@datagrok/bio 2.10.15 → 2.10.17

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/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "name": "Leonid Stolbov",
6
6
  "email": "lstolbov@datagrok.ai"
7
7
  },
8
- "version": "2.10.15",
8
+ "version": "2.10.17",
9
9
  "description": "Bioinformatics support (import/export of sequences, conversion, visualization, analysis). [See more](https://github.com/datagrok-ai/public/blob/master/packages/Bio/README.md) for details.",
10
10
  "repository": {
11
11
  "type": "git",
@@ -34,9 +34,9 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@biowasm/aioli": "^3.1.0",
37
- "@datagrok-libraries/bio": "^5.38.7",
37
+ "@datagrok-libraries/bio": "^5.38.10",
38
38
  "@datagrok-libraries/chem-meta": "^1.0.1",
39
- "@datagrok-libraries/ml": "^6.3.43",
39
+ "@datagrok-libraries/ml": "^6.3.44",
40
40
  "@datagrok-libraries/tutorials": "^1.3.6",
41
41
  "@datagrok-libraries/utils": "^4.0.17",
42
42
  "cash-dom": "^8.0.0",
@@ -62,9 +62,9 @@ A/C/G/T/C
62
62
  C/A/G/T/G/T
63
63
  T/T/C/A/A/C`,
64
64
  helmDna: `seq
65
- DNA1{D(A)P.D(C)P.D(G)P.D(T)P.D(C)P}$$$$
66
- DNA1{D(C)P.D(A)P.D(G)P.D(T)P.D(G)P.D(T)P}$$$$
67
- DNA1{D(T)P.D(T)P.D(C)P.D(A)P.D(A)P.D(C)P}$$$$`,
65
+ RNA1{d(A)p.d(C)p.d(G)p.d(T)p.d(C)p}$$$$
66
+ RNA1{d(C)p.d(A)p.d(G)p.d(T)p.d(G)p.d(T)p}$$$$
67
+ RNA1{d(T)p.d(T)p.d(C)p.d(A)p.d(A)p.d(C)p}$$$$`,
68
68
  fastaRna: `seq
69
69
  ACGUC
70
70
  CAGUGU
@@ -74,9 +74,9 @@ A*C*G*U*C
74
74
  C*A*G*U*G*U
75
75
  U*U*C*A*A*C`,
76
76
  helmRna: `seq
77
- RNA1{R(A)P.R(C)P.R(G)P.R(U)P.R(C)P}$$$$
78
- RNA1{R(C)P.R(A)P.R(G)P.R(U)P.R(G)P.R(U)P}$$$$
79
- RNA1{R(U)P.R(U)P.R(C)P.R(A)P.R(A)P.R(C)P}$$$$`,
77
+ RNA1{r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$
78
+ RNA1{r(C)p.r(A)p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$
79
+ RNA1{r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p}$$$$`,
80
80
  fastaGaps: `seq
81
81
  FW-PH-EYY
82
82
  FYNRQWYV-
@@ -103,17 +103,17 @@ PEPTIDE1{meI.hHis.Aca.N.T.dE.Thr_PO3H2.Aca.D}$$$$
103
103
  PEPTIDE1{meI.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2}$$$$
104
104
  PEPTIDE1{Lys_Boc.hHis.Aca.Cys_SEt.T.dK.Thr_PO3H2.Aca.Tyr_PO3H2}$$$$`,
105
105
  helmLoneDeoxyribose: `seq
106
- DNA1{D(A).D(C).D(G).D(T).D(C)}$$$$
107
- DNA1{D(C).D(A).D(G).D(T).D(G).D(T)P}$$$$
108
- DNA1{D(T).D(T).D(C).D(A).D(A).D(C)P}$$$$`,
106
+ RNA1{d(A).d(C).d(G).d(T).d(C)}$$$$
107
+ RNA1{d(C).d(A).d(G).d(T).d(G).d(T)p}$$$$
108
+ RNA1{d(T).d(T).d(C).d(A).d(A).d(C)p}$$$$`,
109
109
  helmLoneRibose: `seq
110
- RNA1{R(A).R(C).R(G).R(U).R(C)}$$$$
111
- RNA1{R(C).R(A).R(G).R(U).R(G).R(U)P}$$$$
112
- RNA1{R(U).R(U).R(C).R(A).R(A).R(C)P}$$$$`,
110
+ RNA1{r(A).r(C).r(G).r(U).r(C)}$$$$
111
+ RNA1{r(C).r(A).r(G).r(U).r(G).r(U)p}$$$$
112
+ RNA1{r(U).r(U).r(C).r(A).r(A).r(C)p}$$$$`,
113
113
  helmLonePhosphorus: `seq
114
- RNA1{P.P.R(A)P.R(C)P.R(G)P.R(U)P.R(C)P}$$$$
115
- RNA1{P.P.R(C)P.R(A)P.P.R(G)P.R(U)P.R(G)P.R(U)P}$$$$
116
- RNA1{P.R(U)P.R(U)P.R(C)P.R(A)P.R(A)P.R(C)P.P.P}$$$$`,
114
+ RNA1{p.p.r(A)p.r(C)p.r(G)p.r(U)p.r(C)p}$$$$
115
+ RNA1{p.p.r(C)p.r(A)p.p.r(G)p.r(U)p.r(G)p.r(U)p}$$$$
116
+ RNA1{p.r(U)p.r(U)p.r(C)p.r(A)p.r(A)p.r(C)p.p.p}$$$$`,
117
117
  };
118
118
 
119
119
  /** Also detects semantic types
@@ -60,6 +60,9 @@ export enum PROPS {
60
60
  fitWidth = 'fitWidth',
61
61
  positionWidth = 'positionWidth',
62
62
  positionHeight = 'positionHeight',
63
+
64
+ // -- Behavior --
65
+ filterSource = 'filterSource',
63
66
  }
64
67
 
65
68
  const defaults: VdRegionsProps = VdRegionsPropsDefault;
@@ -88,6 +91,8 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
88
91
  public positionWidth: number;
89
92
  public positionHeight: PositionHeight;
90
93
 
94
+ public filterSource: FilterSources;
95
+
91
96
  constructor() {
92
97
  super();
93
98
 
@@ -111,6 +116,10 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
111
116
  });
112
117
  this.positionHeight = this.string(PROPS.positionHeight, defaults.positionHeight,
113
118
  {category: PROPS_CATS.LAYOUT, choices: Object.keys(PositionHeight)}) as PositionHeight;
119
+
120
+ // -- Behavior --
121
+ this.filterSource = this.string(PROPS.filterSource, defaults.filterSource,
122
+ {category: PROPS_CATS.BEHAVIOR, choices: Object.values(FilterSources)}) as FilterSources;
114
123
  }
115
124
 
116
125
  public async init() {
@@ -197,6 +206,10 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
197
206
  this.calcSize();
198
207
  break;
199
208
 
209
+ case PROPS.filterSource:
210
+ this.filterSourceInput.value = this.filterSource;
211
+ break;
212
+
200
213
  default:
201
214
  this.setData(this.dataFrame, this.regions); // onPropertyChanged
202
215
  break;
@@ -244,7 +257,7 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
244
257
  private setDataInProgress: boolean = false;
245
258
 
246
259
  private host: HTMLElement | null = null;
247
- private filterSourceInput: DG.InputBase<boolean | null> | null = null;
260
+ private filterSourceInput!: DG.InputBase<FilterSources | null>;
248
261
  private mainLayout: HTMLTableElement | null = null;
249
262
  private logos: { [chain: string]: WebLogoViewer }[] = [];
250
263
 
@@ -350,12 +363,13 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
350
363
  // this.mainLayout.style.height = '100%';
351
364
  // this.mainLayout.style.border = '1px solid black';
352
365
 
353
- this.filterSourceInput = ui.boolInput('', false, this.filterSourceInputOnValueChanged.bind(this));
366
+ this.filterSourceInput = ui.choiceInput<FilterSources>('Data source', defaults.filterSource,
367
+ Object.values(FilterSources), this.filterSourceInputOnValueChanged.bind(this));
354
368
  this.filterSourceInput.root.style.position = 'absolute';
355
- this.filterSourceInput.root.style.left = '10px';
356
- this.filterSourceInput.root.style.top = '-3px';
369
+ this.filterSourceInput.root.style.right = '9px';
370
+ this.filterSourceInput.root.style.top = '-4px';
357
371
  //this.filterSourceInput.setTooltip('Check to filter sequences for selected VRs'); // TODO: GROK-13614
358
- ui.tooltip.bind(this.filterSourceInput.input, 'Check to filter sequences for selected VRs');
372
+ //ui.tooltip.bind(this.filterSourceInput.input, 'Check to filter sequences for selected VRs');
359
373
 
360
374
  const _color: string = `#ffbb${Math.ceil(Math.random() * 255).toString(16)}`;
361
375
  this.host = ui.div([this.mainLayout, this.filterSourceInput!.root],
@@ -440,15 +454,20 @@ export class VdRegionsViewer extends DG.JsViewer implements IVdRegionsViewer {
440
454
  }
441
455
 
442
456
  private filterSourceInputOnValueChanged(): void {
443
- const filterSource: FilterSources = this.filterSourceInput!.value == true ?
444
- FilterSources.Selected : FilterSources.Filtered;
445
-
446
- for (let orderI = 0; orderI < this.logos.length; orderI++) {
447
- for (let chainI = 0; chainI < this.chains.length; chainI++) {
448
- const chain: string = this.chains[chainI];
449
- const wl: DG.JsViewer = this.logos[orderI][chain];
450
- wl.setOptions({[wlPROPS.filterSource]: filterSource});
457
+ const filterSourceValue = this.filterSourceInput.value;
458
+ // Using promise to prevent 'Bad state: Cannot fire new event. Controller is already firing an event'
459
+ this.viewPromise = this.viewPromise.then(() => {
460
+ if (this.filterSource !== filterSourceValue) {
461
+ this.props.getProperty(PROPS.filterSource).set(this, filterSourceValue); // to update value in property panel
462
+
463
+ for (let orderI = 0; orderI < this.logos.length; orderI++) {
464
+ for (let chainI = 0; chainI < this.chains.length; chainI++) {
465
+ const chain: string = this.chains[chainI];
466
+ const wl: DG.JsViewer = this.logos[orderI][chain];
467
+ wl.setOptions({[wlPROPS.filterSource]: this.filterSource});
468
+ }
469
+ }
451
470
  }
452
- }
471
+ });
453
472
  }
454
473
  }
package/dist/440.js DELETED
@@ -1,2 +0,0 @@
1
- var bio;(()=>{"use strict";var t,e,r={1040:(t,e,r)=>{var n,i,s,o,a,h;r.d(e,{CF:()=>i,Qe:()=>a,W:()=>n,Yc:()=>h,gd:()=>o,gk:()=>s}),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan"}(n||(n={})),function(t){t.Euclidean="Euclidean"}(i||(i={})),function(t){t.Tanimoto="Tanimoto",t.Dice="Dice",t.Asymmetric="Asymmetric",t.BraunBlanquet="Braun-Blanquet",t.Cosine="Cosine",t.Kulczynski="Kulczynski",t.McConnaughey="Mc-Connaughey",t.RogotGoldberg="Rogot-Goldberg",t.Russel="Russel",t.Sokal="Sokal",t.Hamming="Hamming",t.Euclidean="Euclidean"}(s||(s={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(o||(o={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray"}(a||(a={})),function(t){t.NumericDistance="NumericDistance"}(h||(h={}))},7440:(t,e,r)=>{var n=r(4221),i=r(7659),s=r(3659);function o(t){return Math.random()*t}function a(t){return Math.floor(o(t))}function h(t=!1,e="Assertion error."){if(!t)throw new Error(e)}function l(t,e,r=1){const n=t.length;h(n==e.length,"Vector lengths do not match.");const i=new s.OW(n);for(let n=0;n<t.length;++n)i[n]=t[n]+r*e[n];return i}function u(t,e,r=1){const n=function(t,e,r=0){return new Array(t).fill(r).map((()=>new s.OW(e).fill(r)))}(t,e);for(let i=0;i<t;++i)for(let t=0;t<e;++t)n[i][t]=o(r);return n}function c(t,e){const r=function(t){let e=0;for(let r=0;r<t.length;++r)e+=t[r];return e}(function(t){const e=t.length,r=new s.OW(e);for(let e=0;e<t.length;++e)r[e]=t[e]*t[e];return r}(l(t,e,-1)));return Math.sqrt(r)}function f(t){return(e,r)=>t*e+r-Math.floor((e+2)*(e+1)/2)}class m{constructor(t=!0,e=!0){const n=navigator.hardwareConcurrency;this._workerCount=t?Math.max(n-2,1):1,this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(r.p+r.u(868),r.b)))),this._terminateOnComplete=e}async calc(t,e,r=!0){return new Promise((async(n,i)=>{try{const i=t.length,s=new Array(this._workerCount),o=i*(i-1)/2;this._workerCount=Math.min(this._workerCount,o);const a=o/this._workerCount,h=new Float32Array(o);let l=0,u=1,c=0,f=Number.MIN_VALUE;for(let r=0;r<this._workerCount;r++){const n=Math.floor(r*a),m=r===this._workerCount-1?o:Math.floor((r+1)*a),g=l,p=u;r!==this._workerCount-1&&(l=i-2-Math.floor(Math.sqrt(-8*m+4*i*(i-1)-7)/2-.5),u=m-i*l+Math.floor((l+1)*(l+2)/2)),this._workers[r].postMessage({values:t,fnName:e,startRow:g,startCol:p,chunckSize:m-n}),s[r]=new Promise(((t,e)=>{this._workers[r].onmessage=({data:{error:i,distanceMatrixData:s,min:o,max:a}})=>{this._terminateOnComplete&&this._workers[r].terminate(),i?e(i):(h.set(s,n),o<c&&(c=o),a>f&&(f=a),t())}}))}await Promise.all(s),r&&h.forEach(((t,e)=>{h[e]=(t-c)/(f-c)})),n(h)}catch(t){i(t)}}))}terminate(){this._workers.forEach((t=>t.terminate()))}}class g{constructor(t){this.steps=t?.steps??0,this.cycles=t?.cycles??1e6,this.cutoff=t?.cutoff??0,this.lambda=t?.lambda??2,this.dlambda=t?.dlambda??.01,this.lambda2=this.lambda/2,this.dlambda2=this.dlambda/2,this.epsilon=t?.epsilon??1e-10,this.distanceFunction=t?.distance??c,this.distance=new Float32Array,this.distanceFunctionName=t?.distanceFunctionName}async initDistance(t){this.dmIndexFunct=f(t.length);const e=new m(!0,!1);this.distance=await e.calc(t,this.distanceFunctionName),e.terminate()}calcDistance(t,e,r){return this.distance[this.dmIndexFunct(e,r)]}async embed(t){const e=t.length,r=u(e,g.dimension,40);let n=this.lambda2;0===this.steps&&(this.steps=t.length-1),await this.initDistance(t);for(let i=0;i<this.cycles;++i){for(let i=0;i<this.steps;++i){const i=a(e);let s=a(e);for(;i==s;)s=a(e);const o=r[i],h=r[s],u=this.calcDistance(t,i,s),f=c(o,h);if(0==this.cutoff||u<=this.cutoff||f<u){const t=n*(u-f)/(f+this.epsilon),e=l(o,h,-1);r[i]=l(o,e,t),r[s]=l(h,e,-t)}}if(n-=this.dlambda2,n<=0)break}return r}}g.dimension=2;class p extends g{async embed(t){const e=t.length,r=u(e,p.dimension,40);let n=this.lambda;await this.initDistance(t);for(let i=0;i<this.cycles;++i){const i=a(e),s=r[i];for(let o=0;o<e;++o){if(i==o)continue;const e=r[o],a=this.calcDistance(t,i,o),h=c(s,e);if(0==this.cutoff||a<=this.cutoff||h<a){const t=n*(a-h)/(h+this.epsilon),i=l(s,e,-1);r[o]=l(e,i,-t)}}if(n-=this.dlambda,n<=0)break}return r}}class d extends g{constructor(t){super(t),this.cycles=t?.cycles??1e3,this.steps=t?.steps??1e5,this.radiusPercent=t?.radiusPercent??1,this.maxDistance=t?.maxDistance??null,this.maxDistanceSteps=t?.maxDistanceSteps??null}async embed(t){const e=t.length,r=u(e,d.dimension,40);if(await this.initDistance(t),null===this.maxDistanceSteps&&(this.maxDistanceSteps=e*Math.floor((e-1)/2)),null===this.maxDistance){this.maxDistance=-1e37;for(let r=0;r<this.maxDistanceSteps;r++){const r=a(e);let n=a(e);for(;r==n;)n=a(e);const i=this.calcDistance(t,r,n);i>this.maxDistance&&(this.maxDistance=i)}}let n=this.lambda;const i=0==this.radiusPercent?this.maxDistance:this.maxDistance*this.radiusPercent;for(let s=0;s<this.cycles;++s){for(let s=0;s<this.steps;++s){const s=a(e);let o=a(e);for(;s==o;)o=a(e);const h=r[s],u=r[o],f=this.calcDistance(t,s,o),m=c(h,u);if(f<=i||m<f){const t=.5*n*(f-m)/(m+this.epsilon),e=l(h,u,-1);r[s]=l(h,e,t),r[o]=l(u,e,-t)}}if(n-=(this.lambda-this.dlambda)/(this.cycles-1),n<this.dlambda)break}return r}}var w=r(1811),y=r(3979),v=r(5697),b=r(489),M=r(1040);const x={[M.CF.Euclidean]:c},S={[M.W.Levenshtein]:w.T,[M.W.JaroWinkler]:y.H$,[M.W.Manhattan]:function(t,e){if(t.length!==e.length)return 1;{let r=0;for(let n=1;n<t.length;n++)r+=t[n]==e[n]?0:1;return r/t.length}}},E={[M.gk.Tanimoto]:v.KR,[M.gk.Dice]:v._h,[M.gk.Asymmetric]:v.yU,[M.gk.BraunBlanquet]:v.Dz,[M.gk.Cosine]:v.Zd,[M.gk.Kulczynski]:v.s,[M.gk.McConnaughey]:v.aW,[M.gk.RogotGoldberg]:v.MI,[M.gk.Russel]:v.fX,[M.gk.Sokal]:v.NB,[M.gk.Hamming]:v.UX,[M.gk.Euclidean]:v.WI},k={[M.gd.TanimotoIntArray]:v.FV},N={[M.Yc.NumericDistance]:v.bX},R={[M.Qe.Vector]:{[M.CF.Euclidean]:x[M.CF.Euclidean]},[M.Qe.String]:{[M.W.Levenshtein]:S[M.W.Levenshtein],[M.W.JaroWinkler]:S[M.W.JaroWinkler],[M.W.Manhattan]:S[M.W.Manhattan]},[M.Qe.BitArray]:{[M.gk.Tanimoto]:E[M.gk.Tanimoto],[M.gk.Dice]:E[M.gk.Dice],[M.gk.Asymmetric]:E[M.gk.Asymmetric],[M.gk.BraunBlanquet]:E[M.gk.BraunBlanquet],[M.gk.Cosine]:E[M.gk.Cosine],[M.gk.Kulczynski]:E[M.gk.Kulczynski],[M.gk.McConnaughey]:E[M.gk.McConnaughey],[M.gk.RogotGoldberg]:E[M.gk.RogotGoldberg],[M.gk.Russel]:E[M.gk.Russel],[M.gk.Sokal]:E[M.gk.Sokal]},[M.Qe.MacroMolecule]:{[b.U.HAMMING]:b.o[b.U.HAMMING],[b.U.LEVENSHTEIN]:b.o[b.U.LEVENSHTEIN],[b.U.NEEDLEMANN_WUNSCH]:b.o[b.U.NEEDLEMANN_WUNSCH]},[M.Qe.Number]:{[M.Yc.NumericDistance]:N[M.Yc.NumericDistance]},[M.Qe.IntArray]:{[M.gd.TanimotoIntArray]:k[M.gd.TanimotoIntArray]}},_=Object.keys(R).reduce(((t,e)=>{for(const r of Object.keys(R[e]))t[r]=e;return t}),{});class z{constructor(t){this.method=t,this.dataType=_[t]}getMeasure(t){const e=R;if(!e.hasOwnProperty(this.dataType)||!e[this.dataType].hasOwnProperty(this.method))throw new Error(`Unknown measure ${this.method} for data type ${this.dataType}`);return r=this.method,_[r]==M.Qe.MacroMolecule.toString()?e[this.dataType][this.method](t):e[this.dataType][this.method];var r}static getMetricByDataType(t){return Object.keys(R[t])}static get availableMeasures(){return Object.keys(R)}}var A,F=r(9657),I=r(6814);class C{get data(){return this._data}get size(){return this._size}constructor(t,e){if(null==e){if(null==t)throw new Error("Arguments error: data or size is required.");if(this._data=t,this._size=(1+Math.sqrt(1+8*this._data.length))/2,this._size!=Math.floor(this._size))throw new Error(`Invalid data length ${this._data.length} leads to non integer size ${this._size}`)}else{this._size=e;const r=e*(e-1)/2;if(t){if(t.length!=r)throw new Error(`Invalid data length. Observations size ${e} requires data length ${r}.`);this._data=t}else this._data=new Float32Array(r)}}_linearizeIJ(t,e){if(!(t<e))throw new Error("i must be less than j");return this._size*t+e-Math.floor((t+2)*(t+1)/2)}get(t,e){return t==e?0:t<e?this._data[this._linearizeIJ(t,e)]:this._data[this._linearizeIJ(e,t)]}set(t,e,r){this._data[this._linearizeIJ(t,e)]=r}static calc(t,e){const r=t.length,n=new C(void 0,r);for(let i=0;i<r;i++)for(let s=i+1;s<r;s++)n.set(i,s,(0,I.k)(t[i])||(0,I.k)(t[s])?1:e(t[i],t[s]));return n}square(){for(let t=0;t<this._data.length;t++)this._data[t]=this._data[t]**2}add(t){if(this._size!==t._size)throw new Error(`Matrices must have the same size. This size: ${this._size}, other size: ${t._size}`);for(let e=0;e<this._data.length;e++)this._data[e]+=t._data[e]}sqrt(){for(let t=0;t<this._data.length;t++)this._data[t]=Math.sqrt(this._data[t])}normalize(){let t=0,e=this._data[0];for(let r=0;r<this._data.length;r++)this._data[r]<t&&(t=this._data[r]),this._data[r]>e&&(e=this._data[r]);const r=e-t;for(let n=0;n<this._data.length;n++)this._data[n]=0===r?this._data[n]-t:(this._data[n]-t)/(e-t)}}class T{constructor(){this._workerCount=Math.max(navigator.hardwareConcurrency-2,1),this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(r.p+r.u(381),r.b))))}async calc(t,e,r){const n=t.length*(t.length-1)/2,i=Math.floor(n/this._workerCount),s=new Array(this._workerCount);for(let o=0;o<this._workerCount;o++)s[o]=new Promise(((s,a)=>{const h=o*i,l=o===this._workerCount-1?n:(o+1)*i;this._workers[o].postMessage({values:t,startIdx:h,endIdx:l,threshold:r,fnName:e}),this._workers[o].onmessage=({data:{error:t,i:e,j:r,distance:n}})=>{t?a(t):(this._workers[o].terminate(),s({i:e,j:r,distance:n,idx:o}))}}));const o=await Promise.all(s),a=o.reduce(((t,e)=>t+e.i.length),0),h=new Int32Array(a),l=new Int32Array(a),u=new Float32Array(a);let c=0;for(const t of o)h.set(t.i,c),l.set(t.j,c),u.set(t.distance,c),c+=t.i.length;return{i:h,j:l,distance:u}}}!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(A||(A={}));class P{constructor(t){this.data=t.data}}const D={UMAP:class extends P{constructor(t){super(t),h("distanceFname"in t),h("distanceFn"in t),this.distanceFn=t.distanceFn,this.usingSparseMatrix=!!t.usingSparseMatrix||!!t.sparseMatrix,this.sparseMatrixThreshold=t.sparseMatrixThreshold??.8,this.transferedSparseMatrix=t.sparseMatrix,this.distanceFname=t.distanceFname,this.dmIndexFunc=f(this.data.length),this.vectors=new Array(this.data.length).fill(0).map(((t,e)=>[e])),this.usingDistanceMatrix=!(!t.preCalculateDistanceMatrix&&this.data.length>2e4||this.usingSparseMatrix),this.usingDistanceMatrix?t.distanceFn=this._encodedDistanceMatrix.bind(this):this.usingSparseMatrix?t.distanceFn=this._encodedSparseMatrix.bind(this):t.distanceFn=this._encodedDistance.bind(this),this.data.length<15&&(t.nNeighbors=this.data.length-1),this.reducer=new n.u(t)}_encodedDistanceMatrix(t,e){return t[0]===e[0]?0:t[0]>e[0]?this.distanceMatrix[this.dmIndexFunc(e[0],t[0])]:this.distanceMatrix[this.dmIndexFunc(t[0],e[0])]}_encodedSparseMatrix(t,e){return this.sparseMatrix.get(t[0])?.get(e[0])??this.sparseMatrix.get(e[0])?.get(t[0])??1}_encodedDistance(t,e){return this.distanceFn(this.data[t[0]],this.data[e[0]])}async transform(t){if(this.usingDistanceMatrix)this.distanceMatrix=t?await(async()=>{const t=new m(!0,!1);try{const e=await t.calc(this.data,this.distanceFname);return t.terminate(),e}catch(e){throw t.terminate(),e}})():(()=>C.calc(this.data,((t,e)=>this.distanceFn(t,e))).data)();else if(this.usingSparseMatrix){const t=this.transferedSparseMatrix??await(new T).calc(this.data,this.distanceFname,this.sparseMatrixThreshold);this.sparseMatrix=new Map;for(let e=0;e<t.i.length;++e){const r=t.i[e],n=t.j[e],i=t.distance[e];this.sparseMatrix.has(r)||this.sparseMatrix.set(r,new Map),this.sparseMatrix.get(r).set(n,i)}}const e=this.reducer.fit(this.vectors);return{embedding:(r=e,new Array(r.length).fill(0).map(((t,e)=>s.OW.from(r[e])))),...this.distanceMatrix?{distance:this.distanceMatrix}:{}};var r}},"t-SNE":class extends P{constructor(t){super(t),this.reducer=new i.Z(t),this.iterations=t?.iterations??100,this.distanceFname=t.distanceFname,this.distanceFn=t.distanceFn}async transform(t){const e=t?await(async()=>{const t=new m(!0,!1);try{const e=await t.calc(this.data,this.distanceFname);return t.terminate(),e}catch(e){throw t.terminate(),e}})():(()=>{const t=C.calc(this.data,((t,e)=>this.distanceFn(t,e)));return t.normalize(),t.data})(),r=function(t,e){const r=f(e);function n(t,e){const n=Number(t),i=Number(e);return r(n,i)}const i={get:(t,r,i)=>"length"===r?e:new Proxy(t,function(t){return{get:(e,r,i)=>t===r?0:e[Number(t)>Number(r)?n(r,t):n(t,r)]}}(r))};return new Proxy(t,i)}(e,this.data.length);this.reducer.initDataDist(r);for(let t=0;t<this.iterations;++t)this.reducer.step();return{distance:e,embedding:this.reducer.getSolution()}}},SPE:class extends P{constructor(t){super(t),this.reducer=new g(t)}async transform(){const t=await this.reducer.embed(this.data);return{distance:this.reducer.distance,embedding:t}}},pSPE:class extends P{constructor(t){super(t),this.reducer=new p(t)}async transform(){const t=await this.reducer.embed(this.data);return{distance:this.reducer.distance,embedding:t}}},OriginalSPE:class extends P{constructor(t){super(t),this.reducer=new d(t)}async transform(){const t=await this.reducer.embed(this.data);return{distance:this.reducer.distance,embedding:t}}}};class O{constructor(t,e,r,n){const i=new z(r).getMeasure();let s={};if("BitArray"==_[r])for(let e=0;e<t.length;++e)t[e]=new F.Z(t[e]._data,t[e]._length);s="UMAP"==e?{data:t,distanceFn:i,distanceFname:r,nEpochs:n?.cycles,...n}:"t-SNE"==e?{data:t,distanceFn:i,distanceFname:r,iterations:n?.cycles??void 0,...n}:{data:t,distance:i,distanceFunctionName:r,...n},this.reducer=new D[e](s)}async transform(t=!1,e){if(void 0===this.reducer)throw new Error("Reducer was not defined.");let{embedding:r,distance:n}=await this.reducer.transform(e);var i;return t&&(i=r,r=new Array(i[0].length).fill(0).map(((t,e)=>new s.OW(i.length).fill(0).map(((t,r)=>i[r][e]))))),{distance:n,embedding:r}}static availableMetricsByType(t){return Object.keys(R[t])}static get availableMethods(){return Object.keys(D)}static get availableMetrics(){let t=[];return Object.values(R).forEach((e=>{const r=Object.values(e);t=[...t,...r]})),t}}self.onmessage=async({data:{columnData:t,method:e,measure:r,options:n,parallelDistanceWorkers:i}})=>{let s;try{s=await async function(t,e,r,n,i){const s=new O(t,e,r,n);return await s.transform(!0,i)}(t,e,r,n,i)}catch(t){s={error:t}}self.postMessage({error:s.error,distance:s.distance,embedding:s.embedding})}},7659:(t,e,r)=>{e.Z=void 0;var n=r(6215);Object.defineProperty(e,"Z",{enumerable:!0,get:function(){return n.TSNE}})},6215:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TSNE=void 0,e.TSNE=class{constructor(t){this.returnV=!1,this.vValue=0,this.iter=0,t=t||{},this.perplexity=this.getopt(t,"perplexity",30),this.dim=this.getopt(t,"dim",2),this.epsilon=this.getopt(t,"epsilon",10)}assert(t,e){if(!t)throw e||"Assertion failed"}getopt(t,e,r){return t.hasOwnProperty(e)?t[e]:r}gaussRandom(){if(this.returnV)return this.returnV=!1,this.vValue;const t=2*Math.random()-1,e=2*Math.random()-1,r=t*t+e*e;if(0===r||r>1)return this.gaussRandom();const n=Math.sqrt(-2*Math.log(r)/r);return this.vValue=e*n,this.returnV=!0,t*n}randn(t,e){return t+this.gaussRandom()*e}zeros(t){if(void 0===t||isNaN(t))return[];if("undefined"==typeof ArrayBuffer){const e=new Array(t);for(let r=0;r<t;r++)e[r]=0;return e}return new Float64Array(t)}randn2d(t,e,r){const n=void 0!==r,i=[];for(let s=0;s<t;s++){const t=[];for(let i=0;i<e;i++)n?t.push(r):t.push(this.randn(0,1e-4));i.push(t)}return i}L2(t,e){const r=t.length;let n=0;for(let i=0;i<r;i++){const r=t[i],s=e[i];n+=(r-s)*(r-s)}return n}xtod(t){const e=t.length,r=this.zeros(e*e);for(let n=0;n<e;n++)for(let i=n+1;i<e;i++){const s=this.L2(t[n],t[i]);r[n*e+i]=s,r[i*e+n]=s}return r}d2p(t,e,r){const n=Math.sqrt(t.length),i=Math.floor(n);this.assert(i===n,"D should have square number of elements.");const s=Math.log(e),o=this.zeros(i*i),a=this.zeros(i);for(let e=0;e<i;e++){let n=-1/0,h=1/0,l=1,u=!1;const c=50;let f=0;for(;!u;){let o=0;for(let r=0;r<i;r++){let n=Math.exp(-t[e*i+r]*l);e===r&&(n=0),a[r]=n,o+=n}let m=0;for(let t=0;t<i;t++){let e;e=0===o?0:a[t]/o,a[t]=e,e>1e-7&&(m-=e*Math.log(e))}m>s?(n=l,h===1/0?l*=2:l=(l+h)/2):(h=l,n===-1/0?l/=2:l=(l+n)/2),f++,Math.abs(m-s)<r&&(u=!0),f>=c&&(u=!0)}for(let t=0;t<i;t++)o[e*i+t]=a[t]}const h=this.zeros(i*i),l=2*i;for(let t=0;t<i;t++)for(let e=0;e<i;e++)h[t*i+e]=Math.max((o[t*i+e]+o[e*i+t])/l,1e-100);return h}sign(t){return t>0?1:t<0?-1:0}initDataRaw(t){const e=t.length,r=t[0].length;this.assert(e>0," X is empty? You must have some data!"),this.assert(r>0," X[0] is empty? Where is the data?");const n=this.xtod(t);this.P=this.d2p(n,this.perplexity,1e-4),this.N=e,this.initSolution()}initDataDist(t){const e=t.length;this.assert(e>0," X is empty? You must have some data!");const r=this.zeros(e*e);for(let n=0;n<e;n++)for(let i=n+1;i<e;i++){const s=t[n][i];r[n*e+i]=s,r[i*e+n]=s}this.P=this.d2p(r,this.perplexity,1e-4),this.N=e,this.initSolution()}initSolution(){this.Y=this.randn2d(this.N,this.dim),this.gains=this.randn2d(this.N,this.dim,1),this.ystep=this.randn2d(this.N,this.dim,0),this.iter=0}getSolution(){return this.Y}step(){this.iter+=1;const t=this.N,e=this.costGrad(this.Y),r=e.cost,n=e.grad,i=this.zeros(this.dim);for(let e=0;e<t;e++)for(let t=0;t<this.dim;t++){const r=n[e][t],s=this.ystep[e][t],o=this.gains[e][t];let a=this.sign(r)===this.sign(s)?.8*o:o+.2;a<.01&&(a=.01),this.gains[e][t]=a;const h=(this.iter<250?.5:.8)*s-this.epsilon*a*n[e][t];this.ystep[e][t]=h,this.Y[e][t]+=h,i[t]+=this.Y[e][t]}for(let e=0;e<t;e++)for(let r=0;r<this.dim;r++)this.Y[e][r]-=i[r]/t;return r}debugGrad(){const t=this.N,e=this.costGrad(this.Y),r=(e.cost,e.grad),n=1e-5;for(let e=0;e<t;e++)for(let t=0;t<this.dim;t++){const i=this.Y[e][t];this.Y[e][t]=i+n;const s=this.costGrad(this.Y);this.Y[e][t]=i-n;const o=this.costGrad(this.Y),a=r[e][t],h=(s.cost-o.cost)/(2*n);console.log(e+","+t+": gradcheck analytic: "+a+" vs. numerical: "+h),this.Y[e][t]=i}}costGrad(t){const e=this.N,r=this.dim,n=this.P,i=this.iter<100?4:1,s=this.zeros(e*e);let o=0;for(let n=0;n<e;n++)for(let i=n+1;i<e;i++){let a=0;for(let e=0;e<r;e++){const r=t[n][e]-t[i][e];a+=r*r}const h=1/(1+a);s[n*e+i]=h,s[i*e+n]=h,o+=2*h}const a=e*e,h=this.zeros(a);for(let t=0;t<a;t++)h[t]=Math.max(s[t]/o,1e-100);let l=0;const u=[];for(let o=0;o<e;o++){const a=new Array(r);for(let t=0;t<r;t++)a[t]=0;for(let u=0;u<e;u++){l+=-n[o*e+u]*Math.log(h[o*e+u]);const c=4*(i*n[o*e+u]-h[o*e+u])*s[o*e+u];for(let e=0;e<r;e++)a[e]+=c*(t[o][e]-t[u][e])}u.push(a)}return{cost:l,grad:u}}}},9251:(t,e,r)=>{r.r(e),r.d(e,{default:()=>P});const n=Object.prototype.toString;function i(t){return n.call(t).endsWith("Array]")}function s(t,e,r){let n=0;const i=r(e);for(let e=0;e<t.x.length;e++)n+=Math.abs(t.y[e]-i(t.x[e]));return n}const o=Object.prototype.toString;function a(t){return o.call(t).endsWith("Array]")}const h=Object.prototype.toString;function l(t){return h.call(t).endsWith("Array]")}const u=Object.prototype.toString;const c=Object.prototype.toString;function f(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!l(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==r.output){if(!l(r.output))throw new TypeError("output option must be an array if specified");e=r.output}else e=new Array(t.length);var n=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=t,!c.call(e).endsWith("Array]"))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=r.fromIndex,i=void 0===n?0:n,s=r.toIndex,o=void 0===s?t.length:s;if(i<0||i>=t.length||!Number.isInteger(i))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=i||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[i],h=i+1;h<o;h++)t[h]<a&&(a=t[h]);return a}(t),i=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e=t,!u.call(e).endsWith("Array]"))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=r.fromIndex,i=void 0===n?0:n,s=r.toIndex,o=void 0===s?t.length:s;if(i<0||i>=t.length||!Number.isInteger(i))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=i||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var a=t[i],h=i+1;h<o;h++)t[h]>a&&(a=t[h]);return a}(t);if(n===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var s=r.min,o=void 0===s?r.autoMinMax?n:0:s,a=r.max,h=void 0===a?r.autoMinMax?i:1:a;if(o>=h)throw new RangeError("min option must be smaller than max option");for(var f=(h-o)/(i-n),m=0;m<t.length;m++)e[m]=(t[m]-n)*f+o;return e}const m=" ".repeat(2),g=" ".repeat(4);function p(t,e={}){const{maxRows:r=15,maxColumns:n=10,maxNumSize:i=8,padMinus:s="auto"}=e;return`${t.constructor.name} {\n${m}[\n${g}${function(t,e,r,n,i){const{rows:s,columns:o}=t,a=Math.min(s,e),h=Math.min(o,r),l=[];if("auto"===i){i=!1;t:for(let e=0;e<a;e++)for(let r=0;r<h;r++)if(t.get(e,r)<0){i=!0;break t}}for(let e=0;e<a;e++){let r=[];for(let s=0;s<h;s++)r.push(d(t.get(e,s),n,i));l.push(`${r.join(" ")}`)}return h!==o&&(l[l.length-1]+=` ... ${o-r} more columns`),a!==s&&l.push(`... ${s-e} more rows`),l.join(`\n${g}`)}(t,r,n,i,s)}\n${m}]\n${m}rows: ${t.rows}\n${m}columns: ${t.columns}\n}`}function d(t,e,r){return(t>=0&&r?` ${w(t,e-1)}`:w(t,e)).padEnd(e)}function w(t,e){let r=t.toString();if(r.length<=e)return r;let n=t.toFixed(e);if(n.length>e&&(n=t.toFixed(Math.max(0,e-(n.length-e)))),n.length<=e&&!n.startsWith("0.000")&&!n.startsWith("-0.000"))return n;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function y(t,e,r){let n=r?t.rows:t.rows-1;if(e<0||e>n)throw new RangeError("Row index out of range")}function v(t,e,r){let n=r?t.columns:t.columns-1;if(e<0||e>n)throw new RangeError("Column index out of range")}function b(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function M(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function x(t,e,r,n,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(E("startRow",e),E("endRow",r),E("startColumn",n),E("endColumn",i),e>r||n>i||e<0||e>=t.rows||r<0||r>=t.rows||n<0||n>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function S(t,e=0){let r=[];for(let n=0;n<t;n++)r.push(e);return r}function E(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function k(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class N{static from1DArray(t,e,r){if(t*e!==r.length)throw new RangeError("data length does not match given dimensions");let n=new _(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)n.set(i,t,r[i*e+t]);return n}static rowVector(t){let e=new _(1,t.length);for(let r=0;r<t.length;r++)e.set(0,r,t[r]);return e}static columnVector(t){let e=new _(t.length,1);for(let r=0;r<t.length;r++)e.set(r,0,t[r]);return e}static zeros(t,e){return new _(t,e)}static ones(t,e){return new _(t,e).fill(1)}static rand(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{random:n=Math.random}=r;let i=new _(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++)i.set(r,t,n());return i}static randInt(t,e,r={}){if("object"!=typeof r)throw new TypeError("options must be an object");const{min:n=0,max:i=1e3,random:s=Math.random}=r;if(!Number.isInteger(n))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(n>=i)throw new RangeError("min must be smaller than max");let o=i-n,a=new _(t,e);for(let r=0;r<t;r++)for(let t=0;t<e;t++){let e=n+Math.round(s()*o);a.set(r,t,e)}return a}static eye(t,e,r){void 0===e&&(e=t),void 0===r&&(r=1);let n=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<n;t++)i.set(t,t,r);return i}static diag(t,e,r){let n=t.length;void 0===e&&(e=n),void 0===r&&(r=e);let i=Math.min(n,e,r),s=this.zeros(e,r);for(let e=0;e<i;e++)s.set(e,e,t[e]);return s}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,i=new _(r,n);for(let s=0;s<r;s++)for(let r=0;r<n;r++)i.set(s,r,Math.min(t.get(s,r),e.get(s,r)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let r=t.rows,n=t.columns,i=new this(r,n);for(let s=0;s<r;s++)for(let r=0;r<n;r++)i.set(s,r,Math.max(t.get(s,r),e.get(s,r)));return i}static checkMatrix(t){return N.isMatrix(t)?t:new _(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.call(this,e,r);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.push(this.get(e,r));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let r=0;r<this.columns;r++)t[e].push(this.get(e,r))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isEchelonForm(){let t=0,e=0,r=-1,n=!0,i=!1;for(;t<this.rows&&n;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(i=!0,r=e):(n=!1,i=!0);t++}return n}isReducedEchelonForm(){let t=0,e=0,r=-1,n=!0,i=!1;for(;t<this.rows&&n;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>r?(i=!0,r=e):(n=!1,i=!0);for(let r=e+1;r<this.rows;r++)0!==this.get(t,r)&&(n=!1);t++}return n}echelonForm(){let t=this.clone(),e=0,r=0;for(;e<t.rows&&r<t.columns;){let n=e;for(let i=e;i<t.rows;i++)t.get(i,r)>t.get(n,r)&&(n=i);if(0===t.get(n,r))r++;else{t.swapRows(e,n);let i=t.get(e,r);for(let n=r;n<t.columns;n++)t.set(e,n,t.get(e,n)/i);for(let n=e+1;n<t.rows;n++){let i=t.get(n,r)/t.get(e,r);t.set(n,r,0);for(let s=r+1;s<t.columns;s++)t.set(n,s,t.get(n,s)-t.get(e,s)*i)}e++,r++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,r=t.rows,n=r-1;for(;n>=0;)if(0===t.maxRow(n))n--;else{let i=0,s=!1;for(;i<r&&!1===s;)1===t.get(n,i)?s=!0:i++;for(let r=0;r<n;r++){let s=t.get(r,i);for(let o=i;o<e;o++){let e=t.get(r,o)-s*t.get(n,o);t.set(r,o,e)}}n--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:r=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(r)||r<=0)throw new TypeError("columns must be a positive integer");let n=new _(this.rows*e,this.columns*r);for(let t=0;t<e;t++)for(let e=0;e<r;e++)n.setSubMatrix(this,this.rows*t,this.columns*e);return n}fill(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,t);return this}neg(){return this.mulS(-1)}getRow(t){y(this,t);let e=[];for(let r=0;r<this.columns;r++)e.push(this.get(t,r));return e}getRowVector(t){return _.rowVector(this.getRow(t))}setRow(t,e){y(this,t),e=b(this,e);for(let r=0;r<this.columns;r++)this.set(t,r,e[r]);return this}swapRows(t,e){y(this,t),y(this,e);for(let r=0;r<this.columns;r++){let n=this.get(t,r);this.set(t,r,this.get(e,r)),this.set(e,r,n)}return this}getColumn(t){v(this,t);let e=[];for(let r=0;r<this.rows;r++)e.push(this.get(r,t));return e}getColumnVector(t){return _.columnVector(this.getColumn(t))}setColumn(t,e){v(this,t),e=M(this,e);for(let r=0;r<this.rows;r++)this.set(r,t,e[r]);return this}swapColumns(t,e){v(this,t),v(this,e);for(let r=0;r<this.rows;r++){let n=this.get(r,t);this.set(r,t,this.get(r,e)),this.set(r,e,n)}return this}addRowVector(t){t=b(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[r]);return this}subRowVector(t){t=b(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[r]);return this}mulRowVector(t){t=b(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[r]);return this}divRowVector(t){t=b(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[r]);return this}addColumnVector(t){t=M(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t[e]);return this}subColumnVector(t){t=M(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t[e]);return this}mulColumnVector(t){t=M(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t[e]);return this}divColumnVector(t){t=M(this,t);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t[e]);return this}mulRow(t,e){y(this,t);for(let r=0;r<this.columns;r++)this.set(t,r,this.get(t,r)*e);return this}mulColumn(t,e){v(this,t);for(let r=0;r<this.rows;r++)this.set(r,t,this.get(r,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)>t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){k(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)>t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[e]&&(t[e]=this.get(e,r));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t[r]&&(t[r]=this.get(e,r));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.get(e,r)<t&&(t=this.get(e,r));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){k(this);let t=this.get(0,0),e=[0,0];for(let r=0;r<this.rows;r++)for(let n=0;n<this.columns;n++)this.get(r,n)<t&&(t=this.get(r,n),e[0]=r,e[1]=n);return e}maxRow(t){if(y(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r));return e}maxRowIndex(t){y(this,t),k(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n),r[1]=n);return r}minRow(t){if(y(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r));return e}minRowIndex(t){y(this,t),k(this);let e=this.get(t,0),r=[t,0];for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n),r[1]=n);return r}maxColumn(t){if(v(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t));return e}maxColumnIndex(t){v(this,t),k(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t),r[0]=n);return r}minColumn(t){if(v(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t));return e}minColumnIndex(t){v(this,t),k(this);let e=this.get(0,t),r=[0,t];for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t),r[0]=n);return r}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let r=0;r<t;r++)e.push(this.get(r,r));return e}norm(t="frobenius"){let e=0;if("max"===t)return this.max();if("frobenius"===t){for(let t=0;t<this.rows;t++)for(let r=0;r<this.columns;r++)e+=this.get(t,r)*this.get(t,r);return Math.sqrt(e)}throw new RangeError(`unknown norm type: ${t}`)}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t+=this.get(e,r),this.set(e,r,t);return this}dot(t){N.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let r=0;for(let n=0;n<e.length;n++)r+=e[n]*t[n];return r}mmul(t){t=_.checkMatrix(t);let e=this.rows,r=this.columns,n=t.columns,i=new _(e,n),s=new Float64Array(r);for(let o=0;o<n;o++){for(let e=0;e<r;e++)s[e]=t.get(e,o);for(let t=0;t<e;t++){let e=0;for(let n=0;n<r;n++)e+=this.get(t,n)*s[n];i.set(t,o,e)}}return i}strassen2x2(t){t=_.checkMatrix(t);let e=new _(2,2);const r=this.get(0,0),n=t.get(0,0),i=this.get(0,1),s=t.get(0,1),o=this.get(1,0),a=t.get(1,0),h=this.get(1,1),l=t.get(1,1),u=(r+h)*(n+l),c=(o+h)*n,f=r*(s-l),m=h*(a-n),g=(r+i)*l,p=u+m-g+(i-h)*(a+l),d=f+g,w=c+m,y=u-c+f+(o-r)*(n+s);return e.set(0,0,p),e.set(0,1,d),e.set(1,0,w),e.set(1,1,y),e}strassen3x3(t){t=_.checkMatrix(t);let e=new _(3,3);const r=this.get(0,0),n=this.get(0,1),i=this.get(0,2),s=this.get(1,0),o=this.get(1,1),a=this.get(1,2),h=this.get(2,0),l=this.get(2,1),u=this.get(2,2),c=t.get(0,0),f=t.get(0,1),m=t.get(0,2),g=t.get(1,0),p=t.get(1,1),d=t.get(1,2),w=t.get(2,0),y=t.get(2,1),v=t.get(2,2),b=(r-s)*(-f+p),M=(-r+s+o)*(c-f+p),x=(s+o)*(-c+f),S=r*c,E=(-r+h+l)*(c-m+d),k=(-r+h)*(m-d),N=(h+l)*(-c+m),R=(-i+l+u)*(p+w-y),z=(i-u)*(p-y),A=i*w,F=(l+u)*(-w+y),I=(-i+o+a)*(d+w-v),C=(i-a)*(d-v),T=(o+a)*(-w+v),P=S+A+n*g,D=(r+n+i-s-o-l-u)*p+M+x+S+R+A+F,O=S+E+N+(r+n+i-o-a-h-l)*d+A+I+T,j=b+o*(-c+f+g-p-d-w+v)+M+S+A+I+C,V=b+M+x+S+a*y,q=A+I+C+T+s*m,L=S+E+k+l*(-c+m+g-p-d-w+y)+R+z+A,$=R+z+A+F+h*f,W=S+E+k+N+u*v;return e.set(0,0,P),e.set(0,1,D),e.set(0,2,O),e.set(1,0,j),e.set(1,1,V),e.set(1,2,q),e.set(2,0,L),e.set(2,1,$),e.set(2,2,W),e}mmulStrassen(t){t=_.checkMatrix(t);let e=this.clone(),r=e.rows,n=e.columns,i=t.rows,s=t.columns;function o(t,e,r){let n=t.rows,i=t.columns;if(n===e&&i===r)return t;{let n=N.zeros(e,r);return n=n.setSubMatrix(t,0,0),n}}n!==i&&console.warn(`Multiplying ${r} x ${n} and ${i} x ${s} matrix: dimensions do not match.`);let a=Math.max(r,i),h=Math.max(n,s);return e=o(e,a,h),function t(e,r,n,i){if(n<=512||i<=512)return e.mmul(r);n%2==1&&i%2==1?(e=o(e,n+1,i+1),r=o(r,n+1,i+1)):n%2==1?(e=o(e,n+1,i),r=o(r,n+1,i)):i%2==1&&(e=o(e,n,i+1),r=o(r,n,i+1));let s=parseInt(e.rows/2,10),a=parseInt(e.columns/2,10),h=e.subMatrix(0,s-1,0,a-1),l=r.subMatrix(0,s-1,0,a-1),u=e.subMatrix(0,s-1,a,e.columns-1),c=r.subMatrix(0,s-1,a,r.columns-1),f=e.subMatrix(s,e.rows-1,0,a-1),m=r.subMatrix(s,r.rows-1,0,a-1),g=e.subMatrix(s,e.rows-1,a,e.columns-1),p=r.subMatrix(s,r.rows-1,a,r.columns-1),d=t(N.add(h,g),N.add(l,p),s,a),w=t(N.add(f,g),l,s,a),y=t(h,N.sub(c,p),s,a),v=t(g,N.sub(m,l),s,a),b=t(N.add(h,u),p,s,a),M=t(N.sub(f,h),N.add(l,c),s,a),x=t(N.sub(u,g),N.add(m,p),s,a),S=N.add(d,v);S.sub(b),S.add(x);let E=N.add(y,b),k=N.add(w,v),R=N.sub(d,w);R.add(y),R.add(M);let _=N.zeros(2*S.rows,2*S.columns);return _=_.setSubMatrix(S,0,0),_=_.setSubMatrix(E,S.rows,0),_=_.setSubMatrix(k,0,S.columns),_=_.setSubMatrix(R,S.rows,S.columns),_.subMatrix(0,n-1,0,i-1)}(e,t=o(t,a,h),a,h)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new _(this.rows,this.columns);for(let t=0;t<this.rows;t++){const i=this.getRow(t);i.length>0&&f(i,{min:e,max:r,output:i}),n.setRow(t,i)}return n}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:e=0,max:r=1}=t;if(!Number.isFinite(e))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(e>=r)throw new RangeError("min must be smaller than max");let n=new _(this.rows,this.columns);for(let t=0;t<this.columns;t++){const i=this.getColumn(t);i.length&&f(i,{min:e,max:r,output:i}),n.setColumn(t,i)}return n}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let r=0;r<t;r++){let t=this.get(e,r),n=this.get(e,this.columns-1-r);this.set(e,r,n),this.set(e,this.columns-1-r,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let r=0;r<t;r++){let t=this.get(r,e),n=this.get(this.rows-1-r,e);this.set(r,e,n),this.set(this.rows-1-r,e,t)}return this}kroneckerProduct(t){t=_.checkMatrix(t);let e=this.rows,r=this.columns,n=t.rows,i=t.columns,s=new _(e*n,r*i);for(let o=0;o<e;o++)for(let e=0;e<r;e++)for(let r=0;r<n;r++)for(let a=0;a<i;a++)s.set(n*o+r,i*e+a,this.get(o,e)*t.get(r,a));return s}kroneckerSum(t){if(t=_.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,r=t.rows,n=this.kroneckerProduct(_.eye(r,r)),i=_.eye(e,e).kroneckerProduct(t);return n.add(i)}transpose(){let t=new _(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(r,e,this.get(e,r));return t}sortRows(t=R){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=R){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,r,n){x(this,t,e,r,n);let i=new _(e-t+1,n-r+1);for(let s=t;s<=e;s++)for(let e=r;e<=n;e++)i.set(s-t,e-r,this.get(s,e));return i}subMatrixRow(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.columns-1),e>r||e<0||e>=this.columns||r<0||r>=this.columns)throw new RangeError("Argument out of range");let n=new _(t.length,r-e+1);for(let i=0;i<t.length;i++)for(let s=e;s<=r;s++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);n.set(i,s-e,this.get(t[i],s))}return n}subMatrixColumn(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r=this.rows-1),e>r||e<0||e>=this.rows||r<0||r>=this.rows)throw new RangeError("Argument out of range");let n=new _(r-e+1,t.length);for(let i=0;i<t.length;i++)for(let s=e;s<=r;s++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);n.set(s-e,i,this.get(s,t[i]))}return n}setSubMatrix(t,e,r){if((t=_.checkMatrix(t)).isEmpty())return this;x(this,e,e+t.rows-1,r,r+t.columns-1);for(let n=0;n<t.rows;n++)for(let i=0;i<t.columns;i++)this.set(e+n,r+i,t.get(n,i));return this}selection(t,e){!function(t,e){if(!a(e))throw new TypeError("row indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.rows)throw new RangeError("row indices are out of range")}(this,t),function(t,e){if(!a(e))throw new TypeError("column indices must be an array");for(let r=0;r<e.length;r++)if(e[r]<0||e[r]>=t.columns)throw new RangeError("column indices are out of range")}(this,e);let r=new _(t.length,e.length);for(let n=0;n<t.length;n++){let i=t[n];for(let t=0;t<e.length;t++){let s=e[t];r.set(n,t,this.get(i,s))}}return r}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let r=0;r<t;r++)e+=this.get(r,r);return e}clone(){let t=new _(this.rows,this.columns);for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)t.set(e,r,this.get(e,r));return t}sum(t){switch(t){case"row":return function(t){let e=S(t.rows);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]+=t.get(r,n);return e}(this);case"column":return function(t){let e=S(t.columns);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]+=t.get(r,n);return e}(this);case void 0:return function(t){let e=0;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e+=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=S(t.rows,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[r]*=t.get(r,n);return e}(this);case"column":return function(t){let e=S(t.columns,1);for(let r=0;r<t.rows;++r)for(let n=0;n<t.columns;++n)e[n]*=t.get(r,n);return e}(this);case void 0:return function(t){let e=1;for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)e*=t.get(r,n);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:n=this.mean(t)}=e;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(t){case"row":if(!a(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,i=t.columns,s=[];for(let o=0;o<n;o++){let n=0,a=0,h=0;for(let e=0;e<i;e++)h=t.get(o,e)-r[o],n+=h,a+=h*h;e?s.push((a-n*n/i)/(i-1)):s.push((a-n*n/i)/i)}return s}(this,r,n);case"column":if(!a(n))throw new TypeError("mean must be an array");return function(t,e,r){const n=t.rows,i=t.columns,s=[];for(let o=0;o<i;o++){let i=0,a=0,h=0;for(let e=0;e<n;e++)h=t.get(e,o)-r[o],i+=h,a+=h*h;e?s.push((a-i*i/n)/(n-1)):s.push((a-i*i/n)/n)}return s}(this,r,n);case void 0:if("number"!=typeof n)throw new TypeError("mean must be a number");return function(t,e,r){const n=t.rows,i=t.columns,s=n*i;let o=0,a=0,h=0;for(let e=0;e<n;e++)for(let n=0;n<i;n++)h=t.get(e,n)-r,o+=h,a+=h*h;return e?(a-o*o/s)/(s-1):(a-o*o/s)/s}(this,r,n);default:throw new Error(`invalid option: ${t}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const r=this.variance(t,e);if(void 0===t)return Math.sqrt(r);for(let t=0;t<r.length;t++)r[t]=Math.sqrt(r[t]);return r}center(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");const{center:r=this.mean(t)}=e;switch(t){case"row":if(!a(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[r])}(this,r),this;case"column":if(!a(r))throw new TypeError("center must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e[n])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)-e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}scale(t,e={}){if("object"==typeof t&&(e=t,t=void 0),"object"!=typeof e)throw new TypeError("options must be an object");let r=e.scale;switch(t){case"row":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.rows;r++){let n=0;for(let e=0;e<t.columns;e++)n+=Math.pow(t.get(r,e),2)/(t.columns-1);e.push(Math.sqrt(n))}return e}(this);else if(!a(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[r])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let r=0;r<t.columns;r++){let n=0;for(let e=0;e<t.rows;e++)n+=Math.pow(t.get(e,r),2)/(t.rows-1);e.push(Math.sqrt(n))}return e}(this);else if(!a(r))throw new TypeError("scale must be an array");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e[n])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let r=0;for(let n=0;n<t.columns;n++)for(let i=0;i<t.rows;i++)r+=Math.pow(t.get(i,n),2)/e;return Math.sqrt(r)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let r=0;r<t.rows;r++)for(let n=0;n<t.columns;n++)t.set(r,n,t.get(r,n)/e)}(this,r),this;default:throw new Error(`invalid option: ${t}`)}}toString(t){return p(this,t)}}function R(t,e){return t-e}N.prototype.klass="Matrix","undefined"!=typeof Symbol&&(N.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return p(this)}),N.random=N.rand,N.randomInt=N.randInt,N.diagonal=N.diag,N.prototype.diagonal=N.prototype.diag,N.identity=N.eye,N.prototype.negate=N.prototype.neg,N.prototype.tensorProduct=N.prototype.kroneckerProduct;class _ extends N{constructor(t,e){if(super(),_.isMatrix(t))return t.clone();if(Number.isInteger(t)&&t>=0){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let r=0;r<t;r++)this.data.push(new Float64Array(e))}else{if(!a(t))throw new TypeError("First argument must be a positive number or an array");{const r=t;if("number"!=typeof(e=(t=r.length)?r[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let n=0;n<t;n++){if(r[n].length!==e)throw new RangeError("Inconsistent array dimensions");if(!r[n].every((t=>"number"==typeof t)))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(r[n]))}}}this.rows=t,this.columns=e}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}removeRow(t){return y(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),y(this,t,!0),e=Float64Array.from(b(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){v(this,t);for(let e=0;e<this.rows;e++){const r=new Float64Array(this.columns-1);for(let n=0;n<t;n++)r[n]=this.data[e][n];for(let n=t+1;n<this.columns;n++)r[n-1]=this.data[e][n];this.data[e]=r}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),v(this,t,!0),e=M(this,e);for(let r=0;r<this.rows;r++){const n=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)n[i]=this.data[r][i];for(n[i++]=e[r];i<this.columns+1;i++)n[i]=this.data[r][i-1];this.data[r]=n}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)+t.get(e,r));return this},t.add=function(t,r){return new e(t).add(r)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)-t.get(e,r));return this},t.sub=function(t,r){return new e(t).sub(r)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)*t.get(e,r));return this},t.mul=function(t,r){return new e(t).mul(r)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)/t.get(e,r));return this},t.div=function(t,r){return new e(t).div(r)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)%t.get(e,r));return this},t.mod=function(t,r){return new e(t).mod(r)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)&t.get(e,r));return this},t.and=function(t,r){return new e(t).and(r)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)|t.get(e,r));return this},t.or=function(t,r){return new e(t).or(r)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)^t.get(e,r));return this},t.xor=function(t,r){return new e(t).xor(r)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)<<t.get(e,r));return this},t.leftShift=function(t,r){return new e(t).leftShift(r)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>t.get(e,r));return this},t.signPropagatingRightShift=function(t,r){return new e(t).signPropagatingRightShift(r)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,this.get(e,r)>>>t.get(e,r));return this},t.rightShift=function(t,r){return new e(t).rightShift(r)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,r){return new e(t).pow(r)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t));return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let r=0;r<this.columns;r++)this.set(e,r,Math.pow(this.get(e,r),t.get(e,r)));return this}}(N,_);class z extends N{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,r){return this.data[t][e]=r,this}get(t,e){return this.data[t][e]}}class A{constructor(t){let e,r,n,i,s,o,a,h,l,u=(t=z.checkMatrix(t)).clone(),c=u.rows,f=u.columns,m=new Float64Array(c),g=1;for(e=0;e<c;e++)m[e]=e;for(h=new Float64Array(c),r=0;r<f;r++){for(e=0;e<c;e++)h[e]=u.get(e,r);for(e=0;e<c;e++){for(l=Math.min(e,r),s=0,n=0;n<l;n++)s+=u.get(e,n)*h[n];h[e]-=s,u.set(e,r,h[e])}for(i=r,e=r+1;e<c;e++)Math.abs(h[e])>Math.abs(h[i])&&(i=e);if(i!==r){for(n=0;n<f;n++)o=u.get(i,n),u.set(i,n,u.get(r,n)),u.set(r,n,o);a=m[i],m[i]=m[r],m[r]=a,g=-g}if(r<c&&0!==u.get(r,r))for(e=r+1;e<c;e++)u.set(e,r,u.get(e,r)/u.get(r,r))}this.LU=u,this.pivotVector=m,this.pivotSign=g}isSingular(){let t=this.LU,e=t.columns;for(let r=0;r<e;r++)if(0===t.get(r,r))return!0;return!1}solve(t){t=_.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let r,n,i,s=t.columns,o=t.subMatrixRow(this.pivotVector,0,s-1),a=e.columns;for(i=0;i<a;i++)for(r=i+1;r<a;r++)for(n=0;n<s;n++)o.set(r,n,o.get(r,n)-o.get(i,n)*e.get(r,i));for(i=a-1;i>=0;i--){for(n=0;n<s;n++)o.set(i,n,o.get(i,n)/e.get(i,i));for(r=0;r<i;r++)for(n=0;n<s;n++)o.set(r,n,o.get(r,n)-o.get(i,n)*e.get(r,i))}return o}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,r=t.columns;for(let n=0;n<r;n++)e*=t.get(n,n);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new _(e,r);for(let i=0;i<e;i++)for(let e=0;e<r;e++)i>e?n.set(i,e,t.get(i,e)):i===e?n.set(i,e,1):n.set(i,e,0);return n}get upperTriangularMatrix(){let t=this.LU,e=t.rows,r=t.columns,n=new _(e,r);for(let i=0;i<e;i++)for(let e=0;e<r;e++)i<=e?n.set(i,e,t.get(i,e)):n.set(i,e,0);return n}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function F(t,e){let r=0;return Math.abs(t)>Math.abs(e)?(r=e/t,Math.abs(t)*Math.sqrt(1+r*r)):0!==e?(r=t/e,Math.abs(e)*Math.sqrt(1+r*r)):0}class I{constructor(t){let e,r,n,i,s=(t=z.checkMatrix(t)).clone(),o=t.rows,a=t.columns,h=new Float64Array(a);for(n=0;n<a;n++){let t=0;for(e=n;e<o;e++)t=F(t,s.get(e,n));if(0!==t){for(s.get(n,n)<0&&(t=-t),e=n;e<o;e++)s.set(e,n,s.get(e,n)/t);for(s.set(n,n,s.get(n,n)+1),r=n+1;r<a;r++){for(i=0,e=n;e<o;e++)i+=s.get(e,n)*s.get(e,r);for(i=-i/s.get(n,n),e=n;e<o;e++)s.set(e,r,s.get(e,r)+i*s.get(e,n))}}h[n]=-t}this.QR=s,this.Rdiag=h}solve(t){t=_.checkMatrix(t);let e=this.QR,r=e.rows;if(t.rows!==r)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let n,i,s,o,a=t.columns,h=t.clone(),l=e.columns;for(s=0;s<l;s++)for(i=0;i<a;i++){for(o=0,n=s;n<r;n++)o+=e.get(n,s)*h.get(n,i);for(o=-o/e.get(s,s),n=s;n<r;n++)h.set(n,i,h.get(n,i)+o*e.get(n,s))}for(s=l-1;s>=0;s--){for(i=0;i<a;i++)h.set(s,i,h.get(s,i)/this.Rdiag[s]);for(n=0;n<s;n++)for(i=0;i<a;i++)h.set(n,i,h.get(n,i)-h.get(s,i)*e.get(n,s))}return h.subMatrix(0,l-1,0,a-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,r=this.QR,n=r.columns,i=new _(n,n);for(t=0;t<n;t++)for(e=0;e<n;e++)t<e?i.set(t,e,r.get(t,e)):t===e?i.set(t,e,this.Rdiag[t]):i.set(t,e,0);return i}get orthogonalMatrix(){let t,e,r,n,i=this.QR,s=i.rows,o=i.columns,a=new _(s,o);for(r=o-1;r>=0;r--){for(t=0;t<s;t++)a.set(t,r,0);for(a.set(r,r,1),e=r;e<o;e++)if(0!==i.get(r,r)){for(n=0,t=r;t<s;t++)n+=i.get(t,r)*a.get(t,e);for(n=-n/i.get(r,r),t=r;t<s;t++)a.set(t,e,a.get(t,e)+n*i.get(t,r))}}return a}}class C{constructor(t,e={}){if((t=z.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let r=t.rows,n=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:s=!0,autoTranspose:o=!1}=e;let a,h=Boolean(i),l=Boolean(s),u=!1;if(r<n)if(o){a=t.transpose(),r=a.rows,n=a.columns,u=!0;let e=h;h=l,l=e}else a=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else a=t.clone();let c=Math.min(r,n),f=Math.min(r+1,n),m=new Float64Array(f),g=new _(r,c),p=new _(n,n),d=new Float64Array(n),w=new Float64Array(r),y=new Float64Array(f);for(let t=0;t<f;t++)y[t]=t;let v=Math.min(r-1,n),b=Math.max(0,Math.min(n-2,r)),M=Math.max(v,b);for(let t=0;t<M;t++){if(t<v){m[t]=0;for(let e=t;e<r;e++)m[t]=F(m[t],a.get(e,t));if(0!==m[t]){a.get(t,t)<0&&(m[t]=-m[t]);for(let e=t;e<r;e++)a.set(e,t,a.get(e,t)/m[t]);a.set(t,t,a.get(t,t)+1)}m[t]=-m[t]}for(let e=t+1;e<n;e++){if(t<v&&0!==m[t]){let n=0;for(let i=t;i<r;i++)n+=a.get(i,t)*a.get(i,e);n=-n/a.get(t,t);for(let i=t;i<r;i++)a.set(i,e,a.get(i,e)+n*a.get(i,t))}d[e]=a.get(t,e)}if(h&&t<v)for(let e=t;e<r;e++)g.set(e,t,a.get(e,t));if(t<b){d[t]=0;for(let e=t+1;e<n;e++)d[t]=F(d[t],d[e]);if(0!==d[t]){d[t+1]<0&&(d[t]=0-d[t]);for(let e=t+1;e<n;e++)d[e]/=d[t];d[t+1]+=1}if(d[t]=-d[t],t+1<r&&0!==d[t]){for(let e=t+1;e<r;e++)w[e]=0;for(let e=t+1;e<r;e++)for(let r=t+1;r<n;r++)w[e]+=d[r]*a.get(e,r);for(let e=t+1;e<n;e++){let n=-d[e]/d[t+1];for(let i=t+1;i<r;i++)a.set(i,e,a.get(i,e)+n*w[i])}}if(l)for(let e=t+1;e<n;e++)p.set(e,t,d[e])}}let x=Math.min(n,r+1);if(v<n&&(m[v]=a.get(v,v)),r<x&&(m[x-1]=0),b+1<x&&(d[b]=a.get(b,x-1)),d[x-1]=0,h){for(let t=v;t<c;t++){for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}for(let t=v-1;t>=0;t--)if(0!==m[t]){for(let e=t+1;e<c;e++){let n=0;for(let i=t;i<r;i++)n+=g.get(i,t)*g.get(i,e);n=-n/g.get(t,t);for(let i=t;i<r;i++)g.set(i,e,g.get(i,e)+n*g.get(i,t))}for(let e=t;e<r;e++)g.set(e,t,-g.get(e,t));g.set(t,t,1+g.get(t,t));for(let e=0;e<t-1;e++)g.set(e,t,0)}else{for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}}if(l)for(let t=n-1;t>=0;t--){if(t<b&&0!==d[t])for(let e=t+1;e<n;e++){let r=0;for(let i=t+1;i<n;i++)r+=p.get(i,t)*p.get(i,e);r=-r/p.get(t+1,t);for(let i=t+1;i<n;i++)p.set(i,e,p.get(i,e)+r*p.get(i,t))}for(let e=0;e<n;e++)p.set(e,t,0);p.set(t,t,1)}let S=x-1,E=0,k=Number.EPSILON;for(;x>0;){let t,e;for(t=x-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+k*Math.abs(m[t]+Math.abs(m[t+1]));if(Math.abs(d[t])<=e||Number.isNaN(d[t])){d[t]=0;break}}if(t===x-2)e=4;else{let r;for(r=x-1;r>=t&&r!==t;r--){let e=(r!==x?Math.abs(d[r]):0)+(r!==t+1?Math.abs(d[r-1]):0);if(Math.abs(m[r])<=k*e){m[r]=0;break}}r===t?e=3:r===x-1?e=1:(e=2,t=r)}switch(t++,e){case 1:{let e=d[x-2];d[x-2]=0;for(let r=x-2;r>=t;r--){let i=F(m[r],e),s=m[r]/i,o=e/i;if(m[r]=i,r!==t&&(e=-o*d[r-1],d[r-1]=s*d[r-1]),l)for(let t=0;t<n;t++)i=s*p.get(t,r)+o*p.get(t,x-1),p.set(t,x-1,-o*p.get(t,r)+s*p.get(t,x-1)),p.set(t,r,i)}break}case 2:{let e=d[t-1];d[t-1]=0;for(let n=t;n<x;n++){let i=F(m[n],e),s=m[n]/i,o=e/i;if(m[n]=i,e=-o*d[n],d[n]=s*d[n],h)for(let e=0;e<r;e++)i=s*g.get(e,n)+o*g.get(e,t-1),g.set(e,t-1,-o*g.get(e,n)+s*g.get(e,t-1)),g.set(e,n,i)}break}case 3:{const e=Math.max(Math.abs(m[x-1]),Math.abs(m[x-2]),Math.abs(d[x-2]),Math.abs(m[t]),Math.abs(d[t])),i=m[x-1]/e,s=m[x-2]/e,o=d[x-2]/e,a=m[t]/e,u=d[t]/e,c=((s+i)*(s-i)+o*o)/2,f=i*o*(i*o);let w=0;0===c&&0===f||(w=c<0?0-Math.sqrt(c*c+f):Math.sqrt(c*c+f),w=f/(c+w));let y=(a+i)*(a-i)+w,v=a*u;for(let e=t;e<x-1;e++){let i=F(y,v);0===i&&(i=Number.MIN_VALUE);let s=y/i,o=v/i;if(e!==t&&(d[e-1]=i),y=s*m[e]+o*d[e],d[e]=s*d[e]-o*m[e],v=o*m[e+1],m[e+1]=s*m[e+1],l)for(let t=0;t<n;t++)i=s*p.get(t,e)+o*p.get(t,e+1),p.set(t,e+1,-o*p.get(t,e)+s*p.get(t,e+1)),p.set(t,e,i);if(i=F(y,v),0===i&&(i=Number.MIN_VALUE),s=y/i,o=v/i,m[e]=i,y=s*d[e]+o*m[e+1],m[e+1]=-o*d[e]+s*m[e+1],v=o*d[e+1],d[e+1]=s*d[e+1],h&&e<r-1)for(let t=0;t<r;t++)i=s*g.get(t,e)+o*g.get(t,e+1),g.set(t,e+1,-o*g.get(t,e)+s*g.get(t,e+1)),g.set(t,e,i)}d[x-2]=y,E+=1;break}case 4:if(m[t]<=0&&(m[t]=m[t]<0?-m[t]:0,l))for(let e=0;e<=S;e++)p.set(e,t,-p.get(e,t));for(;t<S&&!(m[t]>=m[t+1]);){let e=m[t];if(m[t]=m[t+1],m[t+1]=e,l&&t<n-1)for(let r=0;r<n;r++)e=p.get(r,t+1),p.set(r,t+1,p.get(r,t)),p.set(r,t,e);if(h&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);t++}E=0,x--}}if(u){let t=p;p=g,g=t}this.m=r,this.n=n,this.s=m,this.U=g,this.V=p}solve(t){let e=t,r=this.threshold,n=this.s.length,i=_.zeros(n,n);for(let t=0;t<n;t++)Math.abs(this.s[t])<=r?i.set(t,t,0):i.set(t,t,1/this.s[t]);let s=this.U,o=this.rightSingularVectors,a=o.mmul(i),h=o.rows,l=s.rows,u=_.zeros(h,l);for(let t=0;t<h;t++)for(let e=0;e<l;e++){let r=0;for(let i=0;i<n;i++)r+=a.get(t,i)*s.get(e,i);u.set(t,e,r)}return u.mmul(e)}solveForDiagonal(t){return this.solve(_.diag(t))}inverse(){let t=this.V,e=this.threshold,r=t.rows,n=t.columns,i=new _(r,this.s.length);for(let s=0;s<r;s++)for(let r=0;r<n;r++)Math.abs(this.s[r])>e&&i.set(s,r,t.get(s,r)/this.s[r]);let s=this.U,o=s.rows,a=s.columns,h=new _(r,o);for(let t=0;t<r;t++)for(let e=0;e<o;e++){let r=0;for(let n=0;n<a;n++)r+=i.get(t,n)*s.get(e,n);h.set(t,e,r)}return h}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,r=this.s;for(let n=0,i=r.length;n<i;n++)r[n]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return _.diag(this.s)}}function T(t,e,r,n,i){let s=r*n*n,o=_.eye(e.length,e.length,s);const a=i(e);let h=new Float64Array(t.x.length);for(let e=0;e<t.x.length;e++)h[e]=a(t.x[e]);let l=function(t,e,r,n,i){const s=r.length,o=t.x.length;let a=new Array(s);for(let h=0;h<s;h++){a[h]=new Array(o);let s=r.slice();s[h]+=n;let l=i(s);for(let r=0;r<o;r++)a[h][r]=e[r]-l(t.x[r])}return new _(a)}(t,h,e,n,i),u=function(t,e){const r=t.x.length;let n=new Array(r);for(let i=0;i<r;i++)n[i]=[t.y[i]-e[i]];return new _(n)}(t,h),c=function(t,e=!1){return t=z.checkMatrix(t),e?new C(t).inverse():function(t,e,r=!1){return t=z.checkMatrix(t),e=z.checkMatrix(e),r?new C(t).solve(e):t.isSquare()?new A(t).solve(e):new I(t).solve(e)}(t,_.eye(t.rows))}(o.add(l.mmul(l.transpose())));return(e=(e=new _([e])).sub(c.mmul(l).mmul(u).mul(n).transpose())).to1DArray()}function P(t,e,r={}){let{maxIterations:n=100,gradientDifference:o=.1,damping:a=0,errorTolerance:h=.01,minValues:l,maxValues:u,initialValues:c}=r;if(a<=0)throw new Error("The damping option must be a positive number");if(!t.x||!t.y)throw new Error("The data parameter must have x and y elements");if(!i(t.x)||t.x.length<2||!i(t.y)||t.y.length<2)throw new Error("The data parameter elements must be an array with more than 2 points");if(t.x.length!==t.y.length)throw new Error("The data parameter elements must have the same size");let f=c||new Array(e.length).fill(1),m=f.length;if(u=u||new Array(m).fill(Number.MAX_SAFE_INTEGER),l=l||new Array(m).fill(Number.MIN_SAFE_INTEGER),u.length!==l.length)throw new Error("minValues and maxValues must be the same size");if(!i(f))throw new Error("initialValues must be an array");let g,p=s(t,f,e),d=p<=h;for(g=0;g<n&&!d;g++){f=T(t,f,a,o,e);for(let t=0;t<m;t++)f[t]=Math.min(Math.max(l[t],f[t]),u[t]);if(p=s(t,f,e),isNaN(p))break;d=p<=h}return{parameterValues:f,parameterError:p,iterations:g}}},9378:function(t,e,r){var n=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var i=n(r(4517));function s(t,e){var r=function(r){return i.empty(t).map((function(){return i.filled(e,r)}))},n=[];return n.push(r(-1)),n.push(r(1/0)),n.push(r(0)),n}function o(t,e,r,n,i){e=Math.floor(e);var s=t[0][e],o=t[1][e];if(t[2][e],r>=o[0])return 0;for(var h=0;h<s.length;h++)if(n===s[h])return 0;return a(t,e,r,n,i)}function a(t,e,r,n,i){var s=t[0][e],o=t[1][e],a=t[2][e];if(r>=o[0])return 0;o[0]=r,s[0]=n,a[0]=i;for(var h=0,l=0;;){var u=2*h+1,c=u+1,f=t[0][0].length;if(u>=f)break;if(c>=f){if(!(o[u]>r))break;l=u}else if(o[u]>=o[c]){if(!(r<o[u]))break;l=u}else{if(!(r<o[c]))break;l=c}o[h]=o[l],s[h]=s[l],a[h]=a[l],h=l}return o[h]=r,s[h]=n,a[h]=i,1}function h(t,e,r,n){for(;2*n+1<r;){var i=2*n+1,s=i+1,o=n;if(t[o]<t[i]&&(o=i),s<r&&t[o]<t[s]&&(o=s),o===n)break;var a=t[n];t[n]=t[o],t[o]=a;var h=e[n];e[n]=e[o],e[o]=h,n=o}}e.makeHeap=s,e.rejectionSample=function(t,e,r){for(var n=i.zeros(t),s=0;s<t;s++){for(var o=!0,a=0;o;){a=i.tauRandInt(e,r);for(var h=!1,l=0;l<s;l++)if(a===n[l]){h=!0;break}h||(o=!1)}n[s]=a}return n},e.heapPush=o,e.uncheckedHeapPush=a,e.buildCandidates=function(t,e,r,n,a){for(var h=s(e,n),l=0;l<e;l++)for(var u=0;u<r;u++)if(!(t[0][l][u]<0)){var c=t[0][l][u],f=t[2][l][u],m=i.tauRand(a);o(h,l,m,c,f),o(h,c,m,l,f),t[2][l][u]=0}return h},e.deheapSort=function(t){for(var e=t[0],r=t[1],n=0;n<e.length;n++)for(var i=e[n],s=r[n],o=0;o<i.length-1;o++){var a=i.length-o-1,l=s.length-o-1,u=i[0];i[0]=i[a],i[a]=u;var c=s[0];s[0]=s[l],s[l]=c,h(s,i,l,0)}return{indices:e,weights:r}},e.smallestFlagged=function(t,e){for(var r=t[0][e],n=t[1][e],i=t[2][e],s=1/0,o=-1,a=0;a>r.length;a++)1===i[a]&&n[a]<s&&(s=n[a],o=a);return o>=0?(i[o]=0,Math.floor(r[o])):-1}},4221:(t,e,r)=>{var n=r(4364);e.u=n.UMAP},5686:function(t,e,r){var n,i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}},o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(4517)),h=function(){function t(t,e,r,n){if(this.entries=new Map,this.nRows=0,this.nCols=0,t.length!==e.length||t.length!==r.length)throw new Error("rows, cols and values arrays must all have the same length");this.nRows=n[0],this.nCols=n[1];for(var i=0;i<r.length;i++){var s=t[i],o=e[i];this.checkDims(s,o);var a=this.makeKey(s,o);this.entries.set(a,{value:r[i],row:s,col:o})}}return t.prototype.makeKey=function(t,e){return t+":"+e},t.prototype.checkDims=function(t,e){if(!(t<this.nRows&&e<this.nCols))throw new Error("row and/or col specified outside of matrix dimensions")},t.prototype.set=function(t,e,r){this.checkDims(t,e);var n=this.makeKey(t,e);this.entries.has(n)?this.entries.get(n).value=r:this.entries.set(n,{value:r,row:t,col:e})},t.prototype.get=function(t,e,r){void 0===r&&(r=0),this.checkDims(t,e);var n=this.makeKey(t,e);return this.entries.has(n)?this.entries.get(n).value:r},t.prototype.getAll=function(t){void 0===t&&(t=!0);var e=[];return this.entries.forEach((function(t){e.push(t)})),t&&e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row})),e},t.prototype.getDims=function(){return[this.nRows,this.nCols]},t.prototype.getRows=function(){return Array.from(this.entries,(function(t){var e=i(t,2);return e[0],e[1].row}))},t.prototype.getCols=function(){return Array.from(this.entries,(function(t){var e=i(t,2);return e[0],e[1].col}))},t.prototype.getValues=function(){return Array.from(this.entries,(function(t){var e=i(t,2);return e[0],e[1].value}))},t.prototype.forEach=function(t){this.entries.forEach((function(e){return t(e.value,e.row,e.col)}))},t.prototype.map=function(e){var r=[];this.entries.forEach((function(t){r.push(e(t.value,t.row,t.col))}));var n=[this.nRows,this.nCols];return new t(this.getRows(),this.getCols(),r,n)},t.prototype.toArray=function(){var t=this,e=a.empty(this.nRows).map((function(){return a.zeros(t.nCols)}));return this.entries.forEach((function(t){e[t.row][t.col]=t.value})),e},t}();e.SparseMatrix=h,e.transpose=function(t){var e=[],r=[],n=[];t.forEach((function(t,i,s){e.push(i),r.push(s),n.push(t)}));var i=[t.nCols,t.nRows];return new h(r,e,n,i)},e.identity=function(t){for(var e=i(t,1)[0],r=new h([],[],[],t),n=0;n<e;n++)r.set(n,n,1);return r},e.pairwiseMultiply=function(t,e){return u(t,e,(function(t,e){return t*e}))},e.add=function(t,e){return u(t,e,(function(t,e){return t+e}))},e.subtract=function(t,e){return u(t,e,(function(t,e){return t-e}))},e.maximum=function(t,e){return u(t,e,(function(t,e){return t>e?t:e}))},e.multiplyScalar=function(t,e){return t.map((function(t){return t*e}))},e.eliminateZeros=function(t){for(var e=new Set,r=t.getValues(),n=t.getRows(),i=t.getCols(),s=0;s<r.length;s++)0===r[s]&&e.add(s);var o=function(t,r){return!e.has(r)},a=r.filter(o),l=n.filter(o),u=i.filter(o);return new h(l,u,a,t.getDims())},e.normalize=function(t,e){var r,n;void 0===e&&(e="l2");var i=l[e],o=new Map;t.forEach((function(t,e,r){var n=o.get(e)||[];n.push(r),o.set(e,n)}));var a=new h([],[],[],t.getDims()),u=function(e){for(var r=o.get(e).sort(),n=r.map((function(r){return t.get(e,r)})),s=i(n),h=0;h<s.length;h++)a.set(e,r[h],s[h])};try{for(var c=s(o.keys()),f=c.next();!f.done;f=c.next())u(f.value)}catch(t){r={error:t}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return a};var l=((n={}).max=function(t){for(var e=-1/0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return t.map((function(t){return t/e}))},n.l1=function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r];return t.map((function(t){return t/e}))},n.l2=function(t){for(var e=0,r=0;r<t.length;r++)e+=Math.pow(t[r],2);return t.map((function(t){return Math.sqrt(Math.pow(t,2)/e)}))},n);function u(t,e,r){for(var n=new Set,i=[],s=[],o=[],a=function(n,a){i.push(n),s.push(a);var h=r(t.get(n,a),e.get(n,a));o.push(h)},l=t.getValues(),u=t.getRows(),c=t.getCols(),f=0;f<l.length;f++){var m=(w=u[f])+":"+(y=c[f]);n.add(m),a(w,y)}var g=e.getValues(),p=e.getRows(),d=e.getCols();for(f=0;f<g.length;f++){var w,y;m=(w=p[f])+":"+(y=d[f]),n.has(m)||a(w,y)}var v=[t.nRows,t.nCols];return new h(i,s,o,v)}e.getCSR=function(t){var e=[];t.forEach((function(t,r,n){e.push({value:t,row:r,col:n})})),e.sort((function(t,e){return t.row===e.row?t.col-e.col:t.row-e.row}));for(var r=[],n=[],i=[],s=-1,o=0;o<e.length;o++){var a=e[o],h=a.row,l=a.col,u=a.value;h!==s&&(s=h,i.push(o)),r.push(l),n.push(u)}return{indices:r,values:n,indptr:i}}},760:function(t,e,r){var n=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}},i=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var s=i(r(9378)),o=i(r(5686)),a=i(r(2320)),h=i(r(4517));e.makeNNDescent=function(t,e){return function(r,n,i,o,a,l,u,c){void 0===o&&(o=10),void 0===a&&(a=50),void 0===l&&(l=.001),void 0===u&&(u=.5),void 0===c&&(c=!0);for(var f=r.length,m=s.makeHeap(r.length,i),g=0;g<r.length;g++)for(var p=s.rejectionSample(i,r.length,e),d=0;d<p.length;d++){var w=t(r[g],r[p[d]]);s.heapPush(m,g,w,p[d],1),s.heapPush(m,p[d],w,g,1)}if(c)for(var y=0;y<n.length;y++)for(g=0;g<n[y].length&&!(n[y][g]<0);g++)for(d=g+1;d<n[y].length&&!(n[y][d]<0);d++)w=t(r[n[y][g]],r[n[y][d]]),s.heapPush(m,n[y][g],w,n[y][d],1),s.heapPush(m,n[y][d],w,n[y][g],1);for(y=0;y<o;y++){var v=s.buildCandidates(m,f,i,a,e),b=0;for(g=0;g<f;g++)for(d=0;d<a;d++){var M=Math.floor(v[0][g][d]);if(!(M<0||h.tauRand(e)<u))for(var x=0;x<a;x++){var S=Math.floor(v[0][g][x]),E=v[2][g][d],k=v[2][g][x];S<0||!E&&!k||(w=t(r[M],r[S]),b+=s.heapPush(m,M,w,S,1),b+=s.heapPush(m,S,w,M,1))}}if(b<=l*i*r.length)break}return s.deheapSort(m)}},e.makeInitializations=function(t){return{initFromRandom:function(e,r,n,i,o){for(var a=0;a<n.length;a++)for(var l=h.rejectionSample(e,r.length,o),u=0;u<l.length;u++)if(!(l[u]<0)){var c=t(r[l[u]],n[a]);s.heapPush(i,a,c,l[u],1)}},initFromTree:function(e,r,n,i,o){for(var h=0;h<n.length;h++)for(var l=a.searchFlatTree(n[h],e,o),u=0;u<l.length;u++){if(l[u]<0)return;var c=t(r[l[u]],n[h]);s.heapPush(i,h,c,l[u],1)}}}},e.makeInitializedNNSearch=function(t){return function(e,r,i,a){for(var h,l,u=o.getCSR(r),c=u.indices,f=u.indptr,m=0;m<a.length;m++)for(var g=new Set(i[0][m]);;){var p=s.smallestFlagged(i,m);if(-1===p)break;var d=c.slice(f[p],f[p+1]);try{for(var w=n(d),y=w.next();!y.done;y=w.next()){var v=y.value;if(v!==p&&-1!==v&&!g.has(v)){var b=t(e[v],a[m]);s.uncheckedHeapPush(i,m,b,v,1),g.add(v)}}}catch(t){h={error:t}}finally{try{y&&!y.done&&(l=w.return)&&l.call(w)}finally{if(h)throw h.error}}}return i}},e.initializeSearch=function(t,e,r,i,o,a,h){var l,u,c=s.makeHeap(r.length,i);if(o(i,e,r,c,h),t)try{for(var f=n(t),m=f.next();!m.done;m=f.next())a(m.value,e,r,c,h)}catch(t){l={error:t}}finally{try{m&&!m.done&&(u=f.return)&&u.call(f)}finally{if(l)throw l.error}}return c}},2320:function(t,e,r){var n=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},i=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(n(arguments[e]));return t},s=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}},o=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e};Object.defineProperty(e,"__esModule",{value:!0});var a=o(r(4517)),h=function(t,e,r,n){this.hyperplanes=t,this.offsets=e,this.children=r,this.indices=n};function l(t,e,r,n,i){if(void 0===r&&(r=30),e.length>r){var s=function(t,e,r){var n=t[0].length,i=a.tauRandInt(e.length,r),s=a.tauRandInt(e.length,r);s=(s+=i===s?1:0)%e.length;for(var o=e[i],h=e[s],l=0,u=a.zeros(n),c=0;c<u.length;c++)u[c]=t[o][c]-t[h][c],l-=u[c]*(t[o][c]+t[h][c])/2;var f=0,m=0,g=a.zeros(e.length);for(c=0;c<e.length;c++){for(var p=l,d=0;d<n;d++)p+=u[d]*t[e[c]][d];0===p?(g[c]=a.tauRandInt(2,r),0===g[c]?f+=1:m+=1):p>0?(g[c]=0,f+=1):(g[c]=1,m+=1)}var w=a.zeros(f),y=a.zeros(m);for(f=0,m=0,c=0;c<g.length;c++)0===g[c]?(w[f]=e[c],f+=1):(y[m]=e[c],m+=1);return{indicesLeft:w,indicesRight:y,hyperplane:u,offset:l}}(t,e,i),o=s.indicesLeft,h=s.indicesRight,u=s.hyperplane,c=s.offset;return{leftChild:l(t,o,r,n+1,i),rightChild:l(t,h,r,n+1,i),isLeaf:!1,hyperplane:u,offset:c}}return{indices:e,isLeaf:!0}}function u(t,e,r,n,s,o,a){var h;if(t.isLeaf)return n[o][0]=-a,(h=s[a]).splice.apply(h,i([0,t.indices.length],t.indices)),{nodeNum:o,leafNum:a+=1};e[o]=t.hyperplane,r[o]=t.offset,n[o][0]=o+1;var l=o,c=u(t.leftChild,e,r,n,s,o+1,a);return o=c.nodeNum,a=c.leafNum,n[l][1]=o+1,{nodeNum:(c=u(t.rightChild,e,r,n,s,o+1,a)).nodeNum,leafNum:c.leafNum}}function c(t){return t.isLeaf?1:1+c(t.leftChild)+c(t.rightChild)}function f(t){return t.isLeaf?1:f(t.leftChild)+f(t.rightChild)}function m(t,e,r,n){for(var i=e,s=0;s<r.length;s++)i+=t[s]*r[s];return 0===i?a.tauRandInt(2,n):i>0?0:1}e.FlatTree=h,e.makeForest=function(t,e,r,n){var i=Math.max(10,e);return a.range(r).map((function(e,r){return function(t,e,r,n){return void 0===e&&(e=30),l(t,a.range(t.length),e,r,n)}(t,i,r,n)})).map((function(t){return function(t,e){var r=c(t),n=f(t),i=a.range(r).map((function(){return a.zeros(t.hyperplane?t.hyperplane.length:0)})),s=a.zeros(r),o=a.range(r).map((function(){return[-1,-1]})),l=a.range(n).map((function(){return a.range(e).map((function(){return-1}))}));return u(t,i,s,o,l,0,0),new h(i,s,o,l)}(t,i)}))},e.makeLeafArray=function(t){var e,r;if(t.length>0){var n=[];try{for(var o=s(t),a=o.next();!a.done;a=o.next()){var h=a.value;n.push.apply(n,i(h.indices))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}return n}return[[-1]]},e.searchFlatTree=function(t,e,r){for(var n=0;e.children[n][0]>0;)n=0===m(e.hyperplanes[n],e.offsets[n],t,r)?e.children[n][0]:e.children[n][1];var i=-1*e.children[n][0];return e.indices[i]}},4364:function(t,e,r){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))((function(i,s){function o(t){try{h(n.next(t))}catch(t){s(t)}}function a(t){try{h(n.throw(t))}catch(t){s(t)}}function h(t){t.done?i(t.value):new r((function(e){e(t.value)})).then(o,a)}h((n=n.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},s=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,i,s=r.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},o=this&&this.__spread||function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(s(arguments[e]));return t},a=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},h=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var l=a(r(9378)),u=a(r(5686)),c=a(r(760)),f=a(r(2320)),m=a(r(4517)),g=h(r(9251)),p=1e-5,d=.001,w=function(){function t(t){void 0===t&&(t={});var e=this;this.learningRate=1,this.localConnectivity=1,this.minDist=.1,this.nComponents=2,this.nEpochs=0,this.nNeighbors=15,this.negativeSampleRate=5,this.random=Math.random,this.repulsionStrength=1,this.setOpMixRatio=1,this.spread=1,this.transformQueueSize=4,this.targetMetric="categorical",this.targetWeight=.5,this.targetNNeighbors=this.nNeighbors,this.distanceFn=y,this.isInitialized=!1,this.rpForest=[],this.embedding=[],this.optimizationState=new v;var r=function(r){void 0!==t[r]&&(e[r]=t[r])};r("distanceFn"),r("learningRate"),r("localConnectivity"),r("minDist"),r("nComponents"),r("nEpochs"),r("nNeighbors"),r("negativeSampleRate"),r("random"),r("repulsionStrength"),r("setOpMixRatio"),r("spread"),r("transformQueueSize")}return t.prototype.fit=function(t){return this.initializeFit(t),this.optimizeLayout(),this.embedding},t.prototype.fitAsync=function(t,e){return void 0===e&&(e=function(){return!0}),n(this,void 0,void 0,(function(){return i(this,(function(r){switch(r.label){case 0:return this.initializeFit(t),[4,this.optimizeLayoutAsync(e)];case 1:return r.sent(),[2,this.embedding]}}))}))},t.prototype.setSupervisedProjection=function(t,e){void 0===e&&(e={}),this.Y=t,this.targetMetric=e.targetMetric||this.targetMetric,this.targetWeight=e.targetWeight||this.targetWeight,this.targetNNeighbors=e.targetNNeighbors||this.targetNNeighbors},t.prototype.setPrecomputedKNN=function(t,e){this.knnIndices=t,this.knnDistances=e},t.prototype.initializeFit=function(t){if(t.length<=this.nNeighbors)throw new Error("Not enough data points ("+t.length+") to create nNeighbors: "+this.nNeighbors+". Add more data points or adjust the configuration.");if(this.X===t&&this.isInitialized)return this.getNEpochs();if(this.X=t,!this.knnIndices&&!this.knnDistances){var e=this.nearestNeighbors(t);this.knnIndices=e.knnIndices,this.knnDistances=e.knnDistances}this.graph=this.fuzzySimplicialSet(t,this.nNeighbors,this.setOpMixRatio),this.makeSearchFns(),this.searchGraph=this.makeSearchGraph(t),this.processGraphForSupervisedProjection();var r=this.initializeSimplicialSetEmbedding(),n=r.head,i=r.tail,s=r.epochsPerSample;return this.optimizationState.head=n,this.optimizationState.tail=i,this.optimizationState.epochsPerSample=s,this.initializeOptimization(),this.prepareForOptimizationLoop(),this.isInitialized=!0,this.getNEpochs()},t.prototype.makeSearchFns=function(){var t=c.makeInitializations(this.distanceFn),e=t.initFromTree,r=t.initFromRandom;this.initFromTree=e,this.initFromRandom=r,this.search=c.makeInitializedNNSearch(this.distanceFn)},t.prototype.makeSearchGraph=function(t){for(var e=this.knnIndices,r=this.knnDistances,n=[t.length,t.length],i=new u.SparseMatrix([],[],[],n),s=0;s<e.length;s++)for(var o=e[s],a=r[s],h=0;h<o.length;h++){var l=o[h],c=a[h];c>0&&i.set(s,l,c)}var f=u.transpose(i);return u.maximum(i,f)},t.prototype.transform=function(t){var e=this,r=this.X;if(void 0===r||0===r.length)throw new Error("No data has been fit.");var n=Math.floor(this.nNeighbors*this.transformQueueSize);n=Math.min(r.length,n);var i=c.initializeSearch(this.rpForest,r,t,n,this.initFromRandom,this.initFromTree,this.random),s=this.search(r,this.searchGraph,i,t),o=l.deheapSort(s),a=o.indices,h=o.weights;a=a.map((function(t){return t.slice(0,e.nNeighbors)})),h=h.map((function(t){return t.slice(0,e.nNeighbors)}));var f=Math.max(0,this.localConnectivity-1),g=this.smoothKNNDistance(h,this.nNeighbors,f),p=g.sigmas,d=g.rhos,w=this.computeMembershipStrengths(a,h,p,d),y=w.rows,v=w.cols,b=w.vals,M=[t.length,r.length],x=new u.SparseMatrix(y,v,b,M),S=u.normalize(x,"l1"),E=u.getCSR(S),N=t.length,R=k(m.reshape2d(E.indices,N,this.nNeighbors),m.reshape2d(E.values,N,this.nNeighbors),this.embedding),_=this.nEpochs?this.nEpochs/3:x.nRows<=1e4?100:30,z=x.getValues().reduce((function(t,e){return e>t?e:t}),0);x=x.map((function(t){return t<z/_?0:t})),x=u.eliminateZeros(x);var A=this.makeEpochsPerSample(x.getValues(),_),F=x.getRows(),I=x.getCols();return this.assignOptimizationStateParameters({headEmbedding:R,tailEmbedding:this.embedding,head:F,tail:I,currentEpoch:0,nEpochs:_,nVertices:x.getDims()[1],epochsPerSample:A}),this.prepareForOptimizationLoop(),this.optimizeLayout()},t.prototype.processGraphForSupervisedProjection=function(){var t=this.Y,e=this.X;if(t){if(t.length!==e.length)throw new Error("Length of X and y must be equal");if("categorical"===this.targetMetric){var r=this.targetWeight<1?1/(1-this.targetWeight)*2.5:1e12;this.graph=this.categoricalSimplicialSetIntersection(this.graph,t,r)}}},t.prototype.step=function(){var t=this.optimizationState.currentEpoch;return t<this.getNEpochs()&&this.optimizeLayoutStep(t),this.optimizationState.currentEpoch},t.prototype.getEmbedding=function(){return this.embedding},t.prototype.nearestNeighbors=function(t){var e,r=this.distanceFn,n=this.nNeighbors,i=c.makeNNDescent(r,this.random),s=5+Math.floor(.5==(e=Math.pow(t.length,.5)/20)?0:Math.round(e)),o=Math.max(5,Math.floor(Math.round(function(t){return Math.log(t)/Math.log(2)}(t.length))));this.rpForest=f.makeForest(t,n,s,this.random);var a=i(t,f.makeLeafArray(this.rpForest),n,o);return{knnIndices:a.indices,knnDistances:a.weights}},t.prototype.fuzzySimplicialSet=function(t,e,r){void 0===r&&(r=1);var n=this,i=n.knnIndices,s=void 0===i?[]:i,o=n.knnDistances,a=void 0===o?[]:o,h=n.localConnectivity,l=this.smoothKNNDistance(a,e,h),c=l.sigmas,f=l.rhos,m=this.computeMembershipStrengths(s,a,c,f),g=m.rows,p=m.cols,d=m.vals,w=[t.length,t.length],y=new u.SparseMatrix(g,p,d,w),v=u.transpose(y),b=u.pairwiseMultiply(y,v),M=u.subtract(u.add(y,v),b),x=u.multiplyScalar(M,r),S=u.multiplyScalar(b,1-r);return u.add(x,S)},t.prototype.categoricalSimplicialSetIntersection=function(t,e,r,n){void 0===n&&(n=1);var i=S(t,e,n,r);return E(i=u.eliminateZeros(i))},t.prototype.smoothKNNDistance=function(t,e,r,n,i){void 0===r&&(r=1),void 0===n&&(n=64),void 0===i&&(i=1);for(var s=Math.log(e)/Math.log(2)*i,o=m.zeros(t.length),a=m.zeros(t.length),h=0;h<t.length;h++){var l=0,u=1/0,c=1,f=t[h],g=f.filter((function(t){return t>0}));if(g.length>=r){var w=Math.floor(r),y=r-w;w>0?(o[h]=g[w-1],y>p&&(o[h]+=y*(g[w]-g[w-1]))):o[h]=y*g[0]}else g.length>0&&(o[h]=m.max(g));for(var v=0;v<n;v++){for(var b=0,M=1;M<t[h].length;M++){var x=t[h][M]-o[h];b+=x>0?Math.exp(-x/c):1}if(Math.abs(b-s)<p)break;b>s?c=(l+(u=c))/2:(l=c,u===1/0?c*=2:c=(l+u)/2)}if(a[h]=c,o[h]>0){var S=m.mean(f);a[h]<d*S&&(a[h]=d*S)}else{var E=m.mean(t.map(m.mean));a[h]<d*E&&(a[h]=d*E)}}return{sigmas:a,rhos:o}},t.prototype.computeMembershipStrengths=function(t,e,r,n){for(var i=t.length,s=t[0].length,o=m.zeros(i*s),a=m.zeros(i*s),h=m.zeros(i*s),l=0;l<i;l++)for(var u=0;u<s;u++){var c=0;-1!==t[l][u]&&(c=t[l][u]===l?0:e[l][u]-n[l]<=0?1:Math.exp(-(e[l][u]-n[l])/r[l]),o[l*s+u]=l,a[l*s+u]=t[l][u],h[l*s+u]=c)}return{rows:o,cols:a,vals:h}},t.prototype.initializeSimplicialSetEmbedding=function(){for(var t=this,e=this.getNEpochs(),r=this.nComponents,n=this.graph.getValues(),i=0,s=0;s<n.length;s++){var o=n[s];i<n[s]&&(i=o)}var a=this.graph.map((function(t){return t<i/e?0:t}));this.embedding=m.zeros(a.nRows).map((function(){return m.zeros(r).map((function(){return 20*m.tauRand(t.random)-10}))}));var h=[],l=[],u=[],c=a.getAll();for(s=0;s<c.length;s++){var f=c[s];f.value&&(h.push(f.value),u.push(f.row),l.push(f.col))}return{head:l,tail:u,epochsPerSample:this.makeEpochsPerSample(h,e)}},t.prototype.makeEpochsPerSample=function(t,e){var r=m.filled(t.length,-1),n=m.max(t),i=t.map((function(t){return t/n*e}));return i.forEach((function(t,n){t>0&&(r[n]=e/i[n])})),r},t.prototype.assignOptimizationStateParameters=function(t){Object.assign(this.optimizationState,t)},t.prototype.prepareForOptimizationLoop=function(){var t=this,e=t.repulsionStrength,r=t.learningRate,n=t.negativeSampleRate,i=this.optimizationState,s=i.epochsPerSample,a=i.headEmbedding,h=i.tailEmbedding,l=a[0].length,u=a.length===h.length,c=s.map((function(t){return t/n})),f=o(c),m=o(s);this.assignOptimizationStateParameters({epochOfNextSample:m,epochOfNextNegativeSample:f,epochsPerNegativeSample:c,moveOther:u,initialAlpha:r,alpha:r,gamma:e,dim:l})},t.prototype.initializeOptimization=function(){var t=this.embedding,e=this.embedding,r=this.optimizationState,n=r.head,i=r.tail,s=r.epochsPerSample,o=this.getNEpochs(),a=this.graph.nCols,h=x(this.spread,this.minDist),l=h.a,u=h.b;this.assignOptimizationStateParameters({headEmbedding:t,tailEmbedding:e,head:n,tail:i,epochsPerSample:s,a:l,b:u,nEpochs:o,nVertices:a})},t.prototype.optimizeLayoutStep=function(t){for(var e=this.optimizationState,r=e.head,n=e.tail,i=e.headEmbedding,s=e.tailEmbedding,o=e.epochsPerSample,a=e.epochOfNextSample,h=e.epochOfNextNegativeSample,l=e.epochsPerNegativeSample,u=e.moveOther,c=e.initialAlpha,f=e.alpha,g=e.gamma,p=e.a,d=e.b,w=e.dim,y=e.nEpochs,v=e.nVertices,x=0;x<o.length;x++)if(!(a[x]>t)){var S=r[x],E=n[x],k=i[S],N=s[E],R=M(k,N),_=0;R>0&&(_=-2*p*d*Math.pow(R,d-1),_/=p*Math.pow(R,d)+1);for(var z=0;z<w;z++){var A=b(_*(k[z]-N[z]),4);k[z]+=A*f,u&&(N[z]+=-A*f)}a[x]+=o[x];for(var F=Math.floor((t-h[x])/l[x]),I=0;I<F;I++){var C=m.tauRandInt(v,this.random),T=s[C],P=M(k,T),D=0;if(P>0)D=2*g*d,D/=(.001+P)*(p*Math.pow(P,d)+1);else if(S===C)continue;for(z=0;z<w;z++)A=4,D>0&&(A=b(D*(k[z]-T[z]),4)),k[z]+=A*f}h[x]+=F*l[x]}return e.alpha=c*(1-t/y),e.currentEpoch+=1,i},t.prototype.optimizeLayoutAsync=function(t){var e=this;return void 0===t&&(t=function(){return!0}),new Promise((function(r,s){var o=function(){return n(e,void 0,void 0,(function(){var e,n,a,h,l,u;return i(this,(function(i){try{if(e=this.optimizationState,n=e.nEpochs,a=e.currentEpoch,this.embedding=this.optimizeLayoutStep(a),h=this.optimizationState.currentEpoch,l=!1===t(h),u=h===n,l||u)return[2,r(u)];setTimeout((function(){return o()}),0)}catch(t){s(t)}return[2]}))}))};setTimeout((function(){return o()}),0)}))},t.prototype.optimizeLayout=function(t){void 0===t&&(t=function(){return!0});for(var e=!1,r=[];!e;){var n=this.optimizationState,i=n.nEpochs,s=n.currentEpoch;r=this.optimizeLayoutStep(s);var o=this.optimizationState.currentEpoch,a=!1===t(o);e=o===i||a}return r},t.prototype.getNEpochs=function(){var t=this.graph;if(this.nEpochs>0)return this.nEpochs;var e=t.nRows;return e<=2500?500:e<=5e3?400:e<=7500?300:200},t}();function y(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return Math.sqrt(r)}e.UMAP=w,e.euclidean=y,e.cosine=function(t,e){for(var r=0,n=0,i=0,s=0;s<t.length;s++)r+=t[s]*e[s],n+=Math.pow(t[s],2),i+=Math.pow(e[s],2);return 0===n&&0===i?0:0===n||0===i?1:1-r/Math.sqrt(n*i)};var v=function(){this.currentEpoch=0,this.headEmbedding=[],this.tailEmbedding=[],this.head=[],this.tail=[],this.epochsPerSample=[],this.epochOfNextSample=[],this.epochOfNextNegativeSample=[],this.epochsPerNegativeSample=[],this.moveOther=!0,this.initialAlpha=1,this.alpha=1,this.gamma=1,this.a=1.5769434603113077,this.b=.8950608779109733,this.dim=2,this.nEpochs=500,this.nVertices=0};function b(t,e){return t>e?e:t<-e?-e:t}function M(t,e){for(var r=0,n=0;n<t.length;n++)r+=Math.pow(t[n]-e[n],2);return r}function x(t,e){var r=m.linear(0,3*t,300).map((function(t){return t<e?1:t})),n=m.zeros(r.length).map((function(n,i){return r[i]>=e?Math.exp(-(r[i]-e)/t):n})),i={x:r,y:n},o=g.default(i,(function(t){var e=s(t,2),r=e[0],n=e[1];return function(t){return 1/(1+r*Math.pow(t,2*n))}}),{damping:1.5,initialValues:[.5,.5],gradientDifference:.1,maxIterations:100,errorTolerance:.01}).parameterValues,a=s(o,2);return{a:a[0],b:a[1]}}function S(t,e,r,n){return void 0===r&&(r=1),void 0===n&&(n=5),t.map((function(t,i,s){return-1===e[i]||-1===e[s]?t*Math.exp(-r):e[i]!==e[s]?t*Math.exp(-n):t}))}function E(t){t=u.normalize(t,"max");var e=u.transpose(t),r=u.pairwiseMultiply(e,t);return t=u.add(t,u.subtract(e,r)),u.eliminateZeros(t)}function k(t,e,r){for(var n=m.zeros(t.length).map((function(t){return m.zeros(r[0].length)})),i=0;i<t.length;i++)for(var s=0;s<t[0].length;s++)for(var o=0;o<r[0].length;o++){var a=t[i][s];n[i][o]+=e[i][s]*r[a][o]}return n}e.findABParams=x,e.fastIntersection=S,e.resetLocalConnectivity=E,e.initTransform=k},4517:function(t,e){var r=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],r=0;return e?e.call(t):{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}};function n(t,e){return Math.floor(e()*t)}function i(t){for(var e=[],r=0;r<t;r++)e.push(void 0);return e}function s(t,e){return i(t).map((function(){return e}))}function o(t){return s(t,0)}function a(t){return t.reduce((function(t,e){return t+e}))}Object.defineProperty(e,"__esModule",{value:!0}),e.tauRandInt=n,e.tauRand=function(t){return t()},e.norm=function(t){var e,n,i=0;try{for(var s=r(t),o=s.next();!o.done;o=s.next()){var a=o.value;i+=Math.pow(a,2)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return Math.sqrt(i)},e.empty=i,e.range=function(t){return i(t).map((function(t,e){return e}))},e.filled=s,e.zeros=o,e.ones=function(t){return s(t,1)},e.linear=function(t,e,r){return i(r).map((function(n,i){return t+i*((e-t)/(r-1))}))},e.sum=a,e.mean=function(t){return a(t)/t.length},e.max=function(t){for(var e=0,r=0;r<t.length;r++)e=t[r]>e?t[r]:e;return e},e.max2d=function(t){for(var e=0,r=0;r<t.length;r++)for(var n=0;n<t[r].length;n++)e=t[r][n]>e?t[r][n]:e;return e},e.rejectionSample=function(t,e,r){for(var i=o(t),s=0;s<t;s++)for(var a=!0;a;){for(var h=n(e,r),l=!1,u=0;u<s;u++)if(h===i[u]){l=!0;break}l||(a=!1),i[s]=h}return i},e.reshape2d=function(t,e,r){var n=[],i=0;if(t.length!==e*r)throw new Error("Array dimensions must match input length.");for(var s=0;s<e;s++){for(var o=[],a=0;a<r;a++)o.push(t[i]),i+=1;n.push(o)}return n}}},n={};function i(t){var e=n[t];if(void 0!==e)return e.exports;var s=n[t]={exports:{}};return r[t].call(s.exports,s,s.exports,i),s.exports}i.m=r,i.x=()=>{var t=i.O(void 0,[1,452],(()=>i(7440)));return i.O(t)},t=[],i.O=(e,r,n,s)=>{if(!r){var o=1/0;for(u=0;u<t.length;u++){for(var[r,n,s]=t[u],a=!0,h=0;h<r.length;h++)(!1&s||o>=s)&&Object.keys(i.O).every((t=>i.O[t](r[h])))?r.splice(h--,1):(a=!1,s<o&&(o=s));if(a){t.splice(u--,1);var l=n();void 0!==l&&(e=l)}}return e}s=s||0;for(var u=t.length;u>0&&t[u-1][2]>s;u--)t[u]=t[u-1];t[u]=[r,n,s]},i.d=(t,e)=>{for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.f={},i.e=t=>Promise.all(Object.keys(i.f).reduce(((e,r)=>(i.f[r](t,e),e)),[])),i.u=t=>t+".js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var r=e.getElementsByTagName("script");if(r.length)for(var n=r.length-1;n>-1&&!t;)t=r[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t})(),(()=>{i.b=self.location+"";var t={440:1};i.f.i=(e,r)=>{t[e]||importScripts(i.p+i.u(e))};var e=self.webpackChunkbio=self.webpackChunkbio||[],r=e.push.bind(e);e.push=e=>{var[n,s,o]=e;for(var a in s)i.o(s,a)&&(i.m[a]=s[a]);for(o&&o(i);n.length;)t[n.pop()]=1;r(e)}})(),e=i.x,i.x=()=>Promise.all([i.e(1),i.e(452)]).then(e);var s=i.x();bio=s})();
2
- //# sourceMappingURL=440.js.map