Add settings page for managing forecasting API key and URL via UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-20 14:37:36 +00:00
parent cae411eae7
commit 1c411e402e
19809 changed files with 1962608 additions and 97 deletions

33
frontend/node_modules/es-toolkit/dist/math/clamp.d.mts generated vendored Normal file
View file

@ -0,0 +1,33 @@
//#region src/math/clamp.d.ts
/**
* Clamps a number within the inclusive upper bound.
*
* This function takes a number and a maximum bound, and returns the number clamped within the specified upper bound.
* If only one bound is provided, it returns the minimum of the value and the bound.
*
* @param value - The number to clamp.
* @param maximum - The maximum bound to clamp the number.
* @returns The clamped number within the specified upper bound.
*
* @example
* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
*/
declare function clamp(value: number, maximum: number): number;
/**
* Clamps a number within the inclusive lower and upper bounds.
*
* This function takes a number and two bounds, and returns the number clamped within the specified bounds.
*
* @param value - The number to clamp.
* @param minimum - The minimum bound to clamp the number.
* @param maximum - The maximum bound to clamp the number.
* @returns The clamped number within the specified bounds.
*
* @example
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
*/
declare function clamp(value: number, minimum: number, maximum: number): number;
//#endregion
export { clamp };

33
frontend/node_modules/es-toolkit/dist/math/clamp.d.ts generated vendored Normal file
View file

@ -0,0 +1,33 @@
//#region src/math/clamp.d.ts
/**
* Clamps a number within the inclusive upper bound.
*
* This function takes a number and a maximum bound, and returns the number clamped within the specified upper bound.
* If only one bound is provided, it returns the minimum of the value and the bound.
*
* @param value - The number to clamp.
* @param maximum - The maximum bound to clamp the number.
* @returns The clamped number within the specified upper bound.
*
* @example
* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
*/
declare function clamp(value: number, maximum: number): number;
/**
* Clamps a number within the inclusive lower and upper bounds.
*
* This function takes a number and two bounds, and returns the number clamped within the specified bounds.
*
* @param value - The number to clamp.
* @param minimum - The minimum bound to clamp the number.
* @param maximum - The maximum bound to clamp the number.
* @returns The clamped number within the specified bounds.
*
* @example
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
*/
declare function clamp(value: number, minimum: number, maximum: number): number;
//#endregion
export { clamp };

24
frontend/node_modules/es-toolkit/dist/math/clamp.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
//#region src/math/clamp.ts
/**
* Clamps a number within the specified bounds.
*
* This function takes a number and one or two bounds, and returns the number clamped within the specified bounds.
* If only one bound is provided, it returns the minimum of the value and the bound.
*
* @param value - The number to clamp.
* @param bound1 - The minimum bound to clamp the number, or the maximum bound if bound2 is not provided.
* @param [bound2] - The maximum bound to clamp the number. If not provided, the function will only consider bound1 as the upper limit.
* @returns The clamped number within the specified bounds.
*
* @example
* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
*/
function clamp(value, bound1, bound2) {
if (bound2 == null) return Math.min(value, bound1);
return Math.min(Math.max(value, bound1), bound2);
}
//#endregion
exports.clamp = clamp;

24
frontend/node_modules/es-toolkit/dist/math/clamp.mjs generated vendored Normal file
View file

@ -0,0 +1,24 @@
//#region src/math/clamp.ts
/**
* Clamps a number within the specified bounds.
*
* This function takes a number and one or two bounds, and returns the number clamped within the specified bounds.
* If only one bound is provided, it returns the minimum of the value and the bound.
*
* @param value - The number to clamp.
* @param bound1 - The minimum bound to clamp the number, or the maximum bound if bound2 is not provided.
* @param [bound2] - The maximum bound to clamp the number. If not provided, the function will only consider bound1 as the upper limit.
* @returns The clamped number within the specified bounds.
*
* @example
* const result1 = clamp(10, 5); // result1 will be 5, as 10 is clamped to the bound 5
* const result2 = clamp(10, 5, 15); // result2 will be 10, as it is within the bounds 5 and 15
* const result3 = clamp(2, 5, 15); // result3 will be 5, as 2 is clamped to the lower bound 5
* const result4 = clamp(20, 5, 15); // result4 will be 15, as 20 is clamped to the upper bound 15
*/
function clamp(value, bound1, bound2) {
if (bound2 == null) return Math.min(value, bound1);
return Math.min(Math.max(value, bound1), bound2);
}
//#endregion
export { clamp };

View file

@ -0,0 +1,28 @@
//#region src/math/inRange.d.ts
/**
* Checks if the value is less than the maximum.
*
* @param value The value to check.
* @param maximum The upper bound of the range (exclusive).
* @returns `true` if the value is less than the maximum, otherwise `false`.
*
* @example
* const result = inRange(3, 5); // result will be true.
* const result2 = inRange(5, 5); // result2 will be false.
*/
declare function inRange(value: number, maximum: number): boolean;
/**
* Checks if the value is within the range defined by minimum (inclusive) and maximum (exclusive).
*
* @param value The value to check.
* @param minimum The lower bound of the range (inclusive).
* @param maximum The upper bound of the range (exclusive).
* @returns `true` if the value is within the specified range, otherwise `false`.
*
* @example
* const result = inRange(3, 2, 5); // result will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
*/
declare function inRange(value: number, minimum: number, maximum: number): boolean;
//#endregion
export { inRange };

View file

@ -0,0 +1,28 @@
//#region src/math/inRange.d.ts
/**
* Checks if the value is less than the maximum.
*
* @param value The value to check.
* @param maximum The upper bound of the range (exclusive).
* @returns `true` if the value is less than the maximum, otherwise `false`.
*
* @example
* const result = inRange(3, 5); // result will be true.
* const result2 = inRange(5, 5); // result2 will be false.
*/
declare function inRange(value: number, maximum: number): boolean;
/**
* Checks if the value is within the range defined by minimum (inclusive) and maximum (exclusive).
*
* @param value The value to check.
* @param minimum The lower bound of the range (inclusive).
* @param maximum The upper bound of the range (exclusive).
* @returns `true` if the value is within the specified range, otherwise `false`.
*
* @example
* const result = inRange(3, 2, 5); // result will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
*/
declare function inRange(value: number, minimum: number, maximum: number): boolean;
//#endregion
export { inRange };

25
frontend/node_modules/es-toolkit/dist/math/inRange.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
//#region src/math/inRange.ts
/**
* Checks if the value is within a specified range.
*
* @param value The value to check.
* @param minimum The lower bound of the range (inclusive).
* @param maximum The upper bound of the range (exclusive).
* @returns `true` if the value is within the specified range, otherwise `false`.
* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.
*
* @example
* const result1 = inRange(3, 5); // result1 will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.
*/
function inRange(value, minimum, maximum) {
if (maximum == null) {
maximum = minimum;
minimum = 0;
}
if (minimum >= maximum) throw new Error("The maximum value must be greater than the minimum value.");
return minimum <= value && value < maximum;
}
//#endregion
exports.inRange = inRange;

25
frontend/node_modules/es-toolkit/dist/math/inRange.mjs generated vendored Normal file
View file

@ -0,0 +1,25 @@
//#region src/math/inRange.ts
/**
* Checks if the value is within a specified range.
*
* @param value The value to check.
* @param minimum The lower bound of the range (inclusive).
* @param maximum The upper bound of the range (exclusive).
* @returns `true` if the value is within the specified range, otherwise `false`.
* @throws {Error} Throws an error if the `minimum` is greater or equal than the `maximum`.
*
* @example
* const result1 = inRange(3, 5); // result1 will be true.
* const result2 = inRange(1, 2, 5); // result2 will be false.
* const result3 = inRange(1, 5, 2); // If the minimum is greater or equal than the maximum, an error is thrown.
*/
function inRange(value, minimum, maximum) {
if (maximum == null) {
maximum = minimum;
minimum = 0;
}
if (minimum >= maximum) throw new Error("The maximum value must be greater than the minimum value.");
return minimum <= value && value < maximum;
}
//#endregion
export { inRange };

15
frontend/node_modules/es-toolkit/dist/math/index.d.mts generated vendored Normal file
View file

@ -0,0 +1,15 @@
import { clamp } from "./clamp.mjs";
import { inRange } from "./inRange.mjs";
import { mean } from "./mean.mjs";
import { meanBy } from "./meanBy.mjs";
import { median } from "./median.mjs";
import { medianBy } from "./medianBy.mjs";
import { percentile } from "./percentile.mjs";
import { random } from "./random.mjs";
import { randomInt } from "./randomInt.mjs";
import { range } from "./range.mjs";
import { rangeRight } from "./rangeRight.mjs";
import { round } from "./round.mjs";
import { sum } from "./sum.mjs";
import { sumBy } from "./sumBy.mjs";
export { clamp, inRange, mean, meanBy, median, medianBy, percentile, random, randomInt, range, rangeRight, round, sum, sumBy };

15
frontend/node_modules/es-toolkit/dist/math/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,15 @@
import { clamp } from "./clamp.js";
import { inRange } from "./inRange.js";
import { mean } from "./mean.js";
import { meanBy } from "./meanBy.js";
import { median } from "./median.js";
import { medianBy } from "./medianBy.js";
import { percentile } from "./percentile.js";
import { random } from "./random.js";
import { randomInt } from "./randomInt.js";
import { range } from "./range.js";
import { rangeRight } from "./rangeRight.js";
import { round } from "./round.js";
import { sum } from "./sum.js";
import { sumBy } from "./sumBy.js";
export { clamp, inRange, mean, meanBy, median, medianBy, percentile, random, randomInt, range, rangeRight, round, sum, sumBy };

29
frontend/node_modules/es-toolkit/dist/math/index.js generated vendored Normal file
View file

@ -0,0 +1,29 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_random = require("./random.js");
const require_randomInt = require("./randomInt.js");
const require_clamp = require("./clamp.js");
const require_inRange = require("./inRange.js");
const require_sum = require("./sum.js");
const require_mean = require("./mean.js");
const require_sumBy = require("./sumBy.js");
const require_meanBy = require("./meanBy.js");
const require_median = require("./median.js");
const require_medianBy = require("./medianBy.js");
const require_percentile = require("./percentile.js");
const require_range = require("./range.js");
const require_rangeRight = require("./rangeRight.js");
const require_round = require("./round.js");
exports.clamp = require_clamp.clamp;
exports.inRange = require_inRange.inRange;
exports.mean = require_mean.mean;
exports.meanBy = require_meanBy.meanBy;
exports.median = require_median.median;
exports.medianBy = require_medianBy.medianBy;
exports.percentile = require_percentile.percentile;
exports.random = require_random.random;
exports.randomInt = require_randomInt.randomInt;
exports.range = require_range.range;
exports.rangeRight = require_rangeRight.rangeRight;
exports.round = require_round.round;
exports.sum = require_sum.sum;
exports.sumBy = require_sumBy.sumBy;

15
frontend/node_modules/es-toolkit/dist/math/index.mjs generated vendored Normal file
View file

@ -0,0 +1,15 @@
import { random } from "./random.mjs";
import { randomInt } from "./randomInt.mjs";
import { clamp } from "./clamp.mjs";
import { inRange } from "./inRange.mjs";
import { sum } from "./sum.mjs";
import { mean } from "./mean.mjs";
import { sumBy } from "./sumBy.mjs";
import { meanBy } from "./meanBy.mjs";
import { median } from "./median.mjs";
import { medianBy } from "./medianBy.mjs";
import { percentile } from "./percentile.mjs";
import { range } from "./range.mjs";
import { rangeRight } from "./rangeRight.mjs";
import { round } from "./round.mjs";
export { clamp, inRange, mean, meanBy, median, medianBy, percentile, random, randomInt, range, rangeRight, round, sum, sumBy };

17
frontend/node_modules/es-toolkit/dist/math/mean.d.mts generated vendored Normal file
View file

@ -0,0 +1,17 @@
//#region src/math/mean.d.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the average.
* @returns The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
declare function mean(nums: readonly number[]): number;
//#endregion
export { mean };

17
frontend/node_modules/es-toolkit/dist/math/mean.d.ts generated vendored Normal file
View file

@ -0,0 +1,17 @@
//#region src/math/mean.d.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the average.
* @returns The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
declare function mean(nums: readonly number[]): number;
//#endregion
export { mean };

20
frontend/node_modules/es-toolkit/dist/math/mean.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
const require_sum = require("./sum.js");
//#region src/math/mean.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the average.
* @returns The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
function mean(nums) {
return require_sum.sum(nums) / nums.length;
}
//#endregion
exports.mean = mean;

20
frontend/node_modules/es-toolkit/dist/math/mean.mjs generated vendored Normal file
View file

@ -0,0 +1,20 @@
import { sum } from "./sum.mjs";
//#region src/math/mean.ts
/**
* Calculates the average of an array of numbers.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the average.
* @returns The average of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = mean(numbers);
* // result will be 3
*/
function mean(nums) {
return sum(nums) / nums.length;
}
//#endregion
export { mean };

View file

@ -0,0 +1,19 @@
//#region src/math/meanBy.d.ts
/**
* Calculates the average of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the average.
* @param getValue A function that selects a numeric value from each element.
* @returns The average of all the numbers as determined by the `getValue` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
*/
declare function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number;
//#endregion
export { meanBy };

19
frontend/node_modules/es-toolkit/dist/math/meanBy.d.ts generated vendored Normal file
View file

@ -0,0 +1,19 @@
//#region src/math/meanBy.d.ts
/**
* Calculates the average of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the average.
* @param getValue A function that selects a numeric value from each element.
* @returns The average of all the numbers as determined by the `getValue` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
*/
declare function meanBy<T>(items: readonly T[], getValue: (element: T) => number): number;
//#endregion
export { meanBy };

22
frontend/node_modules/es-toolkit/dist/math/meanBy.js generated vendored Normal file
View file

@ -0,0 +1,22 @@
const require_sumBy = require("./sumBy.js");
//#region src/math/meanBy.ts
/**
* Calculates the average of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the average.
* @param getValue A function that selects a numeric value from each element.
* @returns The average of all the numbers as determined by the `getValue` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
*/
function meanBy(items, getValue) {
return require_sumBy.sumBy(items, (item) => getValue(item)) / items.length;
}
//#endregion
exports.meanBy = meanBy;

22
frontend/node_modules/es-toolkit/dist/math/meanBy.mjs generated vendored Normal file
View file

@ -0,0 +1,22 @@
import { sumBy } from "./sumBy.mjs";
//#region src/math/meanBy.ts
/**
* Calculates the average of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the average.
* @param getValue A function that selects a numeric value from each element.
* @returns The average of all the numbers as determined by the `getValue` function.
*
* @example
* meanBy([{ a: 1 }, { a: 2 }, { a: 3 }], x => x.a); // Returns: 2
* meanBy([], x => x.a); // Returns: NaN
*/
function meanBy(items, getValue) {
return sumBy(items, (item) => getValue(item)) / items.length;
}
//#endregion
export { meanBy };

View file

@ -0,0 +1,26 @@
//#region src/math/median.d.ts
/**
* Calculates the median of an array of numbers.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the median.
* @returns The median of all the numbers in the array.
*
* @example
* const arrayWithOddNumberOfElements = [1, 2, 3, 4, 5];
* const result = median(arrayWithOddNumberOfElements);
* // result will be 3
*
* @example
* const arrayWithEvenNumberOfElements = [1, 2, 3, 4];
* const result = median(arrayWithEvenNumberOfElements);
* // result will be 2.5
*/
declare function median(nums: readonly number[]): number;
//#endregion
export { median };

26
frontend/node_modules/es-toolkit/dist/math/median.d.ts generated vendored Normal file
View file

@ -0,0 +1,26 @@
//#region src/math/median.d.ts
/**
* Calculates the median of an array of numbers.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the median.
* @returns The median of all the numbers in the array.
*
* @example
* const arrayWithOddNumberOfElements = [1, 2, 3, 4, 5];
* const result = median(arrayWithOddNumberOfElements);
* // result will be 3
*
* @example
* const arrayWithEvenNumberOfElements = [1, 2, 3, 4];
* const result = median(arrayWithEvenNumberOfElements);
* // result will be 2.5
*/
declare function median(nums: readonly number[]): number;
//#endregion
export { median };

32
frontend/node_modules/es-toolkit/dist/math/median.js generated vendored Normal file
View file

@ -0,0 +1,32 @@
//#region src/math/median.ts
/**
* Calculates the median of an array of numbers.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the median.
* @returns The median of all the numbers in the array.
*
* @example
* const arrayWithOddNumberOfElements = [1, 2, 3, 4, 5];
* const result = median(arrayWithOddNumberOfElements);
* // result will be 3
*
* @example
* const arrayWithEvenNumberOfElements = [1, 2, 3, 4];
* const result = median(arrayWithEvenNumberOfElements);
* // result will be 2.5
*/
function median(nums) {
if (nums.length === 0) return NaN;
const sorted = nums.slice().sort((a, b) => a - b);
const middleIndex = Math.floor(sorted.length / 2);
if (sorted.length % 2 === 0) return (sorted[middleIndex - 1] + sorted[middleIndex]) / 2;
else return sorted[middleIndex];
}
//#endregion
exports.median = median;

32
frontend/node_modules/es-toolkit/dist/math/median.mjs generated vendored Normal file
View file

@ -0,0 +1,32 @@
//#region src/math/median.ts
/**
* Calculates the median of an array of numbers.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @param nums - An array of numbers to calculate the median.
* @returns The median of all the numbers in the array.
*
* @example
* const arrayWithOddNumberOfElements = [1, 2, 3, 4, 5];
* const result = median(arrayWithOddNumberOfElements);
* // result will be 3
*
* @example
* const arrayWithEvenNumberOfElements = [1, 2, 3, 4];
* const result = median(arrayWithEvenNumberOfElements);
* // result will be 2.5
*/
function median(nums) {
if (nums.length === 0) return NaN;
const sorted = nums.slice().sort((a, b) => a - b);
const middleIndex = Math.floor(sorted.length / 2);
if (sorted.length % 2 === 0) return (sorted[middleIndex - 1] + sorted[middleIndex]) / 2;
else return sorted[middleIndex];
}
//#endregion
export { median };

View file

@ -0,0 +1,24 @@
//#region src/math/medianBy.d.ts
/**
* Calculates the median of an array of elements when applying
* the `getValue` function to each element.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the median.
* @param getValue A function that selects a numeric value from each element.
* @returns The median of all the numbers as determined by the `getValue` function.
*
* @example
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }], x => x.a); // Returns: 3
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }], x => x.a); // Returns: 2.5
* medianBy([], x => x.a); // Returns: NaN
*/
declare function medianBy<T>(items: readonly T[], getValue: (element: T) => number): number;
//#endregion
export { medianBy };

View file

@ -0,0 +1,24 @@
//#region src/math/medianBy.d.ts
/**
* Calculates the median of an array of elements when applying
* the `getValue` function to each element.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the median.
* @param getValue A function that selects a numeric value from each element.
* @returns The median of all the numbers as determined by the `getValue` function.
*
* @example
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }], x => x.a); // Returns: 3
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }], x => x.a); // Returns: 2.5
* medianBy([], x => x.a); // Returns: NaN
*/
declare function medianBy<T>(items: readonly T[], getValue: (element: T) => number): number;
//#endregion
export { medianBy };

28
frontend/node_modules/es-toolkit/dist/math/medianBy.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
const require_median = require("./median.js");
//#region src/math/medianBy.ts
/**
* Calculates the median of an array of elements when applying
* the `getValue` function to each element.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the median.
* @param getValue A function that selects a numeric value from each element.
* @returns The median of all the numbers as determined by the `getValue` function.
*
* @example
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }], x => x.a); // Returns: 3
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }], x => x.a); // Returns: 2.5
* medianBy([], x => x.a); // Returns: NaN
*/
function medianBy(items, getValue) {
const nums = items.map((x) => getValue(x));
return require_median.median(nums);
}
//#endregion
exports.medianBy = medianBy;

View file

@ -0,0 +1,27 @@
import { median } from "./median.mjs";
//#region src/math/medianBy.ts
/**
* Calculates the median of an array of elements when applying
* the `getValue` function to each element.
*
* The median is the middle value of a sorted array.
* If the array has an odd number of elements, the median is the middle value.
* If the array has an even number of elements, it returns the average of the two middle values.
*
* If the array is empty, this function returns `NaN`.
*
* @template T - The type of elements in the array.
* @param items An array to calculate the median.
* @param getValue A function that selects a numeric value from each element.
* @returns The median of all the numbers as determined by the `getValue` function.
*
* @example
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }, { a: 5 }], x => x.a); // Returns: 3
* medianBy([{ a: 1 }, { a: 2 }, { a: 3 }, { a: 4 }], x => x.a); // Returns: 2.5
* medianBy([], x => x.a); // Returns: NaN
*/
function medianBy(items, getValue) {
return median(items.map((x) => getValue(x)));
}
//#endregion
export { medianBy };

View file

@ -0,0 +1,29 @@
//#region src/math/percentile.d.ts
/**
* Calculates the value at the given percentile of an array of numbers.
*
* Sorts the array in ascending order and returns the element at the nearest rank.
* See {@link https://en.wikipedia.org/wiki/Percentile#The_nearest-rank_method | Nearest rank method}.
*
* `NaN` values are sorted as the smallest values. Returns `NaN` if the array is empty.
*
* @param arr - An array of numbers to calculate the percentile.
* @param percentile - The percentile to compute, in the range `[0, 100]`.
* @returns The value at the given percentile.
* @throws {Error} Throws an error if `percentile` is not a number, less than `0`, or greater than `100`.
*
* @example
* percentile([1, 2, 3, 4, 5], 50);
* // Returns 3
*
* @example
* percentile([1, 2, 3, 4, 5], 75);
* // Returns 4
*
* @example
* percentile([5, 1, 4, 2, 3], 0);
* // Returns 1
*/
declare function percentile(arr: readonly number[], percentile: number): number;
//#endregion
export { percentile };

View file

@ -0,0 +1,29 @@
//#region src/math/percentile.d.ts
/**
* Calculates the value at the given percentile of an array of numbers.
*
* Sorts the array in ascending order and returns the element at the nearest rank.
* See {@link https://en.wikipedia.org/wiki/Percentile#The_nearest-rank_method | Nearest rank method}.
*
* `NaN` values are sorted as the smallest values. Returns `NaN` if the array is empty.
*
* @param arr - An array of numbers to calculate the percentile.
* @param percentile - The percentile to compute, in the range `[0, 100]`.
* @returns The value at the given percentile.
* @throws {Error} Throws an error if `percentile` is not a number, less than `0`, or greater than `100`.
*
* @example
* percentile([1, 2, 3, 4, 5], 50);
* // Returns 3
*
* @example
* percentile([1, 2, 3, 4, 5], 75);
* // Returns 4
*
* @example
* percentile([5, 1, 4, 2, 3], 0);
* // Returns 1
*/
declare function percentile(arr: readonly number[], percentile: number): number;
//#endregion
export { percentile };

View file

@ -0,0 +1,39 @@
//#region src/math/percentile.ts
/**
* Calculates the value at the given percentile of an array of numbers.
*
* Sorts the array in ascending order and returns the element at the nearest rank.
* See {@link https://en.wikipedia.org/wiki/Percentile#The_nearest-rank_method | Nearest rank method}.
*
* `NaN` values are sorted as the smallest values. Returns `NaN` if the array is empty.
*
* @param arr - An array of numbers to calculate the percentile.
* @param percentile - The percentile to compute, in the range `[0, 100]`.
* @returns The value at the given percentile.
* @throws {Error} Throws an error if `percentile` is not a number, less than `0`, or greater than `100`.
*
* @example
* percentile([1, 2, 3, 4, 5], 50);
* // Returns 3
*
* @example
* percentile([1, 2, 3, 4, 5], 75);
* // Returns 4
*
* @example
* percentile([5, 1, 4, 2, 3], 0);
* // Returns 1
*/
function percentile(arr, percentile) {
if (Number.isNaN(Number(percentile))) throw new Error(`Expected percentile to be a number but got "${percentile}".`);
if (percentile < 0) throw new Error(`Expected percentile to be >= 0 but got "${percentile}".`);
if (percentile > 100) throw new Error(`Expected percentile to be <= 100 but got "${percentile}".`);
if (arr.length === 0) return NaN;
const sorted = arr.slice().sort((a, b) => {
return (Number.isNaN(a) ? Number.NEGATIVE_INFINITY : a) - (Number.isNaN(b) ? Number.NEGATIVE_INFINITY : b);
});
if (percentile === 0) return sorted[0];
return sorted[Math.ceil(sorted.length * (percentile / 100)) - 1];
}
//#endregion
exports.percentile = percentile;

View file

@ -0,0 +1,39 @@
//#region src/math/percentile.ts
/**
* Calculates the value at the given percentile of an array of numbers.
*
* Sorts the array in ascending order and returns the element at the nearest rank.
* See {@link https://en.wikipedia.org/wiki/Percentile#The_nearest-rank_method | Nearest rank method}.
*
* `NaN` values are sorted as the smallest values. Returns `NaN` if the array is empty.
*
* @param arr - An array of numbers to calculate the percentile.
* @param percentile - The percentile to compute, in the range `[0, 100]`.
* @returns The value at the given percentile.
* @throws {Error} Throws an error if `percentile` is not a number, less than `0`, or greater than `100`.
*
* @example
* percentile([1, 2, 3, 4, 5], 50);
* // Returns 3
*
* @example
* percentile([1, 2, 3, 4, 5], 75);
* // Returns 4
*
* @example
* percentile([5, 1, 4, 2, 3], 0);
* // Returns 1
*/
function percentile(arr, percentile) {
if (Number.isNaN(Number(percentile))) throw new Error(`Expected percentile to be a number but got "${percentile}".`);
if (percentile < 0) throw new Error(`Expected percentile to be >= 0 but got "${percentile}".`);
if (percentile > 100) throw new Error(`Expected percentile to be <= 100 but got "${percentile}".`);
if (arr.length === 0) return NaN;
const sorted = arr.slice().sort((a, b) => {
return (Number.isNaN(a) ? Number.NEGATIVE_INFINITY : a) - (Number.isNaN(b) ? Number.NEGATIVE_INFINITY : b);
});
if (percentile === 0) return sorted[0];
return sorted[Math.ceil(sorted.length * (percentile / 100)) - 1];
}
//#endregion
export { percentile };

View file

@ -0,0 +1,31 @@
//#region src/math/random.d.ts
/**
* Generate a random number within the given range.
*
* If only one argument is provided, a number between `0` and the given number is returned.
*
* @param maximum - The upper bound (exclusive).
* @returns A random number between 0 (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `0`.
*
* @example
* const result1 = random(5); // Returns a random number between 0 and 5.
* const result2 = random(0); // If the `maximum` is less than or equal to 0, an error is thrown.
*/
declare function random(maximum: number): number;
/**
* Generate a random number within the given range.
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result1 = random(0, 5); // Returns a random number between 0 and 5.
* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown.
* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.
*/
declare function random(minimum: number, maximum: number): number;
//#endregion
export { random };

31
frontend/node_modules/es-toolkit/dist/math/random.d.ts generated vendored Normal file
View file

@ -0,0 +1,31 @@
//#region src/math/random.d.ts
/**
* Generate a random number within the given range.
*
* If only one argument is provided, a number between `0` and the given number is returned.
*
* @param maximum - The upper bound (exclusive).
* @returns A random number between 0 (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `0`.
*
* @example
* const result1 = random(5); // Returns a random number between 0 and 5.
* const result2 = random(0); // If the `maximum` is less than or equal to 0, an error is thrown.
*/
declare function random(maximum: number): number;
/**
* Generate a random number within the given range.
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result1 = random(0, 5); // Returns a random number between 0 and 5.
* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown.
* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.
*/
declare function random(minimum: number, maximum: number): number;
//#endregion
export { random };

24
frontend/node_modules/es-toolkit/dist/math/random.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
//#region src/math/random.ts
/**
* Generate a random number within the given range.
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result1 = random(0, 5); // Returns a random number between 0 and 5.
* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown.
* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.
*/
function random(minimum, maximum) {
if (maximum == null) {
maximum = minimum;
minimum = 0;
}
if (minimum >= maximum) throw new Error("Invalid input: The maximum value must be greater than the minimum value.");
return Math.random() * (maximum - minimum) + minimum;
}
//#endregion
exports.random = random;

24
frontend/node_modules/es-toolkit/dist/math/random.mjs generated vendored Normal file
View file

@ -0,0 +1,24 @@
//#region src/math/random.ts
/**
* Generate a random number within the given range.
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random number between minimum (inclusive) and maximum (exclusive). The number can be an integer or a decimal.
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result1 = random(0, 5); // Returns a random number between 0 and 5.
* const result2 = random(5, 0); // If the minimum is greater than the maximum, an error is thrown.
* const result3 = random(5, 5); // If the minimum is equal to the maximum, an error is thrown.
*/
function random(minimum, maximum) {
if (maximum == null) {
maximum = minimum;
minimum = 0;
}
if (minimum >= maximum) throw new Error("Invalid input: The maximum value must be greater than the minimum value.");
return Math.random() * (maximum - minimum) + minimum;
}
//#endregion
export { random };

View file

@ -0,0 +1,27 @@
//#region src/math/randomInt.d.ts
/**
* Generates a random integer between 0 (inclusive) and the given maximum (exclusive).
*
* @param maximum - The upper bound (exclusive).
* @returns A random integer between 0 (inclusive) and maximum (exclusive).
* @throws {Error} Throws an error if `maximum` is not greater than `0`.
*
* @example
* const result = randomInt(5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
*/
declare function randomInt(maximum: number): number;
/**
* Generates a random integer between minimum (inclusive) and maximum (exclusive).
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random integer between minimum (inclusive) and maximum (exclusive).
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
* const result2 = randomInt(5, 0); // This will throw an error
*/
declare function randomInt(minimum: number, maximum: number): number;
//#endregion
export { randomInt };

View file

@ -0,0 +1,27 @@
//#region src/math/randomInt.d.ts
/**
* Generates a random integer between 0 (inclusive) and the given maximum (exclusive).
*
* @param maximum - The upper bound (exclusive).
* @returns A random integer between 0 (inclusive) and maximum (exclusive).
* @throws {Error} Throws an error if `maximum` is not greater than `0`.
*
* @example
* const result = randomInt(5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
*/
declare function randomInt(maximum: number): number;
/**
* Generates a random integer between minimum (inclusive) and maximum (exclusive).
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random integer between minimum (inclusive) and maximum (exclusive).
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
* const result2 = randomInt(5, 0); // This will throw an error
*/
declare function randomInt(minimum: number, maximum: number): number;
//#endregion
export { randomInt };

View file

@ -0,0 +1,21 @@
const require_random = require("./random.js");
//#region src/math/randomInt.ts
/**
* Generates a random integer between minimum (inclusive) and maximum (exclusive).
*
* If only one argument is provided, a number between `0` and the given number is returned.
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random integer between minimum (inclusive) and maximum (exclusive).
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
* const result2 = randomInt(5, 0); // This will throw an error
*/
function randomInt(minimum, maximum) {
return Math.floor(require_random.random(minimum, maximum));
}
//#endregion
exports.randomInt = randomInt;

View file

@ -0,0 +1,21 @@
import { random } from "./random.mjs";
//#region src/math/randomInt.ts
/**
* Generates a random integer between minimum (inclusive) and maximum (exclusive).
*
* If only one argument is provided, a number between `0` and the given number is returned.
*
* @param minimum - The lower bound (inclusive).
* @param maximum - The upper bound (exclusive).
* @returns A random integer between minimum (inclusive) and maximum (exclusive).
* @throws {Error} Throws an error if `maximum` is not greater than `minimum`.
*
* @example
* const result = randomInt(0, 5); // result will be a random integer between 0 (inclusive) and 5 (exclusive)
* const result2 = randomInt(5, 0); // This will throw an error
*/
function randomInt(minimum, maximum) {
return Math.floor(random(minimum, maximum));
}
//#endregion
export { randomInt };

39
frontend/node_modules/es-toolkit/dist/math/range.d.mts generated vendored Normal file
View file

@ -0,0 +1,39 @@
//#region src/math/range.d.ts
/**
* Returns an array of numbers from `0` (inclusive) to `end` (exclusive), incrementing by `1`.
*
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `0` (inclusive) to `end` (exclusive) with a step of `1`.
*
* @example
* // Returns [0, 1, 2, 3]
* range(4);
*/
declare function range(end: number): number[];
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `1`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `start` (inclusive) to `end` (exclusive) with a step of `1`.
*
* @example
* // Returns [1, 2, 3]
* range(1, 4);
*/
declare function range(start: number, end: number): number[];
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
*
* @example
* // Returns [0, 5, 10, 15]
* range(0, 20, 5);
*/
declare function range(start: number, end: number, step: number): number[];
//#endregion
export { range };

39
frontend/node_modules/es-toolkit/dist/math/range.d.ts generated vendored Normal file
View file

@ -0,0 +1,39 @@
//#region src/math/range.d.ts
/**
* Returns an array of numbers from `0` (inclusive) to `end` (exclusive), incrementing by `1`.
*
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `0` (inclusive) to `end` (exclusive) with a step of `1`.
*
* @example
* // Returns [0, 1, 2, 3]
* range(4);
*/
declare function range(end: number): number[];
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `1`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `start` (inclusive) to `end` (exclusive) with a step of `1`.
*
* @example
* // Returns [1, 2, 3]
* range(1, 4);
*/
declare function range(start: number, end: number): number[];
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
*
* @example
* // Returns [0, 5, 10, 15]
* range(0, 20, 5);
*/
declare function range(start: number, end: number, step: number): number[];
//#endregion
export { range };

31
frontend/node_modules/es-toolkit/dist/math/range.js generated vendored Normal file
View file

@ -0,0 +1,31 @@
//#region src/math/range.ts
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
* @throws {Error} Throws an error if the step value is not a non-zero integer.
*
* @example
* // Returns [0, 1, 2, 3]
* range(4);
*
* @example
* // Returns [0, -1, -2, -3]
* range(0, -4, -1);
*/
function range(start, end, step = 1) {
if (end == null) {
end = start;
start = 0;
}
if (!Number.isInteger(step) || step === 0) throw new Error(`The step value must be a non-zero integer.`);
const length = Math.max(Math.ceil((end - start) / step), 0);
const result = new Array(length);
for (let i = 0; i < length; i++) result[i] = start + i * step;
return result;
}
//#endregion
exports.range = range;

31
frontend/node_modules/es-toolkit/dist/math/range.mjs generated vendored Normal file
View file

@ -0,0 +1,31 @@
//#region src/math/range.ts
/**
* Returns an array of numbers from `start` (inclusive) to `end` (exclusive), incrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `start` (inclusive) to `end` (exclusive) with the specified `step`.
* @throws {Error} Throws an error if the step value is not a non-zero integer.
*
* @example
* // Returns [0, 1, 2, 3]
* range(4);
*
* @example
* // Returns [0, -1, -2, -3]
* range(0, -4, -1);
*/
function range(start, end, step = 1) {
if (end == null) {
end = start;
start = 0;
}
if (!Number.isInteger(step) || step === 0) throw new Error(`The step value must be a non-zero integer.`);
const length = Math.max(Math.ceil((end - start) / step), 0);
const result = new Array(length);
for (let i = 0; i < length; i++) result[i] = start + i * step;
return result;
}
//#endregion
export { range };

View file

@ -0,0 +1,39 @@
//#region src/math/rangeRight.d.ts
/**
* Returns an array of numbers from `end` (exclusive) to `0` (inclusive), decrementing by `1`.
*
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `end` (exclusive) to `0` (inclusive) with a step of `1`.
*
* @example
* // Returns [3, 2, 1, 0]
* rangeRight(4);
*/
declare function rangeRight(end: number): number[];
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `1`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `end` (exclusive) to `start` (inclusive) with a step of `1`.
*
* @example
* // Returns [3, 2, 1]
* rangeRight(1, 4);
*/
declare function rangeRight(start: number, end: number): number[];
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`.
*
* @example
* // Returns [15, 10, 5, 0]
* rangeRight(0, 20, 5);
*/
declare function rangeRight(start: number, end: number, step: number): number[];
//#endregion
export { rangeRight };

View file

@ -0,0 +1,39 @@
//#region src/math/rangeRight.d.ts
/**
* Returns an array of numbers from `end` (exclusive) to `0` (inclusive), decrementing by `1`.
*
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `end` (exclusive) to `0` (inclusive) with a step of `1`.
*
* @example
* // Returns [3, 2, 1, 0]
* rangeRight(4);
*/
declare function rangeRight(end: number): number[];
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `1`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @returns An array of numbers from `end` (exclusive) to `start` (inclusive) with a step of `1`.
*
* @example
* // Returns [3, 2, 1]
* rangeRight(1, 4);
*/
declare function rangeRight(start: number, end: number): number[];
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`.
*
* @example
* // Returns [15, 10, 5, 0]
* rangeRight(0, 20, 5);
*/
declare function rangeRight(start: number, end: number, step: number): number[];
//#endregion
export { rangeRight };

View file

@ -0,0 +1,31 @@
//#region src/math/rangeRight.ts
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`.
* @throws {Error} Throws an error if the step value is not a non-zero integer.
*
* @example
* // Returns [3, 2, 1, 0]
* rangeRight(4);
*
* @example
* // Returns [-3, -2, -1, 0]
* rangeRight(0, -4, -1);
*/
function rangeRight(start, end, step = 1) {
if (end == null) {
end = start;
start = 0;
}
if (!Number.isInteger(step) || step === 0) throw new Error(`The step value must be a non-zero integer.`);
const length = Math.max(Math.ceil((end - start) / step), 0);
const result = new Array(length);
for (let i = 0; i < length; i++) result[i] = start + (length - i - 1) * step;
return result;
}
//#endregion
exports.rangeRight = rangeRight;

View file

@ -0,0 +1,31 @@
//#region src/math/rangeRight.ts
/**
* Returns an array of numbers from `end` (exclusive) to `start` (inclusive), decrementing by `step`.
*
* @param start - The starting number of the range (inclusive).
* @param end - The end number of the range (exclusive).
* @param step - The step value for the range.
* @returns An array of numbers from `end` (exclusive) to `start` (inclusive) with the specified `step`.
* @throws {Error} Throws an error if the step value is not a non-zero integer.
*
* @example
* // Returns [3, 2, 1, 0]
* rangeRight(4);
*
* @example
* // Returns [-3, -2, -1, 0]
* rangeRight(0, -4, -1);
*/
function rangeRight(start, end, step = 1) {
if (end == null) {
end = start;
start = 0;
}
if (!Number.isInteger(step) || step === 0) throw new Error(`The step value must be a non-zero integer.`);
const length = Math.max(Math.ceil((end - start) / step), 0);
const result = new Array(length);
for (let i = 0; i < length; i++) result[i] = start + (length - i - 1) * step;
return result;
}
//#endregion
export { rangeRight };

21
frontend/node_modules/es-toolkit/dist/math/round.d.mts generated vendored Normal file
View file

@ -0,0 +1,21 @@
//#region src/math/round.d.ts
/**
* Rounds a number to a specified precision.
*
* This function takes a number and an optional precision value, and returns the number rounded
* to the specified number of decimal places.
*
* @param value - The number to round.
* @param [precision=0] - The number of decimal places to round to. Defaults to 0.
* @returns The rounded number.
* @throws {Error} Throws an error if `Precision` is not integer.
*
* @example
* const result1 = round(1.2345); // result1 will be 1
* const result2 = round(1.2345, 2); // result2 will be 1.23
* const result3 = round(1.2345, 3); // result3 will be 1.235
* const result4 = round(1.2345, 3.1); // This will throw an error
*/
declare function round(value: number, precision?: number): number;
//#endregion
export { round };

21
frontend/node_modules/es-toolkit/dist/math/round.d.ts generated vendored Normal file
View file

@ -0,0 +1,21 @@
//#region src/math/round.d.ts
/**
* Rounds a number to a specified precision.
*
* This function takes a number and an optional precision value, and returns the number rounded
* to the specified number of decimal places.
*
* @param value - The number to round.
* @param [precision=0] - The number of decimal places to round to. Defaults to 0.
* @returns The rounded number.
* @throws {Error} Throws an error if `Precision` is not integer.
*
* @example
* const result1 = round(1.2345); // result1 will be 1
* const result2 = round(1.2345, 2); // result2 will be 1.23
* const result3 = round(1.2345, 3); // result3 will be 1.235
* const result4 = round(1.2345, 3.1); // This will throw an error
*/
declare function round(value: number, precision?: number): number;
//#endregion
export { round };

25
frontend/node_modules/es-toolkit/dist/math/round.js generated vendored Normal file
View file

@ -0,0 +1,25 @@
//#region src/math/round.ts
/**
* Rounds a number to a specified precision.
*
* This function takes a number and an optional precision value, and returns the number rounded
* to the specified number of decimal places.
*
* @param value - The number to round.
* @param [precision=0] - The number of decimal places to round to. Defaults to 0.
* @returns The rounded number.
* @throws {Error} Throws an error if `Precision` is not integer.
*
* @example
* const result1 = round(1.2345); // result1 will be 1
* const result2 = round(1.2345, 2); // result2 will be 1.23
* const result3 = round(1.2345, 3); // result3 will be 1.235
* const result4 = round(1.2345, 3.1); // This will throw an error
*/
function round(value, precision = 0) {
if (!Number.isInteger(precision)) throw new Error("Precision must be an integer.");
const multiplier = Math.pow(10, precision);
return Math.round(value * multiplier) / multiplier;
}
//#endregion
exports.round = round;

25
frontend/node_modules/es-toolkit/dist/math/round.mjs generated vendored Normal file
View file

@ -0,0 +1,25 @@
//#region src/math/round.ts
/**
* Rounds a number to a specified precision.
*
* This function takes a number and an optional precision value, and returns the number rounded
* to the specified number of decimal places.
*
* @param value - The number to round.
* @param [precision=0] - The number of decimal places to round to. Defaults to 0.
* @returns The rounded number.
* @throws {Error} Throws an error if `Precision` is not integer.
*
* @example
* const result1 = round(1.2345); // result1 will be 1
* const result2 = round(1.2345, 2); // result2 will be 1.23
* const result3 = round(1.2345, 3); // result3 will be 1.235
* const result4 = round(1.2345, 3.1); // This will throw an error
*/
function round(value, precision = 0) {
if (!Number.isInteger(precision)) throw new Error("Precision must be an integer.");
const multiplier = Math.pow(10, precision);
return Math.round(value * multiplier) / multiplier;
}
//#endregion
export { round };

17
frontend/node_modules/es-toolkit/dist/math/sum.d.mts generated vendored Normal file
View file

@ -0,0 +1,17 @@
//#region src/math/sum.d.ts
/**
* Calculates the sum of an array of numbers.
*
* This function takes an array of numbers and returns the sum of all the elements in the array.
*
* @param nums - An array of numbers to be summed.
* @returns The sum of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = sum(numbers);
* // result will be 15
*/
declare function sum(nums: readonly number[]): number;
//#endregion
export { sum };

17
frontend/node_modules/es-toolkit/dist/math/sum.d.ts generated vendored Normal file
View file

@ -0,0 +1,17 @@
//#region src/math/sum.d.ts
/**
* Calculates the sum of an array of numbers.
*
* This function takes an array of numbers and returns the sum of all the elements in the array.
*
* @param nums - An array of numbers to be summed.
* @returns The sum of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = sum(numbers);
* // result will be 15
*/
declare function sum(nums: readonly number[]): number;
//#endregion
export { sum };

21
frontend/node_modules/es-toolkit/dist/math/sum.js generated vendored Normal file
View file

@ -0,0 +1,21 @@
//#region src/math/sum.ts
/**
* Calculates the sum of an array of numbers.
*
* This function takes an array of numbers and returns the sum of all the elements in the array.
*
* @param nums - An array of numbers to be summed.
* @returns The sum of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = sum(numbers);
* // result will be 15
*/
function sum(nums) {
let result = 0;
for (let i = 0; i < nums.length; i++) result += nums[i];
return result;
}
//#endregion
exports.sum = sum;

21
frontend/node_modules/es-toolkit/dist/math/sum.mjs generated vendored Normal file
View file

@ -0,0 +1,21 @@
//#region src/math/sum.ts
/**
* Calculates the sum of an array of numbers.
*
* This function takes an array of numbers and returns the sum of all the elements in the array.
*
* @param nums - An array of numbers to be summed.
* @returns The sum of all the numbers in the array.
*
* @example
* const numbers = [1, 2, 3, 4, 5];
* const result = sum(numbers);
* // result will be 15
*/
function sum(nums) {
let result = 0;
for (let i = 0; i < nums.length; i++) result += nums[i];
return result;
}
//#endregion
export { sum };

20
frontend/node_modules/es-toolkit/dist/math/sumBy.d.mts generated vendored Normal file
View file

@ -0,0 +1,20 @@
//#region src/math/sumBy.d.ts
/**
* Calculates the sum of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `0`.
*
* @template T - The type of elements in the array.
* @param items - An array to calculate the sum.
* @param getValue - A function that selects a numeric value from each element.
* It receives the element and its zerobased index in the array.
* @returns The sum of all the numbers as determined by the `getValue` function.
*
* @example
* sumBy([{ a: 1 }, { a: 2 }, { a: 3 }], (x, i) => x.a * i); // Returns: 8
* sumBy([], () => 1); // Returns: 0
*/
declare function sumBy<T>(items: readonly T[], getValue: (element: T, index: number) => number): number;
//#endregion
export { sumBy };

20
frontend/node_modules/es-toolkit/dist/math/sumBy.d.ts generated vendored Normal file
View file

@ -0,0 +1,20 @@
//#region src/math/sumBy.d.ts
/**
* Calculates the sum of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `0`.
*
* @template T - The type of elements in the array.
* @param items - An array to calculate the sum.
* @param getValue - A function that selects a numeric value from each element.
* It receives the element and its zerobased index in the array.
* @returns The sum of all the numbers as determined by the `getValue` function.
*
* @example
* sumBy([{ a: 1 }, { a: 2 }, { a: 3 }], (x, i) => x.a * i); // Returns: 8
* sumBy([], () => 1); // Returns: 0
*/
declare function sumBy<T>(items: readonly T[], getValue: (element: T, index: number) => number): number;
//#endregion
export { sumBy };

24
frontend/node_modules/es-toolkit/dist/math/sumBy.js generated vendored Normal file
View file

@ -0,0 +1,24 @@
//#region src/math/sumBy.ts
/**
* Calculates the sum of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `0`.
*
* @template T - The type of elements in the array.
* @param items - An array to calculate the sum.
* @param getValue - A function that selects a numeric value from each element.
* It receives the element and its zerobased index in the array.
* @returns The sum of all the numbers as determined by the `getValue` function.
*
* @example
* sumBy([{ a: 1 }, { a: 2 }, { a: 3 }], (x, i) => x.a * i); // Returns: 8
* sumBy([], () => 1); // Returns: 0
*/
function sumBy(items, getValue) {
let result = 0;
for (let i = 0; i < items.length; i++) result += getValue(items[i], i);
return result;
}
//#endregion
exports.sumBy = sumBy;

24
frontend/node_modules/es-toolkit/dist/math/sumBy.mjs generated vendored Normal file
View file

@ -0,0 +1,24 @@
//#region src/math/sumBy.ts
/**
* Calculates the sum of an array of numbers when applying
* the `getValue` function to each element.
*
* If the array is empty, this function returns `0`.
*
* @template T - The type of elements in the array.
* @param items - An array to calculate the sum.
* @param getValue - A function that selects a numeric value from each element.
* It receives the element and its zerobased index in the array.
* @returns The sum of all the numbers as determined by the `getValue` function.
*
* @example
* sumBy([{ a: 1 }, { a: 2 }, { a: 3 }], (x, i) => x.a * i); // Returns: 8
* sumBy([], () => 1); // Returns: 0
*/
function sumBy(items, getValue) {
let result = 0;
for (let i = 0; i < items.length; i++) result += getValue(items[i], i);
return result;
}
//#endregion
export { sumBy };