diff --git a/.eslintrc.json b/.eslintrc.json index 4bc0cf66e..f0d2bdc86 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,20 +1,31 @@ { - "extends": "eslint:recommended", - "env": { - "browser": true, - "node": true, - "es6": true, - "worker": true - }, - "rules": { - "no-console": 0, - "no-unused-vars": 0, - "no-undef": 0, - "no-redeclare": 0, - "require-yield": 0, - "no-irregular-whitespace": ["error", { "skipStrings": true, "skipTemplates": true }], - "no-constant-condition": ["error", { "checkLoops": false }]/* , - "comma-dangle": ["error", "only-multiline"], - "complexity": ["error",100] */ - } + "extends": "eslint:recommended", + "env": { + "browser": true, + "node": true, + "es6": true, + "worker": true + }, + "rules": { + "no-console": 0, + "no-unused-vars": 0, + "no-undef": 0, + "no-redeclare": 0, + "require-yield": 0, + "no-irregular-whitespace": [ + "error", + { + "skipStrings": true, + "skipTemplates": true + } + ], + "no-constant-condition": [ + "error", + { + "checkLoops": false + } + ] /* , + "comma-dangle": ["error", "only-multiline"], + "complexity": ["error",100] */ + } } \ No newline at end of file diff --git a/game/core-js-bundle.js b/game/core-js-bundle.js index bbca29b3c..aa0e34730 100644 --- a/game/core-js-bundle.js +++ b/game/core-js-bundle.js @@ -1,7 +1,7 @@ /** - * core-js 3.33.0 + * core-js 3.33.2 * © 2014-2023 Denis Pushkarev (zloirock.ru) - * license: https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE + * license: https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE * source: https://github.com/zloirock/core-js */ !function (undefined) { 'use strict'; /******/ (function(modules) { // webpackBootstrap @@ -721,14 +721,15 @@ if (!NATIVE_SYMBOL) { var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); var tag = uid(description); var setter = function (value) { - if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); - if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + var $this = this === undefined ? global : this; + if ($this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); + if (hasOwn($this, HIDDEN) && hasOwn($this[HIDDEN], tag)) $this[HIDDEN][tag] = false; var descriptor = createPropertyDescriptor(1, value); try { - setSymbolDescriptor(this, tag, descriptor); + setSymbolDescriptor($this, tag, descriptor); } catch (error) { if (!(error instanceof RangeError)) throw error; - fallbackDefineProperty(this, tag, descriptor); + fallbackDefineProperty($this, tag, descriptor); } }; if (DESCRIPTORS && USE_SETTER) setSymbolDescriptor(ObjectPrototype, tag, { configurable: true, set: setter }); @@ -1483,10 +1484,10 @@ var store = __webpack_require__(37); (module.exports = function (key, value) { return store[key] || (store[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.33.0', + version: '3.33.2', mode: IS_PURE ? 'pure' : 'global', copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE', + license: 'https://github.com/zloirock/core-js/blob/v3.33.2/LICENSE', source: 'https://github.com/zloirock/core-js' }); @@ -3758,7 +3759,6 @@ if (ErrorPrototype.toString !== errorToString) { var DESCRIPTORS = __webpack_require__(6); var fails = __webpack_require__(7); var anObject = __webpack_require__(47); -var create = __webpack_require__(72); var normalizeStringArgument = __webpack_require__(121); var nativeErrorToString = Error.prototype.toString; @@ -3766,8 +3766,8 @@ var nativeErrorToString = Error.prototype.toString; var INCORRECT_TO_STRING = fails(function () { if (DESCRIPTORS) { // Chrome 32- incorrectly call accessor - // eslint-disable-next-line es/no-object-defineproperty -- safe - var object = create(Object.defineProperty({}, 'name', { get: function () { + // eslint-disable-next-line es/no-object-create, es/no-object-defineproperty -- safe + var object = Object.create(Object.defineProperty({}, 'name', { get: function () { return this === object; } })); if (nativeErrorToString.call(object) !== 'true') return true; @@ -4977,13 +4977,12 @@ module.exports = defineIterator(Array, 'Array', function (iterated, kind) { }, function () { var state = getInternalState(this); var target = state.target; - var kind = state.kind; var index = state.index++; if (!target || index >= target.length) { state.target = undefined; return createIterResultObject(undefined, true); } - switch (kind) { + switch (state.kind) { case 'keys': return createIterResultObject(index, false); case 'values': return createIterResultObject(target[index], false); } return createIterResultObject([index, target[index]], false); @@ -6008,11 +6007,11 @@ var uncurryThis = __webpack_require__(14); var aCallable = __webpack_require__(31); var toIndexedObject = __webpack_require__(12); var arrayFromConstructorAndList = __webpack_require__(199); -var getVirtual = __webpack_require__(200); +var getBuiltInPrototypeMethod = __webpack_require__(200); var addToUnscopables = __webpack_require__(140); var $Array = Array; -var sort = uncurryThis(getVirtual('Array').sort); +var sort = uncurryThis(getBuiltInPrototypeMethod('Array', 'sort')); // `Array.prototype.toSorted` method // https://tc39.es/ecma262/#sec-array.prototype.tosorted @@ -6053,8 +6052,10 @@ module.exports = function (Constructor, list) { var global = __webpack_require__(4); -module.exports = function (CONSTRUCTOR) { - return global[CONSTRUCTOR].prototype; +module.exports = function (CONSTRUCTOR, METHOD) { + var Constructor = global[CONSTRUCTOR]; + var Prototype = Constructor && Constructor.prototype; + return Prototype && Prototype[METHOD]; }; @@ -15957,14 +15958,14 @@ var getIterator = __webpack_require__(135); var getIteratorDirect = __webpack_require__(496); var getIteratorMethod = __webpack_require__(136); var getMethod = __webpack_require__(30); -var getVirtual = __webpack_require__(200); var getBuiltIn = __webpack_require__(24); +var getBuiltInPrototypeMethod = __webpack_require__(200); var wellKnownSymbol = __webpack_require__(34); var AsyncFromSyncIterator = __webpack_require__(494); var toArray = __webpack_require__(497).toArray; var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); -var arrayIterator = uncurryThis(getVirtual('Array').values); +var arrayIterator = uncurryThis(getBuiltInPrototypeMethod('Array', 'values')); var arrayIteratorNext = uncurryThis(arrayIterator([]).next); var safeArrayIterator = function () { @@ -17721,7 +17722,7 @@ var AsyncFromSyncIterator = __webpack_require__(494); var ASYNC_ITERATOR = wellKnownSymbol('asyncIterator'); -module.exports = function from(obj) { +module.exports = function (obj) { var object = anObject(obj); var alreadyAsync = true; var method = getMethod(object, ASYNC_ITERATOR); @@ -18272,7 +18273,7 @@ var uncurryThis = __webpack_require__(14); var getUint8 = uncurryThis(DataView.prototype.getUint8); // `DataView.prototype.getUint8Clamped` method -// https://github.com/tc39/proposal-dataview-get-set-uint8c +// https://github.com/tc39/proposal-dataview-get-set-uint8clamped $({ target: 'DataView', proto: true, forced: true }, { getUint8Clamped: function getUint8Clamped(byteOffset) { return getUint8(this, byteOffset); @@ -18345,7 +18346,7 @@ var $TypeError = TypeError; var setUint8 = uncurryThis(DataView.prototype.setUint8); // `DataView.prototype.setUint8Clamped` method -// https://github.com/tc39/proposal-dataview-get-set-uint8c +// https://github.com/tc39/proposal-dataview-get-set-uint8clamped $({ target: 'DataView', proto: true, forced: true }, { setUint8Clamped: function setUint8Clamped(byteOffset, value) { if (classof(this) !== 'DataView') throw new $TypeError('Incorrect receiver'); @@ -20734,18 +20735,19 @@ var INVALID_RADIX = 'Invalid radix'; var $RangeError = RangeError; var $SyntaxError = SyntaxError; var $TypeError = TypeError; -var valid = /^[\da-z]+$/; +var pow = Math.pow; +var valid = /^[\d.a-z]+$/; var charAt = uncurryThis(''.charAt); var exec = uncurryThis(valid.exec); var numberToString = uncurryThis(1.0.toString); var stringSlice = uncurryThis(''.slice); +var split = uncurryThis(''.split); // `Number.fromString` method // https://github.com/tc39/proposal-number-fromstring $({ target: 'Number', stat: true, forced: true }, { fromString: function fromString(string, radix) { var sign = 1; - var R, mathNum; if (typeof string != 'string') throw new $TypeError(INVALID_NUMBER_REPRESENTATION); if (!string.length) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); if (charAt(string, 0) === '-') { @@ -20753,11 +20755,13 @@ $({ target: 'Number', stat: true, forced: true }, { string = stringSlice(string, 1); if (!string.length) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); } - R = radix === undefined ? 10 : toIntegerOrInfinity(radix); + var R = radix === undefined ? 10 : toIntegerOrInfinity(radix); if (R < 2 || R > 36) throw new $RangeError(INVALID_RADIX); - if (!exec(valid, string) || numberToString(mathNum = parseInt(string, R), R) !== string) { - throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); - } + if (!exec(valid, string)) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); + var parts = split(string, '.'); + var mathNum = parseInt(parts[0], R); + if (parts.length > 1) mathNum += parseInt(parts[1], R) / pow(R, parts[1].length); + if (numberToString(mathNum, R) !== string) throw new $SyntaxError(INVALID_NUMBER_REPRESENTATION); return sign * mathNum; } }); @@ -23203,7 +23207,6 @@ defineWellKnownSymbol('matcher'); "use strict"; -// TODO: Remove from `core-js@4` var defineWellKnownSymbol = __webpack_require__(81); // `Symbol.metadata` well-known symbol @@ -23217,6 +23220,7 @@ defineWellKnownSymbol('metadata'); "use strict"; +// TODO: Remove from `core-js@4` var defineWellKnownSymbol = __webpack_require__(81); // `Symbol.metadataKey` well-known symbol @@ -24449,7 +24453,7 @@ try { var IS_PURE = __webpack_require__(36); var $ = __webpack_require__(3); var global = __webpack_require__(4); -var getBuiltin = __webpack_require__(24); +var getBuiltIn = __webpack_require__(24); var uncurryThis = __webpack_require__(14); var fails = __webpack_require__(7); var uid = __webpack_require__(41); @@ -24469,7 +24473,8 @@ var validateArgumentsLength = __webpack_require__(329); var getRegExpFlags = __webpack_require__(369); var MapHelpers = __webpack_require__(506); var SetHelpers = __webpack_require__(659); -var arrayBufferTransfer = __webpack_require__(519); +var setIterate = __webpack_require__(664); +var detachTransferable = __webpack_require__(520); var ERROR_STACK_INSTALLABLE = __webpack_require__(125); var PROPER_STRUCTURED_CLONE_TRANSFER = __webpack_require__(522); @@ -24477,25 +24482,17 @@ var Object = global.Object; var Array = global.Array; var Date = global.Date; var Error = global.Error; -var EvalError = global.EvalError; -var RangeError = global.RangeError; -var ReferenceError = global.ReferenceError; -var SyntaxError = global.SyntaxError; var TypeError = global.TypeError; -var URIError = global.URIError; var PerformanceMark = global.PerformanceMark; -var WebAssembly = global.WebAssembly; -var CompileError = WebAssembly && WebAssembly.CompileError || Error; -var LinkError = WebAssembly && WebAssembly.LinkError || Error; -var RuntimeError = WebAssembly && WebAssembly.RuntimeError || Error; -var DOMException = getBuiltin('DOMException'); +var DOMException = getBuiltIn('DOMException'); var Map = MapHelpers.Map; var mapHas = MapHelpers.has; var mapGet = MapHelpers.get; var mapSet = MapHelpers.set; var Set = SetHelpers.Set; var setAdd = SetHelpers.add; -var objectKeys = getBuiltin('Object', 'keys'); +var setHas = SetHelpers.has; +var objectKeys = getBuiltIn('Object', 'keys'); var push = uncurryThis([].push); var thisBooleanValue = uncurryThis(true.valueOf); var thisNumberValue = uncurryThis(1.0.valueOf); @@ -24510,7 +24507,7 @@ var checkBasicSemantic = function (structuredCloneImplementation) { var set1 = new global.Set([7]); var set2 = structuredCloneImplementation(set1); var number = structuredCloneImplementation(Object(7)); - return set2 === set1 || !set2.has(7) || typeof number != 'object' || +number !== 7; + return set2 === set1 || !set2.has(7) || !isObject(number) || +number !== 7; }) && structuredCloneImplementation; }; @@ -24606,10 +24603,10 @@ var cloneBuffer = function (value, map, $type) { // `ArrayBuffer#slice` is not available in IE10 // `ArrayBuffer#slice` and `DataView` are not available in old FF - if (!DataView && typeof value.slice != 'function') throwUnpolyfillable('ArrayBuffer'); + if (!DataView && !isCallable(value.slice)) throwUnpolyfillable('ArrayBuffer'); // detached buffers throws in `DataView` and `.slice` try { - if (typeof value.slice == 'function' && !value.resizable) { + if (isCallable(value.slice) && !value.resizable) { clone = value.slice(0); } else { length = value.byteLength; @@ -24639,13 +24636,7 @@ var cloneView = function (value, type, offset, length, map) { return new C(cloneBuffer(value.buffer, map), offset, length); }; -var Placeholder = function (object, type, metadata) { - this.object = object; - this.type = type; - this.metadata = metadata; -}; - -var structuredCloneInternal = function (value, map, transferredBuffers) { +var structuredCloneInternal = function (value, map) { if (isSymbol(value)) throwUncloneable('Symbol'); if (!isObject(value)) return value; // effectively preserves circular references @@ -24678,34 +24669,21 @@ var structuredCloneInternal = function (value, map, transferredBuffers) { name = value.name; switch (name) { case 'AggregateError': - cloned = new (getBuiltin('AggregateError'))([]); + cloned = new (getBuiltIn(name))([]); break; case 'EvalError': - cloned = new EvalError(); - break; case 'RangeError': - cloned = new RangeError(); - break; case 'ReferenceError': - cloned = new ReferenceError(); - break; + case 'SuppressedError': case 'SyntaxError': - cloned = new SyntaxError(); - break; case 'TypeError': - cloned = new TypeError(); - break; case 'URIError': - cloned = new URIError(); + cloned = new (getBuiltIn(name))(); break; case 'CompileError': - cloned = new CompileError(); - break; case 'LinkError': - cloned = new LinkError(); - break; case 'RuntimeError': - cloned = new RuntimeError(); + cloned = new (getBuiltIn('WebAssembly', name))(); break; default: cloned = new Error(); @@ -24716,9 +24694,7 @@ var structuredCloneInternal = function (value, map, transferredBuffers) { break; case 'ArrayBuffer': case 'SharedArrayBuffer': - cloned = transferredBuffers - ? new Placeholder(value, type) - : cloneBuffer(value, map, type); + cloned = cloneBuffer(value, map, type); break; case 'DataView': case 'Int8Array': @@ -24734,17 +24710,15 @@ var structuredCloneInternal = function (value, map, transferredBuffers) { case 'BigInt64Array': case 'BigUint64Array': length = type === 'DataView' ? value.byteLength : value.length; - cloned = transferredBuffers - ? new Placeholder(value, type, { offset: value.byteOffset, length: length }) - : cloneView(value, type, value.byteOffset, length, map); + cloned = cloneView(value, type, value.byteOffset, length, map); break; case 'DOMQuad': try { cloned = new DOMQuad( - structuredCloneInternal(value.p1, map, transferredBuffers), - structuredCloneInternal(value.p2, map, transferredBuffers), - structuredCloneInternal(value.p3, map, transferredBuffers), - structuredCloneInternal(value.p4, map, transferredBuffers) + structuredCloneInternal(value.p1, map), + structuredCloneInternal(value.p2, map), + structuredCloneInternal(value.p3, map), + structuredCloneInternal(value.p4, map) ); } catch (error) { cloned = tryNativeRestrictedStructuredClone(value, type); @@ -24765,7 +24739,7 @@ var structuredCloneInternal = function (value, map, transferredBuffers) { dataTransfer = createDataTransfer(); if (dataTransfer) { for (i = 0, length = lengthOfArrayLike(value); i < length; i++) { - dataTransfer.items.add(structuredCloneInternal(value[i], map, transferredBuffers)); + dataTransfer.items.add(structuredCloneInternal(value[i], map)); } cloned = dataTransfer.files; } else cloned = tryNativeRestrictedStructuredClone(value, type); @@ -24774,7 +24748,7 @@ var structuredCloneInternal = function (value, map, transferredBuffers) { // Safari 9 ImageData is a constructor, but typeof ImageData is 'object' try { cloned = new ImageData( - structuredCloneInternal(value.data, map, transferredBuffers), + structuredCloneInternal(value.data, map), value.width, value.height, { colorSpace: value.colorSpace } @@ -24871,105 +24845,38 @@ var structuredCloneInternal = function (value, map, transferredBuffers) { keys = objectKeys(value); for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) { key = keys[i]; - createProperty(cloned, key, structuredCloneInternal(value[key], map, transferredBuffers)); + createProperty(cloned, key, structuredCloneInternal(value[key], map)); } break; case 'Map': value.forEach(function (v, k) { - mapSet(cloned, structuredCloneInternal(k, map, transferredBuffers), structuredCloneInternal(v, map, transferredBuffers)); + mapSet(cloned, structuredCloneInternal(k, map), structuredCloneInternal(v, map)); }); break; case 'Set': value.forEach(function (v) { - setAdd(cloned, structuredCloneInternal(v, map, transferredBuffers)); + setAdd(cloned, structuredCloneInternal(v, map)); }); break; case 'Error': - createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map, transferredBuffers)); + createNonEnumerableProperty(cloned, 'message', structuredCloneInternal(value.message, map)); if (hasOwn(value, 'cause')) { - createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map, transferredBuffers)); + createNonEnumerableProperty(cloned, 'cause', structuredCloneInternal(value.cause, map)); } if (name === 'AggregateError') { - cloned.errors = structuredCloneInternal(value.errors, map, transferredBuffers); + cloned.errors = structuredCloneInternal(value.errors, map); + } else if (name === 'SuppressedError') { + cloned.error = structuredCloneInternal(value.error, map); + cloned.suppressed = structuredCloneInternal(value.suppressed, map); } // break omitted case 'DOMException': if (ERROR_STACK_INSTALLABLE) { - createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map, transferredBuffers)); + createNonEnumerableProperty(cloned, 'stack', structuredCloneInternal(value.stack, map)); } } return cloned; }; -var replacePlaceholders = function (value, map) { - if (!isObject(value)) return value; - if (mapHas(map, value)) return mapGet(map, value); - - var type, object, metadata, i, length, keys, key, replacement; - - if (value instanceof Placeholder) { - type = value.type; - object = value.object; - - switch (type) { - case 'ArrayBuffer': - case 'SharedArrayBuffer': - replacement = cloneBuffer(object, map, type); - break; - case 'DataView': - case 'Int8Array': - case 'Uint8Array': - case 'Uint8ClampedArray': - case 'Int16Array': - case 'Uint16Array': - case 'Int32Array': - case 'Uint32Array': - case 'Float16Array': - case 'Float32Array': - case 'Float64Array': - case 'BigInt64Array': - case 'BigUint64Array': - metadata = value.metadata; - replacement = cloneView(object, type, metadata.offset, metadata.length, map); - } - } else switch (classof(value)) { - case 'Array': - case 'Object': - keys = objectKeys(value); - for (i = 0, length = lengthOfArrayLike(keys); i < length; i++) { - key = keys[i]; - value[key] = replacePlaceholders(value[key], map); - } break; - case 'Map': - replacement = new Map(); - value.forEach(function (v, k) { - mapSet(replacement, replacePlaceholders(k, map), replacePlaceholders(v, map)); - }); - break; - case 'Set': - replacement = new Set(); - value.forEach(function (v) { - setAdd(replacement, replacePlaceholders(v, map)); - }); - break; - case 'Error': - value.message = replacePlaceholders(value.message, map); - if (hasOwn(value, 'cause')) { - value.cause = replacePlaceholders(value.cause, map); - } - if (value.name === 'AggregateError') { - value.errors = replacePlaceholders(value.errors, map); - } // break omitted - case 'DOMException': - if (ERROR_STACK_INSTALLABLE) { - value.stack = replacePlaceholders(value.stack, map); - } - } - - mapSet(map, value, replacement || value); - - return replacement || value; -}; - var tryToTransfer = function (rawTransfer, map) { if (!isObject(rawTransfer)) throw new TypeError('Transfer option cannot be converted to a sequence'); @@ -24981,7 +24888,7 @@ var tryToTransfer = function (rawTransfer, map) { var i = 0; var length = lengthOfArrayLike(transfer); - var buffers = []; + var buffers = new Set(); var value, type, C, transferred, canvas, context; while (i < length) { @@ -24989,12 +24896,14 @@ var tryToTransfer = function (rawTransfer, map) { type = classof(value); - if (type === 'ArrayBuffer') { - push(buffers, value); - continue; + if (type === 'ArrayBuffer' ? setHas(buffers, value) : mapHas(map, value)) { + throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR); } - if (mapHas(map, value)) throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR); + if (type === 'ArrayBuffer') { + setAdd(buffers, value); + continue; + } if (PROPER_STRUCTURED_CLONE_TRANSFER) { transferred = nativeStructuredClone(value, { transfer: [value] }); @@ -25034,25 +24943,18 @@ var tryToTransfer = function (rawTransfer, map) { return buffers; }; -var tryToTransferBuffers = function (transfer, map) { - var i = 0; - var length = lengthOfArrayLike(transfer); - var value, transferred; - - while (i < length) { - value = transfer[i++]; - - if (mapHas(map, value)) throw new DOMException('Duplicate transferable', DATA_CLONE_ERROR); - - if (arrayBufferTransfer) { - transferred = arrayBufferTransfer(value, undefined, true); +var detachBuffers = function (buffers) { + setIterate(buffers, function (buffer) { + if (PROPER_STRUCTURED_CLONE_TRANSFER) { + nativeRestrictedStructuredClone(buffer, { transfer: [buffer] }); + } else if (isCallable(buffer.transfer)) { + buffer.transfer(); + } else if (detachTransferable) { + detachTransferable(buffer); } else { - if (!isCallable(value.transfer)) throwUnpolyfillable('ArrayBuffer', TRANSFERRING); - transferred = value.transfer(); + throwUnpolyfillable('ArrayBuffer', TRANSFERRING); } - - mapSet(map, value, transferred); - } + }); }; // `structuredClone` method @@ -25061,24 +24963,18 @@ $({ global: true, enumerable: true, sham: !PROPER_STRUCTURED_CLONE_TRANSFER, for structuredClone: function structuredClone(value /* , { transfer } */) { var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : undefined; var transfer = options ? options.transfer : undefined; - var transferredBuffers = false; var map, buffers; if (transfer !== undefined) { map = new Map(); buffers = tryToTransfer(transfer, map); - transferredBuffers = !!lengthOfArrayLike(buffers); } - var clone = structuredCloneInternal(value, map, transferredBuffers); + var clone = structuredCloneInternal(value, map); - // since of an issue with cloning views of transferred buffers, we a forced to transfer / clone them in 2 steps + // since of an issue with cloning views of transferred buffers, we a forced to detach them later // https://github.com/zloirock/core-js/issues/1265 - if (transferredBuffers) { - map = new Map(); - tryToTransferBuffers(transfer, map); - clone = replacePlaceholders(clone, map); - } + if (buffers) detachBuffers(buffers); return clone; } @@ -26468,6 +26364,7 @@ var create = __webpack_require__(72); var createPropertyDescriptor = __webpack_require__(11); var getIterator = __webpack_require__(135); var getIteratorMethod = __webpack_require__(136); +var createIterResultObject = __webpack_require__(173); var validateArgumentsLength = __webpack_require__(329); var wellKnownSymbol = __webpack_require__(34); var arraySort = __webpack_require__(189); @@ -26556,17 +26453,23 @@ var serialize = function (it) { var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params, kind) { setInternalState(this, { type: URL_SEARCH_PARAMS_ITERATOR, - iterator: getIterator(getInternalParamsState(params).entries), + target: getInternalParamsState(params).entries, + index: 0, kind: kind }); -}, 'Iterator', function next() { +}, URL_SEARCH_PARAMS, function next() { var state = getInternalIteratorState(this); - var kind = state.kind; - var step = state.iterator.next(); - var entry = step.value; - if (!step.done) { - step.value = kind === 'keys' ? entry.key : kind === 'values' ? entry.value : [entry.key, entry.value]; - } return step; + var target = state.target; + var index = state.index++; + if (!target || index >= target.length) { + state.target = undefined; + return createIterResultObject(undefined, true); + } + var entry = target[index]; + switch (state.kind) { + case 'keys': return createIterResultObject(entry.key, false); + case 'values': return createIterResultObject(entry.value, false); + } return createIterResultObject([entry.key, entry.value], false); }, true); var URLSearchParamsState = function (init) { @@ -26586,6 +26489,7 @@ URLSearchParamsState.prototype = { this.update(); }, parseObject: function (object) { + var entries = this.entries; var iteratorMethod = getIteratorMethod(object); var iterator, next, step, entryIterator, entryNext, first, second; @@ -26600,14 +26504,15 @@ URLSearchParamsState.prototype = { (second = call(entryNext, entryIterator)).done || !call(entryNext, entryIterator).done ) throw new TypeError('Expected sequence with length 2'); - push(this.entries, { key: $toString(first.value), value: $toString(second.value) }); + push(entries, { key: $toString(first.value), value: $toString(second.value) }); } } else for (var key in object) if (hasOwn(object, key)) { - push(this.entries, { key: key, value: $toString(object[key]) }); + push(entries, { key: key, value: $toString(object[key]) }); } }, parseQuery: function (query) { if (query) { + var entries = this.entries; var attributes = split(query, '&'); var index = 0; var attribute, entry; @@ -26615,7 +26520,7 @@ URLSearchParamsState.prototype = { attribute = attributes[index++]; if (attribute.length) { entry = split(attribute, '='); - push(this.entries, { + push(entries, { key: deserialize(shift(entry)), value: deserialize(join(entry, '=')) }); diff --git a/game/game.js b/game/game.js index 3907b2be6..d9c8f11d2 100644 --- a/game/game.js +++ b/game/game.js @@ -1,5 +1,15 @@ "use strict"; -{ +const nonameInitialized=localStorage.getItem('noname_inited'); +const assetURL=typeof nonameInitialized!='string'||nonameInitialized=='nodejs'?'':nonameInitialized; +new Promise(resolve=>{ + if('__core-js_shared__' in window) resolve(); + else{ + const coreJSBundle=document.createElement('script'); + coreJSBundle.onerror=coreJSBundle.onload=resolve; + coreJSBundle.src=`${assetURL}game/core-js-bundle.js`; + document.head.appendChild(coreJSBundle); + } +}).then(()=>{ /** * @typedef {InstanceType} Player * @typedef {InstanceType} Card @@ -36,7 +46,6 @@ } } } - const nonameInitialized=localStorage.getItem('noname_inited'); const GeneratorFunction=(function*(){}).constructor; // gnc: GeNCoroutine const gnc={ @@ -122,7 +131,7 @@ updateURL:'https://raw.githubusercontent.com/libccy/noname', mirrorURL:'https://raw.fgit.cf/libccy/noname', hallURL:'47.99.105.222', - assetURL:typeof nonameInitialized!='string'||nonameInitialized=='nodejs'?'':nonameInitialized, + assetURL:assetURL, userAgent:userAgent, compatibleEdition:Boolean(typeof nonameInitialized=='string'&&nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)), changeLog:[], @@ -32541,7 +32550,7 @@ } if(game.online||game.onlineroom){ if((game.servermode||game.onlinehall)&&_status.over){ - + void 0; } else{ localStorage.setItem(lib.configprefix+'directstart',true); @@ -35155,9 +35164,7 @@ } } if(!_status.requestReadClipboard&&get.config('read_clipboard','connect')){ - //每次启动只请求一次 - _status.requestReadClipboard=true; - function read(text){ + const read=text=>{ try{ var roomId=text.split('\n')[1].match(/\d+/); var caption=ui.rooms.find(caption=>caption.key==roomId); @@ -35167,6 +35174,8 @@ } }catch(e){console.log(e)} } + //每次启动只请求一次 + _status.requestReadClipboard=true; if(_status.read_clipboard_text){ read(_status.read_clipboard_text); }else{ @@ -37431,7 +37440,7 @@ ui.create.chat(); if(game.onlineroom){ - + void 0; } else{ var WebSocketServer=require('ws').Server; @@ -44912,7 +44921,7 @@ config.item=config.item(); } if(Array.isArray(config.init)){ - + void 0; } else{ node.classList.add('switcher'); @@ -44990,7 +44999,7 @@ } } else if(config.range){ - + void 0; } else if(config.clear){ if(node.innerHTML.length>=15) node.style.height='auto'; @@ -53757,19 +53766,15 @@ }, player:(position,noclick)=>new lib.element.Player(position,noclick), connectPlayers:ip=>{ + ui.updateConnectPlayerPositions(); game.connectPlayers=[]; - let numberOfPlayers=lib.configOL.number; - const gameMode=lib.configOL.mode; - if(gameMode=='guozhan'||(gameMode=='identity'&&(lib.configOL.identity_mode!='zhong'&&lib.configOL.identity_mode!='purple'))){ - numberOfPlayers=10; - } - ui.updateConnectPlayerPositions(numberOfPlayers); + const configOL=lib.configOL; + const numberOfPlayers=parseInt(configOL.player_number)||configOL.number; for(let position=0;position=lib.configOL.number) player.classList.add('unselectable2'); } var bar=ui.create.div(ui.window); @@ -53801,7 +53806,7 @@ for(var i of game.connectPlayers){ if(!i.nickname&&!i.classList.contains('unselectable2')) num++; } - if(num>=numberOfPlayers-1){ + if(num>=lib.configOL.number-1){ alert('至少要有两名玩家才能开始游戏!'); return; } @@ -58542,7 +58547,10 @@ * @param {number} [numberOfPlayers] */ updateConnectPlayerPositions:numberOfPlayers=>{ - if(typeof numberOfPlayers!='number') numberOfPlayers=lib.configOL.number; + if(typeof numberOfPlayers!='number'){ + const configOL=lib.configOL; + numberOfPlayers=parseInt(configOL.player_number)||configOL.number; + } if(!numberOfPlayers) return; const playerPositions=ui.playerPositions; playerPositions.forEach((position) => { @@ -59778,14 +59786,14 @@ case 'guandu':return '官渡之战'; } } - else if(config.mode=='single'){ + if(config.mode=='single'){ switch(config.single_mode){ case 'normal':return '新1v1'; case 'changban':return '血战长坂坡'; case 'dianjiang':return '点将单挑'; } } - else if(config.mode=='identity'){ + if(config.mode=='identity'){ switch(config.identity_mode){ case 'purple':return '三对三对二'; case 'zhong':return (config.double_character?'双将':'')+'忠胆英杰'; @@ -59793,20 +59801,18 @@ default:return `${get.cnNumber(parseInt(config.number))}人${config.double_nei?'双内':''}${config.enable_commoner?'带民':''}${config.double_character?'双将':''}身份`; } } - else if(config.mode=='guozhan'){ + if(config.mode=='guozhan'){ if(config.separatism) return '群雄割据'; if(config.guozhan_mode!='normal') switch(config.guozhan_mode){ case 'yingbian':return '应变国战'; case 'old':return '怀旧国战'; } } + if(server){ + return get.translation(config.mode)+'模式'; + } else{ - if(server){ - return get.translation(config.mode)+'模式'; - } - else{ - return get.cnNumber(parseInt(config.number))+'人'+get.translation(config.mode); - } + return get.cnNumber(parseInt(config.number))+'人'+get.translation(config.mode); } }, charactersOL:func=>{ @@ -63452,11 +63458,5 @@ setAllPropertiesEnumerable(lib.element.Control.prototype); setAllPropertiesEnumerable(lib.element.Client.prototype); setAllPropertiesEnumerable(lib.element.NodeWS.prototype); - if('__core-js_shared__' in window) lib.init.init(); - else{ - const coreJSBundle=document.createElement('script'); - coreJSBundle.onerror=coreJSBundle.onload=lib.init.init; - coreJSBundle.src=`${lib.assetURL}game/core-js-bundle.js`; - document.head.appendChild(coreJSBundle); - } -} + lib.init.init(); +}); diff --git a/layout/default/layout.css b/layout/default/layout.css index 8b406b722..0058030b0 100644 --- a/layout/default/layout.css +++ b/layout/default/layout.css @@ -3256,38 +3256,6 @@ div:not(.handcards)>.card>.info>span, left: calc(50% - 106px); } -#window>.player.connect[data-position='0'] { - left: calc(25% - 120px); - top: calc(300% / 7 - 155px); -} -#window>.player.connect[data-position='1'] { - left: calc(50% - 60px); - top: calc(300% / 7 - 155px); -} -#window>.player.connect[data-position='2'] { - left: calc(75% - 0px); - top: calc(300% / 7 - 155px); -} -#window>.player.connect[data-position='3'] { - left: calc(25% - 120px); - top: calc(400% / 7 - 75px); -} -#window>.player.connect[data-position='4'] { - left: calc(75% - 0px); - top: calc(400% / 7 - 75px); -} -#window>.player.connect[data-position='5'] { - left: calc(25% - 120px); - top: calc(500% / 7 + 5px); -} -#window>.player.connect[data-position='6'] { - left: calc(50% - 60px); - top: calc(500% / 7 + 5px); -} -#window>.player.connect[data-position='7'] { - left: calc(75% - 0px); - top: calc(500% / 7 + 5px); -} #window>.player.connect[data-position='c0'] { left: calc(50% - 120px); top: calc(50% - 200px) diff --git a/mode/connect.js b/mode/connect.js index dc709ecd0..6772b11dc 100644 --- a/mode/connect.js +++ b/mode/connect.js @@ -42,17 +42,20 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ node.style.overflow='hidden'; var connect=function(e){ - const info=lib.config.reconnect_info; - if(info&&info[0]==node.textContent){ - game.onlineID=info[1]; - if(typeof (game.roomId=info[2])=='string') game.roomIdServer=true; - } event.textnode.textContent='正在连接...'; clearTimeout(event.timeout); if(e) e.preventDefault(); game.saveConfig('last_ip',node.textContent); game.connect(node.textContent,function(success){ - if(!success&&event.textnode){ + if(success){ + var info=lib.config.reconnect_info; + if(info&&info[0]==_status.ip){ + game.onlineID=info[1]; + if(typeof (game.roomId=info[2])=='string') game.roomIdServer=true; + } + return; + } + if(event.textnode){ alert('连接失败'); event.textnode.textContent='输入联机地址'; } @@ -121,7 +124,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ },220); if (get.config('read_clipboard','connect')){ var ced=false; - function read(text){ + var read=text=>{ try{ var text2=text.split('\n')[2]; var ip=text2.slice(5);