'Doublesplit - 999999 in 1

Doublesplit - Agario extension, with zoom, minimap, helpers, adblocker

  1. // ==UserScript==
  2. // @name 'Doublesplit - 999999 in 1
  3. // @name:ru 'Doublesplit - 999999 в 1
  4. // @name:uk 'Doublesplit - 999999 в 1
  5. // @name:ja 'デルタ - 999999 イン 1
  6. // @name:es 'Doublesplit - 999999 en 1
  7. // @name:zh-CN 'Doublesplit - 999999 合 1
  8. // @name:de 'Doublesplit - 999999 in 1
  9. // @name:ar 'دلتا - 999999 في 1
  10. // @description Doublesplit - Agario extension, with zoom, minimap, helpers, adblocker
  11. // @description:es Doublesplit - extensión para Agario con zoom, minimapa, ayudas y bloqueador de anuncios
  12. // @description:ru Doublesplit — расширение для Agario с зумом, миникартой, помощниками и блокировщиком рекламы
  13. // @description:zh-CN Doublesplit - agario 的扩展,带有缩放、小地图、辅助功能和广告拦截器
  14. // @description:uk Doublesplit — розширення для Agario із зумом, мінікартою, помічниками та блокувальником реклами
  15. // @description:tr Doublesplit - Agario için yakınlaştırma, mini harita, yardımcılar ve reklam engelleyici uzantısı
  16. // @description:de Doublesplit – Erweiterung für Agario mit Zoom, Minikarte, Helfern und Werbeblocker
  17. // @description:ja Doublesplit - Agario のズーム、ミニマップ、ヘルパー、広告ブロッカー付き拡張機能
  18. // @description:pl Doublesplit - rozszerzenie do Agario z powiększeniem, minimapą, pomocnikami i blokadą reklam
  19. // @description:fr Doublesplit - extension pour Agario avec zoom, mini-carte, assistants et bloqueur de publicité
  20. // @description:ar دلتا - إضافة لـ Agario مع مانع إعلانات
  21. // @version 8.0.4
  22. // @namespace doublesplit.agar
  23. // @author neo
  24. // @icon https://deltav4.gitlab.io/favicon.ico
  25. // @match *://*.agar.io/
  26. // @run-at document-start
  27. // @grant GM.xmlHttpRequest
  28. // @grant GM.registerMenuCommand
  29. // @grant window.close
  30. // @grant unsafeWindow
  31. // @license MPL-2.0
  32. // @antifeature ads
  33. // @source https://github.com/doublesplit/lite-ext/
  34. // @supportURL https://discord.gg/HHmyKW6
  35. // @require https://cdnjs.cloudflare.com/ajax/libs/preact/10.21.0/preact.umd.min.js
  36. // @require https://cdnjs.cloudflare.com/ajax/libs/preact/10.21.0/hooks.umd.min.js
  37. // @require https://cdnjs.cloudflare.com/ajax/libs/preact/10.21.0/compat.umd.min.js
  38. // ==/UserScript==
  39.  
  40. /*
  41. GREASYFORK VERSION
  42.  
  43. en: If this user script does not start, write me a discord
  44. ru: Если данное расширение не запускается, напишите мне в дискорд
  45. https://discord.gg/HHmyKW6
  46. */
  47.  
  48. (function (window) {
  49. /******/ // runtime can't be in strict mode because a global variable is assign and maybe created.
  50. /******/ var __webpack_modules__ = ({
  51.  
  52. /***/ 32:
  53. /***/ ((module) => {
  54.  
  55. "use strict";
  56. module.exports = preact;
  57.  
  58. /***/ }),
  59.  
  60. /***/ 56:
  61. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  62.  
  63. "use strict";
  64.  
  65.  
  66. /* istanbul ignore next */
  67. function setAttributesWithoutAttributes(styleElement) {
  68. var nonce = true ? __webpack_require__.nc : 0;
  69. if (nonce) {
  70. styleElement.setAttribute("nonce", nonce);
  71. }
  72. }
  73. module.exports = setAttributesWithoutAttributes;
  74.  
  75. /***/ }),
  76.  
  77. /***/ 72:
  78. /***/ ((module) => {
  79.  
  80. "use strict";
  81.  
  82.  
  83. var stylesInDOM = [];
  84. function getIndexByIdentifier(identifier) {
  85. var result = -1;
  86. for (var i = 0; i < stylesInDOM.length; i++) {
  87. if (stylesInDOM[i].identifier === identifier) {
  88. result = i;
  89. break;
  90. }
  91. }
  92. return result;
  93. }
  94. function modulesToDom(list, options) {
  95. var idCountMap = {};
  96. var identifiers = [];
  97. for (var i = 0; i < list.length; i++) {
  98. var item = list[i];
  99. var id = options.base ? item[0] + options.base : item[0];
  100. var count = idCountMap[id] || 0;
  101. var identifier = "".concat(id, " ").concat(count);
  102. idCountMap[id] = count + 1;
  103. var indexByIdentifier = getIndexByIdentifier(identifier);
  104. var obj = {
  105. css: item[1],
  106. media: item[2],
  107. sourceMap: item[3],
  108. supports: item[4],
  109. layer: item[5]
  110. };
  111. if (indexByIdentifier !== -1) {
  112. stylesInDOM[indexByIdentifier].references++;
  113. stylesInDOM[indexByIdentifier].updater(obj);
  114. } else {
  115. var updater = addElementStyle(obj, options);
  116. options.byIndex = i;
  117. stylesInDOM.splice(i, 0, {
  118. identifier: identifier,
  119. updater: updater,
  120. references: 1
  121. });
  122. }
  123. identifiers.push(identifier);
  124. }
  125. return identifiers;
  126. }
  127. function addElementStyle(obj, options) {
  128. var api = options.domAPI(options);
  129. api.update(obj);
  130. var updater = function updater(newObj) {
  131. if (newObj) {
  132. if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
  133. return;
  134. }
  135. api.update(obj = newObj);
  136. } else {
  137. api.remove();
  138. }
  139. };
  140. return updater;
  141. }
  142. module.exports = function (list, options) {
  143. options = options || {};
  144. list = list || [];
  145. var lastIdentifiers = modulesToDom(list, options);
  146. return function update(newList) {
  147. newList = newList || [];
  148. for (var i = 0; i < lastIdentifiers.length; i++) {
  149. var identifier = lastIdentifiers[i];
  150. var index = getIndexByIdentifier(identifier);
  151. stylesInDOM[index].references--;
  152. }
  153. var newLastIdentifiers = modulesToDom(newList, options);
  154. for (var _i = 0; _i < lastIdentifiers.length; _i++) {
  155. var _identifier = lastIdentifiers[_i];
  156. var _index = getIndexByIdentifier(_identifier);
  157. if (stylesInDOM[_index].references === 0) {
  158. stylesInDOM[_index].updater();
  159. stylesInDOM.splice(_index, 1);
  160. }
  161. }
  162. lastIdentifiers = newLastIdentifiers;
  163. };
  164. };
  165.  
  166. /***/ }),
  167.  
  168. /***/ 102:
  169. /***/ ((module) => {
  170.  
  171. "use strict";
  172.  
  173.  
  174. /*
  175. MIT License http://www.opensource.org/licenses/mit-license.php
  176. Author Tobias Koppers @sokra
  177. */
  178. module.exports = function (cssWithMappingToString) {
  179. var list = [];
  180.  
  181. // return the list of modules as css string
  182. list.toString = function toString() {
  183. return this.map(function (item) {
  184. var content = "";
  185. var needLayer = typeof item[5] !== "undefined";
  186. if (item[4]) {
  187. content += "@supports (".concat(item[4], ") {");
  188. }
  189. if (item[2]) {
  190. content += "@media ".concat(item[2], " {");
  191. }
  192. if (needLayer) {
  193. content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
  194. }
  195. content += cssWithMappingToString(item);
  196. if (needLayer) {
  197. content += "}";
  198. }
  199. if (item[2]) {
  200. content += "}";
  201. }
  202. if (item[4]) {
  203. content += "}";
  204. }
  205. return content;
  206. }).join("");
  207. };
  208.  
  209. // import a list of modules into the list
  210. list.i = function i(modules, media, dedupe, supports, layer) {
  211. if (typeof modules === "string") {
  212. modules = [[null, modules, undefined]];
  213. }
  214. var alreadyImportedModules = {};
  215. if (dedupe) {
  216. for (var k = 0; k < this.length; k++) {
  217. var id = this[k][0];
  218. if (id != null) {
  219. alreadyImportedModules[id] = true;
  220. }
  221. }
  222. }
  223. for (var _k = 0; _k < modules.length; _k++) {
  224. var item = [].concat(modules[_k]);
  225. if (dedupe && alreadyImportedModules[item[0]]) {
  226. continue;
  227. }
  228. if (typeof layer !== "undefined") {
  229. if (typeof item[5] === "undefined") {
  230. item[5] = layer;
  231. } else {
  232. item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
  233. item[5] = layer;
  234. }
  235. }
  236. if (media) {
  237. if (!item[2]) {
  238. item[2] = media;
  239. } else {
  240. item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
  241. item[2] = media;
  242. }
  243. }
  244. if (supports) {
  245. if (!item[4]) {
  246. item[4] = "".concat(supports);
  247. } else {
  248. item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
  249. item[4] = supports;
  250. }
  251. }
  252. list.push(item);
  253. }
  254. };
  255. return list;
  256. };
  257.  
  258. /***/ }),
  259.  
  260. /***/ 113:
  261. /***/ ((module) => {
  262.  
  263. "use strict";
  264.  
  265.  
  266. /* istanbul ignore next */
  267. function styleTagTransform(css, styleElement) {
  268. if (styleElement.styleSheet) {
  269. styleElement.styleSheet.cssText = css;
  270. } else {
  271. while (styleElement.firstChild) {
  272. styleElement.removeChild(styleElement.firstChild);
  273. }
  274. styleElement.appendChild(document.createTextNode(css));
  275. }
  276. }
  277. module.exports = styleTagTransform;
  278.  
  279. /***/ }),
  280.  
  281. /***/ 390:
  282. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  283.  
  284. "use strict";
  285. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  286. /* harmony export */ Minimap: () => (/* binding */ Minimap)
  287. /* harmony export */ });
  288. /* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(632);
  289. /* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact_hooks__WEBPACK_IMPORTED_MODULE_0__);
  290. /* harmony import */ var _settings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(701);
  291. /* harmony import */ var _Contexts__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(413);
  292. /* harmony import */ var preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(557);
  293. /* module decorator */ module = __webpack_require__.hmd(module);
  294.  
  295.  
  296.  
  297.  
  298. function Minimap() {
  299. const app = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(_Contexts__WEBPACK_IMPORTED_MODULE_2__.AppContext);
  300. const [minimapEnabled, setMinimapEnabled] = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(_settings__WEBPACK_IMPORTED_MODULE_1__.settings.raw.Minimap);
  301. const $canvas = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  302. const $sectors = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  303. const $minimap = (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
  304. (0,preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect)(() => {
  305. const ctx = $canvas.current.getContext('2d');
  306. const sectors = $sectors.current.querySelectorAll('.sector');
  307. let sectorIndex = -1;
  308. let rafId;
  309. function render() {
  310. const sectorId = app.world.drawMinimap(ctx, $canvas.current);
  311. setSector(sectorId);
  312. rafId = requestAnimationFrame(render);
  313. }
  314. function setSector(index) {
  315. if (index === sectorIndex || index < 0) return;
  316. index = Math.min(index, sectors.length - 1);
  317. sectorIndex !== -1 && sectors[sectorIndex].classList.remove('active');
  318. sectors[index].classList.add('active');
  319. sectorIndex = index;
  320. }
  321. if (minimapEnabled) rafId = requestAnimationFrame(render);
  322. $minimap.current.style.display = minimapEnabled ? '' : 'none';
  323. const minimapListener = _settings__WEBPACK_IMPORTED_MODULE_1__.settings.on('Minimap', value => {
  324. setMinimapEnabled(value);
  325. });
  326. return () => {
  327. _settings__WEBPACK_IMPORTED_MODULE_1__.settings.removeListener('Minimap', minimapListener);
  328. cancelAnimationFrame(rafId);
  329. };
  330. }, [minimapEnabled]);
  331. return (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", {
  332. ref: $minimap,
  333. id: "ds-minimap",
  334. style: {
  335. zIndex: 1000
  336. },
  337. children: [(0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", {
  338. class: "background",
  339. ref: $sectors,
  340. children: [(0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  341. class: "sector",
  342. children: "A1"
  343. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  344. class: "sector",
  345. children: "A2"
  346. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  347. class: "sector",
  348. children: "A3"
  349. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  350. class: "sector",
  351. children: "A4"
  352. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  353. class: "sector",
  354. children: "A5"
  355. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  356. class: "sector",
  357. children: "B1"
  358. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  359. class: "sector",
  360. children: "B2"
  361. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  362. class: "sector",
  363. children: "B3"
  364. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  365. class: "sector",
  366. children: "B4"
  367. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  368. class: "sector",
  369. children: "B5"
  370. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  371. class: "sector",
  372. children: "C1"
  373. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  374. class: "sector",
  375. children: "C2"
  376. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  377. class: "sector",
  378. children: "C3"
  379. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  380. class: "sector",
  381. children: "C4"
  382. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  383. class: "sector",
  384. children: "C5"
  385. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  386. class: "sector",
  387. children: "D1"
  388. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  389. class: "sector",
  390. children: "D2"
  391. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  392. class: "sector",
  393. children: "D3"
  394. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  395. class: "sector",
  396. children: "D4"
  397. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  398. class: "sector",
  399. children: "D5"
  400. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  401. class: "sector",
  402. children: "E1"
  403. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  404. class: "sector",
  405. children: "E2"
  406. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  407. class: "sector",
  408. children: "E3"
  409. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  410. class: "sector",
  411. children: "E4"
  412. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", {
  413. class: "sector",
  414. children: "E5"
  415. })]
  416. }), (0,preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("canvas", {
  417. id: "minimap",
  418. width: "200",
  419. height: "200",
  420. ref: $canvas
  421. })]
  422. });
  423. }
  424. if ('hot' in module) {
  425. // @ts-ignore
  426. module['hot'].accept();
  427. }
  428.  
  429. /***/ }),
  430.  
  431. /***/ 397:
  432. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  433.  
  434. "use strict";
  435. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  436. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  437. /* harmony export */ });
  438. /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(653);
  439. /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
  440. /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(102);
  441. /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
  442. // Imports
  443.  
  444.  
  445. var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
  446. // Module
  447. ___CSS_LOADER_EXPORT___.push([module.id, `/*! tailwindcss v4.1.4 | MIT License | https://tailwindcss.com */
  448. @layer properties;
  449. @layer theme, base, components, utilities;
  450. @layer theme {
  451. :root, :host {
  452. --font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
  453. "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  454. --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
  455. "Courier New", monospace;
  456. --spacing: 0.25rem;
  457. --default-font-family: var(--font-sans);
  458. --default-mono-font-family: var(--font-mono);
  459. }
  460. }
  461. @layer base {
  462. *,
  463. ::after,
  464. ::before,
  465. ::backdrop,
  466. ::file-selector-button {
  467. box-sizing: border-box;
  468. margin: 0;
  469. padding: 0;
  470. border: 0 solid;
  471. }
  472. html,
  473. :host {
  474. line-height: 1.5;
  475. -webkit-text-size-adjust: 100%;
  476. -moz-tab-size: 4;
  477. -o-tab-size: 4;
  478. tab-size: 4;
  479. font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
  480. font-feature-settings: var(--default-font-feature-settings, normal);
  481. font-variation-settings: var(--default-font-variation-settings, normal);
  482. -webkit-tap-highlight-color: transparent;
  483. }
  484. hr {
  485. height: 0;
  486. color: inherit;
  487. border-top-width: 1px;
  488. }
  489. abbr:where([title]) {
  490. -webkit-text-decoration: underline dotted;
  491. text-decoration: underline dotted;
  492. }
  493. h1,
  494. h2,
  495. h3,
  496. h4,
  497. h5,
  498. h6 {
  499. font-size: inherit;
  500. font-weight: inherit;
  501. }
  502. a {
  503. color: inherit;
  504. -webkit-text-decoration: inherit;
  505. text-decoration: inherit;
  506. }
  507. b,
  508. strong {
  509. font-weight: bolder;
  510. }
  511. code,
  512. kbd,
  513. samp,
  514. pre {
  515. font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  516. font-feature-settings: var(--default-mono-font-feature-settings, normal);
  517. font-variation-settings: var(--default-mono-font-variation-settings, normal);
  518. font-size: 1em;
  519. }
  520. small {
  521. font-size: 80%;
  522. }
  523. sub,
  524. sup {
  525. font-size: 75%;
  526. line-height: 0;
  527. position: relative;
  528. vertical-align: baseline;
  529. }
  530. sub {
  531. bottom: -0.25em;
  532. }
  533. sup {
  534. top: -0.5em;
  535. }
  536. table {
  537. text-indent: 0;
  538. border-color: inherit;
  539. border-collapse: collapse;
  540. }
  541. :-moz-focusring {
  542. outline: auto;
  543. }
  544. progress {
  545. vertical-align: baseline;
  546. }
  547. summary {
  548. display: list-item;
  549. }
  550. ol,
  551. ul,
  552. menu {
  553. list-style: none;
  554. }
  555. img,
  556. svg,
  557. video,
  558. canvas,
  559. audio,
  560. iframe,
  561. embed,
  562. object {
  563. display: block;
  564. vertical-align: middle;
  565. }
  566. img,
  567. video {
  568. max-width: 100%;
  569. height: auto;
  570. }
  571. button,
  572. input,
  573. select,
  574. optgroup,
  575. textarea,
  576. ::file-selector-button {
  577. font: inherit;
  578. font-feature-settings: inherit;
  579. font-variation-settings: inherit;
  580. letter-spacing: inherit;
  581. color: inherit;
  582. border-radius: 0;
  583. background-color: transparent;
  584. opacity: 1;
  585. }
  586. :where(select:is([multiple], [size])) optgroup {
  587. font-weight: bolder;
  588. }
  589. :where(select:is([multiple], [size])) optgroup option {
  590. padding-inline-start: 20px;
  591. }
  592. ::file-selector-button {
  593. margin-inline-end: 4px;
  594. }
  595. ::-moz-placeholder {
  596. opacity: 1;
  597. }
  598. ::placeholder {
  599. opacity: 1;
  600. }
  601. @supports (not (-webkit-appearance: -apple-pay-button)) or
  602. (contain-intrinsic-size: 1px) {
  603. ::-moz-placeholder {
  604. color: currentcolor;
  605. @supports (color: color-mix(in lab, red, red)) {
  606. color: color-mix(in oklab, currentcolor 50%, transparent);
  607. }
  608. }
  609. ::placeholder {
  610. color: currentcolor;
  611. @supports (color: color-mix(in lab, red, red)) {
  612. color: color-mix(in oklab, currentcolor 50%, transparent);
  613. }
  614. }
  615. }
  616. textarea {
  617. resize: vertical;
  618. }
  619. ::-webkit-search-decoration {
  620. -webkit-appearance: none;
  621. }
  622. ::-webkit-date-and-time-value {
  623. min-height: 1lh;
  624. text-align: inherit;
  625. }
  626. ::-webkit-datetime-edit {
  627. display: inline-flex;
  628. }
  629. ::-webkit-datetime-edit-fields-wrapper {
  630. padding: 0;
  631. }
  632. ::-webkit-datetime-edit,
  633. ::-webkit-datetime-edit-year-field,
  634. ::-webkit-datetime-edit-month-field,
  635. ::-webkit-datetime-edit-day-field,
  636. ::-webkit-datetime-edit-hour-field,
  637. ::-webkit-datetime-edit-minute-field,
  638. ::-webkit-datetime-edit-second-field,
  639. ::-webkit-datetime-edit-millisecond-field,
  640. ::-webkit-datetime-edit-meridiem-field {
  641. padding-block: 0;
  642. }
  643. :-moz-ui-invalid {
  644. box-shadow: none;
  645. }
  646. button,
  647. input:where([type="button"], [type="reset"], [type="submit"]),
  648. ::file-selector-button {
  649. -webkit-appearance: button;
  650. -moz-appearance: button;
  651. appearance: button;
  652. }
  653. ::-webkit-inner-spin-button,
  654. ::-webkit-outer-spin-button {
  655. height: auto;
  656. }
  657. [hidden]:where(:not([hidden="until-found"])) {
  658. display: none !important;
  659. }
  660. }
  661. @layer utilities {
  662. .absolute {
  663. position: absolute !important;
  664. }
  665. .relative {
  666. position: relative !important;
  667. }
  668. .static {
  669. position: static !important;
  670. }
  671. .mx-2 {
  672. margin-inline: calc(var(--spacing) * 2) !important;
  673. }
  674. .contents {
  675. display: contents !important;
  676. }
  677. .flex {
  678. display: flex !important;
  679. }
  680. .grid {
  681. display: grid !important;
  682. }
  683. .inline {
  684. display: inline !important;
  685. }
  686. .w-4 {
  687. width: calc(var(--spacing) * 4) !important;
  688. }
  689. .w-full {
  690. width: 100% !important;
  691. }
  692. .grow {
  693. flex-grow: 1 !important;
  694. }
  695. .transform {
  696. transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,) !important;
  697. }
  698. .resize {
  699. resize: both !important;
  700. }
  701. .flex-row {
  702. flex-direction: row !important;
  703. }
  704. .gap-2 {
  705. gap: calc(var(--spacing) * 2) !important;
  706. }
  707. .p-1 {
  708. padding: calc(var(--spacing) * 1) !important;
  709. }
  710. .text-left {
  711. text-align: left !important;
  712. }
  713. }
  714. *,
  715. ::after,
  716. ::before,
  717. ::backdrop,
  718. ::file-selector-button {
  719. box-sizing: border-box;
  720. margin: 0;
  721. padding: 0;
  722. border: 0 solid;
  723. }
  724. html,
  725. :host {
  726. line-height: 1.5;
  727. -webkit-text-size-adjust: 100%;
  728. -moz-tab-size: 4;
  729. -o-tab-size: 4;
  730. tab-size: 4;
  731. font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji');
  732. font-feature-settings: var(--default-font-feature-settings, normal);
  733. font-variation-settings: var(--default-font-variation-settings, normal);
  734. -webkit-tap-highlight-color: transparent;
  735. }
  736. hr {
  737. height: 0;
  738. color: inherit;
  739. border-top-width: 1px;
  740. }
  741. abbr:where([title]) {
  742. -webkit-text-decoration: underline dotted;
  743. text-decoration: underline dotted;
  744. }
  745. h1,
  746. h2,
  747. h3,
  748. h4,
  749. h5,
  750. h6 {
  751. font-size: inherit;
  752. font-weight: inherit;
  753. }
  754. a {
  755. color: inherit;
  756. -webkit-text-decoration: inherit;
  757. text-decoration: inherit;
  758. }
  759. b,
  760. strong {
  761. font-weight: bolder;
  762. }
  763. code,
  764. kbd,
  765. samp,
  766. pre {
  767. font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace);
  768. font-feature-settings: var(--default-mono-font-feature-settings, normal);
  769. font-variation-settings: var(--default-mono-font-variation-settings, normal);
  770. font-size: 1em;
  771. }
  772. small {
  773. font-size: 80%;
  774. }
  775. sub,
  776. sup {
  777. font-size: 75%;
  778. line-height: 0;
  779. position: relative;
  780. vertical-align: baseline;
  781. }
  782. sub {
  783. bottom: -0.25em;
  784. }
  785. sup {
  786. top: -0.5em;
  787. }
  788. table {
  789. text-indent: 0;
  790. border-color: inherit;
  791. border-collapse: collapse;
  792. }
  793. :-moz-focusring {
  794. outline: auto;
  795. }
  796. progress {
  797. vertical-align: baseline;
  798. }
  799. summary {
  800. display: list-item;
  801. }
  802. ol,
  803. ul,
  804. menu {
  805. list-style: none;
  806. }
  807. img,
  808. svg,
  809. video,
  810. canvas,
  811. audio,
  812. iframe,
  813. embed,
  814. object {
  815. display: block;
  816. vertical-align: middle;
  817. }
  818. img,
  819. video {
  820. max-width: 100%;
  821. height: auto;
  822. }
  823. button,
  824. input,
  825. select,
  826. optgroup,
  827. textarea,
  828. ::file-selector-button {
  829. font: inherit;
  830. font-feature-settings: inherit;
  831. font-variation-settings: inherit;
  832. letter-spacing: inherit;
  833. color: inherit;
  834. border-radius: 0;
  835. background-color: transparent;
  836. opacity: 1;
  837. }
  838. :where(select:is([multiple], [size])) optgroup {
  839. font-weight: bolder;
  840. }
  841. :where(select:is([multiple], [size])) optgroup option {
  842. padding-inline-start: 20px;
  843. }
  844. ::file-selector-button {
  845. margin-inline-end: 4px;
  846. }
  847. ::-moz-placeholder {
  848. opacity: 1;
  849. }
  850. ::placeholder {
  851. opacity: 1;
  852. }
  853. @supports (not (-webkit-appearance: -apple-pay-button)) or
  854. (contain-intrinsic-size: 1px) {
  855. ::-moz-placeholder {
  856. color: currentcolor;
  857. @supports (color: color-mix(in lab, red, red)) {
  858. color: color-mix(in oklab, currentcolor 50%, transparent);
  859. }
  860. }
  861. ::placeholder {
  862. color: currentcolor;
  863. @supports (color: color-mix(in lab, red, red)) {
  864. color: color-mix(in oklab, currentcolor 50%, transparent);
  865. }
  866. }
  867. }
  868. textarea {
  869. resize: vertical;
  870. }
  871. ::-webkit-search-decoration {
  872. -webkit-appearance: none;
  873. }
  874. ::-webkit-date-and-time-value {
  875. min-height: 1lh;
  876. text-align: inherit;
  877. }
  878. ::-webkit-datetime-edit {
  879. display: inline-flex;
  880. }
  881. ::-webkit-datetime-edit-fields-wrapper {
  882. padding: 0;
  883. }
  884. ::-webkit-datetime-edit,
  885. ::-webkit-datetime-edit-year-field,
  886. ::-webkit-datetime-edit-month-field,
  887. ::-webkit-datetime-edit-day-field,
  888. ::-webkit-datetime-edit-hour-field,
  889. ::-webkit-datetime-edit-minute-field,
  890. ::-webkit-datetime-edit-second-field,
  891. ::-webkit-datetime-edit-millisecond-field,
  892. ::-webkit-datetime-edit-meridiem-field {
  893. padding-block: 0;
  894. }
  895. :-moz-ui-invalid {
  896. box-shadow: none;
  897. }
  898. button,
  899. input:where([type='button'], [type='reset'], [type='submit']),
  900. ::file-selector-button {
  901. -webkit-appearance: button;
  902. -moz-appearance: button;
  903. appearance: button;
  904. }
  905. ::-webkit-inner-spin-button,
  906. ::-webkit-outer-spin-button {
  907. height: auto;
  908. }
  909. [hidden]:where(:not([hidden='until-found'])) {
  910. display: none !important;
  911. }
  912. :root {
  913. --bottom-banner-height: 0px !important;
  914. }
  915. #title {
  916. margin-top: 0 !important;
  917. }
  918. #mainui-play {
  919. height: 595px !important;
  920. }
  921. #mainPanel {
  922. display: flex;
  923. flex-direction: column;
  924. height: 100%;
  925. }
  926. #socialLoginContainer {
  927. position: initial !important;
  928. }
  929. #instructions {
  930. position: initial !important;
  931. display: none !important;
  932. overflow: hidden !important;
  933. flex-direction: column !important;
  934. margin: 0 !important;
  935. }
  936. .play-container {
  937. display: flex;
  938. height: 100%;
  939. padding: 0 !important;
  940. }
  941. #play {
  942. top: initial !important;
  943. }
  944. #nick {
  945. position: initial !important;
  946. left: initial !important;
  947. top: initial !important;
  948. float: initial !important;
  949. }
  950. #skinButton {
  951. position: relative !important;
  952. display: block;
  953. left: initial !important;
  954. width: 46px;
  955. height: 46px;
  956. }
  957. #playnick {
  958. position: initial !important;
  959. display: flex;
  960. flex-direction: row;
  961. flex-wrap: wrap;
  962. justify-content: center;
  963. align-items: center;
  964. }
  965. #socialLoginContainer {
  966. top: initial !important;
  967. margin: 4px 20px 0px 20px !important;
  968. }
  969. .guest {
  970. display: flex;
  971. flex-direction: column;
  972. align-items: center;
  973. }
  974. .menu-addon {
  975. gap: 4px;
  976. display: flex;
  977. flex-direction: column;
  978. align-items: center;
  979. }
  980. .menu-button {
  981. color: #fff;
  982. background-color: #54c800;
  983. border-color: #54c800;
  984. height: 34px;
  985. font-size: 20px;
  986. line-height: 1.5;
  987. padding: 0 0.5rem;
  988. }
  989. .menu-button:hover {
  990. filter: brightness(0.7) contrast(1);
  991. }
  992. .input-addon {
  993. width: 100%;
  994. height: 28px;
  995. }
  996. .circle.green {
  997. position: absolute !important;
  998. }
  999. #settingsButton {
  1000. left: 5px;
  1001. position: absolute !important;
  1002. }
  1003. .circle {
  1004. display: flex;
  1005. justify-content: center;
  1006. }
  1007. .agario-panel {
  1008. margin: 0 auto;
  1009. }
  1010. .tosBox {
  1011. display: none !important;
  1012. }
  1013. @property --tw-rotate-x {
  1014. syntax: "*";
  1015. inherits: false;
  1016. }
  1017. @property --tw-rotate-y {
  1018. syntax: "*";
  1019. inherits: false;
  1020. }
  1021. @property --tw-rotate-z {
  1022. syntax: "*";
  1023. inherits: false;
  1024. }
  1025. @property --tw-skew-x {
  1026. syntax: "*";
  1027. inherits: false;
  1028. }
  1029. @property --tw-skew-y {
  1030. syntax: "*";
  1031. inherits: false;
  1032. }
  1033. @layer properties {
  1034. @supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
  1035. *, ::before, ::after, ::backdrop {
  1036. --tw-rotate-x: initial;
  1037. --tw-rotate-y: initial;
  1038. --tw-rotate-z: initial;
  1039. --tw-skew-x: initial;
  1040. --tw-skew-y: initial;
  1041. }
  1042. }
  1043. }
  1044. `, ""]);
  1045. // Exports
  1046. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
  1047.  
  1048.  
  1049. /***/ }),
  1050.  
  1051. /***/ 413:
  1052. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1053.  
  1054. "use strict";
  1055. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1056. /* harmony export */ AppContext: () => (/* binding */ AppContext)
  1057. /* harmony export */ });
  1058. /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32);
  1059. /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact__WEBPACK_IMPORTED_MODULE_0__);
  1060.  
  1061. const AppContext = (0,preact__WEBPACK_IMPORTED_MODULE_0__.createContext)(null);
  1062.  
  1063. /***/ }),
  1064.  
  1065. /***/ 540:
  1066. /***/ ((module) => {
  1067.  
  1068. "use strict";
  1069.  
  1070.  
  1071. /* istanbul ignore next */
  1072. function insertStyleElement(options) {
  1073. var element = document.createElement("style");
  1074. options.setAttributes(element, options.attributes);
  1075. options.insert(element, options.options);
  1076. return element;
  1077. }
  1078. module.exports = insertStyleElement;
  1079.  
  1080. /***/ }),
  1081.  
  1082. /***/ 557:
  1083. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1084.  
  1085. "use strict";
  1086. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1087. /* harmony export */ Fragment: () => (/* reexport safe */ preact__WEBPACK_IMPORTED_MODULE_0__.Fragment),
  1088. /* harmony export */ jsx: () => (/* binding */ u),
  1089. /* harmony export */ jsxs: () => (/* binding */ u)
  1090. /* harmony export */ });
  1091. /* unused harmony exports jsxAttr, jsxDEV, jsxEscape, jsxTemplate */
  1092. /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(32);
  1093. /* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(preact__WEBPACK_IMPORTED_MODULE_0__);
  1094.  
  1095.  
  1096. var t = /["&<]/;
  1097. function n(r) {
  1098. if (0 === r.length || !1 === t.test(r)) return r;
  1099. for (var e = 0, n = 0, o = "", f = ""; n < r.length; n++) {
  1100. switch (r.charCodeAt(n)) {
  1101. case 34:
  1102. f = "&quot;";
  1103. break;
  1104. case 38:
  1105. f = "&amp;";
  1106. break;
  1107. case 60:
  1108. f = "&lt;";
  1109. break;
  1110. default:
  1111. continue;
  1112. }
  1113. n !== e && (o += r.slice(e, n)), o += f, e = n + 1;
  1114. }
  1115. return n !== e && (o += r.slice(e, n)), o;
  1116. }
  1117. var o = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,
  1118. f = 0,
  1119. i = Array.isArray;
  1120. function u(e, t, n, o, i, u) {
  1121. t || (t = {});
  1122. var a,
  1123. c,
  1124. p = t;
  1125. if ("ref" in p) for (c in p = {}, t) "ref" == c ? a = t[c] : p[c] = t[c];
  1126. var l = {
  1127. type: e,
  1128. props: p,
  1129. key: n,
  1130. ref: a,
  1131. __k: null,
  1132. __: null,
  1133. __b: 0,
  1134. __e: null,
  1135. __c: null,
  1136. constructor: void 0,
  1137. __v: --f,
  1138. __i: -1,
  1139. __u: 0,
  1140. __source: i,
  1141. __self: u
  1142. };
  1143. if ("function" == typeof e && (a = e.defaultProps)) for (c in a) void 0 === p[c] && (p[c] = a[c]);
  1144. return preact__WEBPACK_IMPORTED_MODULE_0__.options.vnode && preact__WEBPACK_IMPORTED_MODULE_0__.options.vnode(l), l;
  1145. }
  1146. function a(r) {
  1147. var t = u(e, {
  1148. tpl: r,
  1149. exprs: [].slice.call(arguments, 1)
  1150. });
  1151. return t.key = t.__v, t;
  1152. }
  1153. var c = {},
  1154. p = /[A-Z]/g;
  1155. function l(e, t) {
  1156. if (r.attr) {
  1157. var f = r.attr(e, t);
  1158. if ("string" == typeof f) return f;
  1159. }
  1160. if ("ref" === e || "key" === e) return "";
  1161. if ("style" === e && "object" == typeof t) {
  1162. var i = "";
  1163. for (var u in t) {
  1164. var a = t[u];
  1165. if (null != a && "" !== a) {
  1166. var l = "-" == u[0] ? u : c[u] || (c[u] = u.replace(p, "-$&").toLowerCase()),
  1167. s = ";";
  1168. "number" != typeof a || l.startsWith("--") || o.test(l) || (s = "px;"), i = i + l + ":" + a + s;
  1169. }
  1170. }
  1171. return e + '="' + i + '"';
  1172. }
  1173. return null == t || !1 === t || "function" == typeof t || "object" == typeof t ? "" : !0 === t ? e : e + '="' + n(t) + '"';
  1174. }
  1175. function s(r) {
  1176. if (null == r || "boolean" == typeof r || "function" == typeof r) return null;
  1177. if ("object" == typeof r) {
  1178. if (void 0 === r.constructor) return r;
  1179. if (i(r)) {
  1180. for (var e = 0; e < r.length; e++) r[e] = s(r[e]);
  1181. return r;
  1182. }
  1183. }
  1184. return n("" + r);
  1185. }
  1186.  
  1187.  
  1188. /***/ }),
  1189.  
  1190. /***/ 632:
  1191. /***/ ((module) => {
  1192.  
  1193. "use strict";
  1194. module.exports = preactHooks;
  1195.  
  1196. /***/ }),
  1197.  
  1198. /***/ 653:
  1199. /***/ ((module) => {
  1200.  
  1201. "use strict";
  1202.  
  1203.  
  1204. module.exports = function (i) {
  1205. return i[1];
  1206. };
  1207.  
  1208. /***/ }),
  1209.  
  1210. /***/ 659:
  1211. /***/ ((module) => {
  1212.  
  1213. "use strict";
  1214.  
  1215.  
  1216. var memo = {};
  1217.  
  1218. /* istanbul ignore next */
  1219. function getTarget(target) {
  1220. if (typeof memo[target] === "undefined") {
  1221. var styleTarget = document.querySelector(target);
  1222.  
  1223. // Special case to return head of iframe instead of iframe itself
  1224. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  1225. try {
  1226. // This will throw an exception if access to iframe is blocked
  1227. // due to cross-origin restrictions
  1228. styleTarget = styleTarget.contentDocument.head;
  1229. } catch (e) {
  1230. // istanbul ignore next
  1231. styleTarget = null;
  1232. }
  1233. }
  1234. memo[target] = styleTarget;
  1235. }
  1236. return memo[target];
  1237. }
  1238.  
  1239. /* istanbul ignore next */
  1240. function insertBySelector(insert, style) {
  1241. var target = getTarget(insert);
  1242. if (!target) {
  1243. throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
  1244. }
  1245. target.appendChild(style);
  1246. }
  1247. module.exports = insertBySelector;
  1248.  
  1249. /***/ }),
  1250.  
  1251. /***/ 701:
  1252. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1253.  
  1254. "use strict";
  1255.  
  1256. // EXPORTS
  1257. __webpack_require__.d(__webpack_exports__, {
  1258. settings: () => (/* binding */ settings)
  1259. });
  1260.  
  1261. // EXTERNAL MODULE: ./Shared/src/utils/Eventify.ts
  1262. var Eventify = __webpack_require__(714);
  1263. ;// ./dev/src/Settngs.ts
  1264.  
  1265. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  1266. class BasicSetting {
  1267. constructor({
  1268. path = 'DEFAULT',
  1269. name = ''
  1270. }) {
  1271. this.exportable = true;
  1272. this.type = 'NONE';
  1273. this._value = null;
  1274. this.default = null;
  1275. this.path = path;
  1276. this.name = name;
  1277. }
  1278. get value() {
  1279. return this._value;
  1280. }
  1281. set value(data) {
  1282. this._value = data;
  1283. }
  1284. setter(data) {
  1285. this.value = data;
  1286. }
  1287. get export() {
  1288. return this.value;
  1289. }
  1290. }
  1291. class Settings extends Eventify.Eventify {
  1292. constructor(descriptions) {
  1293. super();
  1294. this.raw = descriptions;
  1295. const self = this;
  1296. this.proxy = new Proxy(this.raw, {
  1297. set: (target, prop, newValue) => {
  1298. const previous = target[prop].value;
  1299. self.emit('before*', prop, newValue); // before set
  1300. target[prop].setter(newValue);
  1301. try {
  1302. newValue !== previous && self.emit.call(this, prop, newValue, previous); // on set
  1303. newValue !== previous && self.emit('*', prop, newValue, previous); // on any
  1304. } catch (message) {
  1305. console.error(message);
  1306. }
  1307. return true;
  1308. },
  1309. get(target, prop) {
  1310. return target[prop].value;
  1311. }
  1312. });
  1313. }
  1314. import(object) {
  1315. if (!object) return;
  1316. for (const option in this.raw) {
  1317. if (this.raw.hasOwnProperty(option) && object.hasOwnProperty(option)) {
  1318. this.proxy[option] = object[option];
  1319. }
  1320. }
  1321. }
  1322. export() {
  1323. const export_data = {};
  1324. for (const option in this.raw) {
  1325. export_data[option] = this.raw[option].export;
  1326. }
  1327. return export_data;
  1328. }
  1329. restore() {
  1330. for (const opt in this.raw) {
  1331. const option = opt;
  1332. if (this.raw.hasOwnProperty(option)) {
  1333. this.proxy[option] = this.raw[option].default;
  1334. }
  1335. }
  1336. }
  1337. }
  1338. ;// ./dev/src/utils/microColor.ts
  1339. var _a;
  1340. class MicroColor {
  1341. constructor(red = 255, green = 255, blue = 255, alpha = 255) {
  1342. this.r = red;
  1343. this.g = green;
  1344. this.b = blue;
  1345. this.a = alpha;
  1346. this.vector = new Float32Array(4);
  1347. this.bytes = new Uint8Array(4);
  1348. this.dataview = new DataView(this.bytes.buffer);
  1349. this.string = '#000000';
  1350. this.int = 0;
  1351. this.inta = 0;
  1352. this.updVector();
  1353. this.updString();
  1354. this.updInt();
  1355. }
  1356. updVector() {
  1357. this.vector[0] = this.r / 255;
  1358. this.vector[1] = this.g / 255;
  1359. this.vector[2] = this.b / 255;
  1360. this.vector[3] = this.a / 255;
  1361. this.bytes[0] = this.r;
  1362. this.bytes[1] = this.g;
  1363. this.bytes[2] = this.b;
  1364. this.bytes[3] = this.a;
  1365. this.float = this.dataview.getFloat32(0, true);
  1366. this.u32 = this.r | this.g << 8 | this.b << 16 | this.a << 24;
  1367. // for (let i = 0; i < 4; i++) {
  1368. // this.u32 |= this.bytes[i] << (8 * i);
  1369. // }
  1370. }
  1371. updString() {
  1372. this.string = this.toRgb(true);
  1373. }
  1374. updInt() {
  1375. this.int = this.getInt();
  1376. this.inta = this.getInta();
  1377. }
  1378. cloneFrom(t) {
  1379. this.r = t.r;
  1380. this.g = t.g;
  1381. this.b = t.b;
  1382. this.a = t.a;
  1383. this.updVector();
  1384. this.updString();
  1385. return this;
  1386. }
  1387. fromHSL(h, s, l, a = 255) {
  1388. s /= 100;
  1389. l /= 100;
  1390. const c = (1 - Math.abs(2 * l - 1)) * s;
  1391. const x = c * (1 - Math.abs(h / 60 % 2 - 1));
  1392. const m = l - c / 2;
  1393. let r = 0;
  1394. let g = 0;
  1395. let b = 0;
  1396. if (0 <= h && h < 60) {
  1397. r = c, g = x, b = 0;
  1398. } else if (60 <= h && h < 120) {
  1399. r = x, g = c, b = 0;
  1400. } else if (120 <= h && h < 180) {
  1401. r = 0, g = c, b = x;
  1402. } else if (180 <= h && h < 240) {
  1403. r = 0, g = x, b = c;
  1404. } else if (240 <= h && h < 300) {
  1405. r = x, g = 0, b = c;
  1406. } else if (300 <= h && h < 360) {
  1407. r = c, g = 0, b = x;
  1408. }
  1409. // Having obtained RGB, convert channels to hex
  1410. this.r = Math.round((r + m) * 255);
  1411. this.g = Math.round((g + m) * 255);
  1412. this.b = Math.round((b + m) * 255);
  1413. this.a = a;
  1414. return this;
  1415. }
  1416. fromRGB(r, g, b, a = 255) {
  1417. this.r = r;
  1418. this.g = g;
  1419. this.b = b;
  1420. this.a = a;
  1421. this.updVector();
  1422. this.updString();
  1423. return this;
  1424. }
  1425. // fromINTA(int: number, alpha = 255) {
  1426. // const a = (int >> 24) & alpha;
  1427. // return this.fromINT(color);
  1428. // }
  1429. fromINT(int, reorder) {
  1430. this.a = (4278190080 & int) >>> 24;
  1431. this.r = (16711680 & int) >>> 16;
  1432. this.g = (65280 & int) >>> 8;
  1433. this.b = (255 & int) >>> 0;
  1434. if (reorder) Object.assign(this, {
  1435. r: this.a,
  1436. g: this.r,
  1437. b: this.g,
  1438. a: this.b
  1439. });
  1440. this.updVector();
  1441. this.updString();
  1442. return this;
  1443. }
  1444. fromHex(hex) {
  1445. const len = hex.length;
  1446. if (!hex || len !== 7 && len !== 9) return this;
  1447. let i = hex.length === 9 ? 32 : 24;
  1448. const n = parseInt(hex.slice(1), 16);
  1449. const r = n >> (i -= 8) & 255;
  1450. const g = n >> (i -= 8) & 255;
  1451. const b = n >> (i -= 8) & 255;
  1452. const a = i ? n >> i - 8 & 255 : 255;
  1453. return this.fromRGB(r, g, b, a);
  1454. }
  1455. get getNormalFromSecure() {
  1456. return _a.rgbToInt(Math.ceil(this.r / 0.9), Math.ceil(this.g / 0.9), Math.ceil(this.b / 0.9));
  1457. }
  1458. toRgb(useAlpha) {
  1459. return useAlpha ? `rgba(${this.r}, ${this.g}, ${this.b}, ${this.a / 255})` : `rgb(${this.r}, ${this.g}, ${this.b})`;
  1460. }
  1461. getHEXA() {
  1462. let r = this.r.toString(16);
  1463. let g = this.g.toString(16);
  1464. let b = this.b.toString(16);
  1465. let a = this.a.toString(16);
  1466. if (r.length == 1) r = '0' + r;
  1467. if (g.length == 1) g = '0' + g;
  1468. if (b.length == 1) b = '0' + b;
  1469. if (a.length == 1) a = '0' + a;
  1470. return '#' + r + g + b + a;
  1471. }
  1472. getFloat() {
  1473. const bits = this.a << 24 | this.b << 16 | this.g << 8 | this.r;
  1474. return _a.pack(bits & 0xfeffffff);
  1475. }
  1476. getHEX() {
  1477. return '#' + (16777216 | this.getInt()).toString(16).substring(1);
  1478. }
  1479. getInt() {
  1480. return this.r << 16 | this.g << 8 | this.b;
  1481. }
  1482. getIntaShader(alpha) {
  1483. return this.r | this.g << 8 | this.b << 16 | (alpha < 0 ? this.a : alpha) << 24;
  1484. }
  1485. getIntShader() {
  1486. return this.r | this.g << 8 | this.b << 16;
  1487. }
  1488. getInta() {
  1489. return this.a << 24 | this.r << 16 | this.g << 8 | this.b;
  1490. }
  1491. getSecureHex() {
  1492. return _a.colorIntToHex(_a.rgbToInt(~~(this.r * 0.9), ~~(this.g * 0.9), ~~(this.b * 0.9)));
  1493. }
  1494. static rgbToInt(r, g, b) {
  1495. return r << 16 | g << 8 | b;
  1496. }
  1497. static colorIntToHex(int) {
  1498. let s = int.toString(16);
  1499. for (; s.length < 6;) {
  1500. s = '0' + s;
  1501. }
  1502. return '#' + s;
  1503. }
  1504. static inta2shader(int) {
  1505. const a = (0xff000000 & int) >>> 24;
  1506. const r = (0xff0000 & int) >>> 16;
  1507. const g = (0xff00 & int) >>> 8;
  1508. const b = (0xff & int) >>> 0;
  1509. return r | g << 8 | b << 16 | a << 24;
  1510. }
  1511. toHEX8() {
  1512. return `#${(16777216 | this.getInt()).toString(16).substring(1)}${this.a.toString(16).padStart(2, '0')}`;
  1513. }
  1514. static pack(i) {
  1515. _a.int32[0] = i;
  1516. return _a.float32[0];
  1517. }
  1518. static unpack(f) {
  1519. _a.float32[0] = f;
  1520. return _a.int32[0];
  1521. }
  1522. static darkenColor(color, percent) {
  1523. const num = typeof color == 'string' ? parseInt(color, 16) : color,
  1524. amt = Math.round(2.55 * percent),
  1525. R = (num >> 16) + amt,
  1526. B = (num >> 8 & 0x00ff) + amt,
  1527. G = (num & 0x0000ff) + amt;
  1528. return 255 << 24 | R << 16 | G << 8 | B;
  1529. }
  1530. static brighten(int, amount = 10) {
  1531. const a = (4278190080 & int) >>> 24;
  1532. let r = (16711680 & int) >>> 16;
  1533. let g = (65280 & int) >>> 8;
  1534. let b = (255 & int) >>> 0;
  1535. r = Math.max(0, Math.min(255, r - Math.round(255 * -(amount / 100))));
  1536. g = Math.max(0, Math.min(255, g - Math.round(255 * -(amount / 100))));
  1537. b = Math.max(0, Math.min(255, b - Math.round(255 * -(amount / 100))));
  1538. return a << 24 | r << 16 | g << 8 | b;
  1539. }
  1540. static multiplyAlpha(int, alpha) {
  1541. return ((int >>> 24) * alpha & 0xff) << 24 | int & 0x00ffffff;
  1542. }
  1543. }
  1544. _a = MicroColor;
  1545. (() => {
  1546. _a.int8 = new Int8Array(4);
  1547. _a.int32 = new Int32Array(_a.int8.buffer, 0, 1);
  1548. _a.float32 = new Float32Array(_a.int8.buffer, 0, 1);
  1549. })();
  1550. MicroColor.temp = new _a();
  1551. MicroColor.isValidHex = hex => /^#([A-Fa-f0-9]{3,4}){1,2}$/.test(hex);
  1552. MicroColor.getChunksFromString = (st, chunkSize) => st.match(new RegExp(`.{${chunkSize}}`, 'g'));
  1553. MicroColor.convertHexUnitTo256 = hexStr => parseInt(hexStr.repeat(2 / hexStr.length), 16);
  1554. MicroColor.getAlphafloat = (a, alpha) => {
  1555. if (typeof a !== 'undefined') {
  1556. return a / 255;
  1557. }
  1558. if (typeof alpha != 'number' || alpha < 0 || alpha > 1) {
  1559. return 1;
  1560. }
  1561. return alpha;
  1562. };
  1563. MicroColor.hexToRGBA = hex => {
  1564. if (!_a.isValidHex(hex)) {
  1565. throw new Error('Invalid HEX');
  1566. }
  1567. const chunkSize = Math.floor((hex.length - 1) / 3);
  1568. const hexArr = _a.getChunksFromString(hex.slice(1), chunkSize);
  1569. return hexArr.map(_a.convertHexUnitTo256);
  1570. };
  1571. /* harmony default export */ const microColor = (MicroColor);
  1572. ;// ./dev/src/utils/microColorUtils.ts
  1573. let canvas;
  1574. let ctx;
  1575. function parseColorToInta(input) {
  1576. if (!canvas) {
  1577. canvas = document.createElement('canvas');
  1578. canvas.width = canvas.height = 1;
  1579. ctx = canvas.getContext('2d');
  1580. }
  1581. if (!ctx) return 0;
  1582. ctx.clearRect(0, 0, 1, 1);
  1583. try {
  1584. ctx.fillStyle = input;
  1585. } catch (_a) {
  1586. return 0;
  1587. }
  1588. ctx.fillRect(0, 0, 1, 1);
  1589. const [r, g, b, a] = ctx.getImageData(0, 0, 1, 1).data;
  1590. return a << 24 | r << 16 | g << 8 | b;
  1591. }
  1592. ;// ./dev/src/Settings.entities.ts
  1593.  
  1594.  
  1595.  
  1596. class Color extends BasicSetting {
  1597. constructor({
  1598. value = '#FF00FFFF',
  1599. useAlpha = false,
  1600. useCss = false,
  1601. path
  1602. }) {
  1603. super({
  1604. path
  1605. });
  1606. this.microcolor = new microColor();
  1607. this.string = '#FFFFFF'; // hex or rgba
  1608. this.type = 'COL';
  1609. this.value = 0;
  1610. // this.hexa = '#FF00FF66' // 8-Digit hex
  1611. // this.vector = new Float32Array(4)
  1612. // this.rgba = new Uint8Array(4)
  1613. this.alpha = useAlpha;
  1614. this.default = value;
  1615. this.useCss = useCss;
  1616. this.setter(value);
  1617. }
  1618. get export() {
  1619. return this.microcolor.toHEX8();
  1620. }
  1621. toJSON() {
  1622. return this.export;
  1623. }
  1624. setter(string_or_number) {
  1625. let inta = 0;
  1626. if (typeof string_or_number === 'string') {
  1627. if (string_or_number[0] == '#' && (string_or_number.length == 7 || string_or_number.length == 9)) {
  1628. inta = microColor.temp.fromHex(string_or_number).getInta();
  1629. } else {
  1630. inta = parseColorToInta(string_or_number);
  1631. }
  1632. } else {
  1633. inta = string_or_number;
  1634. }
  1635. this.microcolor.fromINT(inta);
  1636. this.value = inta;
  1637. this.string = this.alpha ? this.microcolor.fromINT(inta).toRgb(this.alpha) : this.microcolor.fromINT(inta).getHEX();
  1638. }
  1639. }
  1640. class Select extends BasicSetting {
  1641. constructor({
  1642. name,
  1643. options = {},
  1644. value,
  1645. path
  1646. }) {
  1647. super({
  1648. name,
  1649. path
  1650. });
  1651. this.type = 'SEL';
  1652. this.options = options;
  1653. this.value = value;
  1654. this.default = value;
  1655. this.setter(value);
  1656. }
  1657. get export() {
  1658. return this.value;
  1659. }
  1660. toJSON() {
  1661. return this.export;
  1662. }
  1663. setter(data) {
  1664. let isError = true;
  1665. for (const [, value] of Object.entries(this.options)) {
  1666. if (value === data) {
  1667. isError = false;
  1668. }
  1669. }
  1670. if (isError) {
  1671. console.error('Select: Invalid value ', data, ', fallback to default', this, this.default);
  1672. this.value = this.default;
  1673. return;
  1674. }
  1675. this.value = data;
  1676. }
  1677. }
  1678. class Slider extends BasicSetting {
  1679. constructor({
  1680. name,
  1681. min,
  1682. max,
  1683. step,
  1684. value,
  1685. useCss = false,
  1686. dim = '',
  1687. unit = '',
  1688. path
  1689. }) {
  1690. var _a;
  1691. super({
  1692. name,
  1693. path
  1694. });
  1695. this.type = 'SLD';
  1696. this.min = min;
  1697. this.max = max;
  1698. this.step = step;
  1699. this.value = value;
  1700. this.default = value;
  1701. this.useCss = useCss;
  1702. this.dim = dim;
  1703. this.unit = unit;
  1704. this.precision = ((_a = step.toString().split('.')[1]) === null || _a === void 0 ? void 0 : _a.length) || 0;
  1705. this.setter(value);
  1706. }
  1707. get export() {
  1708. return this.value;
  1709. }
  1710. toJSON() {
  1711. return this.export;
  1712. }
  1713. setter(data) {
  1714. if (typeof data !== 'number' || typeof data == 'undefined') data = this.default;
  1715. this.value = data;
  1716. }
  1717. }
  1718. class Option extends BasicSetting {
  1719. constructor({
  1720. name,
  1721. value,
  1722. path
  1723. }) {
  1724. super({
  1725. name,
  1726. path
  1727. });
  1728. this.type = 'OPT';
  1729. this.value = value;
  1730. this.default = value;
  1731. this.setter(value);
  1732. }
  1733. get export() {
  1734. return this.value;
  1735. }
  1736. toJSON() {
  1737. return this.export;
  1738. }
  1739. setter(data) {
  1740. this.value = data;
  1741. }
  1742. }
  1743. class Input extends BasicSetting {
  1744. constructor({
  1745. name,
  1746. value,
  1747. csshook = s => s,
  1748. path,
  1749. useCss = false,
  1750. options = {}
  1751. }) {
  1752. super({
  1753. name,
  1754. path
  1755. });
  1756. this.type = 'INP';
  1757. this.value = value;
  1758. this.default = value;
  1759. this.csshook = csshook;
  1760. this.useCss = useCss;
  1761. this.options = options;
  1762. this.setter(value);
  1763. }
  1764. get export() {
  1765. return this.value;
  1766. }
  1767. toJSON() {
  1768. return this.export;
  1769. }
  1770. setter(data) {
  1771. if (typeof data !== 'string' || typeof data == 'undefined') data = this.default;
  1772. this.value = String(data);
  1773. }
  1774. cssValue() {
  1775. return this.csshook ? this.csshook(this.value) : this.value;
  1776. }
  1777. }
  1778. ;// ./dev/src/settings.ts
  1779.  
  1780.  
  1781. var Group1;
  1782. (function (Group1) {
  1783. Group1["s_game"] = "gameplayGroup";
  1784. })(Group1 || (Group1 = {}));
  1785. const settingsDescriptions = {
  1786. Minimap: new Option({
  1787. path: Group1.s_game,
  1788. value: true
  1789. }),
  1790. AutoRespawn: new Option({
  1791. path: Group1.s_game,
  1792. value: false
  1793. }),
  1794. AcidMode: new Option({
  1795. path: Group1.s_game,
  1796. value: false
  1797. }),
  1798. LeaderboardTitle: new Input({
  1799. path: Group1.s_game,
  1800. value: 'Doublesplit',
  1801. options: {
  1802. Leaderboard: 'Leaderboard'
  1803. }
  1804. }),
  1805. MapBorder: new Option({
  1806. path: Group1.s_game,
  1807. value: true
  1808. }),
  1809. MapSectors: new Option({
  1810. path: Group1.s_game,
  1811. value: true
  1812. }),
  1813. MapSectorLabels: new Option({
  1814. path: Group1.s_game,
  1815. value: true
  1816. }),
  1817. AutoCollectCoins: new Option({
  1818. path: Group1.s_game,
  1819. value: true
  1820. })
  1821. // label: new Color({ path: Group1.s_game, value: 0x1affa3ff }),
  1822. // miniblob: new Color({ path: Group1.s_game, value: 0x0000ffff }),
  1823. // transparent_cells: new Slider({ path: Group1.s_game, value: 1, min: 0.1, max: 1, step: 0.1 })
  1824. };
  1825. const settings = new Settings(settingsDescriptions);
  1826. Object.assign(window, {
  1827. settings
  1828. });
  1829.  
  1830. /***/ }),
  1831.  
  1832. /***/ 714:
  1833. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  1834.  
  1835. "use strict";
  1836. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  1837. /* harmony export */ EventObject: () => (/* binding */ EventObject),
  1838. /* harmony export */ Eventify: () => (/* binding */ Eventify),
  1839. /* harmony export */ deferrify: () => (/* binding */ deferrify)
  1840. /* harmony export */ });
  1841. /* unused harmony exports EventMixin, eventify, Promised, sleep */
  1842. // https://stackoverflow.com/questions/50071115/typescript-promise-rejection-type
  1843. //https://github.com/microsoft/TypeScript/issues/24122
  1844. function EventMixin(Base) {
  1845. class EventifyBase extends Base {
  1846. constructor() {
  1847. super(...arguments);
  1848. /* Stores events */
  1849. this.events = {};
  1850. /* Stores delegated events */
  1851. // ev: Array<[EventifyBase, EventName<EventMap>, LISTENER]> = [];
  1852. this.ev = [];
  1853. this.blockRemovingListeners = false;
  1854. }
  1855. on(...rest) {
  1856. if (rest.length < 2) throw new Error('Eventify.on() need at least 2 arguments');
  1857. const length = rest.length;
  1858. const listener = rest[length - 1];
  1859. for (let i = 0; length - 1 > i; i++) {
  1860. const event = rest[i];
  1861. if (typeof this.events[event] !== 'object') {
  1862. this.events[event] = [];
  1863. }
  1864. this.events[event].push(listener);
  1865. }
  1866. return listener;
  1867. }
  1868. removeListener(event, listener) {
  1869. if (typeof this.events[event] === 'object') {
  1870. const idx = this.events[event].indexOf(listener);
  1871. if (idx > -1) {
  1872. this.events[event].splice(idx, 1);
  1873. }
  1874. if (this.events[event].length === 0) {
  1875. delete this.events[event];
  1876. }
  1877. }
  1878. }
  1879. emit(event, ...rest) {
  1880. // this.blockRemovingListeners = true;
  1881. if (typeof this.events[event] === 'object') {
  1882. const listeners = this.events[event].slice();
  1883. for (const listener of listeners) {
  1884. listener.apply(this, rest);
  1885. }
  1886. }
  1887. // this.blockRemovingListeners = false;
  1888. }
  1889. once(event, listener) {
  1890. const once_listener = (...args) => {
  1891. this.removeListener(event, once_listener);
  1892. listener.apply(this, args);
  1893. };
  1894. this.on(event, once_listener);
  1895. return once_listener;
  1896. }
  1897. waitTimeout(event, timeout, abortController) {
  1898. const ret = this.waitfor(event, (_, rejector) => {
  1899. const timeoutId = setTimeout(() => {
  1900. const error = new Error(`Waiting "${event.toString()}" Timeout`);
  1901. error.cause = 'timeout';
  1902. rejector(error);
  1903. }, timeout);
  1904. if (abortController) {
  1905. function abort() {
  1906. clearTimeout(timeoutId);
  1907. const error = new Error(`Waiting "${event.toString()}" Aborted`);
  1908. error.cause = 'aborted';
  1909. rejector(error);
  1910. }
  1911. if (abortController.signal.aborted) {
  1912. abort();
  1913. } else {
  1914. abortController.signal.addEventListener('abort', abort, {
  1915. once: true
  1916. });
  1917. }
  1918. }
  1919. return () => {
  1920. clearTimeout(timeoutId);
  1921. };
  1922. });
  1923. return ret;
  1924. }
  1925. waitfor(event, reject_callback) {
  1926. return new Promise((_resolve, _reject) => {
  1927. let destroyCallbackCalled = false;
  1928. const removeListener = () => {
  1929. this.removeListener(event, resolver);
  1930. this.removeListener(event, rejector);
  1931. if (destroyCallbackCalled) return;
  1932. destroyCallbackCalled = true;
  1933. destroyRejectCallback();
  1934. };
  1935. function resolver(v) {
  1936. _resolve(v);
  1937. removeListener();
  1938. }
  1939. function rejector(e) {
  1940. _reject(e);
  1941. removeListener();
  1942. }
  1943. // @ts-ignore
  1944. const destroyRejectCallback = reject_callback(resolver, rejector);
  1945. // eslint-disable-next-line @typescript-eslint/no-explicit-any
  1946. const self = this;
  1947. self.listenSelf(event, resolver);
  1948. self.listenSelf(event, rejector);
  1949. });
  1950. }
  1951. delegateTo(target, ...rest) {
  1952. if (arguments.length < 3) throw new Error('Eventify.delegateTo() need at least 3 arguments');
  1953. const length = rest.length,
  1954. listener = rest[length - 1];
  1955. for (let i = 0; length - 1 > i; i++) {
  1956. const event = rest[i];
  1957. if (typeof target.events[event] !== 'object') {
  1958. target.events[event] = [];
  1959. }
  1960. const _target = target;
  1961. target.ev.push({
  1962. delegated: this,
  1963. event: event,
  1964. listener: listener
  1965. });
  1966. this.on(event, listener);
  1967. }
  1968. return listener;
  1969. }
  1970. listenTo(target, ...rest) {
  1971. return target.delegateTo(this, ...rest);
  1972. }
  1973. listenSelf(...rest) {
  1974. return this.listenTo(this, ...rest);
  1975. }
  1976. /**
  1977. * Removes delegated events
  1978. */
  1979. unlisten() {
  1980. const before = this.ev.slice();
  1981. for (let i = 0; before.length > i; i++) {
  1982. const target = before[i].delegated;
  1983. const eventName = before[i].event;
  1984. const listener = before[i].listener;
  1985. target.removeListener(eventName, listener);
  1986. const idx = this.ev.indexOf(before[i]);
  1987. if (idx > -1) this.ev.splice(idx, 1);
  1988. }
  1989. if (this.ev.length > 0) {
  1990. console.error('We have error in unlisten()', before, this.ev);
  1991. }
  1992. }
  1993. }
  1994. return EventifyBase;
  1995. }
  1996. class Eventify extends EventMixin(class {}) {}
  1997.  
  1998. /* LIB : EVENTIFY ANY OBJECT */
  1999. const props = ['on', 'removeListener', 'emit', 'once', 'listenTo', 'delegateTo', 'listenSelf', 'unlisten', 'ev', 'events', 'waitfor', 'waitTimeout'];
  2000. const eventify = function (object) {
  2001. const EVENTIFY = new Eventify();
  2002. props.forEach(key => {
  2003. Object.defineProperty(object, key, {
  2004. value: EVENTIFY[key],
  2005. enumerable: false,
  2006. writable: false
  2007. });
  2008. });
  2009. return object;
  2010. };
  2011. function EventObject(object) {
  2012. // = instead extends
  2013. const _Eventify = eventify(object);
  2014. const eventObject = new Proxy(object, {
  2015. set(target, prop, val) {
  2016. const prev = object[prop];
  2017. const curr = val;
  2018. // @ts-ignore
  2019. _Eventify.emit('before*', prop, val);
  2020. //@ts-ignore
  2021. object[prop] = val;
  2022. try {
  2023. // @ts-ignore
  2024. _Eventify.emit(prop, val, prev);
  2025. if (prev !== curr) {
  2026. // @ts-ignore
  2027. _Eventify.emit('change:*', prop, val); // @ts-ignore
  2028. _Eventify.emit('change:' + String(prop), val, prev);
  2029. }
  2030. // @ts-ignore
  2031. _Eventify.emit('*', prop, val, prev);
  2032. } catch (message) {
  2033. console.error(message);
  2034. }
  2035. return true;
  2036. }
  2037. });
  2038. Object.defineProperty(eventObject, 'raw', {
  2039. get() {
  2040. return object;
  2041. }
  2042. });
  2043. return eventObject;
  2044. // return eventObject as EventObjectReturnType<OBJ>;
  2045. }
  2046. function deferrify(params) {
  2047. let resolve = null;
  2048. let reject = null;
  2049. const promise = new Promise((resolveFunc, rejectFunc) => {
  2050. var _a;
  2051. resolve = resolveFunc;
  2052. reject = rejectFunc;
  2053. if ((params === null || params === void 0 ? void 0 : params.signal) instanceof Promise) {
  2054. params.signal.catch(reject);
  2055. } else if ((_a = params === null || params === void 0 ? void 0 : params.signal) === null || _a === void 0 ? void 0 : _a.aborted) {
  2056. reject();
  2057. }
  2058. });
  2059. return {
  2060. promise,
  2061. resolve,
  2062. reject
  2063. };
  2064. }
  2065. class Promised extends Promise {
  2066. constructor(executor) {
  2067. super((resolve, reject) => {
  2068. this.resolve = resolve;
  2069. this.reject = reject;
  2070. // @ts-ignore
  2071. if (executor !== undefined) executor(resolve, reject);
  2072. });
  2073. }
  2074. }
  2075. const sleep = delay => function chainDelay(args) {
  2076. return new Promise(res => {
  2077. setTimeout(() => res(args), delay);
  2078. });
  2079. };
  2080.  
  2081. /***/ }),
  2082.  
  2083. /***/ 767:
  2084. /***/ ((module, __webpack_exports__, __webpack_require__) => {
  2085.  
  2086. "use strict";
  2087. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  2088. /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
  2089. /* harmony export */ });
  2090. /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(653);
  2091. /* harmony import */ var _node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
  2092. /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(102);
  2093. /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
  2094. // Imports
  2095.  
  2096.  
  2097. var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
  2098. // Module
  2099. ___CSS_LOADER_EXPORT___.push([module.id, `#minimap {
  2100. position: absolute;
  2101. top: 0;
  2102. left: 0;
  2103. width: 100%;
  2104. height: 100%;
  2105. pointer-events: none;
  2106. }
  2107. #ds-minimap {
  2108. position: fixed;
  2109. bottom: 15px;
  2110. right: 15px;
  2111. width: 200px;
  2112. height: 200px;
  2113. border: 2px solid rgba(255, 255, 255, 0.3);
  2114. border-radius: 10px;
  2115. overflow: hidden;
  2116. background-color: rgba(20, 20, 20, 0.75);
  2117. box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  2118. }
  2119. #ds-minimap .background {
  2120. display: grid;
  2121. grid-template-columns: repeat(5, 1fr);
  2122. grid-template-rows: repeat(5, 1fr);
  2123. width: 100%;
  2124. height: 100%;
  2125. }
  2126. #ds-minimap .sector {
  2127. display: flex;
  2128. justify-content: center;
  2129. align-items: center;
  2130. color: #ddd;
  2131. font-size: 12px;
  2132. border: 1px solid rgba(255, 255, 255, 0.2);
  2133. transition:
  2134. background-color 0.3s ease,
  2135. transform 0.2s ease;
  2136. }
  2137. #ds-minimap .sector.active {
  2138. background-color: rgba(0, 191, 255, 0.3);
  2139. border: 1px solid #00bfff;
  2140. }
  2141. `, ""]);
  2142. // Exports
  2143. /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
  2144.  
  2145.  
  2146. /***/ }),
  2147.  
  2148. /***/ 825:
  2149. /***/ ((module) => {
  2150.  
  2151. "use strict";
  2152.  
  2153.  
  2154. /* istanbul ignore next */
  2155. function apply(styleElement, options, obj) {
  2156. var css = "";
  2157. if (obj.supports) {
  2158. css += "@supports (".concat(obj.supports, ") {");
  2159. }
  2160. if (obj.media) {
  2161. css += "@media ".concat(obj.media, " {");
  2162. }
  2163. var needLayer = typeof obj.layer !== "undefined";
  2164. if (needLayer) {
  2165. css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
  2166. }
  2167. css += obj.css;
  2168. if (needLayer) {
  2169. css += "}";
  2170. }
  2171. if (obj.media) {
  2172. css += "}";
  2173. }
  2174. if (obj.supports) {
  2175. css += "}";
  2176. }
  2177. var sourceMap = obj.sourceMap;
  2178. if (sourceMap && typeof btoa !== "undefined") {
  2179. css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
  2180. }
  2181.  
  2182. // For old IE
  2183. /* istanbul ignore if */
  2184. options.styleTagTransform(css, styleElement, options.options);
  2185. }
  2186. function removeStyleElement(styleElement) {
  2187. // istanbul ignore if
  2188. if (styleElement.parentNode === null) {
  2189. return false;
  2190. }
  2191. styleElement.parentNode.removeChild(styleElement);
  2192. }
  2193.  
  2194. /* istanbul ignore next */
  2195. function domAPI(options) {
  2196. if (typeof document === "undefined") {
  2197. return {
  2198. update: function update() {},
  2199. remove: function remove() {}
  2200. };
  2201. }
  2202. var styleElement = options.insertStyleElement(options);
  2203. return {
  2204. update: function update(obj) {
  2205. apply(styleElement, options, obj);
  2206. },
  2207. remove: function remove() {
  2208. removeStyleElement(styleElement);
  2209. }
  2210. };
  2211. }
  2212. module.exports = domAPI;
  2213.  
  2214. /***/ })
  2215.  
  2216. /******/ });
  2217. /************************************************************************/
  2218. /******/ // The module cache
  2219. /******/ var __webpack_module_cache__ = {};
  2220. /******/
  2221. /******/ // The require function
  2222. /******/ function __webpack_require__(moduleId) {
  2223. /******/ // Check if module is in cache
  2224. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  2225. /******/ if (cachedModule !== undefined) {
  2226. /******/ return cachedModule.exports;
  2227. /******/ }
  2228. /******/ // Create a new module (and put it into the cache)
  2229. /******/ var module = __webpack_module_cache__[moduleId] = {
  2230. /******/ id: moduleId,
  2231. /******/ loaded: false,
  2232. /******/ exports: {}
  2233. /******/ };
  2234. /******/
  2235. /******/ // Execute the module function
  2236. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  2237. /******/
  2238. /******/ // Flag the module as loaded
  2239. /******/ module.loaded = true;
  2240. /******/
  2241. /******/ // Return the exports of the module
  2242. /******/ return module.exports;
  2243. /******/ }
  2244. /******/
  2245. /************************************************************************/
  2246. /******/ /* webpack/runtime/compat get default export */
  2247. /******/ (() => {
  2248. /******/ // getDefaultExport function for compatibility with non-harmony modules
  2249. /******/ __webpack_require__.n = (module) => {
  2250. /******/ var getter = module && module.__esModule ?
  2251. /******/ () => (module['default']) :
  2252. /******/ () => (module);
  2253. /******/ __webpack_require__.d(getter, { a: getter });
  2254. /******/ return getter;
  2255. /******/ };
  2256. /******/ })();
  2257. /******/
  2258. /******/ /* webpack/runtime/define property getters */
  2259. /******/ (() => {
  2260. /******/ // define getter functions for harmony exports
  2261. /******/ __webpack_require__.d = (exports, definition) => {
  2262. /******/ for(var key in definition) {
  2263. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  2264. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  2265. /******/ }
  2266. /******/ }
  2267. /******/ };
  2268. /******/ })();
  2269. /******/
  2270. /******/ /* webpack/runtime/harmony module decorator */
  2271. /******/ (() => {
  2272. /******/ __webpack_require__.hmd = (module) => {
  2273. /******/ module = Object.create(module);
  2274. /******/ if (!module.children) module.children = [];
  2275. /******/ Object.defineProperty(module, 'exports', {
  2276. /******/ enumerable: true,
  2277. /******/ set: () => {
  2278. /******/ throw new Error('ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ' + module.id);
  2279. /******/ }
  2280. /******/ });
  2281. /******/ return module;
  2282. /******/ };
  2283. /******/ })();
  2284. /******/
  2285. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  2286. /******/ (() => {
  2287. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  2288. /******/ })();
  2289. /******/
  2290. /******/ /* webpack/runtime/nonce */
  2291. /******/ (() => {
  2292. /******/ __webpack_require__.nc = undefined;
  2293. /******/ })();
  2294. /******/
  2295. /************************************************************************/
  2296. var __webpack_exports__ = {};
  2297. // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
  2298. (() => {
  2299. "use strict";
  2300.  
  2301. // EXTERNAL MODULE: ./Shared/src/utils/Eventify.ts
  2302. var Eventify = __webpack_require__(714);
  2303. ;// ./dev/src/utils/utils.ts
  2304. /**
  2305. * Finds all nodes in the given tree structure that match the specified condition.
  2306. */
  2307. function find_node(where = window['agarApp'].home, cond) {
  2308. const results = [];
  2309. const find_static = (where = window['agarApp'].home, cond) => {
  2310. function each_children(child, depth) {
  2311. depth += 1;
  2312. child.forEach(ch => {
  2313. if (cond(ch, depth)) results.push(ch);
  2314. ch.children && each_children(ch.children, depth);
  2315. });
  2316. }
  2317. each_children(where, -1);
  2318. return results;
  2319. };
  2320. function each_children(child, depth) {
  2321. var _a, _b, _c, _d, _e, _f, _g;
  2322. depth += 1;
  2323. if (cond(child, depth)) results.push(child);
  2324. child._staticTrees && find_static(child._staticTrees, cond);
  2325. // console.log(depth, 'TAG:', child, child.$vnode?.tag)
  2326. (_a = child.$children) === null || _a === void 0 ? void 0 : _a.forEach(ch => {
  2327. each_children(ch, depth);
  2328. });
  2329. (_b = child.children) === null || _b === void 0 ? void 0 : _b.forEach(ch => {
  2330. each_children(ch, depth);
  2331. });
  2332. (_d = (_c = child._vnode) === null || _c === void 0 ? void 0 : _c.children) === null || _d === void 0 ? void 0 : _d.forEach(ch => {
  2333. each_children(ch, depth);
  2334. });
  2335. (_g = (_f = (_e = child._vnode) === null || _e === void 0 ? void 0 : _e.componentOptions) === null || _f === void 0 ? void 0 : _f.children) === null || _g === void 0 ? void 0 : _g.forEach(ch => {
  2336. each_children(ch, depth);
  2337. });
  2338. }
  2339. each_children(where, -1);
  2340. return results;
  2341. }
  2342. /**
  2343. @example
  2344. overrideMethod(ctx, 'drawImage', (originalMethod, args) => {
  2345. return originalMethod.apply(ctx, args);
  2346. })
  2347. */
  2348. function overrideMethod(obj, methodName, getMethod) {
  2349. const originalMethod = obj[methodName];
  2350. obj[methodName] = function () {
  2351. return getMethod(originalMethod, arguments);
  2352. };
  2353. }
  2354. function overridePrototype(obj, methodName, getMethod) {
  2355. const originalMethod = obj[methodName];
  2356. return obj[methodName] = getMethod(originalMethod);
  2357. }
  2358. const updateCssString = (() => {
  2359. const records = {};
  2360. return (name, css) => {
  2361. if (!records[name]) {
  2362. const style = document.createElement('style');
  2363. style.setAttribute('data-css-name', name);
  2364. document.head.appendChild(style);
  2365. records[name] = style;
  2366. }
  2367. records[name].textContent = css;
  2368. };
  2369. })();
  2370. function setCssVariable(_line, name, value, dimension) {
  2371. const root = document.body;
  2372. if (dimension) value += dimension;
  2373. if (value === 0) {
  2374. value = 'none';
  2375. }
  2376. root.style.setProperty(`--${name}`, String(value));
  2377. }
  2378. function camelCaseToWords(s) {
  2379. const result = s.replace(/([A-Z])/g, ' $1');
  2380. return result.charAt(0).toUpperCase() + result.slice(1);
  2381. }
  2382. ;// ./dev/src/agario-patches.ts
  2383.  
  2384. function exposeHxClasses() {
  2385. let $hxClasses;
  2386. const targetProperty = 'ApplicationMain';
  2387. return new Promise(resolve => {
  2388. Object.defineProperty(Object.prototype, targetProperty, {
  2389. set: function (value) {
  2390. delete Object.prototype[targetProperty];
  2391. this.ApplicationMain = value;
  2392. $hxClasses = value;
  2393. Object.assign(window, {
  2394. $hxClasses: this
  2395. });
  2396. resolve(this);
  2397. },
  2398. get: function () {
  2399. return $hxClasses;
  2400. },
  2401. configurable: true,
  2402. enumerable: false
  2403. });
  2404. });
  2405. }
  2406. function coreInitPatch() {
  2407. overrideMethod(window['core'], 'setFpsCap', originalMethod => {
  2408. return originalMethod(-1);
  2409. });
  2410. }
  2411. function coreUiPatch() {
  2412. const title = document.querySelector('#title');
  2413. title.innerHTML = 'Doublesplit';
  2414. title.style.fontSize = '2.5em';
  2415. }
  2416. function coreAdsPatch() {
  2417. var _a, _b, _c, _d, _e;
  2418. // Ads delete
  2419. (_a = find_node(undefined, child => {
  2420. var _a;
  2421. return (_a = child.$vnode) === null || _a === void 0 ? void 0 : _a.tag.includes('-ads');
  2422. })[0]) === null || _a === void 0 ? void 0 : _a.$destroy();
  2423. (_b = find_node(undefined, child => {
  2424. var _a;
  2425. return (_a = child.$vnode) === null || _a === void 0 ? void 0 : _a.tag.includes('-promo');
  2426. })[0]) === null || _b === void 0 ? void 0 : _b.$destroy();
  2427. find_node(undefined, child => {
  2428. var _a, _b;
  2429. return (_b = (_a = child.elm) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.includes('agar-io');
  2430. }).forEach(child => {
  2431. var _a;
  2432. (_a = child.elm.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(child.elm);
  2433. });
  2434. find_node(undefined, child => child.playVideoAd).forEach(elem => {
  2435. elem.getVideoTimestamp = () => Date.now();
  2436. });
  2437. {
  2438. const vnode = (_c = find_node(undefined, child => Object.getPrototypeOf(child).hasOwnProperty('hasBottomAd'))) === null || _c === void 0 ? void 0 : _c[0];
  2439. if (vnode) {
  2440. Object.defineProperties(vnode, {
  2441. fastEntry: {
  2442. get: () => true
  2443. }
  2444. });
  2445. }
  2446. }
  2447. // Youtube, FB buttons
  2448. {
  2449. const vnode = find_node(undefined, child => {
  2450. var _a;
  2451. if (((_a = child === null || child === void 0 ? void 0 : child.elm) === null || _a === void 0 ? void 0 : _a.id) == 'socialButtons') return true;
  2452. })[0];
  2453. if (vnode) {
  2454. vnode.elm.parentElement.removeChild(vnode.elm);
  2455. }
  2456. }
  2457. // Skin floating badge
  2458. {
  2459. const bubble = find_node(undefined, child => {
  2460. var _a, _b;
  2461. return (_b = (_a = child.data) === null || _a === void 0 ? void 0 : _a.staticClass) === null || _b === void 0 ? void 0 : _b.includes('bubble');
  2462. })[0];
  2463. (_d = bubble === null || bubble === void 0 ? void 0 : bubble.elm) === null || _d === void 0 ? void 0 : _d.parentElement.removeChild(bubble === null || bubble === void 0 ? void 0 : bubble.elm);
  2464. }
  2465. {
  2466. const vnode = (_e = find_node(undefined, child => Object.getPrototypeOf(child).hasOwnProperty('hasBottomAd'))) === null || _e === void 0 ? void 0 : _e[0];
  2467. if (vnode) {
  2468. ['hasBottomAd', 'hasSideAds'].map(prop => {
  2469. vnode._computedWatchers[prop]['getter'] = () => false;
  2470. });
  2471. Object.defineProperties(vnode, {
  2472. hasBottomAd: {
  2473. get: () => false
  2474. },
  2475. // hasSideAds: {get:()=> false},
  2476. // hasTopAd: {get:()=> false},
  2477. // showSideBanners: {get:()=> false},
  2478. // showBottomBanners: {get:()=> false},
  2479. fastEntry: {
  2480. get: () => true
  2481. }
  2482. });
  2483. }
  2484. }
  2485. document.documentElement.style.setProperty(`--bottom-banner-height`, '0px');
  2486. let agarapp = window['agarApp'];
  2487. Object.defineProperty(window, 'agarApp', {
  2488. get() {
  2489. return agarapp;
  2490. },
  2491. set(value) {
  2492. agarapp = value;
  2493. onAgarApp();
  2494. }
  2495. });
  2496. function onAgarApp() {
  2497. var _a, _b, _c;
  2498. var _d;
  2499. (_a = (_d = window['agarApp']).ads) !== null && _a !== void 0 ? _a : _d.ads = {};
  2500. Object.assign(window['agarApp'].ads, {
  2501. requestAds() {},
  2502. requestAd() {},
  2503. refreshAd() {},
  2504. destroyAd() {},
  2505. adSlots() {},
  2506. enableTargetedAds() {},
  2507. disableTargetedAds() {},
  2508. isTargeted() {},
  2509. supersonicAds: {
  2510. BrandConnectReadyEvent() {},
  2511. BrandConnectDoneEvent() {},
  2512. BrandConnectOpenEvent() {},
  2513. BrandConnectCloseEvent() {},
  2514. BrandConnectCompletedEvent() {},
  2515. hasEngagement() {
  2516. return false;
  2517. }
  2518. }
  2519. });
  2520. if ((_b = window['agarApp']) === null || _b === void 0 ? void 0 : _b.main) ['sendEndSession', 'initDataDog', 'sendAnalyticsInitEvent', 'onGoliathReady', 'onGoliathUnload', 'initAnalytics', 'initGuestAnalytics', 'sendAnalyticsInitEvent', 'initBrowserId'].forEach(prop => {
  2521. window['agarApp'].main[prop] = () => {};
  2522. });
  2523. if ((_c = window['agarApp']) === null || _c === void 0 ? void 0 : _c.MCSDK) ['sendMatchEvent'].forEach(prop => window['agarApp'].MCSDK[prop] = () => {});
  2524. }
  2525. try {
  2526. onAgarApp();
  2527. } catch (e) {}
  2528. }
  2529. function fixNoServers() {
  2530. let AgarioEndpoints = null;
  2531. class HookXMLHttpRequest extends window.XMLHttpRequest {
  2532. constructor() {
  2533. super();
  2534. }
  2535. open(method, _url, async, username, password) {
  2536. const url = new URL(_url, location.href);
  2537. if (url.pathname.endsWith('/info')) {
  2538. this.addEventListener('load', () => {
  2539. const regions = JSON.parse(this.responseText);
  2540. AgarioEndpoints = regions;
  2541. });
  2542. }
  2543. if (url.pathname.endsWith('/findServerWithFriends')) {
  2544. console.log('Hooked XMLHttpRequest:', method, url);
  2545. this.addEventListener('load', e => {
  2546. const endpoints = JSON.parse(this.responseText);
  2547. if (endpoints.status == 'no_servers') {
  2548. const escapeIndex = (index, count) => (index % count + count) % count;
  2549. const otherRegions = Object.keys(AgarioEndpoints.regions);
  2550. const targetRegion = window['MC'].getRegion();
  2551. const regionIndex = otherRegions.indexOf(targetRegion);
  2552. const tryRegion = escapeIndex(regionIndex + 1, otherRegions.length);
  2553. console.log('Trying region:', otherRegions[tryRegion]);
  2554. setTimeout(() => {
  2555. window['MC'].setRegion(otherRegions[tryRegion], true);
  2556. }, 0);
  2557. }
  2558. if (false) {}
  2559. });
  2560. }
  2561. super.open(method, url, async, username, password);
  2562. }
  2563. }
  2564. window.XMLHttpRequest = HookXMLHttpRequest;
  2565. }
  2566. // EXTERNAL MODULE: ./dev/src/settings.ts + 4 modules
  2567. var settings = __webpack_require__(701);
  2568. // EXTERNAL MODULE: external "preact"
  2569. var external_preact_ = __webpack_require__(32);
  2570. // EXTERNAL MODULE: ./dev/src/ui/Contexts.ts
  2571. var Contexts = __webpack_require__(413);
  2572. // EXTERNAL MODULE: external "preactHooks"
  2573. var external_preactHooks_ = __webpack_require__(632);
  2574. ;// ./dev/src/utils/minmax.ts
  2575. function vh(v) {
  2576. const h = window.innerHeight;
  2577. return v * h / 100;
  2578. }
  2579. function vw(v) {
  2580. const w = window.innerWidth;
  2581. return v * w / 100;
  2582. }
  2583. function vmin(v) {
  2584. return Math.min(vh(v), vw(v));
  2585. }
  2586. function vmax(v) {
  2587. return Math.max(vh(v), vw(v));
  2588. }
  2589. function gcd(a = window.innerWidth, b = window.innerHeight) {
  2590. return b == 0 ? a : gcd(b, a % b);
  2591. }
  2592. ;// ./dev/src/ui/componetns/hooks.tsx
  2593.  
  2594.  
  2595.  
  2596. const scaling = (0,Eventify.EventObject)({
  2597. uiScale: 1
  2598. });
  2599. function calcScale() {
  2600. const gc = gcd();
  2601. let sizeOfMap = 1;
  2602. const {
  2603. w,
  2604. h
  2605. } = {
  2606. w: 4,
  2607. h: 3
  2608. };
  2609. if (gc * window.innerWidth / (gc * window.innerHeight) > w / h) {
  2610. sizeOfMap = vh(27) / 200;
  2611. } else {
  2612. sizeOfMap = h * vw(27) / w / 200;
  2613. }
  2614. scaling.uiScale = Math.min(1, sizeOfMap);
  2615. }
  2616. window.addEventListener('resize', calcScale);
  2617. calcScale();
  2618. function useEventify(effect, deps) {
  2619. const eventify = (0,external_preactHooks_.useMemo)(() => new Eventify.Eventify(), []);
  2620. (0,external_preactHooks_.useEffect)(() => {
  2621. const destroy = effect(eventify);
  2622. return () => {
  2623. if (destroy) destroy();
  2624. eventify.unlisten();
  2625. };
  2626. }, deps);
  2627. }
  2628. // EXTERNAL MODULE: ./node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
  2629. var jsxRuntime_module = __webpack_require__(557);
  2630. ;// ./dev/src/ui/componetns/Inputs.tsx
  2631.  
  2632.  
  2633.  
  2634.  
  2635. function keepValue(a) {
  2636. const e = a;
  2637. if (e.keyCode === 27) {
  2638. e.target.blur();
  2639. e.preventDefault();
  2640. }
  2641. }
  2642. function UiOption({
  2643. target,
  2644. name
  2645. }) {
  2646. const [value, updateValue] = (0,external_preactHooks_.useState)(target.raw[name].value);
  2647. // @ts-ignore
  2648. useEventify(e => e.listenTo(target, name, () => updateValue(target.raw[name].value))(), [name]);
  2649. return (0,jsxRuntime_module.jsx)(UiOptionMarkup
  2650. // @ts-ignore
  2651. , {
  2652. name: camelCaseToWords(target.raw[name].name || name),
  2653. value: value,
  2654. onValue: value => {
  2655. updateValue(value);
  2656. target.proxy[name] = value;
  2657. }
  2658. });
  2659. }
  2660. function UiOptionMarkup({
  2661. name,
  2662. value,
  2663. onValue
  2664. }) {
  2665. return (0,jsxRuntime_module.jsxs)("label", {
  2666. className: "flex flex-row p-1 text-left gap-2",
  2667. children: [(0,jsxRuntime_module.jsx)("div", {
  2668. className: "grow",
  2669. children: name
  2670. }), (0,jsxRuntime_module.jsx)("div", {
  2671. className: "",
  2672. children: (0,jsxRuntime_module.jsxs)("label", {
  2673. className: "switch",
  2674. children: [(0,jsxRuntime_module.jsx)("input", {
  2675. name: Math.random().toString(),
  2676. className: "",
  2677. onChange: e => onValue(e.target['checked']),
  2678. checked: value,
  2679. defaultChecked: value,
  2680. type: "checkbox"
  2681. }), (0,jsxRuntime_module.jsx)("div", {
  2682. className: "slider round",
  2683. "data-on": 'ui_on',
  2684. "data-off": 'ui_off'
  2685. })]
  2686. })
  2687. })]
  2688. });
  2689. }
  2690. function UiSlider({
  2691. target,
  2692. name
  2693. }) {
  2694. const helperRef = (0,external_preactHooks_.useRef)();
  2695. const unit = target.raw[name].unit || '';
  2696. function updateValue(value) {
  2697. helperRef.current.innerText = String(value.toFixed(target.raw[name].precision)) + unit;
  2698. }
  2699. useEventify(e => {
  2700. // @ts-ignore
  2701. e.listenTo(target, name, () => updateValue(target.raw[name].value))();
  2702. return () => e.unlisten();
  2703. }, [name]);
  2704. return (0,jsxRuntime_module.jsx)(SliderRender
  2705. // @ts-ignore
  2706. , {
  2707. name: camelCaseToWords(name),
  2708. value: target.raw[name].value,
  2709. data: target.raw[name],
  2710. onValue: value => {
  2711. target.proxy[name] = value;
  2712. updateValue(value);
  2713. },
  2714. helperRef: helperRef
  2715. });
  2716. }
  2717. function SliderRender({
  2718. name,
  2719. value,
  2720. data,
  2721. onValue,
  2722. helperRef
  2723. }) {
  2724. const rangeRef = (0,external_preactHooks_.useRef)();
  2725. return (0,jsxRuntime_module.jsxs)("label", {
  2726. class: "flex p-1 text-left gap-2",
  2727. children: [(0,jsxRuntime_module.jsx)("div", {
  2728. class: "grow",
  2729. children: name
  2730. }), (0,jsxRuntime_module.jsx)("div", {
  2731. ref: helperRef,
  2732. class: "helper"
  2733. }), (0,jsxRuntime_module.jsx)("div", {
  2734. class: "text-left",
  2735. children: (0,jsxRuntime_module.jsx)("input", {
  2736. name: Math.random().toString(),
  2737. ref: rangeRef,
  2738. class: "",
  2739. type: "range",
  2740. onInput: e => onValue(Number(e.target['value'])),
  2741. min: data.min,
  2742. max: data.max,
  2743. step: data.step,
  2744. value: value,
  2745. defaultValue: value.toString()
  2746. })
  2747. })]
  2748. });
  2749. }
  2750. function UiSelectbox({
  2751. target,
  2752. name
  2753. }) {
  2754. const [value, updateValue] = (0,external_preactHooks_.useState)(target.raw[name].value);
  2755. useEventify(e => {
  2756. const handleStatusChange = () => updateValue(target.raw[name].value);
  2757. // @ts-ignore
  2758. e.listenTo(target, name, handleStatusChange);
  2759. handleStatusChange();
  2760. return () => e.unlisten();
  2761. }, [name]);
  2762. return (0,jsxRuntime_module.jsx)(SelectboxRender, {
  2763. name: camelCaseToWords(name.toString()),
  2764. value: value,
  2765. data: target.raw[name].options,
  2766. onValue: value => {
  2767. // updateValue(value)
  2768. target.proxy[name] = value;
  2769. }
  2770. });
  2771. }
  2772. function SelectboxRender({
  2773. name,
  2774. value,
  2775. data,
  2776. onValue
  2777. }) {
  2778. return (0,jsxRuntime_module.jsxs)("div", {
  2779. className: "flex p-1 text-left gap-2",
  2780. children: [(0,jsxRuntime_module.jsx)("div", {
  2781. className: "grow",
  2782. children: name
  2783. }), (0,jsxRuntime_module.jsx)("div", {
  2784. className: "",
  2785. children: (0,jsxRuntime_module.jsx)("select", {
  2786. name: Math.random().toString(),
  2787. className: "selectbox",
  2788. value: value,
  2789. onChange: e => onValue(isNaN(e.target.value) ? e.target.value : Number(e.target.value)),
  2790. children: Object.entries(data).map(([name, value]) => (0,jsxRuntime_module.jsx)("option", {
  2791. value: value,
  2792. children: camelCaseToWords(name)
  2793. }))
  2794. })
  2795. })]
  2796. });
  2797. }
  2798. function UiInputbox({
  2799. target,
  2800. name
  2801. }) {
  2802. var _a;
  2803. function onValue(value) {
  2804. // const { target, name } = this.props;
  2805. target.proxy[name] = value;
  2806. }
  2807. const [value, updateValue] = (0,external_preactHooks_.useState)(target.raw[name].value);
  2808. useEventify(e => {
  2809. const handleStatusChange = () => updateValue(target.raw[name].value);
  2810. // @ts-ignore
  2811. e.listenTo(target, name, handleStatusChange);
  2812. handleStatusChange();
  2813. return () => e.unlisten();
  2814. }, [name]);
  2815. const display_name = camelCaseToWords(name);
  2816. return (0,jsxRuntime_module.jsxs)("div", {
  2817. class: "flex p-1 text-left gap-2",
  2818. children: [(0,jsxRuntime_module.jsx)("div", {
  2819. class: "grow",
  2820. children: display_name
  2821. }), (0,jsxRuntime_module.jsxs)("div", {
  2822. class: "flex grow",
  2823. style: {
  2824. width: '30%'
  2825. },
  2826. children: [(0,jsxRuntime_module.jsx)("input", {
  2827. name: Math.random().toString(),
  2828. class: "input",
  2829. type: "search",
  2830. inputMode: "text",
  2831. autocomplete: "off",
  2832. style: "width: 100%;",
  2833. placeholder: name.toString(),
  2834. onKeyDown: keepValue,
  2835. onInput: e => onValue(e.target['value']),
  2836. value: value,
  2837. defaultValue: value
  2838. }), true ? (0,jsxRuntime_module.jsxs)("select", {
  2839. name: 'select-' + Math.random(),
  2840. class: "w-4",
  2841. onChange: _e => {
  2842. const e = _e;
  2843. e.target.value != undefined && onValue(e.target.value);
  2844. e.target.value = '';
  2845. e.target.blur();
  2846. },
  2847. style: "",
  2848. children: [(0,jsxRuntime_module.jsx)("option", {
  2849. value: ""
  2850. }), typeof target.raw[name].default !== 'undefined' && (0,jsxRuntime_module.jsx)("option", {
  2851. value: target.raw[name].default,
  2852. children: "Default"
  2853. }), (_a = Object.entries(target.raw[name].options)) === null || _a === void 0 ? void 0 : _a.map(([key, val]) => (0,jsxRuntime_module.jsx)("option", {
  2854. value: val,
  2855. children: key
  2856. }))]
  2857. }) : 0]
  2858. })]
  2859. });
  2860. }
  2861. ;// ./dev/src/ui/SettingsList.tsx
  2862.  
  2863.  
  2864. function SettingsList({
  2865. array,
  2866. target
  2867. }) {
  2868. // @ts-ignore
  2869. const result = array.map(([optName, setting]) => {
  2870. const type = setting.type;
  2871. // @ts-ignore
  2872. if (type == 'OPT') return (0,jsxRuntime_module.jsx)(UiOption, {
  2873. target: target,
  2874. name: optName
  2875. });
  2876. // @ts-ignore
  2877. if (type == 'SLD') return (0,jsxRuntime_module.jsx)(UiSlider, {
  2878. target: target,
  2879. name: optName
  2880. });
  2881. // @ts-ignore
  2882. if (type == 'SEL') return (0,jsxRuntime_module.jsx)(UiSelectbox, {
  2883. target: target,
  2884. name: optName
  2885. });
  2886. // @ts-ignore
  2887. if (type == 'INP') return (0,jsxRuntime_module.jsx)(UiInputbox, {
  2888. target: target,
  2889. name: optName
  2890. });
  2891. // @ts-ignore
  2892. if (type == 'COL') return (0,jsxRuntime_module.jsx)(UiColorbox, {
  2893. target: target,
  2894. name: optName
  2895. });
  2896. });
  2897. return result;
  2898. }
  2899. ;// ./dev/src/ui/Menu.tsx
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906. function MenuButtons() {
  2907. const app = (0,external_preactHooks_.useContext)(Contexts.AppContext);
  2908. const inputRef = (0,external_preactHooks_.useRef)();
  2909. useEventify(e => {
  2910. e.listenTo(app.state, 'ws', () => {
  2911. inputRef.current.value = app.state.ws;
  2912. })();
  2913. }, []);
  2914. return (0,jsxRuntime_module.jsxs)("div", {
  2915. class: 'menu-addon',
  2916. style: {
  2917. marginTop: '4px',
  2918. display: 'flex',
  2919. flexDirection: 'column',
  2920. alignItems: 'center'
  2921. },
  2922. children: [(0,jsxRuntime_module.jsx)("button", {
  2923. style: {
  2924. width: '242px'
  2925. },
  2926. type: "submit",
  2927. class: "btn menu-button ",
  2928. onClick: () => app.spetate(),
  2929. children: "Spectate"
  2930. }), (0,jsxRuntime_module.jsxs)("div", {
  2931. style: {
  2932. display: 'flex',
  2933. gap: '4px',
  2934. paddingTop: '4px'
  2935. },
  2936. children: [(0,jsxRuntime_module.jsx)("input", {
  2937. class: "input-addon",
  2938. placeholder: "server",
  2939. ref: inputRef
  2940. }), (0,jsxRuntime_module.jsx)("button", {
  2941. type: "submit",
  2942. class: "btn menu-button",
  2943. onClick: () => app.connect(inputRef.current.value),
  2944. children: "Connect"
  2945. })]
  2946. })]
  2947. });
  2948. }
  2949. const Menu = () => {
  2950. return (0,jsxRuntime_module.jsx)("div", {
  2951. style: {
  2952. overflowY: 'scroll'
  2953. },
  2954. onWheel: e => e.stopPropagation(),
  2955. children: (0,jsxRuntime_module.jsx)("div", {
  2956. className: "mx-2",
  2957. children: (0,jsxRuntime_module.jsx)(SettingsList, {
  2958. array: Object.entries(settings.settings.raw),
  2959. target: settings.settings
  2960. })
  2961. })
  2962. });
  2963. };
  2964. // EXTERNAL MODULE: ./dev/src/ui/Minimap.tsx
  2965. var Minimap = __webpack_require__(390);
  2966. ;// ./dev/src/ui/componetns/preact-portal.tsx
  2967.  
  2968.  
  2969. class Portal extends external_preact_.Component {
  2970. constructor() {
  2971. super(...arguments);
  2972. this.isMounted = false;
  2973. }
  2974. componentDidUpdate(props) {
  2975. for (const i in props) {
  2976. if (props[i] !== this.props[i]) {
  2977. return setTimeout(() => this.renderLayer());
  2978. }
  2979. }
  2980. }
  2981. componentDidMount() {
  2982. this.isMounted = true;
  2983. this.renderLayer = this.renderLayer.bind(this);
  2984. this.renderLayer();
  2985. }
  2986. componentWillUnmount() {
  2987. this.renderLayer(false);
  2988. this.isMounted = false;
  2989. if (this.remote && this.remote.parentNode) this.remote.parentNode.removeChild(this.remote);
  2990. }
  2991. findNode(node) {
  2992. return typeof node === 'string' ? document.querySelector(node) : node;
  2993. }
  2994. renderLayer(show = true) {
  2995. if (!this.isMounted) return;
  2996. // clean up old node if moving bases:
  2997. if (this.props.into !== this.intoPointer) {
  2998. this.intoPointer = this.props.into;
  2999. if (this.into && this.remote) {
  3000. // @ts-ignore
  3001. this.remote = (0,external_preact_.render)((0,jsxRuntime_module.jsx)(PortalProxy, {}), createRootFragment(this.into, this.remote));
  3002. }
  3003. this.into = this.findNode(this.props.into);
  3004. }
  3005. // @ts-ignore
  3006. this.remote = (0,external_preact_.render)((0,jsxRuntime_module.jsx)(PortalProxy, {
  3007. context: this.$state,
  3008. children: show && this.props.children ? [this.props.children] : null
  3009. }), createRootFragment(this.into, this.remote));
  3010. }
  3011. render() {
  3012. return null;
  3013. }
  3014. }
  3015. class PortalProxy extends external_preact_.Component {
  3016. getChildContext() {
  3017. return this.props.context;
  3018. }
  3019. render({
  3020. children
  3021. } = this.props) {
  3022. return children && children[0] || null;
  3023. }
  3024. }
  3025. /**
  3026. * A Preact 11+ implementation of the `replaceNode` parameter from Preact 10.
  3027. *
  3028. * This creates a "Persistent Fragment" (a fake DOM element) containing one or more
  3029. * DOM nodes, which can then be passed as the `parent` argument to Preact's `render()` method.
  3030. */
  3031. function createRootFragment(parent, replaceNode) {
  3032. if (replaceNode) {
  3033. replaceNode = Array.isArray(replaceNode) ? replaceNode : [replaceNode];
  3034. } else {
  3035. replaceNode = [parent];
  3036. parent = parent.parentNode;
  3037. }
  3038. const s = replaceNode[replaceNode.length - 1].nextSibling;
  3039. const rootFragment = {
  3040. nodeType: 1,
  3041. parentNode: parent,
  3042. firstChild: replaceNode[0],
  3043. childNodes: replaceNode,
  3044. insertBefore: (c, r) => {
  3045. parent.insertBefore(c, r || s);
  3046. return c;
  3047. },
  3048. appendChild: c => {
  3049. parent.insertBefore(c, s);
  3050. return c;
  3051. },
  3052. removeChild: function (c) {
  3053. parent.removeChild(c);
  3054. return c;
  3055. }
  3056. };
  3057. parent.__k = rootFragment;
  3058. return rootFragment;
  3059. }
  3060. ;// ./dev/src/ui/index.tsx
  3061.  
  3062.  
  3063.  
  3064.  
  3065.  
  3066. // import './style.scss' with { type: 'cssfile' };
  3067.  
  3068. function initLiteui(app) {
  3069. // import('./style.scss', { type: 'cssfile' }).then((module) => {});
  3070. const liteui = document.createElement('div');
  3071. liteui.style = 'display:flex; flex-direction:column; overflow:hidden;';
  3072. document.getElementById('instructions').insertAdjacentElement('afterend', liteui);
  3073. (0,external_preact_.render)((0,jsxRuntime_module.jsx)(jsxRuntime_module.Fragment, {
  3074. children: (0,jsxRuntime_module.jsx)(Portal, {
  3075. into: liteui,
  3076. children: (0,jsxRuntime_module.jsx)(jsxRuntime_module.Fragment, {
  3077. children: (0,jsxRuntime_module.jsxs)("div", {
  3078. "data-portal": true,
  3079. className: "w-full",
  3080. style: "overflow: hidden;display: flex;height: 100%;flex-direction: column;",
  3081. children: [(0,jsxRuntime_module.jsx)(Contexts.AppContext.Provider, {
  3082. value: app,
  3083. children: (0,jsxRuntime_module.jsx)(MenuButtons, {})
  3084. }), (0,jsxRuntime_module.jsx)(Contexts.AppContext.Provider, {
  3085. value: app,
  3086. children: (0,jsxRuntime_module.jsx)(Menu, {})
  3087. })]
  3088. })
  3089. })
  3090. })
  3091. }), document.body);
  3092. const minimapElem = document.createElement('div');
  3093. (0,external_preact_.render)((0,jsxRuntime_module.jsx)(Contexts.AppContext.Provider, {
  3094. value: app,
  3095. children: (0,jsxRuntime_module.jsx)(Minimap.Minimap, {})
  3096. }), minimapElem);
  3097. document.body.insertAdjacentElement('afterbegin', minimapElem);
  3098. const observer = new window.MutationObserver(mtRecs => {
  3099. for (const mtRec of mtRecs) {
  3100. const elem = mtRec.target;
  3101. if (elem.style.display !== 'none') {
  3102. elem.style.display = 'flex';
  3103. elem.style.display = 'flex-direction:column';
  3104. }
  3105. }
  3106. });
  3107. observer.observe(window.document.querySelector('#mainPanel'), {
  3108. attributeFilter: ['style']
  3109. });
  3110. }
  3111. ;// ./dev/src/utils/env.ts
  3112. function makeGLobal(name, value) {
  3113. window[name] = value;
  3114. return value;
  3115. }
  3116. ;// ./dev/src/utils/Sampler.ts
  3117. class Sampler {
  3118. constructor() {
  3119. this.samplerIndex = 0;
  3120. this.sampler = new Float32Array(30).fill(0);
  3121. this.averagePerSecond = 0;
  3122. this.renderedFrames = 0;
  3123. this.average = 0;
  3124. this.now = 0;
  3125. }
  3126. step() {
  3127. const now = Date.now();
  3128. const elapsed = now - this.now;
  3129. this.now = now;
  3130. const delta = elapsed / 1000;
  3131. const perSecond = 1 / delta;
  3132. let average = 0;
  3133. let howmuchSamples = 0;
  3134. this.sampler[this.samplerIndex] = Math.round(perSecond);
  3135. this.samplerIndex = (this.samplerIndex + 1) % this.sampler.length;
  3136. for (let i = 0; i < Math.min(this.sampler.length, this.renderedFrames); i++) {
  3137. average += this.sampler[i];
  3138. howmuchSamples++;
  3139. }
  3140. average = Math.round(average / howmuchSamples);
  3141. this.average = average;
  3142. if (this.renderedFrames <= this.sampler.length) this.renderedFrames++;
  3143. }
  3144. }
  3145. ;// ./dev/src/utils/storage.ts
  3146. var __classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function (receiver, state, kind, f) {
  3147. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  3148. if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  3149. return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
  3150. };
  3151. var _Storage_namespace;
  3152. class Storage {
  3153. constructor() {
  3154. _Storage_namespace.set(this, 'ds_');
  3155. }
  3156. set(key, object, namespace = __classPrivateFieldGet(this, _Storage_namespace, "f"), middleware = d => d) {
  3157. localStorage.setItem(namespace + key, middleware(JSON.stringify(object)));
  3158. }
  3159. get(key, namespace = __classPrivateFieldGet(this, _Storage_namespace, "f"), middleware = d => d) {
  3160. let obj = {};
  3161. const rawData = localStorage.getItem(namespace + key);
  3162. if (typeof rawData === 'string') {
  3163. try {
  3164. obj = JSON.parse(middleware(rawData));
  3165. } catch (e) {
  3166. console.error(e);
  3167. }
  3168. }
  3169. return obj;
  3170. }
  3171. clear(key, namespace = __classPrivateFieldGet(this, _Storage_namespace, "f")) {
  3172. return localStorage.removeItem(namespace + key);
  3173. }
  3174. }
  3175. _Storage_namespace = new WeakMap();
  3176. const storage = new Storage();
  3177. ;// ./dev/src/utils/wasmPatcher.ts
  3178. function applyPatch(u8, operations, anyFail) {
  3179. let result = u8;
  3180. for (const {
  3181. pattern,
  3182. payload,
  3183. type
  3184. } of operations) {
  3185. const index = findPattern(result, pattern);
  3186. if (index === -1) {
  3187. console.warn(`Pattern not found: ${pattern.map(b => b.toString(16)).join(' ')}`);
  3188. anyFail();
  3189. continue;
  3190. }
  3191. let patchIndex = index;
  3192. if (type === 'insertAfter') patchIndex = index + pattern.length;else if (type === 'insertBefore') patchIndex = index;else if (type === 'replaceAfter') {
  3193. patchIndex = index + pattern.length;
  3194. const sliceBefore = result.slice(0, patchIndex);
  3195. const sliceAfter = result.slice(patchIndex + payload.length);
  3196. result = concatUint8Arrays([sliceBefore, new Uint8Array(payload), sliceAfter]);
  3197. continue;
  3198. } else if (type === 'replaceBefore') {
  3199. patchIndex = index - payload.length;
  3200. if (patchIndex < 0) throw new Error('replaceBefore would underflow the buffer');
  3201. const sliceBefore = result.slice(0, patchIndex);
  3202. const sliceAfter = result.slice(index);
  3203. result = concatUint8Arrays([sliceBefore, new Uint8Array(payload), sliceAfter]);
  3204. continue;
  3205. }
  3206. // Default insert
  3207. const sliceBefore = result.slice(0, patchIndex);
  3208. const sliceAfter = result.slice(patchIndex);
  3209. result = concatUint8Arrays([sliceBefore, new Uint8Array(payload), sliceAfter]);
  3210. }
  3211. return result;
  3212. }
  3213. function findPattern(buffer, pattern) {
  3214. for (let i = 0; i <= buffer.length - pattern.length; i++) {
  3215. let match = true;
  3216. for (let j = 0; j < pattern.length; j++) {
  3217. if (buffer[i + j] !== pattern[j]) {
  3218. match = false;
  3219. break;
  3220. }
  3221. }
  3222. if (match) return i;
  3223. }
  3224. return -1;
  3225. }
  3226. function concatUint8Arrays(arrays) {
  3227. const totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0);
  3228. const result = new Uint8Array(totalLength);
  3229. let offset = 0;
  3230. for (const arr of arrays) {
  3231. result.set(arr, offset);
  3232. offset += arr.length;
  3233. }
  3234. return result;
  3235. }
  3236. ;// ./dev/src/World.ts
  3237.  
  3238. class World extends Eventify.Eventify {
  3239. get isAgar() {
  3240. var _a;
  3241. return (_a = this.ws) === null || _a === void 0 ? void 0 : _a.url.includes('minic');
  3242. }
  3243. constructor(app) {
  3244. super();
  3245. this.xorBuffer = (buffer, key) => {
  3246. const dataView = new DataView(buffer);
  3247. for (let i = 0; i < dataView.byteLength; i++) {
  3248. dataView.setUint8(i, dataView.getUint8(i) ^ key >>> i % 4 * 8 & 255);
  3249. }
  3250. return buffer;
  3251. };
  3252. this.overWriteWS = _target => {
  3253. const target = _target;
  3254. this.ws = target;
  3255. target._onopen = target.onopen;
  3256. target._onmessage = target.onmessage;
  3257. target.onopen = e => {
  3258. this.reset();
  3259. target._onopen(e);
  3260. };
  3261. target.onmessage = message => {
  3262. target._onmessage(message);
  3263. let offset = 0;
  3264. let msg = message.data;
  3265. if (this.decryptionKey) msg = this.xorBuffer(msg, this.decryptionKey ^ 31122);
  3266. const view = new DataView(msg);
  3267. const opcode = view.getUint8(offset++);
  3268. switch (opcode) {
  3269. case 17:
  3270. const playerX = view.getFloat32(offset, true);
  3271. offset += 4;
  3272. const playerY = view.getFloat32(offset, true);
  3273. offset += 4;
  3274. this.targetX = this.receiveX(playerX);
  3275. this.targetY = this.receiveY(playerY);
  3276. break;
  3277. case 32:
  3278. this.myCellIds.push(view.getUint32(offset, true));
  3279. break;
  3280. case 69:
  3281. this.ghostCells(view, offset);
  3282. break;
  3283. case 241:
  3284. this.decryptionKey = view.getUint32(offset, true);
  3285. break;
  3286. case 255:
  3287. this.handleMessages(this.uncompressMessage(new Uint8Array(view.buffer.slice(5)), new Uint8Array(view.getUint32(offset, true))));
  3288. break;
  3289. default:
  3290. this.handleMessages(new Uint8Array(msg));
  3291. }
  3292. };
  3293. };
  3294. this.websocketHooked = false;
  3295. this.reset();
  3296. this.app = app;
  3297. }
  3298. reset() {
  3299. this.minimap = [];
  3300. this.offsetX = 0;
  3301. this.offsetY = 0;
  3302. this.borderX = 0;
  3303. this.borderY = 0;
  3304. this.targetX = 0;
  3305. this.targetY = 0;
  3306. this.myCellIds = [];
  3307. this.decryptionKey = 0;
  3308. this.mapOffsetFixed = false;
  3309. this.mapShiftX = 0;
  3310. this.mapShiftY = 0;
  3311. this.mapOffsetX = 0;
  3312. this.mapOffsetY = 0;
  3313. this.mapMinX = 0;
  3314. this.mapMinY = 0;
  3315. this.mapMaxX = 0;
  3316. this.mapMaxY = 0;
  3317. this.mapMidX = 0;
  3318. this.mapMidY = 0;
  3319. this.mapSizeH = 0;
  3320. this.mapSizeV = 0;
  3321. this.mapShrinkW = 1;
  3322. this.mapShrinkH = 1;
  3323. this.viewX = 0;
  3324. this.viewY = 0;
  3325. this.mirrorV = false;
  3326. this.mirrorH = false;
  3327. }
  3328. uncompressMessage(input, output) {
  3329. for (let i = 0, j = 0; i < input.length;) {
  3330. const byte = input[i++];
  3331. let literalsLength = byte >> 4;
  3332. if (literalsLength > 0) {
  3333. let length = literalsLength + 240;
  3334. while (length === 255) {
  3335. length = input[i++];
  3336. literalsLength += length;
  3337. }
  3338. const end = i + literalsLength;
  3339. while (i < end) output[j++] = input[i++];
  3340. if (i === input.length) return output;
  3341. }
  3342. const offset = input[i++] | input[i++] << 8;
  3343. if (offset === 0 || offset > j) return -(i - 2);
  3344. let matchLength = byte & 15;
  3345. let length = matchLength + 240;
  3346. while (length === 255) {
  3347. length = input[i++];
  3348. matchLength += length;
  3349. }
  3350. let pos = j - offset;
  3351. const end = j + matchLength + 4;
  3352. while (j < end) output[j++] = output[pos++];
  3353. }
  3354. return output;
  3355. }
  3356. handleMessages(message) {
  3357. let offset = 0;
  3358. const view = new DataView(message.buffer);
  3359. const opcode = view.getUint8(offset++);
  3360. switch (opcode) {
  3361. case 16:
  3362. {
  3363. const eatRecordLength = view.getUint16(offset, true);
  3364. offset += 2;
  3365. for (let i = 0; i < eatRecordLength; i++) offset += 8;
  3366. while (true) {
  3367. const id = view.getUint32(offset, true);
  3368. offset += 4;
  3369. if (id === 0) break;
  3370. const targetX = this.receiveX(view.getInt32(offset, true));
  3371. offset += 4;
  3372. const targetY = this.receiveY(view.getInt32(offset, true));
  3373. offset += 4;
  3374. offset += 2;
  3375. const flags = view.getUint8(offset++);
  3376. const extendedFlags = flags & 128 ? view.getUint8(offset++) : 0;
  3377. if (flags & 2) offset += 3;
  3378. if (flags & 4) while (view.getInt8(offset++) !== 0) {
  3379. /* intentionally left empty */
  3380. }
  3381. if (flags & 8) while (view.getInt8(offset++) !== 0) {
  3382. /* intentionally left empty */
  3383. }
  3384. if (extendedFlags & 4) offset += 4;
  3385. if (this.myCellIds.indexOf(id) !== -1) {
  3386. this.targetX = targetX;
  3387. this.targetY = targetY;
  3388. }
  3389. }
  3390. const removeLength = view.getUint16(offset, true);
  3391. offset += 2;
  3392. for (let i = 0; i < removeLength; i++) {
  3393. const removedID = view.getUint32(offset, true);
  3394. offset += 4;
  3395. if (this.myCellIds.includes(removedID)) this.myCellIds = this.myCellIds.filter(id => id != removedID);
  3396. }
  3397. }
  3398. break;
  3399. case 64:
  3400. const minx = view.getFloat64(offset, true);
  3401. offset += 8;
  3402. const miny = view.getFloat64(offset, true);
  3403. offset += 8;
  3404. const maxx = view.getFloat64(offset, true);
  3405. offset += 8;
  3406. const maxy = view.getFloat64(offset, true);
  3407. if (!this.mapOffsetFixed) {
  3408. this.offsetX = (minx + maxx) / 2;
  3409. this.offsetY = (miny + maxy) / 2;
  3410. this.borderX = maxx - minx;
  3411. this.borderY = maxy - miny;
  3412. this.setMapOffset(minx, miny, maxx, maxy);
  3413. this.mapOffsetFixed = true;
  3414. }
  3415. break;
  3416. }
  3417. }
  3418. setMapOffset(left, top, right, bottom) {
  3419. const isAgar = this.ws.url.includes('minic');
  3420. if (right - left > 14000 && bottom - top > 14000 || !isAgar) {
  3421. if (this.mapOffsetFixed) return;
  3422. if (isAgar) {
  3423. const side = 14142;
  3424. this.mapShrinkW = side / (right - left);
  3425. this.mapShrinkH = side / (bottom - top);
  3426. left = this.shrinkX(left);
  3427. top = this.shrinkY(top);
  3428. right = this.shrinkX(right);
  3429. bottom = this.shrinkY(bottom);
  3430. }
  3431. this.mapShiftY = 0;
  3432. this.mapShiftX = 0;
  3433. const prX = -(right - left) * 0.5;
  3434. const prY = -(bottom - top) * 0.5;
  3435. const diffX = prX - left;
  3436. const diffY = prY - top;
  3437. this.mapShiftX = -diffX;
  3438. this.mapShiftY = -diffY;
  3439. left = this.shiftX(left);
  3440. top = this.shiftY(top);
  3441. right = this.shiftX(right);
  3442. bottom = this.shiftY(bottom);
  3443. this.mapOffsetX = (right - left) * 0.5 - right;
  3444. this.mapOffsetY = (bottom - top) * 0.5 - bottom;
  3445. this.mapMinX = left;
  3446. this.mapMinY = top;
  3447. this.mapMaxX = right;
  3448. this.mapMaxY = bottom;
  3449. this.mapMidX = (this.mapMaxX + this.mapMinX) * 0.5;
  3450. this.mapMidY = (this.mapMaxY + this.mapMinY) * 0.5;
  3451. this.mapSizeH = this.mapMaxX - this.mapMinX;
  3452. this.mapSizeV = this.mapMaxY - this.mapMinY;
  3453. if (!this.mapOffsetFixed) {
  3454. this.viewX = (right + left) * 0.5;
  3455. this.viewY = (bottom + top) * 0.5;
  3456. }
  3457. this.mapOffsetFixed = true;
  3458. } else {}
  3459. }
  3460. ghostCells(view, offset) {
  3461. this.minimap = [];
  3462. let x = 0,
  3463. y = 0,
  3464. mass = 0;
  3465. const length = view.getUint16(offset, true);
  3466. offset += 2;
  3467. for (let i = 0; i < length; i++) {
  3468. x = this.receiveX(view.getInt32(offset, true));
  3469. offset += 4;
  3470. y = this.receiveY(view.getInt32(offset, true));
  3471. offset += 4;
  3472. mass = view.getUint32(offset, true);
  3473. offset += 5;
  3474. this.minimap.push({
  3475. x: x,
  3476. y: y,
  3477. size: ~~Math.sqrt(100 * mass),
  3478. mass: mass
  3479. });
  3480. }
  3481. }
  3482. unshrinkX(x) {
  3483. return x / this.mapShrinkW;
  3484. }
  3485. unshrinkY(y) {
  3486. return y / this.mapShrinkH;
  3487. }
  3488. shrinkX(x) {
  3489. return x * this.mapShrinkW;
  3490. }
  3491. shrinkY(y) {
  3492. return y * this.mapShrinkH;
  3493. }
  3494. unshiftX(x) {
  3495. return x - -this.mapShiftX;
  3496. }
  3497. unshiftY(y) {
  3498. return y - -this.mapShiftY;
  3499. }
  3500. shiftX(x) {
  3501. return x - this.mapShiftX;
  3502. }
  3503. shiftY(y) {
  3504. return y - this.mapShiftY;
  3505. }
  3506. invflipX(x) {
  3507. return this.mirrorH ? x : this.mapMaxX - (x - this.mapMinX);
  3508. }
  3509. invflipY(y) {
  3510. return this.mirrorV ? y : this.mapMaxY - (y - this.mapMinY);
  3511. }
  3512. flipX(x) {
  3513. return !this.mirrorH ? x : this.mapMaxX - (x - this.mapMinX);
  3514. }
  3515. flipY(y) {
  3516. return !this.mirrorV ? y : this.mapMaxY - (y - this.mapMinY);
  3517. }
  3518. receiveX(x) {
  3519. x = this.shrinkX(x);
  3520. x = this.shiftX(x);
  3521. x = this.flipX(x);
  3522. return x;
  3523. }
  3524. receiveY(y) {
  3525. y = this.shrinkY(y);
  3526. y = this.shiftY(y);
  3527. y = this.flipY(y);
  3528. return y;
  3529. }
  3530. serverX(x) {
  3531. x = this.flipX(x);
  3532. x = this.unshiftX(x);
  3533. x = this.unshrinkX(x);
  3534. return x;
  3535. }
  3536. serverY(y) {
  3537. y = this.flipY(y);
  3538. y = this.unshiftY(y);
  3539. y = this.unshrinkY(y);
  3540. return y;
  3541. }
  3542. drawMinimap(ctx, canvas, clear = true) {
  3543. function safe(number) {
  3544. return number == 0 ? 1 : number;
  3545. }
  3546. if (clear) ctx.clearRect(0, 0, canvas.width, canvas.height);
  3547. this.minimap.forEach(cell => {
  3548. const x = safe(cell.x + this.borderX / 2) / this.borderX * canvas.width;
  3549. const y = safe(cell.y + this.borderY / 2) / this.borderY * canvas.height;
  3550. const size = cell.size / this.borderX * canvas.width + 1;
  3551. ctx.fillStyle = '#ffd700';
  3552. ctx.beginPath();
  3553. ctx.arc(x, y, size, 0, Math.PI * 2);
  3554. ctx.fill();
  3555. });
  3556. const playerX = safe(this.targetX + this.borderX / 2) / this.borderX * canvas.width;
  3557. const playerY = safe(this.targetY + this.borderY / 2) / this.borderY * canvas.height;
  3558. ctx.fillStyle = '#00bfff';
  3559. ctx.beginPath();
  3560. ctx.arc(playerX, playerY, 5, 0, Math.PI * 2);
  3561. ctx.fill();
  3562. const sectorSizeX = canvas.width / 5;
  3563. const sectorSizeY = canvas.height / 5;
  3564. const sectorCol = Math.floor(playerX / sectorSizeX);
  3565. const sectorRow = Math.floor(playerY / sectorSizeY);
  3566. const activeSectorIndex = sectorRow * 5 + sectorCol;
  3567. return Number.isFinite(activeSectorIndex) ? activeSectorIndex : -1;
  3568. }
  3569. initialize() {
  3570. if (this.websocketHooked) return console.error('Error: WebSocket already hooked');
  3571. this.websocketHooked = true;
  3572. // eslint-disable-next-line @typescript-eslint/no-this-alias
  3573. const self = this;
  3574. class WS extends window.WebSocket {
  3575. constructor(url, protocols) {
  3576. const errorStack = new Error().stack;
  3577. const isAgar = /wasm:\/\/|wasm-function|WebAssembly.instantiate/.test(errorStack);
  3578. const isAgarServer = url.includes('minic');
  3579. if (isAgar && !isAgarServer) {
  3580. // window['core'].disableIntegrityChecks(true);
  3581. }
  3582. if (isAgar) self.emit('beforeConnect', url, isAgarServer);
  3583. super(url, protocols);
  3584. if (isAgar) Promise.resolve().then(() => self.overWriteWS(this));
  3585. }
  3586. }
  3587. WS.injectedOnce = false;
  3588. window.WebSocket = WS;
  3589. }
  3590. }
  3591. ;// ./dev/src/App.ts
  3592. var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
  3593. function adopt(value) {
  3594. return value instanceof P ? value : new P(function (resolve) {
  3595. resolve(value);
  3596. });
  3597. }
  3598. return new (P || (P = Promise))(function (resolve, reject) {
  3599. function fulfilled(value) {
  3600. try {
  3601. step(generator.next(value));
  3602. } catch (e) {
  3603. reject(e);
  3604. }
  3605. }
  3606. function rejected(value) {
  3607. try {
  3608. step(generator["throw"](value));
  3609. } catch (e) {
  3610. reject(e);
  3611. }
  3612. }
  3613. function step(result) {
  3614. result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
  3615. }
  3616. step((generator = generator.apply(thisArg, _arguments || [])).next());
  3617. });
  3618. };
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629. class App {
  3630. display_vue() {
  3631. return find_node(window['agarApp'].home, (child, depth) => {
  3632. var _a;
  3633. console.log(child, (_a = child === null || child === void 0 ? void 0 : child.$vnode) === null || _a === void 0 ? void 0 : _a.tag);
  3634. return true;
  3635. });
  3636. }
  3637. constructor() {
  3638. this.sampler = new Sampler();
  3639. this.performance_now = 0; // for speedhack
  3640. this.timer_mp = 1; // time multiplier
  3641. this.waitForSpawn = false; // respawn ways
  3642. this.sector = 5;
  3643. this.stopmovement = false;
  3644. /*** camera zoom ****/
  3645. this.scale = 1;
  3646. /** target cursor world */
  3647. this.mouse = {
  3648. x: 0,
  3649. y: 0
  3650. };
  3651. /** cursor on canvas display */
  3652. this.mouseDisplay = {
  3653. x: 0,
  3654. y: 0
  3655. };
  3656. /** world camera position */
  3657. this.camera = {
  3658. x: 0,
  3659. y: 0
  3660. };
  3661. this.state = (0,Eventify.EventObject)({
  3662. play: false,
  3663. pause: false,
  3664. ws: '',
  3665. isLoggedIn: false
  3666. });
  3667. this.memory = (0,Eventify.EventObject)({
  3668. skinUrl: ''
  3669. });
  3670. /** vue ui */
  3671. this.mainui = null;
  3672. /** exposed emscripten module */
  3673. this.emsc = null;
  3674. /** exposed $hxClasses */
  3675. this.hx = null;
  3676. this.observerPatcher = e => {
  3677. const randomKey = 'app_' + Math.random().toString(36).slice(2, 10);
  3678. window[randomKey] = this;
  3679. const app = 'window.' + randomKey;
  3680. const replacements = {
  3681. registerSkin: [[/("\s?registerSkin\s?"\s?:\s?function\s?\(\s?(.+?)\s?,\s?(.+?)\s?,\s?(.+?)\s?,\s?(.+?)\s?,\s?(.+?)\s?\)\s?\{\s?)/i, `$1${app}.onRegisterSkin($2,$3,$4,$5,$6);`]],
  3682. onConnect: [[/(;..?\s?\.\s?onopen\s?=\s?function\s?\(\s?\)\s?\{\s?)/i, `$1${app}.onConnect(this.url, this);`]],
  3683. mobileData: [[/(\s?if\s?\(\s?window\s?\[\s?"\s?MC\s?"\s?]\s?&&\s?window\s?\[\s?"\s?MC\s?"\s?]\s?\[\s?"\s?onMobileData\s?"\s?]\s?\)\s?window\s?\[\s?"\s?MC\s?"\s?]\s?\[\s?"\s?onMobileData\s?"\s?]\s?\(\s?(.+?)\s?\))/i, `$2=${app}.onPacket($2);$1`]],
  3684. 'Emscripten hook': [[/(\w+)\W+instantiateWasm/, `(${app}.onEmscripten($1)), $&`]],
  3685. 'Mouse hook': [[/("\s?setTarget\s?"\s?:\s?function\s?\(\s?(.+?)\s?,\s?(.+?)\s?\)\s?\{\s?)/i, `$1 var [$2, $3] = ${app}.syncMouse($2, $3);`]],
  3686. 'Player Zoom': [[/("\s?playerZoom\s?"\s?:\s?function\s?\(\s?(.+?)\s?\)\s?\{\s?)/i, `$1$2=${app}.onPlayerZoom($2);`]],
  3687. 'WebSocket onclose': [[/(;..?\s?\.\s?onclose\s?=\s?function\s?\(\s?\)\s?\{\s?)/i, `$1${app}.onDisconnect(this);`]],
  3688. 'WebSocket onerror': [[/(;..?\s?\.\s?onerror\s?=\s?function\s?\(\s?\)\s?\{\s?)/i, `$1${app}.onDisconnect(this);`]],
  3689. 'Binary Patch': [[/(instantiate\(\s?)([^,]+)/, `$1${app}.patchWasm($2)`]],
  3690. something: [[/([a-z]{6}\s?[a-z|A-Z]{16}\s?\(\s?([a-z]{6})\s?,\s?[a-z|A-Z]{10}\s?,\s?[a-z|A-Z]{7}\s?,\s?[a-zA-Z]{8}\s?\)\s?\{\s?)/i, '$1$2=true;']]
  3691. };
  3692. for (const [name, array] of Object.entries(replacements)) {
  3693. let current = 0;
  3694. for (const [regexp, replacer] of array) {
  3695. if (regexp.test(e)) {
  3696. e = e.replace(regexp, replacer);
  3697. current++;
  3698. } else {
  3699. console.log(`[Not Found - ${current}]: `, name);
  3700. }
  3701. }
  3702. }
  3703. return e;
  3704. };
  3705. this.calls = [];
  3706. this.world = new World(this);
  3707. this.world.on('beforeConnect', this.beforeConnect.bind(this));
  3708. const storageName = 'lite_settings';
  3709. settings.settings.import(Object.assign(Object.assign({}, settings.settings.export()), storage.get(storageName)));
  3710. settings.settings.on('*', _ => {
  3711. storage.set(storageName, settings.settings.export());
  3712. });
  3713. Object.assign(this.memory, storage.get('memory'));
  3714. this.memory.on('*', () => {
  3715. console.log('nick', this.memory);
  3716. storage.set('memory', this.memory);
  3717. });
  3718. // this.memory.on('skinUrl', () => {
  3719. // // @ts-ignore
  3720. // if (this.memory.skinUrl)
  3721. // try {
  3722. // window['core'].registerSkin(
  3723. // document.getElementById('nick').value,
  3724. // null,
  3725. // this.memory.skinUrl,
  3726. // 2,
  3727. // null
  3728. // );
  3729. // } catch (e) {}
  3730. // })();
  3731. exposeHxClasses().then(hx => {
  3732. this.hx = hx;
  3733. });
  3734. this.initObserver().then(() => {
  3735. this.world.initialize();
  3736. this.waitCore().then(() => {
  3737. this.handleCoreInit();
  3738. });
  3739. });
  3740. overrideMethod(window.console, 'log', function (o, args) {
  3741. var _a, _b;
  3742. if ((_b = (_a = args[0]).startsWith) === null || _b === void 0 ? void 0 : _b.call(_a, ' ,,,,,')) return window.console.log = o;
  3743. return o.apply(this, args);
  3744. });
  3745. }
  3746. loadAndPatchCore(url, resolve) {
  3747. return __awaiter(this, void 0, void 0, function* () {
  3748. try {
  3749. const request = new XMLHttpRequest();
  3750. request.open('GET', url, false);
  3751. request.onload = () => {
  3752. const patchedText = this.observerPatcher(request.responseText);
  3753. const blob = new Blob([patchedText], {
  3754. type: 'text/javascript'
  3755. });
  3756. const blobURL = URL.createObjectURL(blob);
  3757. const script = document.createElement('script');
  3758. script.id = 'agario.core.js';
  3759. script.src = blobURL;
  3760. script.onload = () => {
  3761. URL.revokeObjectURL(blobURL);
  3762. resolve();
  3763. };
  3764. document.body.appendChild(script);
  3765. };
  3766. request.send();
  3767. } catch (error) {
  3768. console.error('[ERROR] Failed to load and patch core:', error);
  3769. }
  3770. });
  3771. }
  3772. initObserver() {
  3773. const deferred = (0,Eventify.deferrify)();
  3774. const observer = new window.MutationObserver(mtRecs => {
  3775. var _a;
  3776. for (const mtRec of mtRecs) {
  3777. for (let i = 0; i < mtRec.addedNodes.length; i++) {
  3778. const elem = mtRec.addedNodes[i];
  3779. const [t] = elem.src && elem.src.match(/agario\.core\.js.+/i) || [];
  3780. if (t) {
  3781. observer.disconnect();
  3782. elem.remove();
  3783. (_a = elem.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(elem);
  3784. this.loadAndPatchCore(t, deferred.resolve);
  3785. }
  3786. }
  3787. }
  3788. });
  3789. observer.observe(document, {
  3790. childList: true,
  3791. subtree: true
  3792. });
  3793. return deferred.promise;
  3794. }
  3795. patchWasm(u) {
  3796. let anyFail = false;
  3797. const patchedUint8Array = applyPatch(new Uint8Array(u), [{
  3798. pattern: [0x45, 0x0d, 0x00, 0x20, 0x02, 0x10, 0x0f, 0x20, 0x01, 0x20, 0x02, 0x10, 0x1e, 0x21, 0x01],
  3799. payload: [0x20, 0x00, 0x28, 0x02, 0x1c, 0x45, 0x04, 0x40, 0x0f, 0x0b],
  3800. type: 'insertAfter'
  3801. }, {
  3802. pattern: [0x81, 0x03, 0x84, 0x03, 0x10, 0x87, 0x03, 0x86, 0x03, 0x85, 0x03, 0x0a],
  3803. payload: [203],
  3804. type: 'replaceAfter'
  3805. }, {
  3806. pattern: [0x00, 0x20, 0x00, 0x20, 0x04, 0x37, 0x03, 0x08, 0x20, 0x03, 0x41, 0x10, 0x6a, 0x24, 0x00, 0x0b],
  3807. payload: [138],
  3808. type: 'replaceAfter'
  3809. }, {
  3810. pattern: [0x01, 0x2d, 0x00, 0x07, 0x20, 0x02, 0x41, 0x1b, 0x6c, 0x41, 0x01, 0x6a, 0x73, 0x3a, 0x00, 0x07, 0x20, 0x1f, 0xbf, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
  3811. payload: [0, 0],
  3812. type: 'replaceAfter'
  3813. }], () => anyFail = true);
  3814. if (anyFail) return u;
  3815. return patchedUint8Array.buffer;
  3816. }
  3817. waitCore() {
  3818. return __awaiter(this, void 0, void 0, function* () {
  3819. const deferred = (0,Eventify.deferrify)();
  3820. addEventListener('core_init_complete', () => {
  3821. var _a;
  3822. if (!window['core']) {
  3823. // backup event
  3824. if ((_a = window['MC']) === null || _a === void 0 ? void 0 : _a['onAgarioCoreLoaded']) {
  3825. const old_loaded = window['MC']['onAgarioCoreLoaded'];
  3826. window['MC']['onAgarioCoreLoaded'] = function () {
  3827. deferred.resolve();
  3828. window['MC']['onAgarioCoreLoaded'] = old_loaded;
  3829. return old_loaded.apply(this, arguments);
  3830. };
  3831. return;
  3832. }
  3833. // deadline mode
  3834. Object.defineProperty(window, 'core', {
  3835. get: () => window['_core'],
  3836. set: value => (window['_core'] = value, deferred.resolve())
  3837. });
  3838. return;
  3839. }
  3840. deferred.resolve();
  3841. });
  3842. addEventListener('event_regions_update', () => __awaiter(this, void 0, void 0, function* () {}));
  3843. // let rafRequest: any = null;
  3844. // function watchVue() {
  3845. // rafRequest = requestAnimationFrame(() => {
  3846. // if (window['agarApp']) cancelAnimationFrame(rafRequest);
  3847. // coreAdsPatch();
  3848. // });
  3849. // }
  3850. // watchVue();
  3851. // Object.defineProperty(window, 'mcReady', {
  3852. // get: () => () => {},
  3853. // set: () => {}
  3854. // });
  3855. return deferred.promise;
  3856. });
  3857. }
  3858. handleCoreInit() {
  3859. coreInitPatch();
  3860. coreAdsPatch();
  3861. fixNoServers();
  3862. coreUiPatch();
  3863. this.init();
  3864. this.onCoreInit();
  3865. initLiteui(this);
  3866. }
  3867. modifyScore(sourceString) {
  3868. if (!this.state.play) sourceString = '';
  3869. return `${sourceString}`;
  3870. }
  3871. init() {
  3872. const modifyScore = this.modifyScore.bind(this);
  3873. const onPlayerSpawn = this.onPlayerSpawn.bind(this);
  3874. const onPlayerDeath = this.onPlayerDeath.bind(this);
  3875. // timelord.activate();
  3876. // this.performance_now = window.performance['_now']();
  3877. // const updateRealTime = (realTime_ms: number) => {
  3878. // const dt = realTime_ms - this.performance_now;
  3879. // timelord.stepTime(dt * (settings.proxy.AnimationDelay / 100), dt * this.timer_mp);
  3880. // this.performance_now = realTime_ms;
  3881. // window['_requestAnimationFrame'](updateRealTime);
  3882. // };
  3883. // updateRealTime(this.performance_now);
  3884. overridePrototype(CanvasRenderingContext2D.prototype, 'fillText', o => {
  3885. return function () {
  3886. if (arguments[0].includes('Scor')) {
  3887. arguments[0] = modifyScore(arguments[0]);
  3888. } else if (arguments[0].startsWith('Leaderboard')) {
  3889. arguments[0] = settings.settings.proxy.LeaderboardTitle;
  3890. }
  3891. return o.apply(this, arguments);
  3892. };
  3893. });
  3894. overridePrototype(CanvasRenderingContext2D.prototype, 'measureText', o => {
  3895. return function () {
  3896. if (arguments[0].includes('Scor')) {
  3897. arguments[0] = modifyScore(arguments[0]);
  3898. }
  3899. return o.apply(this, arguments);
  3900. };
  3901. });
  3902. overrideMethod(window['MC'], 'onPlayerSpawn', function (o, args) {
  3903. o.apply(this, args);
  3904. onPlayerSpawn(...args);
  3905. });
  3906. overrideMethod(window['MC'], 'onPlayerDeath', function (o, args) {
  3907. o.apply(this, args);
  3908. onPlayerDeath(...args);
  3909. });
  3910. }
  3911. onEmscripten(Module) {
  3912. var _a, _b;
  3913. this.emsc = Module;
  3914. makeGLobal('emsc', Module);
  3915. console.log('emsc', Module);
  3916. this.canvas = document.getElementById('canvas');
  3917. const ctx = this.canvas.getContext('2d');
  3918. const world = this.world;
  3919. function numberIsInRange(value, min, max) {
  3920. return value >= min && value <= max;
  3921. }
  3922. // eslint-disable-next-line @typescript-eslint/no-this-alias
  3923. const self = this;
  3924. const traceCalls = ['clearRect', 'drawImage', 'fillText', 'strokeText', 'fillRect', 'strokeRect',
  3925. // 'beginPath',
  3926. 'moveTo',
  3927. // 'lineTo',
  3928. // 'arc',
  3929. 'scale', 'save', 'restore', 'translate', 'transform', 'setTransform'];
  3930. let gotScale = false;
  3931. let callNumber = -1;
  3932. traceCalls.forEach(method => {
  3933. // @ts-ignore
  3934. overrideMethod(ctx, method, function (o, args) {
  3935. callNumber++;
  3936. // self.calls.push(method);
  3937. // if (callNumber === 3) console.log('scale', ...args);
  3938. // if (callNumber === 2) {
  3939. // console.log('translate', ...args);
  3940. // }
  3941. // if (numberIsInRange(callNumber - 1, 1, 7)) function () {}; // Off grid
  3942. const cmd = o.apply(ctx, args);
  3943. return cmd;
  3944. });
  3945. });
  3946. overrideMethod(ctx, 'scale', function (o, args) {
  3947. if (!gotScale) {
  3948. gotScale = true;
  3949. self.scale = args[0];
  3950. }
  3951. const cmd = o.apply(ctx, args);
  3952. return cmd;
  3953. });
  3954. // if (callNumber == 9) console.log('canvas', args[0], args[1]);
  3955. // if (callNumber == 11) console.log('cam', args[0], args[1]);
  3956. overrideMethod(ctx, 'drawImage', function (o, args) {
  3957. let dx = 0,
  3958. dy = 0,
  3959. dw = 0,
  3960. dh = 0;
  3961. if (args.length == 9) {
  3962. dx = args[5];
  3963. dy = args[6];
  3964. dw = args[7];
  3965. dh = args[8];
  3966. } else if (args.length == 3) {
  3967. dx = args[1];
  3968. dy = args[2];
  3969. }
  3970. const cmd = o.apply(ctx, args);
  3971. return cmd;
  3972. });
  3973. /*** Camera hook ***/
  3974. let translateCall = -1;
  3975. overrideMethod(ctx, 'translate', function (o, args) {
  3976. translateCall++;
  3977. if (translateCall == 2) {
  3978. self.camera.x = args[0];
  3979. self.camera.y = args[1];
  3980. self.drawBackground(ctx, world, o);
  3981. }
  3982. return o.apply(ctx, args);
  3983. });
  3984. /*** Before render ***/
  3985. (_a = Module['preMainLoop']) !== null && _a !== void 0 ? _a : Module['preMainLoop'] = () => {};
  3986. overrideMethod(Module, 'preMainLoop', (o, args) => {
  3987. this.calls = [];
  3988. o.apply(this, args);
  3989. });
  3990. /*** After render ***/
  3991. (_b = Module['postMainLoop']) !== null && _b !== void 0 ? _b : Module['postMainLoop'] = () => {};
  3992. overrideMethod(Module, 'postMainLoop', (o, args) => {
  3993. this.sampler.step();
  3994. callNumber = -1;
  3995. translateCall = -1;
  3996. gotScale = false;
  3997. this.drawHud(ctx);
  3998. o.apply(this, args);
  3999. });
  4000. }
  4001. onRegisterSkin() {
  4002. // console.log('register skin', arguments);
  4003. }
  4004. onCoreInit() {
  4005. settings.settings.on('AcidMode', v => {
  4006. window['core'].setAcid(v);
  4007. })(settings.settings.proxy.AcidMode);
  4008. /** COINS COLLECTION */
  4009. {
  4010. const collectCoins = () => {
  4011. if (this.state.isLoggedIn && settings.settings.proxy.AutoCollectCoins) {
  4012. window['agarApp'].API.getFreeCoins();
  4013. window['agarApp'].API.closeTopView();
  4014. }
  4015. };
  4016. addEventListener('login', () => this.state.isLoggedIn = true);
  4017. addEventListener('logout', () => this.state.isLoggedIn = false);
  4018. addEventListener('free_coins_timer', collectCoins);
  4019. this.state.on('isLoggedIn', collectCoins);
  4020. settings.settings.on('AutoCollectCoins', collectCoins)();
  4021. }
  4022. }
  4023. get menuShow() {
  4024. if (!this.mainui) this.mainui = find_node(window['agarApp'].home, child => {
  4025. var _a, _b;
  4026. return (_b = (_a = child.$vnode) === null || _a === void 0 ? void 0 : _a.tag) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes('mainui');
  4027. })[0];
  4028. if (!this.mainui) return false;
  4029. return this.mainui.menuShow;
  4030. }
  4031. beforeConnect(url, isAgar) {}
  4032. onConnect(url) {
  4033. console.log('Connected', url);
  4034. this.state.ws = url;
  4035. //onconnect
  4036. if (this.waitForSpawn) {
  4037. window['MC'].playGame();
  4038. this.waitForSpawn = false;
  4039. }
  4040. // window['core'].setFadeout(false);
  4041. // window['core'].setFadeout = () => {};
  4042. this.disableMenuBackground();
  4043. }
  4044. disableMenuBackground() {
  4045. if (!this.world.isAgar) return;
  4046. this.emsc._ac_special_on();
  4047. window['core'].setFpsCap(-1);
  4048. window['core'].setFadeout(false);
  4049. requestAnimationFrame(() => {
  4050. window['core'].setFadeout(true);
  4051. });
  4052. this.emsc._ac_spectate();
  4053. }
  4054. spetate() {
  4055. var _a;
  4056. (_a = find_node(undefined, child => child === null || child === void 0 ? void 0 : child.spectate)[0]) === null || _a === void 0 ? void 0 : _a.spectate();
  4057. }
  4058. connect(url) {
  4059. window['core'].disableIntegrityChecks(!url.includes('minic'));
  4060. if (window['raga'] && url.indexOf('raga') > -1) {
  4061. window['raga'].isSwitchingGameMode = true;
  4062. window['raga'].gameMode = 'ragaffa-16x';
  4063. }
  4064. window['core'].connect(url);
  4065. // window['core'].disconnect()
  4066. // window['MC'].reconnect(true)
  4067. }
  4068. respawn() {
  4069. if (this.state.play) {
  4070. this.connect(this.state.ws);
  4071. this.waitForSpawn = true;
  4072. } else {
  4073. window['core'].setFadeout(false);
  4074. window['core'].sendSpectate();
  4075. window['MC'].playGame();
  4076. setTimeout(() => {
  4077. // MC.playGame()
  4078. // window['agarApp'].home.$children[0].$children[0].spectate()
  4079. // window['agarApp'].home.$children[0].$children[0].play()
  4080. // window['agarApp'].home.$children[0].onHideMainMenu()
  4081. // window['agarApp'].home.$children[0].onGameStart()
  4082. }, 200);
  4083. }
  4084. }
  4085. onPlayerSpawn(...args) {
  4086. this.state.play = true;
  4087. this.reset();
  4088. }
  4089. onPlayerDeath(...args) {
  4090. find_node(undefined, child => {
  4091. if (child.fastEntry !== undefined) return true;else return false;
  4092. }).forEach(child => {
  4093. !child.fastEntry && Object.defineProperty(child, 'fastEntry', {
  4094. get: () => true,
  4095. set: x => x
  4096. });
  4097. });
  4098. window['core'].setFadeout(true);
  4099. const setInterval = window['_setInterval'] || window.setInterval;
  4100. const clearInterval = window['_clearInterval'] || window.clearInterval;
  4101. const setTimeout = window['_setTimeout'] || window.setTimeout;
  4102. const clearTimeout = window['_clearTimeout'] || window.clearTimeout;
  4103. this.state.play = false;
  4104. this.reset();
  4105. if (!window['agarApp'].home.$children[0].$children[0].showMenu && settings.settings.proxy.AutoRespawn) {
  4106. this.respawn();
  4107. return true;
  4108. } else {
  4109. const prev = this.timer_mp;
  4110. this.timer_mp = 10000;
  4111. setTimeout(() => this.timer_mp = prev, 800);
  4112. }
  4113. // window.setTimeout(MC.showNickDialog, 500);
  4114. }
  4115. onPacket(packet) {
  4116. return packet;
  4117. }
  4118. reset() {
  4119. this.stopmovement = false;
  4120. this.world.myCellIds = [];
  4121. }
  4122. dumpMem() {
  4123. const blob = new Blob([this['emsc'].buffer]);
  4124. const a = document.createElement('a');
  4125. a.href = URL.createObjectURL(blob);
  4126. a.download = 'dump.bin';
  4127. a.click();
  4128. URL.revokeObjectURL(a.href);
  4129. }
  4130. onDisconnect(obj) {
  4131. console.log('disconnected', obj);
  4132. }
  4133. onPlayerZoom(zoom) {
  4134. return zoom;
  4135. }
  4136. syncCamera(x, y) {
  4137. this.camera.x = x;
  4138. this.camera.y = y;
  4139. }
  4140. syncMouse(mouseDisplayX, mouseDisplayY) {
  4141. this.mouseDisplay.x = mouseDisplayX;
  4142. this.mouseDisplay.y = mouseDisplayY;
  4143. this.calcMosuseWorld();
  4144. if (this.state.pause) {
  4145. return [this.canvas.width / 2, this.canvas.height / 2];
  4146. }
  4147. return [mouseDisplayX, mouseDisplayY];
  4148. }
  4149. calcMosuseWorld() {
  4150. const camX = this.camera.x + this.world.offsetX;
  4151. const camY = this.camera.y + this.world.offsetY;
  4152. const canvasCenterX = this.canvas.width / 2;
  4153. const canvasCenterY = this.canvas.height / 2;
  4154. this.mouse.x = -((canvasCenterX - this.mouseDisplay.x) / this.scale + camX);
  4155. this.mouse.y = -((canvasCenterY - this.mouseDisplay.y) / this.scale + camY);
  4156. }
  4157. renderLoop() {}
  4158. drawBackground(ctx, world, translate = ctx['translate']) {
  4159. const offsetX = this.camera.x + this.world.offsetX;
  4160. const offsetY = this.camera.y + this.world.offsetY;
  4161. const initialAlpha = ctx.globalAlpha;
  4162. translate(offsetX, offsetY);
  4163. /*** Map Border ****/
  4164. if (settings.settings.proxy.MapBorder) {
  4165. ctx.globalAlpha = 0.2;
  4166. ctx.lineWidth = 20;
  4167. ctx.fillStyle = 'green';
  4168. ctx.strokeRect(this.world.mapMinX, this.world.mapMinY, this.world.mapSizeH, this.world.mapSizeV);
  4169. ctx.globalAlpha = initialAlpha;
  4170. }
  4171. const parselw = this.world.mapSizeH / this.sector;
  4172. const parselh = this.world.mapSizeV / this.sector;
  4173. /*** Map Sectors ****/
  4174. if (settings.settings.proxy.MapSectors) {
  4175. ctx.beginPath();
  4176. ctx.lineWidth = 10;
  4177. ctx.strokeStyle = 'green';
  4178. ctx.globalAlpha = 0.2;
  4179. for (let zi = 1; zi < this.sector; zi++) {
  4180. ctx.moveTo(this.world.mapMinX, this.world.mapMinY + parselw * zi);
  4181. ctx.lineTo(this.world.mapMaxX, this.world.mapMinY + parselw * zi);
  4182. ctx.moveTo(this.world.mapMinX + parselh * zi, this.world.mapMinY);
  4183. ctx.lineTo(this.world.mapMinX + parselh * zi, this.world.mapMaxY);
  4184. }
  4185. ctx.stroke();
  4186. ctx.closePath();
  4187. ctx.globalAlpha = initialAlpha;
  4188. }
  4189. /*** Sector Label ****/
  4190. if (settings.settings.proxy.MapSectorLabels) {
  4191. ctx.textAlign = 'center';
  4192. ctx.textBaseline = 'middle';
  4193. ctx.font = parselw / 2.8 + 'px Segoe Print';
  4194. ctx.globalAlpha = 0.2;
  4195. ctx.fillStyle = 'green';
  4196. const bucw = parselw / 2,
  4197. buch = parselh / 2;
  4198. for (let sat = 0; sat < this.sector; sat++) {
  4199. const label = String.fromCharCode(65 + sat);
  4200. for (let sut = 0; sut < this.sector; sut++) {
  4201. ctx.fillText(label + (sut + 1), this.world.mapMinX + parselw * sut + bucw, this.world.mapMinY + parselh * sat + buch);
  4202. }
  4203. }
  4204. ctx.globalAlpha = initialAlpha;
  4205. }
  4206. /*** C3 sign ****/
  4207. ctx.textBaseline = 'middle';
  4208. ctx.textAlign = 'center';
  4209. ctx.font = '380px Segoe Print';
  4210. ctx.globalAlpha = 0.5;
  4211. ctx.fillStyle = '#808080';
  4212. ctx.fillText('Doublesplit', 0, 0);
  4213. ctx.globalAlpha = initialAlpha;
  4214. translate(-offsetX, -offsetY);
  4215. // ctx.fillStyle = 'rgba(0, 0, 0, 0.3)';
  4216. // ctx.scale(1 / this.zoomvalue, 1 / this.zoomvalue);
  4217. // ctx.fillRect(0, 0 + ctx.canvas.height / 2 - 150, 200, 100);
  4218. // ctx.scale(this.zoomvalue, this.zoomvalue);
  4219. return;
  4220. /*** Mini Map ****/
  4221. if (false) {
  4222. const minimapWidth = 100;
  4223. const minimapHeight = 100;
  4224. const mapMinX = this.world.mapMinX;
  4225. const mapMinY = this.world.mapMinY;
  4226. const mapMaxX = this.world.mapMaxX;
  4227. const mapMaxY = this.world.mapMaxY;
  4228. const mapWidth = this.world.mapSizeH;
  4229. const mapHeight = this.world.mapSizeV;
  4230. const viewX = this.camera.x;
  4231. const viewY = this.camera.y;
  4232. const mw = minimapWidth / 5;
  4233. const blurrylines = 0;
  4234. let leftrate = (viewX - mapMinX) / mapWidth;
  4235. let toprate = (viewY - mapMinY) / mapHeight;
  4236. let minileft = Math.round(minimapWidth * leftrate * 100) / 100;
  4237. let minitop = Math.round(minimapHeight * toprate * 100) / 100;
  4238. ctx.beginPath();
  4239. ctx.clearRect(0, 0, minimapWidth, minimapHeight);
  4240. ctx.globalAlpha = 0.5;
  4241. ctx.lineWidth = 0.5;
  4242. ctx.strokeStyle = 'blue'; //settings.raw.border.string;
  4243. ctx.strokeRect(blurrylines + mw, blurrylines + mw, minimapWidth - mw * 2, minimapHeight - mw * 2);
  4244. ctx.strokeRect(blurrylines + mw * 2, blurrylines + mw * 2, minimapWidth - mw * 4, minimapHeight - mw * 4);
  4245. ctx.globalAlpha = 1;
  4246. ctx.fillStyle = 'red'; //settings.raw.miniblob.string;
  4247. ctx.arc(minileft, minitop, 5, 0, 2 * Math.PI);
  4248. ctx.fill();
  4249. ctx.closePath();
  4250. ctx.beginPath();
  4251. ctx.fillStyle = 'red';
  4252. leftrate = minimapWidth / mapWidth;
  4253. toprate = minimapHeight / mapHeight;
  4254. minileft = Math.round((mapWidth / 2 + (this.mouse.x - offsetX)) * leftrate);
  4255. minitop = Math.round((mapHeight / 2 + (this.mouse.y - offsetY)) * toprate);
  4256. ctx.arc(minileft, minitop, 3, 0, 2 * Math.PI);
  4257. ctx.fill();
  4258. ctx.closePath();
  4259. }
  4260. }
  4261. drawHud(ctx) {
  4262. ctx.fillStyle = 'rgba(0, 0, 0, 0.3)';
  4263. ctx.fillRect(0, 0, 0, 0);
  4264. }
  4265. }
  4266. // if ('hot' in module) {
  4267. // // @ts-ignore
  4268. // module['hot'].decline();
  4269. // // @ts-ignore
  4270. // module['hot'].dispose(() => {
  4271. // location.reload();
  4272. // });
  4273. // }
  4274. ;// ./dev/src/dev.ts
  4275.  
  4276. function enableVueDevtools() {
  4277. overrideMethod(window.Object, 'defineProperty', (originalMethod, args) => {
  4278. if (args[1] === 'config') {
  4279. const orig_getter = args[2].get;
  4280. args[2].get = function () {
  4281. const vueConfig = orig_getter();
  4282. vueConfig.devtools = true;
  4283. vueConfig.productionTip = true;
  4284. return () => vueConfig;
  4285. };
  4286. window.Object.defineProperty = originalMethod;
  4287. }
  4288. return originalMethod.apply(window.Object, args);
  4289. });
  4290. }
  4291. function enableFastCanvasView() {
  4292. Object.defineProperty(window.HTMLCanvasElement.prototype, 'aaa', {
  4293. get() {
  4294. this.toBlob(blob => {
  4295. const blobUrl = URL.createObjectURL(blob);
  4296. createPopupWin(blobUrl, 'Canvas', 800, 600);
  4297. });
  4298. return 1;
  4299. }
  4300. });
  4301. }
  4302. function createPopupWin(pageURL, pageTitle, popupWinWidth, popupWinHeight) {
  4303. const left = (screen.width - popupWinWidth) / 2;
  4304. const top = (screen.height - popupWinHeight) / 4;
  4305. return window.open(pageURL, pageTitle, 'resizable=yes, width=' + popupWinWidth + ', height=' + popupWinHeight + ', top=' + top + ', left=' + left);
  4306. }
  4307. // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js
  4308. var injectStylesIntoStyleTag = __webpack_require__(72);
  4309. var injectStylesIntoStyleTag_default = /*#__PURE__*/__webpack_require__.n(injectStylesIntoStyleTag);
  4310. // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleDomAPI.js
  4311. var styleDomAPI = __webpack_require__(825);
  4312. var styleDomAPI_default = /*#__PURE__*/__webpack_require__.n(styleDomAPI);
  4313. // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertBySelector.js
  4314. var insertBySelector = __webpack_require__(659);
  4315. var insertBySelector_default = /*#__PURE__*/__webpack_require__.n(insertBySelector);
  4316. // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js
  4317. var setAttributesWithoutAttributes = __webpack_require__(56);
  4318. var setAttributesWithoutAttributes_default = /*#__PURE__*/__webpack_require__.n(setAttributesWithoutAttributes);
  4319. // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/insertStyleElement.js
  4320. var insertStyleElement = __webpack_require__(540);
  4321. var insertStyleElement_default = /*#__PURE__*/__webpack_require__.n(insertStyleElement);
  4322. // EXTERNAL MODULE: ./node_modules/style-loader/dist/runtime/styleTagTransform.js
  4323. var styleTagTransform = __webpack_require__(113);
  4324. var styleTagTransform_default = /*#__PURE__*/__webpack_require__.n(styleTagTransform);
  4325. // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./dev/src/ui/minimap.css
  4326. var minimap = __webpack_require__(767);
  4327. ;// ./dev/src/ui/minimap.css
  4328.  
  4329.  
  4330. var options = {};
  4331.  
  4332. options.styleTagTransform = (styleTagTransform_default());
  4333. options.setAttributes = (setAttributesWithoutAttributes_default());
  4334. options.insert = insertBySelector_default().bind(null, "head");
  4335. options.domAPI = (styleDomAPI_default());
  4336. options.insertStyleElement = (insertStyleElement_default());
  4337.  
  4338. var update = injectStylesIntoStyleTag_default()(minimap["default"], options);
  4339.  
  4340.  
  4341.  
  4342.  
  4343. /* harmony default export */ const ui_minimap = (minimap["default"] && minimap["default"].locals ? minimap["default"].locals : undefined);
  4344.  
  4345. // EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[1].use[1]!./node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[1].use[2]!./dev/src/ui/style.css
  4346. var style = __webpack_require__(397);
  4347. ;// ./dev/src/ui/style.css
  4348.  
  4349.  
  4350. var style_options = {};
  4351.  
  4352. style_options.styleTagTransform = (styleTagTransform_default());
  4353. style_options.setAttributes = (setAttributesWithoutAttributes_default());
  4354. style_options.insert = insertBySelector_default().bind(null, "head");
  4355. style_options.domAPI = (styleDomAPI_default());
  4356. style_options.insertStyleElement = (insertStyleElement_default());
  4357.  
  4358. var style_update = injectStylesIntoStyleTag_default()(style["default"], style_options);
  4359.  
  4360.  
  4361.  
  4362.  
  4363. /* harmony default export */ const ui_style = (style["default"] && style["default"].locals ? style["default"].locals : undefined);
  4364.  
  4365. ;// ./dev/src/userscripting/Tampermonkey.ts
  4366. function registerMenuCommands() {
  4367. const links = [{
  4368. name: '\uD83D\uDF02 Adverisement: Play cell games on Delt.io',
  4369. url: 'https://delt.io'
  4370. }, {
  4371. name: '\uD83D\uDDAD Contact: Delta Discord',
  4372. url: 'https://bit.ly/3RXQXQd'
  4373. }];
  4374. try {
  4375. links.forEach(link => GM.registerMenuCommand(link.name, () => window.location.href = link.url));
  4376. } catch (e) {}
  4377. }
  4378. function registerCheckUpdates() {
  4379. GM.registerMenuCommand(`Version: ${GM.info.script.version} - Check for updates`, checkUpdates);
  4380. }
  4381. function checkUpdates() {
  4382. const url = GM.info.scriptUpdateURL;
  4383. if (!url) return alert('⛔ Error:\nNo update URL found!');
  4384. const version2int = (x = '0') => x.split('.').reduce((n, c, i, a) => n + parseInt(c) * Math.pow(100, a.length - i - 1), 0);
  4385. const req = new Promise(r => GM.xmlHttpRequest({
  4386. method: 'GET',
  4387. url: url,
  4388. onload: r
  4389. }));
  4390. req.then(res => {
  4391. const matches = /\/\/\s*@version\s*(\S+)/im.exec(res.responseText);
  4392. if (!matches) return alert('⛔ Error:\nNo version found!');
  4393. const remoteVersion = version2int(matches[1]);
  4394. const localVersion = version2int(GM.info.script.version);
  4395. if (remoteVersion > localVersion) {
  4396. const msg = `🔔 New version available: ${matches[1]}\n\nDo you want to update?`;
  4397. if (confirm(msg)) {
  4398. const installer = window.open(url, '_blank');
  4399. const i = setInterval(() => {
  4400. if (!installer.closed) return;
  4401. clearInterval(i);
  4402. location.reload();
  4403. }, 100);
  4404. }
  4405. } else {
  4406. alert('👍 You are using the latest version!');
  4407. }
  4408. }).catch(e => {
  4409. console.error(e);
  4410. alert('⛔ Error: Cant fetch update info!\n' + e);
  4411. });
  4412. }
  4413. function isGM() {
  4414. return typeof GM !== 'undefined' && GM;
  4415. }
  4416. ;// ./dev/src/index.ts
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424. enableVueDevtools();
  4425. enableFastCanvasView();
  4426. const app = new App();
  4427. makeGLobal('app', app);
  4428. makeGLobal('find_node', find_node);
  4429. if (isGM() && !window.GM_skipMenu) {
  4430. registerMenuCommands();
  4431. registerCheckUpdates();
  4432. }
  4433. })();
  4434.  
  4435. MyLibrary = __webpack_exports__;
  4436.  
  4437. })(typeof unsafeWindow !== 'undefined' ? unsafeWindow : window);