@jrc03c/make-key 0.0.32 → 0.0.34

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/build.mjs CHANGED
@@ -5,19 +5,15 @@ function rebuild() {
5
5
  console.log(`\nRebuilding... (${new Date().toLocaleString()})`)
6
6
 
7
7
  try {
8
- const baseCommand = "npx esbuild src/index.mjs --bundle"
8
+ execSync(
9
+ `npx esbuild src/iife.mjs --bundle --outfile=dist/make-key.js`,
10
+ { encoding: "utf8" },
11
+ )
9
12
 
10
- const commands = [
11
- "mkdir -p dist",
12
- "rm -rf dist/*",
13
- `${baseCommand} --platform=node --outfile=dist/make-key.require.cjs`,
14
- `${baseCommand} --outfile=dist/make-key.standalone.cjs`,
15
- `${baseCommand} --format=esm --outfile=dist/make-key.import.mjs`,
16
- ]
17
-
18
- commands.forEach(command => {
19
- execSync(command, { encoding: "utf8" })
20
- })
13
+ execSync(
14
+ `npx esbuild src/iife.mjs --bundle --minify --outfile=dist/make-key.min.js`,
15
+ { encoding: "utf8" },
16
+ )
21
17
 
22
18
  console.log("\nDone! 🎉\n")
23
19
  } catch (e) {
@@ -4284,7 +4284,9 @@
4284
4284
  }
4285
4285
  return out2;
4286
4286
  }
4287
- if (typeof window !== "undefined") {
4288
- window.makeKey = makeKey4;
4287
+
4288
+ // src/iife.mjs
4289
+ if (typeof globalThis !== "undefined") {
4290
+ globalThis.makeKey = makeKey4;
4289
4291
  }
4290
4292
  })();
@@ -0,0 +1,27 @@
1
+ (()=>{var Tt=Object.create;var Ue=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames;var Mt=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var qe=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var jt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Dt(t))!Et.call(e,s)&&s!==n&&Ue(e,s,{get:()=>t[s],enumerable:!(r=It(t,s))||r.enumerable});return e};var ze=(e,t,n)=>(n=e!=null?Tt(Mt(e)):{},jt(t||!e||!e.__esModule?Ue(n,"default",{value:e,enumerable:!0}):n,e));var Bt=Object.defineProperty,Ft=(e,t,n)=>t in e?Bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nt=(e,t,n)=>(Ft(e,typeof t!="symbol"?t+"":t,n),n);function d(e){return typeof e=="number"&&!isNaN(e)||typeof e=="bigint"}var At=new Function(`
2
+ try {
3
+ return this === window
4
+ } catch(e) {}
5
+
6
+ try {
7
+ return typeof importScripts !== "undefined"
8
+ } catch(e) {}
9
+
10
+ return false
11
+ `),U=class extends Error{constructor(e){At()?super(e):super(`
12
+
13
+ \x1B[31m`+e+`
14
+ \x1B[0m`)}};function a(e,t){if(!e)throw new U(t)}var rt=[Array,ArrayBuffer,BigInt64Array,BigUint64Array,Float32Array,Float64Array,Int16Array,Int32Array,Int8Array,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray];function p(e){return e===null||typeof e>"u"}var Pt=rt.map(e=>e.name);function h(e){try{return e instanceof Array?!0:p(e.constructor)?!1:rt.indexOf(e.constructor)>-1||Pt.indexOf(e.constructor.name)>-1}catch{return!1}}function v(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/dataframe")}catch{return!1}}function D(e){return typeof e=="function"}function K(e){return typeof e=="object"&&!p(e)&&!h(e)}function y(e){try{return!!e._symbol&&e._symbol===Symbol.for("@jrc03c/js-math-tools/series")}catch{return!1}}function Q(e,t){if(v(e)){let o=Q(e.values,t);return o.length>0&&d(o[0])&&o[0]>=0&&o[0]<e.index.length&&(o[0]=e.index[o[0]]),o.length>1&&d(o[1])&&o[1]>=0&&o[1]<e.columns.length&&(o[1]=e.columns[o[1]]),o}if(y(e)){let o=Q(e.values,t);return o.length>0&&d(o[0])&&o[0]>=0&&o[0]<e.index.length&&(o[0]=e.index[o[0]]),o}if(a(K(e)||h(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `indexOf` function!"),!D(t)){let o=t;t=i=>i===o}function n(o,i,u){if(u=u||[],u.indexOf(o)>-1)return null;if(K(o)){u.push(o);let l=Object.keys(o).concat(Object.getOwnPropertySymbols(o));for(let c=0;c<l.length;c++){let f=l[c],m=o[f];if(i(m))return[f];let g=n(m,i,u);if(g&&g.length>0)return[f].concat(g)}}else if(h(o)){u.push(o);for(let l=0;l<o.length;l++){let c=o[l];if(i(c))return[l];let f=n(c,i,u);if(f&&f.length>0)return[l].concat(f)}}else if(i(o))return[];return null}function r(o){try{return t(o)}catch{return!1}}let s=n(e,r);return s&&s.length>0?s:null}function E(e){function t(n){if(typeof n=="object"){if(n===null)return null;if(h(n))return n instanceof Array?n.map(s=>E(s)):n.slice();if(y(n)){let s=n.copy();return s.values=E(s.values),s}if(v(n)){let s=n.copy();return s.values=E(n.values),s}if(n instanceof Date)return new Date(n.getTime());n=Z(n);let r={};return Object.keys(n).concat(Object.getOwnPropertySymbols(n)).forEach(s=>{r[s]=E(n[s])}),r}else return n}return t(Z(e))}function Z(e){function t(s,o,i){if(o=o||[],i=i||"",o.indexOf(s)>-1){let u=i.split("/").slice(i.startsWith("/")?1:0);if(u.some((c,f)=>{let m=u.slice(0,u.length-f-1),g=n;return m.forEach(N=>{g=g[N]}),g===s}))return`<reference to "${n===s?"/":"/"+Q(n,s).join("/")}">`}return typeof s=="object"?s===null?null:(o.push(s),h(s)?typeof s.constructor<"u"&&s.constructor.name!=="Array"?s.slice():s.map((u,l)=>t(u,o,i+"/"+l)):(Object.keys(s).concat(Object.getOwnPropertySymbols(s)).forEach(u=>{s[u]=t(s[u],o,i+"/"+u.toString())}),s)):s}let n=e,r=t(n);if(v(e)){let s=e.copy();s._values=r.values,s._columns=r.columns,s._index=r.index,r=s}if(y(e)){let s=e.copy();s.name=r.name,s._values=r.values,s._index=r.index,r=s}return r}function L(e){return e instanceof Date&&e.toString()!=="Invalid Date"}var Ge=["number","int","float","bigint"];function J(e,t){function n(r,s){let o=typeof r,i=typeof s;if(o!==i&&!Ge.includes(o)&&!Ge.includes(i))return!1;if(o==="undefined"&&i==="undefined")return!0;if(o==="boolean"||o==="symbol")return r===s;if(o==="number"||o==="bigint")try{let u=r.toString(),l=s.toString();return u===l}catch{return!1}if(o==="string"||o==="function")return r===s;if(o==="object"){if(r===null||s===null)return r===null&&s===null;{if(L(r))return L(s)?r.getTime()===s.getTime():!1;if(L(s))return!1;if(r instanceof RegExp&&s instanceof RegExp)return r.toString()===s.toString();if(h(r)!==h(s))return!1;let u=Object.keys(r).concat(Object.getOwnPropertySymbols(r)),l=Object.keys(s).concat(Object.getOwnPropertySymbols(s));if(u.length!==l.length)return!1;for(let c=0;c<u.length;c++){let f=u[c];if(!n(r[f],s[f]))return!1}return!0}}}try{return n(e,t)}catch{return n(Z(e),Z(t))}}function oe(e){let t="abcdefg1234567890",n="";for(;n.length<e;)n+=t[Math.floor(Math.random()*t.length)];return n}var Ct=oe(16),kt=oe(16),Rt=oe(16),Yt=oe(16),Kt=oe(16),Jt=class{constructor(){this.clear()}get counts(){return this.values.map(e=>this.get(e))}get values(){return Object.values(this.valuesDict)}clear(){return this.countsDict={},this.valuesDict={},this}count(e){for(let t of e)h(t)?this.count(t):this.increment(t);return this}delete(e){let t=this.getStandardizedKey(e);return delete this.countsDict[t],delete this.valuesDict[t],this}get(e){return this.countsDict[this.getStandardizedKey(e)]||0}getStandardizedKey(e){return typeof e=="object"&&e===null?Ct:p(e)?kt:D(e)?e.toString():typeof e=="symbol"?e.toString()+" - "+Kt:e===1/0?Rt:e===-1/0?Yt:typeof e=="bigint"?e.toString():v(e)?e.toJSONString():y(e)?JSON.stringify(e.toObject()):JSON.stringify(e)}has(e){return!p(this.countsDict[this.getStandardizedKey(e)])}increment(e){return this.set(e,this.get(e)+1)}set(e,t){let n=this.getStandardizedKey(e);return this.countsDict[n]=t,this.valuesDict[n]=e,this}toArray(){return this.values.map(e=>({value:e,count:this.get(e)}))}toObject(){let e={};return this.values.forEach(t=>{e[t]=this.get(t)}),e}};function R(e){if(v(e)||y(e))return R(e.values);a(h(e),"The `flatten` function only works on arrays, Series, and DataFrames!");function t(n){let r=[];return n.forEach(s=>{h(s)?r=r.concat(t(s)):r.push(s)}),r}return t(e)}function P(e,t){t=t||{};let n=new Jt,r={},s=R(e),o=[],i=-1/0,u=1/0,l=!1,c=0;for(let m of s){if(typeof m=="bigint"&&(l=!0),!t.shouldDropNaNs||d(m))try{m>i&&(i=m),m<u&&(u=m),c+=Number(m),o.push(m)}catch{i=NaN,u=NaN,c=NaN}n.increment(m)}let f=c/o.length;if(r.counts=n,r.max=i,r.mean=f,r.min=u,r.n=s.length,r.sum=c,isNaN(r.mean)&&(r.max=NaN,r.min=NaN),t.shouldDropNaNs&&(r.nWithoutNaNs=o.length),t.mode){let m=Array.from(n.values.map(I=>[I,n.get(I)])).toSorted((I,M)=>M[1]-I[1]),g=m[0][1],N=[];for(let I of m)if(I[1]==g)N.push(I[0]);else break;r.mode=N.toSorted()}if(t.median)if(isNaN(f))r.median=NaN;else{let m=o.toSorted((N,I)=>Number(N)-Number(I)),g=Math.floor(m.length/2);if(m.length%2===0){let N=m[g-1],I=m[g];if(r.median=(Number(N)+Number(I))/2,l&&typeof N=="bigint"&&typeof I=="bigint")try{r.median=BigInt(r.median)}catch{}}else r.median=m[g]}if(t.stdev||t.variance){let m=0;for(let N of o)m+=Math.pow(Number(N)-f,2);m/=o.length;let g=Math.sqrt(m);r.stdev=g,r.variance=m}if(l){try{r.sum=BigInt(r.sum)}catch{}try{r.mean=BigInt(r.mean)}catch{}t.mode&&(r.mode=r.mode.map(m=>{try{return BigInt(m)}catch{return m}}))}return r}function ge(e,t){let{counts:n}=P(e);return p(t)||(D(t)?n.values.forEach(r=>{t(r)||n.delete(r)}):n.values.forEach(r=>{J(r,t)||n.delete(r)})),n}function Ie(e){if(v(e)||y(e))return Ie(e.values);if(h(e)){let t=!1,n=!1,r=null;for(let s of e){if(Ie(s))return!0;if(h(s)){if(r===null)r=s.length;else if(s.length!==r)return!0;t=!0}else n=!0;if(t&&n)return!0}}return!1}function ie(e){return Ie(Z(e))}function Ne(e){if(v(e)||y(e))return Ne(e.values);a(h(e),"The `isNested` function only works on arrays, Series, and DataFrames!");for(let t=0;t<e.length;t++)if(h(e[t]))return!0;return!1}var W="You must pass a natural number or a one-dimensional array of natural numbers into the `ndarray` function!";function k(e){a(!p(e),W),h(e)||(e=[e]),a(!Ne(e),W),a(e.length>0,W);let t=e[0];if(typeof t=="bigint"&&(t=Number(t)),a(d(t),W),a(t>=0,W),a(Math.floor(t)===t,W),a(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(k(e.slice(1)));return n}}function Y(e){if(v(e)||y(e)){let n=e.copy();return n.values=Y(n.values),n.index=Y(n.index),n}a(h(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 T(e,t,n=1){a(!p(e)&&!p(t)&&!p(n),"You must pass two numbers and optionally a step value to the `range` function!"),a(d(e)&&d(t)&&d(n),"You must pass two numbers and optionally a step value to the `range` function!"),a(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,s=typeof e=="bigint"||typeof t=="bigint"||typeof n=="bigint";if(e=Number(e),t=Number(t),n=Number(n),e>t){r=!0;let i=e;e=t+n,t=i+n}let o=[];for(let i=e;i<t;i+=n)if(s)try{o.push(BigInt(i))}catch{o.push(i)}else o.push(i);return r&&(o=Y(o)),o}function ue(e){let t="abcdefg1234567890",n="";for(;n.length<e;)n+=t[Math.floor(Math.random()*t.length)];return n}var $t=ue(256),Lt=ue(256),Vt=ue(256),Ut=ue(256),qt=ue(256);function C(e){if(v(e)||y(e))return C(e.values);a(h(e),"The `set` function only works on arrays, Series, and DataFrames!");let t=[],n={};return R(e).forEach(r=>{let s=typeof r=="object"&&r===null?$t:p(r)?Lt:D(r)?r.toString():typeof r=="symbol"?r.toString()+" - "+qt:r===1/0?Vt:r===-1/0?Ut:typeof r=="bigint"?r.toString():v(r)?r.toJSONString():y(r)?JSON.stringify(r.toObject()):JSON.stringify(r);n[s]||t.push(r),n[s]=!0}),t}function st(e){if(h(e)){let t=st(e[0]);return[e.length].concat(t||[])}else return}function b(e){return v(e)||y(e)?b(e.values):(a(h(e),"The `shape` function only works on arrays, Series, and DataFrames!"),st(e))}function ot(e,t,n){if(p(n)&&(n=0),a(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".'),h(t)){a(!ie(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 s=e.copy();s._values.push(t);let o=Math.max(e.shape[1],r[0]);for(s._values.forEach(i=>{for(;i.length<o;)i.push(void 0)});s._index.length<s._values.length;)s._index.push("row"+s._index.length);for(;s._columns.length<o;)s._columns.push("col"+s._columns.length);return s}else{let s=Math.max(e.shape[0],r[0]),o=e.copy();for(T(0,s).forEach(i=>{i>=o._values.length&&o._values.push(k(e.shape[1])),o._values[i].push(t[i])});o._index.length<o._values.length;)o._index.push("row"+o._index.length);for(;o._columns.length<o._values[0].length;)o._columns.push("col"+o._columns.length);return o}else if(r.length===2)if(n===0){let s=Math.max(...t.map(i=>i.length).concat([e.shape[1]])),o=e.copy();for(o._values=o._values.concat(t).map(i=>{for(;i.length<s;)i.push(void 0);return i});o._index.length<o._values.length;)o._index.push("row"+o._index.length);for(;o._columns.length<s;)o._columns.push("col"+o._columns.length);return o}else{let s=Math.max(...t.map(u=>u.length))+e.shape[1],o=Math.max(e.shape[0],r[0]),i=e.copy();for(T(0,o).forEach(u=>{for(u>=i._values.length&&i._values.push(k(e.shape[1])),i._values[u]=i._values[u].concat(t[u]);i._values[u].length<s;)i._values[u].push(void 0)});i._index.length<i._values.length;)i._index.push("row"+i._index.length);for(;i._columns.length<s;)i._columns.push("col"+i._columns.length);return i}else throw new U("Only 1- and 2-dimensional arrays can be appended to a DataFrame!")}else if(y(t)){let r=ot(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(v(t))if(n===0){let r=e.copy(),s=C(r._columns.concat(t._columns)).length;for(r._values.forEach(o=>{for(;o.length<s;)o.push(void 0)}),t.apply(o=>{let i=o.copy(),u=[];r._columns.forEach(l=>{let c=i._index.indexOf(l);c>-1?(u.push(i._values[c]),i._values.splice(c,1),i._index.splice(c,1)):u.push(void 0)}),r._values.push(u.concat(i._values))},1),r._columns=r._columns.concat(t._columns.filter(o=>r._columns.indexOf(o)<0));r._index.length<r._values.length;){let o="row"+r._index.length;r._index.push(o+(e._index.indexOf(o)>-1?" (2)":""))}return r}else{let r=e.copy();return r._index.forEach((s,o)=>{let i=t._index.indexOf(s);i>-1?r._values[o]=r._values[o].concat(t._values[i]):r._values[o]=r._values[o].concat(k(t.shape[1]))}),t._index.forEach((s,o)=>{r._index.indexOf(s)<0&&(r._index.push(s),r._values.push(k(r._columns.length).concat(t._values[o])))}),r._columns=r._columns.concat(t._columns.map(s=>s+(r._columns.indexOf(s)>-1?" (2)":""))),r}else throw new U("Only 1- or 2-dimensional arrays, Series, and DataFrames can be appended to a DataFrame!")}function zt(e,t,n,r,s){if(s=s||0,a(D(r),"The first parameter to the `apply` method must be a function."),a(s===0||s===1,"The second parameter to the `apply` method (the `axis`) must be 0 or 1."),s===0){let o={},i;if(n.columns.forEach((u,l)=>{let c=new t(n.values.map(m=>m[l]));c.name=u,c.index=n.index;let f=r(c,l,n);f instanceof t?o[u]=f.values:o[u]=f,p(i)&&(i=f instanceof t||h(f))}),i){let u=new e(o);return u.index=n.index,u}else{let u=new t(n.columns.map(l=>o[l]));return u.index=n.columns,u}}else if(s===1){let o,i=n.values.map((u,l)=>{let c=new t(u);c.name=n.index[l],c.index=n.columns;let f=r(c,l,n);return p(o)&&(o=f instanceof t||h(f)),f instanceof t?f.values:f});if(o){let u=new e(i);return u.index=n.index,u.columns=n.columns,u}else{let u=new t(i);return u.index=n.index,u}}}function w(e){return typeof e=="string"}function Gt(e,t,n,r,s){let o=u=>u instanceof e,i=u=>u instanceof t;if(p(s)){if(o(r))return n.append(r,1);if(i(r))return n.append(r,1);if(K(r)){let u=Math.max(...Object.keys(r).concat(Object.getOwnPropertySymbols(r)).map(l=>r[l].length));return Object.keys(r).concat(Object.getOwnPropertySymbols(r)).forEach(l=>{for(;r[l].length<u;)r[l].push(void 0)}),n.append(new e(r),1)}else throw new U("You must pass a DataFrame, Series, or object into the `assign` method!")}else{a(w(r),"If passing two arguments into the `assign` method, then the first argument must be a string name!"),a(h(s)&&!ie(s)&&b(s).length===1,"If passing two arguments into the `assign` method, then the second argument must be a 1-dimensional array!");let u=n.append(s,1);return u.columns[u.columns.length-1]=r,u}}function Wt(e,t){if(t.isEmpty)return new e;let n=new e(E(t.values));return n.columns=t.columns.slice(),n.index=t.index.slice(),n}function Ht(e,t,n,r,s){p(r)&&(r=[]),p(s)&&(s=[]),(w(r)||d(r))&&(r=[r]),(w(s)||d(s))&&(s=[s]),a(h(r),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),a(h(s),"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),a(b(r).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings."),a(b(s).length===1,"The `drop` method only works on 1-dimensional arrays of numerical indices and/or strings.");let o,i;n.index.forEach((l,c)=>{r.indexOf(l)<0&&r.indexOf(c)<0&&(o||(o=[]),o.push(l))}),n.columns.forEach((l,c)=>{s.indexOf(l)<0&&s.indexOf(c)<0&&(i||(i=[]),i.push(l))});let u=n.get(o,i);if(u instanceof t){let l=new e;l=l.assign(u),n.index.indexOf(u.name)>-1&&(l=l.transpose()),u=l}return u}function it(e){return d(e)&&(e>=0?Math.floor(e)===e:Math.ceil(e)===e)}function x(e){return it(e)&&e>=0}function Xt(e,t,n,r,s,o){r=r||0,a(r===0||r===1,"The first parameter of the `dropMissing` method (the `axis`) must be 0 or 1."),o=o||0,a(x(o),"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)."),s=o>0?"none":s||"any",a(s==="any"||s==="all"||s==="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 i(c){if(o>0){let f=0;for(let m=0;m<c.length;m++){let g=c[m];if(p(g)&&f++,f>=o)return[]}}else if(s==="any")for(let f=0;f<c.length;f++){let m=c[f];if(p(m))return[]}else if(s==="all"){for(let f=0;f<c.length;f++){let m=c[f];if(!p(m))return c}return[]}return c}let u=n.copy(),l=Math.random().toString();if(r===0){u=u.assign(l,u.index);let c=u.values.map(i).filter(m=>m.length>0);if(b(c).length<2)return new e;u.values=c;let f=u.get(null,l);if(p(f))return new e;w(f)&&(f=[f]),f instanceof t&&(f=f.values),u.index=f,u=u.drop(null,l)}else if(r===1){let c={};if(u.columns.forEach((m,g)=>{let N=u.values.map(M=>M[g]),I=i(N);I.length>0&&(c[m]=I)}),Object.keys(c).length+Object.getOwnPropertySymbols(c).length===0)return new e;let f=new e(c);return f.index=u.index,f}return u}function Re(e){if(v(e)||y(e))return e.dropNaN(...Object.values(arguments).slice(1));a(h(e),"The `dropNaN` function only works on arrays, Series, and DataFrames!");let t=[];return e.forEach(n=>{try{return t.push(Re(n))}catch{if(d(n))return t.push(n)}}),t}function Qt(e,t,n,r,s){n=n||0,a(n===0||n===1,"The first parameter of the `dropNaN` method (the `axis`) must be 0 or 1."),s=s||0,a(x(s),"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=s>0?"none":r||"any",a(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 o(u){let l=Re(u);return s>0?u.length-l.length<s:r==="any"?l.length===u.length:r==="all"?l.length>0:!0}let i=t.copy();if(n===0){let u=i.index.filter(l=>{let c=i.get(l,null).values;return o(c)});return u.length>0?i.get(u,null):new e}else if(n===1){let u=i.columns.filter(l=>{let c=i.get(null,l).values;return o(c)});return u.length>0?i.get(null,u):new e}return i}function We(e){let t={};return R(e).forEach((n,r)=>{t[n]=r}),t}function H(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e)).sort((t,n)=>e[t]-e[n])}function Zt(e,t,n,r,s){a(D(r),"The `filter` method takes a single parameter: a function that is used to filter the values."),p(s)&&(s=0),a(s===0||s===1,"The `axis` parameter to the `filter` method must be 0 or 1.");let o=n.copy();if(o.isEmpty)return o;let i=We(o.index),u=We(o.columns);if(s===0){let l=0,c=o.values.filter((f,m)=>{let g=new t(f);g.name=n.index[m],g.index=n.columns;let N=r(g,m,n);return N?l++:delete i[o.index[m]],N});if(l===0)return new e;if(l===1){let f=new t(c[0]);return f.name=H(i)[0],f.index=H(u),f}o.values=c,o.index=H(i)}else if(s===1){o=o.transpose();let l=0,c=o.values.filter((f,m)=>{let g=new t(f);g.name=n.columns[m],g.index=n.index;let N=r(g,m,n);return N?l++:delete u[o.index[m]],N});if(l===0)return new e;if(l===1){let f=new t(c[0]);return f.name=H(u)[0],f.index=H(i),f}o.values=c,o.index=H(u),o=o.transpose()}return o}function xt(e,t,n){(w(t)||d(t))&&(t=[t]),(w(n)||d(n))&&(n=[n]);for(let s in t)typeof t[s]=="bigint"&&(t[s]=Number(t[s]));for(let s in n)typeof n[s]=="bigint"&&(n[s]=Number(n[s]));let r=C((t||[]).concat(n||[]).map(s=>typeof s));return a(r.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===1&&a(r[0]==="string"||r[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),r.length===2&&(a(r.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),a(r.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),p(t)||(t=t.map(s=>{if(w(s))return a(e.index.indexOf(s)>-1,`Row "${s}" does not exist!`),s;if(d(s))return a(s>=0,`Index ${s} is out of bounds!`),a(Math.floor(s)===s,"Row numbers must be integers!"),a(s<e.index.length,`Index ${s} is out of bounds!`),e.index[s]})),p(n)||(n=n.map(s=>{if(w(s))return a(e.columns.indexOf(s)>-1,`Column "${s}" does not exist!`),s;if(d(s))return a(s>=0,`Column ${s} is out of bounds!`),a(Math.floor(s)===s,"Column numbers must be integers!"),a(s<e.columns.length,`Column ${s} is out of bounds!`),e.columns[s]})),e.getSubsetByNames(t,n)}function en(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 G(e,t){if(p(t)&&(t=en),v(e)||y(e))return e.sort(...Object.values(arguments).slice(1));a(h(e),"The `sort` function only works on arrays, Series, and DataFrames!"),a(D(t),"The second parameter of the `sort` function must be a comparison function!");let n=e.slice();return n.sort(t),n}function tn(e){let t=e.toLowerCase(),n="";for(let s=0;s<t.length;s++){let o=t[s];o.match(/[a-z0-9]/g)?n+=o:n+=" "}let r=n.split(" ").filter(s=>s.length>0);return r[0]+r.slice(1).map(s=>s[0].toUpperCase()+s.substring(1)).join("")}function He(e,t,n){p(n)?n=t.columns:w(n)&&(n=[n]);let r={};n.forEach(o=>{a(w(o),"You must pass either a string or a one-dimensional array of strings into the `getDummies` (AKA `oneHotEncode`) method!");let i=t.columns.indexOf(o);a(i>-1,`The given DataFrame does not have a column called "${o}"!`);let u=t.values.map(c=>c[i]),l=G(C(u));u.forEach(c=>{l.forEach(f=>{let m=o+"_"+tn(f.toString());r[m]||(r[m]=[]),c===f?r[m].push(1):r[m].push(0)})})});let s=new e(r);return s.index=t.index,s}function nn(e,t,n){let r=e.shape;p(t)&&(t=T(0,r[0])),p(n)&&(n=T(0,r[1])),d(t)&&(t=[t]),d(n)&&(n=[n]),a(h(t)&&h(n),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),a(b(t).length===1&&b(n).length===1,"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),a(t.length>0,"The `rowIndices` array must contain at least one index."),a(n.length>0,"The `colIndices` array must contain at least one index."),t.forEach(i=>{a(x(i),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),a(i<e.index.length,`The row index ${i} is out of bounds.`)}),n.forEach(i=>{a(x(i),"The `rowIndices` and `colIndices` parameters must be 1-dimensional arrays of whole numbers."),a(i<e.columns.length,`The column index ${i} is out of bounds.`)});let s=t.map(i=>e.index[i]),o=n.map(i=>e.columns[i]);return e.getSubsetByNames(s,o)}function rn(e,t,n,r,s){p(r)&&(r=n.index),p(s)&&(s=n.columns),w(r)&&(r=[r]),w(s)&&(s=[s]),a(h(r)&&h(s),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),a(b(r).length===1&&b(s).length===1,"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),a(r.length>0,"The `rows` array must contain at least one row name."),a(s.length>0,"The `cols` array must contain at least one column name."),r.forEach(u=>{a(w(u),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),a(n.index.indexOf(u)>-1,`The row name "${u}" does not exist in the list of rows.`)}),s.forEach(u=>{a(w(u),"The `rows` and `cols` parameters must be 1-dimensional arrays of strings."),a(n.columns.indexOf(u)>-1,`The column name "${u}" does not exist in the list of columns.`)});let o=r.map(u=>s.map(l=>n.values[n.index.indexOf(u)][n.columns.indexOf(l)]));if(r.length===1&&s.length===1)return o[0][0];if(r.length===1){let u=new t(o[0]);return u.name=r[0],u.index=s,u}if(s.length===1){let u=new t(o.map(l=>l[0]));return u.name=s[0],u.index=r,u}let i=new e(o);return i.columns=s,i.index=r,i}function sn(e,t,n){function r(g,N){return w(g)&&g.length>N?g.substring(0,N-3)+"...":g}if(n.isEmpty)return console.table({}),console.log("Shape:",[0,0],`
15
+ `),n;let s=typeof window>"u"?20:10,o=Math.floor(s/2),i=typeof process>"u"?10:Math.floor(process.stdout.columns/24)-1,u=Math.floor(i/2),l=s>n.index.length?null:T(0,o).concat(T(n.index.length-o,n.index.length)),c=i>n.columns.length?null:T(0,u).concat(T(n.columns.length-u,n.columns.length)),f=n.get(l,c);f instanceof t&&(n.shape[0]===1?(f=new e([f.values]),f.index=n.index,f.columns=new t(n.columns).get(c).values):n.shape[1]===1&&(f=new e([f.values]).transpose(),f.index=new t(n.index).get(l).values,f.columns=n.columns)),s<=n.index.length&&(f._index.splice(o,0,"..."),f._values.splice(o,0,T(0,f.columns.length).map(()=>"..."))),i<=n.columns.length&&(f._columns.splice(u,0,"..."),f._values=f._values.map(g=>(g.splice(u,0,"..."),g)));let m=28;return f instanceof t?(f.values=f.values.map(g=>r(g,m)),f.name=r(f.name,m),f.index=f.index.map(g=>r(g,m))):(f.values=f.values.map(g=>g.map(N=>r(N,m))),f.columns=f.columns.map(g=>r(g,m)),f.index=f.index.map(g=>r(g,m))),console.table(f.toDetailedObject()),console.log("Shape:",n.shape,`
16
+ `),n}function X(e,t){a(d(e),"The `leftPad` function only works on numbers!");let n=e.toString();for(;n.length<t;)n="0"+n;return n}function on(e,t){let n=t?e:e.copy();return n.index=T(0,e.shape[0]).map(r=>"row"+X(r,(n.index.length-1).toString().length)),n}function ae(e,t){if(v(e)||y(e))return ae(e.values,t);a(h(e),"The `product` function only works on arrays, Series, and DataFrames!");try{if(e.length===0)return NaN;let n=R(e),r=!1,s=1;for(let o of n){if(!d(o))if(t)o=1;else return NaN;typeof o=="bigint"&&(r=!0,o=Number(o)),s*=o}if(r)try{return BigInt(s)}catch{}return s}catch{return NaN}}function un(e){return it(e)&&e>0}function se(e,t){if(v(e)||y(e))return se(e.values,t);if(a(h(e),"The first argument passed into the `reshape` function must be an array!"),d(t)&&(t=[t]),a(h(t),"The second argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),a(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(o=>(typeof o=="bigint"&&(o=Number(o)),a(un(o),"The first argument passed into the `reshape` function must be a whole number or a one-dimensional array of whole numbers!"),Number(o))),t.length===0)return R(e);let n=R(e);if(t.length===1&&t[0]===n.length)return n;a(ae(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=[],s=Math.floor(n.length/t[0]);for(let o=0;o<t[0];o++){let i=n.slice(o*s,(o+1)*s);r.push(se(i,t.slice(1)))}return r}var ut=Math.pow(2,64),_=[];we(Math.floor(Math.random()*ut));function an(e,t){e=j(e);function n(){e+=j("0x9e3779b97f4a7c15");let s=E(e);return s=(s^s>>BigInt(30))*j("0xbf58476d1ce4e5b9"),s=(s^s>>BigInt(27))*j("0x94d049bb133111eb"),s^s>>BigInt(31)}let r=[];for(let s=0;s<t;s++)r.push(n());return r}function j(e){return BigInt.asUintN(64,BigInt(e))}function Xe(e,t){return e=j(e),t=BigInt(t),j(j(e<<t)|j(e>>j(BigInt(64)-t)))}function we(e){if(typeof e=="bigint"&&(e=Number(e)),p(e))return E(_);{a(d(e),"If passing a value into the `seed` function, then that value must be an integer!");let t=an(Math.floor(e),4);_[0]=t[0],_[1]=t[1],_[2]=t[2],_[3]=t[3]}}function Qe(){let e=j(Xe(_[0]+_[3],23)+_[0]),t=j(_[1]<<BigInt(17));return _[2]=j(_[2]^_[0]),_[3]=j(_[3]^_[1]),_[1]=j(_[1]^_[2]),_[0]=j(_[0]^_[3]),_[2]=j(_[2]^t),_[3]=Xe(_[3],45),Math.floor(Number(e))/ut}function q(e){return p(e)?Qe():(h(e)||(e=[e]),se(k(ae(e)).map(Qe),e))}function pe(e){if(v(e)||y(e))return e.shuffle(...Object.values(arguments).slice(1));a(h(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 s=Math.floor(q()*n.length);t.push(n.splice(s,1)[0])}return t}function ln(e,t){return p(t)&&(t=0),a(t===0||t===1,"The `axis` parameter to the `shuffle` must be 0, 1, or undefined."),e.get(t===0?pe(e.index):null,t===1?pe(e.columns):null)}function z(e){return typeof e=="boolean"}function cn(e,t,n){return D(t)?fn(e,t,n):hn(e,t,n)}function fn(e,t,n){if(n=p(n)?0:n,a(D(t),"When sorting a DataFrame using a function, the first argument to the `sort` method must be a function!"),a(d(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=G(e.index,(s,o)=>t(e.get(s,null),e.get(o,null)));return e.get(r,null)}else{let r=G(e.columns,(s,o)=>t(e.get(null,s),e.get(null,o)));return e.get(null,r)}}function hn(e,t,n){let r=e.copy(),s=q().toString();r=r.assign(s,r.index),p(t)&&(t=[s],n=[!0]),(d(t)||w(t))&&(t=[t],(z(n)||w(n))&&(n=[n])),a(h(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."),a(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."),p(n)&&(n=T(0,t.length).map(()=>!0)),a(h(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."),a(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."),a(t.length===n.length,"The arrays passed into the `sort` method must be equal in length."),t=t.map(i=>{if(a(w(i)||d(i),"Column references can either be column names (as strings) or column indices (as whole numbers)."),w(i)){let u=r.columns.indexOf(i);return a(u>-1,`The column "${i}" does not exist!`),u}if(d(i))return a(x(i),"Column indices must be whole numbers!"),a(i<r.columns.length,`The index ${i} is out of bounds!`),i}),n=n.map(i=>{if(a(w(i)||z(i),"Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),w(i)){let u=i.trim().toLowerCase();return a(u==="ascending"||u==="descending","Direction references can either be strings ('ascending' or 'descending') or booleans (true or false)."),u==="ascending"}if(z(i))return i}),r.values=G(r.values,(i,u)=>{let l=0;for(;i[t[l]]===u[t[l]]&&l<t.length;)l++;let c=n[l];if(i[t[l]]===u[t[l]])return 0;if(i[t[l]]<u[t[l]])return c?-1:1;if(i[t[l]]>u[t[l]])return c?1:-1});let o=r.columns.indexOf(s);return r.index=r.values.map(i=>i[o]),r=r.dropColumns(s),r}function mn(e,t){p(t)?t=0:a(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,s)=>{let o={};e.columns.forEach((i,u)=>{o[i]=e.values[s][u]}),n[r]=o}):e.columns.forEach((r,s)=>{let o={};e.index.forEach((i,u)=>{o[i]=e.values[u][s]}),n[r]=o}),n}function at(e,t){return JSON.stringify(e.toObject(t))}async function dn(e,t,n){let r=at(e,n),s=!1,o=!1,i,u;try{let l=t;if(t.includes("/")){let f=t.split("/");l=f[f.length-1]}let c=document.createElement("a");c.href=`data:application/json;charset=utf-8,${encodeURIComponent(r)}`,c.download=l,c.dispatchEvent(new MouseEvent("click")),s=!0}catch(l){i=l}try{let l=await import("node:fs"),c=await import("node:path");l.writeFileSync(c.resolve(t),r,"utf8"),o=!0}catch(l){u=l}if(!s&&!o)throw typeof window<"u"?new U(i):typeof module<"u"?new U(u):new U("I don't know what's going wrong, but it doesn't seem like you're in Node or the browser, and we couldn't download and/or write the file to disk!");return e}function gn(e){let t={};return e.columns.forEach(n=>{t[n]=e.get(n).values}),t}function V(e){if(v(e)||y(e))return e.transpose();a(h(e),"The `transpose` function only works on arrays, Series, and DataFrames!");let t=b(e);if(a(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 Y(e);if(t.length===2){let n=k(Y(t));for(let r=0;r<t[0];r++)for(let s=0;s<t[1];s++)n[s][r]=e[r][s];return n}}function lt(e,t,n){if(y(n))return new e(t.values.concat(n.values));if(h(n)){let r=b(n);a(r.length===1&&!Ne(r),"Only vectors can be appended to Series!");let s=t.copy();return n.forEach((o,i)=>{s._values.push(o),s._index.push("item"+(t.values.length+i))}),s}return lt(t,[n])}function pn(e,t){a(D(t),"The parameter to the `apply` method must be a function.");let n=e.copy();return n._values=n._values.map((r,s)=>t(r,s)),n}function yn(e){let t=e.copy(),n=[];return t._values=t.values.filter((r,s)=>p(r)?!1:(n.push(t.index[s]),!0)),t._index=n,t}function bn(e,t){let n=[],r=[];t.values.forEach((o,i)=>{d(o)&&(r.push(o),n.push(t.index[i]))});let s=new e(r);return s.name=t.name,s.index=n,s}function vn(e,t,n){let r=t.copy(),s=E(r.index),o=[],i=r.values.filter((u,l)=>{let c=n(u,l,r.values);return c||o.push(r.index[l]),c});return o.forEach(u=>{s.splice(s.indexOf(u),1)}),i.length===0?(r=new e,r.name=t.name,r):(r.values=i,r.index=s,r)}function Nn(e,t){(w(t)||d(t))&&(t=[t]);for(let r in t)typeof t[r]=="bigint"&&(t[r]=Number(t[r]));let n=C((t||[]).map(r=>typeof r));return a(n.length<=2,"Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===1&&a(n[0]==="string"||n[0]==="number","Only whole numbers and/or strings are allowed in `get` arrays!"),n.length===2&&(a(n.indexOf("string")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!"),a(n.indexOf("number")>-1,"Only whole numbers and/or strings are allowed in `get` arrays!")),p(t)||(t=t.map(r=>{if(typeof r=="string")return a(e.index.indexOf(r)>-1,`Index "${r}" does not exist!`),r;if(typeof r=="number")return a(r>=0,`Index ${r} is out of bounds!`),a(Math.floor(r)===r,"Indices must be integers!"),a(r<e.index.length,`Index ${r} is out of bounds!`),e.index[r]})),e.getSubsetByNames(t)}function wn(e,t){let n=e.shape;p(t)&&(t=T(0,n[0])),a(h(t),"The `indices` array must be 1-dimensional array of whole numbers."),a(b(t).length===1,"The `indices` array must be a 1-dimensional array of whole numbers."),a(t.length>0,"The `indices` array must contain at least one index."),t.forEach(s=>{a(x(s),"The `indices` array must be a 1-dimensional array of whole numbers."),a(s<e.index.length,`The row index ${s} is out of bounds.`)});let r=t.map(s=>e.index[s]);return e.getSubsetByNames(r)}function On(e,t,n){p(n)&&(n=t.index),a(h(n),"The `indices` array must be a 1-dimensional array of strings."),a(b(n).length===1,"The `indices` array must be a 1-dimensional array of strings."),a(n.length>0,"The `indices` array must contain at least one index name."),n.forEach(o=>{a(w(o),"The `indices` array must contain only strings."),a(t.index.indexOf(o)>-1,`The name "${o}" does not exist in the index.`)});let r=n.map(o=>t.values[t.index.indexOf(o)]);if(r.length===1)return r[0];let s=new e(r);return s.index=n,s.name=t.name,s}function _n(e){let t=e.copy(),n=typeof window>"u"?20:10;if(t.index.length>n){t=t.get(T(0,n/2).concat(T(t.index.length-n/2,t.index.length)));let s=E(t.index);s.splice(Math.floor(s.length/2),0,"..."),t.values.push("..."),t.index.push("..."),t=t.get(s)}let r={};return t.values.forEach((s,o)=>{let i={};i[t.name]=s,r[t.index[o]]=i}),console.table(r),console.log("Shape:",e.shape,`
17
+ `),e}function Sn(e){let t=e.copy();return t.get(pe(t.index))}function Tn(e,t,n){n=n||((l,c)=>l<c?-1:1),a(p(n)||D(n),"You must pass undefined, null, or a comparison function as the second argument to the `sort` method!");let r=V([t.values,t.index]),s=G(r,(l,c)=>n(l[0],c[0])),o=[],i=[];s.forEach(l=>{o.push(l[0]),i.push(l[1])});let u=new e;return u._values=o,u._index=i,u.name=t.name,u}function In(e,t){let n=V([t.values,t.index]);n=V(G(n,(s,o)=>{if(s[1]===o[1])return 0;if(s[1]<o[1])return-1;if(s[1]>o[1])return 1}));let r=new e(n[0]);return r.index=n[1],r.name=t.name,r}function Dn(e){let t={};return t[e.name]={},e.index.forEach((n,r)=>{t[e.name][n]=e.values[r]}),t}var Ze=Symbol.for("@jrc03c/js-math-tools/series");function Mn(e){class t{static[Symbol.hasInstance](r){try{return!!r._symbol&&r._symbol===Ze}catch{return!1}}constructor(r){if(this.name="data",Object.defineProperty(this,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:Ze}),Object.defineProperty(this,"_values",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"values",{configurable:!0,enumerable:!0,get(){return this._values},set(s){a(h(s),"The new values must be a 1-dimensional array!");let o=b(s);a(o.length===1,"The new array of values must be 1-dimensional!"),o[0]<this._index.length?this._index=this._index.slice(0,o[0]):o[0]>this._index.length&&(this._index=this._index.concat(T(this._index.length,o[0]).map(i=>"item"+X(i,(s.length-1).toString().length)))),this._values=s}}),Object.defineProperty(this,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"index",{configurable:!0,enumerable:!0,get(){return this._index},set(s){a(h(s),"The new index must be a 1-dimensional array of strings!"),a(s.length===this.shape[0],"The new index must be the same length as the old index!"),a(b(s).length===1,"The new index must be a 1-dimensional array of strings!"),s.forEach(o=>{a(w(o),"All of the row names must be strings!")}),this._index=s}}),r){if(r instanceof t)this.name=r.name,this.values=E(r.values),this.index=E(r.index);else if(h(r)){let s=b(r);a(s.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 s=Object.keys(r).concat(Object.getOwnPropertySymbols(r)).map(u=>u.toString());a(s.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 o=s[0],i=r[o];a(b(i).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=o,this.values=i.slice()}}}get shape(){return b(this.values)}get length(){return this.shape[0]}get isEmpty(){return this.values.filter(r=>!p(r)).length===0}clear(){let r=this.copy();return r.values.forEach((s,o)=>{r.values[o]=void 0}),r}get(r){return Nn(this,r)}getSubsetByNames(r){return On(t,this,r)}getSubsetByIndices(r){return wn(this,r)}loc(r){return this.getSubsetByNames(r)}iloc(r){return this.getSubsetByIndices(r)}reverse(){let r=new t(Y(this.values));return r.index=Y(this.index),r.name=this.name,r}resetIndex(){let r=this.copy();return r.index=T(0,this.shape[0]).map(s=>"item"+X(s,(r.index.length-1).toString().length)),r}copy(){let r=new t;return r._values=E(this.values),r._index=E(this.index),r.name=this.name,r}append(r){return lt(t,this,r)}apply(r){return pn(this,r)}concat(r){return this.append(r)}dropMissing(r,s){return yn(this,r,s)}dropNaN(){return bn(t,this)}toObject(){return Dn(this)}print(){return _n(this)}shuffle(){return Sn(this)}sort(r){return Tn(t,this,r)}sortByIndex(){return In(t,this)}filter(r){return vn(t,this,r)}toDataFrame(){let r=new e(V([this.values]));return r.columns=[this.name],r.index=this.index,r}transpose(){let r=this.copy();return r.values=Y(r.values),r.index=Y(r.index),r}getDummies(){return this.toDataFrame().getDummies()}oneHotEncode(){return this.getDummies()}}return t}var xe=Symbol.for("@jrc03c/js-math-tools/dataframe");function le(e){let t="abcdefghijklmnopqrstuvwxyz1234567890",n="";for(let r=0;r<e;r++)n+=t[Math.floor(q()*t.length)];return n}var S=class{static[Symbol.hasInstance](e){try{return!!e._symbol&&e._symbol===xe}catch{return!1}}constructor(e){if(Object.defineProperty(this,"_symbol",{configurable:!1,enumerable:!1,writable:!1,value:xe}),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||!p(this._values[0])&&this._values[0].length===0?[[]]:this._values},set(t){a(h(t),"The new values must be a 2-dimensional array!");let n=b(t);a(n.length===2,"The new array of values must be 2-dimensional!"),n[0]<this._index.length?this._index=this._index.slice(0,n[0]):n[0]>this._index.length&&(this._index=this._index.concat(T(this._index.length,n[0]).map(r=>"row"+X(r,(n[0]-1).toString().length)))),n[1]<this._columns.length?this._columns=this._columns.slice(0,n[1]):n[1]>this._columns.length&&(this._columns=this._columns.concat(T(this._columns.length,n[1]).map(r=>"col"+X(r,(n[1]-1).toString().length)))),this._values=t}}),Object.defineProperty(this,"_columns",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"columns",{configurable:!0,enumerable:!0,get(){return this._columns},set(t){a(h(t),"The new columns list must be a 1-dimensional array of strings!"),a(this.isEmpty||t.length===this.shape[1],"The new columns list must be the same length as the old columns list!"),a(b(t).length===1,"The new columns list must be a 1-dimensional array of strings!"),t=t.map(r=>(typeof r!="string"&&(r=JSON.stringify(r)||r.toString()),r.trim().length===0?"untitled_"+le(8):r.trim()));let n=(()=>{let r=ge(t),s={};return r.values.forEach(o=>{s[o]=r.get(o)}),s})();t=t.map(r=>n[r]>1?r+"_"+le(8):r),this._columns=t}}),Object.defineProperty(this,"_index",{value:[],configurable:!0,enumerable:!1,writable:!0}),Object.defineProperty(this,"index",{configurable:!0,enumerable:!0,get(){return this._index},set(t){a(h(t),"The new index must be a 1-dimensional array of strings!"),a(this.isEmpty||t.length===this.shape[0],"The new index must be the same length as the old index!"),a(b(t).length===1,"The new index must be a 1-dimensional array of strings!"),t=t.map(r=>(typeof r!="string"&&(r=JSON.stringify(r)||r.toString()),r.trim().length===0?"untitled_"+le(8):r.trim()));let n=(()=>{let r=ge(t),s={};return r.values.forEach(o=>{s[o]=r.get(o)}),s})();t=t.map(r=>n[r]>1?r+"_"+le(8):r),this._index=t}}),a(p(e)||K(e)||h(e),"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."),e)if(e instanceof S)this.values=E(e.values),this.columns=E(e.columns),this.index=E(e.index);else if(h(e)){let t=b(e);a(t.length===2,"The `data` array passed into the constructor of a DataFrame must be 2-dimensional!"),a(!ie(e),"The 2-dimensional array passed into the constructor of a DataFrame must not contain sub-arrays (i.e., rows) of different lengths!"),this.values=e}else{this._columns=Object.keys(e).concat(Object.getOwnPropertySymbols(e)).map(o=>o.toString());let t=[],n=null,r=null;this._columns.forEach(o=>{p(r)&&(n=o,r=e[o].length),a(e[o].length===r,`The object passed into the DataFrame constructor contains arrays of different lengths! The key "${n}" points to an array containing ${r} items, and the key "${o}" points to an array containing ${e[o].length} items.`),r=e[o].length;let i=e[o];t.push(i)}),this._values=V(t);let s=b(this.values);this._index=T(0,s[0]).map(o=>"row"+X(o,(s[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(e){this.index=e}get isEmpty(){return this.values.length===0||this.values.every(e=>e.length===0)}clear(){let e=new S(k(this.shape));return e.columns=this.columns.slice(),e.index=this.index.slice(),e}get(e,t){if(arguments.length===0)return this;if(arguments.length===1)try{return this.get(null,e)}catch{return this.get(e,null)}return xt(this,e,t)}getSubsetByNames(e,t){return rn(S,B,this,e,t)}getSubsetByIndices(e,t){return nn(this,e,t)}getDummies(e){return He(S,this,e)}oneHotEncode(e){return He(S,this,e)}transpose(){let e=new S(V(this.values));return e.columns=this.index.slice(),e.index=this.columns.slice(),e}get T(){return this.transpose()}resetIndex(e){return on(this,e)}copy(){return Wt(S,this)}assign(e,t){return Gt(S,B,this,e,t)}apply(e,t){return zt(S,B,this,e,t)}dropMissing(e,t,n){return Xt(S,B,this,e,t,n)}dropNaN(e,t,n){return Qt(S,this,e,t,n)}drop(e,t){return Ht(S,B,this,e,t)}dropColumns(e){return this.drop(null,e)}dropRows(e){return this.drop(e,null)}toDetailedObject(e){return mn(this,e)}toObject(){return gn(this)}toJSONString(e){return at(this,e)}saveAsJSON(e,t){return dn(this,e,t)}print(){return sn(S,B,this)}sort(e,t){return cn(this,e,t)}sortByIndex(){return this.sort()}filter(e,t){return Zt(S,B,this,e,t)}shuffle(e){return ln(this,e)}append(e,t){return ot(this,e,t)}concat(e,t){return this.append(e,t)}join(e,t){return this.append(e,t)}toString(){return JSON.stringify(this)}},B=Mn(S);function Oe(e,t){return P(e,{shouldDropNaNs:t}).max}function O(e){return a(D(e),"You must pass a function into the `vectorize` function!"),function t(){let n,r,s=[],o=[],i=Object.keys(arguments).filter(u=>{let l=arguments[u];return h(l)?!0:y(l)?(n=!0,s.push(l),!0):v(l)?(r=!0,o.push(l),!0):!1}).map(u=>arguments[u]);if(i.slice(0,-1).forEach((u,l)=>{a(J(h(u)?b(u):u.shape,h(i[l+1])?b(i[l+1]):i[l+1].shape),`When passing multiple arrays into the \`${e.name}\` function, all of the arrays must have the same shape!`)}),i.length>0){let u=Oe(i.map(c=>c.length?c.length:c.values.length)),l=T(0,u).map(c=>{let f=Object.keys(arguments).map(m=>h(arguments[m])?arguments[m][c]:y(arguments[m])||v(arguments[m])?arguments[m].values[c]:arguments[m]);return t(...f)});if(r)try{if(o.length===1&&J(b(o[0]),b(l))){let c=new S(l);return c.index=o[0].index.slice(),c.columns=o[0].columns.slice(),c}else return new S(l)}catch{return l}if(n)try{if(s.length===1&&s[0].length===l.length){let c=new B(l);return c.name=s[0].name,c.index=s[0].index.slice(),c}else return new B(l)}catch{return l}return l}else return e(...arguments)}}function En(e){try{return d(e)?typeof e=="bigint"?e<0?-e:e:Math.abs(e):NaN}catch{return NaN}}var Ye=O(En);function jn(){try{let e=0,t=!1,n=Object.values(arguments);for(let r of n){if(!d(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 ye=O(jn);function Bn(e,t){try{return t(e)}catch{return NaN}}var _e=O(Bn);function Fn(e){try{return d(e)?(typeof e=="bigint"&&(e=Number(e)),Math.acos(e)):NaN}catch{return NaN}}var An=O(Fn);function Pn(e){try{return d(e)?(typeof e=="bigint"&&(e=Number(e)),Math.asin(e)):NaN}catch{return NaN}}var Cn=O(Pn);function kn(e){try{return d(e)?(typeof e=="bigint"&&(e=Number(e)),Math.atan(e)):NaN}catch{return NaN}}var Rn=O(kn);function De(e,t){if(v(e)){let n=De(e.values,t);return[e.index[n[0]],e.columns[n[1]]]}if(y(e)){let n=De(e.values,t);return e.index[n]}a(h(e),"The `argmax` function only works on arrays, Series, and DataFrames!");try{let n=Q(e,Oe(e,t));return n?n.length===0?void 0:n.length===1?n[0]:n:void 0}catch{return}}function ct(e,t){return P(e,{shouldDropNaNs:t}).min}function Me(e,t){if(v(e)){let n=Me(e.values,t);return[e.index[n[0]],e.columns[n[1]]]}if(y(e)){let n=Me(e.values,t);return e.index[n]}a(h(e),"The `argmin` function only works on arrays, Series, and DataFrames!");try{let n=Q(e,ct(e,t));return n?n.length===0?void 0:n.length===1?n[0]:n:void 0}catch{return}}function A(e,t){if(v(e)||y(e))return e.apply(n=>A(n,t));if(h(e))return e.map(n=>A(n,t));if(t==="null")return null;if(t==="number"){if(p(e))return NaN;let n=A(e,"boolean");if(z(n))return n?1:0;try{JSON.parse(e)}catch{let o=A(e,"date");if(L(o))return o.getTime()}let r=parseFloat(e);return isNaN(r)?NaN:r}if(t==="int"){let n=A(e,"number");return n>=0?Math.floor(n):Math.ceil(n)}if(t==="float")return A(e,"number");if(t==="bigint")return typeof e=="bigint"?e:BigInt(A(e,"int"));if(t==="boolean"){if(z(e))return e;if(d(e))return e===0?!1:e===1?!0:null;try{let n=(typeof e=="object"?e.toString()==="null"?"false":JSON.stringify(e):e.toString()).trim().toLowerCase();return n==="true"||n==="yes"||n==="y"?!0:n==="false"||n==="no"||n==="n"?!1:null}catch{return null}}if(t==="date"){if(L(e))return e;if(p(e))return null;let n=parseFloat(e);if(!isNaN(n)){let s=new Date(e);return L(s)?s:null}let r=Date.parse(e);return isNaN(r)?null:new Date(r)}if(t==="object"){if(K(e))return e;let n=A(e,"boolean");if(z(n))return null;try{let s=A(e,"number");if(d(s))return JSON.parse(e),null}catch{}let r=A(e,"date");if(r)return r;try{let s=JSON.parse(e);return h(s)?s.map(o=>A(o,t)):s}catch{return null}}if(t==="string")return p(e)?J(e,void 0)?"undefined":"null":e instanceof Date?e.toJSON():(()=>typeof e=="object"?e===null?"null":JSON.stringify(e):e.toString())()}function Yn(e){try{return d(e)?typeof e=="bigint"?e:Math.ceil(e):NaN}catch{return NaN}}var Kn=O(Yn);function Jn(e,t){try{if(!d(e))return NaN;if(typeof e=="bigint")return e;if(p(t))t=1e-10;else if(!d(t))return NaN;return Ye(e)<t?0:e}catch{return NaN}}var $n=O(Jn);function Ee(e){if(v(e)||y(e)){let t=e.copy();return t.values=Ee(t.values),t}if(h(e))return e.map(t=>Ee(t));try{let t=JSON.parse(e);return d(t)?typeof t=="bigint"?Number(t):t>=0?Math.floor(t):Math.ceil(t):NaN}catch{return NaN}}var F=O(Ee);function ft(e,t,n){try{return d(e)?d(t)?d(n)?typeof e=="bigint"?BigInt(ft(F(e),t,n)):e<t?t:e>n?n:e:NaN:NaN:NaN}catch{return NaN}}var Ln=O(ft);function be(e,t){function*n(r,s){if(s>r.length)yield r;else if(s<=0)yield[];else if(r.length<2)yield r;else for(let o=0;o<r.length;o++){let i=r[o],u=r.slice(o+1);if(!(u.length<s-1)&&s-1>=0)for(let l of be(u,s-1))yield[i].concat(l)}}return v(e)||y(e)?be(e.values,t):(a(h(e),"The `combinations` function only works on arrays, Series, and DataFrames!"),a(d(t)&&F(t)===t&&t>=0,"`r` must be a non-negative integer!"),n(R(e),t))}function ht(e,t){let n=[];for(let r of be(e,t))n.push(r.slice());return n}function mt(){let e=Object.values(arguments).map(n=>v(n)||y(n)?C(n.values):(a(h(n),"The `intersect` function only works on arrays, Series, and DataFrames!"),C(n)));return C(e).filter(n=>e.every(r=>r.findIndex(s=>J(s,n))>-1))}var te=class{constructor(e){a(p(e)||e===te.DROP_NAN_MODE||e===te.DROP_MISSING_MODE,"The `mode` value passed into the `IndexMatcher` constructor must be undefined or one of [IndexMatcher.DROP_NAN_MODE, IndexMatcher.DROP_MISSING_MODE]! (By default, the mode is `Indexer.DROP_MISSING_MODE`.)"),this.mode=p(e)?te.DROP_NAN_MODE:e,this.index=null}fit(){let e=[];return Object.values(arguments).forEach(t=>{if(h(t)){let n=b(t);if(n.length===1)t=new B(t);else if(n.length===2)t=new S(t);else throw new Error("The `IndexMatcher.fit` method only works on arrays, Series, and DataFrames!")}a(v(t)||y(t),"The `IndexMatcher.fit` method only works on arrays, Series, and DataFrames!"),this.mode===te.DROP_MISSING_MODE?e.push(t.dropMissing().index):e.push(t.dropNaN().index)}),this.index=mt(...e),this}transform(){a(!!this.index,"The IndexMatcher hasn't been fitted yet! Please call the `fit` method before calling the `transform` method.");let e=Object.values(arguments).map(t=>{if(h(t)){let n=b(t);if(n.length===1)return new B(t).get(this.index).values;if(n.length===2)return new S(t).get(this.index,null).values;throw new Error("The `IndexMatcher.fit` method only works on arrays, Series, and DataFrames!")}return a(v(t)||y(t),"The `IndexMatcher.fit` method only works on arrays, Series, and DataFrames!"),t.get(this.index,null)});return e.length===1?e[0]:e}fitAndTransform(){return this.fit(...arguments).transform(...arguments)}},Se=te;nt(Se,"DROP_NAN_MODE","DROP_NAN_MODE");nt(Se,"DROP_MISSING_MODE","DROP_MISSING_MODE");function re(e,t,n,r){if(y(e))return re(e.values,t,n,r);if(y(t))return re(e,t.values,n,r);if(a(h(e)&&h(t)&&b(e).length===1&&b(t).length===1,"The `covariance` function only works on 1-dimensional arrays and Series!"),a(e.length===t.length,"The two arrays or Series passed into the `covariance` function must have the same length!"),n)return re(...new Se().fitAndTransform(e,t),!1,r);try{let s=P(e,{stdev:r}),o=P(t,{stdev:r}),i=Number(s.mean),u=Number(o.mean);if(!d(i)||!d(u))return NaN;let l=Math.max(e.length,t.length),c=0;for(let f=0;f<l;f++){let m=e[f],g=t[f];if(!d(m))return NaN;if(!d(g))return NaN;typeof m=="bigint"&&(m=Number(m)),typeof g=="bigint"&&(g=Number(g)),c+=(m-i)*(g-u)}return r?[c/e.length,s,o]:c/e.length}catch{return NaN}}function je(e,t,n){if(y(e))return je(e.values,t,n);if(y(t))return je(e,t.values,n);a(h(e)&&h(t)&&b(e).length===1&&b(t).length===1,"The `correl` function only works on 1-dimensional arrays and Series!"),a(e.length===t.length,"The two arrays or Series passed into the `correl` function must have the same length!");try{let[s,o,i]=re(e,t,n,!0),u=o.stdev*i.stdev;return s/u}catch{return NaN}}function Vn(e){try{return d(e)?(typeof e=="bigint"&&(e=Number(e)),Math.cos(e)):NaN}catch{return NaN}}var Un=O(Vn),qn=Object.freeze({boolean:"boolean",date:"date",null:"null",number:"number",object:"object",string:"string"});function Be(e,t){if(v(e)||y(e))return Be(e.values,t);if(v(t)||y(t))return Be(e,t.values);a(h(e)&&h(t),"The `diff` function only works on arrays, Series, and DataFrames!");let n=C(e),r=C(t),s=[];return n.forEach(o=>{r.findIndex(i=>J(i,o))<0&&s.push(o)}),s}function dt(e,t){try{if(!d(e))return NaN;if(!d(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=dt(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return Math.pow(e,t)}catch{return NaN}}var Ke=O(dt);function gt(e){try{if(!d(e))return NaN;if(typeof e=="bigint"){let t=gt(Number(e));try{return BigInt(t)}catch{return t}}return Math.sqrt(e)}catch{return NaN}}var pt=O(gt);function zn(){try{let e=Object.values(arguments);if(e.length===0)return NaN;let t=!1,n=1;for(let r of e){if(!d(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 yt=O(zn);function ee(){return yt(...arguments)}function bt(e,t){return ye(e,ee(t,-1))}function Je(e,t){return P(e,{shouldDropNaNs:t}).sum}function Fe(e,t){if(d(e)&&d(t))return Ye(e-t);if(v(e)||y(e))return Fe(e.values,t);if(v(t)||y(t))return Fe(e,t.values);h(e)&&h(t)&&a(J(b(e),b(t)),"If passing two arrays, Series, or DataFrames into the `distance` function, then those objects must have the same shape!");try{return pt(Je(Ke(bt(e,t),2)))}catch{return NaN}}function Gn(e,t){return ee(e,Ke(t,-1))}function $(e,t){if(v(e)){let s=$(e.values,t);if(b(s).length===1){let o=new B(s);return o.name=y(t)?t.name:o.name,o.index=e.index.slice(),o}else{let o=new S(s);return o.index=e.index.slice(),v(t)&&(o.columns=t.columns.slice()),o}}if(v(t)){let s=$(e,t.values);if(b(s).length===1){let o=new B(s);return o.name=y(e)?e.name:o.name,o.index=t.columns.slice(),o}else{let o=new S(s);return o.columns=t.columns.slice(),o}}if(y(e))return $(e.values,t);if(y(t))return $(e,t.values);a(h(e)&&h(t),"The `dot` function only works on arrays, Series, and DataFrames!");let n=b(e),r=b(t);if(a(n.length<=2&&r.length<=2,"I'm not smart enough to know how to get the dot-product of arrays that have more than 2 dimensions. Sorry for the inconvenience! Please only pass 1- or 2-dimensional arrays into the `dot` function!"),a(n[n.length-1]===r[0],`There's a dimension misalignment in the two arrays you passed into the \`dot\` function. (${n[n.length-1]} !== ${r[0]})`),n.length===1&&r.length===1)return Je(ee(e,t));if(n.length===1&&r.length===2)return V(t).map(s=>$(e,s));if(n.length===2&&r.length===1)return e.map(s=>$(s,t));if(n.length===2&&r.length===2){let s=V(t),o=[];for(let i=0;i<e.length;i++){let u=[];for(let l=0;l<s.length;l++)u.push($(e[i],s[l]));o.push(u)}return o}}function $e(e){if(v(e)||y(e))return e.dropMissing(...Object.values(arguments).slice(1));a(h(e),"The `dropMissing` function only works on arrays, Series, and DataFrames!");let t=[];return e.forEach(n=>{try{return t.push($e(n))}catch{p(n)||t.push(n)}}),t}function fe(e,t){if(v(e)||y(e))return fe(e.values,t);if(v(t)||y(t))return fe(e,t.values);a(h(e)&&h(t),"The `dropMissingPairwise` function only works on arrays, Series, and DataFrames!"),a(J(b(e),b(t)),"The two arrays, Series, and/or DataFrames passed into the `dropMissingPairwise` function must have the same shape!");let n=[],r=[];for(let s=0;s<e.length;s++)try{let[o,i]=fe(e[s],t[s]);n.push(o),r.push(i)}catch{!p(e[s])&&!p(t[s])&&(n.push(e[s]),r.push(t[s]))}return[n,r]}function he(e,t){if(v(e)||y(e))return he(e.values,t);if(v(t)||y(t))return he(e,t.values);a(h(e)&&h(t),"The `dropNaNPairwise` only works on arrays, Series, and DataFrames!"),a(J(b(e),b(t)),"The two arrays, Series, and/or DataFrames passed into the `dropNaNPairwise` must have the same shape!");let n=[],r=[];for(let s=0;s<e.length;s++)try{let[o,i]=he(e[s],t[s]);n.push(o),r.push(i)}catch{d(e[s])&&d(t[s])&&(n.push(e[s]),r.push(t[s]))}return[n,r]}function Wn(e){return $e(e)}function ve(e,t){if(v(e)||y(e))return ve(e.values,t);a(h(e),"The first argument passed into the `every` function must be an array, Series, or DataFrame!"),a(D(t),"The second argument passed into the `every` function must be a function!");for(let n of e)if(h(n)){if(!ve(n,t))return!1}else if(!t(n))return!1;return!0}function Hn(e){try{if(!d(e))return NaN;if(typeof e=="bigint"){if(e===0n)return 1n;e=Number(e)}return Math.exp(e)}catch{return NaN}}var Xn=O(Hn);function Ae(e){try{return typeof e=="bigint"?BigInt(Ae(F(e))):e!==F(e)?NaN:e<=1?1:e*Ae(e-1)}catch{return NaN}}var Qn=O(Ae);function Pe(e,t){if(v(e)||y(e))return Pe(e.values,t);if(a(K(e)||h(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `find` function!"),!D(t)){let s=t;t=o=>o===s}function n(s,o,i){if(i=i||[],i.indexOf(s)>-1)return null;if(K(s)){i.push(s);let u=Object.keys(s).concat(Object.getOwnPropertySymbols(s));for(let l=0;l<u.length;l++){let c=u[l],f=s[c];if(o(f))return f;let m=n(f,o,i);if(m)return m}}else if(h(s)){i.push(s);for(let u=0;u<s.length;u++){let l=s[u];if(o(l))return l;let c=n(l,o,i);if(c)return c}}else if(o(s))return s;return null}function r(s){try{return t(s)}catch{return!1}}return n(e,r)}function Ce(e,t){if(v(e)||y(e))return Ce(e.values,t);if(a(K(e)||h(e),"You must pass (1) an object, array, Series, or DataFrame and (2) a function or value into the `findAll` function!"),!D(t)){let o=t;t=i=>i===o}function n(o,i,u){if(u=u||[],u.indexOf(o)>-1)return null;if(K(o)){u.push(o);let l=Object.keys(o).concat(Object.getOwnPropertySymbols(o)),c=[];for(let f=0;f<l.length;f++){let m=l[f],g=o[m],N=!1;i(g)&&(c.push(g),N=!0);let I=n(g,i,u);I&&I.length>0&&I.slice(N?1:0).forEach(M=>c.push(M))}return c}else if(h(o)){u.push(o);let l=[];for(let c=0;c<o.length;c++){let f=o[c],m=!1;i(f)&&(l.push(f),m=!0);let g=n(f,i,u);g&&g.length>0&&g.slice(m?1:0).forEach(N=>l.push(N))}return l}else if(i(o))return[o];return null}function r(o){try{return t(o)}catch{return!1}}let s=n(e,r);return s&&s.length>0?s:null}function Zn(e){try{if(e==="Infinity")return 1/0;if(e==="-Infinity")return-1/0;let t=JSON.parse(e);return d(t)?t:NaN}catch{return NaN}}var xn=O(Zn);function er(e){try{return d(e)?typeof e=="bigint"?e:Math.floor(e):NaN}catch{return NaN}}var tr=O(er);function Le(e){d(e)&&(e=[e]);let t=[],n=ae(e);for(let r=0;r<n;r++)t.push(0);return se(t,e)}function nr(e){typeof e=="bigint"&&(e=F(e)),a(!p(e),"You must pass an integer greater than 0 (representing the size) into the `identity` function!"),a(d(e),"You must pass an integer greater than 0 (representing the size) into the `identity` function!"),a(F(e)===e,"You must pass an integer greater than 0 (representing the size) into the `identity` function!"),a(e>0,"You must pass an integer greater than 0 (representing the size) into the `identity` function!");let t=Le([e,e]);for(let n=0;n<e;n++)t[n][n]=1;return t}var rr=["true","false","yes","no"],sr=["null","none","nan","na","n/a","","undefined"];function ce(e){return e.type==="number"&&(typeof e.value<"u"?e.isInteger=F(e.value)===e.value:e.isInteger=ve(e.values,t=>d(t)?F(t)===t:!0)),e}function me(e){if(v(e)){let o=e.copy(),i=me(e.values);return o.values=i.values,ce({type:i.type,values:o})}if(y(e)){let o=e.copy(),i=me(e.values);return o.values=i.values,ce({type:i.type,values:o})}if(!h(e)){let o=me([e]);return o.value=o.values[0],delete o.values,ce(o)}a(h(e),"The `inferType` function only works on arrays, Series, and DataFrames!");let t=R(e).map(o=>{if(o===void 0)return"null";try{if(typeof o=="object"){let l=new Date(o.getTime());if(L(l))return"date"}}catch{}w(o)||(typeof o=="bigint"?o=o.toString()+"n":o=JSON.stringify(o));let u=o.toLowerCase().trim();if(sr.indexOf(u)>-1)return"null";if(rr.indexOf(u)>-1)return"boolean";try{if(o.match(/^-?\d+n$/g))return"bigint";let l=JSON.parse(o);return d(l)?"number":typeof l=="object"?h(l)?"string":"object":"string"}catch{let c=new Date(o);return L(c)?"date":"string"}}),n=ge(t),s=n.values.toSorted((o,i)=>n.get(i)-n.get(o))[0];return ce({type:s,values:_e(e,o=>A(o,s))})}function de(e){if(v(e)){let n=e.copy();return n.values=de(n.values),n}a(h(e),"The `inverse` function only works on square 2-dimensional arrays or DataFrames!");let t=b(e);if(a(t.length===2,"The array passed into the `inverse` function must be exactly two-dimensional and square!"),a(t[0]===t[1],"The array passed into the `inverse` function must be exactly two-dimensional and square!"),a(t[0]>=0,"The array passed into the `inverse` function must be exactly two-dimensional and square!"),t[0]===0)return e;if(t[0]===1){a(e[0][0]!==0,"This matrix cannot be inverted!");let n=e[0][0];return typeof n=="bigint"&&(n=Number(n)),1/n}else if(t[0]===2){let n=e[0][0],r=e[0][1],s=e[1][0],o=e[1][1];typeof n=="bigint"&&(n=Number(n)),typeof r=="bigint"&&(r=Number(r)),typeof s=="bigint"&&(s=Number(s)),typeof o=="bigint"&&(o=Number(o));let i=n*o-r*s;a(i!==0,"This matrix cannot be inverted!");let u=[[o,-r],[-s,n]];return ee(u,1/i)}else if(t[0]>1){let n=(r,s)=>d(r)||d(s)?ee(r,s):$(r,s);for(let r=1;r<t[0]-1;r++)try{let s=e.slice(0,r).map(M=>M.slice(0,r)),o=e.slice(0,r).map(M=>M.slice(r,t[0])),i=e.slice(r,t[0]).map(M=>M.slice(0,r)),u=e.slice(r,t[0]).map(M=>M.slice(r,t[0])),l=de(s),c=de(ye(u,n(-1,n(n(i,l),o)))),f=ye(l,n(n(n(n(l,o),c),i),l)),m=n(-1,n(n(l,o),c)),g=n(-1,n(n(c,i),l)),N=c;return f.map((M,Te)=>M.concat(m[Te])).concat(g.map((M,Te)=>M.concat(N[Te])))}catch{}a(!1,"This matrix cannot be inverted!")}}var or=new Function(`
18
+ try {
19
+ return this === window
20
+ } catch(e) {}
21
+
22
+ try {
23
+ return !!importScripts
24
+ } catch(e){}
25
+
26
+ return false
27
+ `);function vt(e,t,n){try{if(!d(e))return NaN;if(!d(t))return NaN;if(!d(n))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let r=vt(Number(e),Number(t),n);try{return BigInt(r)}catch{return r}}return n*(t-e)+e}catch{return NaN}}var ir=O(vt);function Nt(e,t){try{if(t=p(t)?Math.E:t,!d(e))return NaN;if(!d(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=Nt(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return Math.log(e)/Math.log(t)}catch{return NaN}}var ur=O(Nt);function ar(e,t){return P(e,{shouldDropNaNs:t}).mean}function lr(e,t){return P(e,{shouldDropNaNs:t,median:!0}).median}function wt(e,t){try{if(!d(e))return NaN;if(!d(t))return NaN;if(typeof e=="bigint"||typeof t=="bigint"){let n=wt(Number(e),Number(t));try{return BigInt(n)}catch{return n}}return e%t}catch{return NaN}}var cr=O(wt);function fr(e,t){return P(e,{shouldDropNaNs:t,mode:!0}).mode}function et(){let e=q(),t=q();return Math.sqrt(-2*Math.log(e))*Math.cos(2*Math.PI*t)}function hr(e){return p(e)?et():_e(k(e),et)}function mr(e){return _e(k(e),()=>1)}function Ve(e,t){function*n(r,s){if(s=s||r.length,r.length===1){yield[r];return}for(let o of ht(r,s)){if(!o.slice)continue;let i=Le(o.length);yield o;let u=1;for(;u<o.length;)if(i[u]<u){if(u%2===0){let l=o[0];o[0]=o[u],o[u]=l}else{let l=o[i[u]];o[i[u]]=o[u],o[u]=l}yield o,i[u]+=1,u=1}else i[u]=0,u+=1}}return v(e)||y(e)?Ve(e.values,t):(a(h(e),"The `permutations` function only works on arrays, Series, and DataFrames!"),p(t)&&(t=e.length),a(d(t)&&F(t)===t&&t>=0,"`r` must be a non-negative integer!"),n(R(e),t))}function dr(e,t){let n=[];for(let r of Ve(e,t))n.push(r.slice());return n}function gr(){Object.keys(arguments).forEach(e=>{let t=arguments[e];if(h(t))if(ie(t))console.log(t);else{let n=b(t);n.length===1?new B(t).print():n.length==2?new S(t).print():console.log(t)}else v(t)||y(t)?t.print():console.log(t)})}var pr=O((e,t,n,r,s)=>{try{let o=!1;for(let c of[e,t,n,r,s]){if(!d(c))return NaN;typeof c=="bigint"&&(o=!0)}o&&(e=Number(e),t=Number(t),n=Number(n),r=Number(r),s=Number(s));let i=(s-r)*(e-t),u=n-t;if(u===0)return NaN;let l=i/u+r;if(o)try{return BigInt(l)}catch{}return l}catch{return NaN}});function yr(e,t,n,r,s){if(h(e)&&p(r)&&p(s)){r=t,s=n;let o=P(e);t=o.min,n=o.max}return pr(e,t,n,r,s)}function br(e){try{return d(e)?typeof e=="bigint"?e:Math.round(e):NaN}catch{return NaN}}var vr=O(br);function Ot(e){try{return d(e)?typeof e=="bigint"?BigInt(Ot(Number(e))):e<0?-1:e>0?1:0:NaN}catch{return NaN}}var Nr=O(Ot);function wr(e){try{return d(e)?(typeof e=="bigint"&&(e=Number(e)),Math.sin(e)):NaN}catch{return NaN}}var Or=O(wr);function ke(e,t){if(v(e)||y(e))return ke(e.values,t);a(h(e),"The first argument passed into the `some` function must be an array, Series, or DataFrame!"),a(D(t),"The second argument passed into the `some` function must be a function!");for(let n of e)if(h(n)){if(ke(n,t))return!0}else if(t(n))return!0;return!1}function _t(e,t){return P(e,{shouldDropNaNs:t,stdev:!0}).stdev}function _r(e){return _t(e)}function Sr(e){try{return d(e)?(typeof e=="bigint"&&(e=Number(e)),Math.tan(e)):NaN}catch{return NaN}}var Tr=O(Sr);function tt(e,t){a(D(e),"`fn` must be a function!");let n=new Date;return t?e(...t):e(),new Date-n}async function Ir(e,t){a(D(e),"`fn` must be a function!");let n=new Date;return t?await e(...t):await e(),new Date-n}function Dr(){return C([...arguments].map(e=>h(e)?e:v(e)||y(e)?e.values:[e]))}function Mr(e,t){return P(e,{shouldDropNaNs:t,variance:!0}).variance}function Er(){let e=[],t=Object.values(arguments).map(n=>((v(n)||y(n))&&(n=n.values),a(h(n),"The `zip` function only works on arrays, Series, and DataFrames!"),n));return T(0,Oe(t.map(n=>n.length))).forEach(n=>{let r=[];t.forEach(s=>{let o=s[n];r.push(p(o)?void 0:o)}),e.push(r)}),e}var ne={abs:Ye,add:ye,apply:_e,arccos:An,arcsin:Cn,arctan:Rn,argmax:De,argmin:Me,assert:a,cast:A,ceil:Kn,chop:$n,clamp:Ln,combinations:ht,combinationsIterator:be,copy:E,correl:je,cos:Un,count:ge,covariance:re,DataFrame:S,dataTypes:qn,decycle:Z,diff:Be,distance:Fe,divide:Gn,dot:$,dropMissing:$e,dropMissingPairwise:fe,dropNaN:Re,dropNaNPairwise:he,dropUndefined:Wn,every:ve,exp:Xn,factorial:Qn,find:Pe,findAll:Ce,flatten:R,float:xn,floor:tr,identity:nr,IndexMatcher:Se,indexOf:Q,inferType:me,int:F,intersect:mt,inverse:de,isArray:h,isBoolean:z,isBrowser:or,isDataFrame:v,isDate:L,isEqual:J,isFunction:D,isJagged:ie,isNested:Ne,isNumber:d,isObject:K,isSeries:y,isString:w,isUndefined:p,lerp:ir,log:ur,MathError:U,max:Oe,mean:ar,median:lr,min:ct,mod:cr,mode:fr,multiply:yt,ndarray:k,normal:hr,ones:mr,permutations:dr,permutationsIterator:Ve,pow:Ke,print:gr,product:ae,random:q,range:T,remap:yr,reshape:se,reverse:Y,round:vr,scale:ee,seed:we,Series:B,set:C,shape:b,shuffle:pe,sign:Nr,sin:Or,some:ke,sort:G,sqrt:pt,stats:P,std:_t,stdev:_r,subtract:bt,sum:Je,tan:Tr,timeAsync:Ir,timeSync:tt,time:tt,transpose:V,union:Dr,variance:Mr,vectorize:O,zeros:Le,zip:Er,dump(){let e=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:void 0;if(!e)throw new ne.MathError("Cannot dump functions into global scope because none of `globalThis`, `global`, `window`, or `self` exist in the current context!");Object.keys(ne).forEach(t=>{try{Object.defineProperty(e,t,{configurable:!1,enumerable:!0,writable:!1,value:ne[t]})}catch{e[t]=ne[t]}})}};typeof window<"u"&&(window.JSMathTools=ne);function St(e,t,n){arguments.length===2&&(d(arguments[1])?n=null:(n=t,t=null)),a(d(e)&&F(e)===e,"`keyLength` must be an integer!"),t&&(a(d(t)&&F(t)===t,"`keySeed` must be an integer!"),we(t)),n&&a(w(n),"`charset` must be a string!");let r="";n=n||"abcdefg1234567890";for(let s=0;s<e;s++)r+=n[F(q()*n.length)];return r}typeof globalThis<"u"&&(globalThis.makeKey=St);})();
package/eslint.config.js CHANGED
@@ -7,10 +7,6 @@ export default [
7
7
  globals: {
8
8
  ...globals.browser,
9
9
  ...globals.node,
10
- afterAll: "readonly",
11
- beforeAll: "readonly",
12
- expect: "readonly",
13
- test: "readonly",
14
10
  },
15
11
  },
16
12
 
package/package.json CHANGED
@@ -8,19 +8,15 @@
8
8
  },
9
9
  "description": "",
10
10
  "devDependencies": {
11
- "@jrc03c/fake-jest": "^0.0.12",
11
+ "@jrc03c/fake-jest": "^0.0.16",
12
12
  "esbuild": "^0.17.11",
13
13
  "eslint": "^8.36.0"
14
14
  },
15
- "exports": {
16
- "import": "./dist/make-key.import.mjs",
17
- "require": "./dist/make-key.require.cjs"
18
- },
19
15
  "keywords": [],
20
16
  "license": "ISC",
21
- "main": "./dist/make-key.require.cjs",
22
- "module": "./dist/make-key.import.mjs",
17
+ "main": "./src/index.mjs",
18
+ "module": "./src/index.mjs",
23
19
  "name": "@jrc03c/make-key",
24
20
  "type": "module",
25
- "version": "0.0.32"
21
+ "version": "0.0.34"
26
22
  }
package/src/iife.mjs ADDED
@@ -0,0 +1,5 @@
1
+ import { makeKey } from "./index.mjs"
2
+
3
+ if (typeof globalThis !== "undefined") {
4
+ globalThis.makeKey = makeKey
5
+ }
package/src/index.mjs CHANGED
@@ -45,8 +45,4 @@ function makeKey(keyLength, keySeed, charset) {
45
45
  return out
46
46
  }
47
47
 
48
- if (typeof window !== "undefined") {
49
- window.makeKey = makeKey
50
- }
51
-
52
48
  export { makeKey }
@@ -1,4 +1,5 @@
1
1
  import { makeKey } from "./index.mjs"
2
+ import { expect, test } from "@jrc03c/fake-jest"
2
3
 
3
4
  test("tests that random strings can be generated correctly", () => {
4
5
  const a = makeKey(123)