@jrc03c/make-key 0.0.35 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.json +10 -0
- package/dist/make-key.js +134 -252
- package/dist/make-key.min.js +5 -5
- package/package.json +3 -3
package/.prettierrc.json
ADDED
package/dist/make-key.js
CHANGED
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
// node_modules/@jrc03c/js-math-tools/src/assert.mjs
|
|
34
34
|
function assert(isTrue, message) {
|
|
35
|
-
if (!isTrue)
|
|
36
|
-
throw new MathError(message);
|
|
35
|
+
if (!isTrue) throw new MathError(message);
|
|
37
36
|
}
|
|
38
37
|
|
|
39
38
|
// node_modules/@jrc03c/js-math-tools/src/helpers/array-types.mjs
|
|
@@ -240,8 +239,7 @@
|
|
|
240
239
|
}
|
|
241
240
|
}
|
|
242
241
|
if (typeof x2 === "object") {
|
|
243
|
-
if (x2 === null)
|
|
244
|
-
return null;
|
|
242
|
+
if (x2 === null) return null;
|
|
245
243
|
checked.push(x2);
|
|
246
244
|
if (isArray(x2)) {
|
|
247
245
|
if (typeof x2.constructor !== "undefined" && x2.constructor.name !== "Array") {
|
|
@@ -290,12 +288,9 @@
|
|
|
290
288
|
const bType = typeof b2;
|
|
291
289
|
if (aType !== bType && !numberTypes.includes(aType) && !numberTypes.includes(bType))
|
|
292
290
|
return false;
|
|
293
|
-
if (aType === "undefined" && bType === "undefined")
|
|
294
|
-
|
|
295
|
-
if (aType === "
|
|
296
|
-
return a2 === b2;
|
|
297
|
-
if (aType === "symbol")
|
|
298
|
-
return a2 === b2;
|
|
291
|
+
if (aType === "undefined" && bType === "undefined") return true;
|
|
292
|
+
if (aType === "boolean") return a2 === b2;
|
|
293
|
+
if (aType === "symbol") return a2 === b2;
|
|
299
294
|
if (aType === "number" || aType === "bigint") {
|
|
300
295
|
try {
|
|
301
296
|
const aString = a2.toString();
|
|
@@ -305,10 +300,8 @@
|
|
|
305
300
|
return false;
|
|
306
301
|
}
|
|
307
302
|
}
|
|
308
|
-
if (aType === "string")
|
|
309
|
-
|
|
310
|
-
if (aType === "function")
|
|
311
|
-
return a2 === b2;
|
|
303
|
+
if (aType === "string") return a2 === b2;
|
|
304
|
+
if (aType === "function") return a2 === b2;
|
|
312
305
|
if (aType === "object") {
|
|
313
306
|
if (a2 === null || b2 === null) {
|
|
314
307
|
return a2 === null && b2 === null;
|
|
@@ -330,12 +323,10 @@
|
|
|
330
323
|
}
|
|
331
324
|
const aKeys = Object.keys(a2).concat(Object.getOwnPropertySymbols(a2));
|
|
332
325
|
const bKeys = Object.keys(b2).concat(Object.getOwnPropertySymbols(b2));
|
|
333
|
-
if (aKeys.length !== bKeys.length)
|
|
334
|
-
return false;
|
|
326
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
335
327
|
for (let i = 0; i < aKeys.length; i++) {
|
|
336
328
|
const key = aKeys[i];
|
|
337
|
-
if (!helper4(a2[key], b2[key]))
|
|
338
|
-
return false;
|
|
329
|
+
if (!helper4(a2[key], b2[key])) return false;
|
|
339
330
|
}
|
|
340
331
|
return true;
|
|
341
332
|
}
|
|
@@ -352,8 +343,7 @@
|
|
|
352
343
|
function makeKey(n) {
|
|
353
344
|
const alpha = "abcdefg1234567890";
|
|
354
345
|
let out = "";
|
|
355
|
-
while (out.length < n)
|
|
356
|
-
out += alpha[Math.floor(Math.random() * alpha.length)];
|
|
346
|
+
while (out.length < n) out += alpha[Math.floor(Math.random() * alpha.length)];
|
|
357
347
|
return out;
|
|
358
348
|
}
|
|
359
349
|
var NULL_KEY = makeKey(16);
|
|
@@ -636,13 +626,11 @@
|
|
|
636
626
|
var error = "You must pass a natural number or a one-dimensional array of natural numbers into the `ndarray` function!";
|
|
637
627
|
function ndarray(shape2) {
|
|
638
628
|
assert(!isUndefined(shape2), error);
|
|
639
|
-
if (!isArray(shape2))
|
|
640
|
-
shape2 = [shape2];
|
|
629
|
+
if (!isArray(shape2)) shape2 = [shape2];
|
|
641
630
|
assert(!isNested(shape2), error);
|
|
642
631
|
assert(shape2.length > 0, error);
|
|
643
632
|
let s2 = shape2[0];
|
|
644
|
-
if (typeof s2 === "bigint")
|
|
645
|
-
s2 = Number(s2);
|
|
633
|
+
if (typeof s2 === "bigint") s2 = Number(s2);
|
|
646
634
|
assert(isNumber(s2), error);
|
|
647
635
|
assert(s2 >= 0, error);
|
|
648
636
|
assert(Math.floor(s2) === s2, error);
|
|
@@ -652,8 +640,7 @@
|
|
|
652
640
|
);
|
|
653
641
|
if (shape2.length === 1) {
|
|
654
642
|
const out = [];
|
|
655
|
-
for (let i = 0; i < s2; i++)
|
|
656
|
-
out.push(void 0);
|
|
643
|
+
for (let i = 0; i < s2; i++) out.push(void 0);
|
|
657
644
|
return out;
|
|
658
645
|
} else {
|
|
659
646
|
const out = [];
|
|
@@ -677,8 +664,7 @@
|
|
|
677
664
|
"The `reverse` function only works on arrays, Series, and DataFrames!"
|
|
678
665
|
);
|
|
679
666
|
const out = [];
|
|
680
|
-
for (let i = arr.length - 1; i >= 0; i--)
|
|
681
|
-
out.push(arr[i]);
|
|
667
|
+
for (let i = arr.length - 1; i >= 0; i--) out.push(arr[i]);
|
|
682
668
|
return out;
|
|
683
669
|
}
|
|
684
670
|
|
|
@@ -719,8 +705,7 @@
|
|
|
719
705
|
out.push(i);
|
|
720
706
|
}
|
|
721
707
|
}
|
|
722
|
-
if (shouldReverse)
|
|
723
|
-
out = reverse(out);
|
|
708
|
+
if (shouldReverse) out = reverse(out);
|
|
724
709
|
return out;
|
|
725
710
|
}
|
|
726
711
|
|
|
@@ -728,8 +713,7 @@
|
|
|
728
713
|
function makeKey2(n) {
|
|
729
714
|
const alpha = "abcdefg1234567890";
|
|
730
715
|
let out = "";
|
|
731
|
-
while (out.length < n)
|
|
732
|
-
out += alpha[Math.floor(Math.random() * alpha.length)];
|
|
716
|
+
while (out.length < n) out += alpha[Math.floor(Math.random() * alpha.length)];
|
|
733
717
|
return out;
|
|
734
718
|
}
|
|
735
719
|
var NULL_KEY2 = makeKey2(256);
|
|
@@ -749,8 +733,7 @@
|
|
|
749
733
|
const temp = {};
|
|
750
734
|
flatten(arr).forEach((item) => {
|
|
751
735
|
const key = typeof item === "object" && item === null ? NULL_KEY2 : isUndefined(item) ? UNDEFINED_KEY2 : isFunction(item) ? item.toString() : typeof item === "symbol" ? item.toString() + " - " + SYMBOL_KEY2 : item === Infinity ? INFINITY_KEY2 : item === -Infinity ? MINUS_INFINITY_KEY2 : typeof item === "bigint" ? item.toString() : isDataFrame(item) ? item.toJSONString() : isSeries(item) ? JSON.stringify(item.toObject()) : JSON.stringify(item);
|
|
752
|
-
if (!temp[key])
|
|
753
|
-
out.push(item);
|
|
736
|
+
if (!temp[key]) out.push(item);
|
|
754
737
|
temp[key] = true;
|
|
755
738
|
});
|
|
756
739
|
return out;
|
|
@@ -1053,8 +1036,7 @@
|
|
|
1053
1036
|
|
|
1054
1037
|
// node_modules/@jrc03c/js-math-tools/src/dataframe/df-copy.mjs
|
|
1055
1038
|
function dfCopy(DataFrame2, df) {
|
|
1056
|
-
if (df.isEmpty)
|
|
1057
|
-
return new DataFrame2();
|
|
1039
|
+
if (df.isEmpty) return new DataFrame2();
|
|
1058
1040
|
const out = new DataFrame2(copy(df.values));
|
|
1059
1041
|
out.columns = df.columns.slice();
|
|
1060
1042
|
out.index = df.index.slice();
|
|
@@ -1063,14 +1045,10 @@
|
|
|
1063
1045
|
|
|
1064
1046
|
// node_modules/@jrc03c/js-math-tools/src/dataframe/df-drop.mjs
|
|
1065
1047
|
function dfDrop(DataFrame2, Series2, df, rows, cols) {
|
|
1066
|
-
if (isUndefined(rows))
|
|
1067
|
-
|
|
1068
|
-
if (
|
|
1069
|
-
|
|
1070
|
-
if (isString(rows) || isNumber(rows))
|
|
1071
|
-
rows = [rows];
|
|
1072
|
-
if (isString(cols) || isNumber(cols))
|
|
1073
|
-
cols = [cols];
|
|
1048
|
+
if (isUndefined(rows)) rows = [];
|
|
1049
|
+
if (isUndefined(cols)) cols = [];
|
|
1050
|
+
if (isString(rows) || isNumber(rows)) rows = [rows];
|
|
1051
|
+
if (isString(cols) || isNumber(cols)) cols = [cols];
|
|
1074
1052
|
assert(
|
|
1075
1053
|
isArray(rows),
|
|
1076
1054
|
"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."
|
|
@@ -1090,15 +1068,13 @@
|
|
|
1090
1068
|
let outIndex, outColumns;
|
|
1091
1069
|
df.index.forEach((row, i) => {
|
|
1092
1070
|
if (rows.indexOf(row) < 0 && rows.indexOf(i) < 0) {
|
|
1093
|
-
if (!outIndex)
|
|
1094
|
-
outIndex = [];
|
|
1071
|
+
if (!outIndex) outIndex = [];
|
|
1095
1072
|
outIndex.push(row);
|
|
1096
1073
|
}
|
|
1097
1074
|
});
|
|
1098
1075
|
df.columns.forEach((col, i) => {
|
|
1099
1076
|
if (cols.indexOf(col) < 0 && cols.indexOf(i) < 0) {
|
|
1100
|
-
if (!outColumns)
|
|
1101
|
-
outColumns = [];
|
|
1077
|
+
if (!outColumns) outColumns = [];
|
|
1102
1078
|
outColumns.push(col);
|
|
1103
1079
|
}
|
|
1104
1080
|
});
|
|
@@ -1106,8 +1082,7 @@
|
|
|
1106
1082
|
if (out instanceof Series2) {
|
|
1107
1083
|
let temp = new DataFrame2();
|
|
1108
1084
|
temp = temp.assign(out);
|
|
1109
|
-
if (df.index.indexOf(out.name) > -1)
|
|
1110
|
-
temp = temp.transpose();
|
|
1085
|
+
if (df.index.indexOf(out.name) > -1) temp = temp.transpose();
|
|
1111
1086
|
out = temp;
|
|
1112
1087
|
}
|
|
1113
1088
|
return out;
|
|
@@ -1145,22 +1120,18 @@
|
|
|
1145
1120
|
let count2 = 0;
|
|
1146
1121
|
for (let i = 0; i < values.length; i++) {
|
|
1147
1122
|
const value = values[i];
|
|
1148
|
-
if (isUndefined(value))
|
|
1149
|
-
|
|
1150
|
-
if (count2 >= threshold)
|
|
1151
|
-
return [];
|
|
1123
|
+
if (isUndefined(value)) count2++;
|
|
1124
|
+
if (count2 >= threshold) return [];
|
|
1152
1125
|
}
|
|
1153
1126
|
} else if (condition === "any") {
|
|
1154
1127
|
for (let i = 0; i < values.length; i++) {
|
|
1155
1128
|
const value = values[i];
|
|
1156
|
-
if (isUndefined(value))
|
|
1157
|
-
return [];
|
|
1129
|
+
if (isUndefined(value)) return [];
|
|
1158
1130
|
}
|
|
1159
1131
|
} else if (condition === "all") {
|
|
1160
1132
|
for (let i = 0; i < values.length; i++) {
|
|
1161
1133
|
const value = values[i];
|
|
1162
|
-
if (!isUndefined(value))
|
|
1163
|
-
return values;
|
|
1134
|
+
if (!isUndefined(value)) return values;
|
|
1164
1135
|
}
|
|
1165
1136
|
return [];
|
|
1166
1137
|
}
|
|
@@ -1171,16 +1142,12 @@
|
|
|
1171
1142
|
if (axis === 0) {
|
|
1172
1143
|
out = out.assign(tempID, out.index);
|
|
1173
1144
|
const newValues = out.values.map(helper4).filter((row) => row.length > 0);
|
|
1174
|
-
if (shape(newValues).length < 2)
|
|
1175
|
-
return new DataFrame2();
|
|
1145
|
+
if (shape(newValues).length < 2) return new DataFrame2();
|
|
1176
1146
|
out.values = newValues;
|
|
1177
1147
|
let newIndex = out.get(null, tempID);
|
|
1178
|
-
if (isUndefined(newIndex))
|
|
1179
|
-
|
|
1180
|
-
if (
|
|
1181
|
-
newIndex = [newIndex];
|
|
1182
|
-
if (newIndex instanceof Series2)
|
|
1183
|
-
newIndex = newIndex.values;
|
|
1148
|
+
if (isUndefined(newIndex)) return new DataFrame2();
|
|
1149
|
+
if (isString(newIndex)) newIndex = [newIndex];
|
|
1150
|
+
if (newIndex instanceof Series2) newIndex = newIndex.values;
|
|
1184
1151
|
out.index = newIndex;
|
|
1185
1152
|
out = out.drop(null, tempID);
|
|
1186
1153
|
} else if (axis === 1) {
|
|
@@ -1243,12 +1210,9 @@
|
|
|
1243
1210
|
);
|
|
1244
1211
|
function helper4(values) {
|
|
1245
1212
|
const numericalValues = dropNaN(values);
|
|
1246
|
-
if (threshold > 0)
|
|
1247
|
-
|
|
1248
|
-
if (condition === "
|
|
1249
|
-
return numericalValues.length === values.length;
|
|
1250
|
-
if (condition === "all")
|
|
1251
|
-
return numericalValues.length > 0;
|
|
1213
|
+
if (threshold > 0) return values.length - numericalValues.length < threshold;
|
|
1214
|
+
if (condition === "any") return numericalValues.length === values.length;
|
|
1215
|
+
if (condition === "all") return numericalValues.length > 0;
|
|
1252
1216
|
return true;
|
|
1253
1217
|
}
|
|
1254
1218
|
const out = df.copy();
|
|
@@ -1257,19 +1221,15 @@
|
|
|
1257
1221
|
const values = out.get(row, null).values;
|
|
1258
1222
|
return helper4(values);
|
|
1259
1223
|
});
|
|
1260
|
-
if (rowsToKeep.length > 0)
|
|
1261
|
-
|
|
1262
|
-
else
|
|
1263
|
-
return new DataFrame2();
|
|
1224
|
+
if (rowsToKeep.length > 0) return out.get(rowsToKeep, null);
|
|
1225
|
+
else return new DataFrame2();
|
|
1264
1226
|
} else if (axis === 1) {
|
|
1265
1227
|
const colsToKeep = out.columns.filter((col) => {
|
|
1266
1228
|
const values = out.get(null, col).values;
|
|
1267
1229
|
return helper4(values);
|
|
1268
1230
|
});
|
|
1269
|
-
if (colsToKeep.length > 0)
|
|
1270
|
-
|
|
1271
|
-
else
|
|
1272
|
-
return new DataFrame2();
|
|
1231
|
+
if (colsToKeep.length > 0) return out.get(null, colsToKeep);
|
|
1232
|
+
else return new DataFrame2();
|
|
1273
1233
|
}
|
|
1274
1234
|
return out;
|
|
1275
1235
|
}
|
|
@@ -1290,15 +1250,13 @@
|
|
|
1290
1250
|
isFunction(fn),
|
|
1291
1251
|
"The `filter` method takes a single parameter: a function that is used to filter the values."
|
|
1292
1252
|
);
|
|
1293
|
-
if (isUndefined(axis))
|
|
1294
|
-
axis = 0;
|
|
1253
|
+
if (isUndefined(axis)) axis = 0;
|
|
1295
1254
|
assert(
|
|
1296
1255
|
axis === 0 || axis === 1,
|
|
1297
1256
|
"The `axis` parameter to the `filter` method must be 0 or 1."
|
|
1298
1257
|
);
|
|
1299
1258
|
let out = df.copy();
|
|
1300
|
-
if (out.isEmpty)
|
|
1301
|
-
return out;
|
|
1259
|
+
if (out.isEmpty) return out;
|
|
1302
1260
|
const index = arrayToObject(out.index);
|
|
1303
1261
|
const columns = arrayToObject(out.columns);
|
|
1304
1262
|
if (axis === 0) {
|
|
@@ -1359,10 +1317,8 @@
|
|
|
1359
1317
|
|
|
1360
1318
|
// node_modules/@jrc03c/js-math-tools/src/dataframe/df-get.mjs
|
|
1361
1319
|
function dfGet(df, rows, cols) {
|
|
1362
|
-
if (isString(rows) || isNumber(rows))
|
|
1363
|
-
|
|
1364
|
-
if (isString(cols) || isNumber(cols))
|
|
1365
|
-
cols = [cols];
|
|
1320
|
+
if (isString(rows) || isNumber(rows)) rows = [rows];
|
|
1321
|
+
if (isString(cols) || isNumber(cols)) cols = [cols];
|
|
1366
1322
|
for (const i in rows) {
|
|
1367
1323
|
if (typeof rows[i] === "bigint") {
|
|
1368
1324
|
rows[i] = Number(rows[i]);
|
|
@@ -1428,24 +1384,19 @@
|
|
|
1428
1384
|
// node_modules/@jrc03c/js-math-tools/src/sort.mjs
|
|
1429
1385
|
function alphaSort(a, b) {
|
|
1430
1386
|
try {
|
|
1431
|
-
if (a < b)
|
|
1432
|
-
|
|
1433
|
-
if (a > b)
|
|
1434
|
-
return 1;
|
|
1387
|
+
if (a < b) return -1;
|
|
1388
|
+
if (a > b) return 1;
|
|
1435
1389
|
return 0;
|
|
1436
1390
|
} catch (e) {
|
|
1437
1391
|
a = typeof a === "object" && a !== null ? JSON.stringify(a) : a.toString();
|
|
1438
1392
|
b = typeof b === "object" && b !== null ? JSON.stringify(b) : b.toString();
|
|
1439
|
-
if (a < b)
|
|
1440
|
-
|
|
1441
|
-
if (a > b)
|
|
1442
|
-
return 1;
|
|
1393
|
+
if (a < b) return -1;
|
|
1394
|
+
if (a > b) return 1;
|
|
1443
1395
|
return 0;
|
|
1444
1396
|
}
|
|
1445
1397
|
}
|
|
1446
1398
|
function sort(arr, fn) {
|
|
1447
|
-
if (isUndefined(fn))
|
|
1448
|
-
fn = alphaSort;
|
|
1399
|
+
if (isUndefined(fn)) fn = alphaSort;
|
|
1449
1400
|
if (isDataFrame(arr) || isSeries(arr)) {
|
|
1450
1401
|
return arr.sort(...Object.values(arguments).slice(1));
|
|
1451
1402
|
}
|
|
@@ -1518,14 +1469,10 @@
|
|
|
1518
1469
|
// node_modules/@jrc03c/js-math-tools/src/dataframe/df-get-subset-by-indices.mjs
|
|
1519
1470
|
function dfGetSubsetByIndices(df, rowIndices, colIndices) {
|
|
1520
1471
|
const dataShape = df.shape;
|
|
1521
|
-
if (isUndefined(rowIndices))
|
|
1522
|
-
|
|
1523
|
-
if (
|
|
1524
|
-
|
|
1525
|
-
if (isNumber(rowIndices))
|
|
1526
|
-
rowIndices = [rowIndices];
|
|
1527
|
-
if (isNumber(colIndices))
|
|
1528
|
-
colIndices = [colIndices];
|
|
1472
|
+
if (isUndefined(rowIndices)) rowIndices = range(0, dataShape[0]);
|
|
1473
|
+
if (isUndefined(colIndices)) colIndices = range(0, dataShape[1]);
|
|
1474
|
+
if (isNumber(rowIndices)) rowIndices = [rowIndices];
|
|
1475
|
+
if (isNumber(colIndices)) colIndices = [colIndices];
|
|
1529
1476
|
assert(
|
|
1530
1477
|
isArray(rowIndices) && isArray(colIndices),
|
|
1531
1478
|
"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."
|
|
@@ -1569,14 +1516,10 @@
|
|
|
1569
1516
|
|
|
1570
1517
|
// node_modules/@jrc03c/js-math-tools/src/dataframe/df-get-subset-by-names.mjs
|
|
1571
1518
|
function dfGetSubsetByNames(DataFrame2, Series2, df, rows, cols) {
|
|
1572
|
-
if (isUndefined(rows))
|
|
1573
|
-
|
|
1574
|
-
if (
|
|
1575
|
-
|
|
1576
|
-
if (isString(rows))
|
|
1577
|
-
rows = [rows];
|
|
1578
|
-
if (isString(cols))
|
|
1579
|
-
cols = [cols];
|
|
1519
|
+
if (isUndefined(rows)) rows = df.index;
|
|
1520
|
+
if (isUndefined(cols)) cols = df.columns;
|
|
1521
|
+
if (isString(rows)) rows = [rows];
|
|
1522
|
+
if (isString(cols)) cols = [cols];
|
|
1580
1523
|
assert(
|
|
1581
1524
|
isArray(rows) && isArray(cols),
|
|
1582
1525
|
"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."
|
|
@@ -1659,7 +1602,7 @@
|
|
|
1659
1602
|
}
|
|
1660
1603
|
const maxRows = typeof window === "undefined" ? 20 : 10;
|
|
1661
1604
|
const halfMaxRows = Math.floor(maxRows / 2);
|
|
1662
|
-
const maxColumns =
|
|
1605
|
+
const maxColumns = 4;
|
|
1663
1606
|
const halfMaxColumns = Math.floor(maxColumns / 2);
|
|
1664
1607
|
const tempRows = maxRows > df.index.length ? null : range(0, halfMaxRows).concat(
|
|
1665
1608
|
range(df.index.length - halfMaxRows, df.index.length)
|
|
@@ -1715,8 +1658,7 @@
|
|
|
1715
1658
|
function leftPad(x, maxLength) {
|
|
1716
1659
|
assert(isNumber(x), "The `leftPad` function only works on numbers!");
|
|
1717
1660
|
let out = x.toString();
|
|
1718
|
-
while (out.length < maxLength)
|
|
1719
|
-
out = "0" + out;
|
|
1661
|
+
while (out.length < maxLength) out = "0" + out;
|
|
1720
1662
|
return out;
|
|
1721
1663
|
}
|
|
1722
1664
|
|
|
@@ -1739,8 +1681,7 @@
|
|
|
1739
1681
|
"The `product` function only works on arrays, Series, and DataFrames!"
|
|
1740
1682
|
);
|
|
1741
1683
|
try {
|
|
1742
|
-
if (arr.length === 0)
|
|
1743
|
-
return NaN;
|
|
1684
|
+
if (arr.length === 0) return NaN;
|
|
1744
1685
|
const temp = flatten(arr);
|
|
1745
1686
|
let resultShouldBeABigInt = false;
|
|
1746
1687
|
let out = 1;
|
|
@@ -1784,8 +1725,7 @@
|
|
|
1784
1725
|
isArray(x),
|
|
1785
1726
|
"The first argument passed into the `reshape` function must be an array!"
|
|
1786
1727
|
);
|
|
1787
|
-
if (isNumber(newShape))
|
|
1788
|
-
newShape = [newShape];
|
|
1728
|
+
if (isNumber(newShape)) newShape = [newShape];
|
|
1789
1729
|
assert(
|
|
1790
1730
|
isArray(newShape),
|
|
1791
1731
|
"The second argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"
|
|
@@ -1838,8 +1778,7 @@
|
|
|
1838
1778
|
return z ^ z >> BigInt(31);
|
|
1839
1779
|
}
|
|
1840
1780
|
const out = [];
|
|
1841
|
-
for (let i = 0; i < n; i++)
|
|
1842
|
-
out.push(helper4());
|
|
1781
|
+
for (let i = 0; i < n; i++) out.push(helper4());
|
|
1843
1782
|
return out;
|
|
1844
1783
|
}
|
|
1845
1784
|
function uint(x) {
|
|
@@ -1880,10 +1819,8 @@
|
|
|
1880
1819
|
return Math.floor(Number(result)) / MAX;
|
|
1881
1820
|
}
|
|
1882
1821
|
function random(shape2) {
|
|
1883
|
-
if (isUndefined(shape2))
|
|
1884
|
-
|
|
1885
|
-
if (!isArray(shape2))
|
|
1886
|
-
shape2 = [shape2];
|
|
1822
|
+
if (isUndefined(shape2)) return next();
|
|
1823
|
+
if (!isArray(shape2)) shape2 = [shape2];
|
|
1887
1824
|
return reshape(ndarray(product(shape2)).map(next), shape2);
|
|
1888
1825
|
}
|
|
1889
1826
|
|
|
@@ -1907,8 +1844,7 @@
|
|
|
1907
1844
|
|
|
1908
1845
|
// node_modules/@jrc03c/js-math-tools/src/dataframe/df-shuffle.mjs
|
|
1909
1846
|
function dfShuffle(df, axis) {
|
|
1910
|
-
if (isUndefined(axis))
|
|
1911
|
-
axis = 0;
|
|
1847
|
+
if (isUndefined(axis)) axis = 0;
|
|
1912
1848
|
assert(
|
|
1913
1849
|
axis === 0 || axis === 1,
|
|
1914
1850
|
"The `axis` parameter to the `shuffle` must be 0, 1, or undefined."
|
|
@@ -1964,8 +1900,7 @@
|
|
|
1964
1900
|
}
|
|
1965
1901
|
if (isNumber(cols) || isString(cols)) {
|
|
1966
1902
|
cols = [cols];
|
|
1967
|
-
if (isBoolean(directions) || isString(directions))
|
|
1968
|
-
directions = [directions];
|
|
1903
|
+
if (isBoolean(directions) || isString(directions)) directions = [directions];
|
|
1969
1904
|
}
|
|
1970
1905
|
assert(
|
|
1971
1906
|
isArray(cols),
|
|
@@ -2028,12 +1963,9 @@
|
|
|
2028
1963
|
counter++;
|
|
2029
1964
|
}
|
|
2030
1965
|
const isAscending = directions[counter];
|
|
2031
|
-
if (a[cols[counter]] === b[cols[counter]])
|
|
2032
|
-
|
|
2033
|
-
if (a[cols[counter]]
|
|
2034
|
-
return isAscending ? -1 : 1;
|
|
2035
|
-
if (a[cols[counter]] > b[cols[counter]])
|
|
2036
|
-
return isAscending ? 1 : -1;
|
|
1966
|
+
if (a[cols[counter]] === b[cols[counter]]) return 0;
|
|
1967
|
+
if (a[cols[counter]] < b[cols[counter]]) return isAscending ? -1 : 1;
|
|
1968
|
+
if (a[cols[counter]] > b[cols[counter]]) return isAscending ? 1 : -1;
|
|
2037
1969
|
});
|
|
2038
1970
|
const indexNumber = out.columns.indexOf(indexID);
|
|
2039
1971
|
out.index = out.values.map((row) => row[indexNumber]);
|
|
@@ -2189,8 +2121,7 @@
|
|
|
2189
2121
|
const indicesToRemove = [];
|
|
2190
2122
|
const newValues = out.values.filter((value, i) => {
|
|
2191
2123
|
const shouldKeep = fn(value, i, out.values);
|
|
2192
|
-
if (!shouldKeep)
|
|
2193
|
-
indicesToRemove.push(out.index[i]);
|
|
2124
|
+
if (!shouldKeep) indicesToRemove.push(out.index[i]);
|
|
2194
2125
|
return shouldKeep;
|
|
2195
2126
|
});
|
|
2196
2127
|
indicesToRemove.forEach((i) => {
|
|
@@ -2208,8 +2139,7 @@
|
|
|
2208
2139
|
|
|
2209
2140
|
// node_modules/@jrc03c/js-math-tools/src/series/series-get.mjs
|
|
2210
2141
|
function seriesGet(series, indices) {
|
|
2211
|
-
if (isString(indices) || isNumber(indices))
|
|
2212
|
-
indices = [indices];
|
|
2142
|
+
if (isString(indices) || isNumber(indices)) indices = [indices];
|
|
2213
2143
|
for (const i in indices) {
|
|
2214
2144
|
if (typeof indices[i] === "bigint") {
|
|
2215
2145
|
indices[i] = Number(indices[i]);
|
|
@@ -2256,8 +2186,7 @@
|
|
|
2256
2186
|
// node_modules/@jrc03c/js-math-tools/src/series/series-get-subset-by-indices.mjs
|
|
2257
2187
|
function seriesGetSubsetByIndices(series, indices) {
|
|
2258
2188
|
const dataShape = series.shape;
|
|
2259
|
-
if (isUndefined(indices))
|
|
2260
|
-
indices = range(0, dataShape[0]);
|
|
2189
|
+
if (isUndefined(indices)) indices = range(0, dataShape[0]);
|
|
2261
2190
|
assert(
|
|
2262
2191
|
isArray(indices),
|
|
2263
2192
|
"The `indices` array must be 1-dimensional array of whole numbers."
|
|
@@ -2286,8 +2215,7 @@
|
|
|
2286
2215
|
|
|
2287
2216
|
// node_modules/@jrc03c/js-math-tools/src/series/series-get-subset-by-names.mjs
|
|
2288
2217
|
function seriesGetSubsetByNames(Series2, series, indices) {
|
|
2289
|
-
if (isUndefined(indices))
|
|
2290
|
-
indices = series.index;
|
|
2218
|
+
if (isUndefined(indices)) indices = series.index;
|
|
2291
2219
|
assert(
|
|
2292
2220
|
isArray(indices),
|
|
2293
2221
|
"The `indices` array must be a 1-dimensional array of strings."
|
|
@@ -2310,8 +2238,7 @@
|
|
|
2310
2238
|
const values = indices.map((name) => {
|
|
2311
2239
|
return series.values[series.index.indexOf(name)];
|
|
2312
2240
|
});
|
|
2313
|
-
if (values.length === 1)
|
|
2314
|
-
return values[0];
|
|
2241
|
+
if (values.length === 1) return values[0];
|
|
2315
2242
|
const out = new Series2(values);
|
|
2316
2243
|
out.index = indices;
|
|
2317
2244
|
out.name = series.name;
|
|
@@ -2380,12 +2307,9 @@
|
|
|
2380
2307
|
let temp = transpose([series.values, series.index]);
|
|
2381
2308
|
temp = transpose(
|
|
2382
2309
|
sort(temp, (a, b) => {
|
|
2383
|
-
if (a[1] === b[1])
|
|
2384
|
-
|
|
2385
|
-
if (a[1]
|
|
2386
|
-
return -1;
|
|
2387
|
-
if (a[1] > b[1])
|
|
2388
|
-
return 1;
|
|
2310
|
+
if (a[1] === b[1]) return 0;
|
|
2311
|
+
if (a[1] < b[1]) return -1;
|
|
2312
|
+
if (a[1] > b[1]) return 1;
|
|
2389
2313
|
})
|
|
2390
2314
|
);
|
|
2391
2315
|
const out = new Series2(temp[0]);
|
|
@@ -2625,11 +2549,10 @@
|
|
|
2625
2549
|
function makeKey3(n) {
|
|
2626
2550
|
const alpha = "abcdefghijklmnopqrstuvwxyz1234567890";
|
|
2627
2551
|
let out = "";
|
|
2628
|
-
for (let i = 0; i < n; i++)
|
|
2629
|
-
out += alpha[Math.floor(random() * alpha.length)];
|
|
2552
|
+
for (let i = 0; i < n; i++) out += alpha[Math.floor(random() * alpha.length)];
|
|
2630
2553
|
return out;
|
|
2631
2554
|
}
|
|
2632
|
-
var DataFrame = class {
|
|
2555
|
+
var DataFrame = class _DataFrame {
|
|
2633
2556
|
static [Symbol.hasInstance](x) {
|
|
2634
2557
|
try {
|
|
2635
2558
|
return !!x._symbol && x._symbol === DATAFRAME_SYMBOL;
|
|
@@ -2794,7 +2717,7 @@
|
|
|
2794
2717
|
"The `data` passed into the constructor of a DataFrame must be either (1) an object where the key-value pairs are (respectively) column names and 1-dimensional arrays of values, or (2) a 2-dimensional array of values."
|
|
2795
2718
|
);
|
|
2796
2719
|
if (data) {
|
|
2797
|
-
if (data instanceof
|
|
2720
|
+
if (data instanceof _DataFrame) {
|
|
2798
2721
|
this.values = copy(data.values);
|
|
2799
2722
|
this.columns = copy(data.columns);
|
|
2800
2723
|
this.index = copy(data.index);
|
|
@@ -2854,7 +2777,7 @@
|
|
|
2854
2777
|
return this.values.length === 0 || this.values.every((row) => row.length === 0);
|
|
2855
2778
|
}
|
|
2856
2779
|
clear() {
|
|
2857
|
-
const out = new
|
|
2780
|
+
const out = new _DataFrame(ndarray(this.shape));
|
|
2858
2781
|
out.columns = this.columns.slice();
|
|
2859
2782
|
out.index = this.index.slice();
|
|
2860
2783
|
return out;
|
|
@@ -2873,19 +2796,19 @@
|
|
|
2873
2796
|
return dfGet(this, rows, cols);
|
|
2874
2797
|
}
|
|
2875
2798
|
getSubsetByNames(rows, cols) {
|
|
2876
|
-
return dfGetSubsetByNames(
|
|
2799
|
+
return dfGetSubsetByNames(_DataFrame, Series, this, rows, cols);
|
|
2877
2800
|
}
|
|
2878
2801
|
getSubsetByIndices(rowIndices, colIndices) {
|
|
2879
2802
|
return dfGetSubsetByIndices(this, rowIndices, colIndices);
|
|
2880
2803
|
}
|
|
2881
2804
|
getDummies(columns) {
|
|
2882
|
-
return dfGetDummies(
|
|
2805
|
+
return dfGetDummies(_DataFrame, this, columns);
|
|
2883
2806
|
}
|
|
2884
2807
|
oneHotEncode(columns) {
|
|
2885
|
-
return dfGetDummies(
|
|
2808
|
+
return dfGetDummies(_DataFrame, this, columns);
|
|
2886
2809
|
}
|
|
2887
2810
|
transpose() {
|
|
2888
|
-
const out = new
|
|
2811
|
+
const out = new _DataFrame(transpose(this.values));
|
|
2889
2812
|
out.columns = this.index.slice();
|
|
2890
2813
|
out.index = this.columns.slice();
|
|
2891
2814
|
return out;
|
|
@@ -2897,22 +2820,22 @@
|
|
|
2897
2820
|
return dfResetIndex(this, shouldSkipCopying);
|
|
2898
2821
|
}
|
|
2899
2822
|
copy() {
|
|
2900
|
-
return dfCopy(
|
|
2823
|
+
return dfCopy(_DataFrame, this);
|
|
2901
2824
|
}
|
|
2902
2825
|
assign(p1, p2) {
|
|
2903
|
-
return dfAssign(
|
|
2826
|
+
return dfAssign(_DataFrame, Series, this, p1, p2);
|
|
2904
2827
|
}
|
|
2905
2828
|
apply(fn, axis) {
|
|
2906
|
-
return dfApply(
|
|
2829
|
+
return dfApply(_DataFrame, Series, this, fn, axis);
|
|
2907
2830
|
}
|
|
2908
2831
|
dropMissing(axis, condition, threshold) {
|
|
2909
|
-
return dfDropMissing(
|
|
2832
|
+
return dfDropMissing(_DataFrame, Series, this, axis, condition, threshold);
|
|
2910
2833
|
}
|
|
2911
2834
|
dropNaN(axis, condition, threshold) {
|
|
2912
|
-
return dfDropNaN(
|
|
2835
|
+
return dfDropNaN(_DataFrame, this, axis, condition, threshold);
|
|
2913
2836
|
}
|
|
2914
2837
|
drop(rows, cols) {
|
|
2915
|
-
return dfDrop(
|
|
2838
|
+
return dfDrop(_DataFrame, Series, this, rows, cols);
|
|
2916
2839
|
}
|
|
2917
2840
|
dropColumns(columns) {
|
|
2918
2841
|
return this.drop(null, columns);
|
|
@@ -2933,7 +2856,7 @@
|
|
|
2933
2856
|
return dfToJSON(this, filename, axis);
|
|
2934
2857
|
}
|
|
2935
2858
|
print() {
|
|
2936
|
-
return dfPrint(
|
|
2859
|
+
return dfPrint(_DataFrame, Series, this);
|
|
2937
2860
|
}
|
|
2938
2861
|
sort(cols, directions) {
|
|
2939
2862
|
return dfSort(this, cols, directions);
|
|
@@ -2942,7 +2865,7 @@
|
|
|
2942
2865
|
return this.sort();
|
|
2943
2866
|
}
|
|
2944
2867
|
filter(fn, axis) {
|
|
2945
|
-
return dfFilter(
|
|
2868
|
+
return dfFilter(_DataFrame, Series, this, fn, axis);
|
|
2946
2869
|
}
|
|
2947
2870
|
shuffle(axis) {
|
|
2948
2871
|
return dfShuffle(this, axis);
|
|
@@ -3058,8 +2981,7 @@
|
|
|
3058
2981
|
// node_modules/@jrc03c/js-math-tools/src/abs.mjs
|
|
3059
2982
|
function abs(x) {
|
|
3060
2983
|
try {
|
|
3061
|
-
if (!isNumber(x))
|
|
3062
|
-
return NaN;
|
|
2984
|
+
if (!isNumber(x)) return NaN;
|
|
3063
2985
|
if (typeof x === "bigint") {
|
|
3064
2986
|
return x < 0 ? -x : x;
|
|
3065
2987
|
} else {
|
|
@@ -3078,8 +3000,7 @@
|
|
|
3078
3000
|
let resultShouldBeABigInt = false;
|
|
3079
3001
|
const x = Object.values(arguments);
|
|
3080
3002
|
for (let v of x) {
|
|
3081
|
-
if (!isNumber(v))
|
|
3082
|
-
return NaN;
|
|
3003
|
+
if (!isNumber(v)) return NaN;
|
|
3083
3004
|
if (typeof v === "bigint") {
|
|
3084
3005
|
resultShouldBeABigInt = true;
|
|
3085
3006
|
v = Number(v);
|
|
@@ -3112,8 +3033,7 @@
|
|
|
3112
3033
|
// node_modules/@jrc03c/js-math-tools/src/arccos.mjs
|
|
3113
3034
|
function arccos(x) {
|
|
3114
3035
|
try {
|
|
3115
|
-
if (!isNumber(x))
|
|
3116
|
-
return NaN;
|
|
3036
|
+
if (!isNumber(x)) return NaN;
|
|
3117
3037
|
if (typeof x === "bigint") {
|
|
3118
3038
|
x = Number(x);
|
|
3119
3039
|
}
|
|
@@ -3127,8 +3047,7 @@
|
|
|
3127
3047
|
// node_modules/@jrc03c/js-math-tools/src/arcsin.mjs
|
|
3128
3048
|
function arcsin(x) {
|
|
3129
3049
|
try {
|
|
3130
|
-
if (!isNumber(x))
|
|
3131
|
-
return NaN;
|
|
3050
|
+
if (!isNumber(x)) return NaN;
|
|
3132
3051
|
if (typeof x === "bigint") {
|
|
3133
3052
|
x = Number(x);
|
|
3134
3053
|
}
|
|
@@ -3142,8 +3061,7 @@
|
|
|
3142
3061
|
// node_modules/@jrc03c/js-math-tools/src/arctan.mjs
|
|
3143
3062
|
function arctan(x) {
|
|
3144
3063
|
try {
|
|
3145
|
-
if (!isNumber(x))
|
|
3146
|
-
return NaN;
|
|
3064
|
+
if (!isNumber(x)) return NaN;
|
|
3147
3065
|
if (typeof x === "bigint") {
|
|
3148
3066
|
x = Number(x);
|
|
3149
3067
|
}
|
|
@@ -3157,10 +3075,8 @@
|
|
|
3157
3075
|
// node_modules/@jrc03c/js-math-tools/src/ceil.mjs
|
|
3158
3076
|
function ceil(x) {
|
|
3159
3077
|
try {
|
|
3160
|
-
if (!isNumber(x))
|
|
3161
|
-
|
|
3162
|
-
if (typeof x === "bigint")
|
|
3163
|
-
return x;
|
|
3078
|
+
if (!isNumber(x)) return NaN;
|
|
3079
|
+
if (typeof x === "bigint") return x;
|
|
3164
3080
|
return Math.ceil(x);
|
|
3165
3081
|
} catch (e) {
|
|
3166
3082
|
return NaN;
|
|
@@ -3171,10 +3087,8 @@
|
|
|
3171
3087
|
// node_modules/@jrc03c/js-math-tools/src/chop.mjs
|
|
3172
3088
|
function chop(x, threshold) {
|
|
3173
3089
|
try {
|
|
3174
|
-
if (!isNumber(x))
|
|
3175
|
-
|
|
3176
|
-
if (typeof x === "bigint")
|
|
3177
|
-
return x;
|
|
3090
|
+
if (!isNumber(x)) return NaN;
|
|
3091
|
+
if (typeof x === "bigint") return x;
|
|
3178
3092
|
if (isUndefined(threshold)) {
|
|
3179
3093
|
threshold = 1e-10;
|
|
3180
3094
|
} else if (!isNumber(threshold)) {
|
|
@@ -3213,19 +3127,14 @@
|
|
|
3213
3127
|
// node_modules/@jrc03c/js-math-tools/src/clamp.mjs
|
|
3214
3128
|
function clamp(x, a, b) {
|
|
3215
3129
|
try {
|
|
3216
|
-
if (!isNumber(x))
|
|
3217
|
-
|
|
3218
|
-
if (!isNumber(
|
|
3219
|
-
return NaN;
|
|
3220
|
-
if (!isNumber(b))
|
|
3221
|
-
return NaN;
|
|
3130
|
+
if (!isNumber(x)) return NaN;
|
|
3131
|
+
if (!isNumber(a)) return NaN;
|
|
3132
|
+
if (!isNumber(b)) return NaN;
|
|
3222
3133
|
if (typeof x === "bigint") {
|
|
3223
3134
|
return BigInt(clamp(vint(x), a, b));
|
|
3224
3135
|
}
|
|
3225
|
-
if (x < a)
|
|
3226
|
-
|
|
3227
|
-
if (x > b)
|
|
3228
|
-
return b;
|
|
3136
|
+
if (x < a) return a;
|
|
3137
|
+
if (x > b) return b;
|
|
3229
3138
|
return x;
|
|
3230
3139
|
} catch (e) {
|
|
3231
3140
|
return NaN;
|
|
@@ -3236,8 +3145,7 @@
|
|
|
3236
3145
|
// node_modules/@jrc03c/js-math-tools/src/cos.mjs
|
|
3237
3146
|
function cos(x) {
|
|
3238
3147
|
try {
|
|
3239
|
-
if (!isNumber(x))
|
|
3240
|
-
return NaN;
|
|
3148
|
+
if (!isNumber(x)) return NaN;
|
|
3241
3149
|
if (typeof x === "bigint") {
|
|
3242
3150
|
x = Number(x);
|
|
3243
3151
|
}
|
|
@@ -3261,10 +3169,8 @@
|
|
|
3261
3169
|
// node_modules/@jrc03c/js-math-tools/src/pow.mjs
|
|
3262
3170
|
function pow(x, p) {
|
|
3263
3171
|
try {
|
|
3264
|
-
if (!isNumber(x))
|
|
3265
|
-
|
|
3266
|
-
if (!isNumber(p))
|
|
3267
|
-
return NaN;
|
|
3172
|
+
if (!isNumber(x)) return NaN;
|
|
3173
|
+
if (!isNumber(p)) return NaN;
|
|
3268
3174
|
if (typeof x === "bigint" || typeof p === "bigint") {
|
|
3269
3175
|
const out = pow(Number(x), Number(p));
|
|
3270
3176
|
try {
|
|
@@ -3283,8 +3189,7 @@
|
|
|
3283
3189
|
// node_modules/@jrc03c/js-math-tools/src/sqrt.mjs
|
|
3284
3190
|
function sqrt(x) {
|
|
3285
3191
|
try {
|
|
3286
|
-
if (!isNumber(x))
|
|
3287
|
-
return NaN;
|
|
3192
|
+
if (!isNumber(x)) return NaN;
|
|
3288
3193
|
if (typeof x === "bigint") {
|
|
3289
3194
|
const out = sqrt(Number(x));
|
|
3290
3195
|
try {
|
|
@@ -3304,13 +3209,11 @@
|
|
|
3304
3209
|
function multiply() {
|
|
3305
3210
|
try {
|
|
3306
3211
|
const x = Object.values(arguments);
|
|
3307
|
-
if (x.length === 0)
|
|
3308
|
-
return NaN;
|
|
3212
|
+
if (x.length === 0) return NaN;
|
|
3309
3213
|
let resultShouldBeABigInt = false;
|
|
3310
3214
|
let out = 1;
|
|
3311
3215
|
for (let v of x) {
|
|
3312
|
-
if (!isNumber(v))
|
|
3313
|
-
return NaN;
|
|
3216
|
+
if (!isNumber(v)) return NaN;
|
|
3314
3217
|
if (typeof v === "bigint") {
|
|
3315
3218
|
resultShouldBeABigInt = true;
|
|
3316
3219
|
v = Number(v);
|
|
@@ -3333,8 +3236,7 @@
|
|
|
3333
3236
|
// node_modules/@jrc03c/js-math-tools/src/exp.mjs
|
|
3334
3237
|
function exp(x) {
|
|
3335
3238
|
try {
|
|
3336
|
-
if (!isNumber(x))
|
|
3337
|
-
return NaN;
|
|
3239
|
+
if (!isNumber(x)) return NaN;
|
|
3338
3240
|
if (typeof x === "bigint") {
|
|
3339
3241
|
if (x === 0n) {
|
|
3340
3242
|
return 1n;
|
|
@@ -3355,10 +3257,8 @@
|
|
|
3355
3257
|
if (typeof n === "bigint") {
|
|
3356
3258
|
return BigInt(factorial(vint(n)));
|
|
3357
3259
|
}
|
|
3358
|
-
if (n !== vint(n))
|
|
3359
|
-
|
|
3360
|
-
if (n <= 1)
|
|
3361
|
-
return 1;
|
|
3260
|
+
if (n !== vint(n)) return NaN;
|
|
3261
|
+
if (n <= 1) return 1;
|
|
3362
3262
|
return n * factorial(n - 1);
|
|
3363
3263
|
} catch (e) {
|
|
3364
3264
|
return NaN;
|
|
@@ -3376,8 +3276,7 @@
|
|
|
3376
3276
|
return -Infinity;
|
|
3377
3277
|
}
|
|
3378
3278
|
const out = JSON.parse(x);
|
|
3379
|
-
if (isNumber(out))
|
|
3380
|
-
return out;
|
|
3279
|
+
if (isNumber(out)) return out;
|
|
3381
3280
|
return NaN;
|
|
3382
3281
|
} catch (e) {
|
|
3383
3282
|
return NaN;
|
|
@@ -3388,8 +3287,7 @@
|
|
|
3388
3287
|
// node_modules/@jrc03c/js-math-tools/src/floor.mjs
|
|
3389
3288
|
function floor(x) {
|
|
3390
3289
|
try {
|
|
3391
|
-
if (!isNumber(x))
|
|
3392
|
-
return NaN;
|
|
3290
|
+
if (!isNumber(x)) return NaN;
|
|
3393
3291
|
if (typeof x === "bigint") {
|
|
3394
3292
|
return x;
|
|
3395
3293
|
}
|
|
@@ -3403,12 +3301,9 @@
|
|
|
3403
3301
|
// node_modules/@jrc03c/js-math-tools/src/lerp.mjs
|
|
3404
3302
|
function lerp(a, b, f) {
|
|
3405
3303
|
try {
|
|
3406
|
-
if (!isNumber(a))
|
|
3407
|
-
|
|
3408
|
-
if (!isNumber(
|
|
3409
|
-
return NaN;
|
|
3410
|
-
if (!isNumber(f))
|
|
3411
|
-
return NaN;
|
|
3304
|
+
if (!isNumber(a)) return NaN;
|
|
3305
|
+
if (!isNumber(b)) return NaN;
|
|
3306
|
+
if (!isNumber(f)) return NaN;
|
|
3412
3307
|
if (typeof a === "bigint" || typeof b === "bigint") {
|
|
3413
3308
|
const out = lerp(Number(a), Number(b), f);
|
|
3414
3309
|
try {
|
|
@@ -3428,10 +3323,8 @@
|
|
|
3428
3323
|
function log(x, base) {
|
|
3429
3324
|
try {
|
|
3430
3325
|
base = isUndefined(base) ? Math.E : base;
|
|
3431
|
-
if (!isNumber(x))
|
|
3432
|
-
|
|
3433
|
-
if (!isNumber(base))
|
|
3434
|
-
return NaN;
|
|
3326
|
+
if (!isNumber(x)) return NaN;
|
|
3327
|
+
if (!isNumber(base)) return NaN;
|
|
3435
3328
|
if (typeof x === "bigint" || typeof base === "bigint") {
|
|
3436
3329
|
const out = log(Number(x), Number(base));
|
|
3437
3330
|
try {
|
|
@@ -3450,10 +3343,8 @@
|
|
|
3450
3343
|
// node_modules/@jrc03c/js-math-tools/src/mod.mjs
|
|
3451
3344
|
function mod(a, b) {
|
|
3452
3345
|
try {
|
|
3453
|
-
if (!isNumber(a))
|
|
3454
|
-
|
|
3455
|
-
if (!isNumber(b))
|
|
3456
|
-
return NaN;
|
|
3346
|
+
if (!isNumber(a)) return NaN;
|
|
3347
|
+
if (!isNumber(b)) return NaN;
|
|
3457
3348
|
if (typeof a === "bigint" || typeof b === "bigint") {
|
|
3458
3349
|
const out = mod(Number(a), Number(b));
|
|
3459
3350
|
try {
|
|
@@ -3490,8 +3381,7 @@
|
|
|
3490
3381
|
}
|
|
3491
3382
|
const num = (d - c) * (x - a);
|
|
3492
3383
|
const den = b - a;
|
|
3493
|
-
if (den === 0)
|
|
3494
|
-
return NaN;
|
|
3384
|
+
if (den === 0) return NaN;
|
|
3495
3385
|
const out = num / den + c;
|
|
3496
3386
|
if (resultShouldBeABigInt) {
|
|
3497
3387
|
try {
|
|
@@ -3508,10 +3398,8 @@
|
|
|
3508
3398
|
// node_modules/@jrc03c/js-math-tools/src/round.mjs
|
|
3509
3399
|
function round(x) {
|
|
3510
3400
|
try {
|
|
3511
|
-
if (!isNumber(x))
|
|
3512
|
-
|
|
3513
|
-
if (typeof x === "bigint")
|
|
3514
|
-
return x;
|
|
3401
|
+
if (!isNumber(x)) return NaN;
|
|
3402
|
+
if (typeof x === "bigint") return x;
|
|
3515
3403
|
return Math.round(x);
|
|
3516
3404
|
} catch (e) {
|
|
3517
3405
|
return NaN;
|
|
@@ -3522,14 +3410,10 @@
|
|
|
3522
3410
|
// node_modules/@jrc03c/js-math-tools/src/sign.mjs
|
|
3523
3411
|
function sign(x) {
|
|
3524
3412
|
try {
|
|
3525
|
-
if (!isNumber(x))
|
|
3526
|
-
|
|
3527
|
-
if (
|
|
3528
|
-
|
|
3529
|
-
if (x < 0)
|
|
3530
|
-
return -1;
|
|
3531
|
-
if (x > 0)
|
|
3532
|
-
return 1;
|
|
3413
|
+
if (!isNumber(x)) return NaN;
|
|
3414
|
+
if (typeof x === "bigint") return BigInt(sign(Number(x)));
|
|
3415
|
+
if (x < 0) return -1;
|
|
3416
|
+
if (x > 0) return 1;
|
|
3533
3417
|
return 0;
|
|
3534
3418
|
} catch (e) {
|
|
3535
3419
|
return NaN;
|
|
@@ -3540,8 +3424,7 @@
|
|
|
3540
3424
|
// node_modules/@jrc03c/js-math-tools/src/sin.mjs
|
|
3541
3425
|
function sin(x) {
|
|
3542
3426
|
try {
|
|
3543
|
-
if (!isNumber(x))
|
|
3544
|
-
return NaN;
|
|
3427
|
+
if (!isNumber(x)) return NaN;
|
|
3545
3428
|
if (typeof x === "bigint") {
|
|
3546
3429
|
x = Number(x);
|
|
3547
3430
|
}
|
|
@@ -3555,8 +3438,7 @@
|
|
|
3555
3438
|
// node_modules/@jrc03c/js-math-tools/src/tan.mjs
|
|
3556
3439
|
function tan(x) {
|
|
3557
3440
|
try {
|
|
3558
|
-
if (!isNumber(x))
|
|
3559
|
-
return NaN;
|
|
3441
|
+
if (!isNumber(x)) return NaN;
|
|
3560
3442
|
if (typeof x === "bigint") {
|
|
3561
3443
|
x = Number(x);
|
|
3562
3444
|
}
|
package/dist/make-key.min.js
CHANGED
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
} catch(e){}
|
|
9
9
|
|
|
10
10
|
return false
|
|
11
|
-
`);var
|
|
11
|
+
`);var R=class extends Error{constructor(t){gt()?super(t):super(`
|
|
12
12
|
|
|
13
13
|
\x1B[31m`+t+`
|
|
14
|
-
\x1B[0m`)}};function s(e,t){if(!e)throw new Y(t)}var yt=[Array,ArrayBuffer,BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int16Array,Int32Array,Int8Array,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray];function h(e){return e===null||typeof e>"u"}var Oe=yt.map(e=>e.name);function l(e){try{return e instanceof Array?!0:h(e.constructor)?!1:yt.indexOf(e.constructor)>-1||Oe.indexOf(e.constructor.name)>-1}catch{return!1}}function y(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/dataframe")}catch{return!1}}function O(e){return typeof e=="function"}function k(e){return typeof e=="object"&&!h(e)&&!l(e)}function g(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/series")}catch{return!1}}function V(e,t){if(y(e)){let i=V(e.values,t);return i.length>0&&f(i[0])&&i[0]>=0&&i[0]<e.index.length&&(i[0]=e.index[i[0]]),i.length>1&&f(i[1])&&i[1]>=0&&i[1]<e.columns.length&&(i[1]=e.columns[i[1]]),i}if(g(e)){let i=V(e.values,t);return i.length>0&&f(i[0])&&i[0]>=0&&i[0]<e.index.length&&(i[0]=e.index[i[0]]),i}if(s(k(e)||l(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `indexOf` function!"),!O(t)){let i=t;t=m=>m===i}function n(i,m,a){if(a=a||[],a.indexOf(i)>-1)return null;if(k(i)){a.push(i);let u=Object.keys(i).concat(Object.getOwnPropertySymbols(i));for(let p=0;p<u.length;p++){let c=u[p],d=i[c];if(m(d))return[c];let v=n(d,m,a);if(v&&v.length>0)return[c].concat(v)}}else if(l(i)){a.push(i);for(let u=0;u<i.length;u++){let p=i[u];if(m(p))return[u];let c=n(p,m,a);if(c&&c.length>0)return[u].concat(c)}}else if(m(i))return[];return null}function r(i){try{return t(i)}catch{return!1}}let o=n(e,r);return o&&o.length>0?o:null}function I(e){function t(n){if(typeof n=="object"){if(n===null)return null;if(l(n))return n instanceof Array?n.map(o=>I(o)):n.slice();if(g(n)){let o=n.copy();return o.values=I(o.values),o}if(y(n)){let o=n.copy();return o.values=I(n.values),o}if(n instanceof Date)return new Date(n.getTime());n=L(n);let r={};return Object.keys(n).concat(Object.getOwnPropertySymbols(n)).forEach(o=>{r[o]=I(n[o])}),r}else return n}return t(L(e))}function L(e){function t(o,i,m){if(i=i||[],m=m||"",i.indexOf(o)>-1){let a=m.split("/").slice(m.startsWith("/")?1:0);if(a.some((p,c)=>{let d=a.slice(0,a.length-c-1),v=n;return d.forEach(D=>{v=v[D]}),v===o}))return`<reference to "${n===o?"/":"/"+V(n,o).join("/")}">`}return typeof o=="object"?o===null?null:(i.push(o),l(o)?typeof o.constructor<"u"&&o.constructor.name!=="Array"?o.slice():o.map((a,u)=>t(a,i,m+"/"+u)):(Object.keys(o).concat(Object.getOwnPropertySymbols(o)).forEach(a=>{o[a]=t(o[a],i,m+"/"+a.toString())}),o)):o}let n=e,r=t(n);if(y(e)){let o=e.copy();o._values=r.values,o._columns=r.columns,o._index=r.index,r=o}if(g(e)){let o=e.copy();o.name=r.name,o._values=r.values,o._index=r.index,r=o}return r}function G(e){return e instanceof Date&&e.toString()!=="Invalid Date"}var Dt=["number","int","float","bigint"];function z(e,t){function n(r,o){let i=typeof r,m=typeof o;if(i!==m&&!Dt.includes(i)&&!Dt.includes(m))return!1;if(i==="undefined"&&m==="undefined")return!0;if(i==="boolean"||i==="symbol")return r===o;if(i==="number"||i==="bigint")try{let a=r.toString(),u=o.toString();return a===u}catch{return!1}if(i==="string"||i==="function")return r===o;if(i==="object"){if(r===null||o===null)return r===null&&o===null;{if(G(r))return G(o)?r.getTime()===o.getTime():!1;if(G(o))return!1;if(r instanceof RegExp&&o instanceof RegExp)return r.toString()===o.toString();if(l(r)!==l(o))return!1;let a=Object.keys(r).concat(Object.getOwnPropertySymbols(r)),u=Object.keys(o).concat(Object.getOwnPropertySymbols(o));if(a.length!==u.length)return!1;for(let p=0;p<a.length;p++){let c=a[p];if(!n(r[c],o[c]))return!1}return!0}}}try{return n(e,t)}catch{return n(L(e),L(t))}}function rt(e){let t="abcdefg1234567890",n="";for(;n.length<e;)n+=t[Math.floor(Math.random()*t.length)];return n}var Te=rt(16),_e=rt(16),De=rt(16),Ie=rt(16),xe=rt(16),mt=class{constructor(){this.clear()}get counts(){return this.values.map(t=>this.get(t))}get values(){return Object.values(this.valuesDict)}clear(){return this.countsDict={},this.valuesDict={},this}count(t){for(let n of t)l(n)?this.count(n):this.increment(n);return this}delete(t){let n=this.getStandardizedKey(t);return delete this.countsDict[n],delete this.valuesDict[n],this}get(t){return this.countsDict[this.getStandardizedKey(t)]||0}getStandardizedKey(t){return typeof t=="object"&&t===null?Te:h(t)?_e:O(t)?t.toString():typeof t=="symbol"?t.toString()+" - "+xe:t===1/0?De:t===-1/0?Ie:typeof t=="bigint"?t.toString():y(t)?t.toJSONString():g(t)?JSON.stringify(t.toObject()):JSON.stringify(t)}has(t){return!h(this.countsDict[this.getStandardizedKey(t)])}increment(t){return this.set(t,this.get(t)+1)}set(t,n){let r=this.getStandardizedKey(t);return this.countsDict[r]=n,this.valuesDict[r]=t,this}toArray(){return this.values.map(t=>({value:t,count:this.get(t)}))}toObject(){let t={};return this.values.forEach(n=>{t[n]=this.get(n)}),t}};function x(e){if(y(e)||g(e))return x(e.values);s(l(e),"The `flatten` function only works on arrays, Series, and DataFrames!");function t(n){let r=[];return n.forEach(o=>{l(o)?r=r.concat(t(o)):r.push(o)}),r}return t(e)}function E(e,t){t=t||{};let n=new mt,r={},o=x(e),i=[],m=-1/0,a=1/0,u=!1,p=0;for(let d of o){if(typeof d=="bigint"&&(u=!0),!t.shouldDropNaNs||f(d))try{d>m&&(m=d),d<a&&(a=d),p+=Number(d),i.push(d)}catch{m=NaN,a=NaN,p=NaN}n.increment(d)}let c=p/i.length;if(r.counts=n,r.max=m,r.mean=c,r.min=a,r.n=o.length,r.sum=p,isNaN(r.mean)&&(r.max=NaN,r.min=NaN),t.shouldDropNaNs&&(r.nWithoutNaNs=i.length),t.mode){let d=Array.from(n.values.map(F=>[F,n.get(F)])).toSorted((F,st)=>st[1]-F[1]),v=d[0][1],D=[];for(let F of d)if(F[1]==v)D.push(F[0]);else break;r.mode=D.toSorted()}if(t.median)if(isNaN(c))r.median=NaN;else{let d=i.toSorted((D,F)=>Number(D)-Number(F)),v=Math.floor(d.length/2);if(d.length%2===0){let D=d[v-1],F=d[v];if(r.median=(Number(D)+Number(F))/2,u&&typeof D=="bigint"&&typeof F=="bigint")try{r.median=BigInt(r.median)}catch{}}else r.median=d[v]}if(t.stdev||t.variance){let d=0;for(let D of i)d+=Math.pow(Number(D)-c,2);d/=i.length;let v=Math.sqrt(d);r.stdev=v,r.variance=d}if(u){try{r.sum=BigInt(r.sum)}catch{}try{r.mean=BigInt(r.mean)}catch{}t.mode&&(r.mode=r.mode.map(d=>{try{return BigInt(d)}catch{return d}}))}return r}function nt(e,t){let{counts:n}=E(e);return h(t)||(O(t)?n.values.forEach(r=>{t(r)||n.delete(r)}):n.values.forEach(r=>{z(r,t)||n.delete(r)})),n}function bt(e){if(y(e)||g(e))return bt(e.values);if(l(e)){let t=!1,n=!1,r=null;for(let o of e){if(bt(o))return!0;if(l(o)){if(r===null)r=o.length;else if(o.length!==r)return!0;t=!0}else n=!0;if(t&&n)return!0}}return!1}function q(e){return bt(L(e))}function H(e){if(y(e)||g(e))return H(e.values);s(l(e),"The `isNested` function only works on arrays, Series, and DataFrames!");for(let t=0;t<e.length;t++)if(l(e[t]))return!0;return!1}var X="You must pass a natural number or a one-dimensional array of natural numbers into the `ndarray` function!";function j(e){s(!h(e),X),l(e)||(e=[e]),s(!H(e),X),s(e.length>0,X);let t=e[0];if(typeof t=="bigint"&&(t=Number(t)),s(f(t),X),s(t>=0,X),s(Math.floor(t)===t,X),s(t!==1/0,"We can't create an array containing an infinite number of values!"),e.length===1){let n=[];for(let r=0;r<t;r++)n.push(void 0);return n}else{let n=[];for(let r=0;r<t;r++)n.push(j(e.slice(1)));return n}}function U(e){if(y(e)||g(e)){let n=e.copy();return n.values=U(n.values),n.index=U(n.index),n}s(l(e),"The `reverse` function only works on arrays, Series, and DataFrames!");let t=[];for(let n=e.length-1;n>=0;n--)t.push(e[n]);return t}function S(e,t,n=1){s(!h(e)&&!h(t)&&!h(n),"You must pass two numbers and optionally a step value to the `range` function!"),s(f(e)&&f(t)&&f(n),"You must pass two numbers and optionally a step value to the `range` function!"),s(n>0,"The step value must be greater than 0! (NOTE: The step value is a magnitude; it does not indicate direction.)");let r=!1,o=typeof e=="bigint"||typeof t=="bigint"||typeof n=="bigint";if(e=Number(e),t=Number(t),n=Number(n),e>t){r=!0;let m=e;e=t+n,t=m+n}let i=[];for(let m=e;m<t;m+=n)if(o)try{i.push(BigInt(m))}catch{i.push(m)}else i.push(m);return r&&(i=U(i)),i}function ot(e){let t="abcdefg1234567890",n="";for(;n.length<e;)n+=t[Math.floor(Math.random()*t.length)];return n}var Ae=ot(256),Fe=ot(256),je=ot(256),Ee=ot(256),Me=ot(256);function P(e){if(y(e)||g(e))return P(e.values);s(l(e),"The `set` function only works on arrays, Series, and DataFrames!");let t=[],n={};return x(e).forEach(r=>{let o=typeof r=="object"&&r===null?Ae:h(r)?Fe:O(r)?r.toString():typeof r=="symbol"?r.toString()+" - "+Me:r===1/0?je:r===-1/0?Ee:typeof r=="bigint"?r.toString():y(r)?r.toJSONString():g(r)?JSON.stringify(r.toObject()):JSON.stringify(r);n[o]||t.push(r),n[o]=!0}),t}function It(e){if(l(e)){let t=It(e[0]);return[e.length].concat(t||[])}else return}function b(e){return y(e)||g(e)?b(e.values):(s(l(e),"The `shape` function only works on arrays, Series, and DataFrames!"),It(e))}function Nt(e,t,n){if(h(n)&&(n=0),s(n===0||n===1||n==="vertical"||n==="horizontal",'The only valid axis values for use when appending data to a DataFrame are 0, 1, "vertical", and "horizontal". Note that 0 == "horizontal" and 1 == "vertical".'),l(t)){s(!q(t),"The array of data you're trying to append to this DataFrame is jagged!");let r=b(t);if(r.length===1)if(n===0){let o=e.copy();o._values.push(t);let i=Math.max(e.shape[1],r[0]);for(o._values.forEach(m=>{for(;m.length<i;)m.push(void 0)});o._index.length<o._values.length;)o._index.push("row"+o._index.length);for(;o._columns.length<i;)o._columns.push("col"+o._columns.length);return o}else{let o=Math.max(e.shape[0],r[0]),i=e.copy();for(S(0,o).forEach(m=>{m>=i._values.length&&i._values.push(j(e.shape[1])),i._values[m].push(t[m])});i._index.length<i._values.length;)i._index.push("row"+i._index.length);for(;i._columns.length<i._values[0].length;)i._columns.push("col"+i._columns.length);return i}else if(r.length===2)if(n===0){let o=Math.max(...t.map(m=>m.length).concat([e.shape[1]])),i=e.copy();for(i._values=i._values.concat(t).map(m=>{for(;m.length<o;)m.push(void 0);return m});i._index.length<i._values.length;)i._index.push("row"+i._index.length);for(;i._columns.length<o;)i._columns.push("col"+i._columns.length);return i}else{let o=Math.max(...t.map(a=>a.length))+e.shape[1],i=Math.max(e.shape[0],r[0]),m=e.copy();for(S(0,i).forEach(a=>{for(a>=m._values.length&&m._values.push(j(e.shape[1])),m._values[a]=m._values[a].concat(t[a]);m._values[a].length<o;)m._values[a].push(void 0)});m._index.length<m._values.length;)m._index.push("row"+m._index.length);for(;m._columns.length<o;)m._columns.push("col"+m._columns.length);return m}else throw new Y("Only 1- and 2-dimensional arrays can be appended to a DataFrame!")}else if(g(t)){let r=Nt(e,t.values,n);return n===0?r.index[r.index.length-1]=r.index.indexOf(t.name)>-1?t.name+" (2)":t.name:r.columns[r.columns.length-1]=r.columns.indexOf(t.name)>-1?t.name+" (2)":t.name,r}else if(y(t))if(n===0){let r=e.copy(),o=P(r._columns.concat(t._columns)).length;for(r._values.forEach(i=>{for(;i.length<o;)i.push(void 0)}),t.apply(i=>{let m=i.copy(),a=[];r._columns.forEach(u=>{let p=m._index.indexOf(u);p>-1?(a.push(m._values[p]),m._values.splice(p,1),m._index.splice(p,1)):a.push(void 0)}),r._values.push(a.concat(m._values))},1),r._columns=r._columns.concat(t._columns.filter(i=>r._columns.indexOf(i)<0));r._index.length<r._values.length;){let i="row"+r._index.length;r._index.push(i+(e._index.indexOf(i)>-1?" (2)":""))}return r}else{let r=e.copy();return r._index.forEach((o,i)=>{let m=t._index.indexOf(o);m>-1?r._values[i]=r._values[i].concat(t._values[m]):r._values[i]=r._values[i].concat(j(t.shape[1]))}),t._index.forEach((o,i)=>{r._index.indexOf(o)<0&&(r._index.push(o),r._values.push(j(r._columns.length).concat(t._values[i])))}),r._columns=r._columns.concat(t._columns.map(o=>o+(r._columns.indexOf(o)>-1?" (2)":""))),r}else throw new Y("Only 1- or 2-dimensional arrays, Series, and DataFrames can be appended to a DataFrame!")}function xt(e,t,n,r,o){if(o=o||0,s(O(r),"The first parameter to the `apply` method must be a function."),s(o===0||o===1,"The second parameter to the `apply` method (the `axis`) must be 0 or 1."),o===0){let i={},m;if(n.columns.forEach((a,u)=>{let p=new t(n.values.map(d=>d[u]));p.name=a,p.index=n.index;let c=r(p,u,n);c instanceof t?i[a]=c.values:i[a]=c,h(m)&&(m=c instanceof t||l(c))}),m){let a=new e(i);return a.index=n.index,a}else{let a=new t(n.columns.map(u=>i[u]));return a.index=n.columns,a}}else if(o===1){let i,m=n.values.map((a,u)=>{let p=new t(a);p.name=n.index[u],p.index=n.columns;let c=r(p,u,n);return h(i)&&(i=c instanceof t||l(c)),c instanceof t?c.values:c});if(i){let a=new e(m);return a.index=n.index,a.columns=n.columns,a}else{let a=new t(m);return a.index=n.index,a}}}function w(e){return typeof e=="string"}function At(e,t,n,r,o){let i=a=>a instanceof e,m=a=>a instanceof t;if(h(o)){if(i(r))return n.append(r,1);if(m(r))return n.append(r,1);if(k(r)){let a=Math.max(...Object.keys(r).concat(Object.getOwnPropertySymbols(r)).map(u=>r[u].length));return Object.keys(r).concat(Object.getOwnPropertySymbols(r)).forEach(u=>{for(;r[u].length<a;)r[u].push(void 0)}),n.append(new e(r),1)}else throw new Y("You must pass a DataFrame, Series, or object into the `assign` method!")}else{s(w(r),"If passing two arguments into the `assign` method, then the first argument must be a string name!"),s(l(o)&&!q(o)&&b(o).length===1,"If passing two arguments into the `assign` method, then the second argument must be a 1-dimensional array!");let a=n.append(o,1);return a.columns[a.columns.length-1]=r,a}}function Ft(e,t){if(t.isEmpty)return new e;let n=new e(I(t.values));return n.columns=t.columns.slice(),n.index=t.index.slice(),n}function jt(e,t,n,r,o){h(r)&&(r=[]),h(o)&&(o=[]),(w(r)||f(r))&&(r=[r]),(w(o)||f(o))&&(o=[o]),s(l(r),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),s(l(o),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),s(b(r).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),s(b(o).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings.");let i,m;n.index.forEach((u,p)=>{r.indexOf(u)<0&&r.indexOf(p)<0&&(i||(i=[]),i.push(u))}),n.columns.forEach((u,p)=>{o.indexOf(u)<0&&o.indexOf(p)<0&&(m||(m=[]),m.push(u))});let a=n.get(i,m);if(a instanceof t){let u=new e;u=u.assign(a),n.index.indexOf(a.name)>-1&&(u=u.transpose()),a=u}return a}function at(e){return f(e)&&(e>=0?Math.floor(e)===e:Math.ceil(e)===e)}function J(e){return at(e)&&e>=0}function Et(e,t,n,r,o,i){r=r||0,s(r===0||r===1,"The first parameter of the `dropMissing` method (the `axis`) must be 0 or 1."),i=i||0,s(J(i),"The third parameter of the `dropMissing` method (the `threshold`) should be a whole number (meaning that data should be dropped if it contains more than `threshold` null values)."),o=i>0?"none":o||"any",s(o==="any"||o==="all"||o==="none","The second parameter of the `dropMissing` method (the `condition` parameter, which indicates the condition under which data should be dropped) should be 'any' or 'all' (meaning that if 'any' of the data contains null values, then it should be dropped; or that if 'all' of the data contains null values, then it should be dropped).");function m(p){if(i>0){let c=0;for(let d=0;d<p.length;d++){let v=p[d];if(h(v)&&c++,c>=i)return[]}}else if(o==="any")for(let c=0;c<p.length;c++){let d=p[c];if(h(d))return[]}else if(o==="all"){for(let c=0;c<p.length;c++){let d=p[c];if(!h(d))return p}return[]}return p}let a=n.copy(),u=Math.random().toString();if(r===0){a=a.assign(u,a.index);let p=a.values.map(m).filter(d=>d.length>0);if(b(p).length<2)return new e;a.values=p;let c=a.get(null,u);if(h(c))return new e;w(c)&&(c=[c]),c instanceof t&&(c=c.values),a.index=c,a=a.drop(null,u)}else if(r===1){let p={};if(a.columns.forEach((d,v)=>{let D=a.values.map(st=>st[v]),F=m(D);F.length>0&&(p[d]=F)}),Object.keys(p).length+Object.getOwnPropertySymbols(p).length===0)return new e;let c=new e(p);return c.index=a.index,c}return a}function ut(e){if(y(e)||g(e))return e.dropNaN(...Object.values(arguments).slice(1));s(l(e),"The `dropNaN` function only works on arrays, Series, and DataFrames!");let t=[];return e.forEach(n=>{try{return t.push(ut(n))}catch{if(f(n))return t.push(n)}}),t}function Mt(e,t,n,r,o){n=n||0,s(n===0||n===1,"The first parameter of the `dropNaN` method (the `axis`) must be 0 or 1."),o=o||0,s(J(o),"The third parameter of the `dropNaN` method (the `threshold`) should be a whole number (meaning that data should be dropped if it contains more than `threshold` NaN values)."),r=o>0?"none":r||"any",s(r==="any"||r==="all"||r==="none","The second parameter of the `dropNaN` method (the `condition` parameter, which indicates the condition under which data should be dropped) should be 'any' or 'all' (meaning that if 'any' of the data contains NaN values, then it should be dropped; or that if 'all' of the data contains NaN values, then it should be dropped).");function i(a){let u=ut(a);return o>0?a.length-u.length<o:r==="any"?u.length===a.length:r==="all"?u.length>0:!0}let m=t.copy();if(n===0){let a=m.index.filter(u=>{let p=m.get(u,null).values;return i(p)});return a.length>0?m.get(a,null):new e}else if(n===1){let a=m.columns.filter(u=>{let p=m.get(null,u).values;return i(p)});return a.length>0?m.get(null,a):new e}return m}function Bt(e){let t={};return x(e).forEach((n,r)=>{t[n]=r}),t}function Q(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e)).sort((t,n)=>e[t]-e[n])}function Ut(e,t,n,r,o){s(O(r),"The `filter` method takes a single parameter: a function that is used to filter the values."),h(o)&&(o=0),s(o===0||o===1,"The `axis` parameter to the `filter` method must be 0 or 1.");let i=n.copy();if(i.isEmpty)return i;let m=Bt(i.index),a=Bt(i.columns);if(o===0){let u=0,p=i.values.filter((c,d)=>{let v=new t(c);v.name=n.index[d],v.index=n.columns;let D=r(v,d,n);return D?u++:delete m[i.index[d]],D});if(u===0)return new e;if(u===1){let c=new t(p[0]);return c.name=Q(m)[0],c.index=Q(a),c}i.values=p,i.index=Q(m)}else if(o===1){i=i.transpose();let u=0,p=i.values.filter((c,d)=>{let v=new t(c);v.name=n.columns[d],v.index=n.index;let D=r(v,d,n);return D?u++:delete a[i.index[d]],D});if(u===0)return new e;if(u===1){let c=new t(p[0]);return c.name=Q(a)[0],c.index=Q(m),c}i.values=p,i.index=Q(a),i=i.transpose()}return i}function Pt(e,t,n){(w(t)||f(t))&&(t=[t]),(w(n)||f(n))&&(n=[n]);for(let o in t)typeof t[o]=="bigint"&&(t[o]=Number(t[o]));for(let o in n)typeof n[o]=="bigint"&&(n[o]=Number(n[o]));let r=P((t||[]).concat(n||[]).map(o=>typeof o));return s(r.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===1&&s(r[0]==="string"||r[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===2&&(s(r.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),s(r.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),h(t)||(t=t.map(o=>{if(w(o))return s(e.index.indexOf(o)>-1,`Row "${o}" does not exist!`),o;if(f(o))return s(o>=0,`Index ${o} is out of bounds!`),s(Math.floor(o)===o,"Row numbers must be integers!"),s(o<e.index.length,`Index ${o} is out of bounds!`),e.index[o]})),h(n)||(n=n.map(o=>{if(w(o))return s(e.columns.indexOf(o)>-1,`Column "${o}" does not exist!`),o;if(f(o))return s(o>=0,`Column ${o} is out of bounds!`),s(Math.floor(o)===o,"Column numbers must be integers!"),s(o<e.columns.length,`Column ${o} is out of bounds!`),e.columns[o]})),e.getSubsetByNames(t,n)}function Be(e,t){try{return e<t?-1:e>t?1:0}catch{return e=typeof e=="object"&&e!==null?JSON.stringify(e):e.toString(),t=typeof t=="object"&&t!==null?JSON.stringify(t):t.toString(),e<t?-1:e>t?1:0}}function R(e,t){if(h(t)&&(t=Be),y(e)||g(e))return e.sort(...Object.values(arguments).slice(1));s(l(e),"The `sort` function only works on arrays, Series, and DataFrames!"),s(O(t),"The second parameter of the `sort` function must be a comparison function!");let n=e.slice();return n.sort(t),n}function Ue(e){let t=e.toLowerCase(),n="";for(let o=0;o<t.length;o++){let i=t[o];i.match(/[a-z0-9]/g)?n+=i:n+=" "}let r=n.split(" ").filter(o=>o.length>0);return r[0]+r.slice(1).map(o=>o[0].toUpperCase()+o.substring(1)).join("")}function vt(e,t,n){h(n)?n=t.columns:w(n)&&(n=[n]);let r={};n.forEach(i=>{s(w(i),"You must pass either a string or a one-dimensional array of strings into the `getDummies` (AKA `oneHotEncode`) method!");let m=t.columns.indexOf(i);s(m>-1,`The given DataFrame does not have a column called "${i}"!`);let a=t.values.map(p=>p[m]),u=R(P(a));a.forEach(p=>{u.forEach(c=>{let d=i+"_"+Ue(c.toString());r[d]||(r[d]=[]),p===c?r[d].push(1):r[d].push(0)})})});let o=new e(r);return o.index=t.index,o}function zt(e,t,n){let r=e.shape;h(t)&&(t=S(0,r[0])),h(n)&&(n=S(0,r[1])),f(t)&&(t=[t]),f(n)&&(n=[n]),s(l(t)&&l(n),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(b(t).length===1&&b(n).length===1,"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(t.length>0,"The `rowIndices` array must contain at least one index."),s(n.length>0,"The `colIndices` array must contain at least one index."),t.forEach(m=>{s(J(m),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(m<e.index.length,`The row index ${m} is out of bounds.`)}),n.forEach(m=>{s(J(m),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(m<e.columns.length,`The column index ${m} is out of bounds.`)});let o=t.map(m=>e.index[m]),i=n.map(m=>e.columns[m]);return e.getSubsetByNames(o,i)}function Ct(e,t,n,r,o){h(r)&&(r=n.index),h(o)&&(o=n.columns),w(r)&&(r=[r]),w(o)&&(o=[o]),s(l(r)&&l(o),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(b(r).length===1&&b(o).length===1,"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(r.length>0,"The `rows` array must contain at least one row name."),s(o.length>0,"The `cols` array must contain at least one column name."),r.forEach(a=>{s(w(a),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(n.index.indexOf(a)>-1,`The row name "${a}" does not exist in the list of rows.`)}),o.forEach(a=>{s(w(a),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(n.columns.indexOf(a)>-1,`The column name "${a}" does not exist in the list of columns.`)});let i=r.map(a=>o.map(u=>n.values[n.index.indexOf(a)][n.columns.indexOf(u)]));if(r.length===1&&o.length===1)return i[0][0];if(r.length===1){let a=new t(i[0]);return a.name=r[0],a.index=o,a}if(o.length===1){let a=new t(i.map(u=>u[0]));return a.name=o[0],a.index=r,a}let m=new e(i);return m.columns=o,m.index=r,m}function kt(e,t,n){function r(v,D){return w(v)&&v.length>D?v.substring(0,D-3)+"...":v}if(n.isEmpty)return console.table({}),console.log("Shape:",[0,0],`
|
|
15
|
-
`),n;let o=typeof window>"u"?20:10,i=Math.floor(o/2),m=
|
|
16
|
-
`),n}function $(e,t){s(f(e),"The `leftPad` function only works on numbers!");let n=e.toString();for(;n.length<t;)n="0"+n;return n}function Jt(e,t){let n=t?e:e.copy();return n.index=S(0,e.shape[0]).map(r=>"row"+$(r,(n.index.length-1).toString().length)),n}function W(e,t){if(y(e)||g(e))return W(e.values,t);s(l(e),"The `product` function only works on arrays, Series, and DataFrames!");try{if(e.length===0)return NaN;let n=x(e),r=!1,o=1;for(let i of n){if(!f(i))if(t)i=1;else return NaN;typeof i=="bigint"&&(r=!0,i=Number(i)),o*=i}if(r)try{return BigInt(o)}catch{}return o}catch{return NaN}}function Rt(e){return at(e)&&e>0}function Z(e,t){if(y(e)||g(e))return Z(e.values,t);if(s(l(e),"The first argument passed into the `reshape` function must be an array!"),f(t)&&(t=[t]),s(l(t),"The second argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),s(b(t).length===1,"The first argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),t=t.map(i=>(typeof i=="bigint"&&(i=Number(i)),s(Rt(i),"The first argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),Number(i))),t.length===0)return x(e);let n=x(e);if(t.length===1&&t[0]===n.length)return n;s(W(t)===n.length,"The new shape doesn't match the number of values available in `x` (the first argument passed into the `reshape` function)!");let r=[],o=Math.floor(n.length/t[0]);for(let i=0;i<t[0];i++){let m=n.slice(i*o,(i+1)*o);r.push(Z(m,t.slice(1)))}return r}var $t=Math.pow(2,64),T=[];ft(Math.floor(Math.random()*$t));function Pe(e,t){e=A(e);function n(){e+=A("0x9e3779b97f4a7c15");let o=I(e);return o=(o^o>>BigInt(30))*A("0xbf58476d1ce4e5b9"),o=(o^o>>BigInt(27))*A("0x94d049bb133111eb"),o^o>>BigInt(31)}let r=[];for(let o=0;o<t;o++)r.push(n());return r}function A(e){return BigInt.asUintN(64,BigInt(e))}function Yt(e,t){return e=A(e),t=BigInt(t),A(A(e<<t)|A(e>>A(BigInt(64)-t)))}function ft(e){if(typeof e=="bigint"&&(e=Number(e)),h(e))return I(T);{s(f(e),"If passing a value into the `seed` function, then that value must be an integer!");let t=Pe(Math.floor(e),4);T[0]=t[0],T[1]=t[1],T[2]=t[2],T[3]=t[3]}}function Kt(){let e=A(Yt(T[0]+T[3],23)+T[0]),t=A(T[1]<<BigInt(17));return T[2]=A(T[2]^T[0]),T[3]=A(T[3]^T[1]),T[1]=A(T[1]^T[2]),T[0]=A(T[0]^T[3]),T[2]=A(T[2]^t),T[3]=Yt(T[3],45),Math.floor(Number(e))/$t}function K(e){return h(e)?Kt():(l(e)||(e=[e]),Z(j(W(e)).map(Kt),e))}function tt(e){if(y(e)||g(e))return e.shuffle(...Object.values(arguments).slice(1));s(l(e),"The `shuffle` function only works on arrays, Series, and DataFrames!");let t=[],n=e.slice();for(let r=0;r<e.length;r++){let o=Math.floor(K()*n.length);t.push(n.splice(o,1)[0])}return t}function Lt(e,t){return h(t)&&(t=0),s(t===0||t===1,"The `axis` parameter to the `shuffle` must be 0, 1, or undefined."),e.get(t===0?tt(e.index):null,t===1?tt(e.columns):null)}function et(e){return typeof e=="boolean"}function qt(e,t,n){return O(t)?ze(e,t,n):Ce(e,t,n)}function ze(e,t,n){if(n=h(n)?0:n,s(O(t),"When sorting a DataFrame using a function, the first argument to the `sort` method must be a function!"),s(f(n),"When sorting a DataFrame using a function, the second argument to the `sort` method must be null, undefined, 0, or 1 to indicate the axis along which the data should be sorted! An axis of 0 means that the rows will be sorted relative to each other, whereas an axis of 1 means that the columns will be sorted relative to each other."),n===0){let r=R(e.index,(o,i)=>t(e.get(o,null),e.get(i,null)));return e.get(r,null)}else{let r=R(e.columns,(o,i)=>t(e.get(null,o),e.get(null,i)));return e.get(null,r)}}function Ce(e,t,n){let r=e.copy(),o=K().toString();r=r.assign(o,r.index),h(t)&&(t=[o],n=[!0]),(f(t)||w(t))&&(t=[t],(et(n)||w(n))&&(n=[n])),s(l(t),"The first parameter of the `sort` method must be (1) a string or index representing a column name or index, respectively; (2) a 1-dimensional array of strings and/or indices; or (3) null."),s(b(t).length===1,"The first parameter of the `sort` method must be (1) a string or index representing a column name or index, respectively; (2) a 1-dimensional array of strings and/or indices; or (3) null."),h(n)&&(n=S(0,t.length).map(()=>!0)),s(l(n),"The second parameter of the `sort` method must be (1) a string or boolean representing the sort direction ('ascending' / 'descending', or true / false); (2) a 1-dimensional array of strings and/or booleans; or (3) null."),s(b(n).length===1,"The second parameter of the `sort` method must be (1) a string or boolean representing the sort direction ('ascending' / 'descending', or true / false); (2) a 1-dimensional array of strings and/or booleans; or (3) null."),s(t.length===n.length,"The arrays passed into the `sort` method must be equal in length."),t=t.map(m=>{if(s(w(m)||f(m),"Column references can either be column names (as strings) or column indices (as whole numbers)."),w(m)){let a=r.columns.indexOf(m);return s(a>-1,`The column "${m}" does not exist!`),a}if(f(m))return s(J(m),"Column indices must be whole numbers!"),s(m<r.columns.length,`The index ${m} is out of bounds!`),m}),n=n.map(m=>{if(s(w(m)||et(m),"Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),w(m)){let a=m.trim().toLowerCase();return s(a==="ascending"||a==="descending","Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),a==="ascending"}if(et(m))return m}),r.values=R(r.values,(m,a)=>{let u=0;for(;m[t[u]]===a[t[u]]&&u<t.length;)u++;let p=n[u];if(m[t[u]]===a[t[u]])return 0;if(m[t[u]]<a[t[u]])return p?-1:1;if(m[t[u]]>a[t[u]])return p?1:-1});let i=r.columns.indexOf(o);return r.index=r.values.map(m=>m[i]),r=r.dropColumns(o),r}function Vt(e,t){h(t)?t=0:s(t===0||t===1,"The axis parameter of the `toDetailedObject` method must be undefined, 0, or 1. An axis of 0 indicates that the returned object should be organized first by rows and then by columns. An axis of 1 indicates that the returned object should be organized first by columns and then by rows.");let n={};return t===0?e.index.forEach((r,o)=>{let i={};e.columns.forEach((m,a)=>{i[m]=e.values[o][a]}),n[r]=i}):e.columns.forEach((r,o)=>{let i={};e.index.forEach((m,a)=>{i[m]=e.values[a][o]}),n[r]=i}),n}function lt(e,t){return JSON.stringify(e.toObject(t))}async function Gt(e,t){return JSON.parse(lt(e,t))}function Wt(e){let t={};return e.columns.forEach(n=>{t[n]=e.get(n).values}),t}function C(e){if(y(e)||g(e))return e.transpose();s(l(e),"The `transpose` function only works on arrays, Series, and DataFrames!");let t=b(e);if(s(t.length<=2,"I'm not smart enough to know how to transpose arrays that have more than 2 dimensions. Sorry for the inconvenience! Please only pass 1- or 2-dimensional arrays into the `transpose` function!"),t.length===1)return U(e);if(t.length===2){let n=j(U(t));for(let r=0;r<t[0];r++)for(let o=0;o<t[1];o++)n[o][r]=e[r][o];return n}}function wt(e,t,n){if(g(n))return new e(t.values.concat(n.values));if(l(n)){let r=b(n);s(r.length===1&&!H(r),"Only vectors can be appended to Series!");let o=t.copy();return n.forEach((i,m)=>{o._values.push(i),o._index.push("item"+(t.values.length+m))}),o}return wt(t,[n])}function Ht(e,t){s(O(t),"The parameter to the `apply` method must be a function.");let n=e.copy();return n._values=n._values.map((r,o)=>t(r,o)),n}function Xt(e){let t=e.copy(),n=[];return t._values=t.values.filter((r,o)=>h(r)?!1:(n.push(t.index[o]),!0)),t._index=n,t}function Qt(e,t){let n=[],r=[];t.values.forEach((i,m)=>{f(i)&&(r.push(i),n.push(t.index[m]))});let o=new e(r);return o.name=t.name,o.index=n,o}function Zt(e,t,n){let r=t.copy(),o=I(r.index),i=[],m=r.values.filter((a,u)=>{let p=n(a,u,r.values);return p||i.push(r.index[u]),p});return i.forEach(a=>{o.splice(o.indexOf(a),1)}),m.length===0?(r=new e,r.name=t.name,r):(r.values=m,r.index=o,r)}function te(e,t){(w(t)||f(t))&&(t=[t]);for(let r in t)typeof t[r]=="bigint"&&(t[r]=Number(t[r]));let n=P((t||[]).map(r=>typeof r));return s(n.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===1&&s(n[0]==="string"||n[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===2&&(s(n.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),s(n.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),h(t)||(t=t.map(r=>{if(typeof r=="string")return s(e.index.indexOf(r)>-1,`Index "${r}" does not exist!`),r;if(typeof r=="number")return s(r>=0,`Index ${r} is out of bounds!`),s(Math.floor(r)===r,"Indices must be integers!"),s(r<e.index.length,`Index ${r} is out of bounds!`),e.index[r]})),e.getSubsetByNames(t)}function ee(e,t){let n=e.shape;h(t)&&(t=S(0,n[0])),s(l(t),"The `indices` array must be 1-dimensional array of whole numbers."),s(b(t).length===1,"The `indices` array must be a 1-dimensional array of whole numbers."),s(t.length>0,"The `indices` array must contain at least one index."),t.forEach(o=>{s(J(o),"The `indices` array must be a 1-dimensional array of whole numbers."),s(o<e.index.length,`The row index ${o} is out of bounds.`)});let r=t.map(o=>e.index[o]);return e.getSubsetByNames(r)}function re(e,t,n){h(n)&&(n=t.index),s(l(n),"The `indices` array must be a 1-dimensional array of strings."),s(b(n).length===1,"The `indices` array must be a 1-dimensional array of strings."),s(n.length>0,"The `indices` array must contain at least one index name."),n.forEach(i=>{s(w(i),"The `indices` array must contain only strings."),s(t.index.indexOf(i)>-1,`The name "${i}" does not exist in the index.`)});let r=n.map(i=>t.values[t.index.indexOf(i)]);if(r.length===1)return r[0];let o=new e(r);return o.index=n,o.name=t.name,o}function ne(e){let t=e.copy(),n=typeof window>"u"?20:10;if(t.index.length>n){t=t.get(S(0,n/2).concat(S(t.index.length-n/2,t.index.length)));let o=I(t.index);o.splice(Math.floor(o.length/2),0,"..."),t.values.push("..."),t.index.push("..."),t=t.get(o)}let r={};return t.values.forEach((o,i)=>{let m={};m[t.name]=o,r[t.index[i]]=m}),console.table(r),console.log("Shape:",e.shape,`
|
|
17
|
-
`),e}function oe(e){let t=e.copy();return t.get(tt(t.index))}function ie(e,t,n){n=n||((u,p)=>u<p?-1:1),s(h(n)||O(n),"You must pass undefined, null, or a comparison function as the second argument to the `sort` method!");let r=C([t.values,t.index]),o=R(r,(u,p)=>n(u[0],p[0])),i=[],m=[];o.forEach(u=>{i.push(u[0]),m.push(u[1])});let a=new e;return a._values=i,a._index=m,a.name=t.name,a}function se(e,t){let n=C([t.values,t.index]);n=C(R(n,(o,i)=>{if(o[1]===i[1])return 0;if(o[1]<i[1])return-1;if(o[1]>i[1])return 1}));let r=new e(n[0]);return r.index=n[1],r.name=t.name,r}function me(e){let t={};return t[e.name]={},e.index.forEach((n,r)=>{t[e.name][n]=e.values[r]}),t}var ae=Symbol.for("@jrc03c/js-math-tools/series");function ue(e){class t{static[Symbol.hasInstance](r){try{return!!r._symbol&&r._symbol===ae}catch{return!1}}constructor(r){if(this.name="data",Object.defineProperty(this,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:ae}),Object.defineProperty(this,"_values",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"values",{configurable:!0,enumerable:!0,get(){return this._values},set(o){s(l(o),"The new values must be a 1-dimensional array!");let i=b(o);s(i.length===1,"The new array of values must be 1-dimensional!"),i[0]<this._index.length?this._index=this._index.slice(0,i[0]):i[0]>this._index.length&&(this._index=this._index.concat(S(this._index.length,i[0]).map(m=>"item"+$(m,(o.length-1).toString().length)))),this._values=o}}),Object.defineProperty(this,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"index",{configurable:!0,enumerable:!0,get(){return this._index},set(o){s(l(o),"The new index must be a 1-dimensional array of strings!"),s(o.length===this.shape[0],"The new index must be the same length as the old index!"),s(b(o).length===1,"The new index must be a 1-dimensional array of strings!"),o.forEach(i=>{s(w(i),"All of the row names must be strings!")}),this._index=o}}),r){if(r instanceof t)this.name=r.name,this.values=I(r.values),this.index=I(r.index);else if(l(r)){let o=b(r);s(o.length===1,"When passing an array into the constructor of a Series, the array must be 1-dimensional!"),this.values=r}else if(r instanceof Object){let o=Object.keys(r).concat(Object.getOwnPropertySymbols(r)).map(a=>a.toString());s(o.length===1,"When passing an object into the constructor of a Series, the object must have only 1 key-value pair, where the key is the name of the data and the value is the 1-dimensional array of values!");let i=o[0],m=r[i];s(b(m).length===1,"When passing an object into the constructor of a Series, the object must have only 1 key-value pair, where the key is the name of the data and the value is the 1-dimensional array of values!"),this.name=i,this.values=m.slice()}}}get shape(){return b(this.values)}get length(){return this.shape[0]}get isEmpty(){return this.values.filter(r=>!h(r)).length===0}clear(){let r=this.copy();return r.values.forEach((o,i)=>{r.values[i]=void 0}),r}get(r){return te(this,r)}getSubsetByNames(r){return re(t,this,r)}getSubsetByIndices(r){return ee(this,r)}loc(r){return this.getSubsetByNames(r)}iloc(r){return this.getSubsetByIndices(r)}reverse(){let r=new t(U(this.values));return r.index=U(this.index),r.name=this.name,r}resetIndex(){let r=this.copy();return r.index=S(0,this.shape[0]).map(o=>"item"+$(o,(r.index.length-1).toString().length)),r}copy(){let r=new t;return r._values=I(this.values),r._index=I(this.index),r.name=this.name,r}append(r){return wt(t,this,r)}apply(r){return Ht(this,r)}concat(r){return this.append(r)}dropMissing(r,o){return Xt(this,r,o)}dropNaN(){return Qt(t,this)}toObject(){return me(this)}print(){return ne(this)}shuffle(){return oe(this)}sort(r){return ie(t,this,r)}sortByIndex(){return se(t,this)}filter(r){return Zt(t,this,r)}toDataFrame(){let r=new e(C([this.values]));return r.columns=[this.name],r.index=this.index,r}transpose(){let r=this.copy();return r.values=U(r.values),r.index=U(r.index),r}getDummies(){return this.toDataFrame().getDummies()}oneHotEncode(){return this.getDummies()}}return t}var fe=Symbol.for("@jrc03c/js-math-tools/dataframe");function pt(e){let t="abcdefghijklmnopqrstuvwxyz1234567890",n="";for(let r=0;r<e;r++)n+=t[Math.floor(K()*t.length)];return n}var _=class{static[Symbol.hasInstance](t){try{return!!t._symbol&&t._symbol===fe}catch{return!1}}constructor(t){if(Object.defineProperty(this,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:fe}),Object.defineProperty(this,"_values",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"values",{configurable:!0,enumerable:!0,get(){return this._values.length===0||!h(this._values[0])&&this._values[0].length===0?[[]]:this._values},set(n){s(l(n),"The new values must be a 2-dimensional array!");let r=b(n);s(r.length===2,"The new array of values must be 2-dimensional!"),r[0]<this._index.length?this._index=this._index.slice(0,r[0]):r[0]>this._index.length&&(this._index=this._index.concat(S(this._index.length,r[0]).map(o=>"row"+$(o,(r[0]-1).toString().length)))),r[1]<this._columns.length?this._columns=this._columns.slice(0,r[1]):r[1]>this._columns.length&&(this._columns=this._columns.concat(S(this._columns.length,r[1]).map(o=>"col"+$(o,(r[1]-1).toString().length)))),this._values=n}}),Object.defineProperty(this,"_columns",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"columns",{configurable:!0,enumerable:!0,get(){return this._columns},set(n){s(l(n),"The new columns list must be a 1-dimensional array of strings!"),s(this.isEmpty||n.length===this.shape[1],"The new columns list must be the same length as the old columns list!"),s(b(n).length===1,"The new columns list must be a 1-dimensional array of strings!"),n=n.map(o=>(typeof o!="string"&&(o=JSON.stringify(o)||o.toString()),o.trim().length===0?"untitled_"+pt(8):o.trim()));let r=(()=>{let o=nt(n),i={};return o.values.forEach(m=>{i[m]=o.get(m)}),i})();n=n.map(o=>r[o]>1?o+"_"+pt(8):o),this._columns=n}}),Object.defineProperty(this,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"index",{configurable:!0,enumerable:!0,get(){return this._index},set(n){s(l(n),"The new index must be a 1-dimensional array of strings!"),s(this.isEmpty||n.length===this.shape[0],"The new index must be the same length as the old index!"),s(b(n).length===1,"The new index must be a 1-dimensional array of strings!"),n=n.map(o=>(typeof o!="string"&&(o=JSON.stringify(o)||o.toString()),o.trim().length===0?"untitled_"+pt(8):o.trim()));let r=(()=>{let o=nt(n),i={};return o.values.forEach(m=>{i[m]=o.get(m)}),i})();n=n.map(o=>r[o]>1?o+"_"+pt(8):o),this._index=n}}),s(h(t)||k(t)||l(t),"The `data` passed into the constructor of a DataFrame must be either (1) an object where the key-value pairs are (respectively) column names and 1-dimensional arrays of values, or (2) a 2-dimensional array of values."),t)if(t instanceof _)this.values=I(t.values),this.columns=I(t.columns),this.index=I(t.index);else if(l(t)){let n=b(t);s(n.length===2,"The `data` array passed into the constructor of a DataFrame must be 2-dimensional!"),s(!q(t),"The 2-dimensional array passed into the constructor of a DataFrame must not contain sub-arrays (i.e., rows) of different lengths!"),this.values=t}else{this._columns=Object.keys(t).concat(Object.getOwnPropertySymbols(t)).map(m=>m.toString());let n=[],r=null,o=null;this._columns.forEach(m=>{h(o)&&(r=m,o=t[m].length),s(t[m].length===o,`The object passed into the DataFrame constructor contains arrays of different lengths! The key "${r}" points to an array containing ${o} items, and the key "${m}" points to an array containing ${t[m].length} items.`),o=t[m].length;let a=t[m];n.push(a)}),this._values=C(n);let i=b(this.values);this._index=S(0,i[0]).map(m=>"row"+$(m,(i[0]-1).toString().length))}}get shape(){return b(this.values)}get length(){return this.shape[0]}get width(){return this.shape[1]}get rows(){return this.index}set rows(t){this.index=t}get isEmpty(){return this.values.length===0||this.values.every(t=>t.length===0)}clear(){let t=new _(j(this.shape));return t.columns=this.columns.slice(),t.index=this.index.slice(),t}get(t,n){if(arguments.length===0)return this;if(arguments.length===1)try{return this.get(null,t)}catch{return this.get(t,null)}return Pt(this,t,n)}getSubsetByNames(t,n){return Ct(_,M,this,t,n)}getSubsetByIndices(t,n){return zt(this,t,n)}getDummies(t){return vt(_,this,t)}oneHotEncode(t){return vt(_,this,t)}transpose(){let t=new _(C(this.values));return t.columns=this.index.slice(),t.index=this.columns.slice(),t}get T(){return this.transpose()}resetIndex(t){return Jt(this,t)}copy(){return Ft(_,this)}assign(t,n){return At(_,M,this,t,n)}apply(t,n){return xt(_,M,this,t,n)}dropMissing(t,n,r){return Et(_,M,this,t,n,r)}dropNaN(t,n,r){return Mt(_,this,t,n,r)}drop(t,n){return jt(_,M,this,t,n)}dropColumns(t){return this.drop(null,t)}dropRows(t){return this.drop(t,null)}toDetailedObject(t){return Vt(this,t)}toObject(){return Wt(this)}toJSONString(t){return lt(this,t)}saveAsJSON(t,n){return Gt(this,t,n)}print(){return kt(_,M,this)}sort(t,n){return qt(this,t,n)}sortByIndex(){return this.sort()}filter(t,n){return Ut(_,M,this,t,n)}shuffle(t){return Lt(this,t)}append(t,n){return Nt(this,t,n)}concat(t,n){return this.append(t,n)}join(t,n){return this.append(t,n)}toString(){return JSON.stringify(this)}},M=ue(_);function it(e,t){return E(e,{shouldDropNaNs:t}).max}function N(e){return s(O(e),"You must pass a function into the `vectorize` function!"),function t(){let n,r,o=[],i=[],m=Object.keys(arguments).filter(a=>{let u=arguments[a];return l(u)?!0:g(u)?(n=!0,o.push(u),!0):y(u)?(r=!0,i.push(u),!0):!1}).map(a=>arguments[a]);if(m.slice(0,-1).forEach((a,u)=>{s(z(l(a)?b(a):a.shape,l(m[u+1])?b(m[u+1]):m[u+1].shape),`When passing multiple arrays into the \`${e.name}\` function, all of the arrays must have the same shape!`)}),m.length>0){let a=it(m.map(p=>p.length?p.length:p.values.length)),u=S(0,a).map(p=>{let c=Object.keys(arguments).map(d=>l(arguments[d])?arguments[d][p]:g(arguments[d])||y(arguments[d])?arguments[d].values[p]:arguments[d]);return t(...c)});if(r)try{if(i.length===1&&z(b(i[0]),b(u))){let p=new _(u);return p.index=i[0].index.slice(),p.columns=i[0].columns.slice(),p}else return new _(u)}catch{return u}if(n)try{if(o.length===1&&o[0].length===u.length){let p=new M(u);return p.name=o[0].name,p.index=o[0].index.slice(),p}else return new M(u)}catch{return u}return u}else return e(...arguments)}}function ke(e){try{return f(e)?typeof e=="bigint"?e<0?-e:e:Math.abs(e):NaN}catch{return NaN}}var ct=N(ke);function Je(){try{let e=0,t=!1,n=Object.values(arguments);for(let r of n){if(!f(r))return NaN;typeof r=="bigint"&&(t=!0,r=Number(r)),e+=r}if(t)try{return BigInt(e)}catch{}return e}catch{return NaN}}var St=N(Je);function Re(e,t){try{return t(e)}catch{return NaN}}var ht=N(Re);function Ye(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.acos(e)):NaN}catch{return NaN}}var Ke=N(Ye);function $e(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.asin(e)):NaN}catch{return NaN}}var Le=N($e);function qe(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.atan(e)):NaN}catch{return NaN}}var Ve=N(qe);function We(e){try{return f(e)?typeof e=="bigint"?e:Math.ceil(e):NaN}catch{return NaN}}var He=N(We);function Xe(e,t){try{if(!f(e))return NaN;if(typeof e=="bigint")return e;if(h(t))t=1e-10;else if(!f(t))return NaN;return ct(e)<t?0:e}catch{return NaN}}var Qe=N(Xe);function Ot(e){if(y(e)||g(e)){let t=e.copy();return t.values=Ot(t.values),t}if(l(e))return e.map(t=>Ot(t));try{let t=JSON.parse(e);return f(t)?typeof t=="bigint"?Number(t):t>=0?Math.floor(t):Math.ceil(t):NaN}catch{return NaN}}var B=N(Ot);function le(e,t,n){try{return f(e)?f(t)?f(n)?typeof e=="bigint"?BigInt(le(B(e),t,n)):e<t?t:e>n?n:e:NaN:NaN:NaN}catch{return NaN}}var Ze=N(le);function nr(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.cos(e)):NaN}catch{return NaN}}var or=N(nr);var ir=Object.freeze({boolean:"boolean",date:"date",null:"null",number:"number",object:"object",string:"string"});function pe(e,t){try{if(!f(e))return NaN;if(!f(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=pe(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return Math.pow(e,t)}catch{return NaN}}var Tt=N(pe);function ce(e){try{if(!f(e))return NaN;if(typeof e=="bigint"){let t=ce(Number(e));try{return BigInt(t)}catch{return t}}return Math.sqrt(e)}catch{return NaN}}var he=N(ce);function sr(){try{let e=Object.values(arguments);if(e.length===0)return NaN;let t=!1,n=1;for(let r of e){if(!f(r))return NaN;typeof r=="bigint"&&(t=!0,r=Number(r)),n*=r}if(t)try{return BigInt(n)}catch{}return n}catch{return NaN}}var de=N(sr);function ur(e){try{if(!f(e))return NaN;if(typeof e=="bigint"){if(e===0n)return 1n;e=Number(e)}return Math.exp(e)}catch{return NaN}}var fr=N(ur);function _t(e){try{return typeof e=="bigint"?BigInt(_t(B(e))):e!==B(e)?NaN:e<=1?1:e*_t(e-1)}catch{return NaN}}var lr=N(_t);function pr(e){try{if(e==="Infinity")return 1/0;if(e==="-Infinity")return-1/0;let t=JSON.parse(e);return f(t)?t:NaN}catch{return NaN}}var cr=N(pr);function hr(e){try{return f(e)?typeof e=="bigint"?e:Math.floor(e):NaN}catch{return NaN}}var dr=N(hr);function be(e,t,n){try{if(!f(e))return NaN;if(!f(t))return NaN;if(!f(n))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let r=be(Number(e),Number(t),n);try{return BigInt(r)}catch{return r}}return n*(t-e)+e}catch{return NaN}}var Nr=N(be);function Ne(e,t){try{if(t=h(t)?Math.E:t,!f(e))return NaN;if(!f(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=Ne(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return Math.log(e)/Math.log(t)}catch{return NaN}}var vr=N(Ne);function ve(e,t){try{if(!f(e))return NaN;if(!f(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=ve(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return e%t}catch{return NaN}}var wr=N(ve);var hd=N((e,t,n,r,o)=>{try{let i=!1;for(let p of[e,t,n,r,o]){if(!f(p))return NaN;typeof p=="bigint"&&(i=!0)}i&&(e=Number(e),t=Number(t),n=Number(n),r=Number(r),o=Number(o));let m=(o-r)*(e-t),a=n-t;if(a===0)return NaN;let u=m/a+r;if(i)try{return BigInt(u)}catch{}return u}catch{return NaN}});function Or(e){try{return f(e)?typeof e=="bigint"?e:Math.round(e):NaN}catch{return NaN}}var Tr=N(Or);function we(e){try{return f(e)?typeof e=="bigint"?BigInt(we(Number(e))):e<0?-1:e>0?1:0:NaN}catch{return NaN}}var _r=N(we);function Dr(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.sin(e)):NaN}catch{return NaN}}var Ir=N(Dr);function Ar(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.tan(e)):NaN}catch{return NaN}}var Fr=N(Ar);function Se(e,t,n){arguments.length===2&&(f(arguments[1])?n=null:(n=t,t=null)),s(f(e)&&B(e)===e,"`keyLength` must be an integer!"),t&&(s(f(t)&&B(t)===t,"`keySeed` must be an integer!"),ft(t)),n&&s(w(n),"`charset` must be a string!");let r="";n=n||"abcdefg1234567890";for(let o=0;o<e;o++)r+=n[B(K()*n.length)];return r}typeof globalThis<"u"&&(globalThis.makeKey=Se);})();
|
|
14
|
+
\x1B[0m`)}};function s(e,t){if(!e)throw new R(t)}var yt=[Array,ArrayBuffer,BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int16Array,Int32Array,Int8Array,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray];function h(e){return e===null||typeof e>"u"}var Oe=yt.map(e=>e.name);function l(e){try{return e instanceof Array?!0:h(e.constructor)?!1:yt.indexOf(e.constructor)>-1||Oe.indexOf(e.constructor.name)>-1}catch{return!1}}function y(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/dataframe")}catch{return!1}}function O(e){return typeof e=="function"}function C(e){return typeof e=="object"&&!h(e)&&!l(e)}function g(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/series")}catch{return!1}}function V(e,t){if(y(e)){let i=V(e.values,t);return i.length>0&&f(i[0])&&i[0]>=0&&i[0]<e.index.length&&(i[0]=e.index[i[0]]),i.length>1&&f(i[1])&&i[1]>=0&&i[1]<e.columns.length&&(i[1]=e.columns[i[1]]),i}if(g(e)){let i=V(e.values,t);return i.length>0&&f(i[0])&&i[0]>=0&&i[0]<e.index.length&&(i[0]=e.index[i[0]]),i}if(s(C(e)||l(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `indexOf` function!"),!O(t)){let i=t;t=a=>a===i}function n(i,a,m){if(m=m||[],m.indexOf(i)>-1)return null;if(C(i)){m.push(i);let u=Object.keys(i).concat(Object.getOwnPropertySymbols(i));for(let p=0;p<u.length;p++){let c=u[p],d=i[c];if(a(d))return[c];let v=n(d,a,m);if(v&&v.length>0)return[c].concat(v)}}else if(l(i)){m.push(i);for(let u=0;u<i.length;u++){let p=i[u];if(a(p))return[u];let c=n(p,a,m);if(c&&c.length>0)return[u].concat(c)}}else if(a(i))return[];return null}function r(i){try{return t(i)}catch{return!1}}let o=n(e,r);return o&&o.length>0?o:null}function _(e){function t(n){if(typeof n=="object"){if(n===null)return null;if(l(n))return n instanceof Array?n.map(o=>_(o)):n.slice();if(g(n)){let o=n.copy();return o.values=_(o.values),o}if(y(n)){let o=n.copy();return o.values=_(n.values),o}if(n instanceof Date)return new Date(n.getTime());n=L(n);let r={};return Object.keys(n).concat(Object.getOwnPropertySymbols(n)).forEach(o=>{r[o]=_(n[o])}),r}else return n}return t(L(e))}function L(e){function t(o,i,a){if(i=i||[],a=a||"",i.indexOf(o)>-1){let m=a.split("/").slice(a.startsWith("/")?1:0);if(m.some((p,c)=>{let d=m.slice(0,m.length-c-1),v=n;return d.forEach(D=>{v=v[D]}),v===o}))return`<reference to "${n===o?"/":"/"+V(n,o).join("/")}">`}return typeof o=="object"?o===null?null:(i.push(o),l(o)?typeof o.constructor<"u"&&o.constructor.name!=="Array"?o.slice():o.map((m,u)=>t(m,i,a+"/"+u)):(Object.keys(o).concat(Object.getOwnPropertySymbols(o)).forEach(m=>{o[m]=t(o[m],i,a+"/"+m.toString())}),o)):o}let n=e,r=t(n);if(y(e)){let o=e.copy();o._values=r.values,o._columns=r.columns,o._index=r.index,r=o}if(g(e)){let o=e.copy();o.name=r.name,o._values=r.values,o._index=r.index,r=o}return r}function G(e){return e instanceof Date&&e.toString()!=="Invalid Date"}var _t=["number","int","float","bigint"];function P(e,t){function n(r,o){let i=typeof r,a=typeof o;if(i!==a&&!_t.includes(i)&&!_t.includes(a))return!1;if(i==="undefined"&&a==="undefined")return!0;if(i==="boolean"||i==="symbol")return r===o;if(i==="number"||i==="bigint")try{let m=r.toString(),u=o.toString();return m===u}catch{return!1}if(i==="string"||i==="function")return r===o;if(i==="object"){if(r===null||o===null)return r===null&&o===null;{if(G(r))return G(o)?r.getTime()===o.getTime():!1;if(G(o))return!1;if(r instanceof RegExp&&o instanceof RegExp)return r.toString()===o.toString();if(l(r)!==l(o))return!1;let m=Object.keys(r).concat(Object.getOwnPropertySymbols(r)),u=Object.keys(o).concat(Object.getOwnPropertySymbols(o));if(m.length!==u.length)return!1;for(let p=0;p<m.length;p++){let c=m[p];if(!n(r[c],o[c]))return!1}return!0}}}try{return n(e,t)}catch{return n(L(e),L(t))}}function rt(e){let t="abcdefg1234567890",n="";for(;n.length<e;)n+=t[Math.floor(Math.random()*t.length)];return n}var Te=rt(16),De=rt(16),_e=rt(16),Ie=rt(16),xe=rt(16),at=class{constructor(){this.clear()}get counts(){return this.values.map(t=>this.get(t))}get values(){return Object.values(this.valuesDict)}clear(){return this.countsDict={},this.valuesDict={},this}count(t){for(let n of t)l(n)?this.count(n):this.increment(n);return this}delete(t){let n=this.getStandardizedKey(t);return delete this.countsDict[n],delete this.valuesDict[n],this}get(t){return this.countsDict[this.getStandardizedKey(t)]||0}getStandardizedKey(t){return typeof t=="object"&&t===null?Te:h(t)?De:O(t)?t.toString():typeof t=="symbol"?t.toString()+" - "+xe:t===1/0?_e:t===-1/0?Ie:typeof t=="bigint"?t.toString():y(t)?t.toJSONString():g(t)?JSON.stringify(t.toObject()):JSON.stringify(t)}has(t){return!h(this.countsDict[this.getStandardizedKey(t)])}increment(t){return this.set(t,this.get(t)+1)}set(t,n){let r=this.getStandardizedKey(t);return this.countsDict[r]=n,this.valuesDict[r]=t,this}toArray(){return this.values.map(t=>({value:t,count:this.get(t)}))}toObject(){let t={};return this.values.forEach(n=>{t[n]=this.get(n)}),t}};function I(e){if(y(e)||g(e))return I(e.values);s(l(e),"The `flatten` function only works on arrays, Series, and DataFrames!");function t(n){let r=[];return n.forEach(o=>{l(o)?r=r.concat(t(o)):r.push(o)}),r}return t(e)}function j(e,t){t=t||{};let n=new at,r={},o=I(e),i=[],a=-1/0,m=1/0,u=!1,p=0;for(let d of o){if(typeof d=="bigint"&&(u=!0),!t.shouldDropNaNs||f(d))try{d>a&&(a=d),d<m&&(m=d),p+=Number(d),i.push(d)}catch{a=NaN,m=NaN,p=NaN}n.increment(d)}let c=p/i.length;if(r.counts=n,r.max=a,r.mean=c,r.min=m,r.n=o.length,r.sum=p,isNaN(r.mean)&&(r.max=NaN,r.min=NaN),t.shouldDropNaNs&&(r.nWithoutNaNs=i.length),t.mode){let d=Array.from(n.values.map(F=>[F,n.get(F)])).toSorted((F,st)=>st[1]-F[1]),v=d[0][1],D=[];for(let F of d)if(F[1]==v)D.push(F[0]);else break;r.mode=D.toSorted()}if(t.median)if(isNaN(c))r.median=NaN;else{let d=i.toSorted((D,F)=>Number(D)-Number(F)),v=Math.floor(d.length/2);if(d.length%2===0){let D=d[v-1],F=d[v];if(r.median=(Number(D)+Number(F))/2,u&&typeof D=="bigint"&&typeof F=="bigint")try{r.median=BigInt(r.median)}catch{}}else r.median=d[v]}if(t.stdev||t.variance){let d=0;for(let D of i)d+=Math.pow(Number(D)-c,2);d/=i.length;let v=Math.sqrt(d);r.stdev=v,r.variance=d}if(u){try{r.sum=BigInt(r.sum)}catch{}try{r.mean=BigInt(r.mean)}catch{}t.mode&&(r.mode=r.mode.map(d=>{try{return BigInt(d)}catch{return d}}))}return r}function nt(e,t){let{counts:n}=j(e);return h(t)||(O(t)?n.values.forEach(r=>{t(r)||n.delete(r)}):n.values.forEach(r=>{P(r,t)||n.delete(r)})),n}function bt(e){if(y(e)||g(e))return bt(e.values);if(l(e)){let t=!1,n=!1,r=null;for(let o of e){if(bt(o))return!0;if(l(o)){if(r===null)r=o.length;else if(o.length!==r)return!0;t=!0}else n=!0;if(t&&n)return!0}}return!1}function q(e){return bt(L(e))}function H(e){if(y(e)||g(e))return H(e.values);s(l(e),"The `isNested` function only works on arrays, Series, and DataFrames!");for(let t=0;t<e.length;t++)if(l(e[t]))return!0;return!1}var X="You must pass a natural number or a one-dimensional array of natural numbers into the `ndarray` function!";function A(e){s(!h(e),X),l(e)||(e=[e]),s(!H(e),X),s(e.length>0,X);let t=e[0];if(typeof t=="bigint"&&(t=Number(t)),s(f(t),X),s(t>=0,X),s(Math.floor(t)===t,X),s(t!==1/0,"We can't create an array containing an infinite number of values!"),e.length===1){let n=[];for(let r=0;r<t;r++)n.push(void 0);return n}else{let n=[];for(let r=0;r<t;r++)n.push(A(e.slice(1)));return n}}function B(e){if(y(e)||g(e)){let n=e.copy();return n.values=B(n.values),n.index=B(n.index),n}s(l(e),"The `reverse` function only works on arrays, Series, and DataFrames!");let t=[];for(let n=e.length-1;n>=0;n--)t.push(e[n]);return t}function S(e,t,n=1){s(!h(e)&&!h(t)&&!h(n),"You must pass two numbers and optionally a step value to the `range` function!"),s(f(e)&&f(t)&&f(n),"You must pass two numbers and optionally a step value to the `range` function!"),s(n>0,"The step value must be greater than 0! (NOTE: The step value is a magnitude; it does not indicate direction.)");let r=!1,o=typeof e=="bigint"||typeof t=="bigint"||typeof n=="bigint";if(e=Number(e),t=Number(t),n=Number(n),e>t){r=!0;let a=e;e=t+n,t=a+n}let i=[];for(let a=e;a<t;a+=n)if(o)try{i.push(BigInt(a))}catch{i.push(a)}else i.push(a);return r&&(i=B(i)),i}function ot(e){let t="abcdefg1234567890",n="";for(;n.length<e;)n+=t[Math.floor(Math.random()*t.length)];return n}var Fe=ot(256),Ae=ot(256),je=ot(256),Ee=ot(256),Me=ot(256);function U(e){if(y(e)||g(e))return U(e.values);s(l(e),"The `set` function only works on arrays, Series, and DataFrames!");let t=[],n={};return I(e).forEach(r=>{let o=typeof r=="object"&&r===null?Fe:h(r)?Ae:O(r)?r.toString():typeof r=="symbol"?r.toString()+" - "+Me:r===1/0?je:r===-1/0?Ee:typeof r=="bigint"?r.toString():y(r)?r.toJSONString():g(r)?JSON.stringify(r.toObject()):JSON.stringify(r);n[o]||t.push(r),n[o]=!0}),t}function It(e){if(l(e)){let t=It(e[0]);return[e.length].concat(t||[])}else return}function b(e){return y(e)||g(e)?b(e.values):(s(l(e),"The `shape` function only works on arrays, Series, and DataFrames!"),It(e))}function Nt(e,t,n){if(h(n)&&(n=0),s(n===0||n===1||n==="vertical"||n==="horizontal",'The only valid axis values for use when appending data to a DataFrame are 0, 1, "vertical", and "horizontal". Note that 0 == "horizontal" and 1 == "vertical".'),l(t)){s(!q(t),"The array of data you're trying to append to this DataFrame is jagged!");let r=b(t);if(r.length===1)if(n===0){let o=e.copy();o._values.push(t);let i=Math.max(e.shape[1],r[0]);for(o._values.forEach(a=>{for(;a.length<i;)a.push(void 0)});o._index.length<o._values.length;)o._index.push("row"+o._index.length);for(;o._columns.length<i;)o._columns.push("col"+o._columns.length);return o}else{let o=Math.max(e.shape[0],r[0]),i=e.copy();for(S(0,o).forEach(a=>{a>=i._values.length&&i._values.push(A(e.shape[1])),i._values[a].push(t[a])});i._index.length<i._values.length;)i._index.push("row"+i._index.length);for(;i._columns.length<i._values[0].length;)i._columns.push("col"+i._columns.length);return i}else if(r.length===2)if(n===0){let o=Math.max(...t.map(a=>a.length).concat([e.shape[1]])),i=e.copy();for(i._values=i._values.concat(t).map(a=>{for(;a.length<o;)a.push(void 0);return a});i._index.length<i._values.length;)i._index.push("row"+i._index.length);for(;i._columns.length<o;)i._columns.push("col"+i._columns.length);return i}else{let o=Math.max(...t.map(m=>m.length))+e.shape[1],i=Math.max(e.shape[0],r[0]),a=e.copy();for(S(0,i).forEach(m=>{for(m>=a._values.length&&a._values.push(A(e.shape[1])),a._values[m]=a._values[m].concat(t[m]);a._values[m].length<o;)a._values[m].push(void 0)});a._index.length<a._values.length;)a._index.push("row"+a._index.length);for(;a._columns.length<o;)a._columns.push("col"+a._columns.length);return a}else throw new R("Only 1- and 2-dimensional arrays can be appended to a DataFrame!")}else if(g(t)){let r=Nt(e,t.values,n);return n===0?r.index[r.index.length-1]=r.index.indexOf(t.name)>-1?t.name+" (2)":t.name:r.columns[r.columns.length-1]=r.columns.indexOf(t.name)>-1?t.name+" (2)":t.name,r}else if(y(t))if(n===0){let r=e.copy(),o=U(r._columns.concat(t._columns)).length;for(r._values.forEach(i=>{for(;i.length<o;)i.push(void 0)}),t.apply(i=>{let a=i.copy(),m=[];r._columns.forEach(u=>{let p=a._index.indexOf(u);p>-1?(m.push(a._values[p]),a._values.splice(p,1),a._index.splice(p,1)):m.push(void 0)}),r._values.push(m.concat(a._values))},1),r._columns=r._columns.concat(t._columns.filter(i=>r._columns.indexOf(i)<0));r._index.length<r._values.length;){let i="row"+r._index.length;r._index.push(i+(e._index.indexOf(i)>-1?" (2)":""))}return r}else{let r=e.copy();return r._index.forEach((o,i)=>{let a=t._index.indexOf(o);a>-1?r._values[i]=r._values[i].concat(t._values[a]):r._values[i]=r._values[i].concat(A(t.shape[1]))}),t._index.forEach((o,i)=>{r._index.indexOf(o)<0&&(r._index.push(o),r._values.push(A(r._columns.length).concat(t._values[i])))}),r._columns=r._columns.concat(t._columns.map(o=>o+(r._columns.indexOf(o)>-1?" (2)":""))),r}else throw new R("Only 1- or 2-dimensional arrays, Series, and DataFrames can be appended to a DataFrame!")}function xt(e,t,n,r,o){if(o=o||0,s(O(r),"The first parameter to the `apply` method must be a function."),s(o===0||o===1,"The second parameter to the `apply` method (the `axis`) must be 0 or 1."),o===0){let i={},a;if(n.columns.forEach((m,u)=>{let p=new t(n.values.map(d=>d[u]));p.name=m,p.index=n.index;let c=r(p,u,n);c instanceof t?i[m]=c.values:i[m]=c,h(a)&&(a=c instanceof t||l(c))}),a){let m=new e(i);return m.index=n.index,m}else{let m=new t(n.columns.map(u=>i[u]));return m.index=n.columns,m}}else if(o===1){let i,a=n.values.map((m,u)=>{let p=new t(m);p.name=n.index[u],p.index=n.columns;let c=r(p,u,n);return h(i)&&(i=c instanceof t||l(c)),c instanceof t?c.values:c});if(i){let m=new e(a);return m.index=n.index,m.columns=n.columns,m}else{let m=new t(a);return m.index=n.index,m}}}function w(e){return typeof e=="string"}function Ft(e,t,n,r,o){let i=m=>m instanceof e,a=m=>m instanceof t;if(h(o)){if(i(r))return n.append(r,1);if(a(r))return n.append(r,1);if(C(r)){let m=Math.max(...Object.keys(r).concat(Object.getOwnPropertySymbols(r)).map(u=>r[u].length));return Object.keys(r).concat(Object.getOwnPropertySymbols(r)).forEach(u=>{for(;r[u].length<m;)r[u].push(void 0)}),n.append(new e(r),1)}else throw new R("You must pass a DataFrame, Series, or object into the `assign` method!")}else{s(w(r),"If passing two arguments into the `assign` method, then the first argument must be a string name!"),s(l(o)&&!q(o)&&b(o).length===1,"If passing two arguments into the `assign` method, then the second argument must be a 1-dimensional array!");let m=n.append(o,1);return m.columns[m.columns.length-1]=r,m}}function At(e,t){if(t.isEmpty)return new e;let n=new e(_(t.values));return n.columns=t.columns.slice(),n.index=t.index.slice(),n}function jt(e,t,n,r,o){h(r)&&(r=[]),h(o)&&(o=[]),(w(r)||f(r))&&(r=[r]),(w(o)||f(o))&&(o=[o]),s(l(r),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),s(l(o),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),s(b(r).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),s(b(o).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings.");let i,a;n.index.forEach((u,p)=>{r.indexOf(u)<0&&r.indexOf(p)<0&&(i||(i=[]),i.push(u))}),n.columns.forEach((u,p)=>{o.indexOf(u)<0&&o.indexOf(p)<0&&(a||(a=[]),a.push(u))});let m=n.get(i,a);if(m instanceof t){let u=new e;u=u.assign(m),n.index.indexOf(m.name)>-1&&(u=u.transpose()),m=u}return m}function mt(e){return f(e)&&(e>=0?Math.floor(e)===e:Math.ceil(e)===e)}function k(e){return mt(e)&&e>=0}function Et(e,t,n,r,o,i){r=r||0,s(r===0||r===1,"The first parameter of the `dropMissing` method (the `axis`) must be 0 or 1."),i=i||0,s(k(i),"The third parameter of the `dropMissing` method (the `threshold`) should be a whole number (meaning that data should be dropped if it contains more than `threshold` null values)."),o=i>0?"none":o||"any",s(o==="any"||o==="all"||o==="none","The second parameter of the `dropMissing` method (the `condition` parameter, which indicates the condition under which data should be dropped) should be 'any' or 'all' (meaning that if 'any' of the data contains null values, then it should be dropped; or that if 'all' of the data contains null values, then it should be dropped).");function a(p){if(i>0){let c=0;for(let d=0;d<p.length;d++){let v=p[d];if(h(v)&&c++,c>=i)return[]}}else if(o==="any")for(let c=0;c<p.length;c++){let d=p[c];if(h(d))return[]}else if(o==="all"){for(let c=0;c<p.length;c++){let d=p[c];if(!h(d))return p}return[]}return p}let m=n.copy(),u=Math.random().toString();if(r===0){m=m.assign(u,m.index);let p=m.values.map(a).filter(d=>d.length>0);if(b(p).length<2)return new e;m.values=p;let c=m.get(null,u);if(h(c))return new e;w(c)&&(c=[c]),c instanceof t&&(c=c.values),m.index=c,m=m.drop(null,u)}else if(r===1){let p={};if(m.columns.forEach((d,v)=>{let D=m.values.map(st=>st[v]),F=a(D);F.length>0&&(p[d]=F)}),Object.keys(p).length+Object.getOwnPropertySymbols(p).length===0)return new e;let c=new e(p);return c.index=m.index,c}return m}function ut(e){if(y(e)||g(e))return e.dropNaN(...Object.values(arguments).slice(1));s(l(e),"The `dropNaN` function only works on arrays, Series, and DataFrames!");let t=[];return e.forEach(n=>{try{return t.push(ut(n))}catch{if(f(n))return t.push(n)}}),t}function Mt(e,t,n,r,o){n=n||0,s(n===0||n===1,"The first parameter of the `dropNaN` method (the `axis`) must be 0 or 1."),o=o||0,s(k(o),"The third parameter of the `dropNaN` method (the `threshold`) should be a whole number (meaning that data should be dropped if it contains more than `threshold` NaN values)."),r=o>0?"none":r||"any",s(r==="any"||r==="all"||r==="none","The second parameter of the `dropNaN` method (the `condition` parameter, which indicates the condition under which data should be dropped) should be 'any' or 'all' (meaning that if 'any' of the data contains NaN values, then it should be dropped; or that if 'all' of the data contains NaN values, then it should be dropped).");function i(m){let u=ut(m);return o>0?m.length-u.length<o:r==="any"?u.length===m.length:r==="all"?u.length>0:!0}let a=t.copy();if(n===0){let m=a.index.filter(u=>{let p=a.get(u,null).values;return i(p)});return m.length>0?a.get(m,null):new e}else if(n===1){let m=a.columns.filter(u=>{let p=a.get(null,u).values;return i(p)});return m.length>0?a.get(null,m):new e}return a}function Bt(e){let t={};return I(e).forEach((n,r)=>{t[n]=r}),t}function Q(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e)).sort((t,n)=>e[t]-e[n])}function Ut(e,t,n,r,o){s(O(r),"The `filter` method takes a single parameter: a function that is used to filter the values."),h(o)&&(o=0),s(o===0||o===1,"The `axis` parameter to the `filter` method must be 0 or 1.");let i=n.copy();if(i.isEmpty)return i;let a=Bt(i.index),m=Bt(i.columns);if(o===0){let u=0,p=i.values.filter((c,d)=>{let v=new t(c);v.name=n.index[d],v.index=n.columns;let D=r(v,d,n);return D?u++:delete a[i.index[d]],D});if(u===0)return new e;if(u===1){let c=new t(p[0]);return c.name=Q(a)[0],c.index=Q(m),c}i.values=p,i.index=Q(a)}else if(o===1){i=i.transpose();let u=0,p=i.values.filter((c,d)=>{let v=new t(c);v.name=n.columns[d],v.index=n.index;let D=r(v,d,n);return D?u++:delete m[i.index[d]],D});if(u===0)return new e;if(u===1){let c=new t(p[0]);return c.name=Q(m)[0],c.index=Q(a),c}i.values=p,i.index=Q(m),i=i.transpose()}return i}function Pt(e,t,n){(w(t)||f(t))&&(t=[t]),(w(n)||f(n))&&(n=[n]);for(let o in t)typeof t[o]=="bigint"&&(t[o]=Number(t[o]));for(let o in n)typeof n[o]=="bigint"&&(n[o]=Number(n[o]));let r=U((t||[]).concat(n||[]).map(o=>typeof o));return s(r.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===1&&s(r[0]==="string"||r[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===2&&(s(r.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),s(r.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),h(t)||(t=t.map(o=>{if(w(o))return s(e.index.indexOf(o)>-1,`Row "${o}" does not exist!`),o;if(f(o))return s(o>=0,`Index ${o} is out of bounds!`),s(Math.floor(o)===o,"Row numbers must be integers!"),s(o<e.index.length,`Index ${o} is out of bounds!`),e.index[o]})),h(n)||(n=n.map(o=>{if(w(o))return s(e.columns.indexOf(o)>-1,`Column "${o}" does not exist!`),o;if(f(o))return s(o>=0,`Column ${o} is out of bounds!`),s(Math.floor(o)===o,"Column numbers must be integers!"),s(o<e.columns.length,`Column ${o} is out of bounds!`),e.columns[o]})),e.getSubsetByNames(t,n)}function Be(e,t){try{return e<t?-1:e>t?1:0}catch{return e=typeof e=="object"&&e!==null?JSON.stringify(e):e.toString(),t=typeof t=="object"&&t!==null?JSON.stringify(t):t.toString(),e<t?-1:e>t?1:0}}function J(e,t){if(h(t)&&(t=Be),y(e)||g(e))return e.sort(...Object.values(arguments).slice(1));s(l(e),"The `sort` function only works on arrays, Series, and DataFrames!"),s(O(t),"The second parameter of the `sort` function must be a comparison function!");let n=e.slice();return n.sort(t),n}function Ue(e){let t=e.toLowerCase(),n="";for(let o=0;o<t.length;o++){let i=t[o];i.match(/[a-z0-9]/g)?n+=i:n+=" "}let r=n.split(" ").filter(o=>o.length>0);return r[0]+r.slice(1).map(o=>o[0].toUpperCase()+o.substring(1)).join("")}function vt(e,t,n){h(n)?n=t.columns:w(n)&&(n=[n]);let r={};n.forEach(i=>{s(w(i),"You must pass either a string or a one-dimensional array of strings into the `getDummies` (AKA `oneHotEncode`) method!");let a=t.columns.indexOf(i);s(a>-1,`The given DataFrame does not have a column called "${i}"!`);let m=t.values.map(p=>p[a]),u=J(U(m));m.forEach(p=>{u.forEach(c=>{let d=i+"_"+Ue(c.toString());r[d]||(r[d]=[]),p===c?r[d].push(1):r[d].push(0)})})});let o=new e(r);return o.index=t.index,o}function zt(e,t,n){let r=e.shape;h(t)&&(t=S(0,r[0])),h(n)&&(n=S(0,r[1])),f(t)&&(t=[t]),f(n)&&(n=[n]),s(l(t)&&l(n),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(b(t).length===1&&b(n).length===1,"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(t.length>0,"The `rowIndices` array must contain at least one index."),s(n.length>0,"The `colIndices` array must contain at least one index."),t.forEach(a=>{s(k(a),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(a<e.index.length,`The row index ${a} is out of bounds.`)}),n.forEach(a=>{s(k(a),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),s(a<e.columns.length,`The column index ${a} is out of bounds.`)});let o=t.map(a=>e.index[a]),i=n.map(a=>e.columns[a]);return e.getSubsetByNames(o,i)}function Ct(e,t,n,r,o){h(r)&&(r=n.index),h(o)&&(o=n.columns),w(r)&&(r=[r]),w(o)&&(o=[o]),s(l(r)&&l(o),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(b(r).length===1&&b(o).length===1,"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(r.length>0,"The `rows` array must contain at least one row name."),s(o.length>0,"The `cols` array must contain at least one column name."),r.forEach(m=>{s(w(m),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(n.index.indexOf(m)>-1,`The row name "${m}" does not exist in the list of rows.`)}),o.forEach(m=>{s(w(m),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),s(n.columns.indexOf(m)>-1,`The column name "${m}" does not exist in the list of columns.`)});let i=r.map(m=>o.map(u=>n.values[n.index.indexOf(m)][n.columns.indexOf(u)]));if(r.length===1&&o.length===1)return i[0][0];if(r.length===1){let m=new t(i[0]);return m.name=r[0],m.index=o,m}if(o.length===1){let m=new t(i.map(u=>u[0]));return m.name=o[0],m.index=r,m}let a=new e(i);return a.columns=o,a.index=r,a}function kt(e,t,n){function r(v,D){return w(v)&&v.length>D?v.substring(0,D-3)+"...":v}if(n.isEmpty)return console.table({}),console.log("Shape:",[0,0],`
|
|
15
|
+
`),n;let o=typeof window>"u"?20:10,i=Math.floor(o/2),a=4,m=Math.floor(a/2),u=o>n.index.length?null:S(0,i).concat(S(n.index.length-i,n.index.length)),p=a>n.columns.length?null:S(0,m).concat(S(n.columns.length-m,n.columns.length)),c=n.get(u,p);c instanceof t&&(n.shape[0]===1?(c=new e([c.values]),c.index=n.index,c.columns=new t(n.columns).get(p).values):n.shape[1]===1&&(c=new e([c.values]).transpose(),c.index=new t(n.index).get(u).values,c.columns=n.columns)),o<=n.index.length&&(c._index.splice(i,0,"..."),c._values.splice(i,0,S(0,c.columns.length).map(()=>"..."))),a<=n.columns.length&&(c._columns.splice(m,0,"..."),c._values=c._values.map(v=>(v.splice(m,0,"..."),v)));let d=28;return c instanceof t?(c.values=c.values.map(v=>r(v,d)),c.name=r(c.name,d),c.index=c.index.map(v=>r(v,d))):(c.values=c.values.map(v=>v.map(D=>r(D,d))),c.columns=c.columns.map(v=>r(v,d)),c.index=c.index.map(v=>r(v,d))),console.table(c.toDetailedObject()),console.log("Shape:",n.shape,`
|
|
16
|
+
`),n}function $(e,t){s(f(e),"The `leftPad` function only works on numbers!");let n=e.toString();for(;n.length<t;)n="0"+n;return n}function Jt(e,t){let n=t?e:e.copy();return n.index=S(0,e.shape[0]).map(r=>"row"+$(r,(n.index.length-1).toString().length)),n}function W(e,t){if(y(e)||g(e))return W(e.values,t);s(l(e),"The `product` function only works on arrays, Series, and DataFrames!");try{if(e.length===0)return NaN;let n=I(e),r=!1,o=1;for(let i of n){if(!f(i))if(t)i=1;else return NaN;typeof i=="bigint"&&(r=!0,i=Number(i)),o*=i}if(r)try{return BigInt(o)}catch{}return o}catch{return NaN}}function Rt(e){return mt(e)&&e>0}function Z(e,t){if(y(e)||g(e))return Z(e.values,t);if(s(l(e),"The first argument passed into the `reshape` function must be an array!"),f(t)&&(t=[t]),s(l(t),"The second argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),s(b(t).length===1,"The first argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),t=t.map(i=>(typeof i=="bigint"&&(i=Number(i)),s(Rt(i),"The first argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),Number(i))),t.length===0)return I(e);let n=I(e);if(t.length===1&&t[0]===n.length)return n;s(W(t)===n.length,"The new shape doesn't match the number of values available in `x` (the first argument passed into the `reshape` function)!");let r=[],o=Math.floor(n.length/t[0]);for(let i=0;i<t[0];i++){let a=n.slice(i*o,(i+1)*o);r.push(Z(a,t.slice(1)))}return r}var $t=Math.pow(2,64),T=[];ft(Math.floor(Math.random()*$t));function Pe(e,t){e=x(e);function n(){e+=x("0x9e3779b97f4a7c15");let o=_(e);return o=(o^o>>BigInt(30))*x("0xbf58476d1ce4e5b9"),o=(o^o>>BigInt(27))*x("0x94d049bb133111eb"),o^o>>BigInt(31)}let r=[];for(let o=0;o<t;o++)r.push(n());return r}function x(e){return BigInt.asUintN(64,BigInt(e))}function Yt(e,t){return e=x(e),t=BigInt(t),x(x(e<<t)|x(e>>x(BigInt(64)-t)))}function ft(e){if(typeof e=="bigint"&&(e=Number(e)),h(e))return _(T);{s(f(e),"If passing a value into the `seed` function, then that value must be an integer!");let t=Pe(Math.floor(e),4);T[0]=t[0],T[1]=t[1],T[2]=t[2],T[3]=t[3]}}function Kt(){let e=x(Yt(T[0]+T[3],23)+T[0]),t=x(T[1]<<BigInt(17));return T[2]=x(T[2]^T[0]),T[3]=x(T[3]^T[1]),T[1]=x(T[1]^T[2]),T[0]=x(T[0]^T[3]),T[2]=x(T[2]^t),T[3]=Yt(T[3],45),Math.floor(Number(e))/$t}function Y(e){return h(e)?Kt():(l(e)||(e=[e]),Z(A(W(e)).map(Kt),e))}function tt(e){if(y(e)||g(e))return e.shuffle(...Object.values(arguments).slice(1));s(l(e),"The `shuffle` function only works on arrays, Series, and DataFrames!");let t=[],n=e.slice();for(let r=0;r<e.length;r++){let o=Math.floor(Y()*n.length);t.push(n.splice(o,1)[0])}return t}function Lt(e,t){return h(t)&&(t=0),s(t===0||t===1,"The `axis` parameter to the `shuffle` must be 0, 1, or undefined."),e.get(t===0?tt(e.index):null,t===1?tt(e.columns):null)}function et(e){return typeof e=="boolean"}function qt(e,t,n){return O(t)?ze(e,t,n):Ce(e,t,n)}function ze(e,t,n){if(n=h(n)?0:n,s(O(t),"When sorting a DataFrame using a function, the first argument to the `sort` method must be a function!"),s(f(n),"When sorting a DataFrame using a function, the second argument to the `sort` method must be null, undefined, 0, or 1 to indicate the axis along which the data should be sorted! An axis of 0 means that the rows will be sorted relative to each other, whereas an axis of 1 means that the columns will be sorted relative to each other."),n===0){let r=J(e.index,(o,i)=>t(e.get(o,null),e.get(i,null)));return e.get(r,null)}else{let r=J(e.columns,(o,i)=>t(e.get(null,o),e.get(null,i)));return e.get(null,r)}}function Ce(e,t,n){let r=e.copy(),o=Y().toString();r=r.assign(o,r.index),h(t)&&(t=[o],n=[!0]),(f(t)||w(t))&&(t=[t],(et(n)||w(n))&&(n=[n])),s(l(t),"The first parameter of the `sort` method must be (1) a string or index representing a column name or index, respectively; (2) a 1-dimensional array of strings and/or indices; or (3) null."),s(b(t).length===1,"The first parameter of the `sort` method must be (1) a string or index representing a column name or index, respectively; (2) a 1-dimensional array of strings and/or indices; or (3) null."),h(n)&&(n=S(0,t.length).map(()=>!0)),s(l(n),"The second parameter of the `sort` method must be (1) a string or boolean representing the sort direction ('ascending' / 'descending', or true / false); (2) a 1-dimensional array of strings and/or booleans; or (3) null."),s(b(n).length===1,"The second parameter of the `sort` method must be (1) a string or boolean representing the sort direction ('ascending' / 'descending', or true / false); (2) a 1-dimensional array of strings and/or booleans; or (3) null."),s(t.length===n.length,"The arrays passed into the `sort` method must be equal in length."),t=t.map(a=>{if(s(w(a)||f(a),"Column references can either be column names (as strings) or column indices (as whole numbers)."),w(a)){let m=r.columns.indexOf(a);return s(m>-1,`The column "${a}" does not exist!`),m}if(f(a))return s(k(a),"Column indices must be whole numbers!"),s(a<r.columns.length,`The index ${a} is out of bounds!`),a}),n=n.map(a=>{if(s(w(a)||et(a),"Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),w(a)){let m=a.trim().toLowerCase();return s(m==="ascending"||m==="descending","Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),m==="ascending"}if(et(a))return a}),r.values=J(r.values,(a,m)=>{let u=0;for(;a[t[u]]===m[t[u]]&&u<t.length;)u++;let p=n[u];if(a[t[u]]===m[t[u]])return 0;if(a[t[u]]<m[t[u]])return p?-1:1;if(a[t[u]]>m[t[u]])return p?1:-1});let i=r.columns.indexOf(o);return r.index=r.values.map(a=>a[i]),r=r.dropColumns(o),r}function Vt(e,t){h(t)?t=0:s(t===0||t===1,"The axis parameter of the `toDetailedObject` method must be undefined, 0, or 1. An axis of 0 indicates that the returned object should be organized first by rows and then by columns. An axis of 1 indicates that the returned object should be organized first by columns and then by rows.");let n={};return t===0?e.index.forEach((r,o)=>{let i={};e.columns.forEach((a,m)=>{i[a]=e.values[o][m]}),n[r]=i}):e.columns.forEach((r,o)=>{let i={};e.index.forEach((a,m)=>{i[a]=e.values[m][o]}),n[r]=i}),n}function lt(e,t){return JSON.stringify(e.toObject(t))}async function Gt(e,t){return JSON.parse(lt(e,t))}function Wt(e){let t={};return e.columns.forEach(n=>{t[n]=e.get(n).values}),t}function z(e){if(y(e)||g(e))return e.transpose();s(l(e),"The `transpose` function only works on arrays, Series, and DataFrames!");let t=b(e);if(s(t.length<=2,"I'm not smart enough to know how to transpose arrays that have more than 2 dimensions. Sorry for the inconvenience! Please only pass 1- or 2-dimensional arrays into the `transpose` function!"),t.length===1)return B(e);if(t.length===2){let n=A(B(t));for(let r=0;r<t[0];r++)for(let o=0;o<t[1];o++)n[o][r]=e[r][o];return n}}function wt(e,t,n){if(g(n))return new e(t.values.concat(n.values));if(l(n)){let r=b(n);s(r.length===1&&!H(r),"Only vectors can be appended to Series!");let o=t.copy();return n.forEach((i,a)=>{o._values.push(i),o._index.push("item"+(t.values.length+a))}),o}return wt(t,[n])}function Ht(e,t){s(O(t),"The parameter to the `apply` method must be a function.");let n=e.copy();return n._values=n._values.map((r,o)=>t(r,o)),n}function Xt(e){let t=e.copy(),n=[];return t._values=t.values.filter((r,o)=>h(r)?!1:(n.push(t.index[o]),!0)),t._index=n,t}function Qt(e,t){let n=[],r=[];t.values.forEach((i,a)=>{f(i)&&(r.push(i),n.push(t.index[a]))});let o=new e(r);return o.name=t.name,o.index=n,o}function Zt(e,t,n){let r=t.copy(),o=_(r.index),i=[],a=r.values.filter((m,u)=>{let p=n(m,u,r.values);return p||i.push(r.index[u]),p});return i.forEach(m=>{o.splice(o.indexOf(m),1)}),a.length===0?(r=new e,r.name=t.name,r):(r.values=a,r.index=o,r)}function te(e,t){(w(t)||f(t))&&(t=[t]);for(let r in t)typeof t[r]=="bigint"&&(t[r]=Number(t[r]));let n=U((t||[]).map(r=>typeof r));return s(n.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===1&&s(n[0]==="string"||n[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===2&&(s(n.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),s(n.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),h(t)||(t=t.map(r=>{if(typeof r=="string")return s(e.index.indexOf(r)>-1,`Index "${r}" does not exist!`),r;if(typeof r=="number")return s(r>=0,`Index ${r} is out of bounds!`),s(Math.floor(r)===r,"Indices must be integers!"),s(r<e.index.length,`Index ${r} is out of bounds!`),e.index[r]})),e.getSubsetByNames(t)}function ee(e,t){let n=e.shape;h(t)&&(t=S(0,n[0])),s(l(t),"The `indices` array must be 1-dimensional array of whole numbers."),s(b(t).length===1,"The `indices` array must be a 1-dimensional array of whole numbers."),s(t.length>0,"The `indices` array must contain at least one index."),t.forEach(o=>{s(k(o),"The `indices` array must be a 1-dimensional array of whole numbers."),s(o<e.index.length,`The row index ${o} is out of bounds.`)});let r=t.map(o=>e.index[o]);return e.getSubsetByNames(r)}function re(e,t,n){h(n)&&(n=t.index),s(l(n),"The `indices` array must be a 1-dimensional array of strings."),s(b(n).length===1,"The `indices` array must be a 1-dimensional array of strings."),s(n.length>0,"The `indices` array must contain at least one index name."),n.forEach(i=>{s(w(i),"The `indices` array must contain only strings."),s(t.index.indexOf(i)>-1,`The name "${i}" does not exist in the index.`)});let r=n.map(i=>t.values[t.index.indexOf(i)]);if(r.length===1)return r[0];let o=new e(r);return o.index=n,o.name=t.name,o}function ne(e){let t=e.copy(),n=typeof window>"u"?20:10;if(t.index.length>n){t=t.get(S(0,n/2).concat(S(t.index.length-n/2,t.index.length)));let o=_(t.index);o.splice(Math.floor(o.length/2),0,"..."),t.values.push("..."),t.index.push("..."),t=t.get(o)}let r={};return t.values.forEach((o,i)=>{let a={};a[t.name]=o,r[t.index[i]]=a}),console.table(r),console.log("Shape:",e.shape,`
|
|
17
|
+
`),e}function oe(e){let t=e.copy();return t.get(tt(t.index))}function ie(e,t,n){n=n||((u,p)=>u<p?-1:1),s(h(n)||O(n),"You must pass undefined, null, or a comparison function as the second argument to the `sort` method!");let r=z([t.values,t.index]),o=J(r,(u,p)=>n(u[0],p[0])),i=[],a=[];o.forEach(u=>{i.push(u[0]),a.push(u[1])});let m=new e;return m._values=i,m._index=a,m.name=t.name,m}function se(e,t){let n=z([t.values,t.index]);n=z(J(n,(o,i)=>{if(o[1]===i[1])return 0;if(o[1]<i[1])return-1;if(o[1]>i[1])return 1}));let r=new e(n[0]);return r.index=n[1],r.name=t.name,r}function ae(e){let t={};return t[e.name]={},e.index.forEach((n,r)=>{t[e.name][n]=e.values[r]}),t}var me=Symbol.for("@jrc03c/js-math-tools/series");function ue(e){class t{static[Symbol.hasInstance](r){try{return!!r._symbol&&r._symbol===me}catch{return!1}}constructor(r){if(this.name="data",Object.defineProperty(this,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:me}),Object.defineProperty(this,"_values",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"values",{configurable:!0,enumerable:!0,get(){return this._values},set(o){s(l(o),"The new values must be a 1-dimensional array!");let i=b(o);s(i.length===1,"The new array of values must be 1-dimensional!"),i[0]<this._index.length?this._index=this._index.slice(0,i[0]):i[0]>this._index.length&&(this._index=this._index.concat(S(this._index.length,i[0]).map(a=>"item"+$(a,(o.length-1).toString().length)))),this._values=o}}),Object.defineProperty(this,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"index",{configurable:!0,enumerable:!0,get(){return this._index},set(o){s(l(o),"The new index must be a 1-dimensional array of strings!"),s(o.length===this.shape[0],"The new index must be the same length as the old index!"),s(b(o).length===1,"The new index must be a 1-dimensional array of strings!"),o.forEach(i=>{s(w(i),"All of the row names must be strings!")}),this._index=o}}),r){if(r instanceof t)this.name=r.name,this.values=_(r.values),this.index=_(r.index);else if(l(r)){let o=b(r);s(o.length===1,"When passing an array into the constructor of a Series, the array must be 1-dimensional!"),this.values=r}else if(r instanceof Object){let o=Object.keys(r).concat(Object.getOwnPropertySymbols(r)).map(m=>m.toString());s(o.length===1,"When passing an object into the constructor of a Series, the object must have only 1 key-value pair, where the key is the name of the data and the value is the 1-dimensional array of values!");let i=o[0],a=r[i];s(b(a).length===1,"When passing an object into the constructor of a Series, the object must have only 1 key-value pair, where the key is the name of the data and the value is the 1-dimensional array of values!"),this.name=i,this.values=a.slice()}}}get shape(){return b(this.values)}get length(){return this.shape[0]}get isEmpty(){return this.values.filter(r=>!h(r)).length===0}clear(){let r=this.copy();return r.values.forEach((o,i)=>{r.values[i]=void 0}),r}get(r){return te(this,r)}getSubsetByNames(r){return re(t,this,r)}getSubsetByIndices(r){return ee(this,r)}loc(r){return this.getSubsetByNames(r)}iloc(r){return this.getSubsetByIndices(r)}reverse(){let r=new t(B(this.values));return r.index=B(this.index),r.name=this.name,r}resetIndex(){let r=this.copy();return r.index=S(0,this.shape[0]).map(o=>"item"+$(o,(r.index.length-1).toString().length)),r}copy(){let r=new t;return r._values=_(this.values),r._index=_(this.index),r.name=this.name,r}append(r){return wt(t,this,r)}apply(r){return Ht(this,r)}concat(r){return this.append(r)}dropMissing(r,o){return Xt(this,r,o)}dropNaN(){return Qt(t,this)}toObject(){return ae(this)}print(){return ne(this)}shuffle(){return oe(this)}sort(r){return ie(t,this,r)}sortByIndex(){return se(t,this)}filter(r){return Zt(t,this,r)}toDataFrame(){let r=new e(z([this.values]));return r.columns=[this.name],r.index=this.index,r}transpose(){let r=this.copy();return r.values=B(r.values),r.index=B(r.index),r}getDummies(){return this.toDataFrame().getDummies()}oneHotEncode(){return this.getDummies()}}return t}var fe=Symbol.for("@jrc03c/js-math-tools/dataframe");function pt(e){let t="abcdefghijklmnopqrstuvwxyz1234567890",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Y()*t.length)];return n}var K=class e{static[Symbol.hasInstance](t){try{return!!t._symbol&&t._symbol===fe}catch{return!1}}constructor(t){if(Object.defineProperty(this,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:fe}),Object.defineProperty(this,"_values",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"values",{configurable:!0,enumerable:!0,get(){return this._values.length===0||!h(this._values[0])&&this._values[0].length===0?[[]]:this._values},set(n){s(l(n),"The new values must be a 2-dimensional array!");let r=b(n);s(r.length===2,"The new array of values must be 2-dimensional!"),r[0]<this._index.length?this._index=this._index.slice(0,r[0]):r[0]>this._index.length&&(this._index=this._index.concat(S(this._index.length,r[0]).map(o=>"row"+$(o,(r[0]-1).toString().length)))),r[1]<this._columns.length?this._columns=this._columns.slice(0,r[1]):r[1]>this._columns.length&&(this._columns=this._columns.concat(S(this._columns.length,r[1]).map(o=>"col"+$(o,(r[1]-1).toString().length)))),this._values=n}}),Object.defineProperty(this,"_columns",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"columns",{configurable:!0,enumerable:!0,get(){return this._columns},set(n){s(l(n),"The new columns list must be a 1-dimensional array of strings!"),s(this.isEmpty||n.length===this.shape[1],"The new columns list must be the same length as the old columns list!"),s(b(n).length===1,"The new columns list must be a 1-dimensional array of strings!"),n=n.map(o=>(typeof o!="string"&&(o=JSON.stringify(o)||o.toString()),o.trim().length===0?"untitled_"+pt(8):o.trim()));let r=(()=>{let o=nt(n),i={};return o.values.forEach(a=>{i[a]=o.get(a)}),i})();n=n.map(o=>r[o]>1?o+"_"+pt(8):o),this._columns=n}}),Object.defineProperty(this,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"index",{configurable:!0,enumerable:!0,get(){return this._index},set(n){s(l(n),"The new index must be a 1-dimensional array of strings!"),s(this.isEmpty||n.length===this.shape[0],"The new index must be the same length as the old index!"),s(b(n).length===1,"The new index must be a 1-dimensional array of strings!"),n=n.map(o=>(typeof o!="string"&&(o=JSON.stringify(o)||o.toString()),o.trim().length===0?"untitled_"+pt(8):o.trim()));let r=(()=>{let o=nt(n),i={};return o.values.forEach(a=>{i[a]=o.get(a)}),i})();n=n.map(o=>r[o]>1?o+"_"+pt(8):o),this._index=n}}),s(h(t)||C(t)||l(t),"The `data` passed into the constructor of a DataFrame must be either (1) an object where the key-value pairs are (respectively) column names and 1-dimensional arrays of values, or (2) a 2-dimensional array of values."),t)if(t instanceof e)this.values=_(t.values),this.columns=_(t.columns),this.index=_(t.index);else if(l(t)){let n=b(t);s(n.length===2,"The `data` array passed into the constructor of a DataFrame must be 2-dimensional!"),s(!q(t),"The 2-dimensional array passed into the constructor of a DataFrame must not contain sub-arrays (i.e., rows) of different lengths!"),this.values=t}else{this._columns=Object.keys(t).concat(Object.getOwnPropertySymbols(t)).map(a=>a.toString());let n=[],r=null,o=null;this._columns.forEach(a=>{h(o)&&(r=a,o=t[a].length),s(t[a].length===o,`The object passed into the DataFrame constructor contains arrays of different lengths! The key "${r}" points to an array containing ${o} items, and the key "${a}" points to an array containing ${t[a].length} items.`),o=t[a].length;let m=t[a];n.push(m)}),this._values=z(n);let i=b(this.values);this._index=S(0,i[0]).map(a=>"row"+$(a,(i[0]-1).toString().length))}}get shape(){return b(this.values)}get length(){return this.shape[0]}get width(){return this.shape[1]}get rows(){return this.index}set rows(t){this.index=t}get isEmpty(){return this.values.length===0||this.values.every(t=>t.length===0)}clear(){let t=new e(A(this.shape));return t.columns=this.columns.slice(),t.index=this.index.slice(),t}get(t,n){if(arguments.length===0)return this;if(arguments.length===1)try{return this.get(null,t)}catch{return this.get(t,null)}return Pt(this,t,n)}getSubsetByNames(t,n){return Ct(e,E,this,t,n)}getSubsetByIndices(t,n){return zt(this,t,n)}getDummies(t){return vt(e,this,t)}oneHotEncode(t){return vt(e,this,t)}transpose(){let t=new e(z(this.values));return t.columns=this.index.slice(),t.index=this.columns.slice(),t}get T(){return this.transpose()}resetIndex(t){return Jt(this,t)}copy(){return At(e,this)}assign(t,n){return Ft(e,E,this,t,n)}apply(t,n){return xt(e,E,this,t,n)}dropMissing(t,n,r){return Et(e,E,this,t,n,r)}dropNaN(t,n,r){return Mt(e,this,t,n,r)}drop(t,n){return jt(e,E,this,t,n)}dropColumns(t){return this.drop(null,t)}dropRows(t){return this.drop(t,null)}toDetailedObject(t){return Vt(this,t)}toObject(){return Wt(this)}toJSONString(t){return lt(this,t)}saveAsJSON(t,n){return Gt(this,t,n)}print(){return kt(e,E,this)}sort(t,n){return qt(this,t,n)}sortByIndex(){return this.sort()}filter(t,n){return Ut(e,E,this,t,n)}shuffle(t){return Lt(this,t)}append(t,n){return Nt(this,t,n)}concat(t,n){return this.append(t,n)}join(t,n){return this.append(t,n)}toString(){return JSON.stringify(this)}},E=ue(K);function it(e,t){return j(e,{shouldDropNaNs:t}).max}function N(e){return s(O(e),"You must pass a function into the `vectorize` function!"),function t(){let n,r,o=[],i=[],a=Object.keys(arguments).filter(m=>{let u=arguments[m];return l(u)?!0:g(u)?(n=!0,o.push(u),!0):y(u)?(r=!0,i.push(u),!0):!1}).map(m=>arguments[m]);if(a.slice(0,-1).forEach((m,u)=>{s(P(l(m)?b(m):m.shape,l(a[u+1])?b(a[u+1]):a[u+1].shape),`When passing multiple arrays into the \`${e.name}\` function, all of the arrays must have the same shape!`)}),a.length>0){let m=it(a.map(p=>p.length?p.length:p.values.length)),u=S(0,m).map(p=>{let c=Object.keys(arguments).map(d=>l(arguments[d])?arguments[d][p]:g(arguments[d])||y(arguments[d])?arguments[d].values[p]:arguments[d]);return t(...c)});if(r)try{if(i.length===1&&P(b(i[0]),b(u))){let p=new K(u);return p.index=i[0].index.slice(),p.columns=i[0].columns.slice(),p}else return new K(u)}catch{return u}if(n)try{if(o.length===1&&o[0].length===u.length){let p=new E(u);return p.name=o[0].name,p.index=o[0].index.slice(),p}else return new E(u)}catch{return u}return u}else return e(...arguments)}}function ke(e){try{return f(e)?typeof e=="bigint"?e<0?-e:e:Math.abs(e):NaN}catch{return NaN}}var ct=N(ke);function Je(){try{let e=0,t=!1,n=Object.values(arguments);for(let r of n){if(!f(r))return NaN;typeof r=="bigint"&&(t=!0,r=Number(r)),e+=r}if(t)try{return BigInt(e)}catch{}return e}catch{return NaN}}var St=N(Je);function Re(e,t){try{return t(e)}catch{return NaN}}var ht=N(Re);function Ye(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.acos(e)):NaN}catch{return NaN}}var Ke=N(Ye);function $e(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.asin(e)):NaN}catch{return NaN}}var Le=N($e);function qe(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.atan(e)):NaN}catch{return NaN}}var Ve=N(qe);function We(e){try{return f(e)?typeof e=="bigint"?e:Math.ceil(e):NaN}catch{return NaN}}var He=N(We);function Xe(e,t){try{if(!f(e))return NaN;if(typeof e=="bigint")return e;if(h(t))t=1e-10;else if(!f(t))return NaN;return ct(e)<t?0:e}catch{return NaN}}var Qe=N(Xe);function Ot(e){if(y(e)||g(e)){let t=e.copy();return t.values=Ot(t.values),t}if(l(e))return e.map(t=>Ot(t));try{let t=JSON.parse(e);return f(t)?typeof t=="bigint"?Number(t):t>=0?Math.floor(t):Math.ceil(t):NaN}catch{return NaN}}var M=N(Ot);function le(e,t,n){try{return f(e)?f(t)?f(n)?typeof e=="bigint"?BigInt(le(M(e),t,n)):e<t?t:e>n?n:e:NaN:NaN:NaN}catch{return NaN}}var Ze=N(le);function nr(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.cos(e)):NaN}catch{return NaN}}var or=N(nr);var ir=Object.freeze({boolean:"boolean",date:"date",null:"null",number:"number",object:"object",string:"string"});function pe(e,t){try{if(!f(e))return NaN;if(!f(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=pe(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return Math.pow(e,t)}catch{return NaN}}var Tt=N(pe);function ce(e){try{if(!f(e))return NaN;if(typeof e=="bigint"){let t=ce(Number(e));try{return BigInt(t)}catch{return t}}return Math.sqrt(e)}catch{return NaN}}var he=N(ce);function sr(){try{let e=Object.values(arguments);if(e.length===0)return NaN;let t=!1,n=1;for(let r of e){if(!f(r))return NaN;typeof r=="bigint"&&(t=!0,r=Number(r)),n*=r}if(t)try{return BigInt(n)}catch{}return n}catch{return NaN}}var de=N(sr);function ur(e){try{if(!f(e))return NaN;if(typeof e=="bigint"){if(e===0n)return 1n;e=Number(e)}return Math.exp(e)}catch{return NaN}}var fr=N(ur);function Dt(e){try{return typeof e=="bigint"?BigInt(Dt(M(e))):e!==M(e)?NaN:e<=1?1:e*Dt(e-1)}catch{return NaN}}var lr=N(Dt);function pr(e){try{if(e==="Infinity")return 1/0;if(e==="-Infinity")return-1/0;let t=JSON.parse(e);return f(t)?t:NaN}catch{return NaN}}var cr=N(pr);function hr(e){try{return f(e)?typeof e=="bigint"?e:Math.floor(e):NaN}catch{return NaN}}var dr=N(hr);function be(e,t,n){try{if(!f(e))return NaN;if(!f(t))return NaN;if(!f(n))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let r=be(Number(e),Number(t),n);try{return BigInt(r)}catch{return r}}return n*(t-e)+e}catch{return NaN}}var Nr=N(be);function Ne(e,t){try{if(t=h(t)?Math.E:t,!f(e))return NaN;if(!f(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=Ne(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return Math.log(e)/Math.log(t)}catch{return NaN}}var vr=N(Ne);function ve(e,t){try{if(!f(e))return NaN;if(!f(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=ve(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return e%t}catch{return NaN}}var wr=N(ve);var ld=N((e,t,n,r,o)=>{try{let i=!1;for(let p of[e,t,n,r,o]){if(!f(p))return NaN;typeof p=="bigint"&&(i=!0)}i&&(e=Number(e),t=Number(t),n=Number(n),r=Number(r),o=Number(o));let a=(o-r)*(e-t),m=n-t;if(m===0)return NaN;let u=a/m+r;if(i)try{return BigInt(u)}catch{}return u}catch{return NaN}});function Or(e){try{return f(e)?typeof e=="bigint"?e:Math.round(e):NaN}catch{return NaN}}var Tr=N(Or);function we(e){try{return f(e)?typeof e=="bigint"?BigInt(we(Number(e))):e<0?-1:e>0?1:0:NaN}catch{return NaN}}var Dr=N(we);function _r(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.sin(e)):NaN}catch{return NaN}}var Ir=N(_r);function Fr(e){try{return f(e)?(typeof e=="bigint"&&(e=Number(e)),Math.tan(e)):NaN}catch{return NaN}}var Ar=N(Fr);function Se(e,t,n){arguments.length===2&&(f(arguments[1])?n=null:(n=t,t=null)),s(f(e)&&M(e)===e,"`keyLength` must be an integer!"),t&&(s(f(t)&&M(t)===t,"`keySeed` must be an integer!"),ft(t)),n&&s(w(n),"`charset` must be a string!");let r="";n=n||"abcdefg1234567890";for(let o=0;o<e;o++)r+=n[M(Y()*n.length)];return r}typeof globalThis<"u"&&(globalThis.makeKey=Se);})();
|
package/package.json
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"key": "./bin.mjs"
|
|
5
5
|
},
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@jrc03c/js-math-tools": "^0.0.
|
|
7
|
+
"@jrc03c/js-math-tools": "^0.0.92"
|
|
8
8
|
},
|
|
9
9
|
"description": "",
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@jrc03c/fake-jest": "^0.0.16",
|
|
12
|
-
"esbuild": "^0.
|
|
12
|
+
"esbuild": "^0.25.0",
|
|
13
13
|
"eslint": "^8.36.0"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [],
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
"module": "./src/index.mjs",
|
|
19
19
|
"name": "@jrc03c/make-key",
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "0.0.
|
|
21
|
+
"version": "0.0.36"
|
|
22
22
|
}
|