+
+Denque is a well tested, extremely fast and lightweight [double-ended queue](http://en.wikipedia.org/wiki/Double-ended_queue)
+implementation with zero dependencies and includes TypeScript types.
+
+Double-ended queues can also be used as a:
+
+- [Stack](http://en.wikipedia.org/wiki/Stack_\(abstract_data_type\))
+- [Queue](http://en.wikipedia.org/wiki/Queue_\(data_structure\))
+
+This implementation is currently the fastest available, even faster than `double-ended-queue`, see the [benchmarks](https://docs.page/invertase/denque/benchmarks).
+
+Every queue operation is done at a constant `O(1)` - including random access from `.peekAt(index)`.
+
+**Works on all node versions >= v0.10**
+
+## Quick Start
+
+Install the package:
+
+```bash
+npm install denque
+```
+
+Create and consume a queue:
+
+```js
+const Denque = require("denque");
+
+const denque = new Denque([1,2,3,4]);
+denque.shift(); // 1
+denque.pop(); // 4
+```
+
+
+See the [API reference documentation](https://docs.page/invertase/denque/api) for more examples.
+
+---
+
+## Who's using it?
+
+- [Kafka Node.js client](https://www.npmjs.com/package/kafka-node)
+- [MariaDB Node.js client](https://www.npmjs.com/package/mariadb)
+- [MongoDB Node.js client](https://www.npmjs.com/package/mongodb)
+- [MySQL Node.js client](https://www.npmjs.com/package/mysql2)
+- [Redis Node.js clients](https://www.npmjs.com/package/redis)
+
+... and [many more](https://www.npmjs.com/browse/depended/denque).
+
+
+---
+
+## License
+
+- See [LICENSE](/LICENSE)
+
+---
+
+
+
diff --git a/EmployeeManagementBackend/node_modules/denque/index.d.ts b/EmployeeManagementBackend/node_modules/denque/index.d.ts
new file mode 100644
index 0000000..e125dd4
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/denque/index.d.ts
@@ -0,0 +1,47 @@
+declare class Denque {
+ length: number;
+
+ constructor();
+
+ constructor(array: T[]);
+
+ constructor(array: T[], options: IDenqueOptions);
+
+ push(item: T): number;
+
+ unshift(item: T): number;
+
+ pop(): T | undefined;
+
+ shift(): T | undefined;
+
+ peekBack(): T | undefined;
+
+ peekFront(): T | undefined;
+
+ peekAt(index: number): T | undefined;
+
+ get(index: number): T | undefined;
+
+ remove(index: number, count: number): T[];
+
+ removeOne(index: number): T | undefined;
+
+ splice(index: number, count: number, ...item: T[]): T[] | undefined;
+
+ isEmpty(): boolean;
+
+ clear(): void;
+
+ size(): number;
+
+ toString(): string;
+
+ toArray(): T[];
+}
+
+interface IDenqueOptions {
+ capacity?: number
+}
+
+export = Denque;
diff --git a/EmployeeManagementBackend/node_modules/denque/index.js b/EmployeeManagementBackend/node_modules/denque/index.js
new file mode 100644
index 0000000..6b2e9d8
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/denque/index.js
@@ -0,0 +1,481 @@
+'use strict';
+
+/**
+ * Custom implementation of a double ended queue.
+ */
+function Denque(array, options) {
+ var options = options || {};
+ this._capacity = options.capacity;
+
+ this._head = 0;
+ this._tail = 0;
+
+ if (Array.isArray(array)) {
+ this._fromArray(array);
+ } else {
+ this._capacityMask = 0x3;
+ this._list = new Array(4);
+ }
+}
+
+/**
+ * --------------
+ * PUBLIC API
+ * -------------
+ */
+
+/**
+ * Returns the item at the specified index from the list.
+ * 0 is the first element, 1 is the second, and so on...
+ * Elements at negative values are that many from the end: -1 is one before the end
+ * (the last element), -2 is two before the end (one before last), etc.
+ * @param index
+ * @returns {*}
+ */
+Denque.prototype.peekAt = function peekAt(index) {
+ var i = index;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ var len = this.size();
+ if (i >= len || i < -len) return undefined;
+ if (i < 0) i += len;
+ i = (this._head + i) & this._capacityMask;
+ return this._list[i];
+};
+
+/**
+ * Alias for peekAt()
+ * @param i
+ * @returns {*}
+ */
+Denque.prototype.get = function get(i) {
+ return this.peekAt(i);
+};
+
+/**
+ * Returns the first item in the list without removing it.
+ * @returns {*}
+ */
+Denque.prototype.peek = function peek() {
+ if (this._head === this._tail) return undefined;
+ return this._list[this._head];
+};
+
+/**
+ * Alias for peek()
+ * @returns {*}
+ */
+Denque.prototype.peekFront = function peekFront() {
+ return this.peek();
+};
+
+/**
+ * Returns the item that is at the back of the queue without removing it.
+ * Uses peekAt(-1)
+ */
+Denque.prototype.peekBack = function peekBack() {
+ return this.peekAt(-1);
+};
+
+/**
+ * Returns the current length of the queue
+ * @return {Number}
+ */
+Object.defineProperty(Denque.prototype, 'length', {
+ get: function length() {
+ return this.size();
+ }
+});
+
+/**
+ * Return the number of items on the list, or 0 if empty.
+ * @returns {number}
+ */
+Denque.prototype.size = function size() {
+ if (this._head === this._tail) return 0;
+ if (this._head < this._tail) return this._tail - this._head;
+ else return this._capacityMask + 1 - (this._head - this._tail);
+};
+
+/**
+ * Add an item at the beginning of the list.
+ * @param item
+ */
+Denque.prototype.unshift = function unshift(item) {
+ if (arguments.length === 0) return this.size();
+ var len = this._list.length;
+ this._head = (this._head - 1 + len) & this._capacityMask;
+ this._list[this._head] = item;
+ if (this._tail === this._head) this._growArray();
+ if (this._capacity && this.size() > this._capacity) this.pop();
+ if (this._head < this._tail) return this._tail - this._head;
+ else return this._capacityMask + 1 - (this._head - this._tail);
+};
+
+/**
+ * Remove and return the first item on the list,
+ * Returns undefined if the list is empty.
+ * @returns {*}
+ */
+Denque.prototype.shift = function shift() {
+ var head = this._head;
+ if (head === this._tail) return undefined;
+ var item = this._list[head];
+ this._list[head] = undefined;
+ this._head = (head + 1) & this._capacityMask;
+ if (head < 2 && this._tail > 10000 && this._tail <= this._list.length >>> 2) this._shrinkArray();
+ return item;
+};
+
+/**
+ * Add an item to the bottom of the list.
+ * @param item
+ */
+Denque.prototype.push = function push(item) {
+ if (arguments.length === 0) return this.size();
+ var tail = this._tail;
+ this._list[tail] = item;
+ this._tail = (tail + 1) & this._capacityMask;
+ if (this._tail === this._head) {
+ this._growArray();
+ }
+ if (this._capacity && this.size() > this._capacity) {
+ this.shift();
+ }
+ if (this._head < this._tail) return this._tail - this._head;
+ else return this._capacityMask + 1 - (this._head - this._tail);
+};
+
+/**
+ * Remove and return the last item on the list.
+ * Returns undefined if the list is empty.
+ * @returns {*}
+ */
+Denque.prototype.pop = function pop() {
+ var tail = this._tail;
+ if (tail === this._head) return undefined;
+ var len = this._list.length;
+ this._tail = (tail - 1 + len) & this._capacityMask;
+ var item = this._list[this._tail];
+ this._list[this._tail] = undefined;
+ if (this._head < 2 && tail > 10000 && tail <= len >>> 2) this._shrinkArray();
+ return item;
+};
+
+/**
+ * Remove and return the item at the specified index from the list.
+ * Returns undefined if the list is empty.
+ * @param index
+ * @returns {*}
+ */
+Denque.prototype.removeOne = function removeOne(index) {
+ var i = index;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ if (this._head === this._tail) return void 0;
+ var size = this.size();
+ var len = this._list.length;
+ if (i >= size || i < -size) return void 0;
+ if (i < 0) i += size;
+ i = (this._head + i) & this._capacityMask;
+ var item = this._list[i];
+ var k;
+ if (index < size / 2) {
+ for (k = index; k > 0; k--) {
+ this._list[i] = this._list[i = (i - 1 + len) & this._capacityMask];
+ }
+ this._list[i] = void 0;
+ this._head = (this._head + 1 + len) & this._capacityMask;
+ } else {
+ for (k = size - 1 - index; k > 0; k--) {
+ this._list[i] = this._list[i = (i + 1 + len) & this._capacityMask];
+ }
+ this._list[i] = void 0;
+ this._tail = (this._tail - 1 + len) & this._capacityMask;
+ }
+ return item;
+};
+
+/**
+ * Remove number of items from the specified index from the list.
+ * Returns array of removed items.
+ * Returns undefined if the list is empty.
+ * @param index
+ * @param count
+ * @returns {array}
+ */
+Denque.prototype.remove = function remove(index, count) {
+ var i = index;
+ var removed;
+ var del_count = count;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ if (this._head === this._tail) return void 0;
+ var size = this.size();
+ var len = this._list.length;
+ if (i >= size || i < -size || count < 1) return void 0;
+ if (i < 0) i += size;
+ if (count === 1 || !count) {
+ removed = new Array(1);
+ removed[0] = this.removeOne(i);
+ return removed;
+ }
+ if (i === 0 && i + count >= size) {
+ removed = this.toArray();
+ this.clear();
+ return removed;
+ }
+ if (i + count > size) count = size - i;
+ var k;
+ removed = new Array(count);
+ for (k = 0; k < count; k++) {
+ removed[k] = this._list[(this._head + i + k) & this._capacityMask];
+ }
+ i = (this._head + i) & this._capacityMask;
+ if (index + count === size) {
+ this._tail = (this._tail - count + len) & this._capacityMask;
+ for (k = count; k > 0; k--) {
+ this._list[i = (i + 1 + len) & this._capacityMask] = void 0;
+ }
+ return removed;
+ }
+ if (index === 0) {
+ this._head = (this._head + count + len) & this._capacityMask;
+ for (k = count - 1; k > 0; k--) {
+ this._list[i = (i + 1 + len) & this._capacityMask] = void 0;
+ }
+ return removed;
+ }
+ if (i < size / 2) {
+ this._head = (this._head + index + count + len) & this._capacityMask;
+ for (k = index; k > 0; k--) {
+ this.unshift(this._list[i = (i - 1 + len) & this._capacityMask]);
+ }
+ i = (this._head - 1 + len) & this._capacityMask;
+ while (del_count > 0) {
+ this._list[i = (i - 1 + len) & this._capacityMask] = void 0;
+ del_count--;
+ }
+ if (index < 0) this._tail = i;
+ } else {
+ this._tail = i;
+ i = (i + count + len) & this._capacityMask;
+ for (k = size - (count + index); k > 0; k--) {
+ this.push(this._list[i++]);
+ }
+ i = this._tail;
+ while (del_count > 0) {
+ this._list[i = (i + 1 + len) & this._capacityMask] = void 0;
+ del_count--;
+ }
+ }
+ if (this._head < 2 && this._tail > 10000 && this._tail <= len >>> 2) this._shrinkArray();
+ return removed;
+};
+
+/**
+ * Native splice implementation.
+ * Remove number of items from the specified index from the list and/or add new elements.
+ * Returns array of removed items or empty array if count == 0.
+ * Returns undefined if the list is empty.
+ *
+ * @param index
+ * @param count
+ * @param {...*} [elements]
+ * @returns {array}
+ */
+Denque.prototype.splice = function splice(index, count) {
+ var i = index;
+ // expect a number or return undefined
+ if ((i !== (i | 0))) {
+ return void 0;
+ }
+ var size = this.size();
+ if (i < 0) i += size;
+ if (i > size) return void 0;
+ if (arguments.length > 2) {
+ var k;
+ var temp;
+ var removed;
+ var arg_len = arguments.length;
+ var len = this._list.length;
+ var arguments_index = 2;
+ if (!size || i < size / 2) {
+ temp = new Array(i);
+ for (k = 0; k < i; k++) {
+ temp[k] = this._list[(this._head + k) & this._capacityMask];
+ }
+ if (count === 0) {
+ removed = [];
+ if (i > 0) {
+ this._head = (this._head + i + len) & this._capacityMask;
+ }
+ } else {
+ removed = this.remove(i, count);
+ this._head = (this._head + i + len) & this._capacityMask;
+ }
+ while (arg_len > arguments_index) {
+ this.unshift(arguments[--arg_len]);
+ }
+ for (k = i; k > 0; k--) {
+ this.unshift(temp[k - 1]);
+ }
+ } else {
+ temp = new Array(size - (i + count));
+ var leng = temp.length;
+ for (k = 0; k < leng; k++) {
+ temp[k] = this._list[(this._head + i + count + k) & this._capacityMask];
+ }
+ if (count === 0) {
+ removed = [];
+ if (i != size) {
+ this._tail = (this._head + i + len) & this._capacityMask;
+ }
+ } else {
+ removed = this.remove(i, count);
+ this._tail = (this._tail - leng + len) & this._capacityMask;
+ }
+ while (arguments_index < arg_len) {
+ this.push(arguments[arguments_index++]);
+ }
+ for (k = 0; k < leng; k++) {
+ this.push(temp[k]);
+ }
+ }
+ return removed;
+ } else {
+ return this.remove(i, count);
+ }
+};
+
+/**
+ * Soft clear - does not reset capacity.
+ */
+Denque.prototype.clear = function clear() {
+ this._list = new Array(this._list.length);
+ this._head = 0;
+ this._tail = 0;
+};
+
+/**
+ * Returns true or false whether the list is empty.
+ * @returns {boolean}
+ */
+Denque.prototype.isEmpty = function isEmpty() {
+ return this._head === this._tail;
+};
+
+/**
+ * Returns an array of all queue items.
+ * @returns {Array}
+ */
+Denque.prototype.toArray = function toArray() {
+ return this._copyArray(false);
+};
+
+/**
+ * -------------
+ * INTERNALS
+ * -------------
+ */
+
+/**
+ * Fills the queue with items from an array
+ * For use in the constructor
+ * @param array
+ * @private
+ */
+Denque.prototype._fromArray = function _fromArray(array) {
+ var length = array.length;
+ var capacity = this._nextPowerOf2(length);
+
+ this._list = new Array(capacity);
+ this._capacityMask = capacity - 1;
+ this._tail = length;
+
+ for (var i = 0; i < length; i++) this._list[i] = array[i];
+};
+
+/**
+ *
+ * @param fullCopy
+ * @param size Initialize the array with a specific size. Will default to the current list size
+ * @returns {Array}
+ * @private
+ */
+Denque.prototype._copyArray = function _copyArray(fullCopy, size) {
+ var src = this._list;
+ var capacity = src.length;
+ var length = this.length;
+ size = size | length;
+
+ // No prealloc requested and the buffer is contiguous
+ if (size == length && this._head < this._tail) {
+ // Simply do a fast slice copy
+ return this._list.slice(this._head, this._tail);
+ }
+
+ var dest = new Array(size);
+
+ var k = 0;
+ var i;
+ if (fullCopy || this._head > this._tail) {
+ for (i = this._head; i < capacity; i++) dest[k++] = src[i];
+ for (i = 0; i < this._tail; i++) dest[k++] = src[i];
+ } else {
+ for (i = this._head; i < this._tail; i++) dest[k++] = src[i];
+ }
+
+ return dest;
+}
+
+/**
+ * Grows the internal list array.
+ * @private
+ */
+Denque.prototype._growArray = function _growArray() {
+ if (this._head != 0) {
+ // double array size and copy existing data, head to end, then beginning to tail.
+ var newList = this._copyArray(true, this._list.length << 1);
+
+ this._tail = this._list.length;
+ this._head = 0;
+
+ this._list = newList;
+ } else {
+ this._tail = this._list.length;
+ this._list.length <<= 1;
+ }
+
+ this._capacityMask = (this._capacityMask << 1) | 1;
+};
+
+/**
+ * Shrinks the internal list array.
+ * @private
+ */
+Denque.prototype._shrinkArray = function _shrinkArray() {
+ this._list.length >>>= 1;
+ this._capacityMask >>>= 1;
+};
+
+/**
+ * Find the next power of 2, at least 4
+ * @private
+ * @param {number} num
+ * @returns {number}
+ */
+Denque.prototype._nextPowerOf2 = function _nextPowerOf2(num) {
+ var log2 = Math.log(num) / Math.log(2);
+ var nextPow2 = 1 << (log2 + 1);
+
+ return Math.max(nextPow2, 4);
+}
+
+module.exports = Denque;
diff --git a/EmployeeManagementBackend/node_modules/denque/package.json b/EmployeeManagementBackend/node_modules/denque/package.json
new file mode 100644
index 0000000..a635910
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/denque/package.json
@@ -0,0 +1,58 @@
+{
+ "name": "denque",
+ "version": "2.1.0",
+ "description": "The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. Maintains compatability with deque.",
+ "main": "index.js",
+ "engines": {
+ "node": ">=0.10"
+ },
+ "keywords": [
+ "data-structure",
+ "data-structures",
+ "queue",
+ "double",
+ "end",
+ "ended",
+ "deque",
+ "denque",
+ "double-ended-queue"
+ ],
+ "scripts": {
+ "test": "istanbul cover --report lcov _mocha && npm run typescript",
+ "coveralls": "cat ./coverage/lcov.info | coveralls",
+ "typescript": "tsc --project ./test/type/tsconfig.json",
+ "benchmark_thousand": "node benchmark/thousand",
+ "benchmark_2mil": "node benchmark/two_million",
+ "benchmark_splice": "node benchmark/splice",
+ "benchmark_remove": "node benchmark/remove",
+ "benchmark_removeOne": "node benchmark/removeOne",
+ "benchmark_growth": "node benchmark/growth",
+ "benchmark_toArray": "node benchmark/toArray",
+ "benchmark_fromArray": "node benchmark/fromArray"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/invertase/denque.git"
+ },
+ "license": "Apache-2.0",
+ "author": {
+ "name": "Invertase",
+ "email": "oss@invertase.io",
+ "url": "http://github.com/invertase/"
+ },
+ "contributors": [
+ "Mike Diarmid (Salakar) "
+ ],
+ "bugs": {
+ "url": "https://github.com/invertase/denque/issues"
+ },
+ "homepage": "https://docs.page/invertase/denque",
+ "devDependencies": {
+ "benchmark": "^2.1.4",
+ "codecov": "^3.8.3",
+ "double-ended-queue": "^2.1.0-0",
+ "istanbul": "^0.4.5",
+ "mocha": "^3.5.3",
+ "typescript": "^3.4.1"
+ }
+}
diff --git a/EmployeeManagementBackend/node_modules/generate-function/.travis.yml b/EmployeeManagementBackend/node_modules/generate-function/.travis.yml
new file mode 100644
index 0000000..6e5919d
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/generate-function/.travis.yml
@@ -0,0 +1,3 @@
+language: node_js
+node_js:
+ - "0.10"
diff --git a/EmployeeManagementBackend/node_modules/generate-function/LICENSE b/EmployeeManagementBackend/node_modules/generate-function/LICENSE
new file mode 100644
index 0000000..757562e
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/generate-function/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2014 Mathias Buus
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
\ No newline at end of file
diff --git a/EmployeeManagementBackend/node_modules/generate-function/README.md b/EmployeeManagementBackend/node_modules/generate-function/README.md
new file mode 100644
index 0000000..97419e9
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/generate-function/README.md
@@ -0,0 +1,89 @@
+# generate-function
+
+Module that helps you write generated functions in Node
+
+```
+npm install generate-function
+```
+
+[](http://travis-ci.org/mafintosh/generate-function)
+
+## Disclamer
+
+Writing code that generates code is hard.
+You should only use this if you really, really, really need this for performance reasons (like schema validators / parsers etc).
+
+## Usage
+
+``` js
+const genfun = require('generate-function')
+const { d } = genfun.formats
+
+function addNumber (val) {
+ const gen = genfun()
+
+ gen(`
+ function add (n) {')
+ return n + ${d(val)}) // supports format strings to insert values
+ }
+ `)
+
+ return gen.toFunction() // will compile the function
+}
+
+const add2 = addNumber(2)
+
+console.log('1 + 2 =', add2(1))
+console.log(add2.toString()) // prints the generated function
+```
+
+If you need to close over variables in your generated function pass them to `toFunction(scope)`
+
+``` js
+function multiply (a, b) {
+ return a * b
+}
+
+function addAndMultiplyNumber (val) {
+ const gen = genfun()
+
+ gen(`
+ function (n) {
+ if (typeof n !== 'number') {
+ throw new Error('argument should be a number')
+ }
+ const result = multiply(${d(val)}, n + ${d(val)})
+ return result
+ }
+ `)
+
+ // use gen.toString() if you want to see the generated source
+
+ return gen.toFunction({multiply})
+}
+
+const addAndMultiply2 = addAndMultiplyNumber(2)
+
+console.log(addAndMultiply2.toString())
+console.log('(3 + 2) * 2 =', addAndMultiply2(3))
+```
+
+You can call `gen(src)` as many times as you want to append more source code to the function.
+
+## Variables
+
+If you need a unique safe identifier for the scope of the generated function call `str = gen.sym('friendlyName')`.
+These are safe to use for variable names etc.
+
+## Object properties
+
+If you need to access an object property use the `str = gen.property('objectName', 'propertyName')`.
+
+This returns `'objectName.propertyName'` if `propertyName` is safe to use as a variable. Otherwise
+it returns `objectName[propertyNameAsString]`.
+
+If you only pass `gen.property('propertyName')` it will only return the `propertyName` part safely
+
+## License
+
+MIT
diff --git a/EmployeeManagementBackend/node_modules/generate-function/example.js b/EmployeeManagementBackend/node_modules/generate-function/example.js
new file mode 100644
index 0000000..7c36c76
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/generate-function/example.js
@@ -0,0 +1,27 @@
+const genfun = require('./')
+const { d } = genfun.formats
+
+function multiply (a, b) {
+ return a * b
+}
+
+function addAndMultiplyNumber (val) {
+ const fn = genfun(`
+ function (n) {
+ if (typeof n !== 'number') {
+ throw new Error('argument should be a number')
+ }
+ const result = multiply(${d(val)}, n + ${d(val)})
+ return result
+ }
+ `)
+
+ // use fn.toString() if you want to see the generated source
+
+ return fn.toFunction({multiply})
+}
+
+const addAndMultiply2 = addAndMultiplyNumber(2)
+
+console.log(addAndMultiply2.toString())
+console.log('(3 + 2) * 2 =', addAndMultiply2(3))
diff --git a/EmployeeManagementBackend/node_modules/generate-function/index.js b/EmployeeManagementBackend/node_modules/generate-function/index.js
new file mode 100644
index 0000000..8105dc0
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/generate-function/index.js
@@ -0,0 +1,181 @@
+var util = require('util')
+var isProperty = require('is-property')
+
+var INDENT_START = /[\{\[]/
+var INDENT_END = /[\}\]]/
+
+// from https://mathiasbynens.be/notes/reserved-keywords
+var RESERVED = [
+ 'do',
+ 'if',
+ 'in',
+ 'for',
+ 'let',
+ 'new',
+ 'try',
+ 'var',
+ 'case',
+ 'else',
+ 'enum',
+ 'eval',
+ 'null',
+ 'this',
+ 'true',
+ 'void',
+ 'with',
+ 'await',
+ 'break',
+ 'catch',
+ 'class',
+ 'const',
+ 'false',
+ 'super',
+ 'throw',
+ 'while',
+ 'yield',
+ 'delete',
+ 'export',
+ 'import',
+ 'public',
+ 'return',
+ 'static',
+ 'switch',
+ 'typeof',
+ 'default',
+ 'extends',
+ 'finally',
+ 'package',
+ 'private',
+ 'continue',
+ 'debugger',
+ 'function',
+ 'arguments',
+ 'interface',
+ 'protected',
+ 'implements',
+ 'instanceof',
+ 'NaN',
+ 'undefined'
+]
+
+var RESERVED_MAP = {}
+
+for (var i = 0; i < RESERVED.length; i++) {
+ RESERVED_MAP[RESERVED[i]] = true
+}
+
+var isVariable = function (name) {
+ return isProperty(name) && !RESERVED_MAP.hasOwnProperty(name)
+}
+
+var formats = {
+ s: function(s) {
+ return '' + s
+ },
+ d: function(d) {
+ return '' + Number(d)
+ },
+ o: function(o) {
+ return JSON.stringify(o)
+ }
+}
+
+var genfun = function() {
+ var lines = []
+ var indent = 0
+ var vars = {}
+
+ var push = function(str) {
+ var spaces = ''
+ while (spaces.length < indent*2) spaces += ' '
+ lines.push(spaces+str)
+ }
+
+ var pushLine = function(line) {
+ if (INDENT_END.test(line.trim()[0]) && INDENT_START.test(line[line.length-1])) {
+ indent--
+ push(line)
+ indent++
+ return
+ }
+ if (INDENT_START.test(line[line.length-1])) {
+ push(line)
+ indent++
+ return
+ }
+ if (INDENT_END.test(line.trim()[0])) {
+ indent--
+ push(line)
+ return
+ }
+
+ push(line)
+ }
+
+ var line = function(fmt) {
+ if (!fmt) return line
+
+ if (arguments.length === 1 && fmt.indexOf('\n') > -1) {
+ var lines = fmt.trim().split('\n')
+ for (var i = 0; i < lines.length; i++) {
+ pushLine(lines[i].trim())
+ }
+ } else {
+ pushLine(util.format.apply(util, arguments))
+ }
+
+ return line
+ }
+
+ line.scope = {}
+ line.formats = formats
+
+ line.sym = function(name) {
+ if (!name || !isVariable(name)) name = 'tmp'
+ if (!vars[name]) vars[name] = 0
+ return name + (vars[name]++ || '')
+ }
+
+ line.property = function(obj, name) {
+ if (arguments.length === 1) {
+ name = obj
+ obj = ''
+ }
+
+ name = name + ''
+
+ if (isProperty(name)) return (obj ? obj + '.' + name : name)
+ return obj ? obj + '[' + JSON.stringify(name) + ']' : JSON.stringify(name)
+ }
+
+ line.toString = function() {
+ return lines.join('\n')
+ }
+
+ line.toFunction = function(scope) {
+ if (!scope) scope = {}
+
+ var src = 'return ('+line.toString()+')'
+
+ Object.keys(line.scope).forEach(function (key) {
+ if (!scope[key]) scope[key] = line.scope[key]
+ })
+
+ var keys = Object.keys(scope).map(function(key) {
+ return key
+ })
+
+ var vals = keys.map(function(key) {
+ return scope[key]
+ })
+
+ return Function.apply(null, keys.concat(src)).apply(null, vals)
+ }
+
+ if (arguments.length) line.apply(null, arguments)
+
+ return line
+}
+
+genfun.formats = formats
+module.exports = genfun
diff --git a/EmployeeManagementBackend/node_modules/generate-function/package.json b/EmployeeManagementBackend/node_modules/generate-function/package.json
new file mode 100644
index 0000000..be2ac04
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/generate-function/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "generate-function",
+ "version": "2.3.1",
+ "description": "Module that helps you write generated functions in Node",
+ "main": "index.js",
+ "scripts": {
+ "test": "tape test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/mafintosh/generate-function"
+ },
+ "keywords": [
+ "generate",
+ "code",
+ "generation",
+ "function",
+ "performance"
+ ],
+ "author": "Mathias Buus",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/mafintosh/generate-function/issues"
+ },
+ "homepage": "https://github.com/mafintosh/generate-function",
+ "devDependencies": {
+ "tape": "^4.9.1"
+ },
+ "dependencies": {
+ "is-property": "^1.0.2"
+ }
+}
diff --git a/EmployeeManagementBackend/node_modules/generate-function/test.js b/EmployeeManagementBackend/node_modules/generate-function/test.js
new file mode 100644
index 0000000..9337b71
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/generate-function/test.js
@@ -0,0 +1,49 @@
+var tape = require('tape')
+var genfun = require('./')
+
+tape('generate add function', function(t) {
+ var fn = genfun()
+ ('function add(n) {')
+ ('return n + %d', 42)
+ ('}')
+
+ t.same(fn.toString(), 'function add(n) {\n return n + 42\n}', 'code is indented')
+ t.same(fn.toFunction()(10), 52, 'function works')
+ t.end()
+})
+
+tape('generate function + closed variables', function(t) {
+ var fn = genfun()
+ ('function add(n) {')
+ ('return n + %d + number', 42)
+ ('}')
+
+ var notGood = fn.toFunction()
+ var good = fn.toFunction({number:10})
+
+ try {
+ notGood(10)
+ t.ok(false, 'function should not work')
+ } catch (err) {
+ t.same(err.message, 'number is not defined', 'throws reference error')
+ }
+
+ t.same(good(11), 63, 'function with closed var works')
+ t.end()
+})
+
+tape('generate property', function(t) {
+ var gen = genfun()
+
+ t.same(gen.property('a'), 'a')
+ t.same(gen.property('42'), '"42"')
+ t.same(gen.property('b', 'a'), 'b.a')
+ t.same(gen.property('b', '42'), 'b["42"]')
+ t.same(gen.sym(42), 'tmp')
+ t.same(gen.sym('a'), 'a')
+ t.same(gen.sym('a'), 'a1')
+ t.same(gen.sym(42), 'tmp1')
+ t.same(gen.sym('const'), 'tmp2')
+
+ t.end()
+})
diff --git a/EmployeeManagementBackend/node_modules/is-property/.npmignore b/EmployeeManagementBackend/node_modules/is-property/.npmignore
new file mode 100644
index 0000000..8ecfa25
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/is-property/.npmignore
@@ -0,0 +1,17 @@
+lib-cov
+*.seed
+*.log
+*.csv
+*.dat
+*.out
+*.pid
+*.gz
+
+pids
+logs
+results
+
+npm-debug.log
+node_modules/*
+*.DS_Store
+test/*
\ No newline at end of file
diff --git a/EmployeeManagementBackend/node_modules/is-property/LICENSE b/EmployeeManagementBackend/node_modules/is-property/LICENSE
new file mode 100644
index 0000000..8ce206a
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/is-property/LICENSE
@@ -0,0 +1,22 @@
+
+The MIT License (MIT)
+
+Copyright (c) 2013 Mikola Lysenko
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/EmployeeManagementBackend/node_modules/is-property/README.md b/EmployeeManagementBackend/node_modules/is-property/README.md
new file mode 100644
index 0000000..ef1d00b
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/is-property/README.md
@@ -0,0 +1,28 @@
+is-property
+===========
+Tests if a property of a JavaScript object can be accessed using the dot (.) notation or if it must be enclosed in brackets, (ie use x[" ... "])
+
+Example
+-------
+
+```javascript
+var isProperty = require("is-property")
+
+console.log(isProperty("foo")) //Prints true
+console.log(isProperty("0")) //Prints false
+```
+
+Install
+-------
+
+ npm install is-property
+
+### `require("is-property")(str)`
+Checks if str is a property
+
+* `str` is a string which we will test if it is a property or not
+
+**Returns** true or false depending if str is a property
+
+## Credits
+(c) 2013 Mikola Lysenko. MIT License
\ No newline at end of file
diff --git a/EmployeeManagementBackend/node_modules/is-property/is-property.js b/EmployeeManagementBackend/node_modules/is-property/is-property.js
new file mode 100644
index 0000000..db58b47
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/is-property/is-property.js
@@ -0,0 +1,5 @@
+"use strict"
+function isProperty(str) {
+ return /^[$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc][$A-Z\_a-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc0-9\u0300-\u036f\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0d02\u0d03\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d82\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19b0-\u19c0\u19c8\u19c9\u19d0-\u19d9\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf2-\u1cf4\u1dc0-\u1de6\u1dfc-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua620-\ua629\ua66f\ua674-\ua67d\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua880\ua881\ua8b4-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f1\ua900-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f]*$/.test(str)
+}
+module.exports = isProperty
\ No newline at end of file
diff --git a/EmployeeManagementBackend/node_modules/is-property/package.json b/EmployeeManagementBackend/node_modules/is-property/package.json
new file mode 100644
index 0000000..2105f7b
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/is-property/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "is-property",
+ "version": "1.0.2",
+ "description": "Tests if a JSON property can be accessed using . syntax",
+ "main": "is-property.js",
+ "directories": {
+ "test": "test"
+ },
+ "dependencies": {},
+ "devDependencies": {
+ "tape": "~1.0.4"
+ },
+ "scripts": {
+ "test": "tap test/*.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/mikolalysenko/is-property.git"
+ },
+ "keywords": [
+ "is",
+ "property",
+ "json",
+ "dot",
+ "bracket",
+ ".",
+ "[]"
+ ],
+ "author": "Mikola Lysenko",
+ "license": "MIT",
+ "readmeFilename": "README.md",
+ "gitHead": "0a85ea5b6b1264ea1cdecc6e5cf186adbb3ffc50",
+ "bugs": {
+ "url": "https://github.com/mikolalysenko/is-property/issues"
+ }
+}
diff --git a/EmployeeManagementBackend/node_modules/long/LICENSE b/EmployeeManagementBackend/node_modules/long/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/EmployeeManagementBackend/node_modules/long/README.md b/EmployeeManagementBackend/node_modules/long/README.md
new file mode 100644
index 0000000..ca4b2f8
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/README.md
@@ -0,0 +1,286 @@
+# long.js
+
+A Long class for representing a 64 bit two's-complement integer value derived from the [Closure Library](https://github.com/google/closure-library)
+for stand-alone use and extended with unsigned support.
+
+[](https://github.com/dcodeIO/long.js/actions/workflows/test.yml) [](https://github.com/dcodeIO/long.js/actions/workflows/publish.yml) [](https://www.npmjs.com/package/long)
+
+## Background
+
+As of [ECMA-262 5th Edition](http://ecma262-5.com/ELS5_HTML.htm#Section_8.5), "all the positive and negative integers
+whose magnitude is no greater than 253 are representable in the Number type", which is "representing the
+doubleprecision 64-bit format IEEE 754 values as specified in the IEEE Standard for Binary Floating-Point Arithmetic".
+The [maximum safe integer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)
+in JavaScript is 253-1.
+
+Example: 264-1 is 1844674407370955**1615** but in JavaScript it evaluates to 1844674407370955**2000**.
+
+Furthermore, bitwise operators in JavaScript "deal only with integers in the range −231 through
+231−1, inclusive, or in the range 0 through 232−1, inclusive. These operators accept any value of
+the Number type but first convert each such value to one of 232 integer values."
+
+In some use cases, however, it is required to be able to reliably work with and perform bitwise operations on the full
+64 bits. This is where long.js comes into play.
+
+## Usage
+
+The package exports an ECMAScript module with an UMD fallback.
+
+```
+$> npm install long
+```
+
+```js
+import Long from "long";
+
+var value = new Long(0xFFFFFFFF, 0x7FFFFFFF);
+console.log(value.toString());
+...
+```
+
+Note that mixing ESM and CommonJS is not recommended as it yields different classes, albeit with the same functionality.
+
+### Usage with a CDN
+
+- From GitHub via [jsDelivr](https://www.jsdelivr.com):
+ `https://cdn.jsdelivr.net/gh/dcodeIO/long.js@TAG/index.js` (ESM)
+- From npm via [jsDelivr](https://www.jsdelivr.com):
+ `https://cdn.jsdelivr.net/npm/long@VERSION/index.js` (ESM)
+ `https://cdn.jsdelivr.net/npm/long@VERSION/umd/index.js` (UMD)
+- From npm via [unpkg](https://unpkg.com):
+ `https://unpkg.com/long@VERSION/index.js` (ESM)
+ `https://unpkg.com/long@VERSION/umd/index.js` (UMD)
+
+Replace `TAG` respectively `VERSION` with a [specific version](https://github.com/dcodeIO/long.js/releases) or omit it (not recommended in production) to use main/latest.
+
+## API
+
+### Constructor
+
+- new **Long**(low: `number`, high?: `number`, unsigned?: `boolean`)
+ Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as _signed_ integers. See the from\* functions below for more convenient ways of constructing Longs.
+
+### Fields
+
+- Long#**low**: `number`
+ The low 32 bits as a signed value.
+
+- Long#**high**: `number`
+ The high 32 bits as a signed value.
+
+- Long#**unsigned**: `boolean`
+ Whether unsigned or not.
+
+### Constants
+
+- Long.**ZERO**: `Long`
+ Signed zero.
+
+- Long.**ONE**: `Long`
+ Signed one.
+
+- Long.**NEG_ONE**: `Long`
+ Signed negative one.
+
+- Long.**UZERO**: `Long`
+ Unsigned zero.
+
+- Long.**UONE**: `Long`
+ Unsigned one.
+
+- Long.**MAX_VALUE**: `Long`
+ Maximum signed value.
+
+- Long.**MIN_VALUE**: `Long`
+ Minimum signed value.
+
+- Long.**MAX_UNSIGNED_VALUE**: `Long`
+ Maximum unsigned value.
+
+### Utility
+
+- type **LongLike**: `Long | number | bigint | string`
+ Any value or object that either is or can be converted to a Long.
+
+- Long.**isLong**(obj: `any`): `boolean`
+ Tests if the specified object is a Long.
+
+- Long.**fromBits**(lowBits: `number`, highBits: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
+
+- Long.**fromBytes**(bytes: `number[]`, unsigned?: `boolean`, le?: `boolean`): `Long`
+ Creates a Long from its byte representation.
+
+- Long.**fromBytesLE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its little endian byte representation.
+
+- Long.**fromBytesBE**(bytes: `number[]`, unsigned?: `boolean`): `Long`
+ Creates a Long from its big endian byte representation.
+
+- Long.**fromInt**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given 32 bit integer value.
+
+- Long.**fromNumber**(value: `number`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+
+- Long.**fromBigInt**(value: `bigint`, unsigned?: `boolean`): `Long`
+ Returns a Long representing the given big integer.
+
+- Long.**fromString**(str: `string`, unsigned?: `boolean`, radix?: `number`)
+ Long.**fromString**(str: `string`, radix: `number`)
+ Returns a Long representation of the given string, written using the specified radix.
+
+- Long.**fromValue**(val: `LongLike`, unsigned?: `boolean`): `Long`
+ Converts the specified value to a Long using the appropriate from\* function for its type.
+
+### Methods
+
+- Long#**add**(addend: `LongLike`): `Long`
+ Returns the sum of this and the specified Long.
+
+- Long#**and**(other: `LongLike`): `Long`
+ Returns the bitwise AND of this Long and the specified.
+
+- Long#**compare**/**comp**(other: `LongLike`): `number`
+ Compares this Long's value with the specified's. Returns `0` if they are the same, `1` if the this is greater and `-1` if the given one is greater.
+
+- Long#**divide**/**div**(divisor: `LongLike`): `Long`
+ Returns this Long divided by the specified.
+
+- Long#**equals**/**eq**(other: `LongLike`): `boolean`
+ Tests if this Long's value equals the specified's.
+
+- Long#**getHighBits**(): `number`
+ Gets the high 32 bits as a signed integer.
+
+- Long#**getHighBitsUnsigned**(): `number`
+ Gets the high 32 bits as an unsigned integer.
+
+- Long#**getLowBits**(): `number`
+ Gets the low 32 bits as a signed integer.
+
+- Long#**getLowBitsUnsigned**(): `number`
+ Gets the low 32 bits as an unsigned integer.
+
+- Long#**getNumBitsAbs**(): `number`
+ Gets the number of bits needed to represent the absolute value of this Long.
+
+- Long#**greaterThan**/**gt**(other: `LongLike`): `boolean`
+ Tests if this Long's value is greater than the specified's.
+
+- Long#**greaterThanOrEqual**/**gte**/**ge**(other: `LongLike`): `boolean`
+ Tests if this Long's value is greater than or equal the specified's.
+
+- Long#**isEven**(): `boolean`
+ Tests if this Long's value is even.
+
+- Long#**isNegative**(): `boolean`
+ Tests if this Long's value is negative.
+
+- Long#**isOdd**(): `boolean`
+ Tests if this Long's value is odd.
+
+- Long#**isPositive**(): `boolean`
+ Tests if this Long's value is positive or zero.
+
+- Long#**isSafeInteger**(): `boolean`
+ Tests if this Long can be safely represented as a JavaScript number.
+
+- Long#**isZero**/**eqz**(): `boolean`
+ Tests if this Long's value equals zero.
+
+- Long#**lessThan**/**lt**(other: `LongLike`): `boolean`
+ Tests if this Long's value is less than the specified's.
+
+- Long#**lessThanOrEqual**/**lte**/**le**(other: `LongLike`): `boolean`
+ Tests if this Long's value is less than or equal the specified's.
+
+- Long#**modulo**/**mod**/**rem**(divisor: `LongLike`): `Long`
+ Returns this Long modulo the specified.
+
+- Long#**multiply**/**mul**(multiplier: `LongLike`): `Long`
+ Returns the product of this and the specified Long.
+
+- Long#**negate**/**neg**(): `Long`
+ Negates this Long's value.
+
+- Long#**not**(): `Long`
+ Returns the bitwise NOT of this Long.
+
+- Long#**countLeadingZeros**/**clz**(): `number`
+ Returns count leading zeros of this Long.
+
+- Long#**countTrailingZeros**/**ctz**(): `number`
+ Returns count trailing zeros of this Long.
+
+- Long#**notEquals**/**neq**/**ne**(other: `LongLike`): `boolean`
+ Tests if this Long's value differs from the specified's.
+
+- Long#**or**(other: `LongLike`): `Long`
+ Returns the bitwise OR of this Long and the specified.
+
+- Long#**shiftLeft**/**shl**(numBits: `Long | number`): `Long`
+ Returns this Long with bits shifted to the left by the given amount.
+
+- Long#**shiftRight**/**shr**(numBits: `Long | number`): `Long`
+ Returns this Long with bits arithmetically shifted to the right by the given amount.
+
+- Long#**shiftRightUnsigned**/**shru**/**shr_u**(numBits: `Long | number`): `Long`
+ Returns this Long with bits logically shifted to the right by the given amount.
+
+- Long#**rotateLeft**/**rotl**(numBits: `Long | number`): `Long`
+ Returns this Long with bits rotated to the left by the given amount.
+
+- Long#**rotateRight**/**rotr**(numBits: `Long | number`): `Long`
+ Returns this Long with bits rotated to the right by the given amount.
+
+- Long#**subtract**/**sub**(subtrahend: `LongLike`): `Long`
+ Returns the difference of this and the specified Long.
+
+- Long#**toBytes**(le?: `boolean`): `number[]`
+ Converts this Long to its byte representation.
+
+- Long#**toBytesLE**(): `number[]`
+ Converts this Long to its little endian byte representation.
+
+- Long#**toBytesBE**(): `number[]`
+ Converts this Long to its big endian byte representation.
+
+- Long#**toInt**(): `number`
+ Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+
+- Long#**toNumber**(): `number`
+ Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+
+- Long#**toBigInt**(): `bigint`
+ Converts the Long to its big integer representation.
+
+- Long#**toSigned**(): `Long`
+ Converts this Long to signed.
+
+- Long#**toString**(radix?: `number`): `string`
+ Converts the Long to a string written in the specified radix.
+
+- Long#**toUnsigned**(): `Long`
+ Converts this Long to unsigned.
+
+- Long#**xor**(other: `Long | number | string`): `Long`
+ Returns the bitwise XOR of this Long and the given one.
+
+## WebAssembly support
+
+[WebAssembly](http://webassembly.org) supports 64-bit integer arithmetic out of the box, hence a [tiny WebAssembly module](./wasm.wat) is used to compute operations like multiplication, division and remainder more efficiently (slow operations like division are around twice as fast), falling back to floating point based computations in JavaScript where WebAssembly is not yet supported, e.g., in older versions of node.
+
+## Building
+
+Building the UMD fallback:
+
+```
+$> npm run build
+```
+
+Running the [tests](./tests):
+
+```
+$> npm test
+```
diff --git a/EmployeeManagementBackend/node_modules/long/index.d.ts b/EmployeeManagementBackend/node_modules/long/index.d.ts
new file mode 100644
index 0000000..7d4b017
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/index.d.ts
@@ -0,0 +1,2 @@
+import { Long } from "./types.js";
+export default Long;
diff --git a/EmployeeManagementBackend/node_modules/long/index.js b/EmployeeManagementBackend/node_modules/long/index.js
new file mode 100644
index 0000000..9a0fe70
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/index.js
@@ -0,0 +1,1581 @@
+/**
+ * @license
+ * Copyright 2009 The Closure Library Authors
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+// WebAssembly optimizations to do native i64 multiplication and divide
+var wasm = null;
+try {
+ wasm = new WebAssembly.Instance(
+ new WebAssembly.Module(
+ new Uint8Array([
+ // \0asm
+ 0, 97, 115, 109,
+ // version 1
+ 1, 0, 0, 0,
+
+ // section "type"
+ 1, 13, 2,
+ // 0, () => i32
+ 96, 0, 1, 127,
+ // 1, (i32, i32, i32, i32) => i32
+ 96, 4, 127, 127, 127, 127, 1, 127,
+
+ // section "function"
+ 3, 7, 6,
+ // 0, type 0
+ 0,
+ // 1, type 1
+ 1,
+ // 2, type 1
+ 1,
+ // 3, type 1
+ 1,
+ // 4, type 1
+ 1,
+ // 5, type 1
+ 1,
+
+ // section "global"
+ 6, 6, 1,
+ // 0, "high", mutable i32
+ 127, 1, 65, 0, 11,
+
+ // section "export"
+ 7, 50, 6,
+ // 0, "mul"
+ 3, 109, 117, 108, 0, 1,
+ // 1, "div_s"
+ 5, 100, 105, 118, 95, 115, 0, 2,
+ // 2, "div_u"
+ 5, 100, 105, 118, 95, 117, 0, 3,
+ // 3, "rem_s"
+ 5, 114, 101, 109, 95, 115, 0, 4,
+ // 4, "rem_u"
+ 5, 114, 101, 109, 95, 117, 0, 5,
+ // 5, "get_high"
+ 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0,
+
+ // section "code"
+ 10, 191, 1, 6,
+ // 0, "get_high"
+ 4, 0, 35, 0, 11,
+ // 1, "mul"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32,
+ 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4,
+ 167, 11,
+ // 2, "div_s"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32,
+ 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4,
+ 167, 11,
+ // 3, "div_u"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32,
+ 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4,
+ 167, 11,
+ // 4, "rem_s"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32,
+ 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4,
+ 167, 11,
+ // 5, "rem_u"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32,
+ 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4,
+ 167, 11,
+ ]),
+ ),
+ {},
+ ).exports;
+} catch {
+ // no wasm support :(
+}
+
+/**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
+ * See the from* functions below for more convenient ways of constructing Longs.
+ * @exports Long
+ * @class A Long class for representing a 64 bit two's-complement integer value.
+ * @param {number} low The low (signed) 32 bits of the long
+ * @param {number} high The high (signed) 32 bits of the long
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @constructor
+ */
+function Long(low, high, unsigned) {
+ /**
+ * The low 32 bits as a signed value.
+ * @type {number}
+ */
+ this.low = low | 0;
+
+ /**
+ * The high 32 bits as a signed value.
+ * @type {number}
+ */
+ this.high = high | 0;
+
+ /**
+ * Whether unsigned or not.
+ * @type {boolean}
+ */
+ this.unsigned = !!unsigned;
+}
+
+// The internal representation of a long is the two given signed, 32-bit values.
+// We use 32-bit pieces because these are the size of integers on which
+// Javascript performs bit-operations. For operations like addition and
+// multiplication, we split each number into 16 bit pieces, which can easily be
+// multiplied within Javascript's floating-point representation without overflow
+// or change in sign.
+//
+// In the algorithms below, we frequently reduce the negative case to the
+// positive case by negating the input(s) and then post-processing the result.
+// Note that we must ALWAYS check specially whether those values are MIN_VALUE
+// (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
+// a positive number, it overflows back into a negative). Not handling this
+// case would often result in infinite recursion.
+//
+// Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
+// methods on which they depend.
+
+/**
+ * An indicator used to reliably determine if an object is a Long or not.
+ * @type {boolean}
+ * @const
+ * @private
+ */
+Long.prototype.__isLong__;
+
+Object.defineProperty(Long.prototype, "__isLong__", { value: true });
+
+/**
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ * @inner
+ */
+function isLong(obj) {
+ return (obj && obj["__isLong__"]) === true;
+}
+
+/**
+ * @function
+ * @param {*} value number
+ * @returns {number}
+ * @inner
+ */
+function ctz32(value) {
+ var c = Math.clz32(value & -value);
+ return value ? 31 - c : c;
+}
+
+/**
+ * Tests if the specified object is a Long.
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ */
+Long.isLong = isLong;
+
+/**
+ * A cache of the Long representations of small integer values.
+ * @type {!Object}
+ * @inner
+ */
+var INT_CACHE = {};
+
+/**
+ * A cache of the Long representations of small unsigned integer values.
+ * @type {!Object}
+ * @inner
+ */
+var UINT_CACHE = {};
+
+/**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromInt(value, unsigned) {
+ var obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+ obj = fromBits(value, 0, true);
+ if (cache) UINT_CACHE[value] = obj;
+ return obj;
+ } else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache) INT_CACHE[value] = obj;
+ return obj;
+ }
+}
+
+/**
+ * Returns a Long representing the given 32 bit integer value.
+ * @function
+ * @param {number} value The 32 bit integer in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromInt = fromInt;
+
+/**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromNumber(value, unsigned) {
+ if (isNaN(value)) return unsigned ? UZERO : ZERO;
+ if (unsigned) {
+ if (value < 0) return UZERO;
+ if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
+ } else {
+ if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
+ }
+ if (value < 0) return fromNumber(-value, unsigned).neg();
+ return fromBits(
+ value % TWO_PWR_32_DBL | 0,
+ (value / TWO_PWR_32_DBL) | 0,
+ unsigned,
+ );
+}
+
+/**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @function
+ * @param {number} value The number in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromNumber = fromNumber;
+
+/**
+ * @param {number} lowBits
+ * @param {number} highBits
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+}
+
+/**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
+ * assumed to use 32 bits.
+ * @function
+ * @param {number} lowBits The low 32 bits
+ * @param {number} highBits The high 32 bits
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromBits = fromBits;
+
+/**
+ * @function
+ * @param {number} base
+ * @param {number} exponent
+ * @returns {number}
+ * @inner
+ */
+var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
+
+/**
+ * @param {string} str
+ * @param {(boolean|number)=} unsigned
+ * @param {number=} radix
+ * @returns {!Long}
+ * @inner
+ */
+function fromString(str, unsigned, radix) {
+ if (str.length === 0) throw Error("empty string");
+ if (typeof unsigned === "number") {
+ // For goog.math.long compatibility
+ radix = unsigned;
+ unsigned = false;
+ } else {
+ unsigned = !!unsigned;
+ }
+ if (
+ str === "NaN" ||
+ str === "Infinity" ||
+ str === "+Infinity" ||
+ str === "-Infinity"
+ )
+ return unsigned ? UZERO : ZERO;
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix) throw RangeError("radix");
+
+ var p;
+ if ((p = str.indexOf("-")) > 0) throw Error("interior hyphen");
+ else if (p === 0) {
+ return fromString(str.substring(1), unsigned, radix).neg();
+ }
+
+ // Do several (8) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
+
+ var result = ZERO;
+ for (var i = 0; i < str.length; i += 8) {
+ var size = Math.min(8, str.length - i),
+ value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ var power = fromNumber(pow_dbl(radix, size));
+ result = result.mul(power).add(fromNumber(value));
+ } else {
+ result = result.mul(radixToPower);
+ result = result.add(fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+}
+
+/**
+ * Returns a Long representation of the given string, written using the specified radix.
+ * @function
+ * @param {string} str The textual representation of the Long
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
+ * @returns {!Long} The corresponding Long value
+ */
+Long.fromString = fromString;
+
+/**
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+function fromValue(val, unsigned) {
+ if (typeof val === "number") return fromNumber(val, unsigned);
+ if (typeof val === "string") return fromString(val, unsigned);
+ // Throws for non-objects, converts non-instanceof Long:
+ return fromBits(
+ val.low,
+ val.high,
+ typeof unsigned === "boolean" ? unsigned : val.unsigned,
+ );
+}
+
+/**
+ * Converts the specified value to a Long using the appropriate from* function for its type.
+ * @function
+ * @param {!Long|number|bigint|string|!{low: number, high: number, unsigned: boolean}} val Value
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long}
+ */
+Long.fromValue = fromValue;
+
+// NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
+// no runtime penalty for these.
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_16_DBL = 1 << 16;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_24_DBL = 1 << 24;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+
+/**
+ * @type {number}
+ * @const
+ * @inner
+ */
+var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+
+/**
+ * @type {!Long}
+ * @const
+ * @inner
+ */
+var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var ZERO = fromInt(0);
+
+/**
+ * Signed zero.
+ * @type {!Long}
+ */
+Long.ZERO = ZERO;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var UZERO = fromInt(0, true);
+
+/**
+ * Unsigned zero.
+ * @type {!Long}
+ */
+Long.UZERO = UZERO;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var ONE = fromInt(1);
+
+/**
+ * Signed one.
+ * @type {!Long}
+ */
+Long.ONE = ONE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var UONE = fromInt(1, true);
+
+/**
+ * Unsigned one.
+ * @type {!Long}
+ */
+Long.UONE = UONE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var NEG_ONE = fromInt(-1);
+
+/**
+ * Signed negative one.
+ * @type {!Long}
+ */
+Long.NEG_ONE = NEG_ONE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var MAX_VALUE = fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+
+/**
+ * Maximum signed value.
+ * @type {!Long}
+ */
+Long.MAX_VALUE = MAX_VALUE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var MAX_UNSIGNED_VALUE = fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+
+/**
+ * Maximum unsigned value.
+ * @type {!Long}
+ */
+Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
+
+/**
+ * @type {!Long}
+ * @inner
+ */
+var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
+
+/**
+ * Minimum signed value.
+ * @type {!Long}
+ */
+Long.MIN_VALUE = MIN_VALUE;
+
+/**
+ * @alias Long.prototype
+ * @inner
+ */
+var LongPrototype = Long.prototype;
+
+/**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ * @this {!Long}
+ * @returns {number}
+ */
+LongPrototype.toInt = function toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+};
+
+/**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ * @this {!Long}
+ * @returns {number}
+ */
+LongPrototype.toNumber = function toNumber() {
+ if (this.unsigned)
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+};
+
+/**
+ * Converts the Long to a string written in the specified radix.
+ * @this {!Long}
+ * @param {number=} radix Radix (2-36), defaults to 10
+ * @returns {string}
+ * @override
+ * @throws {RangeError} If `radix` is out of range
+ */
+LongPrototype.toString = function toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix) throw RangeError("radix");
+ if (this.isZero()) return "0";
+ if (this.isNegative()) {
+ // Unsigned Longs are never negative
+ if (this.eq(MIN_VALUE)) {
+ // We need to change the Long value before it can be negated, so we remove
+ // the bottom-most digit in this base and then recurse to do the rest.
+ var radixLong = fromNumber(radix),
+ div = this.div(radixLong),
+ rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ } else return "-" + this.neg().toString(radix);
+ }
+
+ // Do several (6) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
+ rem = this;
+ var result = "";
+ while (true) {
+ var remDiv = rem.div(radixToPower),
+ intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
+ digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) return digits + result;
+ else {
+ while (digits.length < 6) digits = "0" + digits;
+ result = "" + digits + result;
+ }
+ }
+};
+
+/**
+ * Gets the high 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed high bits
+ */
+LongPrototype.getHighBits = function getHighBits() {
+ return this.high;
+};
+
+/**
+ * Gets the high 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned high bits
+ */
+LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
+ return this.high >>> 0;
+};
+
+/**
+ * Gets the low 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed low bits
+ */
+LongPrototype.getLowBits = function getLowBits() {
+ return this.low;
+};
+
+/**
+ * Gets the low 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned low bits
+ */
+LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
+ return this.low >>> 0;
+};
+
+/**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ * @this {!Long}
+ * @returns {number}
+ */
+LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
+ if (this.isNegative())
+ // Unsigned Longs are never negative
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ var val = this.high != 0 ? this.high : this.low;
+ for (var bit = 31; bit > 0; bit--) if ((val & (1 << bit)) != 0) break;
+ return this.high != 0 ? bit + 33 : bit + 1;
+};
+
+/**
+ * Tests if this Long can be safely represented as a JavaScript number.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isSafeInteger = function isSafeInteger() {
+ // 2^53-1 is the maximum safe value
+ var top11Bits = this.high >> 21;
+ // [0, 2^53-1]
+ if (!top11Bits) return true;
+ // > 2^53-1
+ if (this.unsigned) return false;
+ // [-2^53, -1] except -2^53
+ return top11Bits === -1 && !(this.low === 0 && this.high === -0x200000);
+};
+
+/**
+ * Tests if this Long's value equals zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isZero = function isZero() {
+ return this.high === 0 && this.low === 0;
+};
+
+/**
+ * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
+ * @returns {boolean}
+ */
+LongPrototype.eqz = LongPrototype.isZero;
+
+/**
+ * Tests if this Long's value is negative.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isNegative = function isNegative() {
+ return !this.unsigned && this.high < 0;
+};
+
+/**
+ * Tests if this Long's value is positive or zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isPositive = function isPositive() {
+ return this.unsigned || this.high >= 0;
+};
+
+/**
+ * Tests if this Long's value is odd.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isOdd = function isOdd() {
+ return (this.low & 1) === 1;
+};
+
+/**
+ * Tests if this Long's value is even.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+LongPrototype.isEven = function isEven() {
+ return (this.low & 1) === 0;
+};
+
+/**
+ * Tests if this Long's value equals the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.equals = function equals(other) {
+ if (!isLong(other)) other = fromValue(other);
+ if (
+ this.unsigned !== other.unsigned &&
+ this.high >>> 31 === 1 &&
+ other.high >>> 31 === 1
+ )
+ return false;
+ return this.high === other.high && this.low === other.low;
+};
+
+/**
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.eq = LongPrototype.equals;
+
+/**
+ * Tests if this Long's value differs from the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.notEquals = function notEquals(other) {
+ return !this.eq(/* validates */ other);
+};
+
+/**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.neq = LongPrototype.notEquals;
+
+/**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.ne = LongPrototype.notEquals;
+
+/**
+ * Tests if this Long's value is less than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lessThan = function lessThan(other) {
+ return this.comp(/* validates */ other) < 0;
+};
+
+/**
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lt = LongPrototype.lessThan;
+
+/**
+ * Tests if this Long's value is less than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
+ return this.comp(/* validates */ other) <= 0;
+};
+
+/**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.lte = LongPrototype.lessThanOrEqual;
+
+/**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.le = LongPrototype.lessThanOrEqual;
+
+/**
+ * Tests if this Long's value is greater than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.greaterThan = function greaterThan(other) {
+ return this.comp(/* validates */ other) > 0;
+};
+
+/**
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.gt = LongPrototype.greaterThan;
+
+/**
+ * Tests if this Long's value is greater than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
+ return this.comp(/* validates */ other) >= 0;
+};
+
+/**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.gte = LongPrototype.greaterThanOrEqual;
+
+/**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+LongPrototype.ge = LongPrototype.greaterThanOrEqual;
+
+/**
+ * Compares this Long's value with the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+LongPrototype.compare = function compare(other) {
+ if (!isLong(other)) other = fromValue(other);
+ if (this.eq(other)) return 0;
+ var thisNeg = this.isNegative(),
+ otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg) return -1;
+ if (!thisNeg && otherNeg) return 1;
+ // At this point the sign bits are the same
+ if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1;
+ // Both are positive if at least one is unsigned
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+};
+
+/**
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+LongPrototype.comp = LongPrototype.compare;
+
+/**
+ * Negates this Long's value.
+ * @this {!Long}
+ * @returns {!Long} Negated Long
+ */
+LongPrototype.negate = function negate() {
+ if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
+ return this.not().add(ONE);
+};
+
+/**
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
+ * @function
+ * @returns {!Long} Negated Long
+ */
+LongPrototype.neg = LongPrototype.negate;
+
+/**
+ * Returns the sum of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} addend Addend
+ * @returns {!Long} Sum
+ */
+LongPrototype.add = function add(addend) {
+ if (!isLong(addend)) addend = fromValue(addend);
+
+ // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xffff;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xffff;
+
+ var b48 = addend.high >>> 16;
+ var b32 = addend.high & 0xffff;
+ var b16 = addend.low >>> 16;
+ var b00 = addend.low & 0xffff;
+
+ var c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+};
+
+/**
+ * Returns the difference of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+LongPrototype.subtract = function subtract(subtrahend) {
+ if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+};
+
+/**
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
+ * @function
+ * @param {!Long|number|bigint|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+LongPrototype.sub = LongPrototype.subtract;
+
+/**
+ * Returns the product of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+LongPrototype.multiply = function multiply(multiplier) {
+ if (this.isZero()) return this;
+ if (!isLong(multiplier)) multiplier = fromValue(multiplier);
+
+ // use wasm support if present
+ if (wasm) {
+ var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
+ if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
+ if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
+
+ if (this.isNegative()) {
+ if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());
+ else return this.neg().mul(multiplier).neg();
+ } else if (multiplier.isNegative()) return this.mul(multiplier.neg()).neg();
+
+ // If both longs are small, use float multiplication
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
+ return fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
+
+ // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
+ // We can skip products that would overflow.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xffff;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xffff;
+
+ var b48 = multiplier.high >>> 16;
+ var b32 = multiplier.high & 0xffff;
+ var b16 = multiplier.low >>> 16;
+ var b00 = multiplier.low & 0xffff;
+
+ var c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+};
+
+/**
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
+ * @function
+ * @param {!Long|number|bigint|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+LongPrototype.mul = LongPrototype.multiply;
+
+/**
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
+ * unsigned if this Long is unsigned.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+LongPrototype.divide = function divide(divisor) {
+ if (!isLong(divisor)) divisor = fromValue(divisor);
+ if (divisor.isZero()) throw Error("division by zero");
+
+ // use wasm support if present
+ if (wasm) {
+ // guard against signed division overflow: the largest
+ // negative number / -1 would be 1 larger than the largest
+ // positive number, due to two's complement.
+ if (
+ !this.unsigned &&
+ this.high === -0x80000000 &&
+ divisor.low === -1 &&
+ divisor.high === -1
+ ) {
+ // be consistent with non-wasm code path
+ return this;
+ }
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high,
+ );
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ if (this.isZero()) return this.unsigned ? UZERO : ZERO;
+ var approx, rem, res;
+ if (!this.unsigned) {
+ // This section is only relevant for signed longs and is derived from the
+ // closure library as a whole.
+ if (this.eq(MIN_VALUE)) {
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
+ return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
+ else if (divisor.eq(MIN_VALUE)) return ONE;
+ else {
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
+ var halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(ZERO)) {
+ return divisor.isNegative() ? ONE : NEG_ONE;
+ } else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative()) return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ } else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
+ res = ZERO;
+ } else {
+ // The algorithm below has not been made for unsigned longs. It's therefore
+ // required to take special care of the MSB prior to running it.
+ if (!divisor.unsigned) divisor = divisor.toUnsigned();
+ if (divisor.gt(this)) return UZERO;
+ if (divisor.gt(this.shru(1)))
+ // 15 >>> 1 = 7 ; with divisor = 8 ; true
+ return UONE;
+ res = UZERO;
+ }
+
+ // Repeat the following until the remainder is less than other: find a
+ // floating-point that approximates remainder / other *from below*, add this
+ // into the result, and subtract it from the remainder. It is critical that
+ // the approximate value is less than or equal to the real value so that the
+ // remainder never becomes negative.
+ rem = this;
+ while (rem.gte(divisor)) {
+ // Approximate the result of division. This may be a little greater or
+ // smaller than the actual value.
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+
+ // We will tweak the approximate result by changing it in the 48-th digit or
+ // the smallest non-fractional digit, whichever is larger.
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2),
+ delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48),
+ // Decrease the approximation until it is smaller than the remainder. Note
+ // that if it is too large, the product overflows and is negative.
+ approxRes = fromNumber(approx),
+ approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+
+ // We know the answer can't be zero... and actually, zero would cause
+ // infinite recursion since we would make no progress.
+ if (approxRes.isZero()) approxRes = ONE;
+
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+};
+
+/**
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
+ * @function
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+LongPrototype.div = LongPrototype.divide;
+
+/**
+ * Returns this Long modulo the specified.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+LongPrototype.modulo = function modulo(divisor) {
+ if (!isLong(divisor)) divisor = fromValue(divisor);
+
+ // use wasm support if present
+ if (wasm) {
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high,
+ );
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+
+ return this.sub(this.div(divisor).mul(divisor));
+};
+
+/**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+LongPrototype.mod = LongPrototype.modulo;
+
+/**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+LongPrototype.rem = LongPrototype.modulo;
+
+/**
+ * Returns the bitwise NOT of this Long.
+ * @this {!Long}
+ * @returns {!Long}
+ */
+LongPrototype.not = function not() {
+ return fromBits(~this.low, ~this.high, this.unsigned);
+};
+
+/**
+ * Returns count leading zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+LongPrototype.countLeadingZeros = function countLeadingZeros() {
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
+};
+
+/**
+ * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+LongPrototype.clz = LongPrototype.countLeadingZeros;
+
+/**
+ * Returns count trailing zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+LongPrototype.countTrailingZeros = function countTrailingZeros() {
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
+};
+
+/**
+ * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+LongPrototype.ctz = LongPrototype.countTrailingZeros;
+
+/**
+ * Returns the bitwise AND of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other Long
+ * @returns {!Long}
+ */
+LongPrototype.and = function and(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
+};
+
+/**
+ * Returns the bitwise OR of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other Long
+ * @returns {!Long}
+ */
+LongPrototype.or = function or(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
+};
+
+/**
+ * Returns the bitwise XOR of this Long and the given one.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other Long
+ * @returns {!Long}
+ */
+LongPrototype.xor = function xor(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
+};
+
+/**
+ * Returns this Long with bits shifted to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shiftLeft = function shiftLeft(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ else if (numBits < 32)
+ return fromBits(
+ this.low << numBits,
+ (this.high << numBits) | (this.low >>> (32 - numBits)),
+ this.unsigned,
+ );
+ else return fromBits(0, this.low << (numBits - 32), this.unsigned);
+};
+
+/**
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shl = LongPrototype.shiftLeft;
+
+/**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shiftRight = function shiftRight(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ else if (numBits < 32)
+ return fromBits(
+ (this.low >>> numBits) | (this.high << (32 - numBits)),
+ this.high >> numBits,
+ this.unsigned,
+ );
+ else
+ return fromBits(
+ this.high >> (numBits - 32),
+ this.high >= 0 ? 0 : -1,
+ this.unsigned,
+ );
+};
+
+/**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shr = LongPrototype.shiftRight;
+
+/**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits < 32)
+ return fromBits(
+ (this.low >>> numBits) | (this.high << (32 - numBits)),
+ this.high >>> numBits,
+ this.unsigned,
+ );
+ if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
+ return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);
+};
+
+/**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shru = LongPrototype.shiftRightUnsigned;
+
+/**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
+
+/**
+ * Returns this Long with bits rotated to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotateLeft = function rotateLeft(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+ if (numBits < 32) {
+ b = 32 - numBits;
+ return fromBits(
+ (this.low << numBits) | (this.high >>> b),
+ (this.high << numBits) | (this.low >>> b),
+ this.unsigned,
+ );
+ }
+ numBits -= 32;
+ b = 32 - numBits;
+ return fromBits(
+ (this.high << numBits) | (this.low >>> b),
+ (this.low << numBits) | (this.high >>> b),
+ this.unsigned,
+ );
+};
+/**
+ * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotl = LongPrototype.rotateLeft;
+
+/**
+ * Returns this Long with bits rotated to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotateRight = function rotateRight(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+ if (numBits < 32) {
+ b = 32 - numBits;
+ return fromBits(
+ (this.high << b) | (this.low >>> numBits),
+ (this.low << b) | (this.high >>> numBits),
+ this.unsigned,
+ );
+ }
+ numBits -= 32;
+ b = 32 - numBits;
+ return fromBits(
+ (this.low << b) | (this.high >>> numBits),
+ (this.high << b) | (this.low >>> numBits),
+ this.unsigned,
+ );
+};
+/**
+ * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+LongPrototype.rotr = LongPrototype.rotateRight;
+
+/**
+ * Converts this Long to signed.
+ * @this {!Long}
+ * @returns {!Long} Signed long
+ */
+LongPrototype.toSigned = function toSigned() {
+ if (!this.unsigned) return this;
+ return fromBits(this.low, this.high, false);
+};
+
+/**
+ * Converts this Long to unsigned.
+ * @this {!Long}
+ * @returns {!Long} Unsigned long
+ */
+LongPrototype.toUnsigned = function toUnsigned() {
+ if (this.unsigned) return this;
+ return fromBits(this.low, this.high, true);
+};
+
+/**
+ * Converts this Long to its byte representation.
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @this {!Long}
+ * @returns {!Array.} Byte representation
+ */
+LongPrototype.toBytes = function toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+};
+
+/**
+ * Converts this Long to its little endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Little endian byte representation
+ */
+LongPrototype.toBytesLE = function toBytesLE() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24,
+ ];
+};
+
+/**
+ * Converts this Long to its big endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Big endian byte representation
+ */
+LongPrototype.toBytesBE = function toBytesBE() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff,
+ ];
+};
+
+/**
+ * Creates a Long from its byte representation.
+ * @param {!Array.} bytes Byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @returns {Long} The corresponding Long value
+ */
+Long.fromBytes = function fromBytes(bytes, unsigned, le) {
+ return le
+ ? Long.fromBytesLE(bytes, unsigned)
+ : Long.fromBytesBE(bytes, unsigned);
+};
+
+/**
+ * Creates a Long from its little endian byte representation.
+ * @param {!Array.} bytes Little endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
+ return new Long(
+ bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24),
+ bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24),
+ unsigned,
+ );
+};
+
+/**
+ * Creates a Long from its big endian byte representation.
+ * @param {!Array.} bytes Big endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
+ return new Long(
+ (bytes[4] << 24) | (bytes[5] << 16) | (bytes[6] << 8) | bytes[7],
+ (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3],
+ unsigned,
+ );
+};
+
+// Support conversion to/from BigInt where available
+if (typeof BigInt === "function") {
+ /**
+ * Returns a Long representing the given big integer.
+ * @function
+ * @param {number} value The big integer value
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromBigInt = function fromBigInt(value, unsigned) {
+ var lowBits = Number(BigInt.asIntN(32, value));
+ var highBits = Number(BigInt.asIntN(32, value >> BigInt(32)));
+ return fromBits(lowBits, highBits, unsigned);
+ };
+
+ // Override
+ Long.fromValue = function fromValueWithBigInt(value, unsigned) {
+ if (typeof value === "bigint") return fromBigInt(value, unsigned);
+ return fromValue(value, unsigned);
+ };
+
+ /**
+ * Converts the Long to its big integer representation.
+ * @this {!Long}
+ * @returns {bigint}
+ */
+ LongPrototype.toBigInt = function toBigInt() {
+ var lowBigInt = BigInt(this.low >>> 0);
+ var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high);
+ return (highBigInt << BigInt(32)) | lowBigInt;
+ };
+}
+
+export default Long;
diff --git a/EmployeeManagementBackend/node_modules/long/package.json b/EmployeeManagementBackend/node_modules/long/package.json
new file mode 100644
index 0000000..ab590cb
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/package.json
@@ -0,0 +1,58 @@
+{
+ "name": "long",
+ "version": "5.3.1",
+ "author": "Daniel Wirtz ",
+ "description": "A Long class for representing a 64-bit two's-complement integer value.",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/dcodeIO/long.js.git"
+ },
+ "bugs": {
+ "url": "https://github.com/dcodeIO/long.js/issues"
+ },
+ "keywords": [
+ "math",
+ "long",
+ "int64"
+ ],
+ "license": "Apache-2.0",
+ "type": "module",
+ "main": "umd/index.js",
+ "types": "umd/index.d.ts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./index.js"
+ },
+ "require": {
+ "types": "./umd/index.d.ts",
+ "default": "./umd/index.js"
+ }
+ }
+ },
+ "scripts": {
+ "build": "node scripts/build.js",
+ "lint": "prettier --check .",
+ "format": "prettier --write .",
+ "test": "npm run test:unit && npm run test:typescript",
+ "test:unit": "node tests",
+ "test:typescript": "tsc --project tests/typescript/tsconfig.esnext.json && tsc --project tests/typescript/tsconfig.nodenext.json && tsc --project tests/typescript/tsconfig.commonjs.json && tsc --project tests/typescript/tsconfig.global.json"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts",
+ "types.d.ts",
+ "umd/index.js",
+ "umd/index.d.ts",
+ "umd/types.d.ts",
+ "umd/package.json",
+ "LICENSE",
+ "README.md"
+ ],
+ "devDependencies": {
+ "esm2umd": "^0.3.0",
+ "prettier": "^3.5.0",
+ "typescript": "^5.7.3"
+ }
+}
diff --git a/EmployeeManagementBackend/node_modules/long/types.d.ts b/EmployeeManagementBackend/node_modules/long/types.d.ts
new file mode 100644
index 0000000..7693ca4
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/types.d.ts
@@ -0,0 +1,474 @@
+// Common type definitions for both the ESM and UMD variants. The ESM variant
+// reexports the Long class as its default export, whereas the UMD variant makes
+// the Long class a whole-module export with a global variable fallback.
+
+type LongLike =
+ | Long
+ | number
+ | bigint
+ | string
+ | { low: number; high: number; unsigned: boolean };
+
+export declare class Long {
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
+ */
+ constructor(low: number, high?: number, unsigned?: boolean);
+
+ /**
+ * Maximum unsigned value.
+ */
+ static MAX_UNSIGNED_VALUE: Long;
+
+ /**
+ * Maximum signed value.
+ */
+ static MAX_VALUE: Long;
+
+ /**
+ * Minimum signed value.
+ */
+ static MIN_VALUE: Long;
+
+ /**
+ * Signed negative one.
+ */
+ static NEG_ONE: Long;
+
+ /**
+ * Signed one.
+ */
+ static ONE: Long;
+
+ /**
+ * Unsigned one.
+ */
+ static UONE: Long;
+
+ /**
+ * Unsigned zero.
+ */
+ static UZERO: Long;
+
+ /**
+ * Signed zero
+ */
+ static ZERO: Long;
+
+ /**
+ * The high 32 bits as a signed value.
+ */
+ high: number;
+
+ /**
+ * The low 32 bits as a signed value.
+ */
+ low: number;
+
+ /**
+ * Whether unsigned or not.
+ */
+ unsigned: boolean;
+
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
+ */
+ static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ */
+ static fromInt(value: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ */
+ static fromNumber(value: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given big integer value.
+ */
+ static fromBigInt(value: bigint, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ */
+ static fromString(
+ str: string,
+ unsigned?: boolean | number,
+ radix?: number,
+ ): Long;
+
+ /**
+ * Creates a Long from its byte representation.
+ */
+ static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
+
+ /**
+ * Creates a Long from its little endian byte representation.
+ */
+ static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
+
+ /**
+ * Creates a Long from its big endian byte representation.
+ */
+ static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
+
+ /**
+ * Tests if the specified object is a Long.
+ */
+ static isLong(obj: any): obj is Long;
+
+ /**
+ * Converts the specified value to a Long.
+ */
+ static fromValue(val: LongLike, unsigned?: boolean): Long;
+
+ /**
+ * Returns the sum of this and the specified Long.
+ */
+ add(addend: LongLike): Long;
+
+ /**
+ * Returns the bitwise AND of this Long and the specified.
+ */
+ and(other: LongLike): Long;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ compare(other: LongLike): number;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ comp(other: LongLike): number;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ divide(divisor: LongLike): Long;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ div(divisor: LongLike): Long;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ equals(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ eq(other: LongLike): boolean;
+
+ /**
+ * Gets the high 32 bits as a signed integer.
+ */
+ getHighBits(): number;
+
+ /**
+ * Gets the high 32 bits as an unsigned integer.
+ */
+ getHighBitsUnsigned(): number;
+
+ /**
+ * Gets the low 32 bits as a signed integer.
+ */
+ getLowBits(): number;
+
+ /**
+ * Gets the low 32 bits as an unsigned integer.
+ */
+ getLowBitsUnsigned(): number;
+
+ /**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ */
+ getNumBitsAbs(): number;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ greaterThan(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ gt(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ greaterThanOrEqual(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ gte(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ ge(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is even.
+ */
+ isEven(): boolean;
+
+ /**
+ * Tests if this Long's value is negative.
+ */
+ isNegative(): boolean;
+
+ /**
+ * Tests if this Long's value is odd.
+ */
+ isOdd(): boolean;
+
+ /**
+ * Tests if this Long's value is positive or zero.
+ */
+ isPositive(): boolean;
+
+ /**
+ * Tests if this Long can be safely represented as a JavaScript number.
+ */
+ isSafeInteger(): boolean;
+
+ /**
+ * Tests if this Long's value equals zero.
+ */
+ isZero(): boolean;
+
+ /**
+ * Tests if this Long's value equals zero.
+ */
+ eqz(): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lessThan(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lt(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lessThanOrEqual(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lte(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ le(other: LongLike): boolean;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ modulo(other: LongLike): Long;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ mod(other: LongLike): Long;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ rem(other: LongLike): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ multiply(multiplier: LongLike): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ mul(multiplier: LongLike): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ negate(): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ neg(): Long;
+
+ /**
+ * Returns the bitwise NOT of this Long.
+ */
+ not(): Long;
+
+ /**
+ * Returns count leading zeros of this Long.
+ */
+ countLeadingZeros(): number;
+
+ /**
+ * Returns count leading zeros of this Long.
+ */
+ clz(): number;
+
+ /**
+ * Returns count trailing zeros of this Long.
+ */
+ countTrailingZeros(): number;
+
+ /**
+ * Returns count trailing zeros of this Long.
+ */
+ ctz(): number;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ notEquals(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ neq(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ ne(other: LongLike): boolean;
+
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ */
+ or(other: LongLike): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shiftLeft(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shl(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shiftRight(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shr(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shiftRightUnsigned(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shru(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shr_u(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ */
+ rotateLeft(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ */
+ rotl(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ */
+ rotateRight(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ */
+ rotr(numBits: number | Long): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ subtract(subtrahend: LongLike): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ sub(subtrahend: LongLike): Long;
+
+ /**
+ * Converts the Long to a big integer.
+ */
+ toBigInt(): bigint;
+
+ /**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ */
+ toInt(): number;
+
+ /**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ */
+ toNumber(): number;
+
+ /**
+ * Converts this Long to its byte representation.
+ */
+
+ toBytes(le?: boolean): number[];
+
+ /**
+ * Converts this Long to its little endian byte representation.
+ */
+
+ toBytesLE(): number[];
+
+ /**
+ * Converts this Long to its big endian byte representation.
+ */
+
+ toBytesBE(): number[];
+
+ /**
+ * Converts this Long to signed.
+ */
+ toSigned(): Long;
+
+ /**
+ * Converts the Long to a string written in the specified radix.
+ */
+ toString(radix?: number): string;
+
+ /**
+ * Converts this Long to unsigned.
+ */
+ toUnsigned(): Long;
+
+ /**
+ * Returns the bitwise XOR of this Long and the given one.
+ */
+ xor(other: LongLike): Long;
+}
diff --git a/EmployeeManagementBackend/node_modules/long/umd/index.d.ts b/EmployeeManagementBackend/node_modules/long/umd/index.d.ts
new file mode 100644
index 0000000..5036689
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/umd/index.d.ts
@@ -0,0 +1,3 @@
+import { Long } from "./types.js";
+export = Long;
+export as namespace Long;
diff --git a/EmployeeManagementBackend/node_modules/long/umd/index.js b/EmployeeManagementBackend/node_modules/long/umd/index.js
new file mode 100644
index 0000000..8351d62
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/umd/index.js
@@ -0,0 +1,1622 @@
+// GENERATED FILE. DO NOT EDIT.
+(function (global, factory) {
+ function unwrapDefault(exports) {
+ return "default" in exports ? exports.default : exports;
+ }
+ if (typeof define === "function" && define.amd) {
+ define([], function () {
+ var exports = {};
+ factory(exports);
+ return unwrapDefault(exports);
+ });
+ } else if (typeof exports === "object") {
+ factory(exports);
+ if (typeof module === "object") module.exports = unwrapDefault(exports);
+ } else {
+ (function () {
+ var exports = {};
+ factory(exports);
+ global.Long = unwrapDefault(exports);
+ })();
+ }
+})(
+ typeof globalThis !== "undefined"
+ ? globalThis
+ : typeof self !== "undefined"
+ ? self
+ : this,
+ function (_exports) {
+ "use strict";
+
+ Object.defineProperty(_exports, "__esModule", {
+ value: true,
+ });
+ _exports.default = void 0;
+ /**
+ * @license
+ * Copyright 2009 The Closure Library Authors
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+ // WebAssembly optimizations to do native i64 multiplication and divide
+ var wasm = null;
+ try {
+ wasm = new WebAssembly.Instance(
+ new WebAssembly.Module(
+ new Uint8Array([
+ // \0asm
+ 0, 97, 115, 109,
+ // version 1
+ 1, 0, 0, 0,
+ // section "type"
+ 1, 13, 2,
+ // 0, () => i32
+ 96, 0, 1, 127,
+ // 1, (i32, i32, i32, i32) => i32
+ 96, 4, 127, 127, 127, 127, 1, 127,
+ // section "function"
+ 3, 7, 6,
+ // 0, type 0
+ 0,
+ // 1, type 1
+ 1,
+ // 2, type 1
+ 1,
+ // 3, type 1
+ 1,
+ // 4, type 1
+ 1,
+ // 5, type 1
+ 1,
+ // section "global"
+ 6, 6, 1,
+ // 0, "high", mutable i32
+ 127, 1, 65, 0, 11,
+ // section "export"
+ 7, 50, 6,
+ // 0, "mul"
+ 3, 109, 117, 108, 0, 1,
+ // 1, "div_s"
+ 5, 100, 105, 118, 95, 115, 0, 2,
+ // 2, "div_u"
+ 5, 100, 105, 118, 95, 117, 0, 3,
+ // 3, "rem_s"
+ 5, 114, 101, 109, 95, 115, 0, 4,
+ // 4, "rem_u"
+ 5, 114, 101, 109, 95, 117, 0, 5,
+ // 5, "get_high"
+ 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0,
+ // section "code"
+ 10, 191, 1, 6,
+ // 0, "get_high"
+ 4, 0, 35, 0, 11,
+ // 1, "mul"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
+ 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0,
+ 32, 4, 167, 11,
+ // 2, "div_s"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
+ 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0,
+ 32, 4, 167, 11,
+ // 3, "div_u"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
+ 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0,
+ 32, 4, 167, 11,
+ // 4, "rem_s"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
+ 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0,
+ 32, 4, 167, 11,
+ // 5, "rem_u"
+ 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173,
+ 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0,
+ 32, 4, 167, 11,
+ ]),
+ ),
+ {},
+ ).exports;
+ } catch {
+ // no wasm support :(
+ }
+
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
+ * See the from* functions below for more convenient ways of constructing Longs.
+ * @exports Long
+ * @class A Long class for representing a 64 bit two's-complement integer value.
+ * @param {number} low The low (signed) 32 bits of the long
+ * @param {number} high The high (signed) 32 bits of the long
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @constructor
+ */
+ function Long(low, high, unsigned) {
+ /**
+ * The low 32 bits as a signed value.
+ * @type {number}
+ */
+ this.low = low | 0;
+
+ /**
+ * The high 32 bits as a signed value.
+ * @type {number}
+ */
+ this.high = high | 0;
+
+ /**
+ * Whether unsigned or not.
+ * @type {boolean}
+ */
+ this.unsigned = !!unsigned;
+ }
+
+ // The internal representation of a long is the two given signed, 32-bit values.
+ // We use 32-bit pieces because these are the size of integers on which
+ // Javascript performs bit-operations. For operations like addition and
+ // multiplication, we split each number into 16 bit pieces, which can easily be
+ // multiplied within Javascript's floating-point representation without overflow
+ // or change in sign.
+ //
+ // In the algorithms below, we frequently reduce the negative case to the
+ // positive case by negating the input(s) and then post-processing the result.
+ // Note that we must ALWAYS check specially whether those values are MIN_VALUE
+ // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
+ // a positive number, it overflows back into a negative). Not handling this
+ // case would often result in infinite recursion.
+ //
+ // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
+ // methods on which they depend.
+
+ /**
+ * An indicator used to reliably determine if an object is a Long or not.
+ * @type {boolean}
+ * @const
+ * @private
+ */
+ Long.prototype.__isLong__;
+ Object.defineProperty(Long.prototype, "__isLong__", {
+ value: true,
+ });
+
+ /**
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ * @inner
+ */
+ function isLong(obj) {
+ return (obj && obj["__isLong__"]) === true;
+ }
+
+ /**
+ * @function
+ * @param {*} value number
+ * @returns {number}
+ * @inner
+ */
+ function ctz32(value) {
+ var c = Math.clz32(value & -value);
+ return value ? 31 - c : c;
+ }
+
+ /**
+ * Tests if the specified object is a Long.
+ * @function
+ * @param {*} obj Object
+ * @returns {boolean}
+ */
+ Long.isLong = isLong;
+
+ /**
+ * A cache of the Long representations of small integer values.
+ * @type {!Object}
+ * @inner
+ */
+ var INT_CACHE = {};
+
+ /**
+ * A cache of the Long representations of small unsigned integer values.
+ * @type {!Object}
+ * @inner
+ */
+ var UINT_CACHE = {};
+
+ /**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+ function fromInt(value, unsigned) {
+ var obj, cachedObj, cache;
+ if (unsigned) {
+ value >>>= 0;
+ if ((cache = 0 <= value && value < 256)) {
+ cachedObj = UINT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+ obj = fromBits(value, 0, true);
+ if (cache) UINT_CACHE[value] = obj;
+ return obj;
+ } else {
+ value |= 0;
+ if ((cache = -128 <= value && value < 128)) {
+ cachedObj = INT_CACHE[value];
+ if (cachedObj) return cachedObj;
+ }
+ obj = fromBits(value, value < 0 ? -1 : 0, false);
+ if (cache) INT_CACHE[value] = obj;
+ return obj;
+ }
+ }
+
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ * @function
+ * @param {number} value The 32 bit integer in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromInt = fromInt;
+
+ /**
+ * @param {number} value
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+ function fromNumber(value, unsigned) {
+ if (isNaN(value)) return unsigned ? UZERO : ZERO;
+ if (unsigned) {
+ if (value < 0) return UZERO;
+ if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE;
+ } else {
+ if (value <= -TWO_PWR_63_DBL) return MIN_VALUE;
+ if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE;
+ }
+ if (value < 0) return fromNumber(-value, unsigned).neg();
+ return fromBits(
+ value % TWO_PWR_32_DBL | 0,
+ (value / TWO_PWR_32_DBL) | 0,
+ unsigned,
+ );
+ }
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ * @function
+ * @param {number} value The number in question
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromNumber = fromNumber;
+
+ /**
+ * @param {number} lowBits
+ * @param {number} highBits
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+ function fromBits(lowBits, highBits, unsigned) {
+ return new Long(lowBits, highBits, unsigned);
+ }
+
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
+ * assumed to use 32 bits.
+ * @function
+ * @param {number} lowBits The low 32 bits
+ * @param {number} highBits The high 32 bits
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromBits = fromBits;
+
+ /**
+ * @function
+ * @param {number} base
+ * @param {number} exponent
+ * @returns {number}
+ * @inner
+ */
+ var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
+
+ /**
+ * @param {string} str
+ * @param {(boolean|number)=} unsigned
+ * @param {number=} radix
+ * @returns {!Long}
+ * @inner
+ */
+ function fromString(str, unsigned, radix) {
+ if (str.length === 0) throw Error("empty string");
+ if (typeof unsigned === "number") {
+ // For goog.math.long compatibility
+ radix = unsigned;
+ unsigned = false;
+ } else {
+ unsigned = !!unsigned;
+ }
+ if (
+ str === "NaN" ||
+ str === "Infinity" ||
+ str === "+Infinity" ||
+ str === "-Infinity"
+ )
+ return unsigned ? UZERO : ZERO;
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix) throw RangeError("radix");
+ var p;
+ if ((p = str.indexOf("-")) > 0) throw Error("interior hyphen");
+ else if (p === 0) {
+ return fromString(str.substring(1), unsigned, radix).neg();
+ }
+
+ // Do several (8) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 8));
+ var result = ZERO;
+ for (var i = 0; i < str.length; i += 8) {
+ var size = Math.min(8, str.length - i),
+ value = parseInt(str.substring(i, i + size), radix);
+ if (size < 8) {
+ var power = fromNumber(pow_dbl(radix, size));
+ result = result.mul(power).add(fromNumber(value));
+ } else {
+ result = result.mul(radixToPower);
+ result = result.add(fromNumber(value));
+ }
+ }
+ result.unsigned = unsigned;
+ return result;
+ }
+
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ * @function
+ * @param {string} str The textual representation of the Long
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromString = fromString;
+
+ /**
+ * @function
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
+ * @param {boolean=} unsigned
+ * @returns {!Long}
+ * @inner
+ */
+ function fromValue(val, unsigned) {
+ if (typeof val === "number") return fromNumber(val, unsigned);
+ if (typeof val === "string") return fromString(val, unsigned);
+ // Throws for non-objects, converts non-instanceof Long:
+ return fromBits(
+ val.low,
+ val.high,
+ typeof unsigned === "boolean" ? unsigned : val.unsigned,
+ );
+ }
+
+ /**
+ * Converts the specified value to a Long using the appropriate from* function for its type.
+ * @function
+ * @param {!Long|number|bigint|string|!{low: number, high: number, unsigned: boolean}} val Value
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long}
+ */
+ Long.fromValue = fromValue;
+
+ // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
+ // no runtime penalty for these.
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_16_DBL = 1 << 16;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_24_DBL = 1 << 24;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
+
+ /**
+ * @type {number}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
+
+ /**
+ * @type {!Long}
+ * @const
+ * @inner
+ */
+ var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var ZERO = fromInt(0);
+
+ /**
+ * Signed zero.
+ * @type {!Long}
+ */
+ Long.ZERO = ZERO;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var UZERO = fromInt(0, true);
+
+ /**
+ * Unsigned zero.
+ * @type {!Long}
+ */
+ Long.UZERO = UZERO;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var ONE = fromInt(1);
+
+ /**
+ * Signed one.
+ * @type {!Long}
+ */
+ Long.ONE = ONE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var UONE = fromInt(1, true);
+
+ /**
+ * Unsigned one.
+ * @type {!Long}
+ */
+ Long.UONE = UONE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var NEG_ONE = fromInt(-1);
+
+ /**
+ * Signed negative one.
+ * @type {!Long}
+ */
+ Long.NEG_ONE = NEG_ONE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var MAX_VALUE = fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
+
+ /**
+ * Maximum signed value.
+ * @type {!Long}
+ */
+ Long.MAX_VALUE = MAX_VALUE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var MAX_UNSIGNED_VALUE = fromBits(0xffffffff | 0, 0xffffffff | 0, true);
+
+ /**
+ * Maximum unsigned value.
+ * @type {!Long}
+ */
+ Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
+
+ /**
+ * @type {!Long}
+ * @inner
+ */
+ var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
+
+ /**
+ * Minimum signed value.
+ * @type {!Long}
+ */
+ Long.MIN_VALUE = MIN_VALUE;
+
+ /**
+ * @alias Long.prototype
+ * @inner
+ */
+ var LongPrototype = Long.prototype;
+
+ /**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ * @this {!Long}
+ * @returns {number}
+ */
+ LongPrototype.toInt = function toInt() {
+ return this.unsigned ? this.low >>> 0 : this.low;
+ };
+
+ /**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ * @this {!Long}
+ * @returns {number}
+ */
+ LongPrototype.toNumber = function toNumber() {
+ if (this.unsigned)
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
+ };
+
+ /**
+ * Converts the Long to a string written in the specified radix.
+ * @this {!Long}
+ * @param {number=} radix Radix (2-36), defaults to 10
+ * @returns {string}
+ * @override
+ * @throws {RangeError} If `radix` is out of range
+ */
+ LongPrototype.toString = function toString(radix) {
+ radix = radix || 10;
+ if (radix < 2 || 36 < radix) throw RangeError("radix");
+ if (this.isZero()) return "0";
+ if (this.isNegative()) {
+ // Unsigned Longs are never negative
+ if (this.eq(MIN_VALUE)) {
+ // We need to change the Long value before it can be negated, so we remove
+ // the bottom-most digit in this base and then recurse to do the rest.
+ var radixLong = fromNumber(radix),
+ div = this.div(radixLong),
+ rem1 = div.mul(radixLong).sub(this);
+ return div.toString(radix) + rem1.toInt().toString(radix);
+ } else return "-" + this.neg().toString(radix);
+ }
+
+ // Do several (6) digits each time through the loop, so as to
+ // minimize the calls to the very expensive emulated div.
+ var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned),
+ rem = this;
+ var result = "";
+ while (true) {
+ var remDiv = rem.div(radixToPower),
+ intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0,
+ digits = intval.toString(radix);
+ rem = remDiv;
+ if (rem.isZero()) return digits + result;
+ else {
+ while (digits.length < 6) digits = "0" + digits;
+ result = "" + digits + result;
+ }
+ }
+ };
+
+ /**
+ * Gets the high 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed high bits
+ */
+ LongPrototype.getHighBits = function getHighBits() {
+ return this.high;
+ };
+
+ /**
+ * Gets the high 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned high bits
+ */
+ LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
+ return this.high >>> 0;
+ };
+
+ /**
+ * Gets the low 32 bits as a signed integer.
+ * @this {!Long}
+ * @returns {number} Signed low bits
+ */
+ LongPrototype.getLowBits = function getLowBits() {
+ return this.low;
+ };
+
+ /**
+ * Gets the low 32 bits as an unsigned integer.
+ * @this {!Long}
+ * @returns {number} Unsigned low bits
+ */
+ LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
+ return this.low >>> 0;
+ };
+
+ /**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ * @this {!Long}
+ * @returns {number}
+ */
+ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
+ if (this.isNegative())
+ // Unsigned Longs are never negative
+ return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
+ var val = this.high != 0 ? this.high : this.low;
+ for (var bit = 31; bit > 0; bit--) if ((val & (1 << bit)) != 0) break;
+ return this.high != 0 ? bit + 33 : bit + 1;
+ };
+
+ /**
+ * Tests if this Long can be safely represented as a JavaScript number.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+ LongPrototype.isSafeInteger = function isSafeInteger() {
+ // 2^53-1 is the maximum safe value
+ var top11Bits = this.high >> 21;
+ // [0, 2^53-1]
+ if (!top11Bits) return true;
+ // > 2^53-1
+ if (this.unsigned) return false;
+ // [-2^53, -1] except -2^53
+ return top11Bits === -1 && !(this.low === 0 && this.high === -0x200000);
+ };
+
+ /**
+ * Tests if this Long's value equals zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+ LongPrototype.isZero = function isZero() {
+ return this.high === 0 && this.low === 0;
+ };
+
+ /**
+ * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
+ * @returns {boolean}
+ */
+ LongPrototype.eqz = LongPrototype.isZero;
+
+ /**
+ * Tests if this Long's value is negative.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+ LongPrototype.isNegative = function isNegative() {
+ return !this.unsigned && this.high < 0;
+ };
+
+ /**
+ * Tests if this Long's value is positive or zero.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+ LongPrototype.isPositive = function isPositive() {
+ return this.unsigned || this.high >= 0;
+ };
+
+ /**
+ * Tests if this Long's value is odd.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+ LongPrototype.isOdd = function isOdd() {
+ return (this.low & 1) === 1;
+ };
+
+ /**
+ * Tests if this Long's value is even.
+ * @this {!Long}
+ * @returns {boolean}
+ */
+ LongPrototype.isEven = function isEven() {
+ return (this.low & 1) === 0;
+ };
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.equals = function equals(other) {
+ if (!isLong(other)) other = fromValue(other);
+ if (
+ this.unsigned !== other.unsigned &&
+ this.high >>> 31 === 1 &&
+ other.high >>> 31 === 1
+ )
+ return false;
+ return this.high === other.high && this.low === other.low;
+ };
+
+ /**
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.eq = LongPrototype.equals;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.notEquals = function notEquals(other) {
+ return !this.eq(/* validates */ other);
+ };
+
+ /**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.neq = LongPrototype.notEquals;
+
+ /**
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.ne = LongPrototype.notEquals;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lessThan = function lessThan(other) {
+ return this.comp(/* validates */ other) < 0;
+ };
+
+ /**
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lt = LongPrototype.lessThan;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
+ return this.comp(/* validates */ other) <= 0;
+ };
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.lte = LongPrototype.lessThanOrEqual;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.le = LongPrototype.lessThanOrEqual;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.greaterThan = function greaterThan(other) {
+ return this.comp(/* validates */ other) > 0;
+ };
+
+ /**
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.gt = LongPrototype.greaterThan;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
+ return this.comp(/* validates */ other) >= 0;
+ };
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.gte = LongPrototype.greaterThanOrEqual;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {boolean}
+ */
+ LongPrototype.ge = LongPrototype.greaterThanOrEqual;
+
+ /**
+ * Compares this Long's value with the specified's.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+ LongPrototype.compare = function compare(other) {
+ if (!isLong(other)) other = fromValue(other);
+ if (this.eq(other)) return 0;
+ var thisNeg = this.isNegative(),
+ otherNeg = other.isNegative();
+ if (thisNeg && !otherNeg) return -1;
+ if (!thisNeg && otherNeg) return 1;
+ // At this point the sign bits are the same
+ if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1;
+ // Both are positive if at least one is unsigned
+ return other.high >>> 0 > this.high >>> 0 ||
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
+ ? -1
+ : 1;
+ };
+
+ /**
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
+ * @function
+ * @param {!Long|number|bigint|string} other Other value
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
+ * if the given one is greater
+ */
+ LongPrototype.comp = LongPrototype.compare;
+
+ /**
+ * Negates this Long's value.
+ * @this {!Long}
+ * @returns {!Long} Negated Long
+ */
+ LongPrototype.negate = function negate() {
+ if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
+ return this.not().add(ONE);
+ };
+
+ /**
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
+ * @function
+ * @returns {!Long} Negated Long
+ */
+ LongPrototype.neg = LongPrototype.negate;
+
+ /**
+ * Returns the sum of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} addend Addend
+ * @returns {!Long} Sum
+ */
+ LongPrototype.add = function add(addend) {
+ if (!isLong(addend)) addend = fromValue(addend);
+
+ // Divide each number into 4 chunks of 16 bits, and then sum the chunks.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xffff;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xffff;
+ var b48 = addend.high >>> 16;
+ var b32 = addend.high & 0xffff;
+ var b16 = addend.low >>> 16;
+ var b00 = addend.low & 0xffff;
+ var c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 + b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 + b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 + b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 + b48;
+ c48 &= 0xffff;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ };
+
+ /**
+ * Returns the difference of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+ LongPrototype.subtract = function subtract(subtrahend) {
+ if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
+ return this.add(subtrahend.neg());
+ };
+
+ /**
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
+ * @function
+ * @param {!Long|number|bigint|string} subtrahend Subtrahend
+ * @returns {!Long} Difference
+ */
+ LongPrototype.sub = LongPrototype.subtract;
+
+ /**
+ * Returns the product of this and the specified Long.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+ LongPrototype.multiply = function multiply(multiplier) {
+ if (this.isZero()) return this;
+ if (!isLong(multiplier)) multiplier = fromValue(multiplier);
+
+ // use wasm support if present
+ if (wasm) {
+ var low = wasm["mul"](
+ this.low,
+ this.high,
+ multiplier.low,
+ multiplier.high,
+ );
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+ if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
+ if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
+ if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
+ if (this.isNegative()) {
+ if (multiplier.isNegative()) return this.neg().mul(multiplier.neg());
+ else return this.neg().mul(multiplier).neg();
+ } else if (multiplier.isNegative())
+ return this.mul(multiplier.neg()).neg();
+
+ // If both longs are small, use float multiplication
+ if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24))
+ return fromNumber(
+ this.toNumber() * multiplier.toNumber(),
+ this.unsigned,
+ );
+
+ // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.
+ // We can skip products that would overflow.
+
+ var a48 = this.high >>> 16;
+ var a32 = this.high & 0xffff;
+ var a16 = this.low >>> 16;
+ var a00 = this.low & 0xffff;
+ var b48 = multiplier.high >>> 16;
+ var b32 = multiplier.high & 0xffff;
+ var b16 = multiplier.low >>> 16;
+ var b00 = multiplier.low & 0xffff;
+ var c48 = 0,
+ c32 = 0,
+ c16 = 0,
+ c00 = 0;
+ c00 += a00 * b00;
+ c16 += c00 >>> 16;
+ c00 &= 0xffff;
+ c16 += a16 * b00;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c16 += a00 * b16;
+ c32 += c16 >>> 16;
+ c16 &= 0xffff;
+ c32 += a32 * b00;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a16 * b16;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c32 += a00 * b32;
+ c48 += c32 >>> 16;
+ c32 &= 0xffff;
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
+ c48 &= 0xffff;
+ return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
+ };
+
+ /**
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
+ * @function
+ * @param {!Long|number|bigint|string} multiplier Multiplier
+ * @returns {!Long} Product
+ */
+ LongPrototype.mul = LongPrototype.multiply;
+
+ /**
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
+ * unsigned if this Long is unsigned.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+ LongPrototype.divide = function divide(divisor) {
+ if (!isLong(divisor)) divisor = fromValue(divisor);
+ if (divisor.isZero()) throw Error("division by zero");
+
+ // use wasm support if present
+ if (wasm) {
+ // guard against signed division overflow: the largest
+ // negative number / -1 would be 1 larger than the largest
+ // positive number, due to two's complement.
+ if (
+ !this.unsigned &&
+ this.high === -0x80000000 &&
+ divisor.low === -1 &&
+ divisor.high === -1
+ ) {
+ // be consistent with non-wasm code path
+ return this;
+ }
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high,
+ );
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+ if (this.isZero()) return this.unsigned ? UZERO : ZERO;
+ var approx, rem, res;
+ if (!this.unsigned) {
+ // This section is only relevant for signed longs and is derived from the
+ // closure library as a whole.
+ if (this.eq(MIN_VALUE)) {
+ if (divisor.eq(ONE) || divisor.eq(NEG_ONE))
+ return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE
+ else if (divisor.eq(MIN_VALUE)) return ONE;
+ else {
+ // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.
+ var halfThis = this.shr(1);
+ approx = halfThis.div(divisor).shl(1);
+ if (approx.eq(ZERO)) {
+ return divisor.isNegative() ? ONE : NEG_ONE;
+ } else {
+ rem = this.sub(divisor.mul(approx));
+ res = approx.add(rem.div(divisor));
+ return res;
+ }
+ }
+ } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO;
+ if (this.isNegative()) {
+ if (divisor.isNegative()) return this.neg().div(divisor.neg());
+ return this.neg().div(divisor).neg();
+ } else if (divisor.isNegative()) return this.div(divisor.neg()).neg();
+ res = ZERO;
+ } else {
+ // The algorithm below has not been made for unsigned longs. It's therefore
+ // required to take special care of the MSB prior to running it.
+ if (!divisor.unsigned) divisor = divisor.toUnsigned();
+ if (divisor.gt(this)) return UZERO;
+ if (divisor.gt(this.shru(1)))
+ // 15 >>> 1 = 7 ; with divisor = 8 ; true
+ return UONE;
+ res = UZERO;
+ }
+
+ // Repeat the following until the remainder is less than other: find a
+ // floating-point that approximates remainder / other *from below*, add this
+ // into the result, and subtract it from the remainder. It is critical that
+ // the approximate value is less than or equal to the real value so that the
+ // remainder never becomes negative.
+ rem = this;
+ while (rem.gte(divisor)) {
+ // Approximate the result of division. This may be a little greater or
+ // smaller than the actual value.
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
+
+ // We will tweak the approximate result by changing it in the 48-th digit or
+ // the smallest non-fractional digit, whichever is larger.
+ var log2 = Math.ceil(Math.log(approx) / Math.LN2),
+ delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48),
+ // Decrease the approximation until it is smaller than the remainder. Note
+ // that if it is too large, the product overflows and is negative.
+ approxRes = fromNumber(approx),
+ approxRem = approxRes.mul(divisor);
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
+ approx -= delta;
+ approxRes = fromNumber(approx, this.unsigned);
+ approxRem = approxRes.mul(divisor);
+ }
+
+ // We know the answer can't be zero... and actually, zero would cause
+ // infinite recursion since we would make no progress.
+ if (approxRes.isZero()) approxRes = ONE;
+ res = res.add(approxRes);
+ rem = rem.sub(approxRem);
+ }
+ return res;
+ };
+
+ /**
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
+ * @function
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Quotient
+ */
+ LongPrototype.div = LongPrototype.divide;
+
+ /**
+ * Returns this Long modulo the specified.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+ LongPrototype.modulo = function modulo(divisor) {
+ if (!isLong(divisor)) divisor = fromValue(divisor);
+
+ // use wasm support if present
+ if (wasm) {
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(
+ this.low,
+ this.high,
+ divisor.low,
+ divisor.high,
+ );
+ return fromBits(low, wasm["get_high"](), this.unsigned);
+ }
+ return this.sub(this.div(divisor).mul(divisor));
+ };
+
+ /**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+ LongPrototype.mod = LongPrototype.modulo;
+
+ /**
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
+ * @function
+ * @param {!Long|number|bigint|string} divisor Divisor
+ * @returns {!Long} Remainder
+ */
+ LongPrototype.rem = LongPrototype.modulo;
+
+ /**
+ * Returns the bitwise NOT of this Long.
+ * @this {!Long}
+ * @returns {!Long}
+ */
+ LongPrototype.not = function not() {
+ return fromBits(~this.low, ~this.high, this.unsigned);
+ };
+
+ /**
+ * Returns count leading zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+ LongPrototype.countLeadingZeros = function countLeadingZeros() {
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
+ };
+
+ /**
+ * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+ LongPrototype.clz = LongPrototype.countLeadingZeros;
+
+ /**
+ * Returns count trailing zeros of this Long.
+ * @this {!Long}
+ * @returns {!number}
+ */
+ LongPrototype.countTrailingZeros = function countTrailingZeros() {
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
+ };
+
+ /**
+ * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
+ * @function
+ * @param {!Long}
+ * @returns {!number}
+ */
+ LongPrototype.ctz = LongPrototype.countTrailingZeros;
+
+ /**
+ * Returns the bitwise AND of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other Long
+ * @returns {!Long}
+ */
+ LongPrototype.and = function and(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(
+ this.low & other.low,
+ this.high & other.high,
+ this.unsigned,
+ );
+ };
+
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other Long
+ * @returns {!Long}
+ */
+ LongPrototype.or = function or(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(
+ this.low | other.low,
+ this.high | other.high,
+ this.unsigned,
+ );
+ };
+
+ /**
+ * Returns the bitwise XOR of this Long and the given one.
+ * @this {!Long}
+ * @param {!Long|number|bigint|string} other Other Long
+ * @returns {!Long}
+ */
+ LongPrototype.xor = function xor(other) {
+ if (!isLong(other)) other = fromValue(other);
+ return fromBits(
+ this.low ^ other.low,
+ this.high ^ other.high,
+ this.unsigned,
+ );
+ };
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shiftLeft = function shiftLeft(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ else if (numBits < 32)
+ return fromBits(
+ this.low << numBits,
+ (this.high << numBits) | (this.low >>> (32 - numBits)),
+ this.unsigned,
+ );
+ else return fromBits(0, this.low << (numBits - 32), this.unsigned);
+ };
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shl = LongPrototype.shiftLeft;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shiftRight = function shiftRight(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ else if (numBits < 32)
+ return fromBits(
+ (this.low >>> numBits) | (this.high << (32 - numBits)),
+ this.high >> numBits,
+ this.unsigned,
+ );
+ else
+ return fromBits(
+ this.high >> (numBits - 32),
+ this.high >= 0 ? 0 : -1,
+ this.unsigned,
+ );
+ };
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shr = LongPrototype.shiftRight;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits < 32)
+ return fromBits(
+ (this.low >>> numBits) | (this.high << (32 - numBits)),
+ this.high >>> numBits,
+ this.unsigned,
+ );
+ if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
+ return fromBits(this.high >>> (numBits - 32), 0, this.unsigned);
+ };
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shru = LongPrototype.shiftRightUnsigned;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Shifted Long
+ */
+ LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
+
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+ LongPrototype.rotateLeft = function rotateLeft(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+ if (numBits < 32) {
+ b = 32 - numBits;
+ return fromBits(
+ (this.low << numBits) | (this.high >>> b),
+ (this.high << numBits) | (this.low >>> b),
+ this.unsigned,
+ );
+ }
+ numBits -= 32;
+ b = 32 - numBits;
+ return fromBits(
+ (this.high << numBits) | (this.low >>> b),
+ (this.low << numBits) | (this.high >>> b),
+ this.unsigned,
+ );
+ };
+ /**
+ * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+ LongPrototype.rotl = LongPrototype.rotateLeft;
+
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ * @this {!Long}
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+ LongPrototype.rotateRight = function rotateRight(numBits) {
+ var b;
+ if (isLong(numBits)) numBits = numBits.toInt();
+ if ((numBits &= 63) === 0) return this;
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
+ if (numBits < 32) {
+ b = 32 - numBits;
+ return fromBits(
+ (this.high << b) | (this.low >>> numBits),
+ (this.low << b) | (this.high >>> numBits),
+ this.unsigned,
+ );
+ }
+ numBits -= 32;
+ b = 32 - numBits;
+ return fromBits(
+ (this.low << b) | (this.high >>> numBits),
+ (this.high << b) | (this.low >>> numBits),
+ this.unsigned,
+ );
+ };
+ /**
+ * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
+ * @function
+ * @param {number|!Long} numBits Number of bits
+ * @returns {!Long} Rotated Long
+ */
+ LongPrototype.rotr = LongPrototype.rotateRight;
+
+ /**
+ * Converts this Long to signed.
+ * @this {!Long}
+ * @returns {!Long} Signed long
+ */
+ LongPrototype.toSigned = function toSigned() {
+ if (!this.unsigned) return this;
+ return fromBits(this.low, this.high, false);
+ };
+
+ /**
+ * Converts this Long to unsigned.
+ * @this {!Long}
+ * @returns {!Long} Unsigned long
+ */
+ LongPrototype.toUnsigned = function toUnsigned() {
+ if (this.unsigned) return this;
+ return fromBits(this.low, this.high, true);
+ };
+
+ /**
+ * Converts this Long to its byte representation.
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @this {!Long}
+ * @returns {!Array.} Byte representation
+ */
+ LongPrototype.toBytes = function toBytes(le) {
+ return le ? this.toBytesLE() : this.toBytesBE();
+ };
+
+ /**
+ * Converts this Long to its little endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Little endian byte representation
+ */
+ LongPrototype.toBytesLE = function toBytesLE() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ lo & 0xff,
+ (lo >>> 8) & 0xff,
+ (lo >>> 16) & 0xff,
+ lo >>> 24,
+ hi & 0xff,
+ (hi >>> 8) & 0xff,
+ (hi >>> 16) & 0xff,
+ hi >>> 24,
+ ];
+ };
+
+ /**
+ * Converts this Long to its big endian byte representation.
+ * @this {!Long}
+ * @returns {!Array.} Big endian byte representation
+ */
+ LongPrototype.toBytesBE = function toBytesBE() {
+ var hi = this.high,
+ lo = this.low;
+ return [
+ hi >>> 24,
+ (hi >>> 16) & 0xff,
+ (hi >>> 8) & 0xff,
+ hi & 0xff,
+ lo >>> 24,
+ (lo >>> 16) & 0xff,
+ (lo >>> 8) & 0xff,
+ lo & 0xff,
+ ];
+ };
+
+ /**
+ * Creates a Long from its byte representation.
+ * @param {!Array.} bytes Byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
+ * @returns {Long} The corresponding Long value
+ */
+ Long.fromBytes = function fromBytes(bytes, unsigned, le) {
+ return le
+ ? Long.fromBytesLE(bytes, unsigned)
+ : Long.fromBytesBE(bytes, unsigned);
+ };
+
+ /**
+ * Creates a Long from its little endian byte representation.
+ * @param {!Array.} bytes Little endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+ Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
+ return new Long(
+ bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24),
+ bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24),
+ unsigned,
+ );
+ };
+
+ /**
+ * Creates a Long from its big endian byte representation.
+ * @param {!Array.} bytes Big endian byte representation
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {Long} The corresponding Long value
+ */
+ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
+ return new Long(
+ (bytes[4] << 24) | (bytes[5] << 16) | (bytes[6] << 8) | bytes[7],
+ (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3],
+ unsigned,
+ );
+ };
+
+ // Support conversion to/from BigInt where available
+ if (typeof BigInt === "function") {
+ /**
+ * Returns a Long representing the given big integer.
+ * @function
+ * @param {number} value The big integer value
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
+ * @returns {!Long} The corresponding Long value
+ */
+ Long.fromBigInt = function fromBigInt(value, unsigned) {
+ var lowBits = Number(BigInt.asIntN(32, value));
+ var highBits = Number(BigInt.asIntN(32, value >> BigInt(32)));
+ return fromBits(lowBits, highBits, unsigned);
+ };
+
+ // Override
+ Long.fromValue = function fromValueWithBigInt(value, unsigned) {
+ if (typeof value === "bigint") return fromBigInt(value, unsigned);
+ return fromValue(value, unsigned);
+ };
+
+ /**
+ * Converts the Long to its big integer representation.
+ * @this {!Long}
+ * @returns {bigint}
+ */
+ LongPrototype.toBigInt = function toBigInt() {
+ var lowBigInt = BigInt(this.low >>> 0);
+ var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high);
+ return (highBigInt << BigInt(32)) | lowBigInt;
+ };
+ }
+ var _default = (_exports.default = Long);
+ },
+);
diff --git a/EmployeeManagementBackend/node_modules/long/umd/package.json b/EmployeeManagementBackend/node_modules/long/umd/package.json
new file mode 100644
index 0000000..5bbefff
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/umd/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "commonjs"
+}
diff --git a/EmployeeManagementBackend/node_modules/long/umd/types.d.ts b/EmployeeManagementBackend/node_modules/long/umd/types.d.ts
new file mode 100644
index 0000000..7693ca4
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/long/umd/types.d.ts
@@ -0,0 +1,474 @@
+// Common type definitions for both the ESM and UMD variants. The ESM variant
+// reexports the Long class as its default export, whereas the UMD variant makes
+// the Long class a whole-module export with a global variable fallback.
+
+type LongLike =
+ | Long
+ | number
+ | bigint
+ | string
+ | { low: number; high: number; unsigned: boolean };
+
+export declare class Long {
+ /**
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
+ */
+ constructor(low: number, high?: number, unsigned?: boolean);
+
+ /**
+ * Maximum unsigned value.
+ */
+ static MAX_UNSIGNED_VALUE: Long;
+
+ /**
+ * Maximum signed value.
+ */
+ static MAX_VALUE: Long;
+
+ /**
+ * Minimum signed value.
+ */
+ static MIN_VALUE: Long;
+
+ /**
+ * Signed negative one.
+ */
+ static NEG_ONE: Long;
+
+ /**
+ * Signed one.
+ */
+ static ONE: Long;
+
+ /**
+ * Unsigned one.
+ */
+ static UONE: Long;
+
+ /**
+ * Unsigned zero.
+ */
+ static UZERO: Long;
+
+ /**
+ * Signed zero
+ */
+ static ZERO: Long;
+
+ /**
+ * The high 32 bits as a signed value.
+ */
+ high: number;
+
+ /**
+ * The low 32 bits as a signed value.
+ */
+ low: number;
+
+ /**
+ * Whether unsigned or not.
+ */
+ unsigned: boolean;
+
+ /**
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
+ */
+ static fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given 32 bit integer value.
+ */
+ static fromInt(value: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
+ */
+ static fromNumber(value: number, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representing the given big integer value.
+ */
+ static fromBigInt(value: bigint, unsigned?: boolean): Long;
+
+ /**
+ * Returns a Long representation of the given string, written using the specified radix.
+ */
+ static fromString(
+ str: string,
+ unsigned?: boolean | number,
+ radix?: number,
+ ): Long;
+
+ /**
+ * Creates a Long from its byte representation.
+ */
+ static fromBytes(bytes: number[], unsigned?: boolean, le?: boolean): Long;
+
+ /**
+ * Creates a Long from its little endian byte representation.
+ */
+ static fromBytesLE(bytes: number[], unsigned?: boolean): Long;
+
+ /**
+ * Creates a Long from its big endian byte representation.
+ */
+ static fromBytesBE(bytes: number[], unsigned?: boolean): Long;
+
+ /**
+ * Tests if the specified object is a Long.
+ */
+ static isLong(obj: any): obj is Long;
+
+ /**
+ * Converts the specified value to a Long.
+ */
+ static fromValue(val: LongLike, unsigned?: boolean): Long;
+
+ /**
+ * Returns the sum of this and the specified Long.
+ */
+ add(addend: LongLike): Long;
+
+ /**
+ * Returns the bitwise AND of this Long and the specified.
+ */
+ and(other: LongLike): Long;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ compare(other: LongLike): number;
+
+ /**
+ * Compares this Long's value with the specified's.
+ */
+ comp(other: LongLike): number;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ divide(divisor: LongLike): Long;
+
+ /**
+ * Returns this Long divided by the specified.
+ */
+ div(divisor: LongLike): Long;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ equals(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value equals the specified's.
+ */
+ eq(other: LongLike): boolean;
+
+ /**
+ * Gets the high 32 bits as a signed integer.
+ */
+ getHighBits(): number;
+
+ /**
+ * Gets the high 32 bits as an unsigned integer.
+ */
+ getHighBitsUnsigned(): number;
+
+ /**
+ * Gets the low 32 bits as a signed integer.
+ */
+ getLowBits(): number;
+
+ /**
+ * Gets the low 32 bits as an unsigned integer.
+ */
+ getLowBitsUnsigned(): number;
+
+ /**
+ * Gets the number of bits needed to represent the absolute value of this Long.
+ */
+ getNumBitsAbs(): number;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ greaterThan(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than the specified's.
+ */
+ gt(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ greaterThanOrEqual(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ gte(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is greater than or equal the specified's.
+ */
+ ge(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is even.
+ */
+ isEven(): boolean;
+
+ /**
+ * Tests if this Long's value is negative.
+ */
+ isNegative(): boolean;
+
+ /**
+ * Tests if this Long's value is odd.
+ */
+ isOdd(): boolean;
+
+ /**
+ * Tests if this Long's value is positive or zero.
+ */
+ isPositive(): boolean;
+
+ /**
+ * Tests if this Long can be safely represented as a JavaScript number.
+ */
+ isSafeInteger(): boolean;
+
+ /**
+ * Tests if this Long's value equals zero.
+ */
+ isZero(): boolean;
+
+ /**
+ * Tests if this Long's value equals zero.
+ */
+ eqz(): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lessThan(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than the specified's.
+ */
+ lt(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lessThanOrEqual(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ lte(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value is less than or equal the specified's.
+ */
+ le(other: LongLike): boolean;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ modulo(other: LongLike): Long;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ mod(other: LongLike): Long;
+
+ /**
+ * Returns this Long modulo the specified.
+ */
+ rem(other: LongLike): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ multiply(multiplier: LongLike): Long;
+
+ /**
+ * Returns the product of this and the specified Long.
+ */
+ mul(multiplier: LongLike): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ negate(): Long;
+
+ /**
+ * Negates this Long's value.
+ */
+ neg(): Long;
+
+ /**
+ * Returns the bitwise NOT of this Long.
+ */
+ not(): Long;
+
+ /**
+ * Returns count leading zeros of this Long.
+ */
+ countLeadingZeros(): number;
+
+ /**
+ * Returns count leading zeros of this Long.
+ */
+ clz(): number;
+
+ /**
+ * Returns count trailing zeros of this Long.
+ */
+ countTrailingZeros(): number;
+
+ /**
+ * Returns count trailing zeros of this Long.
+ */
+ ctz(): number;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ notEquals(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ neq(other: LongLike): boolean;
+
+ /**
+ * Tests if this Long's value differs from the specified's.
+ */
+ ne(other: LongLike): boolean;
+
+ /**
+ * Returns the bitwise OR of this Long and the specified.
+ */
+ or(other: LongLike): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shiftLeft(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits shifted to the left by the given amount.
+ */
+ shl(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shiftRight(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
+ */
+ shr(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shiftRightUnsigned(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shru(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits logically shifted to the right by the given amount.
+ */
+ shr_u(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ */
+ rotateLeft(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the left by the given amount.
+ */
+ rotl(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ */
+ rotateRight(numBits: number | Long): Long;
+
+ /**
+ * Returns this Long with bits rotated to the right by the given amount.
+ */
+ rotr(numBits: number | Long): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ subtract(subtrahend: LongLike): Long;
+
+ /**
+ * Returns the difference of this and the specified Long.
+ */
+ sub(subtrahend: LongLike): Long;
+
+ /**
+ * Converts the Long to a big integer.
+ */
+ toBigInt(): bigint;
+
+ /**
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
+ */
+ toInt(): number;
+
+ /**
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
+ */
+ toNumber(): number;
+
+ /**
+ * Converts this Long to its byte representation.
+ */
+
+ toBytes(le?: boolean): number[];
+
+ /**
+ * Converts this Long to its little endian byte representation.
+ */
+
+ toBytesLE(): number[];
+
+ /**
+ * Converts this Long to its big endian byte representation.
+ */
+
+ toBytesBE(): number[];
+
+ /**
+ * Converts this Long to signed.
+ */
+ toSigned(): Long;
+
+ /**
+ * Converts the Long to a string written in the specified radix.
+ */
+ toString(radix?: number): string;
+
+ /**
+ * Converts this Long to unsigned.
+ */
+ toUnsigned(): Long;
+
+ /**
+ * Returns the bitwise XOR of this Long and the given one.
+ */
+ xor(other: LongLike): Long;
+}
diff --git a/EmployeeManagementBackend/node_modules/lru-cache/LICENSE b/EmployeeManagementBackend/node_modules/lru-cache/LICENSE
new file mode 100644
index 0000000..f785757
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru-cache/LICENSE
@@ -0,0 +1,15 @@
+The ISC License
+
+Copyright (c) 2010-2023 Isaac Z. Schlueter and Contributors
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/EmployeeManagementBackend/node_modules/lru-cache/README.md b/EmployeeManagementBackend/node_modules/lru-cache/README.md
new file mode 100644
index 0000000..f128330
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru-cache/README.md
@@ -0,0 +1,1117 @@
+# lru-cache
+
+A cache object that deletes the least-recently-used items.
+
+Specify a max number of the most recently used items that you
+want to keep, and this cache will keep that many of the most
+recently accessed items.
+
+This is not primarily a TTL cache, and does not make strong TTL
+guarantees. There is no preemptive pruning of expired items by
+default, but you _may_ set a TTL on the cache or on a single
+`set`. If you do so, it will treat expired items as missing, and
+delete them when fetched. If you are more interested in TTL
+caching than LRU caching, check out
+[@isaacs/ttlcache](http://npm.im/@isaacs/ttlcache).
+
+As of version 7, this is one of the most performant LRU
+implementations available in JavaScript, and supports a wide
+diversity of use cases. However, note that using some of the
+features will necessarily impact performance, by causing the
+cache to have to do more work. See the "Performance" section
+below.
+
+## Installation
+
+```bash
+npm install lru-cache --save
+```
+
+## Usage
+
+```js
+// hybrid module, either works
+import LRUCache from 'lru-cache'
+// or:
+const LRUCache = require('lru-cache')
+
+// At least one of 'max', 'ttl', or 'maxSize' is required, to prevent
+// unsafe unbounded storage.
+//
+// In most cases, it's best to specify a max for performance, so all
+// the required memory allocation is done up-front.
+//
+// All the other options are optional, see the sections below for
+// documentation on what each one does. Most of them can be
+// overridden for specific items in get()/set()
+const options = {
+ max: 500,
+
+ // for use with tracking overall storage size
+ maxSize: 5000,
+ sizeCalculation: (value, key) => {
+ return 1
+ },
+
+ // for use when you need to clean up something when objects
+ // are evicted from the cache
+ dispose: (value, key) => {
+ freeFromMemoryOrWhatever(value)
+ },
+
+ // how long to live in ms
+ ttl: 1000 * 60 * 5,
+
+ // return stale items before removing from cache?
+ allowStale: false,
+
+ updateAgeOnGet: false,
+ updateAgeOnHas: false,
+
+ // async method to use for cache.fetch(), for
+ // stale-while-revalidate type of behavior
+ fetchMethod: async (key, staleValue, { options, signal }) => {},
+}
+
+const cache = new LRUCache(options)
+
+cache.set('key', 'value')
+cache.get('key') // "value"
+
+// non-string keys ARE fully supported
+// but note that it must be THE SAME object, not
+// just a JSON-equivalent object.
+var someObject = { a: 1 }
+cache.set(someObject, 'a value')
+// Object keys are not toString()-ed
+cache.set('[object Object]', 'a different value')
+assert.equal(cache.get(someObject), 'a value')
+// A similar object with same keys/values won't work,
+// because it's a different object identity
+assert.equal(cache.get({ a: 1 }), undefined)
+
+cache.clear() // empty the cache
+```
+
+If you put more stuff in it, then items will fall out.
+
+## Options
+
+### `max`
+
+The maximum number of items that remain in the cache (assuming no
+TTL pruning or explicit deletions). Note that fewer items may be
+stored if size calculation is used, and `maxSize` is exceeded.
+This must be a positive finite intger.
+
+At least one of `max`, `maxSize`, or `TTL` is required. This
+must be a positive integer if set.
+
+**It is strongly recommended to set a `max` to prevent unbounded
+growth of the cache.** See "Storage Bounds Safety" below.
+
+### `maxSize`
+
+Set to a positive integer to track the sizes of items added to
+the cache, and automatically evict items in order to stay below
+this size. Note that this may result in fewer than `max` items
+being stored.
+
+Attempting to add an item to the cache whose calculated size is
+greater that this amount will be a no-op. The item will not be
+cached, and no other items will be evicted.
+
+Optional, must be a positive integer if provided.
+
+Sets `maxEntrySize` to the same value, unless a different value
+is provided for `maxEntrySize`.
+
+At least one of `max`, `maxSize`, or `TTL` is required. This
+must be a positive integer if set.
+
+Even if size tracking is enabled, **it is strongly recommended to
+set a `max` to prevent unbounded growth of the cache.** See
+"Storage Bounds Safety" below.
+
+### `maxEntrySize`
+
+Set to a positive integer to track the sizes of items added to
+the cache, and prevent caching any item over a given size.
+Attempting to add an item whose calculated size is greater than
+this amount will be a no-op. The item will not be cached, and no
+other items will be evicted.
+
+Optional, must be a positive integer if provided. Defaults to
+the value of `maxSize` if provided.
+
+### `sizeCalculation`
+
+Function used to calculate the size of stored items. If you're
+storing strings or buffers, then you probably want to do
+something like `n => n.length`. The item is passed as the first
+argument, and the key is passed as the second argument.
+
+This may be overridden by passing an options object to
+`cache.set()`.
+
+Requires `maxSize` to be set.
+
+If the `size` (or return value of `sizeCalculation`) for a given
+entry is greater than `maxEntrySize`, then the item will not be
+added to the cache.
+
+Deprecated alias: `length`
+
+### `fetchMethod`
+
+Function that is used to make background asynchronous fetches.
+Called with `fetchMethod(key, staleValue, { signal, options,
+context })`. May return a Promise.
+
+If `fetchMethod` is not provided, then `cache.fetch(key)` is
+equivalent to `Promise.resolve(cache.get(key))`.
+
+The `signal` object is an `AbortSignal` if that's available in
+the global object, otherwise it's a pretty close polyfill.
+
+If at any time, `signal.aborted` is set to `true`, or if the
+`signal.onabort` method is called, or if it emits an `'abort'`
+event which you can listen to with `addEventListener`, then that
+means that the fetch should be abandoned. This may be passed
+along to async functions aware of AbortController/AbortSignal
+behavior.
+
+The `fetchMethod` should **only** return `undefined` or a Promise
+resolving to `undefined` if the AbortController signaled an
+`abort` event. In all other cases, it should return or resolve
+to a value suitable for adding to the cache.
+
+The `options` object is a union of the options that may be
+provided to `set()` and `get()`. If they are modified, then that
+will result in modifying the settings to `cache.set()` when the
+value is resolved, and in the case of `noDeleteOnFetchRejection`
+and `allowStaleOnFetchRejection`, the handling of `fetchMethod`
+failures.
+
+For example, a DNS cache may update the TTL based on the value
+returned from a remote DNS server by changing `options.ttl` in
+the `fetchMethod`.
+
+### `fetchContext`
+
+Arbitrary data that can be passed to the `fetchMethod` as the
+`context` option.
+
+Note that this will only be relevant when the `cache.fetch()`
+call needs to call `fetchMethod()`. Thus, any data which will
+meaningfully vary the fetch response needs to be present in the
+key. This is primarily intended for including `x-request-id`
+headers and the like for debugging purposes, which do not affect
+the `fetchMethod()` response.
+
+### `noDeleteOnFetchRejection`
+
+If a `fetchMethod` throws an error or returns a rejected promise,
+then by default, any existing stale value will be removed from
+the cache.
+
+If `noDeleteOnFetchRejection` is set to `true`, then this
+behavior is suppressed, and the stale value remains in the cache
+in the case of a rejected `fetchMethod`.
+
+This is important in cases where a `fetchMethod` is _only_ called
+as a background update while the stale value is returned, when
+`allowStale` is used.
+
+This is implicitly in effect when `allowStaleOnFetchRejection` is
+set.
+
+This may be set in calls to `fetch()`, or defaulted on the
+constructor, or overridden by modifying the options object in the
+`fetchMethod`.
+
+### `allowStaleOnFetchRejection`
+
+Set to true to return a stale value from the cache when a
+`fetchMethod` throws an error or returns a rejected Promise.
+
+If a `fetchMethod` fails, and there is no stale value available,
+the `fetch()` will resolve to `undefined`. Ie, all `fetchMethod`
+errors are suppressed.
+
+Implies `noDeleteOnFetchRejection`.
+
+This may be set in calls to `fetch()`, or defaulted on the
+constructor, or overridden by modifying the options object in the
+`fetchMethod`.
+
+### `allowStaleOnFetchAbort`
+
+Set to true to return a stale value from the cache when the
+`AbortSignal` passed to the `fetchMethod` dispatches an `'abort'`
+event, whether user-triggered, or due to internal cache behavior.
+
+Unless `ignoreFetchAbort` is also set, the underlying
+`fetchMethod` will still be considered canceled, and its return
+value will be ignored and not cached.
+
+### `ignoreFetchAbort`
+
+Set to true to ignore the `abort` event emitted by the
+`AbortSignal` object passed to `fetchMethod`, and still cache the
+resulting resolution value, as long as it is not `undefined`.
+
+When used on its own, this means aborted `fetch()` calls are not
+immediately resolved or rejected when they are aborted, and
+instead take the full time to await.
+
+When used with `allowStaleOnFetchAbort`, aborted `fetch()` calls
+will resolve immediately to their stale cached value or
+`undefined`, and will continue to process and eventually update
+the cache when they resolve, as long as the resulting value is
+not `undefined`, thus supporting a "return stale on timeout while
+refreshing" mechanism by passing `AbortSignal.timeout(n)` as the
+signal.
+
+For example:
+
+```js
+const c = new LRUCache({
+ ttl: 100,
+ ignoreFetchAbort: true,
+ allowStaleOnFetchAbort: true,
+ fetchMethod: async (key, oldValue, { signal }) => {
+ // note: do NOT pass the signal to fetch()!
+ // let's say this fetch can take a long time.
+ const res = await fetch(`https://slow-backend-server/${key}`)
+ return await res.json()
+ },
+})
+
+// this will return the stale value after 100ms, while still
+// updating in the background for next time.
+const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
+```
+
+**Note**: regardless of this setting, an `abort` event _is still
+emitted on the `AbortSignal` object_, so may result in invalid
+results when passed to other underlying APIs that use
+AbortSignals.
+
+This may be overridden on the `fetch()` call or in the
+`fetchMethod` itself.
+
+### `dispose`
+
+Function that is called on items when they are dropped from the
+cache, as `this.dispose(value, key, reason)`.
+
+This can be handy if you want to close file descriptors or do
+other cleanup tasks when items are no longer stored in the cache.
+
+**NOTE**: It is called _before_ the item has been fully removed
+from the cache, so if you want to put it right back in, you need
+to wait until the next tick. If you try to add it back in during
+the `dispose()` function call, it will break things in subtle and
+weird ways.
+
+Unlike several other options, this may _not_ be overridden by
+passing an option to `set()`, for performance reasons. If
+disposal functions may vary between cache entries, then the
+entire list must be scanned on every cache swap, even if no
+disposal function is in use.
+
+The `reason` will be one of the following strings, corresponding
+to the reason for the item's deletion:
+
+- `evict` Item was evicted to make space for a new addition
+- `set` Item was overwritten by a new value
+- `delete` Item was removed by explicit `cache.delete(key)` or by
+ calling `cache.clear()`, which deletes everything.
+
+The `dispose()` method is _not_ called for canceled calls to
+`fetchMethod()`. If you wish to handle evictions, overwrites,
+and deletes of in-flight asynchronous fetches, you must use the
+`AbortSignal` provided.
+
+Optional, must be a function.
+
+### `disposeAfter`
+
+The same as `dispose`, but called _after_ the entry is completely
+removed and the cache is once again in a clean state.
+
+It is safe to add an item right back into the cache at this
+point. However, note that it is _very_ easy to inadvertently
+create infinite recursion in this way.
+
+The `disposeAfter()` method is _not_ called for canceled calls to
+`fetchMethod()`. If you wish to handle evictions, overwrites,
+and deletes of in-flight asynchronous fetches, you must use the
+`AbortSignal` provided.
+
+### `noDisposeOnSet`
+
+Set to `true` to suppress calling the `dispose()` function if the
+entry key is still accessible within the cache.
+
+This may be overridden by passing an options object to
+`cache.set()`.
+
+Boolean, default `false`. Only relevant if `dispose` or
+`disposeAfter` options are set.
+
+### `ttl`
+
+Max time to live for items before they are considered stale.
+Note that stale items are NOT preemptively removed by default,
+and MAY live in the cache, contributing to its LRU max, long
+after they have expired.
+
+Also, as this cache is optimized for LRU/MRU operations, some of
+the staleness/TTL checks will reduce performance.
+
+This is not primarily a TTL cache, and does not make strong TTL
+guarantees. There is no pre-emptive pruning of expired items,
+but you _may_ set a TTL on the cache, and it will treat expired
+items as missing when they are fetched, and delete them.
+
+Optional, but must be a positive integer in ms if specified.
+
+This may be overridden by passing an options object to
+`cache.set()`.
+
+At least one of `max`, `maxSize`, or `TTL` is required. This
+must be a positive integer if set.
+
+Even if ttl tracking is enabled, **it is strongly recommended to
+set a `max` to prevent unbounded growth of the cache.** See
+"Storage Bounds Safety" below.
+
+If ttl tracking is enabled, and `max` and `maxSize` are not set,
+and `ttlAutopurge` is not set, then a warning will be emitted
+cautioning about the potential for unbounded memory consumption.
+
+Deprecated alias: `maxAge`
+
+### `noUpdateTTL`
+
+Boolean flag to tell the cache to not update the TTL when setting
+a new value for an existing key (ie, when updating a value rather
+than inserting a new value). Note that the TTL value is _always_
+set (if provided) when adding a new entry into the cache.
+
+This may be passed as an option to `cache.set()`.
+
+Boolean, default false.
+
+### `ttlResolution`
+
+Minimum amount of time in ms in which to check for staleness.
+Defaults to `1`, which means that the current time is checked at
+most once per millisecond.
+
+Set to `0` to check the current time every time staleness is
+tested.
+
+Note that setting this to a higher value _will_ improve
+performance somewhat while using ttl tracking, albeit at the
+expense of keeping stale items around a bit longer than intended.
+
+### `ttlAutopurge`
+
+Preemptively remove stale items from the cache.
+
+Note that this may _significantly_ degrade performance,
+especially if the cache is storing a large number of items. It
+is almost always best to just leave the stale items in the cache,
+and let them fall out as new items are added.
+
+Note that this means that `allowStale` is a bit pointless, as
+stale items will be deleted almost as soon as they expire.
+
+Use with caution!
+
+Boolean, default `false`
+
+### `allowStale`
+
+By default, if you set `ttl`, it'll only delete stale items from
+the cache when you `get(key)`. That is, it's not preemptively
+pruning items.
+
+If you set `allowStale:true`, it'll return the stale value as
+well as deleting it. If you don't set this, then it'll return
+`undefined` when you try to get a stale entry.
+
+Note that when a stale entry is fetched, _even if it is returned
+due to `allowStale` being set_, it is removed from the cache
+immediately. You can immediately put it back in the cache if you
+wish, thus resetting the TTL.
+
+This may be overridden by passing an options object to
+`cache.get()`. The `cache.has()` method will always return
+`false` for stale items.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+Deprecated alias: `stale`
+
+### `noDeleteOnStaleGet`
+
+When using time-expiring entries with `ttl`, by default stale
+items will be removed from the cache when the key is accessed
+with `cache.get()`.
+
+Setting `noDeleteOnStaleGet` to `true` will cause stale items to
+remain in the cache, until they are explicitly deleted with
+`cache.delete(key)`, or retrieved with `noDeleteOnStaleGet` set
+to `false`.
+
+This may be overridden by passing an options object to
+`cache.get()`.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+### `updateAgeOnGet`
+
+When using time-expiring entries with `ttl`, setting this to
+`true` will make each item's age reset to 0 whenever it is
+retrieved from cache with `get()`, causing it to not expire. (It
+can still fall out of cache based on recency of use, of course.)
+
+This may be overridden by passing an options object to
+`cache.get()`.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+### `updateAgeOnHas`
+
+When using time-expiring entries with `ttl`, setting this to
+`true` will make each item's age reset to 0 whenever its presence
+in the cache is checked with `has()`, causing it to not expire.
+(It can still fall out of cache based on recency of use, of
+course.)
+
+This may be overridden by passing an options object to
+`cache.has()`.
+
+Boolean, default false, only relevant if `ttl` is set.
+
+## API
+
+### `new LRUCache(options)`
+
+Create a new LRUCache. All options are documented above, and are
+on the cache as public members.
+
+### `cache.max`, `cache.maxSize`, `cache.allowStale`,
+
+`cache.noDisposeOnSet`, `cache.sizeCalculation`, `cache.dispose`,
+`cache.maxSize`, `cache.ttl`, `cache.updateAgeOnGet`,
+`cache.updateAgeOnHas`
+
+All option names are exposed as public members on the cache
+object.
+
+These are intended for read access only. Changing them during
+program operation can cause undefined behavior.
+
+### `cache.size`
+
+The total number of items held in the cache at the current
+moment.
+
+### `cache.calculatedSize`
+
+The total size of items in cache when using size tracking.
+
+### `set(key, value, [{ size, sizeCalculation, ttl, noDisposeOnSet, start, status }])`
+
+Add a value to the cache.
+
+Optional options object may contain `ttl` and `sizeCalculation`
+as described above, which default to the settings on the cache
+object.
+
+If `start` is provided, then that will set the effective start
+time for the TTL calculation. Note that this must be a previous
+value of `performance.now()` if supported, or a previous value of
+`Date.now()` if not.
+
+Options object may also include `size`, which will prevent
+calling the `sizeCalculation` function and just use the specified
+number if it is a positive integer, and `noDisposeOnSet` which
+will prevent calling a `dispose` function in the case of
+overwrites.
+
+If the `size` (or return value of `sizeCalculation`) for a given
+entry is greater than `maxEntrySize`, then the item will not be
+added to the cache.
+
+Will update the recency of the entry.
+
+Returns the cache object.
+
+For the usage of the `status` option, see **Status Tracking**
+below.
+
+### `get(key, { updateAgeOnGet, allowStale, status } = {}) => value`
+
+Return a value from the cache.
+
+Will update the recency of the cache entry found.
+
+If the key is not found, `get()` will return `undefined`. This
+can be confusing when setting values specifically to `undefined`,
+as in `cache.set(key, undefined)`. Use `cache.has()` to
+determine whether a key is present in the cache at all.
+
+For the usage of the `status` option, see **Status Tracking**
+below.
+
+### `async fetch(key, options = {}) => Promise`
+
+The following options are supported:
+
+- `updateAgeOnGet`
+- `allowStale`
+- `size`
+- `sizeCalculation`
+- `ttl`
+- `noDisposeOnSet`
+- `forceRefresh`
+- `status` - See **Status Tracking** below.
+- `signal` - AbortSignal can be used to cancel the `fetch()`.
+ Note that the `signal` option provided to the `fetchMethod` is
+ a different object, because it must also respond to internal
+ cache state changes, but aborting this signal will abort the
+ one passed to `fetchMethod` as well.
+- `fetchContext` - sets the `context` option passed to the
+ underlying `fetchMethod`.
+
+If the value is in the cache and not stale, then the returned
+Promise resolves to the value.
+
+If not in the cache, or beyond its TTL staleness, then
+`fetchMethod(key, staleValue, { options, signal, context })` is
+called, and the value returned will be added to the cache once
+resolved.
+
+If called with `allowStale`, and an asynchronous fetch is
+currently in progress to reload a stale value, then the former
+stale value will be returned.
+
+If called with `forceRefresh`, then the cached item will be
+re-fetched, even if it is not stale. However, if `allowStale` is
+set, then the old value will still be returned. This is useful
+in cases where you want to force a reload of a cached value. If
+a background fetch is already in progress, then `forceRefresh`
+has no effect.
+
+Multiple fetches for the same `key` will only call `fetchMethod`
+a single time, and all will be resolved when the value is
+resolved, even if different options are used.
+
+If `fetchMethod` is not specified, then this is effectively an
+alias for `Promise.resolve(cache.get(key))`.
+
+When the fetch method resolves to a value, if the fetch has not
+been aborted due to deletion, eviction, or being overwritten,
+then it is added to the cache using the options provided.
+
+If the key is evicted or deleted before the `fetchMethod`
+resolves, then the AbortSignal passed to the `fetchMethod` will
+receive an `abort` event, and the promise returned by `fetch()`
+will reject with the reason for the abort.
+
+If a `signal` is passed to the `fetch()` call, then aborting the
+signal will abort the fetch and cause the `fetch()` promise to
+reject with the reason provided.
+
+### `peek(key, { allowStale } = {}) => value`
+
+Like `get()` but doesn't update recency or delete stale items.
+
+Returns `undefined` if the item is stale, unless `allowStale` is
+set either on the cache or in the options object.
+
+### `has(key, { updateAgeOnHas, status } = {}) => Boolean`
+
+Check if a key is in the cache, without updating the recency of
+use. Age is updated if `updateAgeOnHas` is set to `true` in
+either the options or the constructor.
+
+Will return `false` if the item is stale, even though it is
+technically in the cache. The difference can be determined (if
+it matters) by using a `status` argument, and inspecting the
+`has` field.
+
+For the usage of the `status` option, see **Status Tracking**
+below.
+
+### `delete(key)`
+
+Deletes a key out of the cache.
+
+Returns `true` if the key was deleted, `false` otherwise.
+
+### `clear()`
+
+Clear the cache entirely, throwing away all values.
+
+Deprecated alias: `reset()`
+
+### `keys()`
+
+Return a generator yielding the keys in the cache, in order from
+most recently used to least recently used.
+
+### `rkeys()`
+
+Return a generator yielding the keys in the cache, in order from
+least recently used to most recently used.
+
+### `values()`
+
+Return a generator yielding the values in the cache, in order
+from most recently used to least recently used.
+
+### `rvalues()`
+
+Return a generator yielding the values in the cache, in order
+from least recently used to most recently used.
+
+### `entries()`
+
+Return a generator yielding `[key, value]` pairs, in order from
+most recently used to least recently used.
+
+### `rentries()`
+
+Return a generator yielding `[key, value]` pairs, in order from
+least recently used to most recently used.
+
+### `find(fn, [getOptions])`
+
+Find a value for which the supplied `fn` method returns a truthy
+value, similar to `Array.find()`.
+
+`fn` is called as `fn(value, key, cache)`.
+
+The optional `getOptions` are applied to the resulting `get()` of
+the item found.
+
+### `dump()`
+
+Return an array of `[key, entry]` objects which can be passed to
+`cache.load()`
+
+The `start` fields are calculated relative to a portable
+`Date.now()` timestamp, even if `performance.now()` is available.
+
+Stale entries are always included in the `dump`, even if
+`allowStale` is false.
+
+Note: this returns an actual array, not a generator, so it can be
+more easily passed around.
+
+### `load(entries)`
+
+Reset the cache and load in the items in `entries` in the order
+listed. Note that the shape of the resulting cache may be
+different if the same options are not used in both caches.
+
+The `start` fields are assumed to be calculated relative to a
+portable `Date.now()` timestamp, even if `performance.now()` is
+available.
+
+### `purgeStale()`
+
+Delete any stale entries. Returns `true` if anything was
+removed, `false` otherwise.
+
+Deprecated alias: `prune`
+
+### `getRemainingTTL(key)`
+
+Return the number of ms left in the item's TTL. If item is not
+in cache, returns `0`. Returns `Infinity` if item is in cache
+without a defined TTL.
+
+### `forEach(fn, [thisp])`
+
+Call the `fn` function with each set of `fn(value, key, cache)`
+in the LRU cache, from most recent to least recently used.
+
+Does not affect recency of use.
+
+If `thisp` is provided, function will be called in the
+`this`-context of the provided object.
+
+### `rforEach(fn, [thisp])`
+
+Same as `cache.forEach(fn, thisp)`, but in order from least
+recently used to most recently used.
+
+### `pop()`
+
+Evict the least recently used item, returning its value.
+
+Returns `undefined` if cache is empty.
+
+### Internal Methods and Properties
+
+In order to optimize performance as much as possible, "private"
+members and methods are exposed on the object as normal
+properties, rather than being accessed via Symbols, private
+members, or closure variables.
+
+**Do not use or rely on these.** They will change or be removed
+without notice. They will cause undefined behavior if used
+inappropriately. There is no need or reason to ever call them
+directly.
+
+This documentation is here so that it is especially clear that
+this not "undocumented" because someone forgot; it _is_
+documented, and the documentation is telling you not to do it.
+
+**Do not report bugs that stem from using these properties.**
+They will be ignored.
+
+- `initializeTTLTracking()` Set up the cache for tracking TTLs
+- `updateItemAge(index)` Called when an item age is updated, by
+ internal ID
+- `setItemTTL(index)` Called when an item ttl is updated, by
+ internal ID
+- `isStale(index)` Called to check an item's staleness, by
+ internal ID
+- `initializeSizeTracking()` Set up the cache for tracking item
+ size. Called automatically when a size is specified.
+- `removeItemSize(index)` Updates the internal size calculation
+ when an item is removed or modified, by internal ID
+- `addItemSize(index)` Updates the internal size calculation when
+ an item is added or modified, by internal ID
+- `indexes()` An iterator over the non-stale internal IDs, from
+ most recently to least recently used.
+- `rindexes()` An iterator over the non-stale internal IDs, from
+ least recently to most recently used.
+- `newIndex()` Create a new internal ID, either reusing a deleted
+ ID, evicting the least recently used ID, or walking to the end
+ of the allotted space.
+- `evict()` Evict the least recently used internal ID, returning
+ its ID. Does not do any bounds checking.
+- `connect(p, n)` Connect the `p` and `n` internal IDs in the
+ linked list.
+- `moveToTail(index)` Move the specified internal ID to the most
+ recently used position.
+- `keyMap` Map of keys to internal IDs
+- `keyList` List of keys by internal ID
+- `valList` List of values by internal ID
+- `sizes` List of calculated sizes by internal ID
+- `ttls` List of TTL values by internal ID
+- `starts` List of start time values by internal ID
+- `next` Array of "next" pointers by internal ID
+- `prev` Array of "previous" pointers by internal ID
+- `head` Internal ID of least recently used item
+- `tail` Internal ID of most recently used item
+- `free` Stack of deleted internal IDs
+
+## Status Tracking
+
+Occasionally, it may be useful to track the internal behavior of
+the cache, particularly for logging, debugging, or for behavior
+within the `fetchMethod`. To do this, you can pass a `status`
+object to the `get()`, `set()`, `has()`, and `fetch()` methods.
+
+The `status` option should be a plain JavaScript object.
+
+The following fields will be set appropriately:
+
+```ts
+interface Status {
+ /**
+ * The status of a set() operation.
+ *
+ * - add: the item was not found in the cache, and was added
+ * - update: the item was in the cache, with the same value provided
+ * - replace: the item was in the cache, and replaced
+ * - miss: the item was not added to the cache for some reason
+ */
+ set?: 'add' | 'update' | 'replace' | 'miss'
+
+ /**
+ * the ttl stored for the item, or undefined if ttls are not used.
+ */
+ ttl?: LRUMilliseconds
+
+ /**
+ * the start time for the item, or undefined if ttls are not used.
+ */
+ start?: LRUMilliseconds
+
+ /**
+ * The timestamp used for TTL calculation
+ */
+ now?: LRUMilliseconds
+
+ /**
+ * the remaining ttl for the item, or undefined if ttls are not used.
+ */
+ remainingTTL?: LRUMilliseconds
+
+ /**
+ * The calculated size for the item, if sizes are used.
+ */
+ size?: LRUSize
+
+ /**
+ * A flag indicating that the item was not stored, due to exceeding the
+ * {@link maxEntrySize}
+ */
+ maxEntrySizeExceeded?: true
+
+ /**
+ * The old value, specified in the case of `set:'update'` or
+ * `set:'replace'`
+ */
+ oldValue?: V
+
+ /**
+ * The results of a {@link has} operation
+ *
+ * - hit: the item was found in the cache
+ * - stale: the item was found in the cache, but is stale
+ * - miss: the item was not found in the cache
+ */
+ has?: 'hit' | 'stale' | 'miss'
+
+ /**
+ * The status of a {@link fetch} operation.
+ * Note that this can change as the underlying fetch() moves through
+ * various states.
+ *
+ * - inflight: there is another fetch() for this key which is in process
+ * - get: there is no fetchMethod, so {@link get} was called.
+ * - miss: the item is not in cache, and will be fetched.
+ * - hit: the item is in the cache, and was resolved immediately.
+ * - stale: the item is in the cache, but stale.
+ * - refresh: the item is in the cache, and not stale, but
+ * {@link forceRefresh} was specified.
+ */
+ fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
+
+ /**
+ * The {@link fetchMethod} was called
+ */
+ fetchDispatched?: true
+
+ /**
+ * The cached value was updated after a successful call to fetchMethod
+ */
+ fetchUpdated?: true
+
+ /**
+ * The reason for a fetch() rejection. Either the error raised by the
+ * {@link fetchMethod}, or the reason for an AbortSignal.
+ */
+ fetchError?: Error
+
+ /**
+ * The fetch received an abort signal
+ */
+ fetchAborted?: true
+
+ /**
+ * The abort signal received was ignored, and the fetch was allowed to
+ * continue.
+ */
+ fetchAbortIgnored?: true
+
+ /**
+ * The fetchMethod promise resolved successfully
+ */
+ fetchResolved?: true
+
+ /**
+ * The results of the fetchMethod promise were stored in the cache
+ */
+ fetchUpdated?: true
+
+ /**
+ * The fetchMethod promise was rejected
+ */
+ fetchRejected?: true
+
+ /**
+ * The status of a {@link get} operation.
+ *
+ * - fetching: The item is currently being fetched. If a previous value is
+ * present and allowed, that will be returned.
+ * - stale: The item is in the cache, and is stale.
+ * - hit: the item is in the cache
+ * - miss: the item is not in the cache
+ */
+ get?: 'stale' | 'hit' | 'miss'
+
+ /**
+ * A fetch or get operation returned a stale value.
+ */
+ returnedStale?: true
+}
+```
+
+## Storage Bounds Safety
+
+This implementation aims to be as flexible as possible, within
+the limits of safe memory consumption and optimal performance.
+
+At initial object creation, storage is allocated for `max` items.
+If `max` is set to zero, then some performance is lost, and item
+count is unbounded. Either `maxSize` or `ttl` _must_ be set if
+`max` is not specified.
+
+If `maxSize` is set, then this creates a safe limit on the
+maximum storage consumed, but without the performance benefits of
+pre-allocation. When `maxSize` is set, every item _must_ provide
+a size, either via the `sizeCalculation` method provided to the
+constructor, or via a `size` or `sizeCalculation` option provided
+to `cache.set()`. The size of every item _must_ be a positive
+integer.
+
+If neither `max` nor `maxSize` are set, then `ttl` tracking must
+be enabled. Note that, even when tracking item `ttl`, items are
+_not_ preemptively deleted when they become stale, unless
+`ttlAutopurge` is enabled. Instead, they are only purged the
+next time the key is requested. Thus, if `ttlAutopurge`, `max`,
+and `maxSize` are all not set, then the cache will potentially
+grow unbounded.
+
+In this case, a warning is printed to standard error. Future
+versions may require the use of `ttlAutopurge` if `max` and
+`maxSize` are not specified.
+
+If you truly wish to use a cache that is bound _only_ by TTL
+expiration, consider using a `Map` object, and calling
+`setTimeout` to delete entries when they expire. It will perform
+much better than an LRU cache.
+
+Here is an implementation you may use, under the same
+[license](./LICENSE) as this package:
+
+```js
+// a storage-unbounded ttl cache that is not an lru-cache
+const cache = {
+ data: new Map(),
+ timers: new Map(),
+ set: (k, v, ttl) => {
+ if (cache.timers.has(k)) {
+ clearTimeout(cache.timers.get(k))
+ }
+ cache.timers.set(
+ k,
+ setTimeout(() => cache.delete(k), ttl)
+ )
+ cache.data.set(k, v)
+ },
+ get: k => cache.data.get(k),
+ has: k => cache.data.has(k),
+ delete: k => {
+ if (cache.timers.has(k)) {
+ clearTimeout(cache.timers.get(k))
+ }
+ cache.timers.delete(k)
+ return cache.data.delete(k)
+ },
+ clear: () => {
+ cache.data.clear()
+ for (const v of cache.timers.values()) {
+ clearTimeout(v)
+ }
+ cache.timers.clear()
+ },
+}
+```
+
+If that isn't to your liking, check out
+[@isaacs/ttlcache](http://npm.im/@isaacs/ttlcache).
+
+## Performance
+
+As of January 2022, version 7 of this library is one of the most
+performant LRU cache implementations in JavaScript.
+
+Benchmarks can be extremely difficult to get right. In
+particular, the performance of set/get/delete operations on
+objects will vary _wildly_ depending on the type of key used. V8
+is highly optimized for objects with keys that are short strings,
+especially integer numeric strings. Thus any benchmark which
+tests _solely_ using numbers as keys will tend to find that an
+object-based approach performs the best.
+
+Note that coercing _anything_ to strings to use as object keys is
+unsafe, unless you can be 100% certain that no other type of
+value will be used. For example:
+
+```js
+const myCache = {}
+const set = (k, v) => (myCache[k] = v)
+const get = k => myCache[k]
+
+set({}, 'please hang onto this for me')
+set('[object Object]', 'oopsie')
+```
+
+Also beware of "Just So" stories regarding performance. Garbage
+collection of large (especially: deep) object graphs can be
+incredibly costly, with several "tipping points" where it
+increases exponentially. As a result, putting that off until
+later can make it much worse, and less predictable. If a library
+performs well, but only in a scenario where the object graph is
+kept shallow, then that won't help you if you are using large
+objects as keys.
+
+In general, when attempting to use a library to improve
+performance (such as a cache like this one), it's best to choose
+an option that will perform well in the sorts of scenarios where
+you'll actually use it.
+
+This library is optimized for repeated gets and minimizing
+eviction time, since that is the expected need of a LRU. Set
+operations are somewhat slower on average than a few other
+options, in part because of that optimization. It is assumed
+that you'll be caching some costly operation, ideally as rarely
+as possible, so optimizing set over get would be unwise.
+
+If performance matters to you:
+
+1. If it's at all possible to use small integer values as keys,
+ and you can guarantee that no other types of values will be
+ used as keys, then do that, and use a cache such as
+ [lru-fast](https://npmjs.com/package/lru-fast), or
+ [mnemonist's
+ LRUCache](https://yomguithereal.github.io/mnemonist/lru-cache)
+ which uses an Object as its data store.
+2. Failing that, if at all possible, use short non-numeric
+ strings (ie, less than 256 characters) as your keys, and use
+ [mnemonist's
+ LRUCache](https://yomguithereal.github.io/mnemonist/lru-cache).
+3. If the types of your keys will be long strings, strings that
+ look like floats, `null`, objects, or some mix of types, or if
+ you aren't sure, then this library will work well for you.
+4. Do not use a `dispose` function, size tracking, or especially
+ ttl behavior, unless absolutely needed. These features are
+ convenient, and necessary in some use cases, and every attempt
+ has been made to make the performance impact minimal, but it
+ isn't nothing.
+
+## Breaking Changes in Version 7
+
+This library changed to a different algorithm and internal data
+structure in version 7, yielding significantly better
+performance, albeit with some subtle changes as a result.
+
+If you were relying on the internals of LRUCache in version 6 or
+before, it probably will not work in version 7 and above.
+
+For more info, see the [change log](CHANGELOG.md).
diff --git a/EmployeeManagementBackend/node_modules/lru-cache/index.d.ts b/EmployeeManagementBackend/node_modules/lru-cache/index.d.ts
new file mode 100644
index 0000000..b58395e
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru-cache/index.d.ts
@@ -0,0 +1,869 @@
+// Project: https://github.com/isaacs/node-lru-cache
+// Based initially on @types/lru-cache
+// https://github.com/DefinitelyTyped/DefinitelyTyped
+// used under the terms of the MIT License, shown below.
+//
+// DefinitelyTyped license:
+// ------
+// MIT License
+//
+// Copyright (c) Microsoft Corporation.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
+// ------
+//
+// Changes by Isaac Z. Schlueter released under the terms found in the
+// LICENSE file within this project.
+
+/**
+ * Integer greater than 0, representing some number of milliseconds, or the
+ * time at which a TTL started counting from.
+ */
+declare type LRUMilliseconds = number
+
+/**
+ * An integer greater than 0, reflecting the calculated size of items
+ */
+declare type LRUSize = number
+
+/**
+ * An integer greater than 0, reflecting a number of items
+ */
+declare type LRUCount = number
+
+declare class LRUCache implements Iterable<[K, V]> {
+ constructor(options: LRUCache.Options)
+
+ /**
+ * Number of items in the cache.
+ * Alias for {@link size}
+ *
+ * @deprecated since 7.0 use {@link size} instead
+ */
+ public readonly length: LRUCount
+
+ public readonly max: LRUCount
+ public readonly maxSize: LRUSize
+ public readonly maxEntrySize: LRUSize
+ public readonly sizeCalculation:
+ | LRUCache.SizeCalculator
+ | undefined
+ public readonly dispose: LRUCache.Disposer
+ /**
+ * @since 7.4.0
+ */
+ public readonly disposeAfter: LRUCache.Disposer | null
+ public readonly noDisposeOnSet: boolean
+ public readonly ttl: LRUMilliseconds
+ public readonly ttlResolution: LRUMilliseconds
+ public readonly ttlAutopurge: boolean
+ public readonly allowStale: boolean
+ public readonly updateAgeOnGet: boolean
+ /**
+ * @since 7.11.0
+ */
+ public readonly noDeleteOnStaleGet: boolean
+ /**
+ * @since 7.6.0
+ */
+ public readonly fetchMethod: LRUCache.Fetcher | null
+
+ /**
+ * The total number of items held in the cache at the current moment.
+ */
+ public readonly size: LRUCount
+
+ /**
+ * The total size of items in cache when using size tracking.
+ */
+ public readonly calculatedSize: LRUSize
+
+ /**
+ * Add a value to the cache.
+ */
+ public set(
+ key: K,
+ value: V,
+ options?: LRUCache.SetOptions
+ ): this
+
+ /**
+ * Return a value from the cache. Will update the recency of the cache entry
+ * found.
+ *
+ * If the key is not found, {@link get} will return `undefined`. This can be
+ * confusing when setting values specifically to `undefined`, as in
+ * `cache.set(key, undefined)`. Use {@link has} to determine whether a key is
+ * present in the cache at all.
+ */
+ public get(key: K, options?: LRUCache.GetOptions): V | undefined
+
+ /**
+ * Like {@link get} but doesn't update recency or delete stale items.
+ * Returns `undefined` if the item is stale, unless {@link allowStale} is set
+ * either on the cache or in the options object.
+ */
+ public peek(key: K, options?: LRUCache.PeekOptions): V | undefined
+
+ /**
+ * Check if a key is in the cache, without updating the recency of use.
+ * Will return false if the item is stale, even though it is technically
+ * in the cache.
+ *
+ * Will not update item age unless {@link updateAgeOnHas} is set in the
+ * options or constructor.
+ */
+ public has(key: K, options?: LRUCache.HasOptions): boolean
+
+ /**
+ * Deletes a key out of the cache.
+ * Returns true if the key was deleted, false otherwise.
+ */
+ public delete(key: K): boolean
+
+ /**
+ * Clear the cache entirely, throwing away all values.
+ */
+ public clear(): void
+
+ /**
+ * Delete any stale entries. Returns true if anything was removed, false
+ * otherwise.
+ */
+ public purgeStale(): boolean
+
+ /**
+ * Find a value for which the supplied fn method returns a truthy value,
+ * similar to Array.find(). fn is called as fn(value, key, cache).
+ */
+ public find(
+ callbackFn: (
+ value: V,
+ key: K,
+ cache: this
+ ) => boolean | undefined | void,
+ options?: LRUCache.GetOptions
+ ): V | undefined
+
+ /**
+ * Call the supplied function on each item in the cache, in order from
+ * most recently used to least recently used. fn is called as
+ * fn(value, key, cache). Does not update age or recenty of use.
+ */
+ public forEach(
+ callbackFn: (this: T, value: V, key: K, cache: this) => void,
+ thisArg?: T
+ ): void
+
+ /**
+ * The same as {@link forEach} but items are iterated over in reverse
+ * order. (ie, less recently used items are iterated over first.)
+ */
+ public rforEach(
+ callbackFn: (this: T, value: V, key: K, cache: this) => void,
+ thisArg?: T
+ ): void
+
+ /**
+ * Return a generator yielding the keys in the cache,
+ * in order from most recently used to least recently used.
+ */
+ public keys(): Generator
+
+ /**
+ * Inverse order version of {@link keys}
+ *
+ * Return a generator yielding the keys in the cache,
+ * in order from least recently used to most recently used.
+ */
+ public rkeys(): Generator
+
+ /**
+ * Return a generator yielding the values in the cache,
+ * in order from most recently used to least recently used.
+ */
+ public values(): Generator
+
+ /**
+ * Inverse order version of {@link values}
+ *
+ * Return a generator yielding the values in the cache,
+ * in order from least recently used to most recently used.
+ */
+ public rvalues(): Generator
+
+ /**
+ * Return a generator yielding `[key, value]` pairs,
+ * in order from most recently used to least recently used.
+ */
+ public entries(): Generator<[K, V], void, void>
+
+ /**
+ * Inverse order version of {@link entries}
+ *
+ * Return a generator yielding `[key, value]` pairs,
+ * in order from least recently used to most recently used.
+ */
+ public rentries(): Generator<[K, V], void, void>
+
+ /**
+ * Iterating over the cache itself yields the same results as
+ * {@link entries}
+ */
+ public [Symbol.iterator](): Generator<[K, V], void, void>
+
+ /**
+ * Return an array of [key, entry] objects which can be passed to
+ * cache.load()
+ */
+ public dump(): Array<[K, LRUCache.Entry]>
+
+ /**
+ * Reset the cache and load in the items in entries in the order listed.
+ * Note that the shape of the resulting cache may be different if the
+ * same options are not used in both caches.
+ */
+ public load(
+ cacheEntries: ReadonlyArray<[K, LRUCache.Entry]>
+ ): void
+
+ /**
+ * Evict the least recently used item, returning its value or `undefined`
+ * if cache is empty.
+ */
+ public pop(): V | undefined
+
+ /**
+ * Deletes a key out of the cache.
+ *
+ * @deprecated since 7.0 use delete() instead
+ */
+ public del(key: K): boolean
+
+ /**
+ * Clear the cache entirely, throwing away all values.
+ *
+ * @deprecated since 7.0 use clear() instead
+ */
+ public reset(): void
+
+ /**
+ * Manually iterates over the entire cache proactively pruning old entries.
+ *
+ * @deprecated since 7.0 use purgeStale() instead
+ */
+ public prune(): boolean
+
+ /**
+ * Make an asynchronous cached fetch using the {@link fetchMethod} function.
+ *
+ * If multiple fetches for the same key are issued, then they will all be
+ * coalesced into a single call to fetchMethod.
+ *
+ * Note that this means that handling options such as
+ * {@link allowStaleOnFetchAbort}, {@link signal}, and
+ * {@link allowStaleOnFetchRejection} will be determined by the FIRST fetch()
+ * call for a given key.
+ *
+ * This is a known (fixable) shortcoming which will be addresed on when
+ * someone complains about it, as the fix would involve added complexity and
+ * may not be worth the costs for this edge case.
+ *
+ * since: 7.6.0
+ */
+ public fetch(
+ key: K,
+ options?: LRUCache.FetchOptions
+ ): Promise
+
+ /**
+ * since: 7.6.0
+ */
+ public getRemainingTTL(key: K): LRUMilliseconds
+}
+
+declare namespace LRUCache {
+ type DisposeReason = 'evict' | 'set' | 'delete'
+
+ type SizeCalculator = (value: V, key: K) => LRUSize
+ type Disposer = (
+ value: V,
+ key: K,
+ reason: DisposeReason
+ ) => void
+ type Fetcher = (
+ key: K,
+ staleValue: V | undefined,
+ options: FetcherOptions
+ ) => Promise | V | void | undefined
+
+ interface DeprecatedOptions {
+ /**
+ * alias for ttl
+ *
+ * @deprecated since 7.0 use options.ttl instead
+ */
+ maxAge?: LRUMilliseconds
+
+ /**
+ * alias for {@link sizeCalculation}
+ *
+ * @deprecated since 7.0 use {@link sizeCalculation} instead
+ */
+ length?: SizeCalculator
+
+ /**
+ * alias for allowStale
+ *
+ * @deprecated since 7.0 use options.allowStale instead
+ */
+ stale?: boolean
+ }
+
+ interface LimitedByCount {
+ /**
+ * The number of most recently used items to keep.
+ * Note that we may store fewer items than this if maxSize is hit.
+ */
+ max: LRUCount
+ }
+
+ type MaybeMaxEntrySizeLimit =
+ | {
+ /**
+ * The maximum allowed size for any single item in the cache.
+ *
+ * If a larger item is passed to {@link set} or returned by a
+ * {@link fetchMethod}, then it will not be stored in the cache.
+ */
+ maxEntrySize: LRUSize
+ sizeCalculation?: SizeCalculator
+ }
+ | {}
+
+ interface LimitedBySize {
+ /**
+ * If you wish to track item size, you must provide a maxSize
+ * note that we still will only keep up to max *actual items*,
+ * if max is set, so size tracking may cause fewer than max items
+ * to be stored. At the extreme, a single item of maxSize size
+ * will cause everything else in the cache to be dropped when it
+ * is added. Use with caution!
+ *
+ * Note also that size tracking can negatively impact performance,
+ * though for most cases, only minimally.
+ */
+ maxSize: LRUSize
+
+ /**
+ * Function to calculate size of items. Useful if storing strings or
+ * buffers or other items where memory size depends on the object itself.
+ *
+ * Items larger than {@link maxEntrySize} will not be stored in the cache.
+ *
+ * Note that when {@link maxSize} or {@link maxEntrySize} are set, every
+ * item added MUST have a size specified, either via a `sizeCalculation` in
+ * the constructor, or `sizeCalculation` or {@link size} options to
+ * {@link set}.
+ */
+ sizeCalculation?: SizeCalculator
+ }
+
+ interface LimitedByTTL {
+ /**
+ * Max time in milliseconds for items to live in cache before they are
+ * considered stale. Note that stale items are NOT preemptively removed
+ * by default, and MAY live in the cache, contributing to its LRU max,
+ * long after they have expired.
+ *
+ * Also, as this cache is optimized for LRU/MRU operations, some of
+ * the staleness/TTL checks will reduce performance, as they will incur
+ * overhead by deleting items.
+ *
+ * Must be an integer number of ms, defaults to 0, which means "no TTL"
+ */
+ ttl: LRUMilliseconds
+
+ /**
+ * Boolean flag to tell the cache to not update the TTL when
+ * setting a new value for an existing key (ie, when updating a value
+ * rather than inserting a new value). Note that the TTL value is
+ * _always_ set (if provided) when adding a new entry into the cache.
+ *
+ * @default false
+ * @since 7.4.0
+ */
+ noUpdateTTL?: boolean
+
+ /**
+ * Minimum amount of time in ms in which to check for staleness.
+ * Defaults to 1, which means that the current time is checked
+ * at most once per millisecond.
+ *
+ * Set to 0 to check the current time every time staleness is tested.
+ * (This reduces performance, and is theoretically unnecessary.)
+ *
+ * Setting this to a higher value will improve performance somewhat
+ * while using ttl tracking, albeit at the expense of keeping stale
+ * items around a bit longer than their TTLs would indicate.
+ *
+ * @default 1
+ * @since 7.1.0
+ */
+ ttlResolution?: LRUMilliseconds
+
+ /**
+ * Preemptively remove stale items from the cache.
+ * Note that this may significantly degrade performance,
+ * especially if the cache is storing a large number of items.
+ * It is almost always best to just leave the stale items in
+ * the cache, and let them fall out as new items are added.
+ *
+ * Note that this means that {@link allowStale} is a bit pointless,
+ * as stale items will be deleted almost as soon as they expire.
+ *
+ * Use with caution!
+ *
+ * @default false
+ * @since 7.1.0
+ */
+ ttlAutopurge?: boolean
+
+ /**
+ * Return stale items from {@link get} before disposing of them.
+ * Return stale values from {@link fetch} while performing a call
+ * to the {@link fetchMethod} in the background.
+ *
+ * @default false
+ */
+ allowStale?: boolean
+
+ /**
+ * Update the age of items on {@link get}, renewing their TTL
+ *
+ * @default false
+ */
+ updateAgeOnGet?: boolean
+
+ /**
+ * Do not delete stale items when they are retrieved with {@link get}.
+ * Note that the {@link get} return value will still be `undefined` unless
+ * allowStale is true.
+ *
+ * @default false
+ * @since 7.11.0
+ */
+ noDeleteOnStaleGet?: boolean
+
+ /**
+ * Update the age of items on {@link has}, renewing their TTL
+ *
+ * @default false
+ */
+ updateAgeOnHas?: boolean
+ }
+
+ type SafetyBounds =
+ | LimitedByCount
+ | LimitedBySize
+ | LimitedByTTL
+
+ // options shared by all three of the limiting scenarios
+ interface SharedOptions {
+ /**
+ * Function that is called on items when they are dropped from the cache.
+ * This can be handy if you want to close file descriptors or do other
+ * cleanup tasks when items are no longer accessible. Called with `key,
+ * value`. It's called before actually removing the item from the
+ * internal cache, so it is *NOT* safe to re-add them.
+ * Use {@link disposeAfter} if you wish to dispose items after they have
+ * been full removed, when it is safe to add them back to the cache.
+ */
+ dispose?: Disposer
+
+ /**
+ * The same as dispose, but called *after* the entry is completely
+ * removed and the cache is once again in a clean state. It is safe to
+ * add an item right back into the cache at this point.
+ * However, note that it is *very* easy to inadvertently create infinite
+ * recursion this way.
+ *
+ * @since 7.3.0
+ */
+ disposeAfter?: Disposer
+
+ /**
+ * Set to true to suppress calling the dispose() function if the entry
+ * key is still accessible within the cache.
+ * This may be overridden by passing an options object to {@link set}.
+ *
+ * @default false
+ */
+ noDisposeOnSet?: boolean
+
+ /**
+ * Function that is used to make background asynchronous fetches. Called
+ * with `fetchMethod(key, staleValue, { signal, options, context })`.
+ *
+ * If `fetchMethod` is not provided, then {@link fetch} is
+ * equivalent to `Promise.resolve(cache.get(key))`.
+ *
+ * The `fetchMethod` should ONLY return `undefined` in cases where the
+ * abort controller has sent an abort signal.
+ *
+ * @since 7.6.0
+ */
+ fetchMethod?: LRUCache.Fetcher
+
+ /**
+ * Set to true to suppress the deletion of stale data when a
+ * {@link fetchMethod} throws an error or returns a rejected promise
+ *
+ * This may be overridden in the {@link fetchMethod}.
+ *
+ * @default false
+ * @since 7.10.0
+ */
+ noDeleteOnFetchRejection?: boolean
+
+ /**
+ * Set to true to allow returning stale data when a {@link fetchMethod}
+ * throws an error or returns a rejected promise. Note that this
+ * differs from using {@link allowStale} in that stale data will
+ * ONLY be returned in the case that the fetch fails, not any other
+ * times.
+ *
+ * This may be overridden in the {@link fetchMethod}.
+ *
+ * @default false
+ * @since 7.16.0
+ */
+ allowStaleOnFetchRejection?: boolean
+
+ /**
+ *
+ * Set to true to ignore the `abort` event emitted by the `AbortSignal`
+ * object passed to {@link fetchMethod}, and still cache the
+ * resulting resolution value, as long as it is not `undefined`.
+ *
+ * When used on its own, this means aborted {@link fetch} calls are not
+ * immediately resolved or rejected when they are aborted, and instead take
+ * the full time to await.
+ *
+ * When used with {@link allowStaleOnFetchAbort}, aborted {@link fetch}
+ * calls will resolve immediately to their stale cached value or
+ * `undefined`, and will continue to process and eventually update the
+ * cache when they resolve, as long as the resulting value is not
+ * `undefined`, thus supporting a "return stale on timeout while
+ * refreshing" mechanism by passing `AbortSignal.timeout(n)` as the signal.
+ *
+ * **Note**: regardless of this setting, an `abort` event _is still emitted
+ * on the `AbortSignal` object_, so may result in invalid results when
+ * passed to other underlying APIs that use AbortSignals.
+ *
+ * This may be overridden in the {@link fetchMethod} or the call to
+ * {@link fetch}.
+ *
+ * @default false
+ * @since 7.17.0
+ */
+ ignoreFetchAbort?: boolean
+
+ /**
+ * Set to true to return a stale value from the cache when the
+ * `AbortSignal` passed to the {@link fetchMethod} dispatches an `'abort'`
+ * event, whether user-triggered, or due to internal cache behavior.
+ *
+ * Unless {@link ignoreFetchAbort} is also set, the underlying
+ * {@link fetchMethod} will still be considered canceled, and its return
+ * value will be ignored and not cached.
+ *
+ * This may be overridden in the {@link fetchMethod} or the call to
+ * {@link fetch}.
+ *
+ * @default false
+ * @since 7.17.0
+ */
+ allowStaleOnFetchAbort?: boolean
+
+ /**
+ * Set to any value in the constructor or {@link fetch} options to
+ * pass arbitrary data to the {@link fetchMethod} in the {@link context}
+ * options field.
+ *
+ * @since 7.12.0
+ */
+ fetchContext?: any
+ }
+
+ type Options = SharedOptions &
+ DeprecatedOptions &
+ SafetyBounds &
+ MaybeMaxEntrySizeLimit
+
+ /**
+ * options which override the options set in the LRUCache constructor
+ * when making calling {@link set}.
+ */
+ interface SetOptions {
+ /**
+ * A value for the size of the entry, prevents calls to
+ * {@link sizeCalculation}.
+ *
+ * Items larger than {@link maxEntrySize} will not be stored in the cache.
+ *
+ * Note that when {@link maxSize} or {@link maxEntrySize} are set, every
+ * item added MUST have a size specified, either via a `sizeCalculation` in
+ * the constructor, or {@link sizeCalculation} or `size` options to
+ * {@link set}.
+ */
+ size?: LRUSize
+ /**
+ * Overrides the {@link sizeCalculation} method set in the constructor.
+ *
+ * Items larger than {@link maxEntrySize} will not be stored in the cache.
+ *
+ * Note that when {@link maxSize} or {@link maxEntrySize} are set, every
+ * item added MUST have a size specified, either via a `sizeCalculation` in
+ * the constructor, or `sizeCalculation` or {@link size} options to
+ * {@link set}.
+ */
+ sizeCalculation?: SizeCalculator
+ ttl?: LRUMilliseconds
+ start?: LRUMilliseconds
+ noDisposeOnSet?: boolean
+ noUpdateTTL?: boolean
+ status?: Status
+ }
+
+ /**
+ * options which override the options set in the LRUCAche constructor
+ * when calling {@link has}.
+ */
+ interface HasOptions {
+ updateAgeOnHas?: boolean
+ status: Status
+ }
+
+ /**
+ * options which override the options set in the LRUCache constructor
+ * when calling {@link get}.
+ */
+ interface GetOptions {
+ allowStale?: boolean
+ updateAgeOnGet?: boolean
+ noDeleteOnStaleGet?: boolean
+ status?: Status
+ }
+
+ /**
+ * options which override the options set in the LRUCache constructor
+ * when calling {@link peek}.
+ */
+ interface PeekOptions {
+ allowStale?: boolean
+ }
+
+ /**
+ * Options object passed to the {@link fetchMethod}
+ *
+ * May be mutated by the {@link fetchMethod} to affect the behavior of the
+ * resulting {@link set} operation on resolution, or in the case of
+ * {@link noDeleteOnFetchRejection}, {@link ignoreFetchAbort}, and
+ * {@link allowStaleOnFetchRejection}, the handling of failure.
+ */
+ interface FetcherFetchOptions {
+ allowStale?: boolean
+ updateAgeOnGet?: boolean
+ noDeleteOnStaleGet?: boolean
+ size?: LRUSize
+ sizeCalculation?: SizeCalculator
+ ttl?: LRUMilliseconds
+ noDisposeOnSet?: boolean
+ noUpdateTTL?: boolean
+ noDeleteOnFetchRejection?: boolean
+ allowStaleOnFetchRejection?: boolean
+ ignoreFetchAbort?: boolean
+ allowStaleOnFetchAbort?: boolean
+ status?: Status
+ }
+
+ /**
+ * Status object that may be passed to {@link fetch}, {@link get},
+ * {@link set}, and {@link has}.
+ */
+ interface Status {
+ /**
+ * The status of a set() operation.
+ *
+ * - add: the item was not found in the cache, and was added
+ * - update: the item was in the cache, with the same value provided
+ * - replace: the item was in the cache, and replaced
+ * - miss: the item was not added to the cache for some reason
+ */
+ set?: 'add' | 'update' | 'replace' | 'miss'
+
+ /**
+ * the ttl stored for the item, or undefined if ttls are not used.
+ */
+ ttl?: LRUMilliseconds
+
+ /**
+ * the start time for the item, or undefined if ttls are not used.
+ */
+ start?: LRUMilliseconds
+
+ /**
+ * The timestamp used for TTL calculation
+ */
+ now?: LRUMilliseconds
+
+ /**
+ * the remaining ttl for the item, or undefined if ttls are not used.
+ */
+ remainingTTL?: LRUMilliseconds
+
+ /**
+ * The calculated size for the item, if sizes are used.
+ */
+ size?: LRUSize
+
+ /**
+ * A flag indicating that the item was not stored, due to exceeding the
+ * {@link maxEntrySize}
+ */
+ maxEntrySizeExceeded?: true
+
+ /**
+ * The old value, specified in the case of `set:'update'` or
+ * `set:'replace'`
+ */
+ oldValue?: V
+
+ /**
+ * The results of a {@link has} operation
+ *
+ * - hit: the item was found in the cache
+ * - stale: the item was found in the cache, but is stale
+ * - miss: the item was not found in the cache
+ */
+ has?: 'hit' | 'stale' | 'miss'
+
+ /**
+ * The status of a {@link fetch} operation.
+ * Note that this can change as the underlying fetch() moves through
+ * various states.
+ *
+ * - inflight: there is another fetch() for this key which is in process
+ * - get: there is no fetchMethod, so {@link get} was called.
+ * - miss: the item is not in cache, and will be fetched.
+ * - hit: the item is in the cache, and was resolved immediately.
+ * - stale: the item is in the cache, but stale.
+ * - refresh: the item is in the cache, and not stale, but
+ * {@link forceRefresh} was specified.
+ */
+ fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
+
+ /**
+ * The {@link fetchMethod} was called
+ */
+ fetchDispatched?: true
+
+ /**
+ * The cached value was updated after a successful call to fetchMethod
+ */
+ fetchUpdated?: true
+
+ /**
+ * The reason for a fetch() rejection. Either the error raised by the
+ * {@link fetchMethod}, or the reason for an AbortSignal.
+ */
+ fetchError?: Error
+
+ /**
+ * The fetch received an abort signal
+ */
+ fetchAborted?: true
+
+ /**
+ * The abort signal received was ignored, and the fetch was allowed to
+ * continue.
+ */
+ fetchAbortIgnored?: true
+
+ /**
+ * The fetchMethod promise resolved successfully
+ */
+ fetchResolved?: true
+
+ /**
+ * The fetchMethod promise was rejected
+ */
+ fetchRejected?: true
+
+ /**
+ * The status of a {@link get} operation.
+ *
+ * - fetching: The item is currently being fetched. If a previous value is
+ * present and allowed, that will be returned.
+ * - stale: The item is in the cache, and is stale.
+ * - hit: the item is in the cache
+ * - miss: the item is not in the cache
+ */
+ get?: 'stale' | 'hit' | 'miss'
+
+ /**
+ * A fetch or get operation returned a stale value.
+ */
+ returnedStale?: true
+ }
+
+ /**
+ * options which override the options set in the LRUCache constructor
+ * when calling {@link fetch}.
+ *
+ * This is the union of GetOptions and SetOptions, plus
+ * {@link noDeleteOnFetchRejection}, {@link allowStaleOnFetchRejection},
+ * {@link forceRefresh}, and {@link fetchContext}
+ */
+ interface FetchOptions extends FetcherFetchOptions {
+ forceRefresh?: boolean
+ fetchContext?: any
+ signal?: AbortSignal
+ status?: Status
+ }
+
+ interface FetcherOptions {
+ signal: AbortSignal
+ options: FetcherFetchOptions
+ /**
+ * Object provided in the {@link fetchContext} option
+ */
+ context: any
+ }
+
+ interface Entry {
+ value: V
+ ttl?: LRUMilliseconds
+ size?: LRUSize
+ start?: LRUMilliseconds
+ }
+}
+
+export = LRUCache
diff --git a/EmployeeManagementBackend/node_modules/lru-cache/index.js b/EmployeeManagementBackend/node_modules/lru-cache/index.js
new file mode 100644
index 0000000..48e99fe
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru-cache/index.js
@@ -0,0 +1,1227 @@
+const perf =
+ typeof performance === 'object' &&
+ performance &&
+ typeof performance.now === 'function'
+ ? performance
+ : Date
+
+const hasAbortController = typeof AbortController === 'function'
+
+// minimal backwards-compatibility polyfill
+// this doesn't have nearly all the checks and whatnot that
+// actual AbortController/Signal has, but it's enough for
+// our purposes, and if used properly, behaves the same.
+const AC = hasAbortController
+ ? AbortController
+ : class AbortController {
+ constructor() {
+ this.signal = new AS()
+ }
+ abort(reason = new Error('This operation was aborted')) {
+ this.signal.reason = this.signal.reason || reason
+ this.signal.aborted = true
+ this.signal.dispatchEvent({
+ type: 'abort',
+ target: this.signal,
+ })
+ }
+ }
+
+const hasAbortSignal = typeof AbortSignal === 'function'
+// Some polyfills put this on the AC class, not global
+const hasACAbortSignal = typeof AC.AbortSignal === 'function'
+const AS = hasAbortSignal
+ ? AbortSignal
+ : hasACAbortSignal
+ ? AC.AbortController
+ : class AbortSignal {
+ constructor() {
+ this.reason = undefined
+ this.aborted = false
+ this._listeners = []
+ }
+ dispatchEvent(e) {
+ if (e.type === 'abort') {
+ this.aborted = true
+ this.onabort(e)
+ this._listeners.forEach(f => f(e), this)
+ }
+ }
+ onabort() {}
+ addEventListener(ev, fn) {
+ if (ev === 'abort') {
+ this._listeners.push(fn)
+ }
+ }
+ removeEventListener(ev, fn) {
+ if (ev === 'abort') {
+ this._listeners = this._listeners.filter(f => f !== fn)
+ }
+ }
+ }
+
+const warned = new Set()
+const deprecatedOption = (opt, instead) => {
+ const code = `LRU_CACHE_OPTION_${opt}`
+ if (shouldWarn(code)) {
+ warn(code, `${opt} option`, `options.${instead}`, LRUCache)
+ }
+}
+const deprecatedMethod = (method, instead) => {
+ const code = `LRU_CACHE_METHOD_${method}`
+ if (shouldWarn(code)) {
+ const { prototype } = LRUCache
+ const { get } = Object.getOwnPropertyDescriptor(prototype, method)
+ warn(code, `${method} method`, `cache.${instead}()`, get)
+ }
+}
+const deprecatedProperty = (field, instead) => {
+ const code = `LRU_CACHE_PROPERTY_${field}`
+ if (shouldWarn(code)) {
+ const { prototype } = LRUCache
+ const { get } = Object.getOwnPropertyDescriptor(prototype, field)
+ warn(code, `${field} property`, `cache.${instead}`, get)
+ }
+}
+
+const emitWarning = (...a) => {
+ typeof process === 'object' &&
+ process &&
+ typeof process.emitWarning === 'function'
+ ? process.emitWarning(...a)
+ : console.error(...a)
+}
+
+const shouldWarn = code => !warned.has(code)
+
+const warn = (code, what, instead, fn) => {
+ warned.add(code)
+ const msg = `The ${what} is deprecated. Please use ${instead} instead.`
+ emitWarning(msg, 'DeprecationWarning', code, fn)
+}
+
+const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
+
+/* istanbul ignore next - This is a little bit ridiculous, tbh.
+ * The maximum array length is 2^32-1 or thereabouts on most JS impls.
+ * And well before that point, you're caching the entire world, I mean,
+ * that's ~32GB of just integers for the next/prev links, plus whatever
+ * else to hold that many keys and values. Just filling the memory with
+ * zeroes at init time is brutal when you get that big.
+ * But why not be complete?
+ * Maybe in the future, these limits will have expanded. */
+const getUintArray = max =>
+ !isPosInt(max)
+ ? null
+ : max <= Math.pow(2, 8)
+ ? Uint8Array
+ : max <= Math.pow(2, 16)
+ ? Uint16Array
+ : max <= Math.pow(2, 32)
+ ? Uint32Array
+ : max <= Number.MAX_SAFE_INTEGER
+ ? ZeroArray
+ : null
+
+class ZeroArray extends Array {
+ constructor(size) {
+ super(size)
+ this.fill(0)
+ }
+}
+
+class Stack {
+ constructor(max) {
+ if (max === 0) {
+ return []
+ }
+ const UintArray = getUintArray(max)
+ this.heap = new UintArray(max)
+ this.length = 0
+ }
+ push(n) {
+ this.heap[this.length++] = n
+ }
+ pop() {
+ return this.heap[--this.length]
+ }
+}
+
+class LRUCache {
+ constructor(options = {}) {
+ const {
+ max = 0,
+ ttl,
+ ttlResolution = 1,
+ ttlAutopurge,
+ updateAgeOnGet,
+ updateAgeOnHas,
+ allowStale,
+ dispose,
+ disposeAfter,
+ noDisposeOnSet,
+ noUpdateTTL,
+ maxSize = 0,
+ maxEntrySize = 0,
+ sizeCalculation,
+ fetchMethod,
+ fetchContext,
+ noDeleteOnFetchRejection,
+ noDeleteOnStaleGet,
+ allowStaleOnFetchRejection,
+ allowStaleOnFetchAbort,
+ ignoreFetchAbort,
+ } = options
+
+ // deprecated options, don't trigger a warning for getting them if
+ // the thing being passed in is another LRUCache we're copying.
+ const { length, maxAge, stale } =
+ options instanceof LRUCache ? {} : options
+
+ if (max !== 0 && !isPosInt(max)) {
+ throw new TypeError('max option must be a nonnegative integer')
+ }
+
+ const UintArray = max ? getUintArray(max) : Array
+ if (!UintArray) {
+ throw new Error('invalid max value: ' + max)
+ }
+
+ this.max = max
+ this.maxSize = maxSize
+ this.maxEntrySize = maxEntrySize || this.maxSize
+ this.sizeCalculation = sizeCalculation || length
+ if (this.sizeCalculation) {
+ if (!this.maxSize && !this.maxEntrySize) {
+ throw new TypeError(
+ 'cannot set sizeCalculation without setting maxSize or maxEntrySize'
+ )
+ }
+ if (typeof this.sizeCalculation !== 'function') {
+ throw new TypeError('sizeCalculation set to non-function')
+ }
+ }
+
+ this.fetchMethod = fetchMethod || null
+ if (this.fetchMethod && typeof this.fetchMethod !== 'function') {
+ throw new TypeError(
+ 'fetchMethod must be a function if specified'
+ )
+ }
+
+ this.fetchContext = fetchContext
+ if (!this.fetchMethod && fetchContext !== undefined) {
+ throw new TypeError(
+ 'cannot set fetchContext without fetchMethod'
+ )
+ }
+
+ this.keyMap = new Map()
+ this.keyList = new Array(max).fill(null)
+ this.valList = new Array(max).fill(null)
+ this.next = new UintArray(max)
+ this.prev = new UintArray(max)
+ this.head = 0
+ this.tail = 0
+ this.free = new Stack(max)
+ this.initialFill = 1
+ this.size = 0
+
+ if (typeof dispose === 'function') {
+ this.dispose = dispose
+ }
+ if (typeof disposeAfter === 'function') {
+ this.disposeAfter = disposeAfter
+ this.disposed = []
+ } else {
+ this.disposeAfter = null
+ this.disposed = null
+ }
+ this.noDisposeOnSet = !!noDisposeOnSet
+ this.noUpdateTTL = !!noUpdateTTL
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort
+ this.ignoreFetchAbort = !!ignoreFetchAbort
+
+ // NB: maxEntrySize is set to maxSize if it's set
+ if (this.maxEntrySize !== 0) {
+ if (this.maxSize !== 0) {
+ if (!isPosInt(this.maxSize)) {
+ throw new TypeError(
+ 'maxSize must be a positive integer if specified'
+ )
+ }
+ }
+ if (!isPosInt(this.maxEntrySize)) {
+ throw new TypeError(
+ 'maxEntrySize must be a positive integer if specified'
+ )
+ }
+ this.initializeSizeTracking()
+ }
+
+ this.allowStale = !!allowStale || !!stale
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet
+ this.updateAgeOnGet = !!updateAgeOnGet
+ this.updateAgeOnHas = !!updateAgeOnHas
+ this.ttlResolution =
+ isPosInt(ttlResolution) || ttlResolution === 0
+ ? ttlResolution
+ : 1
+ this.ttlAutopurge = !!ttlAutopurge
+ this.ttl = ttl || maxAge || 0
+ if (this.ttl) {
+ if (!isPosInt(this.ttl)) {
+ throw new TypeError(
+ 'ttl must be a positive integer if specified'
+ )
+ }
+ this.initializeTTLTracking()
+ }
+
+ // do not allow completely unbounded caches
+ if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
+ throw new TypeError(
+ 'At least one of max, maxSize, or ttl is required'
+ )
+ }
+ if (!this.ttlAutopurge && !this.max && !this.maxSize) {
+ const code = 'LRU_CACHE_UNBOUNDED'
+ if (shouldWarn(code)) {
+ warned.add(code)
+ const msg =
+ 'TTL caching without ttlAutopurge, max, or maxSize can ' +
+ 'result in unbounded memory consumption.'
+ emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache)
+ }
+ }
+
+ if (stale) {
+ deprecatedOption('stale', 'allowStale')
+ }
+ if (maxAge) {
+ deprecatedOption('maxAge', 'ttl')
+ }
+ if (length) {
+ deprecatedOption('length', 'sizeCalculation')
+ }
+ }
+
+ getRemainingTTL(key) {
+ return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0
+ }
+
+ initializeTTLTracking() {
+ this.ttls = new ZeroArray(this.max)
+ this.starts = new ZeroArray(this.max)
+
+ this.setItemTTL = (index, ttl, start = perf.now()) => {
+ this.starts[index] = ttl !== 0 ? start : 0
+ this.ttls[index] = ttl
+ if (ttl !== 0 && this.ttlAutopurge) {
+ const t = setTimeout(() => {
+ if (this.isStale(index)) {
+ this.delete(this.keyList[index])
+ }
+ }, ttl + 1)
+ /* istanbul ignore else - unref() not supported on all platforms */
+ if (t.unref) {
+ t.unref()
+ }
+ }
+ }
+
+ this.updateItemAge = index => {
+ this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
+ }
+
+ this.statusTTL = (status, index) => {
+ if (status) {
+ status.ttl = this.ttls[index]
+ status.start = this.starts[index]
+ status.now = cachedNow || getNow()
+ status.remainingTTL = status.now + status.ttl - status.start
+ }
+ }
+
+ // debounce calls to perf.now() to 1s so we're not hitting
+ // that costly call repeatedly.
+ let cachedNow = 0
+ const getNow = () => {
+ const n = perf.now()
+ if (this.ttlResolution > 0) {
+ cachedNow = n
+ const t = setTimeout(
+ () => (cachedNow = 0),
+ this.ttlResolution
+ )
+ /* istanbul ignore else - not available on all platforms */
+ if (t.unref) {
+ t.unref()
+ }
+ }
+ return n
+ }
+
+ this.getRemainingTTL = key => {
+ const index = this.keyMap.get(key)
+ if (index === undefined) {
+ return 0
+ }
+ return this.ttls[index] === 0 || this.starts[index] === 0
+ ? Infinity
+ : this.starts[index] +
+ this.ttls[index] -
+ (cachedNow || getNow())
+ }
+
+ this.isStale = index => {
+ return (
+ this.ttls[index] !== 0 &&
+ this.starts[index] !== 0 &&
+ (cachedNow || getNow()) - this.starts[index] >
+ this.ttls[index]
+ )
+ }
+ }
+ updateItemAge(_index) {}
+ statusTTL(_status, _index) {}
+ setItemTTL(_index, _ttl, _start) {}
+ isStale(_index) {
+ return false
+ }
+
+ initializeSizeTracking() {
+ this.calculatedSize = 0
+ this.sizes = new ZeroArray(this.max)
+ this.removeItemSize = index => {
+ this.calculatedSize -= this.sizes[index]
+ this.sizes[index] = 0
+ }
+ this.requireSize = (k, v, size, sizeCalculation) => {
+ // provisionally accept background fetches.
+ // actual value size will be checked when they return.
+ if (this.isBackgroundFetch(v)) {
+ return 0
+ }
+ if (!isPosInt(size)) {
+ if (sizeCalculation) {
+ if (typeof sizeCalculation !== 'function') {
+ throw new TypeError('sizeCalculation must be a function')
+ }
+ size = sizeCalculation(v, k)
+ if (!isPosInt(size)) {
+ throw new TypeError(
+ 'sizeCalculation return invalid (expect positive integer)'
+ )
+ }
+ } else {
+ throw new TypeError(
+ 'invalid size value (must be positive integer). ' +
+ 'When maxSize or maxEntrySize is used, sizeCalculation or size ' +
+ 'must be set.'
+ )
+ }
+ }
+ return size
+ }
+ this.addItemSize = (index, size, status) => {
+ this.sizes[index] = size
+ if (this.maxSize) {
+ const maxSize = this.maxSize - this.sizes[index]
+ while (this.calculatedSize > maxSize) {
+ this.evict(true)
+ }
+ }
+ this.calculatedSize += this.sizes[index]
+ if (status) {
+ status.entrySize = size
+ status.totalCalculatedSize = this.calculatedSize
+ }
+ }
+ }
+ removeItemSize(_index) {}
+ addItemSize(_index, _size) {}
+ requireSize(_k, _v, size, sizeCalculation) {
+ if (size || sizeCalculation) {
+ throw new TypeError(
+ 'cannot set size without setting maxSize or maxEntrySize on cache'
+ )
+ }
+ }
+
+ *indexes({ allowStale = this.allowStale } = {}) {
+ if (this.size) {
+ for (let i = this.tail; true; ) {
+ if (!this.isValidIndex(i)) {
+ break
+ }
+ if (allowStale || !this.isStale(i)) {
+ yield i
+ }
+ if (i === this.head) {
+ break
+ } else {
+ i = this.prev[i]
+ }
+ }
+ }
+ }
+
+ *rindexes({ allowStale = this.allowStale } = {}) {
+ if (this.size) {
+ for (let i = this.head; true; ) {
+ if (!this.isValidIndex(i)) {
+ break
+ }
+ if (allowStale || !this.isStale(i)) {
+ yield i
+ }
+ if (i === this.tail) {
+ break
+ } else {
+ i = this.next[i]
+ }
+ }
+ }
+ }
+
+ isValidIndex(index) {
+ return (
+ index !== undefined &&
+ this.keyMap.get(this.keyList[index]) === index
+ )
+ }
+
+ *entries() {
+ for (const i of this.indexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield [this.keyList[i], this.valList[i]]
+ }
+ }
+ }
+ *rentries() {
+ for (const i of this.rindexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield [this.keyList[i], this.valList[i]]
+ }
+ }
+ }
+
+ *keys() {
+ for (const i of this.indexes()) {
+ if (
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.keyList[i]
+ }
+ }
+ }
+ *rkeys() {
+ for (const i of this.rindexes()) {
+ if (
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.keyList[i]
+ }
+ }
+ }
+
+ *values() {
+ for (const i of this.indexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.valList[i]
+ }
+ }
+ }
+ *rvalues() {
+ for (const i of this.rindexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.valList[i]
+ }
+ }
+ }
+
+ [Symbol.iterator]() {
+ return this.entries()
+ }
+
+ find(fn, getOptions) {
+ for (const i of this.indexes()) {
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ if (fn(value, this.keyList[i], this)) {
+ return this.get(this.keyList[i], getOptions)
+ }
+ }
+ }
+
+ forEach(fn, thisp = this) {
+ for (const i of this.indexes()) {
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ fn.call(thisp, value, this.keyList[i], this)
+ }
+ }
+
+ rforEach(fn, thisp = this) {
+ for (const i of this.rindexes()) {
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ fn.call(thisp, value, this.keyList[i], this)
+ }
+ }
+
+ get prune() {
+ deprecatedMethod('prune', 'purgeStale')
+ return this.purgeStale
+ }
+
+ purgeStale() {
+ let deleted = false
+ for (const i of this.rindexes({ allowStale: true })) {
+ if (this.isStale(i)) {
+ this.delete(this.keyList[i])
+ deleted = true
+ }
+ }
+ return deleted
+ }
+
+ dump() {
+ const arr = []
+ for (const i of this.indexes({ allowStale: true })) {
+ const key = this.keyList[i]
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ const entry = { value }
+ if (this.ttls) {
+ entry.ttl = this.ttls[i]
+ // always dump the start relative to a portable timestamp
+ // it's ok for this to be a bit slow, it's a rare operation.
+ const age = perf.now() - this.starts[i]
+ entry.start = Math.floor(Date.now() - age)
+ }
+ if (this.sizes) {
+ entry.size = this.sizes[i]
+ }
+ arr.unshift([key, entry])
+ }
+ return arr
+ }
+
+ load(arr) {
+ this.clear()
+ for (const [key, entry] of arr) {
+ if (entry.start) {
+ // entry.start is a portable timestamp, but we may be using
+ // node's performance.now(), so calculate the offset.
+ // it's ok for this to be a bit slow, it's a rare operation.
+ const age = Date.now() - entry.start
+ entry.start = perf.now() - age
+ }
+ this.set(key, entry.value, entry)
+ }
+ }
+
+ dispose(_v, _k, _reason) {}
+
+ set(
+ k,
+ v,
+ {
+ ttl = this.ttl,
+ start,
+ noDisposeOnSet = this.noDisposeOnSet,
+ size = 0,
+ sizeCalculation = this.sizeCalculation,
+ noUpdateTTL = this.noUpdateTTL,
+ status,
+ } = {}
+ ) {
+ size = this.requireSize(k, v, size, sizeCalculation)
+ // if the item doesn't fit, don't do anything
+ // NB: maxEntrySize set to maxSize by default
+ if (this.maxEntrySize && size > this.maxEntrySize) {
+ if (status) {
+ status.set = 'miss'
+ status.maxEntrySizeExceeded = true
+ }
+ // have to delete, in case a background fetch is there already.
+ // in non-async cases, this is a no-op
+ this.delete(k)
+ return this
+ }
+ let index = this.size === 0 ? undefined : this.keyMap.get(k)
+ if (index === undefined) {
+ // addition
+ index = this.newIndex()
+ this.keyList[index] = k
+ this.valList[index] = v
+ this.keyMap.set(k, index)
+ this.next[this.tail] = index
+ this.prev[index] = this.tail
+ this.tail = index
+ this.size++
+ this.addItemSize(index, size, status)
+ if (status) {
+ status.set = 'add'
+ }
+ noUpdateTTL = false
+ } else {
+ // update
+ this.moveToTail(index)
+ const oldVal = this.valList[index]
+ if (v !== oldVal) {
+ if (this.isBackgroundFetch(oldVal)) {
+ oldVal.__abortController.abort(new Error('replaced'))
+ } else {
+ if (!noDisposeOnSet) {
+ this.dispose(oldVal, k, 'set')
+ if (this.disposeAfter) {
+ this.disposed.push([oldVal, k, 'set'])
+ }
+ }
+ }
+ this.removeItemSize(index)
+ this.valList[index] = v
+ this.addItemSize(index, size, status)
+ if (status) {
+ status.set = 'replace'
+ const oldValue =
+ oldVal && this.isBackgroundFetch(oldVal)
+ ? oldVal.__staleWhileFetching
+ : oldVal
+ if (oldValue !== undefined) status.oldValue = oldValue
+ }
+ } else if (status) {
+ status.set = 'update'
+ }
+ }
+ if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
+ this.initializeTTLTracking()
+ }
+ if (!noUpdateTTL) {
+ this.setItemTTL(index, ttl, start)
+ }
+ this.statusTTL(status, index)
+ if (this.disposeAfter) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
+ return this
+ }
+
+ newIndex() {
+ if (this.size === 0) {
+ return this.tail
+ }
+ if (this.size === this.max && this.max !== 0) {
+ return this.evict(false)
+ }
+ if (this.free.length !== 0) {
+ return this.free.pop()
+ }
+ // initial fill, just keep writing down the list
+ return this.initialFill++
+ }
+
+ pop() {
+ if (this.size) {
+ const val = this.valList[this.head]
+ this.evict(true)
+ return val
+ }
+ }
+
+ evict(free) {
+ const head = this.head
+ const k = this.keyList[head]
+ const v = this.valList[head]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('evicted'))
+ } else {
+ this.dispose(v, k, 'evict')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'evict'])
+ }
+ }
+ this.removeItemSize(head)
+ // if we aren't about to use the index, then null these out
+ if (free) {
+ this.keyList[head] = null
+ this.valList[head] = null
+ this.free.push(head)
+ }
+ this.head = this.next[head]
+ this.keyMap.delete(k)
+ this.size--
+ return head
+ }
+
+ has(k, { updateAgeOnHas = this.updateAgeOnHas, status } = {}) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ if (!this.isStale(index)) {
+ if (updateAgeOnHas) {
+ this.updateItemAge(index)
+ }
+ if (status) status.has = 'hit'
+ this.statusTTL(status, index)
+ return true
+ } else if (status) {
+ status.has = 'stale'
+ this.statusTTL(status, index)
+ }
+ } else if (status) {
+ status.has = 'miss'
+ }
+ return false
+ }
+
+ // like get(), but without any LRU updating or TTL expiration
+ peek(k, { allowStale = this.allowStale } = {}) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined && (allowStale || !this.isStale(index))) {
+ const v = this.valList[index]
+ // either stale and allowed, or forcing a refresh of non-stale value
+ return this.isBackgroundFetch(v) ? v.__staleWhileFetching : v
+ }
+ }
+
+ backgroundFetch(k, index, options, context) {
+ const v = index === undefined ? undefined : this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ return v
+ }
+ const ac = new AC()
+ if (options.signal) {
+ options.signal.addEventListener('abort', () =>
+ ac.abort(options.signal.reason)
+ )
+ }
+ const fetchOpts = {
+ signal: ac.signal,
+ options,
+ context,
+ }
+ const cb = (v, updateCache = false) => {
+ const { aborted } = ac.signal
+ const ignoreAbort = options.ignoreFetchAbort && v !== undefined
+ if (options.status) {
+ if (aborted && !updateCache) {
+ options.status.fetchAborted = true
+ options.status.fetchError = ac.signal.reason
+ if (ignoreAbort) options.status.fetchAbortIgnored = true
+ } else {
+ options.status.fetchResolved = true
+ }
+ }
+ if (aborted && !ignoreAbort && !updateCache) {
+ return fetchFail(ac.signal.reason)
+ }
+ // either we didn't abort, and are still here, or we did, and ignored
+ if (this.valList[index] === p) {
+ if (v === undefined) {
+ if (p.__staleWhileFetching) {
+ this.valList[index] = p.__staleWhileFetching
+ } else {
+ this.delete(k)
+ }
+ } else {
+ if (options.status) options.status.fetchUpdated = true
+ this.set(k, v, fetchOpts.options)
+ }
+ }
+ return v
+ }
+ const eb = er => {
+ if (options.status) {
+ options.status.fetchRejected = true
+ options.status.fetchError = er
+ }
+ return fetchFail(er)
+ }
+ const fetchFail = er => {
+ const { aborted } = ac.signal
+ const allowStaleAborted =
+ aborted && options.allowStaleOnFetchAbort
+ const allowStale =
+ allowStaleAborted || options.allowStaleOnFetchRejection
+ const noDelete = allowStale || options.noDeleteOnFetchRejection
+ if (this.valList[index] === p) {
+ // if we allow stale on fetch rejections, then we need to ensure that
+ // the stale value is not removed from the cache when the fetch fails.
+ const del = !noDelete || p.__staleWhileFetching === undefined
+ if (del) {
+ this.delete(k)
+ } else if (!allowStaleAborted) {
+ // still replace the *promise* with the stale value,
+ // since we are done with the promise at this point.
+ // leave it untouched if we're still waiting for an
+ // aborted background fetch that hasn't yet returned.
+ this.valList[index] = p.__staleWhileFetching
+ }
+ }
+ if (allowStale) {
+ if (options.status && p.__staleWhileFetching !== undefined) {
+ options.status.returnedStale = true
+ }
+ return p.__staleWhileFetching
+ } else if (p.__returned === p) {
+ throw er
+ }
+ }
+ const pcall = (res, rej) => {
+ this.fetchMethod(k, v, fetchOpts).then(v => res(v), rej)
+ // ignored, we go until we finish, regardless.
+ // defer check until we are actually aborting,
+ // so fetchMethod can override.
+ ac.signal.addEventListener('abort', () => {
+ if (
+ !options.ignoreFetchAbort ||
+ options.allowStaleOnFetchAbort
+ ) {
+ res()
+ // when it eventually resolves, update the cache.
+ if (options.allowStaleOnFetchAbort) {
+ res = v => cb(v, true)
+ }
+ }
+ })
+ }
+ if (options.status) options.status.fetchDispatched = true
+ const p = new Promise(pcall).then(cb, eb)
+ p.__abortController = ac
+ p.__staleWhileFetching = v
+ p.__returned = null
+ if (index === undefined) {
+ // internal, don't expose status.
+ this.set(k, p, { ...fetchOpts.options, status: undefined })
+ index = this.keyMap.get(k)
+ } else {
+ this.valList[index] = p
+ }
+ return p
+ }
+
+ isBackgroundFetch(p) {
+ return (
+ p &&
+ typeof p === 'object' &&
+ typeof p.then === 'function' &&
+ Object.prototype.hasOwnProperty.call(
+ p,
+ '__staleWhileFetching'
+ ) &&
+ Object.prototype.hasOwnProperty.call(p, '__returned') &&
+ (p.__returned === p || p.__returned === null)
+ )
+ }
+
+ // this takes the union of get() and set() opts, because it does both
+ async fetch(
+ k,
+ {
+ // get options
+ allowStale = this.allowStale,
+ updateAgeOnGet = this.updateAgeOnGet,
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
+ // set options
+ ttl = this.ttl,
+ noDisposeOnSet = this.noDisposeOnSet,
+ size = 0,
+ sizeCalculation = this.sizeCalculation,
+ noUpdateTTL = this.noUpdateTTL,
+ // fetch exclusive options
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
+ ignoreFetchAbort = this.ignoreFetchAbort,
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
+ fetchContext = this.fetchContext,
+ forceRefresh = false,
+ status,
+ signal,
+ } = {}
+ ) {
+ if (!this.fetchMethod) {
+ if (status) status.fetch = 'get'
+ return this.get(k, {
+ allowStale,
+ updateAgeOnGet,
+ noDeleteOnStaleGet,
+ status,
+ })
+ }
+
+ const options = {
+ allowStale,
+ updateAgeOnGet,
+ noDeleteOnStaleGet,
+ ttl,
+ noDisposeOnSet,
+ size,
+ sizeCalculation,
+ noUpdateTTL,
+ noDeleteOnFetchRejection,
+ allowStaleOnFetchRejection,
+ allowStaleOnFetchAbort,
+ ignoreFetchAbort,
+ status,
+ signal,
+ }
+
+ let index = this.keyMap.get(k)
+ if (index === undefined) {
+ if (status) status.fetch = 'miss'
+ const p = this.backgroundFetch(k, index, options, fetchContext)
+ return (p.__returned = p)
+ } else {
+ // in cache, maybe already fetching
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ const stale =
+ allowStale && v.__staleWhileFetching !== undefined
+ if (status) {
+ status.fetch = 'inflight'
+ if (stale) status.returnedStale = true
+ }
+ return stale ? v.__staleWhileFetching : (v.__returned = v)
+ }
+
+ // if we force a refresh, that means do NOT serve the cached value,
+ // unless we are already in the process of refreshing the cache.
+ const isStale = this.isStale(index)
+ if (!forceRefresh && !isStale) {
+ if (status) status.fetch = 'hit'
+ this.moveToTail(index)
+ if (updateAgeOnGet) {
+ this.updateItemAge(index)
+ }
+ this.statusTTL(status, index)
+ return v
+ }
+
+ // ok, it is stale or a forced refresh, and not already fetching.
+ // refresh the cache.
+ const p = this.backgroundFetch(k, index, options, fetchContext)
+ const hasStale = p.__staleWhileFetching !== undefined
+ const staleVal = hasStale && allowStale
+ if (status) {
+ status.fetch = hasStale && isStale ? 'stale' : 'refresh'
+ if (staleVal && isStale) status.returnedStale = true
+ }
+ return staleVal ? p.__staleWhileFetching : (p.__returned = p)
+ }
+ }
+
+ get(
+ k,
+ {
+ allowStale = this.allowStale,
+ updateAgeOnGet = this.updateAgeOnGet,
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
+ status,
+ } = {}
+ ) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ const value = this.valList[index]
+ const fetching = this.isBackgroundFetch(value)
+ this.statusTTL(status, index)
+ if (this.isStale(index)) {
+ if (status) status.get = 'stale'
+ // delete only if not an in-flight background fetch
+ if (!fetching) {
+ if (!noDeleteOnStaleGet) {
+ this.delete(k)
+ }
+ if (status) status.returnedStale = allowStale
+ return allowStale ? value : undefined
+ } else {
+ if (status) {
+ status.returnedStale =
+ allowStale && value.__staleWhileFetching !== undefined
+ }
+ return allowStale ? value.__staleWhileFetching : undefined
+ }
+ } else {
+ if (status) status.get = 'hit'
+ // if we're currently fetching it, we don't actually have it yet
+ // it's not stale, which means this isn't a staleWhileRefetching.
+ // If it's not stale, and fetching, AND has a __staleWhileFetching
+ // value, then that means the user fetched with {forceRefresh:true},
+ // so it's safe to return that value.
+ if (fetching) {
+ return value.__staleWhileFetching
+ }
+ this.moveToTail(index)
+ if (updateAgeOnGet) {
+ this.updateItemAge(index)
+ }
+ return value
+ }
+ } else if (status) {
+ status.get = 'miss'
+ }
+ }
+
+ connect(p, n) {
+ this.prev[n] = p
+ this.next[p] = n
+ }
+
+ moveToTail(index) {
+ // if tail already, nothing to do
+ // if head, move head to next[index]
+ // else
+ // move next[prev[index]] to next[index] (head has no prev)
+ // move prev[next[index]] to prev[index]
+ // prev[index] = tail
+ // next[tail] = index
+ // tail = index
+ if (index !== this.tail) {
+ if (index === this.head) {
+ this.head = this.next[index]
+ } else {
+ this.connect(this.prev[index], this.next[index])
+ }
+ this.connect(this.tail, index)
+ this.tail = index
+ }
+ }
+
+ get del() {
+ deprecatedMethod('del', 'delete')
+ return this.delete
+ }
+
+ delete(k) {
+ let deleted = false
+ if (this.size !== 0) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ deleted = true
+ if (this.size === 1) {
+ this.clear()
+ } else {
+ this.removeItemSize(index)
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('deleted'))
+ } else {
+ this.dispose(v, k, 'delete')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'delete'])
+ }
+ }
+ this.keyMap.delete(k)
+ this.keyList[index] = null
+ this.valList[index] = null
+ if (index === this.tail) {
+ this.tail = this.prev[index]
+ } else if (index === this.head) {
+ this.head = this.next[index]
+ } else {
+ this.next[this.prev[index]] = this.next[index]
+ this.prev[this.next[index]] = this.prev[index]
+ }
+ this.size--
+ this.free.push(index)
+ }
+ }
+ }
+ if (this.disposed) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
+ return deleted
+ }
+
+ clear() {
+ for (const index of this.rindexes({ allowStale: true })) {
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('deleted'))
+ } else {
+ const k = this.keyList[index]
+ this.dispose(v, k, 'delete')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'delete'])
+ }
+ }
+ }
+
+ this.keyMap.clear()
+ this.valList.fill(null)
+ this.keyList.fill(null)
+ if (this.ttls) {
+ this.ttls.fill(0)
+ this.starts.fill(0)
+ }
+ if (this.sizes) {
+ this.sizes.fill(0)
+ }
+ this.head = 0
+ this.tail = 0
+ this.initialFill = 1
+ this.free.length = 0
+ this.calculatedSize = 0
+ this.size = 0
+ if (this.disposed) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
+ }
+
+ get reset() {
+ deprecatedMethod('reset', 'clear')
+ return this.clear
+ }
+
+ get length() {
+ deprecatedProperty('length', 'size')
+ return this.size
+ }
+
+ static get AbortController() {
+ return AC
+ }
+ static get AbortSignal() {
+ return AS
+ }
+}
+
+module.exports = LRUCache
diff --git a/EmployeeManagementBackend/node_modules/lru-cache/index.mjs b/EmployeeManagementBackend/node_modules/lru-cache/index.mjs
new file mode 100644
index 0000000..4a0b481
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru-cache/index.mjs
@@ -0,0 +1,1227 @@
+const perf =
+ typeof performance === 'object' &&
+ performance &&
+ typeof performance.now === 'function'
+ ? performance
+ : Date
+
+const hasAbortController = typeof AbortController === 'function'
+
+// minimal backwards-compatibility polyfill
+// this doesn't have nearly all the checks and whatnot that
+// actual AbortController/Signal has, but it's enough for
+// our purposes, and if used properly, behaves the same.
+const AC = hasAbortController
+ ? AbortController
+ : class AbortController {
+ constructor() {
+ this.signal = new AS()
+ }
+ abort(reason = new Error('This operation was aborted')) {
+ this.signal.reason = this.signal.reason || reason
+ this.signal.aborted = true
+ this.signal.dispatchEvent({
+ type: 'abort',
+ target: this.signal,
+ })
+ }
+ }
+
+const hasAbortSignal = typeof AbortSignal === 'function'
+// Some polyfills put this on the AC class, not global
+const hasACAbortSignal = typeof AC.AbortSignal === 'function'
+const AS = hasAbortSignal
+ ? AbortSignal
+ : hasACAbortSignal
+ ? AC.AbortController
+ : class AbortSignal {
+ constructor() {
+ this.reason = undefined
+ this.aborted = false
+ this._listeners = []
+ }
+ dispatchEvent(e) {
+ if (e.type === 'abort') {
+ this.aborted = true
+ this.onabort(e)
+ this._listeners.forEach(f => f(e), this)
+ }
+ }
+ onabort() {}
+ addEventListener(ev, fn) {
+ if (ev === 'abort') {
+ this._listeners.push(fn)
+ }
+ }
+ removeEventListener(ev, fn) {
+ if (ev === 'abort') {
+ this._listeners = this._listeners.filter(f => f !== fn)
+ }
+ }
+ }
+
+const warned = new Set()
+const deprecatedOption = (opt, instead) => {
+ const code = `LRU_CACHE_OPTION_${opt}`
+ if (shouldWarn(code)) {
+ warn(code, `${opt} option`, `options.${instead}`, LRUCache)
+ }
+}
+const deprecatedMethod = (method, instead) => {
+ const code = `LRU_CACHE_METHOD_${method}`
+ if (shouldWarn(code)) {
+ const { prototype } = LRUCache
+ const { get } = Object.getOwnPropertyDescriptor(prototype, method)
+ warn(code, `${method} method`, `cache.${instead}()`, get)
+ }
+}
+const deprecatedProperty = (field, instead) => {
+ const code = `LRU_CACHE_PROPERTY_${field}`
+ if (shouldWarn(code)) {
+ const { prototype } = LRUCache
+ const { get } = Object.getOwnPropertyDescriptor(prototype, field)
+ warn(code, `${field} property`, `cache.${instead}`, get)
+ }
+}
+
+const emitWarning = (...a) => {
+ typeof process === 'object' &&
+ process &&
+ typeof process.emitWarning === 'function'
+ ? process.emitWarning(...a)
+ : console.error(...a)
+}
+
+const shouldWarn = code => !warned.has(code)
+
+const warn = (code, what, instead, fn) => {
+ warned.add(code)
+ const msg = `The ${what} is deprecated. Please use ${instead} instead.`
+ emitWarning(msg, 'DeprecationWarning', code, fn)
+}
+
+const isPosInt = n => n && n === Math.floor(n) && n > 0 && isFinite(n)
+
+/* istanbul ignore next - This is a little bit ridiculous, tbh.
+ * The maximum array length is 2^32-1 or thereabouts on most JS impls.
+ * And well before that point, you're caching the entire world, I mean,
+ * that's ~32GB of just integers for the next/prev links, plus whatever
+ * else to hold that many keys and values. Just filling the memory with
+ * zeroes at init time is brutal when you get that big.
+ * But why not be complete?
+ * Maybe in the future, these limits will have expanded. */
+const getUintArray = max =>
+ !isPosInt(max)
+ ? null
+ : max <= Math.pow(2, 8)
+ ? Uint8Array
+ : max <= Math.pow(2, 16)
+ ? Uint16Array
+ : max <= Math.pow(2, 32)
+ ? Uint32Array
+ : max <= Number.MAX_SAFE_INTEGER
+ ? ZeroArray
+ : null
+
+class ZeroArray extends Array {
+ constructor(size) {
+ super(size)
+ this.fill(0)
+ }
+}
+
+class Stack {
+ constructor(max) {
+ if (max === 0) {
+ return []
+ }
+ const UintArray = getUintArray(max)
+ this.heap = new UintArray(max)
+ this.length = 0
+ }
+ push(n) {
+ this.heap[this.length++] = n
+ }
+ pop() {
+ return this.heap[--this.length]
+ }
+}
+
+class LRUCache {
+ constructor(options = {}) {
+ const {
+ max = 0,
+ ttl,
+ ttlResolution = 1,
+ ttlAutopurge,
+ updateAgeOnGet,
+ updateAgeOnHas,
+ allowStale,
+ dispose,
+ disposeAfter,
+ noDisposeOnSet,
+ noUpdateTTL,
+ maxSize = 0,
+ maxEntrySize = 0,
+ sizeCalculation,
+ fetchMethod,
+ fetchContext,
+ noDeleteOnFetchRejection,
+ noDeleteOnStaleGet,
+ allowStaleOnFetchRejection,
+ allowStaleOnFetchAbort,
+ ignoreFetchAbort,
+ } = options
+
+ // deprecated options, don't trigger a warning for getting them if
+ // the thing being passed in is another LRUCache we're copying.
+ const { length, maxAge, stale } =
+ options instanceof LRUCache ? {} : options
+
+ if (max !== 0 && !isPosInt(max)) {
+ throw new TypeError('max option must be a nonnegative integer')
+ }
+
+ const UintArray = max ? getUintArray(max) : Array
+ if (!UintArray) {
+ throw new Error('invalid max value: ' + max)
+ }
+
+ this.max = max
+ this.maxSize = maxSize
+ this.maxEntrySize = maxEntrySize || this.maxSize
+ this.sizeCalculation = sizeCalculation || length
+ if (this.sizeCalculation) {
+ if (!this.maxSize && !this.maxEntrySize) {
+ throw new TypeError(
+ 'cannot set sizeCalculation without setting maxSize or maxEntrySize'
+ )
+ }
+ if (typeof this.sizeCalculation !== 'function') {
+ throw new TypeError('sizeCalculation set to non-function')
+ }
+ }
+
+ this.fetchMethod = fetchMethod || null
+ if (this.fetchMethod && typeof this.fetchMethod !== 'function') {
+ throw new TypeError(
+ 'fetchMethod must be a function if specified'
+ )
+ }
+
+ this.fetchContext = fetchContext
+ if (!this.fetchMethod && fetchContext !== undefined) {
+ throw new TypeError(
+ 'cannot set fetchContext without fetchMethod'
+ )
+ }
+
+ this.keyMap = new Map()
+ this.keyList = new Array(max).fill(null)
+ this.valList = new Array(max).fill(null)
+ this.next = new UintArray(max)
+ this.prev = new UintArray(max)
+ this.head = 0
+ this.tail = 0
+ this.free = new Stack(max)
+ this.initialFill = 1
+ this.size = 0
+
+ if (typeof dispose === 'function') {
+ this.dispose = dispose
+ }
+ if (typeof disposeAfter === 'function') {
+ this.disposeAfter = disposeAfter
+ this.disposed = []
+ } else {
+ this.disposeAfter = null
+ this.disposed = null
+ }
+ this.noDisposeOnSet = !!noDisposeOnSet
+ this.noUpdateTTL = !!noUpdateTTL
+ this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection
+ this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection
+ this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort
+ this.ignoreFetchAbort = !!ignoreFetchAbort
+
+ // NB: maxEntrySize is set to maxSize if it's set
+ if (this.maxEntrySize !== 0) {
+ if (this.maxSize !== 0) {
+ if (!isPosInt(this.maxSize)) {
+ throw new TypeError(
+ 'maxSize must be a positive integer if specified'
+ )
+ }
+ }
+ if (!isPosInt(this.maxEntrySize)) {
+ throw new TypeError(
+ 'maxEntrySize must be a positive integer if specified'
+ )
+ }
+ this.initializeSizeTracking()
+ }
+
+ this.allowStale = !!allowStale || !!stale
+ this.noDeleteOnStaleGet = !!noDeleteOnStaleGet
+ this.updateAgeOnGet = !!updateAgeOnGet
+ this.updateAgeOnHas = !!updateAgeOnHas
+ this.ttlResolution =
+ isPosInt(ttlResolution) || ttlResolution === 0
+ ? ttlResolution
+ : 1
+ this.ttlAutopurge = !!ttlAutopurge
+ this.ttl = ttl || maxAge || 0
+ if (this.ttl) {
+ if (!isPosInt(this.ttl)) {
+ throw new TypeError(
+ 'ttl must be a positive integer if specified'
+ )
+ }
+ this.initializeTTLTracking()
+ }
+
+ // do not allow completely unbounded caches
+ if (this.max === 0 && this.ttl === 0 && this.maxSize === 0) {
+ throw new TypeError(
+ 'At least one of max, maxSize, or ttl is required'
+ )
+ }
+ if (!this.ttlAutopurge && !this.max && !this.maxSize) {
+ const code = 'LRU_CACHE_UNBOUNDED'
+ if (shouldWarn(code)) {
+ warned.add(code)
+ const msg =
+ 'TTL caching without ttlAutopurge, max, or maxSize can ' +
+ 'result in unbounded memory consumption.'
+ emitWarning(msg, 'UnboundedCacheWarning', code, LRUCache)
+ }
+ }
+
+ if (stale) {
+ deprecatedOption('stale', 'allowStale')
+ }
+ if (maxAge) {
+ deprecatedOption('maxAge', 'ttl')
+ }
+ if (length) {
+ deprecatedOption('length', 'sizeCalculation')
+ }
+ }
+
+ getRemainingTTL(key) {
+ return this.has(key, { updateAgeOnHas: false }) ? Infinity : 0
+ }
+
+ initializeTTLTracking() {
+ this.ttls = new ZeroArray(this.max)
+ this.starts = new ZeroArray(this.max)
+
+ this.setItemTTL = (index, ttl, start = perf.now()) => {
+ this.starts[index] = ttl !== 0 ? start : 0
+ this.ttls[index] = ttl
+ if (ttl !== 0 && this.ttlAutopurge) {
+ const t = setTimeout(() => {
+ if (this.isStale(index)) {
+ this.delete(this.keyList[index])
+ }
+ }, ttl + 1)
+ /* istanbul ignore else - unref() not supported on all platforms */
+ if (t.unref) {
+ t.unref()
+ }
+ }
+ }
+
+ this.updateItemAge = index => {
+ this.starts[index] = this.ttls[index] !== 0 ? perf.now() : 0
+ }
+
+ this.statusTTL = (status, index) => {
+ if (status) {
+ status.ttl = this.ttls[index]
+ status.start = this.starts[index]
+ status.now = cachedNow || getNow()
+ status.remainingTTL = status.now + status.ttl - status.start
+ }
+ }
+
+ // debounce calls to perf.now() to 1s so we're not hitting
+ // that costly call repeatedly.
+ let cachedNow = 0
+ const getNow = () => {
+ const n = perf.now()
+ if (this.ttlResolution > 0) {
+ cachedNow = n
+ const t = setTimeout(
+ () => (cachedNow = 0),
+ this.ttlResolution
+ )
+ /* istanbul ignore else - not available on all platforms */
+ if (t.unref) {
+ t.unref()
+ }
+ }
+ return n
+ }
+
+ this.getRemainingTTL = key => {
+ const index = this.keyMap.get(key)
+ if (index === undefined) {
+ return 0
+ }
+ return this.ttls[index] === 0 || this.starts[index] === 0
+ ? Infinity
+ : this.starts[index] +
+ this.ttls[index] -
+ (cachedNow || getNow())
+ }
+
+ this.isStale = index => {
+ return (
+ this.ttls[index] !== 0 &&
+ this.starts[index] !== 0 &&
+ (cachedNow || getNow()) - this.starts[index] >
+ this.ttls[index]
+ )
+ }
+ }
+ updateItemAge(_index) {}
+ statusTTL(_status, _index) {}
+ setItemTTL(_index, _ttl, _start) {}
+ isStale(_index) {
+ return false
+ }
+
+ initializeSizeTracking() {
+ this.calculatedSize = 0
+ this.sizes = new ZeroArray(this.max)
+ this.removeItemSize = index => {
+ this.calculatedSize -= this.sizes[index]
+ this.sizes[index] = 0
+ }
+ this.requireSize = (k, v, size, sizeCalculation) => {
+ // provisionally accept background fetches.
+ // actual value size will be checked when they return.
+ if (this.isBackgroundFetch(v)) {
+ return 0
+ }
+ if (!isPosInt(size)) {
+ if (sizeCalculation) {
+ if (typeof sizeCalculation !== 'function') {
+ throw new TypeError('sizeCalculation must be a function')
+ }
+ size = sizeCalculation(v, k)
+ if (!isPosInt(size)) {
+ throw new TypeError(
+ 'sizeCalculation return invalid (expect positive integer)'
+ )
+ }
+ } else {
+ throw new TypeError(
+ 'invalid size value (must be positive integer). ' +
+ 'When maxSize or maxEntrySize is used, sizeCalculation or size ' +
+ 'must be set.'
+ )
+ }
+ }
+ return size
+ }
+ this.addItemSize = (index, size, status) => {
+ this.sizes[index] = size
+ if (this.maxSize) {
+ const maxSize = this.maxSize - this.sizes[index]
+ while (this.calculatedSize > maxSize) {
+ this.evict(true)
+ }
+ }
+ this.calculatedSize += this.sizes[index]
+ if (status) {
+ status.entrySize = size
+ status.totalCalculatedSize = this.calculatedSize
+ }
+ }
+ }
+ removeItemSize(_index) {}
+ addItemSize(_index, _size) {}
+ requireSize(_k, _v, size, sizeCalculation) {
+ if (size || sizeCalculation) {
+ throw new TypeError(
+ 'cannot set size without setting maxSize or maxEntrySize on cache'
+ )
+ }
+ }
+
+ *indexes({ allowStale = this.allowStale } = {}) {
+ if (this.size) {
+ for (let i = this.tail; true; ) {
+ if (!this.isValidIndex(i)) {
+ break
+ }
+ if (allowStale || !this.isStale(i)) {
+ yield i
+ }
+ if (i === this.head) {
+ break
+ } else {
+ i = this.prev[i]
+ }
+ }
+ }
+ }
+
+ *rindexes({ allowStale = this.allowStale } = {}) {
+ if (this.size) {
+ for (let i = this.head; true; ) {
+ if (!this.isValidIndex(i)) {
+ break
+ }
+ if (allowStale || !this.isStale(i)) {
+ yield i
+ }
+ if (i === this.tail) {
+ break
+ } else {
+ i = this.next[i]
+ }
+ }
+ }
+ }
+
+ isValidIndex(index) {
+ return (
+ index !== undefined &&
+ this.keyMap.get(this.keyList[index]) === index
+ )
+ }
+
+ *entries() {
+ for (const i of this.indexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield [this.keyList[i], this.valList[i]]
+ }
+ }
+ }
+ *rentries() {
+ for (const i of this.rindexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield [this.keyList[i], this.valList[i]]
+ }
+ }
+ }
+
+ *keys() {
+ for (const i of this.indexes()) {
+ if (
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.keyList[i]
+ }
+ }
+ }
+ *rkeys() {
+ for (const i of this.rindexes()) {
+ if (
+ this.keyList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.keyList[i]
+ }
+ }
+ }
+
+ *values() {
+ for (const i of this.indexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.valList[i]
+ }
+ }
+ }
+ *rvalues() {
+ for (const i of this.rindexes()) {
+ if (
+ this.valList[i] !== undefined &&
+ !this.isBackgroundFetch(this.valList[i])
+ ) {
+ yield this.valList[i]
+ }
+ }
+ }
+
+ [Symbol.iterator]() {
+ return this.entries()
+ }
+
+ find(fn, getOptions) {
+ for (const i of this.indexes()) {
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ if (fn(value, this.keyList[i], this)) {
+ return this.get(this.keyList[i], getOptions)
+ }
+ }
+ }
+
+ forEach(fn, thisp = this) {
+ for (const i of this.indexes()) {
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ fn.call(thisp, value, this.keyList[i], this)
+ }
+ }
+
+ rforEach(fn, thisp = this) {
+ for (const i of this.rindexes()) {
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ fn.call(thisp, value, this.keyList[i], this)
+ }
+ }
+
+ get prune() {
+ deprecatedMethod('prune', 'purgeStale')
+ return this.purgeStale
+ }
+
+ purgeStale() {
+ let deleted = false
+ for (const i of this.rindexes({ allowStale: true })) {
+ if (this.isStale(i)) {
+ this.delete(this.keyList[i])
+ deleted = true
+ }
+ }
+ return deleted
+ }
+
+ dump() {
+ const arr = []
+ for (const i of this.indexes({ allowStale: true })) {
+ const key = this.keyList[i]
+ const v = this.valList[i]
+ const value = this.isBackgroundFetch(v)
+ ? v.__staleWhileFetching
+ : v
+ if (value === undefined) continue
+ const entry = { value }
+ if (this.ttls) {
+ entry.ttl = this.ttls[i]
+ // always dump the start relative to a portable timestamp
+ // it's ok for this to be a bit slow, it's a rare operation.
+ const age = perf.now() - this.starts[i]
+ entry.start = Math.floor(Date.now() - age)
+ }
+ if (this.sizes) {
+ entry.size = this.sizes[i]
+ }
+ arr.unshift([key, entry])
+ }
+ return arr
+ }
+
+ load(arr) {
+ this.clear()
+ for (const [key, entry] of arr) {
+ if (entry.start) {
+ // entry.start is a portable timestamp, but we may be using
+ // node's performance.now(), so calculate the offset.
+ // it's ok for this to be a bit slow, it's a rare operation.
+ const age = Date.now() - entry.start
+ entry.start = perf.now() - age
+ }
+ this.set(key, entry.value, entry)
+ }
+ }
+
+ dispose(_v, _k, _reason) {}
+
+ set(
+ k,
+ v,
+ {
+ ttl = this.ttl,
+ start,
+ noDisposeOnSet = this.noDisposeOnSet,
+ size = 0,
+ sizeCalculation = this.sizeCalculation,
+ noUpdateTTL = this.noUpdateTTL,
+ status,
+ } = {}
+ ) {
+ size = this.requireSize(k, v, size, sizeCalculation)
+ // if the item doesn't fit, don't do anything
+ // NB: maxEntrySize set to maxSize by default
+ if (this.maxEntrySize && size > this.maxEntrySize) {
+ if (status) {
+ status.set = 'miss'
+ status.maxEntrySizeExceeded = true
+ }
+ // have to delete, in case a background fetch is there already.
+ // in non-async cases, this is a no-op
+ this.delete(k)
+ return this
+ }
+ let index = this.size === 0 ? undefined : this.keyMap.get(k)
+ if (index === undefined) {
+ // addition
+ index = this.newIndex()
+ this.keyList[index] = k
+ this.valList[index] = v
+ this.keyMap.set(k, index)
+ this.next[this.tail] = index
+ this.prev[index] = this.tail
+ this.tail = index
+ this.size++
+ this.addItemSize(index, size, status)
+ if (status) {
+ status.set = 'add'
+ }
+ noUpdateTTL = false
+ } else {
+ // update
+ this.moveToTail(index)
+ const oldVal = this.valList[index]
+ if (v !== oldVal) {
+ if (this.isBackgroundFetch(oldVal)) {
+ oldVal.__abortController.abort(new Error('replaced'))
+ } else {
+ if (!noDisposeOnSet) {
+ this.dispose(oldVal, k, 'set')
+ if (this.disposeAfter) {
+ this.disposed.push([oldVal, k, 'set'])
+ }
+ }
+ }
+ this.removeItemSize(index)
+ this.valList[index] = v
+ this.addItemSize(index, size, status)
+ if (status) {
+ status.set = 'replace'
+ const oldValue =
+ oldVal && this.isBackgroundFetch(oldVal)
+ ? oldVal.__staleWhileFetching
+ : oldVal
+ if (oldValue !== undefined) status.oldValue = oldValue
+ }
+ } else if (status) {
+ status.set = 'update'
+ }
+ }
+ if (ttl !== 0 && this.ttl === 0 && !this.ttls) {
+ this.initializeTTLTracking()
+ }
+ if (!noUpdateTTL) {
+ this.setItemTTL(index, ttl, start)
+ }
+ this.statusTTL(status, index)
+ if (this.disposeAfter) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
+ return this
+ }
+
+ newIndex() {
+ if (this.size === 0) {
+ return this.tail
+ }
+ if (this.size === this.max && this.max !== 0) {
+ return this.evict(false)
+ }
+ if (this.free.length !== 0) {
+ return this.free.pop()
+ }
+ // initial fill, just keep writing down the list
+ return this.initialFill++
+ }
+
+ pop() {
+ if (this.size) {
+ const val = this.valList[this.head]
+ this.evict(true)
+ return val
+ }
+ }
+
+ evict(free) {
+ const head = this.head
+ const k = this.keyList[head]
+ const v = this.valList[head]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('evicted'))
+ } else {
+ this.dispose(v, k, 'evict')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'evict'])
+ }
+ }
+ this.removeItemSize(head)
+ // if we aren't about to use the index, then null these out
+ if (free) {
+ this.keyList[head] = null
+ this.valList[head] = null
+ this.free.push(head)
+ }
+ this.head = this.next[head]
+ this.keyMap.delete(k)
+ this.size--
+ return head
+ }
+
+ has(k, { updateAgeOnHas = this.updateAgeOnHas, status } = {}) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ if (!this.isStale(index)) {
+ if (updateAgeOnHas) {
+ this.updateItemAge(index)
+ }
+ if (status) status.has = 'hit'
+ this.statusTTL(status, index)
+ return true
+ } else if (status) {
+ status.has = 'stale'
+ this.statusTTL(status, index)
+ }
+ } else if (status) {
+ status.has = 'miss'
+ }
+ return false
+ }
+
+ // like get(), but without any LRU updating or TTL expiration
+ peek(k, { allowStale = this.allowStale } = {}) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined && (allowStale || !this.isStale(index))) {
+ const v = this.valList[index]
+ // either stale and allowed, or forcing a refresh of non-stale value
+ return this.isBackgroundFetch(v) ? v.__staleWhileFetching : v
+ }
+ }
+
+ backgroundFetch(k, index, options, context) {
+ const v = index === undefined ? undefined : this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ return v
+ }
+ const ac = new AC()
+ if (options.signal) {
+ options.signal.addEventListener('abort', () =>
+ ac.abort(options.signal.reason)
+ )
+ }
+ const fetchOpts = {
+ signal: ac.signal,
+ options,
+ context,
+ }
+ const cb = (v, updateCache = false) => {
+ const { aborted } = ac.signal
+ const ignoreAbort = options.ignoreFetchAbort && v !== undefined
+ if (options.status) {
+ if (aborted && !updateCache) {
+ options.status.fetchAborted = true
+ options.status.fetchError = ac.signal.reason
+ if (ignoreAbort) options.status.fetchAbortIgnored = true
+ } else {
+ options.status.fetchResolved = true
+ }
+ }
+ if (aborted && !ignoreAbort && !updateCache) {
+ return fetchFail(ac.signal.reason)
+ }
+ // either we didn't abort, and are still here, or we did, and ignored
+ if (this.valList[index] === p) {
+ if (v === undefined) {
+ if (p.__staleWhileFetching) {
+ this.valList[index] = p.__staleWhileFetching
+ } else {
+ this.delete(k)
+ }
+ } else {
+ if (options.status) options.status.fetchUpdated = true
+ this.set(k, v, fetchOpts.options)
+ }
+ }
+ return v
+ }
+ const eb = er => {
+ if (options.status) {
+ options.status.fetchRejected = true
+ options.status.fetchError = er
+ }
+ return fetchFail(er)
+ }
+ const fetchFail = er => {
+ const { aborted } = ac.signal
+ const allowStaleAborted =
+ aborted && options.allowStaleOnFetchAbort
+ const allowStale =
+ allowStaleAborted || options.allowStaleOnFetchRejection
+ const noDelete = allowStale || options.noDeleteOnFetchRejection
+ if (this.valList[index] === p) {
+ // if we allow stale on fetch rejections, then we need to ensure that
+ // the stale value is not removed from the cache when the fetch fails.
+ const del = !noDelete || p.__staleWhileFetching === undefined
+ if (del) {
+ this.delete(k)
+ } else if (!allowStaleAborted) {
+ // still replace the *promise* with the stale value,
+ // since we are done with the promise at this point.
+ // leave it untouched if we're still waiting for an
+ // aborted background fetch that hasn't yet returned.
+ this.valList[index] = p.__staleWhileFetching
+ }
+ }
+ if (allowStale) {
+ if (options.status && p.__staleWhileFetching !== undefined) {
+ options.status.returnedStale = true
+ }
+ return p.__staleWhileFetching
+ } else if (p.__returned === p) {
+ throw er
+ }
+ }
+ const pcall = (res, rej) => {
+ this.fetchMethod(k, v, fetchOpts).then(v => res(v), rej)
+ // ignored, we go until we finish, regardless.
+ // defer check until we are actually aborting,
+ // so fetchMethod can override.
+ ac.signal.addEventListener('abort', () => {
+ if (
+ !options.ignoreFetchAbort ||
+ options.allowStaleOnFetchAbort
+ ) {
+ res()
+ // when it eventually resolves, update the cache.
+ if (options.allowStaleOnFetchAbort) {
+ res = v => cb(v, true)
+ }
+ }
+ })
+ }
+ if (options.status) options.status.fetchDispatched = true
+ const p = new Promise(pcall).then(cb, eb)
+ p.__abortController = ac
+ p.__staleWhileFetching = v
+ p.__returned = null
+ if (index === undefined) {
+ // internal, don't expose status.
+ this.set(k, p, { ...fetchOpts.options, status: undefined })
+ index = this.keyMap.get(k)
+ } else {
+ this.valList[index] = p
+ }
+ return p
+ }
+
+ isBackgroundFetch(p) {
+ return (
+ p &&
+ typeof p === 'object' &&
+ typeof p.then === 'function' &&
+ Object.prototype.hasOwnProperty.call(
+ p,
+ '__staleWhileFetching'
+ ) &&
+ Object.prototype.hasOwnProperty.call(p, '__returned') &&
+ (p.__returned === p || p.__returned === null)
+ )
+ }
+
+ // this takes the union of get() and set() opts, because it does both
+ async fetch(
+ k,
+ {
+ // get options
+ allowStale = this.allowStale,
+ updateAgeOnGet = this.updateAgeOnGet,
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
+ // set options
+ ttl = this.ttl,
+ noDisposeOnSet = this.noDisposeOnSet,
+ size = 0,
+ sizeCalculation = this.sizeCalculation,
+ noUpdateTTL = this.noUpdateTTL,
+ // fetch exclusive options
+ noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
+ allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
+ ignoreFetchAbort = this.ignoreFetchAbort,
+ allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
+ fetchContext = this.fetchContext,
+ forceRefresh = false,
+ status,
+ signal,
+ } = {}
+ ) {
+ if (!this.fetchMethod) {
+ if (status) status.fetch = 'get'
+ return this.get(k, {
+ allowStale,
+ updateAgeOnGet,
+ noDeleteOnStaleGet,
+ status,
+ })
+ }
+
+ const options = {
+ allowStale,
+ updateAgeOnGet,
+ noDeleteOnStaleGet,
+ ttl,
+ noDisposeOnSet,
+ size,
+ sizeCalculation,
+ noUpdateTTL,
+ noDeleteOnFetchRejection,
+ allowStaleOnFetchRejection,
+ allowStaleOnFetchAbort,
+ ignoreFetchAbort,
+ status,
+ signal,
+ }
+
+ let index = this.keyMap.get(k)
+ if (index === undefined) {
+ if (status) status.fetch = 'miss'
+ const p = this.backgroundFetch(k, index, options, fetchContext)
+ return (p.__returned = p)
+ } else {
+ // in cache, maybe already fetching
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ const stale =
+ allowStale && v.__staleWhileFetching !== undefined
+ if (status) {
+ status.fetch = 'inflight'
+ if (stale) status.returnedStale = true
+ }
+ return stale ? v.__staleWhileFetching : (v.__returned = v)
+ }
+
+ // if we force a refresh, that means do NOT serve the cached value,
+ // unless we are already in the process of refreshing the cache.
+ const isStale = this.isStale(index)
+ if (!forceRefresh && !isStale) {
+ if (status) status.fetch = 'hit'
+ this.moveToTail(index)
+ if (updateAgeOnGet) {
+ this.updateItemAge(index)
+ }
+ this.statusTTL(status, index)
+ return v
+ }
+
+ // ok, it is stale or a forced refresh, and not already fetching.
+ // refresh the cache.
+ const p = this.backgroundFetch(k, index, options, fetchContext)
+ const hasStale = p.__staleWhileFetching !== undefined
+ const staleVal = hasStale && allowStale
+ if (status) {
+ status.fetch = hasStale && isStale ? 'stale' : 'refresh'
+ if (staleVal && isStale) status.returnedStale = true
+ }
+ return staleVal ? p.__staleWhileFetching : (p.__returned = p)
+ }
+ }
+
+ get(
+ k,
+ {
+ allowStale = this.allowStale,
+ updateAgeOnGet = this.updateAgeOnGet,
+ noDeleteOnStaleGet = this.noDeleteOnStaleGet,
+ status,
+ } = {}
+ ) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ const value = this.valList[index]
+ const fetching = this.isBackgroundFetch(value)
+ this.statusTTL(status, index)
+ if (this.isStale(index)) {
+ if (status) status.get = 'stale'
+ // delete only if not an in-flight background fetch
+ if (!fetching) {
+ if (!noDeleteOnStaleGet) {
+ this.delete(k)
+ }
+ if (status) status.returnedStale = allowStale
+ return allowStale ? value : undefined
+ } else {
+ if (status) {
+ status.returnedStale =
+ allowStale && value.__staleWhileFetching !== undefined
+ }
+ return allowStale ? value.__staleWhileFetching : undefined
+ }
+ } else {
+ if (status) status.get = 'hit'
+ // if we're currently fetching it, we don't actually have it yet
+ // it's not stale, which means this isn't a staleWhileRefetching.
+ // If it's not stale, and fetching, AND has a __staleWhileFetching
+ // value, then that means the user fetched with {forceRefresh:true},
+ // so it's safe to return that value.
+ if (fetching) {
+ return value.__staleWhileFetching
+ }
+ this.moveToTail(index)
+ if (updateAgeOnGet) {
+ this.updateItemAge(index)
+ }
+ return value
+ }
+ } else if (status) {
+ status.get = 'miss'
+ }
+ }
+
+ connect(p, n) {
+ this.prev[n] = p
+ this.next[p] = n
+ }
+
+ moveToTail(index) {
+ // if tail already, nothing to do
+ // if head, move head to next[index]
+ // else
+ // move next[prev[index]] to next[index] (head has no prev)
+ // move prev[next[index]] to prev[index]
+ // prev[index] = tail
+ // next[tail] = index
+ // tail = index
+ if (index !== this.tail) {
+ if (index === this.head) {
+ this.head = this.next[index]
+ } else {
+ this.connect(this.prev[index], this.next[index])
+ }
+ this.connect(this.tail, index)
+ this.tail = index
+ }
+ }
+
+ get del() {
+ deprecatedMethod('del', 'delete')
+ return this.delete
+ }
+
+ delete(k) {
+ let deleted = false
+ if (this.size !== 0) {
+ const index = this.keyMap.get(k)
+ if (index !== undefined) {
+ deleted = true
+ if (this.size === 1) {
+ this.clear()
+ } else {
+ this.removeItemSize(index)
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('deleted'))
+ } else {
+ this.dispose(v, k, 'delete')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'delete'])
+ }
+ }
+ this.keyMap.delete(k)
+ this.keyList[index] = null
+ this.valList[index] = null
+ if (index === this.tail) {
+ this.tail = this.prev[index]
+ } else if (index === this.head) {
+ this.head = this.next[index]
+ } else {
+ this.next[this.prev[index]] = this.next[index]
+ this.prev[this.next[index]] = this.prev[index]
+ }
+ this.size--
+ this.free.push(index)
+ }
+ }
+ }
+ if (this.disposed) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
+ return deleted
+ }
+
+ clear() {
+ for (const index of this.rindexes({ allowStale: true })) {
+ const v = this.valList[index]
+ if (this.isBackgroundFetch(v)) {
+ v.__abortController.abort(new Error('deleted'))
+ } else {
+ const k = this.keyList[index]
+ this.dispose(v, k, 'delete')
+ if (this.disposeAfter) {
+ this.disposed.push([v, k, 'delete'])
+ }
+ }
+ }
+
+ this.keyMap.clear()
+ this.valList.fill(null)
+ this.keyList.fill(null)
+ if (this.ttls) {
+ this.ttls.fill(0)
+ this.starts.fill(0)
+ }
+ if (this.sizes) {
+ this.sizes.fill(0)
+ }
+ this.head = 0
+ this.tail = 0
+ this.initialFill = 1
+ this.free.length = 0
+ this.calculatedSize = 0
+ this.size = 0
+ if (this.disposed) {
+ while (this.disposed.length) {
+ this.disposeAfter(...this.disposed.shift())
+ }
+ }
+ }
+
+ get reset() {
+ deprecatedMethod('reset', 'clear')
+ return this.clear
+ }
+
+ get length() {
+ deprecatedProperty('length', 'size')
+ return this.size
+ }
+
+ static get AbortController() {
+ return AC
+ }
+ static get AbortSignal() {
+ return AS
+ }
+}
+
+export default LRUCache
diff --git a/EmployeeManagementBackend/node_modules/lru-cache/package.json b/EmployeeManagementBackend/node_modules/lru-cache/package.json
new file mode 100644
index 0000000..9684991
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru-cache/package.json
@@ -0,0 +1,96 @@
+{
+ "name": "lru-cache",
+ "description": "A cache object that deletes the least-recently-used items.",
+ "version": "7.18.3",
+ "author": "Isaac Z. Schlueter ",
+ "keywords": [
+ "mru",
+ "lru",
+ "cache"
+ ],
+ "sideEffects": false,
+ "scripts": {
+ "build": "npm run prepare",
+ "pretest": "npm run prepare",
+ "presnap": "npm run prepare",
+ "prepare": "node ./scripts/transpile-to-esm.js",
+ "size": "size-limit",
+ "test": "tap",
+ "snap": "tap",
+ "preversion": "npm test",
+ "postversion": "npm publish",
+ "prepublishOnly": "git push origin --follow-tags",
+ "format": "prettier --write .",
+ "typedoc": "typedoc ./index.d.ts"
+ },
+ "type": "commonjs",
+ "main": "./index.js",
+ "module": "./index.mjs",
+ "types": "./index.d.ts",
+ "exports": {
+ ".": {
+ "import": {
+ "types": "./index.d.ts",
+ "default": "./index.mjs"
+ },
+ "require": {
+ "types": "./index.d.ts",
+ "default": "./index.js"
+ }
+ },
+ "./package.json": "./package.json"
+ },
+ "repository": "git://github.com/isaacs/node-lru-cache.git",
+ "devDependencies": {
+ "@size-limit/preset-small-lib": "^7.0.8",
+ "@types/node": "^17.0.31",
+ "@types/tap": "^15.0.6",
+ "benchmark": "^2.1.4",
+ "c8": "^7.11.2",
+ "clock-mock": "^1.0.6",
+ "eslint-config-prettier": "^8.5.0",
+ "prettier": "^2.6.2",
+ "size-limit": "^7.0.8",
+ "tap": "^16.3.4",
+ "ts-node": "^10.7.0",
+ "tslib": "^2.4.0",
+ "typedoc": "^0.23.24",
+ "typescript": "^4.6.4"
+ },
+ "license": "ISC",
+ "files": [
+ "index.js",
+ "index.mjs",
+ "index.d.ts"
+ ],
+ "engines": {
+ "node": ">=12"
+ },
+ "prettier": {
+ "semi": false,
+ "printWidth": 70,
+ "tabWidth": 2,
+ "useTabs": false,
+ "singleQuote": true,
+ "jsxSingleQuote": false,
+ "bracketSameLine": true,
+ "arrowParens": "avoid",
+ "endOfLine": "lf"
+ },
+ "tap": {
+ "nyc-arg": [
+ "--include=index.js"
+ ],
+ "node-arg": [
+ "--expose-gc",
+ "--require",
+ "ts-node/register"
+ ],
+ "ts": false
+ },
+ "size-limit": [
+ {
+ "path": "./index.js"
+ }
+ ]
+}
diff --git a/EmployeeManagementBackend/node_modules/lru.min/LICENSE b/EmployeeManagementBackend/node_modules/lru.min/LICENSE
new file mode 100644
index 0000000..e8c4fff
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru.min/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2024-current Weslley Araújo (@wellwelwel)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/EmployeeManagementBackend/node_modules/lru.min/README.md b/EmployeeManagementBackend/node_modules/lru.min/README.md
new file mode 100644
index 0000000..380cf7d
--- /dev/null
+++ b/EmployeeManagementBackend/node_modules/lru.min/README.md
@@ -0,0 +1,384 @@
+
lru.min
+
+
+[](https://www.npmjs.com/package/lru.min)
+[](https://www.npmjs.com/package/lru.min)
+[](https://app.codecov.io/gh/wellwelwel/lru.min)
+[](https://github.com/wellwelwel/lru.min/actions/workflows/ci_node.yml?query=branch%3Amain)
+[](https://github.com/wellwelwel/lru.min/actions/workflows/ci_bun.yml?query=branch%3Amain)
+[](https://github.com/wellwelwel/lru.min/actions/workflows/ci_deno.yml?query=branch%3Amain)
+
+🔥 An extremely fast and efficient LRU Cache for JavaScript (Browser compatible) — **6.8KB**.
+
+