Projektstart

This commit is contained in:
2026-01-22 15:49:12 +01:00
parent 7212eb6f7a
commit 57e5f652f8
10637 changed files with 2598792 additions and 64 deletions

406
backend/node_modules/fast-copy/dist/cjs/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,406 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var toStringFunction = Function.prototype.toString;
var create = Object.create;
var toStringObject = Object.prototype.toString;
/**
* @classdesc Fallback cache for when WeakMap is not natively supported
*/
var LegacyCache = /** @class */ (function () {
function LegacyCache() {
this._keys = [];
this._values = [];
}
LegacyCache.prototype.has = function (key) {
return !!~this._keys.indexOf(key);
};
LegacyCache.prototype.get = function (key) {
return this._values[this._keys.indexOf(key)];
};
LegacyCache.prototype.set = function (key, value) {
this._keys.push(key);
this._values.push(value);
};
return LegacyCache;
}());
function createCacheLegacy() {
return new LegacyCache();
}
function createCacheModern() {
return new WeakMap();
}
/**
* Get a new cache object to prevent circular references.
*/
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
/**
* Get an empty version of the object with the same prototype it has.
*/
function getCleanClone(prototype) {
if (!prototype) {
return create(null);
}
var Constructor = prototype.constructor;
if (Constructor === Object) {
return prototype === Object.prototype ? {} : create(prototype);
}
if (Constructor &&
~toStringFunction.call(Constructor).indexOf('[native code]')) {
try {
return new Constructor();
}
catch (_a) { }
}
return create(prototype);
}
function getRegExpFlagsLegacy(regExp) {
var flags = '';
if (regExp.global) {
flags += 'g';
}
if (regExp.ignoreCase) {
flags += 'i';
}
if (regExp.multiline) {
flags += 'm';
}
if (regExp.unicode) {
flags += 'u';
}
if (regExp.sticky) {
flags += 'y';
}
return flags;
}
function getRegExpFlagsModern(regExp) {
return regExp.flags;
}
/**
* Get the flags to apply to the copied regexp.
*/
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
function getTagLegacy(value) {
var type = toStringObject.call(value);
return type.substring(8, type.length - 1);
}
function getTagModern(value) {
return value[Symbol.toStringTag] || getTagLegacy(value);
}
/**
* Get the tag of the value passed, so that the correct copier can be used.
*/
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
function getStrictPropertiesModern(object) {
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
}
/**
* Get the properites used when copying objects strictly. This includes both keys and symbols.
*/
var getStrictProperties = SUPPORTS_SYMBOL
? getStrictPropertiesModern
: getOwnPropertyNames;
/**
* Striclty copy all properties contained on the object.
*/
function copyOwnPropertiesStrict(value, clone, state) {
var properties = getStrictProperties(value);
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
property = properties[index];
if (property === 'callee' || property === 'caller') {
continue;
}
descriptor = getOwnPropertyDescriptor(value, property);
if (!descriptor) {
// In extra edge cases where the property descriptor cannot be retrived, fall back to
// the loose assignment.
clone[property] = state.copier(value[property], state);
continue;
}
// Only clone the value if actually a value, not a getter / setter.
if (!descriptor.get && !descriptor.set) {
descriptor.value = state.copier(descriptor.value, state);
}
try {
defineProperty(clone, property, descriptor);
}
catch (error) {
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
clone[property] = descriptor.value;
}
}
return clone;
}
/**
* Deeply copy the indexed values in the array.
*/
function copyArrayLoose(array, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(array, clone);
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
clone[index] = state.copier(array[index], state);
}
return clone;
}
/**
* Deeply copy the indexed values in the array, as well as any custom properties.
*/
function copyArrayStrict(array, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(array, clone);
return copyOwnPropertiesStrict(array, clone, state);
}
/**
* Copy the contents of the ArrayBuffer.
*/
function copyArrayBuffer(arrayBuffer, _state) {
return arrayBuffer.slice(0);
}
/**
* Create a new Blob with the contents of the original.
*/
function copyBlob(blob, _state) {
return blob.slice(0, blob.size, blob.type);
}
/**
* Create a new DataView with the contents of the original.
*/
function copyDataView(dataView, state) {
return new state.Constructor(copyArrayBuffer(dataView.buffer));
}
/**
* Create a new Date based on the time of the original.
*/
function copyDate(date, state) {
return new state.Constructor(date.getTime());
}
/**
* Deeply copy the keys and values of the original.
*/
function copyMapLoose(map, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(map, clone);
map.forEach(function (value, key) {
clone.set(key, state.copier(value, state));
});
return clone;
}
/**
* Deeply copy the keys and values of the original, as well as any custom properties.
*/
function copyMapStrict(map, state) {
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
}
function copyObjectLooseLegacy(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
clone[key] = state.copier(object[key], state);
}
}
return clone;
}
function copyObjectLooseModern(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
clone[key] = state.copier(object[key], state);
}
}
var symbols = getOwnPropertySymbols(object);
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
symbol = symbols[index];
if (propertyIsEnumerable.call(object, symbol)) {
clone[symbol] = state.copier(object[symbol], state);
}
}
return clone;
}
/**
* Deeply copy the properties (keys and symbols) and values of the original.
*/
var copyObjectLoose = SUPPORTS_SYMBOL
? copyObjectLooseModern
: copyObjectLooseLegacy;
/**
* Deeply copy the properties (keys and symbols) and values of the original, as well
* as any hidden or non-enumerable properties.
*/
function copyObjectStrict(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
return copyOwnPropertiesStrict(object, clone, state);
}
/**
* Create a new primitive wrapper from the value of the original.
*/
function copyPrimitiveWrapper(primitiveObject, state) {
return new state.Constructor(primitiveObject.valueOf());
}
/**
* Create a new RegExp based on the value and flags of the original.
*/
function copyRegExp(regExp, state) {
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
clone.lastIndex = regExp.lastIndex;
return clone;
}
/**
* Return the original value (an identity function).
*
* @note
* THis is used for objects that cannot be copied, such as WeakMap.
*/
function copySelf(value, _state) {
return value;
}
/**
* Deeply copy the values of the original.
*/
function copySetLoose(set, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(set, clone);
set.forEach(function (value) {
clone.add(state.copier(value, state));
});
return clone;
}
/**
* Deeply copy the values of the original, as well as any custom properties.
*/
function copySetStrict(set, state) {
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
}
var isArray = Array.isArray;
var assign = Object.assign;
var getPrototypeOf = Object.getPrototypeOf || (function (obj) { return obj.__proto__; });
var DEFAULT_LOOSE_OPTIONS = {
array: copyArrayLoose,
arrayBuffer: copyArrayBuffer,
blob: copyBlob,
dataView: copyDataView,
date: copyDate,
error: copySelf,
map: copyMapLoose,
object: copyObjectLoose,
regExp: copyRegExp,
set: copySetLoose,
};
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
array: copyArrayStrict,
map: copyMapStrict,
object: copyObjectStrict,
set: copySetStrict,
});
/**
* Get the copiers used for each specific object tag.
*/
function getTagSpecificCopiers(options) {
return {
Arguments: options.object,
Array: options.array,
ArrayBuffer: options.arrayBuffer,
Blob: options.blob,
Boolean: copyPrimitiveWrapper,
DataView: options.dataView,
Date: options.date,
Error: options.error,
Float32Array: options.arrayBuffer,
Float64Array: options.arrayBuffer,
Int8Array: options.arrayBuffer,
Int16Array: options.arrayBuffer,
Int32Array: options.arrayBuffer,
Map: options.map,
Number: copyPrimitiveWrapper,
Object: options.object,
Promise: copySelf,
RegExp: options.regExp,
Set: options.set,
String: copyPrimitiveWrapper,
WeakMap: copySelf,
WeakSet: copySelf,
Uint8Array: options.arrayBuffer,
Uint8ClampedArray: options.arrayBuffer,
Uint16Array: options.arrayBuffer,
Uint32Array: options.arrayBuffer,
Uint64Array: options.arrayBuffer,
};
}
/**
* Create a custom copier based on the object-specific copy methods passed.
*/
function createCopier(options) {
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
function copier(value, state) {
state.prototype = state.Constructor = undefined;
if (!value || typeof value !== 'object') {
return value;
}
if (state.cache.has(value)) {
return state.cache.get(value);
}
state.prototype = getPrototypeOf(value);
state.Constructor = state.prototype && state.prototype.constructor;
// plain objects
if (!state.Constructor || state.Constructor === Object) {
return object(value, state);
}
// arrays
if (isArray(value)) {
return array(value, state);
}
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
if (tagSpecificCopier) {
return tagSpecificCopier(value, state);
}
return typeof value.then === 'function' ? value : object(value, state);
}
return function copy(value) {
return copier(value, {
Constructor: undefined,
cache: createCache(),
copier: copier,
prototype: undefined,
});
};
}
/**
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
* same internals as `copyStrict`.
*/
function createStrictCopier(options) {
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
}
/**
* Copy an value deeply as much as possible, where strict recreation of object properties
* are maintained. All properties (including non-enumerable ones) are copied with their
* original property descriptors on both objects and arrays.
*/
var copyStrict = createStrictCopier({});
/**
* Copy an value deeply as much as possible.
*/
var index = createCopier({});
exports.copyStrict = copyStrict;
exports.createCopier = createCopier;
exports.createStrictCopier = createStrictCopier;
exports.default = index;
//# sourceMappingURL=index.cjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
import type { Cache } from './utils';
export type InternalCopier<Value> = (value: Value, state: State) => Value;
export interface State {
Constructor: any;
cache: Cache;
copier: InternalCopier<any>;
prototype: any;
}
/**
* Deeply copy the indexed values in the array.
*/
export declare function copyArrayLoose(array: any[], state: State): any;
/**
* Deeply copy the indexed values in the array, as well as any custom properties.
*/
export declare function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value;
/**
* Copy the contents of the ArrayBuffer.
*/
export declare function copyArrayBuffer<Value extends ArrayBuffer>(arrayBuffer: Value, _state: State): Value;
/**
* Create a new Blob with the contents of the original.
*/
export declare function copyBlob<Value extends Blob>(blob: Value, _state: State): Value;
/**
* Create a new DataView with the contents of the original.
*/
export declare function copyDataView<Value extends DataView>(dataView: Value, state: State): Value;
/**
* Create a new Date based on the time of the original.
*/
export declare function copyDate<Value extends Date>(date: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original.
*/
export declare function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original, as well as any custom properties.
*/
export declare function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value;
declare function copyObjectLooseModern<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Deeply copy the properties (keys and symbols) and values of the original.
*/
export declare const copyObjectLoose: typeof copyObjectLooseModern;
/**
* Deeply copy the properties (keys and symbols) and values of the original, as well
* as any hidden or non-enumerable properties.
*/
export declare function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Create a new primitive wrapper from the value of the original.
*/
export declare function copyPrimitiveWrapper<Value extends Boolean | Number | String>(primitiveObject: Value, state: State): Value;
/**
* Create a new RegExp based on the value and flags of the original.
*/
export declare function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value;
/**
* Return the original value (an identity function).
*
* @note
* THis is used for objects that cannot be copied, such as WeakMap.
*/
export declare function copySelf<Value>(value: Value, _state: State): Value;
/**
* Deeply copy the values of the original.
*/
export declare function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value;
/**
* Deeply copy the values of the original, as well as any custom properties.
*/
export declare function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value;
export {};

View File

@@ -0,0 +1,34 @@
import type { InternalCopier } from './copier';
export type { State } from './copier';
export interface CreateCopierOptions {
array?: InternalCopier<any[]>;
arrayBuffer?: InternalCopier<ArrayBuffer>;
blob?: InternalCopier<Blob>;
dataView?: InternalCopier<DataView>;
date?: InternalCopier<Date>;
error?: InternalCopier<any>;
map?: InternalCopier<Map<any, any>>;
object?: InternalCopier<Record<string, any>>;
regExp?: InternalCopier<RegExp>;
set?: InternalCopier<Set<any>>;
}
/**
* Create a custom copier based on the object-specific copy methods passed.
*/
export declare function createCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
* same internals as `copyStrict`.
*/
export declare function createStrictCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible, where strict recreation of object properties
* are maintained. All properties (including non-enumerable ones) are copied with their
* original property descriptors on both objects and arrays.
*/
export declare const copyStrict: <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible.
*/
declare const _default: <Value>(value: Value) => Value;
export default _default;

View File

@@ -0,0 +1,25 @@
export interface Cache {
has: (value: any) => boolean;
set: (key: any, value: any) => void;
get: (key: any) => any;
}
declare function createCacheModern(): Cache;
/**
* Get a new cache object to prevent circular references.
*/
export declare const createCache: typeof createCacheModern;
/**
* Get an empty version of the object with the same prototype it has.
*/
export declare function getCleanClone(prototype: any): any;
declare function getRegExpFlagsModern(regExp: RegExp): string;
/**
* Get the flags to apply to the copied regexp.
*/
export declare const getRegExpFlags: typeof getRegExpFlagsModern;
declare function getTagLegacy(value: any): string;
/**
* Get the tag of the value passed, so that the correct copier can be used.
*/
export declare const getTag: typeof getTagLegacy;
export {};

399
backend/node_modules/fast-copy/dist/esm/index.mjs generated vendored Normal file
View File

@@ -0,0 +1,399 @@
var toStringFunction = Function.prototype.toString;
var create = Object.create;
var toStringObject = Object.prototype.toString;
/**
* @classdesc Fallback cache for when WeakMap is not natively supported
*/
var LegacyCache = /** @class */ (function () {
function LegacyCache() {
this._keys = [];
this._values = [];
}
LegacyCache.prototype.has = function (key) {
return !!~this._keys.indexOf(key);
};
LegacyCache.prototype.get = function (key) {
return this._values[this._keys.indexOf(key)];
};
LegacyCache.prototype.set = function (key, value) {
this._keys.push(key);
this._values.push(value);
};
return LegacyCache;
}());
function createCacheLegacy() {
return new LegacyCache();
}
function createCacheModern() {
return new WeakMap();
}
/**
* Get a new cache object to prevent circular references.
*/
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
/**
* Get an empty version of the object with the same prototype it has.
*/
function getCleanClone(prototype) {
if (!prototype) {
return create(null);
}
var Constructor = prototype.constructor;
if (Constructor === Object) {
return prototype === Object.prototype ? {} : create(prototype);
}
if (Constructor &&
~toStringFunction.call(Constructor).indexOf('[native code]')) {
try {
return new Constructor();
}
catch (_a) { }
}
return create(prototype);
}
function getRegExpFlagsLegacy(regExp) {
var flags = '';
if (regExp.global) {
flags += 'g';
}
if (regExp.ignoreCase) {
flags += 'i';
}
if (regExp.multiline) {
flags += 'm';
}
if (regExp.unicode) {
flags += 'u';
}
if (regExp.sticky) {
flags += 'y';
}
return flags;
}
function getRegExpFlagsModern(regExp) {
return regExp.flags;
}
/**
* Get the flags to apply to the copied regexp.
*/
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
function getTagLegacy(value) {
var type = toStringObject.call(value);
return type.substring(8, type.length - 1);
}
function getTagModern(value) {
return value[Symbol.toStringTag] || getTagLegacy(value);
}
/**
* Get the tag of the value passed, so that the correct copier can be used.
*/
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
function getStrictPropertiesModern(object) {
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
}
/**
* Get the properites used when copying objects strictly. This includes both keys and symbols.
*/
var getStrictProperties = SUPPORTS_SYMBOL
? getStrictPropertiesModern
: getOwnPropertyNames;
/**
* Striclty copy all properties contained on the object.
*/
function copyOwnPropertiesStrict(value, clone, state) {
var properties = getStrictProperties(value);
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
property = properties[index];
if (property === 'callee' || property === 'caller') {
continue;
}
descriptor = getOwnPropertyDescriptor(value, property);
if (!descriptor) {
// In extra edge cases where the property descriptor cannot be retrived, fall back to
// the loose assignment.
clone[property] = state.copier(value[property], state);
continue;
}
// Only clone the value if actually a value, not a getter / setter.
if (!descriptor.get && !descriptor.set) {
descriptor.value = state.copier(descriptor.value, state);
}
try {
defineProperty(clone, property, descriptor);
}
catch (error) {
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
clone[property] = descriptor.value;
}
}
return clone;
}
/**
* Deeply copy the indexed values in the array.
*/
function copyArrayLoose(array, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(array, clone);
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
clone[index] = state.copier(array[index], state);
}
return clone;
}
/**
* Deeply copy the indexed values in the array, as well as any custom properties.
*/
function copyArrayStrict(array, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(array, clone);
return copyOwnPropertiesStrict(array, clone, state);
}
/**
* Copy the contents of the ArrayBuffer.
*/
function copyArrayBuffer(arrayBuffer, _state) {
return arrayBuffer.slice(0);
}
/**
* Create a new Blob with the contents of the original.
*/
function copyBlob(blob, _state) {
return blob.slice(0, blob.size, blob.type);
}
/**
* Create a new DataView with the contents of the original.
*/
function copyDataView(dataView, state) {
return new state.Constructor(copyArrayBuffer(dataView.buffer));
}
/**
* Create a new Date based on the time of the original.
*/
function copyDate(date, state) {
return new state.Constructor(date.getTime());
}
/**
* Deeply copy the keys and values of the original.
*/
function copyMapLoose(map, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(map, clone);
map.forEach(function (value, key) {
clone.set(key, state.copier(value, state));
});
return clone;
}
/**
* Deeply copy the keys and values of the original, as well as any custom properties.
*/
function copyMapStrict(map, state) {
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
}
function copyObjectLooseLegacy(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
clone[key] = state.copier(object[key], state);
}
}
return clone;
}
function copyObjectLooseModern(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
clone[key] = state.copier(object[key], state);
}
}
var symbols = getOwnPropertySymbols(object);
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
symbol = symbols[index];
if (propertyIsEnumerable.call(object, symbol)) {
clone[symbol] = state.copier(object[symbol], state);
}
}
return clone;
}
/**
* Deeply copy the properties (keys and symbols) and values of the original.
*/
var copyObjectLoose = SUPPORTS_SYMBOL
? copyObjectLooseModern
: copyObjectLooseLegacy;
/**
* Deeply copy the properties (keys and symbols) and values of the original, as well
* as any hidden or non-enumerable properties.
*/
function copyObjectStrict(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
return copyOwnPropertiesStrict(object, clone, state);
}
/**
* Create a new primitive wrapper from the value of the original.
*/
function copyPrimitiveWrapper(primitiveObject, state) {
return new state.Constructor(primitiveObject.valueOf());
}
/**
* Create a new RegExp based on the value and flags of the original.
*/
function copyRegExp(regExp, state) {
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
clone.lastIndex = regExp.lastIndex;
return clone;
}
/**
* Return the original value (an identity function).
*
* @note
* THis is used for objects that cannot be copied, such as WeakMap.
*/
function copySelf(value, _state) {
return value;
}
/**
* Deeply copy the values of the original.
*/
function copySetLoose(set, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(set, clone);
set.forEach(function (value) {
clone.add(state.copier(value, state));
});
return clone;
}
/**
* Deeply copy the values of the original, as well as any custom properties.
*/
function copySetStrict(set, state) {
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
}
var isArray = Array.isArray;
var assign = Object.assign;
var getPrototypeOf = Object.getPrototypeOf || (function (obj) { return obj.__proto__; });
var DEFAULT_LOOSE_OPTIONS = {
array: copyArrayLoose,
arrayBuffer: copyArrayBuffer,
blob: copyBlob,
dataView: copyDataView,
date: copyDate,
error: copySelf,
map: copyMapLoose,
object: copyObjectLoose,
regExp: copyRegExp,
set: copySetLoose,
};
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
array: copyArrayStrict,
map: copyMapStrict,
object: copyObjectStrict,
set: copySetStrict,
});
/**
* Get the copiers used for each specific object tag.
*/
function getTagSpecificCopiers(options) {
return {
Arguments: options.object,
Array: options.array,
ArrayBuffer: options.arrayBuffer,
Blob: options.blob,
Boolean: copyPrimitiveWrapper,
DataView: options.dataView,
Date: options.date,
Error: options.error,
Float32Array: options.arrayBuffer,
Float64Array: options.arrayBuffer,
Int8Array: options.arrayBuffer,
Int16Array: options.arrayBuffer,
Int32Array: options.arrayBuffer,
Map: options.map,
Number: copyPrimitiveWrapper,
Object: options.object,
Promise: copySelf,
RegExp: options.regExp,
Set: options.set,
String: copyPrimitiveWrapper,
WeakMap: copySelf,
WeakSet: copySelf,
Uint8Array: options.arrayBuffer,
Uint8ClampedArray: options.arrayBuffer,
Uint16Array: options.arrayBuffer,
Uint32Array: options.arrayBuffer,
Uint64Array: options.arrayBuffer,
};
}
/**
* Create a custom copier based on the object-specific copy methods passed.
*/
function createCopier(options) {
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
function copier(value, state) {
state.prototype = state.Constructor = undefined;
if (!value || typeof value !== 'object') {
return value;
}
if (state.cache.has(value)) {
return state.cache.get(value);
}
state.prototype = getPrototypeOf(value);
state.Constructor = state.prototype && state.prototype.constructor;
// plain objects
if (!state.Constructor || state.Constructor === Object) {
return object(value, state);
}
// arrays
if (isArray(value)) {
return array(value, state);
}
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
if (tagSpecificCopier) {
return tagSpecificCopier(value, state);
}
return typeof value.then === 'function' ? value : object(value, state);
}
return function copy(value) {
return copier(value, {
Constructor: undefined,
cache: createCache(),
copier: copier,
prototype: undefined,
});
};
}
/**
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
* same internals as `copyStrict`.
*/
function createStrictCopier(options) {
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
}
/**
* Copy an value deeply as much as possible, where strict recreation of object properties
* are maintained. All properties (including non-enumerable ones) are copied with their
* original property descriptors on both objects and arrays.
*/
var copyStrict = createStrictCopier({});
/**
* Copy an value deeply as much as possible.
*/
var index = createCopier({});
export { copyStrict, createCopier, createStrictCopier, index as default };
//# sourceMappingURL=index.mjs.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
import type { Cache } from './utils';
export type InternalCopier<Value> = (value: Value, state: State) => Value;
export interface State {
Constructor: any;
cache: Cache;
copier: InternalCopier<any>;
prototype: any;
}
/**
* Deeply copy the indexed values in the array.
*/
export declare function copyArrayLoose(array: any[], state: State): any;
/**
* Deeply copy the indexed values in the array, as well as any custom properties.
*/
export declare function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value;
/**
* Copy the contents of the ArrayBuffer.
*/
export declare function copyArrayBuffer<Value extends ArrayBuffer>(arrayBuffer: Value, _state: State): Value;
/**
* Create a new Blob with the contents of the original.
*/
export declare function copyBlob<Value extends Blob>(blob: Value, _state: State): Value;
/**
* Create a new DataView with the contents of the original.
*/
export declare function copyDataView<Value extends DataView>(dataView: Value, state: State): Value;
/**
* Create a new Date based on the time of the original.
*/
export declare function copyDate<Value extends Date>(date: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original.
*/
export declare function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original, as well as any custom properties.
*/
export declare function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value;
declare function copyObjectLooseModern<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Deeply copy the properties (keys and symbols) and values of the original.
*/
export declare const copyObjectLoose: typeof copyObjectLooseModern;
/**
* Deeply copy the properties (keys and symbols) and values of the original, as well
* as any hidden or non-enumerable properties.
*/
export declare function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Create a new primitive wrapper from the value of the original.
*/
export declare function copyPrimitiveWrapper<Value extends Boolean | Number | String>(primitiveObject: Value, state: State): Value;
/**
* Create a new RegExp based on the value and flags of the original.
*/
export declare function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value;
/**
* Return the original value (an identity function).
*
* @note
* THis is used for objects that cannot be copied, such as WeakMap.
*/
export declare function copySelf<Value>(value: Value, _state: State): Value;
/**
* Deeply copy the values of the original.
*/
export declare function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value;
/**
* Deeply copy the values of the original, as well as any custom properties.
*/
export declare function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value;
export {};

View File

@@ -0,0 +1,34 @@
import type { InternalCopier } from './copier';
export type { State } from './copier';
export interface CreateCopierOptions {
array?: InternalCopier<any[]>;
arrayBuffer?: InternalCopier<ArrayBuffer>;
blob?: InternalCopier<Blob>;
dataView?: InternalCopier<DataView>;
date?: InternalCopier<Date>;
error?: InternalCopier<any>;
map?: InternalCopier<Map<any, any>>;
object?: InternalCopier<Record<string, any>>;
regExp?: InternalCopier<RegExp>;
set?: InternalCopier<Set<any>>;
}
/**
* Create a custom copier based on the object-specific copy methods passed.
*/
export declare function createCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
* same internals as `copyStrict`.
*/
export declare function createStrictCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible, where strict recreation of object properties
* are maintained. All properties (including non-enumerable ones) are copied with their
* original property descriptors on both objects and arrays.
*/
export declare const copyStrict: <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible.
*/
declare const _default: <Value>(value: Value) => Value;
export default _default;

View File

@@ -0,0 +1,25 @@
export interface Cache {
has: (value: any) => boolean;
set: (key: any, value: any) => void;
get: (key: any) => any;
}
declare function createCacheModern(): Cache;
/**
* Get a new cache object to prevent circular references.
*/
export declare const createCache: typeof createCacheModern;
/**
* Get an empty version of the object with the same prototype it has.
*/
export declare function getCleanClone(prototype: any): any;
declare function getRegExpFlagsModern(regExp: RegExp): string;
/**
* Get the flags to apply to the copied regexp.
*/
export declare const getRegExpFlags: typeof getRegExpFlagsModern;
declare function getTagLegacy(value: any): string;
/**
* Get the tag of the value passed, so that the correct copier can be used.
*/
export declare const getTag: typeof getTagLegacy;
export {};

2
backend/node_modules/fast-copy/dist/min/index.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r="undefined"!=typeof globalThis?globalThis:r||self)["fast-copy"]={})}(this,(function(r){"use strict";var t=Function.prototype.toString,e=Object.create,n=Object.prototype.toString,o=function(){function r(){this._keys=[],this._values=[]}return r.prototype.has=function(r){return!!~this._keys.indexOf(r)},r.prototype.get=function(r){return this._values[this._keys.indexOf(r)]},r.prototype.set=function(r,t){this._keys.push(r),this._values.push(t)},r}();var a="undefined"!=typeof WeakMap?function(){return new WeakMap}:function(){return new o};function c(r){if(!r)return e(null);var n=r.constructor;if(n===Object)return r===Object.prototype?{}:e(r);if(n&&~t.call(n).indexOf("[native code]"))try{return new n}catch(r){}return e(r)}var u="g"===/test/g.flags?function(r){return r.flags}:function(r){var t="";return r.global&&(t+="g"),r.ignoreCase&&(t+="i"),r.multiline&&(t+="m"),r.unicode&&(t+="u"),r.sticky&&(t+="y"),t};function i(r){var t=n.call(r);return t.substring(8,t.length-1)}var f="undefined"!=typeof Symbol?function(r){return r[Symbol.toStringTag]||i(r)}:i,s=Object.defineProperty,p=Object.getOwnPropertyDescriptor,y=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,v=Object.prototype,d=v.hasOwnProperty,b=v.propertyIsEnumerable,h="function"==typeof l;var g=h?function(r){return y(r).concat(l(r))}:y;function O(r,t,e){for(var n=g(r),o=0,a=n.length,c=void 0,u=void 0;o<a;++o)if("callee"!==(c=n[o])&&"caller"!==c)if(u=p(r,c)){u.get||u.set||(u.value=e.copier(u.value,e));try{s(t,c,u)}catch(r){t[c]=u.value}}else t[c]=e.copier(r[c],e);return t}function j(r,t){return r.slice(0)}function w(r,t){var e=new t.Constructor;return t.cache.set(r,e),r.forEach((function(r,n){e.set(n,t.copier(r,t))})),e}var m=h?function(r,t){var e=c(t.prototype);for(var n in t.cache.set(r,e),r)d.call(r,n)&&(e[n]=t.copier(r[n],t));for(var o=l(r),a=0,u=o.length,i=void 0;a<u;++a)i=o[a],b.call(r,i)&&(e[i]=t.copier(r[i],t));return e}:function(r,t){var e=c(t.prototype);for(var n in t.cache.set(r,e),r)d.call(r,n)&&(e[n]=t.copier(r[n],t));return e};function C(r,t){return new t.Constructor(r.valueOf())}function A(r,t){return r}function B(r,t){var e=new t.Constructor;return t.cache.set(r,e),r.forEach((function(r){e.add(t.copier(r,t))})),e}var _=Array.isArray,x=Object.assign,S=Object.getPrototypeOf||function(r){return r.__proto__},k={array:function(r,t){var e=new t.Constructor;t.cache.set(r,e);for(var n=0,o=r.length;n<o;++n)e[n]=t.copier(r[n],t);return e},arrayBuffer:j,blob:function(r,t){return r.slice(0,r.size,r.type)},dataView:function(r,t){return new t.Constructor(j(r.buffer))},date:function(r,t){return new t.Constructor(r.getTime())},error:A,map:w,object:m,regExp:function(r,t){var e=new t.Constructor(r.source,u(r));return e.lastIndex=r.lastIndex,e},set:B},P=x({},k,{array:function(r,t){var e=new t.Constructor;return t.cache.set(r,e),O(r,e,t)},map:function(r,t){return O(r,w(r,t),t)},object:function(r,t){var e=c(t.prototype);return t.cache.set(r,e),O(r,e,t)},set:function(r,t){return O(r,B(r,t),t)}});function E(r){var t=function(r){return{Arguments:r.object,Array:r.array,ArrayBuffer:r.arrayBuffer,Blob:r.blob,Boolean:C,DataView:r.dataView,Date:r.date,Error:r.error,Float32Array:r.arrayBuffer,Float64Array:r.arrayBuffer,Int8Array:r.arrayBuffer,Int16Array:r.arrayBuffer,Int32Array:r.arrayBuffer,Map:r.map,Number:C,Object:r.object,Promise:A,RegExp:r.regExp,Set:r.set,String:C,WeakMap:A,WeakSet:A,Uint8Array:r.arrayBuffer,Uint8ClampedArray:r.arrayBuffer,Uint16Array:r.arrayBuffer,Uint32Array:r.arrayBuffer,Uint64Array:r.arrayBuffer}}(x({},k,r)),e=t.Array,n=t.Object;function o(r,o){if(o.prototype=o.Constructor=void 0,!r||"object"!=typeof r)return r;if(o.cache.has(r))return o.cache.get(r);if(o.prototype=S(r),o.Constructor=o.prototype&&o.prototype.constructor,!o.Constructor||o.Constructor===Object)return n(r,o);if(_(r))return e(r,o);var a=t[f(r)];return a?a(r,o):"function"==typeof r.then?r:n(r,o)}return function(r){return o(r,{Constructor:void 0,cache:a(),copier:o,prototype:void 0})}}function I(r){return E(x({},P,r))}var M=I({}),U=E({});r.copyStrict=M,r.createCopier=E,r.createStrictCopier=I,r.default=U,Object.defineProperty(r,"__esModule",{value:!0})}));
//# sourceMappingURL=index.js.map

1
backend/node_modules/fast-copy/dist/min/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
import type { Cache } from './utils';
export type InternalCopier<Value> = (value: Value, state: State) => Value;
export interface State {
Constructor: any;
cache: Cache;
copier: InternalCopier<any>;
prototype: any;
}
/**
* Deeply copy the indexed values in the array.
*/
export declare function copyArrayLoose(array: any[], state: State): any;
/**
* Deeply copy the indexed values in the array, as well as any custom properties.
*/
export declare function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value;
/**
* Copy the contents of the ArrayBuffer.
*/
export declare function copyArrayBuffer<Value extends ArrayBuffer>(arrayBuffer: Value, _state: State): Value;
/**
* Create a new Blob with the contents of the original.
*/
export declare function copyBlob<Value extends Blob>(blob: Value, _state: State): Value;
/**
* Create a new DataView with the contents of the original.
*/
export declare function copyDataView<Value extends DataView>(dataView: Value, state: State): Value;
/**
* Create a new Date based on the time of the original.
*/
export declare function copyDate<Value extends Date>(date: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original.
*/
export declare function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original, as well as any custom properties.
*/
export declare function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value;
declare function copyObjectLooseModern<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Deeply copy the properties (keys and symbols) and values of the original.
*/
export declare const copyObjectLoose: typeof copyObjectLooseModern;
/**
* Deeply copy the properties (keys and symbols) and values of the original, as well
* as any hidden or non-enumerable properties.
*/
export declare function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Create a new primitive wrapper from the value of the original.
*/
export declare function copyPrimitiveWrapper<Value extends Boolean | Number | String>(primitiveObject: Value, state: State): Value;
/**
* Create a new RegExp based on the value and flags of the original.
*/
export declare function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value;
/**
* Return the original value (an identity function).
*
* @note
* THis is used for objects that cannot be copied, such as WeakMap.
*/
export declare function copySelf<Value>(value: Value, _state: State): Value;
/**
* Deeply copy the values of the original.
*/
export declare function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value;
/**
* Deeply copy the values of the original, as well as any custom properties.
*/
export declare function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value;
export {};

View File

@@ -0,0 +1,34 @@
import type { InternalCopier } from './copier';
export type { State } from './copier';
export interface CreateCopierOptions {
array?: InternalCopier<any[]>;
arrayBuffer?: InternalCopier<ArrayBuffer>;
blob?: InternalCopier<Blob>;
dataView?: InternalCopier<DataView>;
date?: InternalCopier<Date>;
error?: InternalCopier<any>;
map?: InternalCopier<Map<any, any>>;
object?: InternalCopier<Record<string, any>>;
regExp?: InternalCopier<RegExp>;
set?: InternalCopier<Set<any>>;
}
/**
* Create a custom copier based on the object-specific copy methods passed.
*/
export declare function createCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
* same internals as `copyStrict`.
*/
export declare function createStrictCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible, where strict recreation of object properties
* are maintained. All properties (including non-enumerable ones) are copied with their
* original property descriptors on both objects and arrays.
*/
export declare const copyStrict: <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible.
*/
declare const _default: <Value>(value: Value) => Value;
export default _default;

View File

@@ -0,0 +1,25 @@
export interface Cache {
has: (value: any) => boolean;
set: (key: any, value: any) => void;
get: (key: any) => any;
}
declare function createCacheModern(): Cache;
/**
* Get a new cache object to prevent circular references.
*/
export declare const createCache: typeof createCacheModern;
/**
* Get an empty version of the object with the same prototype it has.
*/
export declare function getCleanClone(prototype: any): any;
declare function getRegExpFlagsModern(regExp: RegExp): string;
/**
* Get the flags to apply to the copied regexp.
*/
export declare const getRegExpFlags: typeof getRegExpFlagsModern;
declare function getTagLegacy(value: any): string;
/**
* Get the tag of the value passed, so that the correct copier can be used.
*/
export declare const getTag: typeof getTagLegacy;
export {};

412
backend/node_modules/fast-copy/dist/umd/index.js generated vendored Normal file
View File

@@ -0,0 +1,412 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["fast-copy"] = {}));
})(this, (function (exports) { 'use strict';
var toStringFunction = Function.prototype.toString;
var create = Object.create;
var toStringObject = Object.prototype.toString;
/**
* @classdesc Fallback cache for when WeakMap is not natively supported
*/
var LegacyCache = /** @class */ (function () {
function LegacyCache() {
this._keys = [];
this._values = [];
}
LegacyCache.prototype.has = function (key) {
return !!~this._keys.indexOf(key);
};
LegacyCache.prototype.get = function (key) {
return this._values[this._keys.indexOf(key)];
};
LegacyCache.prototype.set = function (key, value) {
this._keys.push(key);
this._values.push(value);
};
return LegacyCache;
}());
function createCacheLegacy() {
return new LegacyCache();
}
function createCacheModern() {
return new WeakMap();
}
/**
* Get a new cache object to prevent circular references.
*/
var createCache = typeof WeakMap !== 'undefined' ? createCacheModern : createCacheLegacy;
/**
* Get an empty version of the object with the same prototype it has.
*/
function getCleanClone(prototype) {
if (!prototype) {
return create(null);
}
var Constructor = prototype.constructor;
if (Constructor === Object) {
return prototype === Object.prototype ? {} : create(prototype);
}
if (Constructor &&
~toStringFunction.call(Constructor).indexOf('[native code]')) {
try {
return new Constructor();
}
catch (_a) { }
}
return create(prototype);
}
function getRegExpFlagsLegacy(regExp) {
var flags = '';
if (regExp.global) {
flags += 'g';
}
if (regExp.ignoreCase) {
flags += 'i';
}
if (regExp.multiline) {
flags += 'm';
}
if (regExp.unicode) {
flags += 'u';
}
if (regExp.sticky) {
flags += 'y';
}
return flags;
}
function getRegExpFlagsModern(regExp) {
return regExp.flags;
}
/**
* Get the flags to apply to the copied regexp.
*/
var getRegExpFlags = /test/g.flags === 'g' ? getRegExpFlagsModern : getRegExpFlagsLegacy;
function getTagLegacy(value) {
var type = toStringObject.call(value);
return type.substring(8, type.length - 1);
}
function getTagModern(value) {
return value[Symbol.toStringTag] || getTagLegacy(value);
}
/**
* Get the tag of the value passed, so that the correct copier can be used.
*/
var getTag = typeof Symbol !== 'undefined' ? getTagModern : getTagLegacy;
var defineProperty = Object.defineProperty, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor, getOwnPropertyNames = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols;
var _a = Object.prototype, hasOwnProperty = _a.hasOwnProperty, propertyIsEnumerable = _a.propertyIsEnumerable;
var SUPPORTS_SYMBOL = typeof getOwnPropertySymbols === 'function';
function getStrictPropertiesModern(object) {
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
}
/**
* Get the properites used when copying objects strictly. This includes both keys and symbols.
*/
var getStrictProperties = SUPPORTS_SYMBOL
? getStrictPropertiesModern
: getOwnPropertyNames;
/**
* Striclty copy all properties contained on the object.
*/
function copyOwnPropertiesStrict(value, clone, state) {
var properties = getStrictProperties(value);
for (var index = 0, length_1 = properties.length, property = void 0, descriptor = void 0; index < length_1; ++index) {
property = properties[index];
if (property === 'callee' || property === 'caller') {
continue;
}
descriptor = getOwnPropertyDescriptor(value, property);
if (!descriptor) {
// In extra edge cases where the property descriptor cannot be retrived, fall back to
// the loose assignment.
clone[property] = state.copier(value[property], state);
continue;
}
// Only clone the value if actually a value, not a getter / setter.
if (!descriptor.get && !descriptor.set) {
descriptor.value = state.copier(descriptor.value, state);
}
try {
defineProperty(clone, property, descriptor);
}
catch (error) {
// Tee above can fail on node in edge cases, so fall back to the loose assignment.
clone[property] = descriptor.value;
}
}
return clone;
}
/**
* Deeply copy the indexed values in the array.
*/
function copyArrayLoose(array, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(array, clone);
for (var index = 0, length_2 = array.length; index < length_2; ++index) {
clone[index] = state.copier(array[index], state);
}
return clone;
}
/**
* Deeply copy the indexed values in the array, as well as any custom properties.
*/
function copyArrayStrict(array, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(array, clone);
return copyOwnPropertiesStrict(array, clone, state);
}
/**
* Copy the contents of the ArrayBuffer.
*/
function copyArrayBuffer(arrayBuffer, _state) {
return arrayBuffer.slice(0);
}
/**
* Create a new Blob with the contents of the original.
*/
function copyBlob(blob, _state) {
return blob.slice(0, blob.size, blob.type);
}
/**
* Create a new DataView with the contents of the original.
*/
function copyDataView(dataView, state) {
return new state.Constructor(copyArrayBuffer(dataView.buffer));
}
/**
* Create a new Date based on the time of the original.
*/
function copyDate(date, state) {
return new state.Constructor(date.getTime());
}
/**
* Deeply copy the keys and values of the original.
*/
function copyMapLoose(map, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(map, clone);
map.forEach(function (value, key) {
clone.set(key, state.copier(value, state));
});
return clone;
}
/**
* Deeply copy the keys and values of the original, as well as any custom properties.
*/
function copyMapStrict(map, state) {
return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);
}
function copyObjectLooseLegacy(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
clone[key] = state.copier(object[key], state);
}
}
return clone;
}
function copyObjectLooseModern(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
for (var key in object) {
if (hasOwnProperty.call(object, key)) {
clone[key] = state.copier(object[key], state);
}
}
var symbols = getOwnPropertySymbols(object);
for (var index = 0, length_3 = symbols.length, symbol = void 0; index < length_3; ++index) {
symbol = symbols[index];
if (propertyIsEnumerable.call(object, symbol)) {
clone[symbol] = state.copier(object[symbol], state);
}
}
return clone;
}
/**
* Deeply copy the properties (keys and symbols) and values of the original.
*/
var copyObjectLoose = SUPPORTS_SYMBOL
? copyObjectLooseModern
: copyObjectLooseLegacy;
/**
* Deeply copy the properties (keys and symbols) and values of the original, as well
* as any hidden or non-enumerable properties.
*/
function copyObjectStrict(object, state) {
var clone = getCleanClone(state.prototype);
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(object, clone);
return copyOwnPropertiesStrict(object, clone, state);
}
/**
* Create a new primitive wrapper from the value of the original.
*/
function copyPrimitiveWrapper(primitiveObject, state) {
return new state.Constructor(primitiveObject.valueOf());
}
/**
* Create a new RegExp based on the value and flags of the original.
*/
function copyRegExp(regExp, state) {
var clone = new state.Constructor(regExp.source, getRegExpFlags(regExp));
clone.lastIndex = regExp.lastIndex;
return clone;
}
/**
* Return the original value (an identity function).
*
* @note
* THis is used for objects that cannot be copied, such as WeakMap.
*/
function copySelf(value, _state) {
return value;
}
/**
* Deeply copy the values of the original.
*/
function copySetLoose(set, state) {
var clone = new state.Constructor();
// set in the cache immediately to be able to reuse the object recursively
state.cache.set(set, clone);
set.forEach(function (value) {
clone.add(state.copier(value, state));
});
return clone;
}
/**
* Deeply copy the values of the original, as well as any custom properties.
*/
function copySetStrict(set, state) {
return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);
}
var isArray = Array.isArray;
var assign = Object.assign;
var getPrototypeOf = Object.getPrototypeOf || (function (obj) { return obj.__proto__; });
var DEFAULT_LOOSE_OPTIONS = {
array: copyArrayLoose,
arrayBuffer: copyArrayBuffer,
blob: copyBlob,
dataView: copyDataView,
date: copyDate,
error: copySelf,
map: copyMapLoose,
object: copyObjectLoose,
regExp: copyRegExp,
set: copySetLoose,
};
var DEFAULT_STRICT_OPTIONS = assign({}, DEFAULT_LOOSE_OPTIONS, {
array: copyArrayStrict,
map: copyMapStrict,
object: copyObjectStrict,
set: copySetStrict,
});
/**
* Get the copiers used for each specific object tag.
*/
function getTagSpecificCopiers(options) {
return {
Arguments: options.object,
Array: options.array,
ArrayBuffer: options.arrayBuffer,
Blob: options.blob,
Boolean: copyPrimitiveWrapper,
DataView: options.dataView,
Date: options.date,
Error: options.error,
Float32Array: options.arrayBuffer,
Float64Array: options.arrayBuffer,
Int8Array: options.arrayBuffer,
Int16Array: options.arrayBuffer,
Int32Array: options.arrayBuffer,
Map: options.map,
Number: copyPrimitiveWrapper,
Object: options.object,
Promise: copySelf,
RegExp: options.regExp,
Set: options.set,
String: copyPrimitiveWrapper,
WeakMap: copySelf,
WeakSet: copySelf,
Uint8Array: options.arrayBuffer,
Uint8ClampedArray: options.arrayBuffer,
Uint16Array: options.arrayBuffer,
Uint32Array: options.arrayBuffer,
Uint64Array: options.arrayBuffer,
};
}
/**
* Create a custom copier based on the object-specific copy methods passed.
*/
function createCopier(options) {
var normalizedOptions = assign({}, DEFAULT_LOOSE_OPTIONS, options);
var tagSpecificCopiers = getTagSpecificCopiers(normalizedOptions);
var array = tagSpecificCopiers.Array, object = tagSpecificCopiers.Object;
function copier(value, state) {
state.prototype = state.Constructor = undefined;
if (!value || typeof value !== 'object') {
return value;
}
if (state.cache.has(value)) {
return state.cache.get(value);
}
state.prototype = getPrototypeOf(value);
state.Constructor = state.prototype && state.prototype.constructor;
// plain objects
if (!state.Constructor || state.Constructor === Object) {
return object(value, state);
}
// arrays
if (isArray(value)) {
return array(value, state);
}
var tagSpecificCopier = tagSpecificCopiers[getTag(value)];
if (tagSpecificCopier) {
return tagSpecificCopier(value, state);
}
return typeof value.then === 'function' ? value : object(value, state);
}
return function copy(value) {
return copier(value, {
Constructor: undefined,
cache: createCache(),
copier: copier,
prototype: undefined,
});
};
}
/**
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
* same internals as `copyStrict`.
*/
function createStrictCopier(options) {
return createCopier(assign({}, DEFAULT_STRICT_OPTIONS, options));
}
/**
* Copy an value deeply as much as possible, where strict recreation of object properties
* are maintained. All properties (including non-enumerable ones) are copied with their
* original property descriptors on both objects and arrays.
*/
var copyStrict = createStrictCopier({});
/**
* Copy an value deeply as much as possible.
*/
var index = createCopier({});
exports.copyStrict = copyStrict;
exports.createCopier = createCopier;
exports.createStrictCopier = createStrictCopier;
exports.default = index;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=index.js.map

1
backend/node_modules/fast-copy/dist/umd/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,74 @@
import type { Cache } from './utils';
export type InternalCopier<Value> = (value: Value, state: State) => Value;
export interface State {
Constructor: any;
cache: Cache;
copier: InternalCopier<any>;
prototype: any;
}
/**
* Deeply copy the indexed values in the array.
*/
export declare function copyArrayLoose(array: any[], state: State): any;
/**
* Deeply copy the indexed values in the array, as well as any custom properties.
*/
export declare function copyArrayStrict<Value extends any[]>(array: Value, state: State): Value;
/**
* Copy the contents of the ArrayBuffer.
*/
export declare function copyArrayBuffer<Value extends ArrayBuffer>(arrayBuffer: Value, _state: State): Value;
/**
* Create a new Blob with the contents of the original.
*/
export declare function copyBlob<Value extends Blob>(blob: Value, _state: State): Value;
/**
* Create a new DataView with the contents of the original.
*/
export declare function copyDataView<Value extends DataView>(dataView: Value, state: State): Value;
/**
* Create a new Date based on the time of the original.
*/
export declare function copyDate<Value extends Date>(date: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original.
*/
export declare function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value;
/**
* Deeply copy the keys and values of the original, as well as any custom properties.
*/
export declare function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State): Value;
declare function copyObjectLooseModern<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Deeply copy the properties (keys and symbols) and values of the original.
*/
export declare const copyObjectLoose: typeof copyObjectLooseModern;
/**
* Deeply copy the properties (keys and symbols) and values of the original, as well
* as any hidden or non-enumerable properties.
*/
export declare function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value;
/**
* Create a new primitive wrapper from the value of the original.
*/
export declare function copyPrimitiveWrapper<Value extends Boolean | Number | String>(primitiveObject: Value, state: State): Value;
/**
* Create a new RegExp based on the value and flags of the original.
*/
export declare function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value;
/**
* Return the original value (an identity function).
*
* @note
* THis is used for objects that cannot be copied, such as WeakMap.
*/
export declare function copySelf<Value>(value: Value, _state: State): Value;
/**
* Deeply copy the values of the original.
*/
export declare function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value;
/**
* Deeply copy the values of the original, as well as any custom properties.
*/
export declare function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value;
export {};

View File

@@ -0,0 +1,34 @@
import type { InternalCopier } from './copier';
export type { State } from './copier';
export interface CreateCopierOptions {
array?: InternalCopier<any[]>;
arrayBuffer?: InternalCopier<ArrayBuffer>;
blob?: InternalCopier<Blob>;
dataView?: InternalCopier<DataView>;
date?: InternalCopier<Date>;
error?: InternalCopier<any>;
map?: InternalCopier<Map<any, any>>;
object?: InternalCopier<Record<string, any>>;
regExp?: InternalCopier<RegExp>;
set?: InternalCopier<Set<any>>;
}
/**
* Create a custom copier based on the object-specific copy methods passed.
*/
export declare function createCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Create a custom copier based on the object-specific copy methods passed, defaulting to the
* same internals as `copyStrict`.
*/
export declare function createStrictCopier(options: CreateCopierOptions): <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible, where strict recreation of object properties
* are maintained. All properties (including non-enumerable ones) are copied with their
* original property descriptors on both objects and arrays.
*/
export declare const copyStrict: <Value>(value: Value) => Value;
/**
* Copy an value deeply as much as possible.
*/
declare const _default: <Value>(value: Value) => Value;
export default _default;

View File

@@ -0,0 +1,25 @@
export interface Cache {
has: (value: any) => boolean;
set: (key: any, value: any) => void;
get: (key: any) => any;
}
declare function createCacheModern(): Cache;
/**
* Get a new cache object to prevent circular references.
*/
export declare const createCache: typeof createCacheModern;
/**
* Get an empty version of the object with the same prototype it has.
*/
export declare function getCleanClone(prototype: any): any;
declare function getRegExpFlagsModern(regExp: RegExp): string;
/**
* Get the flags to apply to the copied regexp.
*/
export declare const getRegExpFlags: typeof getRegExpFlagsModern;
declare function getTagLegacy(value: any): string;
/**
* Get the tag of the value passed, so that the correct copier can be used.
*/
export declare const getTag: typeof getTagLegacy;
export {};