@datagrok/peptides 1.18.2 → 1.18.3
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/CHANGELOG.md +4 -0
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +1 -1
- package/src/viewers/sar-viewer.ts +49 -26
package/dist/package-test.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var peptides_test;(()=>{var t={9135:(t,e,n)=>{"use strict";n.d(e,{pj:()=>m,uL:()=>g});var i,r,o,s,a,l,u,c=n(6082),h=n(4328);n(8774),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(i||(i={})),function(t){t.Euclidean="Euclidean"}(r||(r={})),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"}(o||(o={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(s||(s={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray",t.NumberArray="NumberArray"}(a||(a={})),function(t){t.Difference="Difference"}(l||(l={})),function(t){t.CommonItems="Common Items"}(u||(u={}));var d=n(4572);o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Cosine,o.Tanimoto,o.Asymmetric,o.Cosine,o.Sokal,d.Z.HAMMING,d.Z.LEVENSHTEIN,d.Z.MONOMER_CHEMICAL_DISTANCE,d.Z.NEEDLEMANN_WUNSCH,n(3151);var f=n(2738),p=(n(826),n(3077));async function m(){const t=c.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await t[0].prepare().call()).getOutputParamValue()}async function g(t,e){t instanceof c.Column&&(t=(0,p.R)(t).columns.toList());const n=(await m()).getMonomerLib(),i=new Array(t.length),r=t[0].length,o=new Float32Array(r);for(let s=0;s<t.length;++s){const a=s<e.length?e.getCanonical(s):f._S,l=n.getMonomer("PEPTIDE",a)?.smiles??"",u=t[s],d=u.getRawData(),p=u.categories,m=p.indexOf("");if(i[s]={categories:p,data:d,emptyIndex:m},void 0===a)continue;const g=c.Column.fromStrings("smiles",p.map((t=>n.getMonomer("PEPTIDE",t)?.smiles??""))),v=(c.DataFrame.fromColumns([g]),await h.chem.getSimilarities(g,l)),y=v?v.getRawData():null;for(let t=0;t<r;++t){const e=d[t];a!==f._S&&e!==m?o[t]+=y[e]:a===f._S&&e===m&&(o[t]+=1)}}for(let n=0;n<o.length;++n){let r=o[n]/e.length;for(let o=0;o<t.length;++o){const t=i[o];if(o>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&o<e.length){r=c.FLOAT_NULL;break}}o[n]=r}return c.Column.fromFloat32Array("Similarity",o)}},3151:(t,e,n)=>{"use strict";n.d(e,{EK:()=>r,q7:()=>i});const i="p",r=new RegExp(`[rd]\\((\\w)\\)${i}?`,"g")},439:(t,e,n)=>{"use strict";n.d(e,{B5:()=>l,Hi:()=>i,YI:()=>r,gp:()=>o,q7:()=>c,z1:()=>a});var i,r,o,s=n(2738);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm"}(i||(i={})),function(t){t.DNA="DNA",t.RNA="RNA",t.PT="PT",t.UN="UN"}(r||(r={})),function(t){t.aligned="aligned",t.alphabet="alphabet",t.alphabetSize=".alphabetSize",t.alphabetIsMultichar=".alphabetIsMultichar",t.separator="separator",t.isHelmCompatible=".isHelmCompatible",t.positionNames=".positionNames",t.positionLabels=".positionLabels",t.regions=".regions"}(o||(o={}));const a=", ",l=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,u=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},c=[new s.aD(r.PT,u.fasta.peptide,.5),new s.aD(r.DNA,u.fasta.dna,.55),new s.aD(r.RNA,u.fasta.rna,.55)]},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,J9:()=>r.J9,SM:()=>r.SM,YI:()=>i.YI,dh:()=>r.dh,gp:()=>i.gp,q7:()=>i.q7,qp:()=>r.qp,z1:()=>i.z1,zS:()=>r.zS});var i=n(439),r=n(9634)},2738:(t,e,n)=>{"use strict";n.d(e,{XN:()=>o,_S:()=>i,aD:()=>r});const i="";class r{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class o extends r{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},9634:(t,e,n)=>{"use strict";n.d(e,{Mu:()=>E,pc:()=>R,dh:()=>_,zS:()=>I,SM:()=>P,J9:()=>T,tm:()=>x,qp:()=>O});var i=n(6082),r=n(144),o=n.n(r),s=n(2738),a=n(439),l=n(826);class u extends Float32Array{}function c(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}class h{static makePalette(t,e=!1,n=h){const i={};return t.forEach((t=>{const n=t[0],r=t[1];n.forEach(((t,n)=>{i[t]=this.colourPalette[r][e?0:n]}))})),new n(i)}constructor(t){this._palette=t}get(t,e){return this._palette[t]}}h.undefinedColor="rgb(100,100,100)",h.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class d extends h{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,d)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,d)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new d({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in d.aaSynonyms?d.aaSynonyms[t]:t;return super.get(e)}}d.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class f{static getPalette(t="grok"){switch(t){case"grok":return d.GrokGroups;case"lesk":return d.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const r of t)"("==r?e++:")"==r?e--:e?n+=r:i+=r;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[i,r]=this.getInnerOuter(t);if(i=i.length>6?`${i.slice(0,3)}...`:i,r=r.length>6?`${r.slice(0,3)}...`:r,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,r,1]:[this.undefinedColor,i,r,1]}if("d"==t[0]&&t[1]in n&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in n?[n.get(e),e,r,2]:[this.undefinedColor,i,r,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in n?[n.get(e),e,r,3]:[this.undefinedColor,i,r,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in n?[n.get(e),e,r,4]:[this.undefinedColor,i,r,4]}return[this.undefinedColor,i,r,0]}}f.SemType="Aminoacids",f.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",f.undefinedColor="rgb(100,100,100)",f.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},f.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},f.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},f.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class p extends h{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new p({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class m{}m.SemType="Nucleotides",m.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",m.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};var g=n(9135);function v(t,e=!0){if(null==t)return"rgb(100,100,100)";const n=i.Color.fromHtml(t);if(e){const t=i.Color.g(n),e=i.Color.r(n),r=i.Color.b(n),o=Math.sqrt(Math.pow(0-e,2)+Math.pow(0-t,2)+Math.pow(0-r,2));if(o>210)return`rgb(${e/o*210},${t/o*210},${r/o*210})`}return i.Color.toRgb(n)}class y{static hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}}class C{}class w extends C{get(t,e){return"#666666"}}class b extends C{static buildPalette(){return(0,g.pj)().then((t=>{t.awaitLoaded().then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{b.customMonomerColors={},b.polymerTypes=e.getPolymerTypes();for(const t of this.polymerTypes){const n=e.getMonomerSymbolsByType(t);for(const i of n){const n=e.getMonomer(t,i);n?.meta?.colors?.default?.background&&(this.customMonomerColors[i]||(this.customMonomerColors[i]={}),this.customMonomerColors[i][t]=v(n.meta.colors.default.background,!1))}}}))}))})),[].concat(...Object.values(h.colourPalette))}get(t,e){const n=b.customMonomerColors[t],i=e??"PEPTIDE";if(n&&n[i])return n[i];const r=y.hashCode(t)%b.palette.length;return v(b.palette[r])}}b.palette=b.buildPalette(),b.customMonomerColors={},b.polymerTypes=[];class A extends h{static get Gray(){return void 0===this.gray&&(this.gray=new w),this.gray}static get Color(){return void 0===this.color&&(this.color=new b),this.color}}class E{get length(){return this.mList.length}get canonicals(){return this.mList}get originals(){return this.mList}isGap(t){return this.getOriginal(t)===this.gapOriginalMonomer}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}constructor(t,e){this.mList=t,this.gapOriginalMonomer=e}}class S{get length(){return this.seqS.length}get canonicals(){return this.seqS}get originals(){return this.seqS}isGap(t){return this.getOriginal(t)===l.b9[a.Hi.FASTA]}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");return this.isGap(t)?s._S:this.seqS[t]}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.seqS[t]}constructor(t){this.seqS=t}}const T=t=>{const e=o()(t.toString().matchAll(a.B5)).map((t=>t[2]??t[1])).toArray();return new E(e,l.b9[a.Hi.FASTA])},x=t=>t?new S(t):new E([],l.b9[a.Hi.FASTA]);function _(t,e=void 0){return n=>{if(n){let i;const r=new RegExp(String.raw`"-"|'-'|[^${t}]+`,"g");if(void 0!==e){r.lastIndex=0,i=new Array(Math.ceil(e));let t=null,o=0;for(;null!==(t=r.exec(n))&&o<e;)i[o++]=t[0].replace('"-"',"").replace("'-'","");i.splice(o)}else i=n.replaceAll('"-"',"").replaceAll("'-'","").split(t,e);return new E(i,l.b9[a.Hi.SEPARATOR])}return new E([],l.b9[a.Hi.SEPARATOR])}}const N=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,M=/\[([^\[\]]+)]/g,O=t=>{N.lastIndex=0;const e=N.exec(t.toString()),n=e?e[2]:null,i=n?n.split("."):[];return new E(i.map((t=>{M.lastIndex=0;const e=M.exec(t);return e&&e.length>=2?e[1]:t})),l.b9[a.Hi.HELM])},L=/([^\W_]+)/g;function I(t,e){if(t.length<=e)return t;const n=t.match(L),i=t.length>e||(n?.length??0)>1,r=n?.[0]??" ";return i?r.substring(0,e-1)+"…":r}function R(t,e,n="-"){const i=e.map((e=>{const i=function(t,e,n="-"){const i=new Set([...new Set(Object.keys(t)),...e]);i.delete(n);const r=[],o=[];for(const n of i)r.push(n in t?t[n]:0),o.push(e.has(n)?1:0);const s=new u(r),a=new u(o);return function(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}(s,a)/(c(s)*c(a))}(t,e.alphabet,n);return new s.XN(e,t,i)}));let r;const o=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return r=o>0?i.find((t=>t.similarity===o)).name:a.YI.UN,r}function P(t,e=5){let n;if(t.semType==i.SEMTYPE.MACROMOLECULE)n=l.GO.forColumn(t).alphabet;else{const i=function(t,e,n){const i=t.categories;return function(t,e){const n={};let i=!0,r=null;for(const o of t)if(null==r?r=o.length:o.length!==r&&(i=!1),o.length>=e)for(const t of o.canonicals)t in n||(n[t]=0),n[t]+=1;return{freq:n,sameLength:i}}(o().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,e,T);n=R(i.freq,a.q7)}return function(t){switch(t){case a.YI.PT:return d.GrokGroups;case a.YI.DNA:case a.YI.RNA:return p.Chromatogram;default:return A.Color}}(n)}},826:(t,e,n)=>{"use strict";n.d(e,{GO:()=>p,b9:()=>f});var i=n(6082),r=n(144),o=n.n(r),s=n(2003),a=n(2738),l=n(9634),u=n(4572),c=n(9135),h=n(3151);const d=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}},f={[s.Hi.FASTA]:"-",[s.Hi.SEPARATOR]:"",[s.Hi.HELM]:"*"};class p{constructor(t){if(this._splitter=null,this.cached=!0,this._splitted=null,this.columnVersion=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,t.type!==i.TYPE.STRING)throw new Error(`Unexpected column type '${t.type}', must be '${i.TYPE.STRING}'.`);this._column=t;const e=this._column.meta.units;if(null==e)throw new Error("Units are not specified in column");if(this._units=e,this._notation=this.getNotation(),this._defaultGapOriginal=this.isFasta()?f[s.Hi.FASTA]:this.isHelm()?f[s.Hi.HELM]:f[s.Hi.SEPARATOR],!this.column.tags.has(s.gp.aligned)||!this.column.tags.has(s.gp.alphabet)||!this.column.tags.has(s.gp.alphabetIsMultichar)&&!this.isHelm()&&this.alphabet===s.YI.UN)if(this.isFasta())p.setUnitsToFastaColumn(this);else if(this.isSeparator()){const e=t.getTag(s.gp.separator);p.setUnitsToSeparatorColumn(this,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.meta.units}'.`);p.setUnitsToHelmColumn(this)}if(!this.column.tags.has(s.gp.alphabetIsMultichar))if(this.isHelm())this.column.setTag(s.gp.alphabetIsMultichar,"true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '${s.gp.alphabetIsMultichar}' is mandatory.`);this.notationProvider=this.column.temp[d.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(t){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE||t.column.meta.units!==s.Hi.FASTA)throw new Error(`The column of notation '${s.Hi.FASTA}' must be '${i.SEMTYPE.MACROMOLECULE}'.`);t.column.meta.units=s.Hi.FASTA,p.setTags(t)}static setUnitsToSeparatorColumn(t,e){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE||t.column.meta.units!==s.Hi.SEPARATOR)throw new Error(`The column of notation '${s.Hi.SEPARATOR}' must be '${i.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error(`The column of notation '${s.Hi.SEPARATOR}' must have the separator tag.`);t.column.meta.units=s.Hi.SEPARATOR,t.column.setTag(s.gp.separator,e),p.setTags(t)}static setUnitsToHelmColumn(t){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${s.Hi.HELM}' must be '${i.SEMTYPE.MACROMOLECULE}'`);t.column.meta.units=s.Hi.HELM,p.setTags(t)}static setTags(t){const e=t.column.meta.units;if([s.Hi.FASTA,s.Hi.SEPARATOR].includes(e)){if(!t.column.getTag(s.gp.alphabet)&&0===Object.keys(t.stats.freq).length)throw new Error("Alphabet is empty and not annotated.");let e=t.column.getTag(s.gp.aligned);null===e&&(e=t.stats.sameLength?"SEQ.MSA":"SEQ",t.column.setTag(s.gp.aligned,e));let n=t.column.getTag(s.gp.alphabet);if(null===n&&(n=(0,l.pc)(t.stats.freq,s.q7),t.column.setTag(s.gp.alphabet,n)),n===s.YI.UN){const e=Object.keys(t.stats.freq).length,n=Object.keys(t.stats.freq).some((t=>t.length>1));t.column.setTag(s.gp.alphabetSize,e.toString()),t.column.setTag(s.gp.alphabetIsMultichar,n?"true":"false")}}}get column(){return this._column}get length(){return this._column.length}get units(){return this._units}get notation(){return this._notation}get defaultGapOriginal(){return this._defaultGapOriginal}get separator(){const t=this.column.getTag(s.gp.separator)??void 0;if(this.notation===s.Hi.SEPARATOR&&void 0===t)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return t}get aligned(){const t=this.column.getTag(s.gp.aligned);if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return t}get alphabet(){const t=this.column.getTag(s.gp.alphabet);if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return t}get helmCompatible(){return this.column.getTag(s.gp.isHelmCompatible)}getAlphabetSize(){if(this.notation==s.Hi.HELM||this.alphabet==s.YI.UN){const t=this.column.getTag(s.gp.alphabetSize);let e;if(t)e=parseInt(t);else{const t=this.stats;e=Object.keys(t.freq).length}return e}switch(this.alphabet){case s.YI.PT:return 20;case s.YI.DNA:case s.YI.RNA:return 4;case"NT":return console.warn("Unexpected alphabet 'NT'."),4;default:throw new Error(`Unexpected alphabet '${this.alphabet}'.`)}}getAlphabetIsMultichar(){return this.notation===s.Hi.HELM||this.alphabet===s.YI.UN&&"true"===this.column.getTag(s.gp.alphabetIsMultichar)}getSplitted(t,e){if(this.cached&&void 0===e){this.column.version===this.columnVersion&&null!==this._splitted||(this.columnVersion=this.column.version,this._splitted=new Array(this.column.length));let e=this._splitted[t]?this._splitted[t].deref():void 0;if(!e){const n=this.column.get(t);e=this.splitter(n),this._splitted[t]=new WeakRef(e)}return e}{const n=this.column.get(t);return this.getSplitter(e)(n)}}async getHelm(t,e){const n=this.column.get(t);return this.notationProvider?(await this.notationProvider.getHelm(this.column,e)).get(t):this.convertToHelm(n)}get stats(){if(null===this._stats){const t={};let e=!0,n=null;const i=this.column.length;for(let r=0;r<i;++r){const i=this.getSplitted(r);null==n?n=i.length:i.length!==n&&(e=!1);for(const e of i.canonicals)e in t||(t[e]=0),t[e]+=1}this._stats={freq:t,sameLength:e}}return this._stats}get maxLength(){return null===this._maxLength&&(this._maxLength=0===this.column.length?0:Math.max(...o().count(0).take(this.column.length).map((t=>this.getSplitted(t).length)))),this._maxLength}get posList(){if(null===this._posList){const t=this.column.getTag(s.gp.positionNames);this._posList=t?t.split(s.z1).map((t=>t.trim())):o().count(1).take(this.maxLength).map((t=>t.toString())).toArray()}return this._posList}isFasta(){return this.notation===s.Hi.FASTA}isSeparator(){return this.notation===s.Hi.SEPARATOR}isHelm(){return this.notation===s.Hi.HELM}isRna(){return this.alphabet===s.YI.RNA}isDna(){return this.alphabet===s.YI.DNA}isPeptide(){return this.alphabet===s.YI.PT}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}isGap(t){return!t||t===this._defaultGapOriginal}getNotation(){if(this.units.toLowerCase().startsWith(s.Hi.FASTA))return s.Hi.FASTA;if(this.units.toLowerCase().startsWith(s.Hi.SEPARATOR))return s.Hi.SEPARATOR;if(this.units.toLowerCase().startsWith(s.Hi.HELM))return s.Hi.HELM;throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getHelmWrappers(){return[this.isDna()||this.isRna()||this.isHelmCompatible()?"RNA1{":"PEPTIDE1{",this.isDna()?"d(":this.isRna()?"r(":"",this.isDna()||this.isRna()?")p":"","}$$$$"]}getNewColumn(t,e,n,r){const o=this.column,a=t.toLowerCase()+"("+o.name+")",l=n??o.dataFrame.columns.getUnusedName(a),u=i.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(u.semType=i.SEMTYPE.MACROMOLECULE,u.meta.units=t,t===s.Hi.SEPARATOR){if(!e)throw new Error(`Notation '${s.Hi.SEPARATOR}' requires separator value.`);u.setTag(s.gp.separator,e)}u.setTag(i.TAGS.CELL_RENDERER,t===s.Hi.HELM?"helm":"sequence");const c=o.getTag(s.gp.aligned);c&&u.setTag(s.gp.aligned,c);let h=o.getTag(s.gp.alphabet);h||this.notation!==s.Hi.HELM||t===s.Hi.HELM||(h=s.YI.UN),null!=h&&u.setTag(s.gp.alphabet,h);let d=o.getTag(s.gp.alphabetSize);null!=h&&d&&u.setTag(s.gp.alphabetSize,d);const f=o.getTag(s.gp.alphabetIsMultichar);return null!=h&&void 0!==f&&u.setTag(s.gp.alphabetIsMultichar,f),t==s.Hi.HELM&&(d=this.getAlphabetSize().toString(),u.setTag(s.gp.alphabetSize,d)),u}getNewColumnFromList(t,e){return this.getNewColumn(this.notation,this.separator,t,e)}static getNewColumn(t){const e=p.forColumn(t),n=e.notation;return e.getNewColumn(n)}static unitsStringIsValid(t){return t=t.toLowerCase(),[s.Hi.FASTA,s.Hi.SEPARATOR,s.Hi.HELM].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,n){if(!p.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const r=i.Column.fromList("string",e,new Array(t).fill(""));return r.semType=i.SEMTYPE.MACROMOLECULE,r.meta.units=n,r}getSplitter(t){let e=null;if(e=this.notationProvider?this.notationProvider.splitter:null,e)return e;if(this.units.toLowerCase().startsWith(s.Hi.FASTA))return null===this.column.getTag(s.gp.alphabet)||this.getAlphabetIsMultichar()?s.J9:l.tm;if(this.units.toLowerCase().startsWith(s.Hi.SEPARATOR))return(0,s.dh)(this.separator,t);if(this.units.toLowerCase().startsWith(s.Hi.HELM))return s.qp;throw new Error(`Unexpected units ${this.units} .`)}split(t){return this.splitter(t)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");if(this.isMsa())return u.Z.HAMMING;switch(this.alphabet){case s.YI.DNA:case s.YI.RNA:case s.YI.PT:}return u.Z.LEVENSHTEIN}getDistanceFunction(){return u.V[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(s.gp.isHelmCompatible))return"true"===this.column.getTag(s.gp.isHelmCompatible);const t=(await(0,c.pj)()).getMonomerLib().getMonomerSymbolsByType("PEPTIDE"),e=new Set(t),n=((0,s.dh)(this.separator),new Set),i=this.column.length,r=this.column.getRawData();for(let t=0;t<i;++t){const i=r[t];if(!(i in n)){n.add(i);const r=this.getSplitted(t);for(const t of r.canonicals)if(!e.has(t))return this.column.setTag(s.gp.isHelmCompatible,"false"),!1}}return this.column.setTag(s.gp.isHelmCompatible,"true"),!0}get splitter(){return null===this._splitter&&(this._splitter=this.getSplitter()),this._splitter}toFasta(t){return t===s.Hi.FASTA}toSeparator(t){return t===s.Hi.SEPARATOR}toHelm(t){return t===s.Hi.HELM}convertHelmToFastaSeparator(t,e,n,i){i||(i=this.toFasta(e)?f[s.Hi.FASTA]:f[s.Hi.SEPARATOR]),n||(n=this.toFasta(e)?"":this.separator);const r=t.startsWith("RNA"),o=this.splitter(t),a=[];for(let t=0;t<o.length;++t){let n=o.getOriginal(t);if(r&&(n=n.replace(h.EK,"")),n===f[s.Hi.HELM])a.push(i);else if(this.toFasta(e)&&n.length>1){const t="["+n+"]";a.push(t)}else a.push(n)}return a.join(n)}convert(t,e){const n=this.getJoiner({notation:t,separator:e}),i=this.getNewColumn(t,e);return i.init((t=>{const e=this.getSplitted(t);return n(e)})),i}getRegion(t,e,n){const i=this.getNewColumn(this.notation,this.separator);i.name=n;const r=t??0,o=e??this.maxLength-1,a=this.getJoiner(),u=o-r+1,c=f[this.notation];i.init((t=>{const e=this.getSplitted(t),n=new Array(u);for(let t=0;t<u;++t){const i=r+t;n[t]=i<e.length?e.getOriginal(i):c}return a(new l.Mu(n,c))}));const h=t=>{const e=t.split(",").map((t=>t.trim())),n=new Array(u);for(let t=0;t<u;++t){const i=r+t;n[t]=i<e.length?e[i]:"?"}return n.join(s.z1)},d=this.column.getTag(s.gp.positionNames);d&&i.setTag(s.gp.positionNames,h(d));const p=this.column.getTag(s.gp.positionLabels);return p&&i.setTag(s.gp.positionLabels,h(p)),i}get joiner(){return this._joiner||(this._joiner=this.getJoiner()),this._joiner}getJoiner(t){const e=t?t.notation:this.notation,n=t?t.separator:this.separator;let i;const r=this;switch(e){case s.Hi.FASTA:i=function(t){return r.joinToFasta(t,r.isHelm())};break;case s.Hi.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${e}'.`);i=function(t){return m(t,n,r.isHelm())};break;case s.Hi.HELM:{const t=r.alphabet===s.YI.DNA||r.alphabet===s.YI.RNA,e=r.getHelmWrappers();i=function(n){return g(n,e,t)};break}default:throw new Error(`Unexpected notation '${e}'.`)}return i}getConverter(t,e=void 0){if(t===s.Hi.SEPARATOR&&!e)throw new Error(`Target separator is not specified for target units '${s.Hi.SEPARATOR}'.`);const n=this;if(t===s.Hi.FASTA)return function(t){return n.convertToFasta(t)};if(t===s.Hi.HELM)return function(t){return n.convertToHelm(t)};if(t===s.Hi.SEPARATOR)return function(t){return n.convertToSeparator(t,e)};throw new Error}static forColumn(t){let e=t.temp[d.seqHandler];return e&&e.columnVersion===t.version||(e=t.temp[d.seqHandler]=new p(t)),e}joinToFasta(t,e){const n=new Array(t.length);for(let i=0;i<t.length;++i){const r=t.getOriginal(i);let o=t.getOriginal(i);e&&(o=o.replace(h.EK,"$1")),r===a._S?o=f[s.Hi.FASTA]:r===h.q7?o="":o.length>1&&(o="["+o+"]"),n[i]=o}return n.join("")}convertToFasta(t){const e=this.splitter,n=this.isHelm()?this.splitterAsHelmNucl(t):e(t);return this.joinToFasta(n,this.isHelm())}convertToSeparator(t,e){return m(this.isHelm()?this.splitterAsHelmNucl(t):this.splitter(t),e,this.isHelm())}convertToHelm(t){if(this.notation==s.Hi.HELM)return t;const e=this.getHelmWrappers(),n=t.startsWith("DNA")||t.startsWith("RNA");return g(this.splitter(t),e,n)}splitterAsHelmNucl(t){const e=this.splitter(t),n=new Array(e.length),i=t.startsWith("DNA"),r=t.startsWith("RNA");for(let t=0;t<e.length;++t){let o=e.getOriginal(t);(i||r)&&(o=o.replace(h.EK,"$1"),o=o===h.q7?null:o),n[t]=o||null}return new l.Mu(n.filter((t=>!!t)),f[s.Hi.HELM])}}function m(t,e,n){const i=new Array(t.length);for(let e=0;e<t.length;++e){const r=t.getCanonical(e);let o=t.getOriginal(e);n&&(o=o.replace(h.EK,"$1")),r===a._S?o=f[s.Hi.SEPARATOR]:r===h.q7&&(o=""),i[e]=o}return i.join(e)}function g(t,e,n){const[i,r,o,l]=e,u=new Array(t.length);for(let e=0;e<t.length;++e){const i=t.getCanonical(e);let l=t.getOriginal(e);i===a._S?l=f[s.Hi.HELM]:(n&&(l=l.replace(h.EK,"$1")),l=1===l.length?`${r}${l}${o}`:`${r}[${l}]${o}`),u[e]=l}return`${i}${u.join(".")}${l}`}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>o});var i=n(6082),r=n(826);function o(t){const e=t=>{const e=s.columns.addNewString((t+1).toString());return n.push(e),e},n=[],o=t.length,s=i.DataFrame.create(o),a=r.GO.forColumn(t);for(let t=0;t<o;++t){const i=a.getSplitted(t);for(let r=0;r<i.length;++r){const o=i.getOriginal(r);((n[r]??null)||e(r)).set(t,o,!1)}}return s}},4326:(t,e,n)=>{"use strict";n.d(e,{P4:()=>s,fH:()=>r});var i,r,o,s,a,l,u=n(6082);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(t){t.Entropy="Entropy",t.full="100%"}(r||(r={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(o||(o={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(s||(s={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(a||(a={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(l||(l={})),new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=u.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=r.Entropy,this.positionWidth=16,this.verticalAlignment=o.MIDDLE,this.horizontalAlignment=s.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},5540:(t,e,n)=>{"use strict";t=n.hmd(t);var i,r=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,r=void 0!==t?t:{};r.ready=new Promise((function(t,i){e=t,n=i}));var o,s=Object.assign({},r),a="object"==typeof window,l="function"==typeof importScripts,u=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?u=self.location.href:"undefined"!=typeof document&&document.currentScript&&(u=document.currentScript.src),i&&(u=i),u=0!==u.indexOf("blob:")?u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(o=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),r.print||console.log.bind(console);var c,h,d=r.printErr||console.warn.bind(console);Object.assign(r,s),s=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(c=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var f,p,m,g=!1;function v(){var t=h.buffer;r.HEAP8=f=new Int8Array(t),r.HEAP16=new Int16Array(t),r.HEAP32=new Int32Array(t),r.HEAPU8=p=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=m=new Uint32Array(t),r.HEAPF32=new Float32Array(t),r.HEAPF64=new Float64Array(t)}var y=[],C=[],w=[],b=0,A=null,E=null;function S(t){r.onAbort&&r.onAbort(t),d(t="Aborted("+t+")"),g=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var T,x;function _(t){return t.startsWith("data:application/octet-stream;base64,")}function N(t){try{if(t==T&&c)return new Uint8Array(c);if(o)return o(t);throw"both async and sync fetching of the wasm failed"}catch(t){S(t)}}function M(t,e,n){return function(t){return c||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return N(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return N(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){d("failed to asynchronously prepare wasm: "+t),S(t)}))}function O(t){for(;t.length>0;)t.shift()(r)}function L(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){m[this.ptr+4>>2]=t},this.get_type=function(){return m[this.ptr+4>>2]},this.set_destructor=function(t){m[this.ptr+8>>2]=t},this.get_destructor=function(){return m[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,f[this.ptr+12|0]=t},this.get_caught=function(){return 0!=f[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,f[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=f[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){m[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return m[this.ptr+16>>2]},this.get_exception_ptr=function(){if(H(this.get_type()))return m[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function I(t){var e=h.buffer;try{return h.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function R(t){return r["_"+t]}_(T="wasmDbscan.wasm")||(x=T,T=r.locateFile?r.locateFile(x,u):u+x);var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,n,i,r){var o={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<=127?e++:i<=2047?e+=2:i>=55296&&i<=57343?(e+=4,++n):e+=3}return e}(t)+1,n=F(e);return function(t,e,n){!function(t,e,n,i){if(!(i>0))return 0;for(var r=n+i-1,o=0;o<t.length;++o){var s=t.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++o)),s<=127){if(n>=r)break;e[n++]=s}else if(s<=2047){if(n+1>=r)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=r)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=r)break;e[n++]=240|s>>18,e[n++]=128|s>>12&63,e[n++]=128|s>>6&63,e[n++]=128|63&s}}e[n]=0}(t,p,e,n)}(t,n,e),n}(t)),e},array:t=>{var e,n,i=F(t.length);return e=t,n=i,f.set(e,n),i}},s=R(t),a=[],l=0;if(i)for(var u=0;u<i.length;u++){var c=o[n[u]];c?(0===l&&(l=U()),a[u]=c(i[u])):a[u]=i[u]}var h=s.apply(null,a);return function(t){return 0!==l&&V(l),function(t){return"string"===e?(n=t)?function(t,e,n){for(var i=e+n,r=e;t[r]&&!(r>=i);)++r;if(r-e>16&&t.buffer&&P)return P.decode(t.subarray(e,r));for(var o="";e<r;){var s=t[e++];if(128&s){var a=63&t[e++];if(192!=(224&s)){var l=63&t[e++];if((s=224==(240&s)?(15&s)<<12|a<<6|l:(7&s)<<18|a<<12|l<<6|63&t[e++])<65536)o+=String.fromCharCode(s);else{var u=s-65536;o+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else o+=String.fromCharCode((31&s)<<6|a)}else o+=String.fromCharCode(s)}return o}(p,n,i):"":"boolean"===e?Boolean(t):t;var n,i}(t)}(h)}var G,D={__cxa_throw:function(t,e,n){throw new L(t).init(e,n),t},abort:function(){S("")},emscripten_memcpy_big:function(t,e,n){p.copyWithin(t,e,e+n)},emscripten_resize_heap:function(t){var e,n=p.length,i=2147483648;if((t>>>=0)>i)return!1;for(var r=1;r<=4;r*=2){var o=n*(1+.2/r);if(o=Math.min(o,t+100663296),I(Math.min(i,(e=Math.max(t,o))+(65536-e%65536)%65536)))return!0}return!1}},U=(function(){var t,e,i,o,s={env:D,wasi_snapshot_preview1:D};function a(t,e){var n,i=t.exports;return r.asm=i,h=r.asm.memory,v(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,C.unshift(n),function(t){if(b--,r.monitorRunDependencies&&r.monitorRunDependencies(b),0==b&&(null!==A&&(clearInterval(A),A=null),E)){var e=E;E=null,e()}}(),i}if(b++,r.monitorRunDependencies&&r.monitorRunDependencies(b),r.instantiateWasm)try{return r.instantiateWasm(s,a)}catch(t){d("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=c,e=T,i=s,o=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||_(e)||"function"!=typeof fetch?M(e,i,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(o,(function(t){return d("wasm streaming compile failed: "+t),d("falling back to ArrayBuffer instantiation"),M(e,i,o)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(U=r.asm.stackSave).apply(null,arguments)}),V=function(){return(V=r.asm.stackRestore).apply(null,arguments)},F=function(){return(F=r.asm.stackAlloc).apply(null,arguments)},H=function(){return(H=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function B(){function t(){G||(G=!0,r.calledRun=!0,g||(O(C),e(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)t=r.postRun.shift(),w.unshift(t);var t;O(w)}()))}b>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)t=r.preRun.shift(),y.unshift(t);var t;O(y)}(),b>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),t()}),1)):t()))}if(r.ccall=k,r.cwrap=function(t,e,n,i){var r=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&r&&!i?R(t):function(){return k(t,e,n,arguments)}},E=function t(){G||B(),G||(E=t)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return B(),t.ready});"object"==typeof exports?t.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},4329:(t,e,n)=>{"use strict";n.d(e,{_:()=>o});var i=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};let r=null;function o(){return i(this,void 0,void 0,(function*(){if(!r&&(r=yield navigator.gpu.requestAdapter(),null==r))return null;const t=yield r.requestAdapterInfo();return t?s(t.description,s(t.vendor,"No GPU description available")):null}))}function s(t,e){return t&&""!=t?t:e}},5395:(t,e,n)=>{"use strict";function i(t={}){const e=function(){if(!t||!t.scoringMatrix||!t.alphabetIndexes)return(t,e)=>t===e?0:1;if(t.scoringMatrix.length!==Object.keys(t.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const e=t.alphabetIndexes,n=t.scoringMatrix,i=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,r=new Float32Array((n.length+i)*(n.length+i));return Object.entries(e).forEach((([t,i])=>{const o=n[i];Object.entries(e).forEach((([e,i])=>{r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=o[i]}))})),(t,e)=>1-r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,i)=>{let r=0;const o=t.length,s=i.length,a=Math.ceil(Math.max(o,s)*(1-n));o!==s&&(r=Math.abs(o-s));let l=0;for(let n=0;n<Math.min(o,s);n++)if(t[n]!==i[n]&&(l+=e(t[n],i[n]),l>a))return 1;return l+=r,l/=Math.max(o,s),l}}n.d(e,{k:()=>i})},4572:(t,e,n)=>{"use strict";n.d(e,{V:()=>i.V,Z:()=>i.Z});var i=n(2362)},3359:(t,e,n)=>{"use strict";n.d(e,{Q:()=>r});var i=n(2787);function r(){return(t,e)=>(0,i.I)(t,e)/Math.max(t.length,e.length)}},2362:(t,e,n)=>{"use strict";n.d(e,{V:()=>a,Z:()=>i});var i,r=n(5395),o=n(3359),s=n(250);!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(i||(i={}));const a={[i.HAMMING]:r.k,[i.LEVENSHTEIN]:o.Q,[i.NEEDLEMANN_WUNSCH]:s.i,[i.MONOMER_CHEMICAL_DISTANCE]:r.k}},250:(t,e,n)=>{"use strict";n.d(e,{i:()=>r});const i={gapOpen:1,gapExtend:.6,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};function r(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:r,scoringMatrix:o,alphabetIndexes:s}={...i,...t};Object.entries(s).forEach((([t,n])=>e[t.charCodeAt(0)]=n));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(t,i)=>{const s=new Array(t.length+1).fill(!1),l=new Array(t.length+1).fill(!1);let u=0,c=1;for(let e=1;e<t.length+1;e++)a[0][e]=-r-(e-1)*r,a[1][e]=0;a[0][0]=0;for(let h=1;h<i.length+1;h++){a[c][0]=-r-(h-1)*r;for(let d=1;d<t.length+1;d++){const f=a[u][d-1]+o[e[t.charCodeAt(d-1)]][e[i.charCodeAt(h-1)]],p=a[u][d]-(s[d]||1===h||h===i.length?r:n),m=a[c][d-1]-(l[d-1]||1===d||d===t.length?r:n);a[c][d]=Math.max(f,m,p),a[c][d]===f?(s[d]=!1,l[d]=!1):a[c][d]===m?(s[d]=!1,l[d]=!0):(s[d]=!0,l[d]=!1)}u=c,c=(c+1)%2}const h=Math.min(t.length,i.length);return(h-a[u][t.length])/h}}},8774:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});class i{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,r=i._createBuffer(n);if(e)for(let t=0;t<r.length;t++)r[t]=-1;this._data=r,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,i){if(t<e||t>n)throw new Error(`Argument ${i} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let i=0;i<n;i++)e[i]=t[i]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new i(t._length);n._length=t._length,n._data=i._createBuffer(n._length),n._version=0;const r=t.lengthInInts;for(let i=0;i<r;i++)n._data[i]=t._data[i]&e._data[i];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new i(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new i(t);for(let i=0;i<t;++i)n.setBit(i,e(i));return n._version=0,n}static fromString(t){return i.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new i(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new i(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let r=0,o=0;for(;e-o>=4;)n._data[r++]=255&t[o]|(255&t[o+1])<<8|(255&t[o+2])<<16|(255&t[o+3])<<24,o+=4;return e-o==3&&(n._data[r]=(255&t[o+2])<<16),e-o==2&&(n._data[r]|=(255&t[o+1])<<8),e-o==1&&(n._data[r]|=255&t[o]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new i(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,i=this.lengthInInts;for(let t=0;t<i;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,i=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(i)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,i=!0,r=!0){if(n&&r&&this.setAll(!e,!1),r)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(i)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return i.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return n}setRange(t,e,n,i=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const r=Math.min(t,e),o=Math.max(t,e);if(n)for(let t=r;t<=o;t++)this.setTrue(t);else for(let t=r;t<=o;t++)this.setFalse(t);return this.incrementVersion(i),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const i=this._length;this.setLength(this._length+e);for(let n=i-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let i=t;i<t+e;i++)this.setBit(i,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let i=-1;-1!=(i=t.findNext(i,!e));)this.setFast(n++,this.getBit(i));this._length=n,this._version++}return this}getBit(t){return!!(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=i._onBitCount[255&t];let n=this._data[e];const r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));0!=n;n>>>=8)this._selectedCount+=i._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const r=this.lengthInInts;let o=0;for(;o<r-1;o++)for(let e=this._data[o]&t._data[o];0!=e;e>>>=8)n+=i._onBitCount[255&e];let s=this._data[o]&t._data[o];const a=31&this._length;for(0!=a&&(s&=~(4294967295<<a));0!=s;s>>>=8)n+=i._onBitCount[255&s];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const r=this.lengthInInts;for(let o=Math.floor(t/32);o<r;o++){let r=e?this._data[o]:~this._data[o];if(0!=n)r&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==r)continue;for(let e=0;0!=r;e+=8,r>>>=8){const n=i._firstOnBit[255&r];if(n>=0)return(t=n+32*o+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let r=Math.floor(t/32);r>=0;r--){let t=e?this._data[r]:~this._data[r];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=i._lastOnBit[t>>>24];if(n>=0)return n+32*r+e}}return-1}}i._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),i._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),i._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},8070:(t,e,n)=>{"use strict";n.d(e,{Pl:()=>G,bk:()=>q,gM:()=>k,L1:()=>P,cb:()=>B,E3:()=>I,Wj:()=>R,Xb:()=>U,N$:()=>V,t6:()=>L,PE:()=>M,rd:()=>O,Bl:()=>j,CN:()=>C});var i=n(4328),r=n(6082);n(9982);const o=r.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');o.columns.add(r.Column.fromList(r.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var s=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function a(t,e,n,r,o,a,l,u,c=!0){return s(this,void 0,void 0,(function*(){let h=null;if(yield O(r,(n=>s(this,void 0,void 0,(function*(){let n=null;for(const i of t.viewers)i.type===e&&(n=i);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),a&&(yield a(n)),o){const e=null!=u?u:{};e.tv=t,e.viewer=n,h=yield o(e,c)}yield M(i.events.onViewerClosed,(()=>{I(n.subs.some((t=>!t.closed)),!1)}),(()=>n.close()),3e3)}))),(()=>s(this,void 0,void 0,(function*(){l?t.loadLayout(l):yield function(t,e,n){return s(this,void 0,void 0,(function*(){let i;return n?(i=yield t.dataFrame.plot.fromType(e),t.dockManager.dock(i)):i=t.addViewer(e),i}))}(t,e,n)}))),6e4,"TEST_EVENT_ASYNC"),h)return h}))}function l(t,e=!0){return s(this,void 0,void 0,(function*(){const n=t.tv.dataFrame,i=n.clone();Array.from(n.row(0).cells).forEach((t=>t.value=null));const r=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((t=>t.idx>=0&&t.idx<r)),e&&(yield B(50));for(let t=r;t<2*r;t++)n.filter.set(t,!1);e&&(yield B(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((t=>n.columns.remove(t))),e&&(yield B(100)),t.tv.dataFrame=i,yield B(50)}))}function u(t,e=!0){return s(this,void 0,void 0,(function*(){const e=t.tv.dataFrame;setTimeout((()=>e.filter.set(0,!e.filter.get(0))),0)}))}function c(t,e=!0){return s(this,void 0,void 0,(function*(){let e,n;try{e=t.viewer.getOptions(!0).look}catch(t){throw new Error("Viewer's .getOptions() error.",{cause:t})}try{n=t.viewer.getProperties()}catch(t){throw new Error("Viewer's .getProperties() error.",{cause:t})}const i={};return Object.keys(e).filter((t=>"boolean"==typeof e[t])).forEach((t=>i[t]=!e[t])),n.filter((t=>null!==t.choices)).forEach((t=>i[t.name]=t.choices.find((n=>n!==e[t.name])))),t.viewer.setOptions(i),yield B(300),{layout:t.tv.saveLayout(),savedProps:t.viewer.getOptions().look}}))}function h(t,e=!0){return s(this,void 0,void 0,(function*(){I(JSON.stringify(t.viewer.getOptions().look),JSON.stringify(t.savedProps))}))}var d=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const f=3e4,p=108e5,m=console.log.bind(console),g=console.info.bind(console),v=console.warn.bind(console),y=console.error.bind(console),C={},w="Auto Tests",b="Demo",A="Detectors",E="Core",S={};let T;var x;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(x||(x={}));class _{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class N{constructor(t,e,n,i){var r;this.category=t,this.name=e,null!=i||(i={}),null!==(r=i.timeout)&&void 0!==r||(i.timeout=f),this.options=i,this.test=()=>d(this,void 0,void 0,(function*(){return new Promise(((t,e)=>d(this,void 0,void 0,(function*(){let i="";try{i=yield n()}catch(t){e(t)}t(i)}))))}))}}function M(t,e,n,i=0,r="timeout"){return d(this,void 0,void 0,(function*(){return new Promise(((o,s)=>{const a=t.subscribe((t=>{try{e(t),o("OK")}catch(t){s(t)}finally{a.unsubscribe(),clearTimeout(l)}})),l=setTimeout((()=>{a.unsubscribe(),s(r)}),i);n()}))}))}function O(t,e,n,i=0,r="timeout"){return d(this,void 0,void 0,(function*(){return new Promise(((o,s)=>{const a=t.subscribe((t=>{e(t).then((()=>{o("OK")})).catch((t=>{s(t)})).finally((()=>{a.unsubscribe(),clearTimeout(l)}))})),l=setTimeout((()=>{a.unsubscribe(),s(r)}),i);n()}))}))}function L(t,e,n){null==C[T]&&(C[T]={}),null==C[T].tests&&(C[T].tests=[]),C[T].tests.push(new N(T,t,e,n))}function I(t,e=!0,n){if(n=n?`${n}, `:"",t!==e)throw new Error(`${n}Expected "${e}", got "${t}"`)}function R(t,e,n=.001,i){if(t===Number.POSITIVE_INFINITY&&e===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY&&e===Number.NEGATIVE_INFINITY||t===Number.NaN&&e===Number.NaN||isNaN(t)&&isNaN(e))return;const r=Math.abs(t-e)<n;if(I(r,!0,`${null!=i?i:""} (tolerance = ${n})`),!r)throw new Error(`Expected ${e}, got ${t} (tolerance = ${n})`)}function P(t,e,n){var i;T=t,e(),C[T]&&(C[T].clear=null===(i=null==n?void 0:n.clear)||void 0===i||i,C[T].timeout=null==n?void 0:n.timeout,C[T].benchmarks=null==n?void 0:n.benchmarks,C[T].stressTests=null==n?void 0:n.stressTests)}function k(t){null==C[T]&&(C[T]={}),C[T].before=t}function G(t){null==C[T]&&(C[T]={}),C[T].after=t}function D(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function U(t,e){var n,s,a,l;return d(this,void 0,void 0,(function*(){const u=t.id;if(S[u])return;const c=e?e.tests:C;if(void 0!==c[w]||void 0!==c[b]||Object.keys(c).find((t=>t.startsWith(w)||t.startsWith(E))))return void(S[u]=!0);if("DevTools"===t.name||e&&"DevTools"===e._package.name)for(const t of window.dartTests){const e=t.name.split(/\s*\|\s*!/g);let i=null!==(n=e.pop())&&void 0!==n?n:t.name,r=e.length?E+": "+e.join(": "):E,o=i.split(" | ");i=o[o.length-1],o.unshift(r),o.pop(),r=o.join(": "),void 0===c[r]&&(c[r]={tests:[],clear:!0}),c[r].tests.push(new N(r,i,t.test,{isAggregated:!1,timeout:null!==(a=null===(s=t.options)||void 0===s?void 0:s.timeout)&&void 0!==a?a:f,skipReason:null===(l=t.options)||void 0===l?void 0:l.skipReason}))}const h=[],p=[],m=[],g=yield i.dapi.functions.filter(`package.id = "${u}"`).list(),v=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const t of g){const e=t.options.test,n=t.options.demoPath;if(e&&Array.isArray(e)&&e.length)for(let n=0;n<e.length;n++){const o=e[n].matchAll(v),s={};Array.from(o).forEach((t=>{t[0].startsWith("skip")?s.skip=t[1]:t[0].startsWith("wait")?s.wait=parseInt(t[2]):t[0].startsWith("cat")?s.cat=t[3]:t[0].startsWith("timeout")&&(s.timeout=parseInt(t[4]))}));const a=new N(w,1===e.length?t.name:`${t.name} ${n+1}`,(()=>d(this,void 0,void 0,(function*(){const r=yield i.functions.eval(D(e[n],t));if(s.wait&&(yield B(s.wait)),"boolean"==typeof r&&!r)throw`Failed: ${e[n]}, expected true, got ${r}`}))),{skipReason:s.skip,timeout:r.Test.isInBenchmark?s.benchmarkTimeout:s.timeout});if(s.cat){const t=w+": "+s.cat;a.category=t,void 0===c[t]&&(c[t]={tests:[],clear:!0}),c[t].tests.push(a)}else h.push(a)}if(n){const e=t.options.demoWait?parseInt(t.options.demoWait):void 0,n=new N(b,t.friendlyName,(()=>d(this,void 0,void 0,(function*(){i.shell.isInDemo=!0,void 0===i.shell.view(r.View.BROWSE)&&(i.shell.v=r.View.createByType(r.View.BROWSE)),yield B(300),i.shell.clearLastError(),yield t.apply(),yield B(e||2e3);const n=yield i.shell.lastError;if(n)throw new Error(n);i.shell.isInDemo=!1}))),{skipReason:t.options.demoSkip});p.push(n)}if(t.hasTag("semTypeDetector")){const e=new N(A,t.friendlyName,(()=>d(this,void 0,void 0,(function*(){const e=[];for(const n of o.clone().columns){const i=yield t.apply([n]);e.push(i||n.semType)}I(e.filter((t=>t)).length,1)}))),{skipReason:t.options.skipTest});m.push(e)}}S[u]=!0,h.length&&(c[w]={tests:h,clear:!0}),p.length&&(c[b]={tests:p,clear:!0}),m.length&&(c[A]={tests:m,clear:!1})}))}function V(t){var e,n,o,s;return d(this,void 0,void 0,(function*(){const a=null===(n=null===(e=i.functions.getCurrentCall())||void 0===e?void 0:e.func)||void 0===n?void 0:n.package;yield U(a);const l=[];console.log("Running tests"),null!=t||(t={}),null!==(o=(s=t).testContext)&&void 0!==o||(s.testContext=new _),i.shell.clearLastError();const u=function(){const t=[];return console.log=(...e)=>{t.push(...e),m(...e)},console.info=(...e)=>{t.push(...e),g(...e)},console.warn=(...e)=>{t.push(...e),v(...e)},console.error=(...e)=>{t.push(...e),y(...e)},t}();(null==t?void 0:t.stressTest)?yield function(t){var e,n,i,o,s,h;return d(this,void 0,void 0,(function*(){let d=[];for(const[t,r]of Object.entries(C)){let t=null===(e=r.tests)||void 0===e?void 0:e.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest}));r.stressTests&&(t=null===(n=r.tests)||void 0===n?void 0:n.filter((t=>{var e,n;return void 0===(null===(e=t.options)||void 0===e?void 0:e.stressTest)||!0===(null===(n=t.options)||void 0===n?void 0:n.stressTest)})));const s=null===(i=r.tests)||void 0===i?void 0:i.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));if(!s)for(let e of null!=t?t:[])null==(null===(o=e.options)||void 0===o?void 0:o.skipReason)&&d.push({test:e,value:r})}d=function(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}(d);const f=[];for(let e of d){yield c(e.value.before,null!==(s=t.category)&&void 0!==s?s:"");let n=yield H(e.test,null==t?void 0:t.test,u,r.Test.isInBenchmark?e.value.benchmarkTimeout:e.value.timeout,a.name,t.verbose);n&&f.push(n),console.log(`Test: ${null==L?void 0:L.name}; result: ${n}`),yield c(e.value.after,null!==(h=t.category)&&void 0!==h?h:"")}l.push(...f)}))}(t):yield function(t,e){var n,o,s,h,f,p,C;return d(this,void 0,void 0,(function*(){try{for(const[d,g]of Object.entries(t)){if((null==e?void 0:e.category)&&!d.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(n=e.exclude)||void 0===n?void 0:n.some((t=>d.startsWith(t)))))continue;m(`Started ${d} category`);const t=null===(o=g.tests)||void 0===o?void 0:o.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));t||(g.beforeStatus=yield c(g.before,null!==(s=e.category)&&void 0!==s?s:""));const v=null!==(h=g.tests)&&void 0!==h?h:[],y=[];if(g.clear)for(let t=0;t<v.length;t++){v[t].options&&void 0===(null===(f=v[t].options)||void 0===f?void 0:f.benchmark)&&(v[t].options||(v[t].options={}),v[t].options.benchmark=null!==(p=g.benchmarks)&&void 0!==p&&p);let n=yield H(v[t],null==e?void 0:e.test,u,r.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,a.name,e.verbose);n&&y.push(n),i.shell.closeAll(),r.Balloon.closeAll()}else for(let t=0;t<v.length;t++){let n=yield H(v[t],null==e?void 0:e.test,u,r.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,a.name,e.verbose);n&&y.push(n)}const w=y.filter((t=>"skipped"!=t.result));t||(g.afterStatus=yield c(g.after,null!==(C=e.category)&&void 0!==C?C:"")),g.afterStatus&&w.push({date:(new Date).toISOString(),logs:"",category:d,name:"after",result:g.afterStatus,success:!1,ms:0,skipped:!1}),g.beforeStatus&&w.push({date:(new Date).toISOString(),logs:"",category:d,name:"before",result:g.beforeStatus,success:!1,ms:0,skipped:!1}),l.push(...w)}}finally{console.log=m,console.info=g,console.warn=v,console.error=y}if(e.testContext.catchUnhandled&&!r.Test.isInBenchmark){yield B(1e3);const t=yield i.shell.lastError,e={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=t?t:"",success:!t,ms:0,skipped:!1};l.push(e),e.package=a.name,null!=i.shell.reportTest?yield i.shell.reportTest("package",e):yield fetch(`${i.dapi.root}/log/tests/package`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}}))}(C,t);for(let t of l)t.result=t.result.toString().replace(/"/g,"'"),null!=t.logs&&(t.logs=t.logs.toString().replace(/"/g,"'"));return l;function c(t,e){return d(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==t&&(yield Y((()=>d(this,void 0,void 0,(function*(){yield t()}))),1e5,`before ${e}: timeout error`))}catch(t){n=yield F(t)}return n}))}}))}function F(t){return d(this,void 0,void 0,(function*(){return`${t.toString()}\n${t.stack?yield r.Logger.translateStackTrace(t.stack):""}`}))}function H(t,e,n,o,s,a){var l,u,c,h,g,v,C,w;return d(this,void 0,void 0,(function*(){let d;n.length=0;let b="package";const A=null!=e&&t.name.toLowerCase()!==e.toLowerCase();let E=(null===(l=t.options)||void 0===l?void 0:l.skipReason)||A,S=A?"skipped":null===(u=t.options)||void 0===u?void 0:u.skipReason;if(r.Test.isInBenchmark&&!(null===(c=t.options)||void 0===c?void 0:c.benchmark))return void m(`SKIPPED: ${t.category} ${t.name} doesnt available in benchmark mode`);E||m(`Started ${t.category} ${t.name}`);const T=Date.now();try{if(E)d={date:(new Date).toISOString(),success:!0,result:S,ms:0,skipped:!0};else{let e=(null===(h=t.options)||void 0===h?void 0:h.timeout)===f&&o?o:null===(g=t.options)||void 0===g?void 0:g.timeout;e=e===f&&r.Test.isInBenchmark?p:e,d={date:(new Date).toISOString(),success:!0,result:null!==(v=yield Y(t.test,e))&&void 0!==v?v:"OK",ms:0,skipped:!1}}}catch(t){y(t),d={date:(new Date).toISOString(),success:!1,result:yield F(t),ms:0,skipped:!1}}if((null===(C=t.options)||void 0===C?void 0:C.isAggregated)&&d.result.constructor===r.DataFrame){const t=d.result.col("success");if(t&&(d.success=t.stats.sum===t.length),!a){const t=d.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),d.result=t}d.result=d.result.toCsv()}if(d.logs=n.join("\n"),d.ms=Date.now()-T,E||m(`Finished ${t.category} ${t.name} for ${d.ms} ms`),d.category=t.category,d.name=t.name,!A){let e={success:d.success,result:d.result,ms:d.ms,skipped:d.skipped,package:s,category:t.category,name:t.name,logs:d.logs};if(d.result.constructor==Object){const t=Object.keys(d.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:d.result[e]})),{});e=Object.assign(Object.assign({},e),t)}e.result instanceof r.DataFrame&&(e.result=JSON.stringify(null===(w=e.result)||void 0===w?void 0:w.toJson())||""),null!=i.shell.reportTest?yield i.shell.reportTest(b,e):yield fetch(`${i.dapi.root}/log/tests/${b}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}return d}))}function B(t){return d(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function q(t,e="Timeout exceeded",n=500,i=50){return d(this,void 0,void 0,(function*(){return new Promise(((r,o)=>{setTimeout((()=>{clearInterval(s),o(new Error(e))}),n);const s=setInterval((()=>{t()&&(clearInterval(s),r())}),i)}))}))}function Y(t,e,n="EXECUTION TIMEOUT"){return d(this,void 0,void 0,(function*(){let i=null;const r=new Promise(((t,r)=>{i=setTimeout((()=>{r(n)}),e)}));try{return yield Promise.race([t(),r])}finally{i&&clearTimeout(i)}}))}const $=r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])]);function j(t,e,n){var r;return d(this,void 0,void 0,(function*(){const o=null!==(r=null==n?void 0:n.packageName)&&void 0!==r?r:"";(null==n?void 0:n.detectSemanticTypes)&&(yield i.data.detectSemanticTypes(e));const s=i.shell.addTableView(e);try{yield a(s,t,o,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(s,t,o,i.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,l,n.awaitViewer)));let e=null;e=yield a(s,t,o,i.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(e=yield a(s,t,o,i.events.onViewerAdded,c,n.awaitViewer)),yield a(s,t,o,i.events.onViewLayoutApplied,h,void 0,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps}),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewLayoutApplied,h,n.awaitViewer,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(s.dataFrame=$,yield B(50),yield a(s,t,o,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,void 0,n.awaitViewer))),yield a(s,t,o,i.events.onViewerAdded,u),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,u,n.awaitViewer))}finally{}}))}},7233:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,r=e.createElement.bind(e),o=r("div"),s=r("table"),a=r("tbody"),l=r("tr"),u=Array.isArray,c=Array.prototype,h=c.concat,d=c.filter,f=c.indexOf,p=c.map,m=c.push,g=c.slice,v=c.some,y=c.splice,C=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,b=/<.+>/,A=/^\w+$/;function E(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||M(e)||O(e))?!i&&w.test(t)?e.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!i&&A.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t):[]}var S=function(){function t(t,i){if(t){if(_(t))return t;var r=t;if(I(t)){var o=i||e;if(!(r=C.test(t)&&M(o)?o.getElementById(t.slice(1).replace(/\\/g,"")):b.test(t)?J(t):_(o)?o.find(t):I(o)?x(o).find(t):E(t,o)))return}else if(L(t))return this.ready(t);(r.nodeType||r===n)&&(r=[r]),this.length=r.length;for(var s=0,a=this.length;s<a;s++)this[s]=r[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),T=S.prototype,x=T.init;function _(t){return t instanceof S}function N(t){return!!t&&t===t.window}function M(t){return!!t&&9===t.nodeType}function O(t){return!!t&&1===t.nodeType}function L(t){return"function"==typeof t}function I(t){return"string"==typeof t}function R(t){return void 0===t}function P(t){return null===t}function k(t){return!isNaN(parseFloat(t))&&isFinite(t)}function G(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function D(t,e,n){if(n){for(var i=t.length;i--;)if(!1===e.call(t[i],i,t[i]))return t}else if(G(t))for(var r=Object.keys(t),o=(i=0,r.length);i<o;i++){var s=r[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,o=t.length;i<o;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function U(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="boolean"==typeof t[0]&&t.shift(),i=t.shift(),r=t.length;if(!i)return{};if(!r)return U(n,x,i);for(var o=0;o<r;o++){var s=t[o];for(var a in s)n&&(u(s[a])||G(s[a]))?(i[a]&&i[a].constructor===s[a].constructor||(i[a]=new s[a].constructor),U(n,i[a],s[a])):i[a]=s[a]}return i}x.fn=x.prototype=T,T.length=0,T.splice=y,"function"==typeof Symbol&&(T[Symbol.iterator]=c[Symbol.iterator]),x.isWindow=N,x.isFunction=L,x.isArray=u,x.isNumeric=k,x.isPlainObject=G,x.each=D,T.each=function(t){return D(this,t)},T.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},x.extend=U,T.extend=function(t){return U(T,t)};var V=/\S+/g;function F(t){return I(t)&&t.match(V)||[]}function H(t,e,i){if(O(t)){var r=n.getComputedStyle(t,null);return i?r.getPropertyValue(e)||void 0:r[e]||t.style[e]}}function B(t,e){return parseInt(H(t,e),10)||0}function q(t,e){return B(t,"border".concat(e?"Left":"Top","Width"))+B(t,"padding".concat(e?"Left":"Top"))+B(t,"padding".concat(e?"Right":"Bottom"))+B(t,"border".concat(e?"Right":"Bottom","Width"))}T.toggleClass=function(t,e){var n=F(t),i=!R(e);return this.each((function(t,r){O(r)&&D(n,(function(t,n){i?e?r.classList.add(n):r.classList.remove(n):r.classList.toggle(n)}))}))},T.addClass=function(t){return this.toggleClass(t,!0)},T.removeAttr=function(t){var e=F(t);return this.each((function(t,n){O(n)&&D(e,(function(t,e){n.removeAttribute(e)}))}))},T.attr=function(t,e){if(t){if(I(t)){if(arguments.length<2){if(!this[0]||!O(this[0]))return;var n=this[0].getAttribute(t);return P(n)?void 0:n}return R(e)?this:P(e)?this.removeAttr(t):this.each((function(n,i){O(i)&&i.setAttribute(t,e)}))}for(var i in t)this.attr(i,t[i]);return this}},T.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},T.hasClass=function(t){return!!t&&v.call(this,(function(e){return O(e)&&e.classList.contains(t)}))},T.get=function(t){return R(t)?g.call(this):this[(t=Number(t))<0?t+this.length:t]},T.eq=function(t){return x(this.get(t))},T.first=function(){return this.eq(0)},T.last=function(){return this.eq(-1)},T.text=function(t){return R(t)?this.get().map((function(t){return O(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){O(n)&&(n.textContent=t)}))};var Y={};function $(t){return"none"===H(t,"display")}function j(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.msMatchesSelector);return!!n&&!!e&&n.call(t,e)}function W(t){return I(t)?function(e,n){return j(n,t)}:L(t)?t:_(t)?function(e,n){return t.is(n)}:t?function(e,n){return n===t}:function(){return!1}}function z(t,e){return e?t.filter(e):t}T.filter=function(t){var e=W(t);return x(d.call(this,(function(t,n){return e.call(t,n,t)})))},T.detach=function(t){return z(this,t).each((function(t,e){e.parentNode&&e.parentNode.removeChild(e)})),this};var K=/^\s*<(\w+)[^>]*>/,Q=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,X={"*":o,tr:a,td:l,th:l,thead:s,tbody:s,tfoot:s};function J(t){if(!I(t))return[];if(Q.test(t))return[r(RegExp.$1)];var e=K.test(t)&&RegExp.$1,n=X[e]||X["*"];return n.innerHTML=t,x(n.childNodes).detach().get()}function Z(t,e,n,i){for(var r=[],o=L(e),s=i&&W(i),a=0,l=t.length;a<l;a++)if(o){var u=e(t[a]);u.length&&m.apply(r,u)}else for(var c=t[a][e];!(null==c||i&&s(-1,c));)r.push(c),c=n?c[e]:null;return r}function tt(t){return t.multiple&&t.options?Z(d.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?d.call(t,(function(t,e,n){return f.call(n,t)===e})):t}x.parseHTML=J,T.has=function(t){var e=I(t)?function(e,n){return E(t,n).length}:function(e,n){return n.contains(t)};return this.filter(e)},T.not=function(t){var e=W(t);return this.filter((function(n,i){return(!I(t)||O(i))&&!e.call(i,n,i)}))},T.val=function(t){return arguments.length?this.each((function(e,n){var i=n.multiple&&n.options;if(i||It.test(n.type)){var r=u(t)?p.call(t,String):P(t)?[]:[String(t)];i?D(n.options,(function(t,e){e.selected=r.indexOf(e.value)>=0}),!0):n.checked=r.indexOf(n.value)>=0}else n.value=R(t)||P(t)?"":t})):this[0]&&tt(this[0])},T.is=function(t){var e=W(t);return v.call(this,(function(t,n){return e.call(t,n,t)}))},x.guid=1,x.unique=et,T.add=function(t,e){return x(et(this.get().concat(x(t,e).get())))},T.children=function(t){return z(x(et(Z(this,(function(t){return t.children})))),t)},T.parent=function(t){return z(x(et(Z(this,"parentNode"))),t)},T.index=function(t){var e=t?x(t)[0]:this[0],n=t?this:x(e).parent().children();return f.call(n,e)},T.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},T.siblings=function(t){return z(x(et(Z(this,(function(t){return x(t).parent().children().not(t)})))),t)},T.find=function(t){return x(et(Z(this,(function(e){return E(t,e)}))))};var nt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,it=/^$|^module$|\/(java|ecma)script/i,rt=["type","src","nonce","noModule"];function ot(t,e,n,o,s,a,l,u){return D(t,(function(t,a){D(x(a),(function(t,a){D(x(e),(function(e,l){var u=n?l:a,c=n?t:e;!function(t,e,n,o,s){o?t.insertBefore(e,n?t.firstChild:null):"HTML"===t.nodeName?t.parentNode.replaceChild(e,t):t.parentNode.insertBefore(e,n?t:t.nextSibling),s&&function(t,e){var n=x(t);n.filter("script").add(n.find("script")).each((function(t,n){if(it.test(n.type)&&i.contains(n)){var o=r("script");o.text=n.textContent.replace(nt,""),D(rt,(function(t,e){n[e]&&(o[e]=n[e])})),e.head.insertBefore(o,null),e.head.removeChild(o)}}))}(e,t.ownerDocument)}(n?a:l,c?u.cloneNode(!0):u,o,s,!c)}),u)}),l)}),a),e}T.after=function(){return ot(arguments,this,!1,!1,!1,!0,!0)},T.append=function(){return ot(arguments,this,!1,!1,!0)},T.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(R(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){O(i)&&(e?x(i).empty().append(t):i.innerHTML=t)}))},T.appendTo=function(t){return ot(arguments,this,!0,!1,!0)},T.wrapInner=function(t){return this.each((function(e,n){var i=x(n),r=i.contents();r.length?r.wrapAll(t):i.append(t)}))},T.before=function(){return ot(arguments,this,!1,!0)},T.wrapAll=function(t){for(var e=x(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},T.wrap=function(t){return this.each((function(e,n){var i=x(t)[0];x(n).wrapAll(e?i.cloneNode(!0):i)}))},T.insertAfter=function(t){return ot(arguments,this,!0,!1,!1,!1,!1,!0)},T.insertBefore=function(t){return ot(arguments,this,!0,!0)},T.prepend=function(){return ot(arguments,this,!1,!0,!0,!0,!0)},T.prependTo=function(t){return ot(arguments,this,!0,!0,!0,!1,!1,!0)},T.contents=function(){return x(et(Z(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},T.next=function(t,e,n){return z(x(et(Z(this,"nextElementSibling",e,n))),t)},T.nextAll=function(t){return this.next(t,!0)},T.nextUntil=function(t,e){return this.next(e,!0,t)},T.parents=function(t,e){return z(x(et(Z(this,"parentElement",!0,e))),t)},T.parentsUntil=function(t,e){return this.parents(e,t)},T.prev=function(t,e,n){return z(x(et(Z(this,"previousElementSibling",e,n))),t)},T.prevAll=function(t){return this.prev(t,!0)},T.prevUntil=function(t,e){return this.prev(e,!0,t)},T.map=function(t){return x(h.apply([],p.call(this,(function(e,n){return t.call(e,n,e)}))))},T.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},T.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===H(n,"position");)n=n.offsetParent;return n||i}))},T.slice=function(t,e){return x(g.call(this,t,e))};var st=/-([a-z])/g;function at(t){return t.replace(st,(function(t,e){return e.toUpperCase()}))}T.ready=function(t){var n=function(){return setTimeout(t,0,x)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},T.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=x(e);n.replaceWith(n.children())}})),this},T.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},T.position=function(){var t=this[0];if(t){var e="fixed"===H(t,"position"),n=e?t.getBoundingClientRect():this.offset();if(!e){for(var i=t.ownerDocument,r=t.offsetParent||i.documentElement;(r===i.body||r===i.documentElement)&&"static"===H(r,"position");)r=r.parentNode;if(r!==t&&O(r)){var o=x(r).offset();n.top-=o.top+B(r,"borderTopWidth"),n.left-=o.left+B(r,"borderLeftWidth")}}return{top:n.top-B(t,"marginTop"),left:n.left-B(t,"marginLeft")}}};var lt={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};T.prop=function(t,e){if(t){if(I(t))return t=lt[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each((function(n,i){i[t]=e}));for(var n in t)this.prop(n,t[n]);return this}},T.removeProp=function(t){return this.each((function(e,n){delete n[lt[t]||t]}))};var ut=/^--/;function ct(t){return ut.test(t)}var ht={},dt=o.style,ft=["webkit","moz","ms"],pt={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function mt(t,e,n){return void 0===n&&(n=ct(t)),n||pt[t]||!k(e)?e:"".concat(e,"px")}function gt(t,e){try{return t(e)}catch(t){return e}}T.css=function(t,e){if(I(t)){var n=ct(t);return t=function(t,e){if(void 0===e&&(e=ct(t)),e)return t;if(!ht[t]){var n=at(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));D("".concat(n," ").concat(ft.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in dt)return ht[t]=n,!1}))}return ht[t]}(t,n),arguments.length<2?this[0]&&H(this[0],t,n):t?(e=mt(t,e,n),this.each((function(i,r){O(r)&&(n?r.style.setProperty(t,e):r.style[t]=e)}))):this}for(var i in t)this.css(i,t[i]);return this};var vt=/^\s+|\s+$/;function yt(t,e){var n=t.dataset[e]||t.dataset[at(e)];return vt.test(n)?n:gt(JSON.parse,n)}function Ct(t,e){var n=t.documentElement;return Math.max(t.body["scroll".concat(e)],n["scroll".concat(e)],t.body["offset".concat(e)],n["offset".concat(e)],n["client".concat(e)])}T.data=function(t,e){if(!t){if(!this[0])return;var n={};for(var i in this[0].dataset)n[i]=yt(this[0],i);return n}if(I(t))return arguments.length<2?this[0]&&yt(this[0],t):R(e)?this:this.each((function(n,i){!function(t,e,n){n=gt(JSON.stringify,n),t.dataset[at(e)]=n}(i,t,e)}));for(var i in t)this.data(i,t[i]);return this},D([!0,!1],(function(t,e){D(["Width","Height"],(function(t,n){var i="".concat(e?"outer":"inner").concat(n);T[i]=function(i){if(this[0])return N(this[0])?e?this[0]["inner".concat(n)]:this[0].document.documentElement["client".concat(n)]:M(this[0])?Ct(this[0],n):this[0]["".concat(e?"offset":"client").concat(n)]+(i&&e?B(this[0],"margin".concat(t?"Top":"Left"))+B(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),D(["Width","Height"],(function(t,e){var n=e.toLowerCase();T[n]=function(i){if(!this[0])return R(i)?void 0:this;if(!arguments.length)return N(this[0])?this[0].document.documentElement["client".concat(e)]:M(this[0])?Ct(this[0],e):this[0].getBoundingClientRect()[n]-q(this[0],!t);var r=parseInt(i,10);return this.each((function(e,i){if(O(i)){var o=H(i,"boxSizing");i.style[n]=mt(n,r+("border-box"===o?q(i,!t):0))}}))}}));var wt="___cd";T.toggle=function(t){return this.each((function(n,i){if(O(i)){var o=$(i);(R(t)?o:t)?(i.style.display=i[wt]||"",$(i)&&(i.style.display=function(t){if(Y[t])return Y[t];var n=r(t);e.body.insertBefore(n,null);var i=H(n,"display");return e.body.removeChild(n),Y[t]="none"!==i?i:"block"}(i.tagName))):o||(i[wt]=H(i,"display"),i.style.display="none")}}))},T.hide=function(){return this.toggle(!1)},T.show=function(){return this.toggle(!0)};var bt="___ce",At={focus:"focusin",blur:"focusout"},Et={mouseenter:"mouseover",mouseleave:"mouseout"},St=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Tt(t){return Et[t]||At[t]||t}function xt(t){var e=t.split(".");return[e[0],e.slice(1).sort()]}function _t(t){return t[bt]=t[bt]||{}}function Nt(t,e){return!e||!v.call(e,(function(e){return t.indexOf(e)<0}))}function Mt(t,e,n,i,r){var o=_t(t);if(e)o[e]&&(o[e]=o[e].filter((function(o){var s=o[0],a=o[1],l=o[2];if(r&&l.guid!==r.guid||!Nt(s,n)||i&&i!==a)return!0;t.removeEventListener(e,l)})));else for(e in o)Mt(t,e,n,i,r)}T.trigger=function(t,n){if(I(t)){var i=xt(t),r=i[0],o=i[1],s=Tt(r);if(!s)return this;var a=St.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(a)).initEvent(s,!0,!0),t.namespace=o.join("."),t.___ot=r}t.___td=n;var l=t.___ot in At;return this.each((function(e,n){l&&L(n[t.___ot])&&(n["___i".concat(t.type)]=!0,n[t.___ot](),n["___i".concat(t.type)]=!1),n.dispatchEvent(t)}))},T.off=function(t,e,n){var i=this;if(R(t))this.each((function(t,e){(O(e)||M(e)||N(e))&&Mt(e)}));else if(I(t))L(e)&&(n=e,e=""),D(F(t),(function(t,r){var o=xt(r),s=o[0],a=o[1],l=Tt(s);i.each((function(t,i){(O(i)||M(i)||N(i))&&Mt(i,l,a,e,n)}))}));else for(var r in t)this.off(r,t[r]);return this},T.remove=function(t){return z(this,t).detach().off(),this},T.replaceWith=function(t){return this.before(t).remove()},T.replaceAll=function(t){return x(t).replaceWith(this),this},T.on=function(t,e,n,i,r){var o=this;if(!I(t)){for(var s in t)this.on(s,e,n,t[s],r);return this}return I(e)||(R(e)||P(e)?e="":R(n)?(n=e,e=""):(i=n,n=e,e="")),L(i)||(i=n,n=void 0),i?(D(F(t),(function(t,s){var a=xt(s),l=a[0],u=a[1],c=Tt(l),h=l in Et,d=l in At;c&&o.each((function(t,o){if(O(o)||M(o)||N(o)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||Nt(u,t.namespace.split(".")))&&(e||!(d&&(t.target!==o||t.___ot===c)||h&&t.relatedTarget&&o.contains(t.relatedTarget)))){var a=o;if(e){for(var l=t.target;!j(l,e);){if(l===o)return;if(!(l=l.parentNode))return}a=l}Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return a}}),Object.defineProperty(t,"delegateTarget",{configurable:!0,get:function(){return o}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var f=i.call(a,t,t.___td);r&&Mt(o,c,u,e,s),!1===f&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||x.guid++,function(t,e,n,i,r){var o=_t(t);o[e]=o[e]||[],o[e].push([n,i,r]),t.addEventListener(e,r)}(o,c,u,e,s)}}))})),this):this},T.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var Ot=/\r?\n/g,Lt=/file|reset|submit|button|image/i,It=/radio|checkbox/i;T.serialize=function(){var t="";return this.each((function(e,n){D(n.elements||[n],(function(e,n){if(!(n.disabled||!n.name||"FIELDSET"===n.tagName||Lt.test(n.type)||It.test(n.type)&&!n.checked)){var i=tt(n);R(i)||D(u(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(Ot,"\r\n")))}(n.name,i)}))}}))})),t.slice(1)},t.exports=x}()},6677:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),r=n.n(i),o=n(6314),s=n.n(o)()(r());s.push([t.id,".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/utils/src/u2.css"],names:[],mappings:"AAAA;;AAEA;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,kBAAkB;AACtB;;AAEA;IACI,SAAS;AACb",sourcesContent:[".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}"],sourceRoot:""}]);const a=s},365:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),r=n.n(i),o=n(6314),s=n.n(o)()(r());s.push([t.id,".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n","",{version:3,sources:["webpack://./src/styles.css"],names:[],mappings:"AAAA;EACE,kBAAkB;AACpB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,kBAAkB;EAClB,QAAQ;EACR,kBAAkB;EAClB,WAAW;EACX,UAAU;AACZ;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,gCAAgC;EAChC,kBAAkB;AACpB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,aAAa;EACb,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,iDAAiD;EACjD,cAAc;EACd,kBAAkB;EAClB,WAAW;EACX,eAAe;AACjB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;AACV",sourcesContent:[".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n"],sourceRoot:""}]);const a=s},6314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,r,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var u=0;u<t.length;u++){var c=[].concat(t[u]);i&&s[c[0]]||(void 0!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},1354:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),o="/*# ".concat(r," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},9982:function(t,e,n){var i;!function(e,r){var o={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,i,r,o){for(var s,a,l,u,c,h,d,f,p,m,g,v,y;o>=64;){for(s=n[0],a=n[1],l=n[2],u=n[3],c=n[4],h=n[5],d=n[6],f=n[7],m=0;m<16;m++)g=r+4*m,t[m]=(255&i[g])<<24|(255&i[g+1])<<16|(255&i[g+2])<<8|255&i[g+3];for(m=16;m<64;m++)v=((p=t[m-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,y=((p=t[m-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,t[m]=(v+t[m-7]|0)+(y+t[m-16]|0);for(m=0;m<64;m++)v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&h^~c&d)|0)+(f+(e[m]+t[m]|0)|0)|0,y=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&a^s&l^a&l)|0,f=d,d=h,h=c,c=u+v|0,u=l,l=a,a=s,s=v+y|0;n[0]+=s,n[1]+=a,n[2]+=l,n[3]+=u,n[4]+=c,n[5]+=h,n[6]+=d,n[7]+=f,r+=64,o-=64}return r}var i=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[i++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(i=n(this.temp,this.state,t,i,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[i++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,i=this.bufferLength,r=e/536870912|0,o=e<<3,s=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<s-8;a++)this.buffer[a]=0;this.buffer[s-8]=r>>>24&255,this.buffer[s-7]=r>>>16&255,this.buffer[s-6]=r>>>8&255,this.buffer[s-5]=r>>>0&255,this.buffer[s-4]=o>>>24&255,this.buffer[s-3]=o>>>16&255,this.buffer[s-2]=o>>>8&255,this.buffer[s-1]=o>>>0&255,n(this.temp,this.state,this.buffer,0,s),this.finished=!0}for(a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=i;var r=function(){function t(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new i).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function o(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new r(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var r=i[0];if(0===r)throw new Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=r,t.hash=o,t.default=o,t.hmac=s;var l=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,i){void 0===e&&(e=l),void 0===i&&(i=32);for(var o=new Uint8Array([1]),u=s(e,t),c=new r(u),h=new Uint8Array(c.digestLength),d=h.length,f=new Uint8Array(i),p=0;p<i;p++)d===h.length&&(a(h,c,n,o),d=0),f[p]=h[d++];return c.clean(),h.fill(0),o.fill(0),f},t.pbkdf2=function(t,e,n,i){for(var o=new r(t),s=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(i),h=0;h*s<i;h++){var d=h+1;a[0]=d>>>24&255,a[1]=d>>>16&255,a[2]=d>>>8&255,a[3]=d>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(u);for(var f=0;f<s;f++)l[f]=u[f];for(f=2;f<=n;f++){o.reset(),o.update(u).finish(u);for(var p=0;p<s;p++)l[p]^=u[p]}for(f=0;f<s&&h*s+f<i;f++)c[h*s+f]=l[f]}for(h=0;h<s;h++)l[h]=u[h]=0;for(h=0;h<4;h++)a[h]=0;return o.clean(),c}}(o);var s=o.default;for(var a in o)s[a]=o[a];"object"==typeof t.exports?t.exports=s:void 0===(i=function(){return s}.call(o,n,o,t))||(t.exports=i)}()},2787:(t,e,n)=>{"use strict";n.d(e,{I:()=>r});const i=new Uint32Array(65536),r=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,r=e.length,o=1<<n-1;let s=-1,a=0,l=n,u=n;for(;u--;)i[t.charCodeAt(u)]|=1<<u;for(u=0;u<r;u++){let t=i[e.charCodeAt(u)];const n=t|a;t|=(t&s)+s^s,a|=~(t|s),s&=t,a&o&&l++,s&o&&l--,a=a<<1|1,s=s<<1|~(n|a),a&=n}for(u=n;u--;)i[t.charCodeAt(u)]=0;return l})(t,e):((t,e)=>{const n=e.length,r=t.length,o=[],s=[],a=Math.ceil(n/32),l=Math.ceil(r/32);for(let t=0;t<a;t++)s[t]=-1,o[t]=0;let u=0;for(;u<l-1;u++){let a=0,l=-1;const c=32*u,h=Math.min(32,r)+c;for(let e=c;e<h;e++)i[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],r=s[t/32|0]>>>t&1,u=o[t/32|0]>>>t&1,c=n|a,h=((n|u)&l)+l^l|n|u;let d=a|~(h|l),f=l&h;d>>>31^r&&(s[t/32|0]^=1<<t),f>>>31^u&&(o[t/32|0]^=1<<t),d=d<<1|r,f=f<<1|u,l=f|~(c|d),a=d&c}for(let e=c;e<h;e++)i[t.charCodeAt(e)]=0}let c=0,h=-1;const d=32*u,f=Math.min(32,r-d)+d;for(let e=d;e<f;e++)i[t.charCodeAt(e)]|=1<<e;let p=r;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],a=s[t/32|0]>>>t&1,l=o[t/32|0]>>>t&1,u=n|c,d=((n|l)&h)+h^h|n|l;let f=c|~(d|h),m=h&d;p+=f>>>r-1&1,p-=m>>>r-1&1,f>>>31^a&&(s[t/32|0]^=1<<t),m>>>31^l&&(o[t/32|0]^=1<<t),f=f<<1|a,m=m<<1|l,h=m|~(u|f),c=f&u}for(let e=d;e<f;e++)i[t.charCodeAt(e)]=0;return p})(t,e)}},9937:t=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(t,e)=>{e.assign=function(t){t=t||{};var e,n,i,r=Array.prototype.slice.call(arguments).slice(1);for(e=0,i=r.length;e<i;e++)if(r[e])for(n in r[e])t[n]=r[e][n];return t},e.validateSettings=function(t){return"linLogMode"in t&&"boolean"!=typeof t.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&"boolean"!=typeof t.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&"boolean"!=typeof t.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&"number"!=typeof t.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in t)||"number"==typeof t.scalingRatio&&t.scalingRatio>=0?"strongGravityMode"in t&&"boolean"!=typeof t.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in t)||"number"==typeof t.gravity&&t.gravity>=0?"slowDown"in t&&!("number"==typeof t.slowDown||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&"boolean"!=typeof t.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in t)||"number"==typeof t.barnesHutTheta&&t.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},e.graphToByteArrays=function(t,e){var n,i=t.order,r=t.size,o={},s=new Float32Array(10*i),a=new Float32Array(3*r);return n=0,t.forEachNode((function(t,e){o[t]=n,s[n]=e.x,s[n+1]=e.y,s[n+2]=0,s[n+3]=0,s[n+4]=0,s[n+5]=0,s[n+6]=1,s[n+7]=1,s[n+8]=e.size||1,s[n+9]=e.fixed?1:0,n+=10})),n=0,t.forEachEdge((function(t,i,r,l,u,c,h){var d=o[r],f=o[l],p=e(t,i,r,l,u,c,h);s[d+6]+=p,s[f+6]+=p,a[n]=d,a[n+1]=f,a[n+2]=p,n+=3})),{nodes:s,edges:a}},e.assignLayoutChanges=function(t,e,n){var i=0;t.updateEachNodeAttributes((function(t,r){return r.x=e[i],r.y=e[i+1],i+=10,n?n(t,r):r}))},e.readGraphPositions=function(t,e){var n=0;t.forEachNode((function(t,i){e[n]=i.x,e[n+1]=i.y,n+=10}))},e.collectLayoutChanges=function(t,e,n){for(var i=t.nodes(),r={},o=0,s=0,a=e.length;o<a;o+=10){if(n){var l=Object.assign({},t.getNodeAttributes(i[s]));l.x=e[o],l.y=e[o+1],l=n(i[s],l),r[i[s]]={x:l.x,y:l.y}}else r[i[s]]={x:e[o],y:e[o+1]};s++}return r},e.createWorker=function(t){var e=window.URL||window.webkitURL,n=t.toString(),i=e.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return e.revokeObjectURL(i),r}},8903:(t,e,n)=>{var i=n(1736),r=n(8153).Fd,o=n(2561),s=n(1782),a=n(9937);function l(t,e,n){if(!i(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var l=n.iterations;if("number"!=typeof l)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(l<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var u=r("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,c="function"==typeof n.outputReducer?n.outputReducer:null,h=s.assign({},a,n.settings),d=s.validateSettings(h);if(d)throw new Error("graphology-layout-forceatlas2: "+d.message);var f,p=s.graphToByteArrays(e,u);for(f=0;f<l;f++)o(h,p.nodes,p.edges);if(!t)return s.collectLayoutChanges(e,p.nodes);s.assignLayoutChanges(e,p.nodes,c)}var u=l.bind(null,!1);u.assign=l.bind(null,!0),u.inferSettings=function(t){var e="number"==typeof t?t:t.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}},t.exports=u},2561:t=>{var e=10;t.exports=function(t,n,i){var r,o,s,a,l,u,c,h,d,f,p,m,g,v,y,C,w,b,A,E,S,T,x,_=n.length,N=i.length,M=t.adjustSizes,O=t.barnesHutTheta*t.barnesHutTheta,L=[];for(s=0;s<_;s+=e)n[s+4]=n[s+2],n[s+5]=n[s+3],n[s+2]=0,n[s+3]=0;if(t.outboundAttractionDistribution){for(p=0,s=0;s<_;s+=e)p+=n[s+6];p/=_/e}if(t.barnesHutOptimize){var I,R,P,k=1/0,G=-1/0,D=1/0,U=-1/0;for(s=0;s<_;s+=e)k=Math.min(k,n[s+0]),G=Math.max(G,n[s+0]),D=Math.min(D,n[s+1]),U=Math.max(U,n[s+1]);var V=G-k,F=U-D;for(V>F?U=(D-=(V-F)/2)+V:G=(k-=(F-V)/2)+F,L[0]=-1,L[1]=(k+G)/2,L[2]=(D+U)/2,L[3]=Math.max(G-k,U-D),L[4]=-1,L[5]=-1,L[6]=0,L[7]=0,L[8]=0,r=1,s=0;s<_;s+=e)for(o=0,P=3;;){if(!(L[o+5]>=0)){if(L[o+0]<0){L[o+0]=s;break}if(L[o+5]=9*r,h=L[o+3]/2,L[(d=L[o+5])+0]=-1,L[d+1]=L[o+1]-h,L[d+2]=L[o+2]-h,L[d+3]=h,L[d+4]=d+9,L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,L[(d+=9)+0]=-1,L[d+1]=L[o+1]-h,L[d+2]=L[o+2]+h,L[d+3]=h,L[d+4]=d+9,L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,L[(d+=9)+0]=-1,L[d+1]=L[o+1]+h,L[d+2]=L[o+2]-h,L[d+3]=h,L[d+4]=d+9,L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,L[(d+=9)+0]=-1,L[d+1]=L[o+1]+h,L[d+2]=L[o+2]+h,L[d+3]=h,L[d+4]=L[o+4],L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,r+=4,I=n[L[o+0]+0]<L[o+1]?n[L[o+0]+1]<L[o+2]?L[o+5]:L[o+5]+9:n[L[o+0]+1]<L[o+2]?L[o+5]+18:L[o+5]+27,L[o+6]=n[L[o+0]+6],L[o+7]=n[L[o+0]+0],L[o+8]=n[L[o+0]+1],L[I+0]=L[o+0],L[o+0]=-1,I===(R=n[s+0]<L[o+1]?n[s+1]<L[o+2]?L[o+5]:L[o+5]+9:n[s+1]<L[o+2]?L[o+5]+18:L[o+5]+27)){if(P--){o=I;continue}P=3;break}L[R+0]=s;break}I=n[s+0]<L[o+1]?n[s+1]<L[o+2]?L[o+5]:L[o+5]+9:n[s+1]<L[o+2]?L[o+5]+18:L[o+5]+27,L[o+7]=(L[o+7]*L[o+6]+n[s+0]*n[s+6])/(L[o+6]+n[s+6]),L[o+8]=(L[o+8]*L[o+6]+n[s+1]*n[s+6])/(L[o+6]+n[s+6]),L[o+6]+=n[s+6],o=I}}if(t.barnesHutOptimize){for(m=t.scalingRatio,s=0;s<_;s+=e)for(o=0;;)if(L[o+5]>=0){if(C=Math.pow(n[s+0]-L[o+7],2)+Math.pow(n[s+1]-L[o+8],2),4*(f=L[o+3])*f/C<O){if(g=n[s+0]-L[o+7],v=n[s+1]-L[o+8],!0===M?C>0?(w=m*n[s+6]*L[o+6]/C,n[s+2]+=g*w,n[s+3]+=v*w):C<0&&(w=-m*n[s+6]*L[o+6]/Math.sqrt(C),n[s+2]+=g*w,n[s+3]+=v*w):C>0&&(w=m*n[s+6]*L[o+6]/C,n[s+2]+=g*w,n[s+3]+=v*w),(o=L[o+4])<0)break;continue}o=L[o+5]}else if((u=L[o+0])>=0&&u!==s&&(C=(g=n[s+0]-n[u+0])*g+(v=n[s+1]-n[u+1])*v,!0===M?C>0?(w=m*n[s+6]*n[u+6]/C,n[s+2]+=g*w,n[s+3]+=v*w):C<0&&(w=-m*n[s+6]*n[u+6]/Math.sqrt(C),n[s+2]+=g*w,n[s+3]+=v*w):C>0&&(w=m*n[s+6]*n[u+6]/C,n[s+2]+=g*w,n[s+3]+=v*w)),(o=L[o+4])<0)break}else for(m=t.scalingRatio,a=0;a<_;a+=e)for(l=0;l<a;l+=e)g=n[a+0]-n[l+0],v=n[a+1]-n[l+1],!0===M?(C=Math.sqrt(g*g+v*v)-n[a+8]-n[l+8])>0?(w=m*n[a+6]*n[l+6]/C/C,n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w):C<0&&(w=100*m*n[a+6]*n[l+6],n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w):(C=Math.sqrt(g*g+v*v))>0&&(w=m*n[a+6]*n[l+6]/C/C,n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w);for(d=t.gravity/t.scalingRatio,m=t.scalingRatio,s=0;s<_;s+=e)w=0,g=n[s+0],v=n[s+1],C=Math.sqrt(Math.pow(g,2)+Math.pow(v,2)),t.strongGravityMode?C>0&&(w=m*n[s+6]*d):C>0&&(w=m*n[s+6]*d/C),n[s+2]-=g*w,n[s+3]-=v*w;for(m=1*(t.outboundAttractionDistribution?p:1),c=0;c<N;c+=3)a=i[c+0],l=i[c+1],h=i[c+2],y=Math.pow(h,t.edgeWeightInfluence),g=n[a+0]-n[l+0],v=n[a+1]-n[l+1],!0===M?(C=Math.sqrt(g*g+v*v)-n[a+8]-n[l+8],t.linLogMode?t.outboundAttractionDistribution?C>0&&(w=-m*y*Math.log(1+C)/C/n[a+6]):C>0&&(w=-m*y*Math.log(1+C)/C):t.outboundAttractionDistribution?C>0&&(w=-m*y/n[a+6]):C>0&&(w=-m*y)):(C=Math.sqrt(Math.pow(g,2)+Math.pow(v,2)),t.linLogMode?t.outboundAttractionDistribution?C>0&&(w=-m*y*Math.log(1+C)/C/n[a+6]):C>0&&(w=-m*y*Math.log(1+C)/C):t.outboundAttractionDistribution?(C=1,w=-m*y/n[a+6]):(C=1,w=-m*y)),C>0&&(n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w);if(!0===M)for(s=0;s<_;s+=e)1!==n[s+9]&&((b=Math.sqrt(Math.pow(n[s+2],2)+Math.pow(n[s+3],2)))>10&&(n[s+2]=10*n[s+2]/b,n[s+3]=10*n[s+3]/b),A=n[s+6]*Math.sqrt((n[s+4]-n[s+2])*(n[s+4]-n[s+2])+(n[s+5]-n[s+3])*(n[s+5]-n[s+3])),E=Math.sqrt((n[s+4]+n[s+2])*(n[s+4]+n[s+2])+(n[s+5]+n[s+3])*(n[s+5]+n[s+3]))/2,S=.1*Math.log(1+E)/(1+Math.sqrt(A)),T=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=T,x=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=x);else for(s=0;s<_;s+=e)1!==n[s+9]&&(A=n[s+6]*Math.sqrt((n[s+4]-n[s+2])*(n[s+4]-n[s+2])+(n[s+5]-n[s+3])*(n[s+5]-n[s+3])),E=Math.sqrt((n[s+4]+n[s+2])*(n[s+4]+n[s+2])+(n[s+5]+n[s+3])*(n[s+5]+n[s+3]))/2,S=n[s+7]*Math.log(1+E)/(1+Math.sqrt(A)),n[s+7]=Math.min(1,Math.sqrt(S*(Math.pow(n[s+2],2)+Math.pow(n[s+3],2))/(1+Math.sqrt(A)))),T=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=T,x=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=x);return{}}},8153:(t,e)=>{function n(t){return"number"!=typeof t||isNaN(t)?1:t}e.Fd=function(t){return function(t,e){var n={},i=function(t){return void 0===t?e:t};"function"==typeof e&&(i=e);var r=function(e){return i(e[t])},o=function(){return i(void 0)};return"string"==typeof t?(n.fromAttributes=r,n.fromGraph=function(t,e){return r(t.getEdgeAttributes(e))},n.fromEntry=function(t,e){return r(e)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof t?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(e,n){var r=e.extremities(n);return i(t(n,e.getEdgeAttributes(n),r[0],r[1],e.getNodeAttributes(r[0]),e.getNodeAttributes(r[1]),e.isUndirected(n)))},n.fromEntry=function(e,n,r,o,s,a,l){return i(t(e,n,r,o,s,a,l))},n.fromPartialEntry=function(e,n,r,o){return i(t(e,n,r,o))},n.fromMinimalEntry=function(e,n){return i(t(e,n))}):(n.fromAttributes=o,n.fromGraph=o,n.fromEntry=o,n.fromMinimalEntry=o),n}(t,n)}},1736:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},934:function(t){t.exports=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function r(t,e,n){return r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&i(o,n.prototype),o},r.apply(null,arguments)}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,s)}function s(){return r(t,arguments,n(this).constructor)}return s.prototype=Object.create(t.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),i(s,t)},o(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var a=function(){for(var t=arguments[0],e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var i in arguments[e])t[i]=arguments[e][i];return t};function l(t,e,n,i){var r=t._nodes.get(e),o=null;return r?o="mixed"===i?r.out&&r.out[n]||r.undirected&&r.undirected[n]:"directed"===i?r.out&&r.out[n]:r.undirected&&r.undirected[n]:o}function u(e){return"object"===t(e)&&null!==e}function c(t){var e;for(e in t)return!1;return!0}function h(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function d(t,e,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(t,e,i)}function f(t){return!(!u(t)||t.attributes&&!Array.isArray(t.attributes))}"function"==typeof Object.assign&&(a=Object.assign);var p,m={exports:{}},g="object"==typeof Reflect?Reflect:null,v=g&&"function"==typeof g.apply?g.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};p=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var y=Number.isNaN||function(t){return t!=t};function C(){C.init.call(this)}m.exports=C,m.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}M(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&M(t,"error",e,{once:!0})}(t,r)}))},C.EventEmitter=C,C.prototype._events=void 0,C.prototype._eventsCount=0,C.prototype._maxListeners=void 0;var w=10;function b(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function A(t){return void 0===t._maxListeners?C.defaultMaxListeners:t._maxListeners}function E(t,e,n,i){var r,o,s,a;if(b(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(r=A(t))>0&&s.length>r&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return t}function S(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function T(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=S.bind(i);return r.listener=n,i.wrapFn=r,r}function x(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(r):N(r,r.length)}function _(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function N(t,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=t[i];return n}function M(t,e,n,i){if("function"==typeof t.on)i.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function r(o){i.once&&t.removeEventListener(e,r),n(o)}))}}function O(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}Object.defineProperty(C,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(t){if("number"!=typeof t||t<0||y(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w=t}}),C.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},C.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||y(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},C.prototype.getMaxListeners=function(){return A(this)},C.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=r[t];if(void 0===a)return!1;if("function"==typeof a)v(a,this,e);else{var l=a.length,u=N(a,l);for(n=0;n<l;++n)v(u[n],this,e)}return!0},C.prototype.addListener=function(t,e){return E(this,t,e,!1)},C.prototype.on=C.prototype.addListener,C.prototype.prependListener=function(t,e){return E(this,t,e,!0)},C.prototype.once=function(t,e){return b(e),this.on(t,T(this,t,e)),this},C.prototype.prependOnceListener=function(t,e){return b(e),this.prependListener(t,T(this,t,e)),this},C.prototype.removeListener=function(t,e){var n,i,r,o,s;if(b(e),void 0===(i=this._events))return this;if(void 0===(n=i[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,r),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,s||e)}return this},C.prototype.off=C.prototype.removeListener,C.prototype.removeAllListeners=function(t){var e,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},C.prototype.listeners=function(t){return x(this,t,!0)},C.prototype.rawListeners=function(t){return x(this,t,!1)},C.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},C.prototype.listenerCount=_,C.prototype.eventNames=function(){return this._eventsCount>0?p(this._events):[]},"undefined"!=typeof Symbol&&(O.prototype[Symbol.iterator]=function(){return this}),O.of=function(){var t=arguments,e=t.length,n=0;return new O((function(){return n>=e?{done:!0}:{done:!1,value:t[n++]}}))},O.empty=function(){return new O((function(){return{done:!0}}))},O.fromSequence=function(t){var e=0,n=t.length;return new O((function(){return e>=n?{done:!0}:{done:!1,value:t[e++]}}))},O.is=function(t){return t instanceof O||"object"==typeof t&&null!==t&&"function"==typeof t.next};var L=O,I={};I.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,I.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var R=L,P=I,k=P.ARRAY_BUFFER_SUPPORT,G=P.SYMBOL_SUPPORT,D=function(t){var e=function(t){return"string"==typeof t||Array.isArray(t)||k&&ArrayBuffer.isView(t)?R.fromSequence(t):"object"!=typeof t||null===t?null:G&&"function"==typeof t[Symbol.iterator]?t[Symbol.iterator]():"function"==typeof t.next?t:null}(t);if(!e)throw new Error("obliterator: target is not iterable nor a valid iterator.");return e},U=D,V=function(t,e){for(var n,i=arguments.length>1?e:1/0,r=i!==1/0?new Array(i):[],o=0,s=U(t);;){if(o===i)return r;if((n=s.next()).done)return o!==e&&(r.length=o),r;r[o++]=n.value}},F=function(t){function n(e){var n;return(n=t.call(this)||this).name="GraphError",n.message=e,n}return e(n,t),n}(o(Error)),H=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(s(i),n.prototype.constructor),i}return e(n,t),n}(F),B=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(s(i),n.prototype.constructor),i}return e(n,t),n}(F),q=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(s(i),n.prototype.constructor),i}return e(n,t),n}(F);function Y(t,e){this.key=t,this.attributes=e,this.clear()}function $(t,e){this.key=t,this.attributes=e,this.clear()}function j(t,e){this.key=t,this.attributes=e,this.clear()}function W(t,e,n,i,r){this.key=e,this.attributes=r,this.undirected=t,this.source=n,this.target=i}function z(t,e,n,i,r,o,s){var a,l,u,c;if(i=""+i,0===n){if(!(a=t._nodes.get(i)))throw new B("Graph.".concat(e,': could not find the "').concat(i,'" node in the graph.'));u=r,c=o}else if(3===n){if(r=""+r,!(l=t._edges.get(r)))throw new B("Graph.".concat(e,': could not find the "').concat(r,'" edge in the graph.'));var h=l.source.key,d=l.target.key;if(i===h)a=l.target;else{if(i!==d)throw new B("Graph.".concat(e,': the "').concat(i,'" node is not attached to the "').concat(r,'" edge (').concat(h,", ").concat(d,")."));a=l.source}u=o,c=s}else{if(!(l=t._edges.get(i)))throw new B("Graph.".concat(e,': could not find the "').concat(i,'" edge in the graph.'));a=1===n?l.source:l.target,u=r,c=o}return[a,u,c]}Y.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},$.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},j.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},W.prototype.attach=function(){var t="out",e="in";this.undirected&&(t=e="undirected");var n=this.source.key,i=this.target.key;this.source[t][i]=this,this.undirected&&n===i||(this.target[e][n]=this)},W.prototype.attachMulti=function(){var t="out",e="in",n=this.source.key,i=this.target.key;this.undirected&&(t=e="undirected");var r=this.source[t],o=r[i];if(void 0===o)return r[i]=this,void(this.undirected&&n===i||(this.target[e][n]=this));o.previous=this,this.next=o,r[i]=this,this.target[e][n]=this},W.prototype.detach=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][e],delete this.target[i][t]},W.prototype.detachMulti=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[i][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[i][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var K=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];return s.attributes[a]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){return z(this,e,n,t,i)[0].attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];return s.attributes.hasOwnProperty(a)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var s=z(this,e,n,t,i,r,o),a=s[0],l=s[1],u=s[2];return a.attributes[l]=u,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var s=z(this,e,n,t,i,r,o),a=s[0],l=s[1],u=s[2];if("function"!=typeof u)throw new H("Graph.".concat(e,": updater should be a function."));var c=a.attributes,h=u(c[l]);return c[l]=h,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];return delete s.attributes[a],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:a}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];if(!u(a))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return s.attributes=a,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],l=o[1];if(!u(l))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return a(s.attributes,l),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:l}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];if("function"!=typeof a)throw new H("Graph.".concat(e,": provided updater is not a function."));return s.attributes=a(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}}],Q=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes[i]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var r=""+t,o=""+arguments[1];if(!(i=l(this,r,o,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes.hasOwnProperty(i)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+t,a=""+i;if(i=arguments[2],r=arguments[3],!(o=l(this,s,a,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return o.attributes[i]=r,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+t,a=""+i;if(i=arguments[2],r=arguments[3],!(o=l(this,s,a,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof r)throw new H("Graph.".concat(e,": updater should be a function."));return o.attributes[i]=r(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return delete r.attributes[i],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:i}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return r.attributes=i,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return a(r.attributes,i),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:i}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof i)throw new H("Graph.".concat(e,": provided updater is not a function."));return r.attributes=i(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}}],X=L,J=D,Z=function(){var t=arguments,e=null,n=-1;return new X((function(){for(var i=null;;){if(null===e){if(++n>=t.length)return{done:!0};e=J(t[n])}if(!0!==(i=e.next()).done)break;e=null}return i}))},tt=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function et(t,e,n,i){var r=!1;for(var o in e)if(o!==i){var s=e[o];if(r=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),t&&r)return s.key}}function nt(t,e,n,i){var r,o,s,a=!1;for(var l in e)if(l!==i){r=e[l];do{if(o=r.source,s=r.target,a=n(r.key,r.attributes,o.key,s.key,o.attributes,s.attributes,r.undirected),t&&a)return r.key;r=r.next}while(void 0!==r)}}function it(t,e){var n,i=Object.keys(t),r=i.length,o=0;return new L((function(){do{if(n)n=n.next;else{if(o>=r)return{done:!0};var s=i[o++];if(s===e){n=void 0;continue}n=t[s]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function rt(t,e,n,i){var r=e[n];if(r){var o=r.source,s=r.target;return i(r.key,r.attributes,o.key,s.key,o.attributes,s.attributes,r.undirected)&&t?r.key:void 0}}function ot(t,e,n,i){var r=e[n];if(r){var o=!1;do{if(o=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),t&&o)return r.key;r=r.next}while(void 0!==r)}}function st(t,e){var n=t[e];return void 0!==n.next?new L((function(){if(!n)return{done:!0};var t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}})):L.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function at(t,e,n,i){if(0!==e.size)for(var r,o,s="mixed"!==n&&n!==e.type,a="undirected"===n,l=!1,u=e._edges.values();!0!==(r=u.next()).done;)if(o=r.value,!s||o.undirected===a){var c=o,h=c.key,d=c.attributes,f=c.source,p=c.target;if(l=i(h,d,f.key,p.key,f.attributes,p.attributes,o.undirected),t&&l)return h}}function lt(t,e,n,i,r,o){var s,a=e?nt:et;if("undirected"!==n){if("out"!==i&&(s=a(t,r.in,o),t&&s))return s;if("in"!==i&&(s=a(t,r.out,o,i?void 0:r.key),t&&s))return s}if("directed"!==n&&(s=a(t,r.undirected,o),t&&s))return s}function ut(t,e,n,i,r,o,s){var a,l=n?ot:rt;if("undirected"!==e){if(void 0!==r.in&&"out"!==i&&(a=l(t,r.in,o,s),t&&a))return a;if(void 0!==r.out&&"in"!==i&&(i||r.key!==o)&&(a=l(t,r.out,o,s),t&&a))return a}if("directed"!==e&&void 0!==r.undirected&&(a=l(t,r.undirected,o,s),t&&a))return a}var ct=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ht(){this.A=null,this.B=null}function dt(t,e,n,i,r){for(var o in i){var s=i[o],a=s.source,l=s.target,u=a===n?l:a;if(!e||!e.has(u.key)){var c=r(u.key,u.attributes);if(t&&c)return u.key}}}function ft(t,e,n,i,r){if("mixed"!==e){if("undirected"===e)return dt(t,null,i,i.undirected,r);if("string"==typeof n)return dt(t,null,i,i[n],r)}var o,s=new ht;if("undirected"!==e){if("out"!==n){if(o=dt(t,null,i,i.in,r),t&&o)return o;s.wrap(i.in)}if("in"!==n){if(o=dt(t,s,i,i.out,r),t&&o)return o;s.wrap(i.out)}}if("directed"!==e&&(o=dt(t,s,i,i.undirected,r),t&&o))return o}function pt(t,e,n){var i=Object.keys(n),r=i.length,o=0;return new L((function(){var s=null;do{if(o>=r)return t&&t.wrap(n),{done:!0};var a=n[i[o++]],l=a.source,u=a.target;s=l===e?u:l,t&&t.has(s.key)&&(s=null)}while(null===s);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}))}function mt(t,e,n,i,r){for(var o,s,a,l,u,c,h,d=i._nodes.values(),f=i.type;!0!==(o=d.next()).done;){var p=!1;if(s=o.value,"undirected"!==f)for(a in l=s.out){u=l[a];do{if(c=u.target,p=!0,h=r(s.key,c.key,s.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&h)return u;u=u.next}while(u)}if("directed"!==f)for(a in l=s.undirected)if(!(e&&s.key>a)){u=l[a];do{if((c=u.target).key!==a&&(c=u.source),p=!0,h=r(s.key,c.key,s.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&h)return u;u=u.next}while(u)}if(n&&!p&&(h=r(s.key,null,s.attributes,null,null,null,null),t&&h))return null}}function gt(t){if(!u(t))throw new H('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new H("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new H("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function vt(t){if(!u(t))throw new H('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new H("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new H("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new H("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new H("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}ht.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},ht.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};var yt,Ct=(yt=255&Math.floor(256*Math.random()),function(){return yt++}),wt=new Set(["directed","undirected","mixed"]),bt=new Set(["domain","_events","_eventsCount","_maxListeners"]),At={allowSelfLoops:!0,multi:!1,type:"mixed"};function Et(t,e,n){var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}function St(t,e,n,i,r,o,s,a){if(!i&&"undirected"===t.type)throw new q("Graph.".concat(e,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new q("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!u(a))throw new H("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(a,'"'));if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new q("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var l=t._nodes.get(o),c=t._nodes.get(s);if(!l)throw new B("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!c)throw new B("Graph.".concat(e,': target node "').concat(s,'" not found.'));var h={key:null,undirected:i,source:o,target:s,attributes:a};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new q("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));if(!t.multi&&(i?void 0!==l.undirected[s]:void 0!==l.out[s]))throw new q("Graph.".concat(e,': an edge linking "').concat(o,'" to "').concat(s,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var d=new W(i,r,l,c,a);t._edges.set(r,d);var f=o===s;return i?(l.undirectedDegree++,c.undirectedDegree++,f&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,c.inDegree++,f&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?d.attachMulti():d.attach(),i?t._undirectedSize++:t._directedSize++,h.key=r,t.emit("edgeAdded",h),r}function Tt(t,e,n,i,r,o,s,l,c){if(!i&&"undirected"===t.type)throw new q("Graph.".concat(e,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new q("Graph.".concat(e,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(l)if(c){if("function"!=typeof l)throw new H("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(l,'"'))}else if(!u(l))throw new H("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(l,'"'));var h;if(o=""+o,s=""+s,c&&(h=l,l=void 0),!t.allowSelfLoops&&o===s)throw new q("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var d,f,p=t._nodes.get(o),m=t._nodes.get(s);if(!n&&(d=t._edges.get(r))){if(!(d.source.key===o&&d.target.key===s||i&&d.source.key===s&&d.target.key===o))throw new q("Graph.".concat(e,': inconsistency detected when attempting to merge the "').concat(r,'" edge with "').concat(o,'" source & "').concat(s,'" target vs. ("').concat(d.source.key,'", "').concat(d.target.key,'").'));f=d}if(f||t.multi||!p||(f=i?p.undirected[s]:p.out[s]),f){var g=[f.key,!1,!1,!1];if(c?!h:!l)return g;if(c){var v=f.attributes;f.attributes=h(v),t.emit("edgeAttributesUpdated",{type:"replace",key:f.key,attributes:f.attributes})}else a(f.attributes,l),t.emit("edgeAttributesUpdated",{type:"merge",key:f.key,attributes:f.attributes,data:l});return g}l=l||{},c&&h&&(l=h(l));var y={key:null,undirected:i,source:o,target:s,attributes:l};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new q("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));var C=!1,w=!1;p||(p=Et(t,o,{}),C=!0,o===s&&(m=p,w=!0)),m||(m=Et(t,s,{}),w=!0),d=new W(i,r,p,m,l),t._edges.set(r,d);var b=o===s;return i?(p.undirectedDegree++,m.undirectedDegree++,b&&(p.undirectedLoops++,t._undirectedSelfLoopCount++)):(p.outDegree++,m.inDegree++,b&&(p.directedLoops++,t._directedSelfLoopCount++)),t.multi?d.attachMulti():d.attach(),i?t._undirectedSize++:t._directedSize++,y.key=r,t.emit("edgeAdded",y),[r,!0,C,w]}function xt(t,e){t._edges.delete(e.key);var n=e.source,i=e.target,r=e.attributes,o=e.undirected,s=n===i;o?(n.undirectedDegree--,i.undirectedDegree--,s&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,s&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:r,source:n.key,target:i.key,undirected:o})}var _t=function(n){function i(t){var e;if(e=n.call(this)||this,"boolean"!=typeof(t=a({},At,t)).multi)throw new H("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(t.multi,'".'));if(!wt.has(t.type))throw new H('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(t.type,'".'));if("boolean"!=typeof t.allowSelfLoops)throw new H("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(t.allowSelfLoops,'".'));var i="mixed"===t.type?Y:"directed"===t.type?$:j;h(s(e),"NodeDataClass",i);var r="geid_"+Ct()+"_",o=0;return h(s(e),"_attributes",{}),h(s(e),"_nodes",new Map),h(s(e),"_edges",new Map),h(s(e),"_directedSize",0),h(s(e),"_undirectedSize",0),h(s(e),"_directedSelfLoopCount",0),h(s(e),"_undirectedSelfLoopCount",0),h(s(e),"_edgeKeyGenerator",(function(){var t;do{t=r+o++}while(e._edges.has(t));return t})),h(s(e),"_options",t),bt.forEach((function(t){return h(s(e),t,e[t])})),d(s(e),"order",(function(){return e._nodes.size})),d(s(e),"size",(function(){return e._edges.size})),d(s(e),"directedSize",(function(){return e._directedSize})),d(s(e),"undirectedSize",(function(){return e._undirectedSize})),d(s(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),d(s(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),d(s(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),d(s(e),"multi",e._options.multi),d(s(e),"type",e._options.type),d(s(e),"allowSelfLoops",e._options.allowSelfLoops),d(s(e),"implementation",(function(){return"graphology"})),e}e(i,n);var r=i.prototype;return r._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},r.hasNode=function(t){return this._nodes.has(""+t)},r.hasDirectedEdge=function(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.out.hasOwnProperty(e)}throw new H("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasUndirectedEdge=function(t,e){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.undirected.hasOwnProperty(e)}throw new H("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasEdge=function(t,e){if(1===arguments.length){var n=""+t;return this._edges.has(n)}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(e)||void 0!==i.undirected&&i.undirected.hasOwnProperty(e))}throw new H("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.directedEdge=function(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new q("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(t);if(!n)throw new B('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B('Graph.directedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new q("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(t);if(!n)throw new B('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B('Graph.undirectedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.undirected&&n.undirected[e]||void 0;return i?i.key:void 0}},r.edge=function(t,e){if(this.multi)throw new q("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B('Graph.edge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(i)return i.key},r.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},r.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},r.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},r.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},r.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected},r.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areInboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected},r.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areOutboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected},r.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},r.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},r.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},r.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},r.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n},r.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n},r.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.degree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n},r.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},r.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},r.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},r.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},r.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,i+=e.directedLoops),n-i},r.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,i+=e.directedLoops),n-i},r.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.degreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,i+=2*e.directedLoops),n-i},r.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},r.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},r.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},r.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new B('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var i=n.source.key,r=n.target.key;if(t===i)return r;if(t===r)return i;throw new B('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(i,", ").concat(r,")."))},r.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new B('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},r.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},r.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},r.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},r.addNode=function(t,e){var n=function(t,e,n){if(n&&!u(n))throw new H('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(e=""+e,n=n||{},t._nodes.has(e))throw new q('Graph.addNode: the "'.concat(e,'" node already exist in the graph.'));var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}(this,t,e);return n.key},r.mergeNode=function(t,e){if(e&&!u(e))throw new H('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(e,'"'));t=""+t,e=e||{};var n=this._nodes.get(t);return n?(e&&(a(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])},r.updateNode=function(t,e){if(e&&"function"!=typeof e)throw new H('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(e,'"'));t=""+t;var n=this._nodes.get(t);if(n){if(e){var i=n.attributes;n.attributes=e(i),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}var r=e?e({}):{};return n=new this.NodeDataClass(t,r),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]},r.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new B('Graph.dropNode: could not find the "'.concat(t,'" node in the graph.'));if("undirected"!==this.type){for(var i in n.out){e=n.out[i];do{xt(this,e),e=e.next}while(e)}for(var r in n.in){e=n.in[r];do{xt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{xt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},r.dropEdge=function(t){var e;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(e=l(this,n,i,this.type)))throw new B('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" edge in the graph.'))}else if(t=""+t,!(e=this._edges.get(t)))throw new B('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return xt(this,e),this},r.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new q("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new q("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=l(this,t=""+t,e=""+e,"directed");if(!n)throw new B('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return xt(this,n),this},r.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new q("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new q("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=l(this,t,e,"undirected");if(!n)throw new B('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return xt(this,n),this},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.clearEdges=function(){for(var t,e=this._nodes.values();!0!==(t=e.next()).done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},r.getAttribute=function(t){return this._attributes[t]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},r.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.updateAttribute=function(t,e){if("function"!=typeof e)throw new H("Graph.updateAttribute: updater should be a function.");var n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},r.replaceAttributes=function(t){if(!u(t))throw new H("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(t){if(!u(t))throw new H("Graph.mergeAttributes: provided attributes are not a plain object.");return a(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this},r.updateAttributes=function(t){if("function"!=typeof t)throw new H("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(t,e){if("function"!=typeof t)throw new H("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!f(e))throw new H("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r=this._nodes.values();!0!==(n=r.next()).done;)(i=n.value).attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},r.updateEachEdgeAttributes=function(t,e){if("function"!=typeof t)throw new H("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!f(e))throw new H("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r,o,s=this._edges.values();!0!==(n=s.next()).done;)r=(i=n.value).source,o=i.target,i.attributes=t(i.key,i.attributes,r.key,o.key,r.attributes,o.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},r.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new H("Graph.forEachAdjacencyEntry: expecting a callback.");mt(!1,!1,!1,this,t)},r.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new H("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");mt(!1,!1,!0,this,t)},r.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new H("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");mt(!1,!0,!1,this,t)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new H("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");mt(!1,!0,!0,this,t)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):V(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(t){if("function"!=typeof t)throw new H("Graph.forEachNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)},r.findNode=function(t){if("function"!=typeof t)throw new H("Graph.findNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return n.key},r.mapNodes=function(t){if("function"!=typeof t)throw new H("Graph.mapNode: expecting a callback.");for(var e,n,i=this._nodes.values(),r=new Array(this.order),o=0;!0!==(e=i.next()).done;)n=e.value,r[o++]=t(n.key,n.attributes);return r},r.someNode=function(t){if("function"!=typeof t)throw new H("Graph.someNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return!0;return!1},r.everyNode=function(t){if("function"!=typeof t)throw new H("Graph.everyNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(!t((n=e.value).key,n.attributes))return!1;return!0},r.filterNodes=function(t){if("function"!=typeof t)throw new H("Graph.filterNodes: expecting a callback.");for(var e,n,i=this._nodes.values(),r=[];!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(t,e){if("function"!=typeof t)throw new H("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new H("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,i,r=e,o=this._nodes.values();!0!==(n=o.next()).done;)r=t(r,(i=n.value).key,i.attributes);return r},r.nodeEntries=function(){var t=this._nodes.values();return new L((function(){var e=t.next();if(e.done)return e;var n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},r.export=function(){var t=this,e=new Array(this._nodes.size),n=0;this._nodes.forEach((function(t,i){e[n++]=function(t,e){var n={key:t};return c(e.attributes)||(n.attributes=a({},e.attributes)),n}(i,t)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(e,r){i[n++]=function(t,e,n){var i={key:e,source:n.source.key,target:n.target.key};return c(n.attributes)||(i.attributes=a({},n.attributes)),"mixed"===t&&n.undirected&&(i.undirected=!0),i}(t.type,r,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}},r.import=function(t){var e,n,r,o,s,a=this,l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof i)return t.forEachNode((function(t,e){l?a.mergeNode(t,e):a.addNode(t,e)})),t.forEachEdge((function(t,e,n,i,r,o,s){l?s?a.mergeUndirectedEdgeWithKey(t,n,i,e):a.mergeDirectedEdgeWithKey(t,n,i,e):s?a.addUndirectedEdgeWithKey(t,n,i,e):a.addDirectedEdgeWithKey(t,n,i,e)})),this;if(!u(t))throw new H("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!u(t.attributes))throw new H("Graph.import: invalid attributes. Expecting a plain object.");l?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}if(t.nodes){if(r=t.nodes,!Array.isArray(r))throw new H("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=r.length;e<n;e++){gt(o=r[e]);var c=o,h=c.key,d=c.attributes;l?this.mergeNode(h,d):this.addNode(h,d)}}if(t.edges){var f=!1;if("undirected"===this.type&&(f=!0),r=t.edges,!Array.isArray(r))throw new H("Graph.import: invalid edges. Expecting an array.");for(e=0,n=r.length;e<n;e++){vt(s=r[e]);var p=s,m=p.source,g=p.target,v=p.attributes,y=p.undirected,C=void 0===y?f:y;"key"in s?(l?C?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:C?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,s.key,m,g,v):(l?C?this.mergeUndirectedEdge:this.mergeDirectedEdge:C?this.addUndirectedEdge:this.addDirectedEdge).call(this,m,g,v)}}return this},r.nullCopy=function(t){var e=new i(a({},this._options,t));return e.replaceAttributes(a({},this.getAttributes())),e},r.emptyCopy=function(t){var e=this.nullCopy(t);return this._nodes.forEach((function(t,n){var i=a({},t.attributes);t=new e.NodeDataClass(n,i),e._nodes.set(n,t)})),e},r.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new q('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(t.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new q("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new q("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var e,n,i=this.emptyCopy(t),r=this._edges.values();!0!==(e=r.next()).done;)St(i,"copy",!1,(n=e.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return i},r.toJSON=function(){return this.export()},r.toString=function(){return"[object Graph]"},r.inspect=function(){var e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var i={},r={};this._edges.forEach((function(t,n){var o,s=t.undirected?"--":"->",a="",l=t.source.key,u=t.target.key;t.undirected&&l>u&&(o=l,l=u,u=o);var c="(".concat(l,")").concat(s,"(").concat(u,")");n.startsWith("geid_")?e.multi&&(void 0===r[c]?r[c]=0:r[c]++,a+="".concat(r[c],". ")):a+="[".concat(n,"]: "),i[a+=c]=t.attributes}));var o={};for(var s in this)this.hasOwnProperty(s)&&!bt.has(s)&&"function"!=typeof this[s]&&"symbol"!==t(s)&&(o[s]=this[s]);return o.attributes=this._attributes,o.nodes=n,o.edges=i,h(o,"constructor",this.constructor),o},i}(m.exports.EventEmitter);"undefined"!=typeof Symbol&&(_t.prototype[Symbol.for("nodejs.util.inspect.custom")]=_t.prototype.inspect),[{name:function(t){return"".concat(t,"Edge")},generateKey:!0},{name:function(t){return"".concat(t,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(t){return"".concat(t,"EdgeWithKey")}},{name:function(t){return"".concat(t,"DirectedEdgeWithKey")},type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(t){["add","merge","update"].forEach((function(e){var n=t.name(e),i="add"===e?St:Tt;t.generateKey?_t.prototype[n]=function(r,o,s){return i(this,n,!0,"undirected"===(t.type||this.type),null,r,o,s,"update"===e)}:_t.prototype[n]=function(r,o,s,a){return i(this,n,!1,"undirected"===(t.type||this.type),r,o,s,a,"update"===e)}}))})),function(t){K.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Node"),0),i(t,n("Source"),1),i(t,n("Target"),2),i(t,n("Opposite"),3)}))}(_t),function(t){Q.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Edge"),"mixed"),i(t,n("DirectedEdge"),"directed"),i(t,n("UndirectedEdge"),"undirected")}))}(_t),function(t){tt.forEach((function(e){!function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return"function"==typeof Array.from?Array.from(t._edges.keys()):V(t._edges.keys(),t._edges.size);for(var n,i,r="undirected"===e?t.undirectedSize:t.directedSize,o=new Array(r),s="undirected"===e,a=t._edges.values(),l=0;!0!==(n=a.next()).done;)(i=n.value).undirected===s&&(o[l++]=i.key);return o}(this,i);if(1===arguments.length){t=""+t;var o=this._nodes.get(t);if(void 0===o)throw new B("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n,i){var r=[];return lt(!1,t,e,n,i,(function(t){r.push(t)})),r}(this.multi,"mixed"===i?this.type:i,r,o)}if(2===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new B("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i,r){var o=[];return ut(!1,t,e,n,i,r,(function(t){o.push(t)})),o}(i,this.multi,r,s,e)}throw new H("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return at(!1,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var s=this._nodes.get(t);if(void 0===s)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return lt(!1,this.multi,"mixed"===i?this.type:i,r,s,n)}if(3===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!1,i,this.multi,r,a,e,n)}throw new H("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){var t,e=Array.prototype.slice.call(arguments),n=e.pop();if(0===e.length){var r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),t=new Array(r);var s=0;e.push((function(e,i,r,o,a,l,u){t[s++]=n(e,i,r,o,a,l,u)}))}else t=[],e.push((function(e,i,r,o,s,a,l){t.push(n(e,i,r,o,s,a,l))}));return this[o].apply(this,e),t};var a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((function(t,i,r,o,s,a,l){e(t,i,r,o,s,a,l)&&n.push(t)})),this[o].apply(this,t),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[l]=function(){var t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new H("Graph.".concat(l,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new H("Graph.".concat(l,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);var i=e;return n.push((function(e,n,r,o,s,a,l){i=t(i,e,n,r,o,s,a,l)})),this[o].apply(this,n),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return at(!0,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var s=this._nodes.get(t);if(void 0===s)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return lt(!0,this.multi,"mixed"===i?this.type:i,r,s,n)}if(3===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!0,i,this.multi,r,a,e,n)}throw new H("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var s="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,s,a){return e(t,n,i,r,o,s,a)})),!!this[o].apply(this,t)};var a="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,s,a){return!e(t,n,i,r,o,s,a)})),!this[o].apply(this,t)}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return L.empty();if(!arguments.length)return function(t,e){if(0===t.size)return L.empty();var n="mixed"!==e&&e!==t.type,i="undirected"===e,r=t._edges.values();return new L((function(){for(var t,e;;){if((t=r.next()).done)return t;if(e=t.value,!n||e.undirected===i)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}))}(this,i);if(1===arguments.length){t=""+t;var n=this._nodes.get(t);if(!n)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){var i=L.empty();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(i=Z(i,it(n.in))),"in"!==e&&void 0!==n.out&&(i=Z(i,it(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(i=Z(i,it(n.undirected))),i}(i,r,n)}if(2===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i){var r=L.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&i in n.in&&(r=Z(r,st(n.in,i))),void 0!==n.out&&"in"!==e&&i in n.out&&(e||n.key!==i)&&(r=Z(r,st(n.out,i)))),"directed"!==t&&void 0!==n.undirected&&i in n.undirected&&(r=Z(r,st(n.undirected,i))),r}(i,r,s,e)}throw new H("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(_t),function(t){ct.forEach((function(e){(function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new B("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}var i=[];return ft(!1,t,e,n,(function(t){i.push(t)})),i}("mixed"===i?this.type:i,r,e)}})(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));ft(!1,"mixed"===i?this.type:i,r,n,e)}};var s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){var n=[];return this[o](t,(function(t,i){n.push(e(t,i))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){var n=[];return this[o](t,(function(t,i){e(t,i)&&n.push(t)})),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[l]=function(t,e,n){if(arguments.length<3)throw new H("Graph.".concat(l,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var i=n;return this[o](t,(function(t,n){i=e(i,t,n)})),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n[0].toUpperCase()+n.slice(1,-1),s="find"+o;t.prototype[s]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new B("Graph.".concat(s,': could not find the "').concat(t,'" node in the graph.'));return ft(!0,"mixed"===i?this.type:i,r,n,e)}};var a="some"+o;t.prototype[a]=function(t,e){return!!this[s](t,e)};var l="every"+o;t.prototype[l]=function(t,e){return!this[s](t,(function(t,n){return!e(t,n)}))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return L.empty();t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return pt(null,n,n.undirected);if("string"==typeof e)return pt(null,n,n[e])}var i=L.empty(),r=new ht;return"undirected"!==t&&("out"!==e&&(i=Z(i,pt(r,n,n.in))),"in"!==e&&(i=Z(i,pt(r,n,n.out)))),"directed"!==t&&(i=Z(i,pt(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,e)}}(t,e)}))}(_t);var Nt=function(t){function n(e){var n=a({type:"directed"},e);if("multi"in n&&!1!==n.multi)throw new H("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new H('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t),Mt=function(t){function n(e){var n=a({type:"undirected"},e);if("multi"in n&&!1!==n.multi)throw new H("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new H('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t),Ot=function(t){function n(e){var n=a({multi:!0},e);if("multi"in n&&!0!==n.multi)throw new H("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return t.call(this,n)||this}return e(n,t),n}(_t),Lt=function(t){function n(e){var n=a({type:"directed",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new H("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new H('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t),It=function(t){function n(e){var n=a({type:"undirected",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new H("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new H('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t);function Rt(t){t.from=function(e,n){var i=a({},e.options,n),r=new t(i);return r.import(e),r}}return Rt(_t),Rt(Nt),Rt(Mt),Rt(Ot),Rt(Lt),Rt(It),_t.Graph=_t,_t.DirectedGraph=Nt,_t.UndirectedGraph=Mt,_t.MultiGraph=Ot,_t.MultiDirectedGraph=Lt,_t.MultiUndirectedGraph=It,_t.InvalidArgumentsGraphError=H,_t.NotFoundGraphError=B,_t.UsageGraphError=q,_t}()},6572:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,i=Array.prototype.slice,r=Object.prototype.toString;function o(e,n){var i=e>n?e:n;return t.pow(10,17-~~(t.log(i>0?i:-i)*t.LOG10E))}var s=Array.isArray||function(t){return"[object Array]"===r.call(t)};function a(t){return"[object Function]"===r.call(t)}function l(t){return"number"==typeof t&&t-t==0}function u(){return new u._init(arguments)}function c(){return 0}function h(){return 1}function d(t,e){return t===e?1:0}u.fn=u.prototype,u._init=function(t){if(s(t[0]))if(s(t[0][0])){a(t[1])&&(t[0]=u.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=a(t[1])?u.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=u.seq.apply(null,t),this.length=1;else{if(t[0]instanceof u)return u(t[0].toArray());this[0]=[],this.length=1}return this},u._init.prototype=u.prototype,u._init.constructor=u,u.utils={calcRdx:o,isArray:s,isFunction:a,isNumber:l,toVector:function(t){return n.apply([],t)}},u._random_fn=t.random,u.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");u._random_fn=t},u.extend=function(t){var e,n;if(1===arguments.length){for(n in t)u[n]=t[n];return this}for(e=1;e<arguments.length;e++)for(n in arguments[e])t[n]=arguments[e][n];return t},u.rows=function(t){return t.length||1},u.cols=function(t){return t[0].length||1},u.dimensions=function(t){return{rows:u.rows(t),cols:u.cols(t)}},u.row=function(t,e){return s(e)?e.map((function(e){return u.row(t,e)})):t[e]},u.rowa=function(t,e){return u.row(t,e)},u.col=function(t,e){if(s(e)){var n=u.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,i){u.arange(t.length).forEach((function(r){n[r][i]=t[r][e]}))})),n}for(var i=new Array(t.length),r=0;r<t.length;r++)i[r]=[t[r][e]];return i},u.cola=function(t,e){return u.col(t,e).map((function(t){return t[0]}))},u.diag=function(t){for(var e=u.rows(t),n=new Array(e),i=0;i<e;i++)n[i]=[t[i][i]];return n},u.antidiag=function(t){for(var e=u.rows(t)-1,n=new Array(e),i=0;e>=0;e--,i++)n[i]=[t[i][e]];return n},u.transpose=function(t){var e,n,i,r,o,a=[];for(s(t[0])||(t=[t]),n=t.length,i=t[0].length,o=0;o<i;o++){for(e=new Array(n),r=0;r<n;r++)e[r]=t[r][o];a.push(e)}return 1===a.length?a[0]:a},u.map=function(t,e,n){var i,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),l=0;l<o;l++)a[i][l]=e(t[i][l],i,l);return 1===a.length?a[0]:a},u.cumreduce=function(t,e,n){var i,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),o>0&&(a[i][0]=t[i][0]),l=1;l<o;l++)a[i][l]=e(a[i][l-1],t[i][l]);return 1===a.length?a[0]:a},u.alter=function(t,e){return u.map(t,e,!0)},u.create=function(t,e,n){var i,r,o=new Array(t);for(a(e)&&(n=e,e=t),i=0;i<t;i++)for(o[i]=new Array(e),r=0;r<e;r++)o[i][r]=n(i,r);return o},u.zeros=function(t,e){return l(e)||(e=t),u.create(t,e,c)},u.ones=function(t,e){return l(e)||(e=t),u.create(t,e,h)},u.rand=function(t,e){return l(e)||(e=t),u.create(t,e,u._random_fn)},u.identity=function(t,e){return l(e)||(e=t),u.create(t,e,d)},u.symmetric=function(t){var e,n,i=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<i;e++)for(n=0;n<i;n++)if(t[n][e]!==t[e][n])return!1;return!0},u.clear=function(t){return u.alter(t,c)},u.seq=function(t,e,n,i){a(i)||(i=!1);var r,s=[],l=o(t,e),u=(e*l-t*l)/((n-1)*l),c=t;for(r=0;c<=e&&r<n;c=(t*l+u*l*++r)/l)s.push(i?i(c,r):c);return s},u.arange=function(t,n,i){var r,o=[];if(i=i||1,n===e&&(n=t,t=0),t===n||0===i)return[];if(t<n&&i<0)return[];if(t>n&&i>0)return[];if(i>0)for(r=t;r<n;r+=i)o.push(r);else for(r=t;r>n;r+=i)o.push(r);return o},u.slice=function(){function t(t,n,i,r){var o,s=[],a=t.length;if(n===e&&i===e&&r===e)return u.copy(t);if(r=r||1,(n=(n=n||0)>=0?n:a+n)===(i=(i=i||t.length)>=0?i:a+i)||0===r)return[];if(n<i&&r<0)return[];if(n>i&&r>0)return[];if(r>0)for(o=n;o<i;o+=r)s.push(t[o]);else for(o=n;o>i;o+=r)s.push(t[o]);return s}return function(e,n){var i,r;return l((n=n||{}).row)?l(n.col)?e[n.row][n.col]:t(u.rowa(e,n.row),(i=n.col||{}).start,i.end,i.step):l(n.col)?t(u.cola(e,n.col),(r=n.row||{}).start,r.end,r.step):(r=n.row||{},i=n.col||{},t(e,r.start,r.end,r.step).map((function(e){return t(e,i.start,i.end,i.step)})))}}(),u.sliceAssign=function(n,i,r){var o,s;if(l(i.row)){if(l(i.col))return n[i.row][i.col]=r;i.col=i.col||{},i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,o=u.arange(i.col.start,t.min(n.length,i.col.end),i.col.step);var a=i.row;return o.forEach((function(t,e){n[a][t]=r[e]})),n}if(l(i.col)){i.row=i.row||{},i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,s=u.arange(i.row.start,t.min(n[0].length,i.row.end),i.row.step);var c=i.col;return s.forEach((function(t,e){n[t][c]=r[e]})),n}return r[0].length===e&&(r=[r]),i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,s=u.arange(i.row.start,t.min(n.length,i.row.end),i.row.step),o=u.arange(i.col.start,t.min(n[0].length,i.col.end),i.col.step),s.forEach((function(t,e){o.forEach((function(i,o){n[t][i]=r[e][o]}))})),n},u.diagonal=function(t){var e=u.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},u.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=u.prototype;return f.length=0,f.push=Array.prototype.push,f.sort=Array.prototype.sort,f.splice=Array.prototype.splice,f.slice=Array.prototype.slice,f.toArray=function(){return this.length>1?i.call(this):i.call(this)[0]},f.map=function(t,e){return u(u.map(this,t,e))},f.cumreduce=function(t,e){return u(u.cumreduce(this,t,e))},f.alter=function(t){return u.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e){var n,i=this;return e?(setTimeout((function(){e.call(i,f[t].call(i))})),this):(n=u[t](this),s(n)?u(n):n)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e,n){var i=this;return n?(setTimeout((function(){n.call(i,f[t].call(i,e))})),this):u(u[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return u(u[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),u}(Math),function(t,e){var n=t.utils.isFunction;function i(t,e){return t-e}function r(t,n,i){return e.max(n,e.min(t,i))}t.sum=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,i=t.mean(e),r=0,o=e.length;--o>=0;)r+=(n=e[o]-i)*n;return r},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]<e&&(e=t[n]);return e},t.max=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]>e&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],i=0;i<t.length;i++)e[t[i]]||(e[t[i]]=!0,n.push(t[i]));return n},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(n){var i=n.map(e.log),r=t.mean(i);return e.exp(r)},t.median=function(t){var e=t.length,n=t.slice().sort(i);return 1&e?n[e/2|0]:(n[e/2-1]+n[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,n=[],i=t.length;for(e=1;e<i;e++)n.push(t[e]-t[e-1]);return n},t.rank=function(t){var e,n=[],r={};for(e=0;e<t.length;e++)r[l=t[e]]?r[l]++:(r[l]=1,n.push(l));var o=n.sort(i),s={},a=1;for(e=0;e<o.length;e++){var l,u=r[l=o[e]],c=(a+(a+u-1))/2;s[l]=c,a+=u}return t.map((function(t){return s[t]}))},t.mode=function(t){var e,n=t.length,r=t.slice().sort(i),o=1,s=0,a=0,l=[];for(e=0;e<n;e++)r[e]===r[e+1]?o++:(o>s?(l=[r[e]],s=o,a=0):o===s&&(l.push(r[e]),a++),o=1);return 0===a?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),i=e.length,r=new Array(i),o=0;o<i;o++)r[o]=e[o]-n;return r},t.stdev=function(n,i){return e.sqrt(t.variance(n,i))},t.pooledstdev=function(n){return e.sqrt(t.pooledvariance(n))},t.meandev=function(n){for(var i=t.mean(n),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.mean(r)},t.meddev=function(n){for(var i=t.median(n),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.median(r)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,r=t.slice().sort(i);return[r[e.round(n/4)-1],r[e.round(n/2)-1],r[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,s){var a,l,u,c,h,d=t.slice().sort(i),f=[n.length],p=t.length;for(void 0===o&&(o=3/8),void 0===s&&(s=3/8),a=0;a<n.length;a++)u=p*(l=n[a])+(o+l*(1-o-s)),c=e.floor(r(u,1,p-1)),h=r(u-c,0,1),f[a]=(1-h)*d[c-1]+h*d[c];return f},t.percentile=function(t,e,n){var r=t.slice().sort(i),o=e*(r.length+(n?1:-1))+(n?0:1),s=parseInt(o),a=o-s;return s+1<r.length?r[s-1]+a*(r[s]-r[s-1]):r[s-1]},t.percentileOfScore=function(t,e,n){var i,r,o=0,s=t.length,a=!1;for("strict"===n&&(a=!0),r=0;r<s;r++)i=t[r],(a&&i<e||!a&&i<=e)&&o++;return o/s},t.histogram=function(n,i){i=i||4;var r,o=t.min(n),s=(t.max(n)-o)/i,a=n.length,l=[];for(r=0;r<i;r++)l[r]=0;for(r=0;r<a;r++)l[e.min(e.floor((n[r]-o)/s),i-1)]+=1;return l},t.covariance=function(e,n){var i,r=t.mean(e),o=t.mean(n),s=e.length,a=new Array(s);for(i=0;i<s;i++)a[i]=(e[i]-r)*(n[i]-o);return t.sum(a)/(s-1)},t.corrcoeff=function(e,n){return t.covariance(e,n)/t.stdev(e,1)/t.stdev(n,1)},t.spearmancoeff=function(e,n){return e=t.rank(e),n=t.rank(n),t.corrcoeff(e,n)},t.stanMoment=function(n,i){for(var r=t.mean(n),o=t.stdev(n),s=n.length,a=0,l=0;l<s;l++)a+=e.pow((n[l]-r)/o,i);return a/n.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var o=t.prototype;!function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[e].call(l,i))})),this;if(this.length>1){for(l=!0===i?this:this.transpose();a<l.length;a++)s[a]=t[e](l[a]);return s}return t[e](this[0],i)}}(e[i])}("cumsum cumprod".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[e].call(l,i))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===i?this:this.transpose());a<l.length;a++)s[a]=t[e](l[a]);return!0===i?t[e](t.utils.toVector(s)):s}return t[e](this[0],i)}}(e[i])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(){var i,r=[],s=0,a=this,l=Array.prototype.slice.call(arguments);if(n(l[l.length-1])){i=l[l.length-1];var u=l.slice(0,l.length-1);return setTimeout((function(){i.call(a,o[e].apply(a,u))})),this}i=void 0;var c=function(n){return t[e].apply(a,[n].concat(l))};if(this.length>1){for(a=a.transpose();s<a.length;s++)r[s]=c(a[s]);return r}return c(this[0])}}(e[i])}("quantiles percentileOfScore".split(" "))}(e,Math),function(t,e){t.gammaln=function(t){var n,i,r,o=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(r=(i=n=t)+5.5,r-=(n+.5)*e.log(r);o<6;o++)a+=s[o]/++i;return e.log(2.5066282746310007*a/n)-r},t.loggam=function(t){var n,i,r,o,s,a,l,u=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(n=t,l=0,1==t||2==t)return 0;for(t<=7&&(n=t+(l=e.floor(7-t))),i=1/(n*n),r=2*e.PI,s=u[9],a=8;a>=0;a--)s*=i,s+=u[a];if(o=s/n+.5*e.log(r)+(n-.5)*e.log(n)-n,t<=7)for(a=1;a<=l;a++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,i,r,o,s=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,u=0,c=0,h=0,d=t;if(t>171.6243769536076)return 1/0;if(d<=0){if(!(o=d%1+36e-17))return 1/0;l=(1&d?-1:1)*e.PI/e.sin(e.PI*o),d=1-d}for(r=d,i=d<1?d++:(d-=u=(0|d)-1)-1,n=0;n<8;++n)h=(h+s[n])*i,c=c*i+a[n];if(o=h/c+1,r<d)o/=r;else if(r>d)for(n=0;n<u;++n)o*=d,d++;return l&&(o=l/o),o},t.gammap=function(e,n){return t.lowRegGamma(e,n)*t.gammafn(e)},t.lowRegGamma=function(n,i){var r,o=t.gammaln(n),s=n,a=1/n,l=a,u=i+1-n,c=1/1e-30,h=1/u,d=h,f=1,p=-~(8.5*e.log(n>=1?n:1/n)+.4*n+17);if(i<0||n<=0)return NaN;if(i<n+1){for(;f<=p;f++)a+=l*=i/++s;return a*e.exp(-i+n*e.log(i)-o)}for(;f<=p;f++)d*=(h=1/(h=(r=-f*(f-n))*h+(u+=2)))*(c=u+r/c);return 1-d*e.exp(-i+n*e.log(i)-o)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(n,i){return n>170||i>170?e.exp(t.combinationln(n,i)):t.factorial(n)/t.factorial(i)/t.factorial(n-i)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,i){if(!(n<=0||i<=0))return n+i>170?e.exp(t.betaln(n,i)):t.gammafn(n)*t.gammafn(i)/t.gammafn(n+i)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,i){var r,o,s,a,l=1e-30,u=1,c=n+i,h=n+1,d=n-1,f=1,p=1-c*t/h;for(e.abs(p)<l&&(p=l),a=p=1/p;u<=100&&(p=1+(o=u*(i-u)*t/((d+(r=2*u))*(n+r)))*p,e.abs(p)<l&&(p=l),f=1+o/f,e.abs(f)<l&&(f=l),a*=(p=1/p)*f,p=1+(o=-(n+u)*(c+u)*t/((n+r)*(h+r)))*p,e.abs(p)<l&&(p=l),f=1+o/f,e.abs(f)<l&&(f=l),a*=s=(p=1/p)*f,!(e.abs(s-1)<3e-7));u++);return a},t.gammapinv=function(n,i){var r,o,s,a,l,u,c=0,h=i-1,d=t.gammaln(i);if(n>=1)return e.max(100,i+100*e.sqrt(i));if(n<=0)return 0;for(i>1?(l=e.log(h),u=e.exp(h*(l-1)-d),a=n<.5?n:1-n,r=(2.30753+.27061*(o=e.sqrt(-2*e.log(a))))/(1+o*(.99229+.04481*o))-o,n<.5&&(r=-r),r=e.max(.001,i*e.pow(1-1/(9*i)-r/(3*e.sqrt(i)),3))):r=n<(o=1-i*(.253+.12*i))?e.pow(n/o,1/i):1-e.log(1-(n-o)/(1-o));c<12;c++){if(r<=0)return 0;if((r-=o=(s=(t.lowRegGamma(i,r)-n)/(o=i>1?u*e.exp(-(r-h)+h*(e.log(r)-l)):e.exp(-r+h*e.log(r)-d)))/(1-.5*e.min(1,s*((i-1)/r-1))))<=0&&(r=.5*(r+o)),e.abs(o)<1e-8*r)break}return r},t.erf=function(t){var n,i,r,o,s=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],a=s.length-1,l=!1,u=0,c=0;for(t<0&&(t=-t,l=!0),i=4*(n=2/(2+t))-2;a>0;a--)r=u,u=i*u-c+s[a],c=r;return o=n*e.exp(-t*t+.5*(s[0]+i*u)-c),l?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var i,r,o,s,a=0;if(n>=2)return-100;if(n<=0)return 100;for(s=n<1?n:2-n,i=-.70711*((2.30753+.27061*(o=e.sqrt(-2*e.log(s/2))))/(1+o*(.99229+.04481*o))-o);a<2;a++)i+=(r=t.erfc(i)-s)/(1.1283791670955126*e.exp(-i*i)-i*r);return n<1?i:-i},t.ibetainv=function(n,i,r){var o,s,a,l,u,c,h,d,f,p,m=i-1,g=r-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(i>=1&&r>=1?(a=n<.5?n:1-n,c=(2.30753+.27061*(l=e.sqrt(-2*e.log(a))))/(1+l*(.99229+.04481*l))-l,n<.5&&(c=-c),h=(c*c-3)/6,d=2/(1/(2*i-1)+1/(2*r-1)),f=c*e.sqrt(h+d)/d-(1/(2*r-1)-1/(2*i-1))*(h+5/6-2/(3*d)),c=i/(i+r*e.exp(2*f))):(o=e.log(i/(i+r)),s=e.log(r/(i+r)),c=n<(l=e.exp(i*o)/i)/(f=l+(u=e.exp(r*s)/r))?e.pow(i*f*n,1/i):1-e.pow(r*f*(1-n),1/r)),p=-t.gammaln(i)-t.gammaln(r)+t.gammaln(i+r);v<10;v++){if(0===c||1===c)return c;if((c-=l=(u=(t.ibeta(c,i,r)-n)/(l=e.exp(m*e.log(c)+g*e.log(1-c)+p)))/(1-.5*e.min(1,u*(m/c-g/(1-c)))))<=0&&(c=.5*(c+l)),c>=1&&(c=.5*(c+l+1)),e.abs(l)<1e-8*c&&v>0)break}return c},t.ibeta=function(n,i,r){var o=0===n||1===n?0:e.exp(t.gammaln(i+r)-t.gammaln(i)-t.gammaln(r)+i*e.log(n)+r*e.log(1-n));return!(n<0||n>1)&&(n<(i+1)/(i+r+2)?o*t.betacf(n,i,r)/i:1-o*t.betacf(1-n,r,i)/r)},t.randn=function(n,i){var r,o,s,a,l;if(i||(i=n),n)return t.create(n,i,(function(){return t.randn()}));do{r=t._random_fn(),o=1.7156*(t._random_fn()-.5),l=(s=r-.449871)*s+(a=e.abs(o)+.386595)*(.196*a-.25472*s)}while(l>.27597&&(l>.27846||o*o>-4*e.log(r)*r*r));return o/r},t.randg=function(n,i,r){var o,s,a,l,u,c,h=n;if(r||(r=i),n||(n=1),i)return(c=t.zeros(i,r)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),o=n-1/3,s=1/e.sqrt(9*o);do{do{l=1+s*(u=t.randn())}while(l<=0);l*=l*l,a=t._random_fn()}while(a>1-.331*e.pow(u,4)&&e.log(a)>.5*u*u+o*(1-l+e.log(l)));if(n==h)return o*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/h)*o*l},function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(n){return t[e](n)})))}}(e[n])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[n])}("randn".split(" "))}(e,Math),function(t,e){function n(t,n,i,r){for(var o,s=0,a=1,l=1,u=1,c=0,h=0;e.abs((l-h)/l)>r;)h=l,a=u+(o=-(n+c)*(n+i+c)*t/(n+2*c)/(n+2*c+1))*a,l=(s=l+o*s)+(o=(c+=1)*(i-c)*t/(n+2*c-1)/(n+2*c))*l,s/=u=a+o*u,a/=u,l/=u,u=1;return l/n}function i(n,i,r){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],s=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*n;if(a>=8)return 1;var l,u=2*t.normal.cdf(a,0,1,1,0)-1;u=u>=e.exp(-50/r)?e.pow(u,r):0;for(var c=a,h=(8-a)/(l=n>3?2:3),d=c+h,f=0,p=r-1,m=1;m<=l;m++){for(var g=0,v=.5*(d+c),y=.5*(d-c),C=1;C<=12;C++){var w,b=v+y*(6<C?o[(w=12-C+1)-1]:-o[(w=C)-1]),A=b*b;if(A>60)break;var E=2*t.normal.cdf(b,0,1,1,0)*.5-2*t.normal.cdf(b,n,1,1,0)*.5;E>=e.exp(-30/p)&&(g+=E=s[w-1]*e.exp(-.5*A)*e.pow(E,p))}f+=g*=2*y*r/e.sqrt(2*e.PI),c=d,d+=h}return(u+=f)<=e.exp(-30/i)?0:(u=e.pow(u,i))>=1?1:u}!function(e){for(var n=0;n<e.length;n++)!function(e){t[e]=function t(e,n,i){return this instanceof t?(this._a=e,this._b=n,this._c=i,this):new t(e,n,i)},t.fn[e]=function(n,i,r){var o=t[e](n,i,r);return o.data=this,o},t[e].prototype.sample=function(n){var i=this._a,r=this._b,o=this._c;return n?t.alter(n,(function(){return t[e].sample(i,r,o)})):t[e].sample(i,r,o)},function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(i){var r=this._a,o=this._b,s=this._c;return i||0===i||(i=this.data),"number"!=typeof i?t.fn.map.call(i,(function(i){return t[e][n](i,r,o,s)})):t[e][n](i,r,o,s)}}(n[i])}("pdf cdf inv".split(" ")),function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(){return t[e][n](this._a,this._b,this._c)}}(n[i])}("mean median mode variance".split(" "))}(e[n])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(n,i,r){return n>1||n<0?0:1==i&&1==r?1:i<512&&r<512?e.pow(n,i-1)*e.pow(1-n,r-1)/t.betafn(i,r):e.exp((i-1)*e.log(n)+(r-1)*e.log(1-n)-t.betaln(i,r))},cdf:function(e,n,i){return e>1||e<0?1*(e>1):t.ibeta(e,n,i)},inv:function(e,n,i){return t.ibetainv(e,n,i)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var i=t.randg(e);return i/(i+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,i,r){var o;return n<0?0:i<=2?0===n&&i<2?1/0:0===n&&2===i?1:1/t.betafn(i/2,r/2)*e.pow(i/r,i/2)*e.pow(n,i/2-1)*e.pow(1+i/r*n,-(i+r)/2):(o=i*n/(r+n*i),i*(r/(r+n*i))/2*t.binomial.pdf((i-2)/2,(i+r-2)/2,o))},cdf:function(e,n,i){return e<0?0:t.ibeta(n*e/(n*e+i),n/2,i/2)},inv:function(e,n,i){return i/(n*(1/t.ibetainv(e,n/2,i/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,i){return i<0?0:i/(e.pow(t-n,2)+e.pow(i,2))/e.PI},cdf:function(t,n,i){return e.atan((t-n)/i)/e.PI+.5},inv:function(t,n,i){return n+i*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,i){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*i+n}}),t.extend(t.chisquare,{pdf:function(n,i){return n<0?0:0===n&&2===i?.5:e.exp((i/2-1)*e.log(n)-n/2-i/2*e.log(2)-t.gammaln(i/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,i,r){return n<0?0:0===n&&1===i?1/r:e.exp((i-1)*e.log(n)-n/r-t.gammaln(i)-i*e.log(r))},cdf:function(e,n,i){return e<0?0:t.lowRegGamma(n,e/i)},inv:function(e,n,i){return t.gammapinv(e,n)*i},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,i,r){return n<=0?0:e.exp(-(i+1)*e.log(n)-r/n-t.gammaln(i)+i*e.log(r))},cdf:function(e,n,i){return e<=0?0:1-t.lowRegGamma(n,i/e)},inv:function(e,n,i){return i/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,i){return 0===t&&1===n?i:1===t&&1===i?n:e.exp(e.log(n)+e.log(i)+(n-1)*e.log(t)+(i-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,i){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),i)},inv:function(t,n,i){return e.pow(1-e.pow(1-t,1/i),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,i){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(i)-e.pow(e.log(t)-n,2)/(2*i*i))},cdf:function(n,i,r){return n<0?0:.5+.5*t.erf((e.log(n)-i)/e.sqrt(2*r*r))},inv:function(n,i,r){return e.exp(-1.4142135623730951*r*t.erfcinv(2*n)+i)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,i){return e.exp(t.randn()*i+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,i,r){return e.abs(r)<1e-14?t.studentt.pdf(n,i):e.abs(n)<1e-14?e.exp(t.gammaln((i+1)/2)-r*r/2-.5*e.log(e.PI*i)-t.gammaln(i/2)):i/n*(t.noncentralt.cdf(n*e.sqrt(1+2/i),i+2,r)-t.noncentralt.cdf(n,i,r))},cdf:function(n,i,r){var o=1e-14;if(e.abs(r)<o)return t.studentt.cdf(n,i);var s=!1;n<0&&(s=!0,r=-r);for(var a=t.normal.cdf(-r,0,1),l=o+1,u=l,c=n*n/(n*n+i),h=0,d=e.exp(-r*r/2),f=e.exp(-r*r/2-.5*e.log(2)-t.gammaln(1.5))*r;h<200||u>o||l>o;)u=l,h>0&&(d*=r*r/(2*h),f*=r*r/(2*(h+.5))),a+=.5*(l=d*t.beta.cdf(c,h+.5,i/2)+f*t.beta.cdf(c,h+1,i/2)),h++;return s?1-a:a}}),t.extend(t.normal,{pdf:function(t,n,i){return e.exp(-.5*e.log(2*e.PI)-e.log(i)-e.pow(t-n,2)/(2*i*i))},cdf:function(n,i,r){return.5*(1+t.erf((n-i)/e.sqrt(2*r*r)))},inv:function(e,n,i){return-1.4142135623730951*i*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,i){return t<n?0:i*e.pow(n,i)/e.pow(t,i+1)},cdf:function(t,n,i){return t<n?0:1-e.pow(n/t,i)},inv:function(t,n,i){return n/e.pow(1-t,1/i)},mean:function(t,n){if(!(n<=1))return n*e.pow(t,n)/(n-1)},median:function(t,n){return t*(n*e.SQRT2)},mode:function(t){return t},variance:function(t,n){if(!(n<=2))return t*t*n/(e.pow(n-1,2)*(n-2))}}),t.extend(t.studentt,{pdf:function(n,i){return i=i>1e100?1e100:i,1/(e.sqrt(i)*t.betafn(.5,i/2))*e.pow(1+n*n/i,-(i+1)/2)},cdf:function(n,i){var r=i/2;return t.ibeta((n+e.sqrt(n*n+i))/(2*e.sqrt(n*n+i)),r,r)},inv:function(n,i){var r=t.ibetainv(2*e.min(n,1-n),.5*i,.5);return r=e.sqrt(i*(1-r)/r),n>.5?r:-r},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,i){return t<0||n<0||i<0?0:i/n*e.pow(t/n,i-1)*e.exp(-e.pow(t/n,i))},cdf:function(t,n,i){return t<0?0:1-e.exp(-e.pow(t/n,i))},inv:function(t,n,i){return n*e.pow(-e.log(1-t),1/i)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,i){return n*e.pow(-e.log(t._random_fn()),1/i)},variance:function(n,i){return n*n*t.gammafn(1+2/i)-e.pow(t.weibull.mean(n,i),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return t<e||t>n?0:1/(n-e)},cdf:function(t,e,n){return t<e?0:t<n?(t-e)/(n-e):1},inv:function(t,e,n){return e+t*(n-e)},mean:function(t,e){return.5*(t+e)},median:function(e,n){return t.mean(e,n)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,n){return e/2+n/2+(n/2-e/2)*(2*t._random_fn()-1)},variance:function(t,n){return e.pow(n-t,2)/12}}),t.extend(t.binomial,{pdf:function(n,i,r){return 0===r||1===r?i*r===n?1:0:t.combination(i,n)*e.pow(r,n)*e.pow(1-r,i-n)},cdf:function(i,r,o){var s,a=1e-10;if(i<0)return 0;if(i>=r)return 1;if(o<0||o>1||r<=0)return NaN;var l=o,u=(i=e.floor(i))+1,c=r-i,h=u+c,d=e.exp(t.gammaln(h)-t.gammaln(c)-t.gammaln(u)+u*e.log(l)+c*e.log(1-l));return s=l<(u+1)/(h+2)?d*n(l,u,c,a):1-d*n(1-l,c,u,a),e.round(1/a*(1-s))/(1/a)}}),t.extend(t.negbin,{pdf:function(n,i,r){return n===n>>>0&&(n<0?0:t.combination(n+i-1,i-1)*e.pow(1-r,n)*e.pow(r,i))},cdf:function(e,n,i){var r=0,o=0;if(e<0)return 0;for(;o<=e;o++)r+=t.negbin.pdf(o,n,i);return r}}),t.extend(t.hypgeom,{pdf:function(n,i,r,o){if(n!=n|0)return!1;if(n<0||n<r-(i-o))return 0;if(n>o||n>r)return 0;if(2*r>i)return 2*o>i?t.hypgeom.pdf(i-r-o+n,i,i-r,i-o):t.hypgeom.pdf(o-n,i,i-r,o);if(2*o>i)return t.hypgeom.pdf(r-n,i,r,i-o);if(r<o)return t.hypgeom.pdf(n,i,o,r);for(var s=1,a=0,l=0;l<n;l++){for(;s>1&&a<o;)s*=1-r/(i-a),a++;s*=(o-l)*(r-l)/((l+1)*(i-r-o+l+1))}for(;a<o;a++)s*=1-r/(i-a);return e.min(1,e.max(0,s))},cdf:function(n,i,r,o){if(n<0||n<r-(i-o))return 0;if(n>=o||n>=r)return 1;if(2*r>i)return 2*o>i?t.hypgeom.cdf(i-r-o+n,i,i-r,i-o):1-t.hypgeom.cdf(o-n-1,i,i-r,o);if(2*o>i)return 1-t.hypgeom.cdf(r-n-1,i,r,i-o);if(r<o)return t.hypgeom.cdf(n,i,o,r);for(var s=1,a=1,l=0,u=0;u<n;u++){for(;s>1&&l<o;){var c=1-r/(i-l);a*=c,s*=c,l++}s+=a*=(o-u)*(r-u)/((u+1)*(i-r-o+u+1))}for(;l<o;l++)s*=1-r/(i-l);return e.min(1,e.max(0,s))}}),t.extend(t.poisson,{pdf:function(n,i){return i<0||n%1!=0||n<0?0:e.pow(i,n)*e.exp(-i)/t.factorial(n)},cdf:function(e,n){var i=[],r=0;if(e<0)return 0;for(;r<=e;r++)i.push(t.poisson.pdf(r,n));return t.sum(i)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(n){var i=1,r=0,o=e.exp(-n);do{r++,i*=t._random_fn()}while(i>o);return r-1},sampleLarge:function(n){var i,r,o,s,a,l,u,c,h,d,f=n;for(s=e.sqrt(f),a=e.log(f),l=.02483*(u=.931+2.53*s)-.059,c=1.1239+1.1328/(u-3.4),h=.9277-3.6224/(u-2);;){if(r=e.random()-.5,o=e.random(),d=.5-e.abs(r),i=e.floor((2*l/d+u)*r+f+.43),d>=.07&&o<=h)return i;if(!(i<0||d<.013&&o>d)&&e.log(o)+e.log(c)-e.log(l/(d*d)+u)<=i*a-f-t.loggam(i+1))return i}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,i){return n<=e||i<e||i>n?NaN:t<e||t>n?0:t<i?2*(t-e)/((n-e)*(i-e)):t===i?2/(n-e):2*(n-t)/((n-e)*(n-i))},cdf:function(t,n,i,r){return i<=n||r<n||r>i?NaN:t<=n?0:t>=i?1:t<=r?e.pow(t-n,2)/((i-n)*(r-n)):1-e.pow(i-t,2)/((i-n)*(i-r))},inv:function(t,n,i,r){return i<=n||r<n||r>i?NaN:t<=(r-n)/(i-n)?n+(i-n)*e.sqrt(t*((r-n)/(i-n))):n+(i-n)*(1-e.sqrt((1-t)*(1-(r-n)/(i-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,i){return i<=(t+n)/2?n-e.sqrt((n-t)*(n-i))/e.sqrt(2):i>(t+n)/2?t+e.sqrt((n-t)*(i-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,i,r){var o=t._random_fn();return o<(r-n)/(i-n)?n+e.sqrt(o*(i-n)*(r-n)):i-e.sqrt((1-o)*(i-n)*(i-r))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,i){return i<=n?NaN:t<=n||t>=i?0:2/e.PI*e.pow(e.pow(i-n,2)-e.pow(2*t-n-i,2),-.5)},cdf:function(t,n,i){return t<n?0:t<i?2/e.PI*e.asin(e.sqrt((t-n)/(i-n))):1},inv:function(t,n,i){return n+(.5-.5*e.cos(e.PI*t))*(i-n)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(n,i){return(n+i)/2+(i-n)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,n){return n<=t?NaN:e.pow(n-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,n,i){return i<=0?0:e.exp(-e.abs(t-n)/i)/(2*i)},cdf:function(t,n,i){return i<=0?0:t<n?.5*e.exp((t-n)/i):1-.5*e.exp(-(t-n)/i)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(n,i){var r,o=t._random_fn()-.5;return n-i*((r=o)/e.abs(r))*e.log(1-2*e.abs(o))}}),t.extend(t.tukey,{cdf:function(n,r,o){var s=r,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],l=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(o<2||s<2)return NaN;if(!Number.isFinite(n))return 1;if(o>25e3)return i(n,1,s);var u,c=.5*o,h=c*e.log(o)-o*e.log(2)-t.gammaln(c),d=c-1,f=.25*o;u=o<=100?1:o<=800?.5:o<=5e3?.25:.125,h+=e.log(u);for(var p=0,m=1;m<=50;m++){for(var g=0,v=(2*m-1)*u,y=1;y<=16;y++){var C,w;8<y?(C=y-8-1,w=h+d*e.log(v+a[C]*u)-(a[C]*u+v)*f):(C=y-1,w=h+d*e.log(v-a[C]*u)+(a[C]*u-v)*f),w>=-30&&(g+=i(8<y?n*e.sqrt(.5*(a[C]*u+v)):n*e.sqrt(.5*(-a[C]*u+v)),1,s)*l[C]*e.exp(w))}if(m*u>=1&&g<=1e-14)break;p+=g}if(g>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(n,i,r){if(r<2||i<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,s=function(t,n,i){var r=.5-.5*t,o=e.sqrt(e.log(1/(r*r))),s=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);i<120&&(s+=(s*s*s+s)/i/4);var a=.8832-.2368*s;return i<120&&(a+=-1.214/i+1.208*s/i),s*(a*e.log(n-1)+1.4142)}(n,i,r),a=t.tukey.cdf(s,i,r)-n;o=a>0?e.max(0,s-1):s+1;for(var l,u=t.tukey.cdf(o,i,r)-n,c=1;c<50;c++)if(l=o-u*(o-s)/(u-a),a=u,s=o,l<0&&(l=0,u=-n),u=t.tukey.cdf(l,i,r)-n,o=l,e.abs(o-s)<1e-4)return l;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,i,r=Array.prototype.push,o=t.utils.isArray;function s(e){return o(e)||e instanceof t}t.extend({add:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t+n[e][i]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t-n[e][i]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var i,r,o,a,l,u,c,h;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,u=e[0].length,c=t.zeros(l,o=s(n)?n[0].length:u),h=0,s(n)){for(;h<o;h++)for(i=0;i<l;i++){for(a=0,r=0;r<u;r++)a+=e[i][r]*n[r][h];c[i][h]=a}return 1===l&&1===h?c[0][0]:c}return t.map(e,(function(t){return t*n}))},outer:function(e,n){return t.multiply(e.map((function(t){return[t]})),[n])},dot:function(e,n){s(e[0])||(e=[e]),s(n[0])||(n=[n]);for(var i,r,o=1===e[0].length&&1!==e.length?t.transpose(e):e,a=1===n[0].length&&1!==n.length?t.transpose(n):n,l=[],u=0,c=o.length,h=o[0].length;u<c;u++){for(l[u]=[],i=0,r=0;r<h;r++)i+=o[u][r]*a[u][r];l[u]=i}return 1===l.length?l[0]:l},pow:function(n,i){return t.map(n,(function(t){return e.pow(t,i)}))},exp:function(n){return t.map(n,(function(t){return e.exp(t)}))},log:function(n){return t.map(n,(function(t){return e.log(t)}))},abs:function(n){return t.map(n,(function(t){return e.abs(t)}))},norm:function(t,n){var i=0,r=0;for(isNaN(n)&&(n=2),s(t[0])&&(t=t[0]);r<t.length;r++)i+=e.pow(e.abs(t[r]),n);return e.pow(i,1/n)},angle:function(n,i){return e.acos(t.dot(n,i)/(t.norm(n)*t.norm(i)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)r.apply(i[n],e[n]);return i},inv:function(e){for(var n,i=e.length,r=e[0].length,o=t.identity(i,r),s=t.gauss_jordan(e,o),a=[],l=0;l<i;l++)for(a[l]=[],n=r;n<s[0].length;n++)a[l][n-r]=s[l][n];return a},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var n=0,i=0;i<e.length;i++){for(var r=[],o=1;o<e.length;o++){r[o-1]=[];for(var s=0;s<e.length;s++)s<i?r[o-1][s]=e[o][s]:s>i&&(r[o-1][s-1]=e[o][s])}var a=i%2?-1:1;n+=t(r)*e[0][i]*a}return n},gauss_elimination:function(n,i){var r,o,s,a,l=0,u=0,c=n.length,h=n[0].length,d=1,f=0,p=[];for(r=(n=t.aug(n,i))[0].length,l=0;l<c;l++){for(o=n[l][l],u=l,a=l+1;a<h;a++)o<e.abs(n[a][l])&&(o=n[a][l],u=a);if(u!=l)for(a=0;a<r;a++)s=n[l][a],n[l][a]=n[u][a],n[u][a]=s;for(u=l+1;u<c;u++)for(d=n[u][l]/n[l][l],a=l;a<r;a++)n[u][a]=n[u][a]-d*n[l][a]}for(l=c-1;l>=0;l--){for(f=0,u=l+1;u<=c-1;u++)f+=p[u]*n[l][u];p[l]=(n[l][r-1]-f)/n[l][l]}return p},gauss_jordan:function(n,i){var r,o,s,a=t.aug(n,i),l=a.length,u=a[0].length,c=0;for(o=0;o<l;o++){var h=o;for(s=o+1;s<l;s++)e.abs(a[s][o])>e.abs(a[h][o])&&(h=s);var d=a[o];for(a[o]=a[h],a[h]=d,s=o+1;s<l;s++)for(c=a[s][o]/a[o][o],r=o;r<u;r++)a[s][r]-=a[o][r]*c}for(o=l-1;o>=0;o--){for(c=a[o][o],s=0;s<o;s++)for(r=u-1;r>o-1;r--)a[s][r]-=a[o][r]*a[s][o]/c;for(a[o][o]/=c,r=l;r<u;r++)a[o][r]/=c}return a},triaUpSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r-1,-1,-1).forEach((function(s){i=t.arange(s+1,r).map((function(t){return o[t]*e[s][t]})),o[s]=(n[s]-t.sum(i))/e[s][s]})),s?o.map((function(t){return[t]})):o},triaLowSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r).forEach((function(r){i=t.arange(r).map((function(t){return e[r][t]*o[t]})),o[r]=(n[r]-t.sum(i))/e[r][r]})),s?o.map((function(t){return[t]})):o},lu:function(e){var n,i=e.length,r=t.identity(i),o=t.zeros(e.length,e[0].length);return t.arange(i).forEach((function(t){o[0][t]=e[0][t]})),t.arange(1,i).forEach((function(s){t.arange(s).forEach((function(i){n=t.arange(i).map((function(t){return r[s][t]*o[t][i]})),r[s][i]=(e[s][i]-t.sum(n))/o[i][i]})),t.arange(s,i).forEach((function(i){n=t.arange(s).map((function(t){return r[s][t]*o[t][i]})),o[s][i]=e[n.length][i]-t.sum(n)}))})),[r,o]},cholesky:function(n){var i,r=n.length,o=t.zeros(n.length,n[0].length);return t.arange(r).forEach((function(s){i=t.arange(s).map((function(t){return e.pow(o[s][t],2)})),o[s][s]=e.sqrt(n[s][s]-t.sum(i)),t.arange(s+1,r).forEach((function(e){i=t.arange(s).map((function(t){return o[s][t]*o[e][t]})),o[e][s]=(n[s][e]-t.sum(i))/o[s][s]}))})),o},gauss_jacobi:function(n,i,r,o){for(var s,a,l,u,c=0,h=0,d=n.length,f=[],p=[],m=[];c<d;c++)for(f[c]=[],p[c]=[],m[c]=[],h=0;h<d;h++)c>h?(f[c][h]=n[c][h],p[c][h]=m[c][h]=0):c<h?(p[c][h]=n[c][h],f[c][h]=m[c][h]=0):(m[c][h]=n[c][h],f[c][h]=p[c][h]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(f,p)),-1),a=t.multiply(t.inv(m),i),s=r,u=t.add(t.multiply(l,r),a),c=2;e.abs(t.norm(t.subtract(u,s)))>o;)s=u,u=t.add(t.multiply(l,s),a),c++;return u},gauss_seidel:function(n,i,r,o){for(var s,a,l,u,c,h=0,d=n.length,f=[],p=[],m=[];h<d;h++)for(f[h]=[],p[h]=[],m[h]=[],s=0;s<d;s++)h>s?(f[h][s]=n[h][s],p[h][s]=m[h][s]=0):h<s?(p[h][s]=n[h][s],f[h][s]=m[h][s]=0):(m[h][s]=n[h][s],f[h][s]=p[h][s]=0);for(u=t.multiply(t.multiply(t.inv(t.add(m,f)),p),-1),l=t.multiply(t.inv(t.add(m,f)),i),a=r,c=t.add(t.multiply(u,r),l),h=2;e.abs(t.norm(t.subtract(c,a)))>o;)a=c,c=t.add(t.multiply(u,a),l),h+=1;return c},SOR:function(n,i,r,o,s){for(var a,l,u,c,h,d=0,f=n.length,p=[],m=[],g=[];d<f;d++)for(p[d]=[],m[d]=[],g[d]=[],a=0;a<f;a++)d>a?(p[d][a]=n[d][a],m[d][a]=g[d][a]=0):d<a?(m[d][a]=n[d][a],p[d][a]=g[d][a]=0):(g[d][a]=n[d][a],p[d][a]=m[d][a]=0);for(c=t.multiply(t.inv(t.add(g,t.multiply(p,s))),t.subtract(t.multiply(g,1-s),t.multiply(m,s))),u=t.multiply(t.multiply(t.inv(t.add(g,t.multiply(p,s))),i),s),l=r,h=t.add(t.multiply(c,r),u),d=2;e.abs(t.norm(t.subtract(h,l)))>o;)l=h,h=t.add(t.multiply(c,l),u),d++;return h},householder:function(n){for(var i,r,o,s,a=n.length,l=n[0].length,u=0,c=[],h=[];u<a-1;u++){for(i=0,s=u+1;s<l;s++)i+=n[s][u]*n[s][u];for(i=(n[u+1][u]>0?-1:1)*e.sqrt(i),r=e.sqrt((i*i-n[u+1][u]*i)/2),(c=t.zeros(a,1))[u+1][0]=(n[u+1][u]-i)/(2*r),o=u+2;o<a;o++)c[o][0]=n[o][u]/(2*r);h=t.subtract(t.identity(a,l),t.multiply(t.multiply(c,t.transpose(c)),2)),n=t.multiply(h,t.multiply(n,h))}return n},QR:(n=t.sum,i=t.arange,function(r){var o,s,a,l=r.length,u=r[0].length,c=t.zeros(u,u);for(r=t.copy(r),s=0;s<u;s++){for(c[s][s]=e.sqrt(n(i(l).map((function(t){return r[t][s]*r[t][s]})))),o=0;o<l;o++)r[o][s]=r[o][s]/c[s][s];for(a=s+1;a<u;a++)for(c[s][a]=n(i(l).map((function(t){return r[t][s]*r[t][a]}))),o=0;o<l;o++)r[o][a]=r[o][a]-r[o][s]*c[s][a]}return[r,c]}),lstsq:function(e,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var r=t.QR(e),o=r[0],s=r[1],a=e[0].length,l=t.slice(o,{col:{end:a}}),u=function(e){var n=(e=t.copy(e)).length,i=t.identity(n);return t.arange(n-1,-1,-1).forEach((function(n){t.sliceAssign(i,{row:n},t.divide(t.slice(i,{row:n}),e[n][n])),t.sliceAssign(e,{row:n},t.divide(t.slice(e,{row:n}),e[n][n])),t.arange(n).forEach((function(r){var o=t.multiply(e[r][n],-1),s=t.slice(e,{row:r}),a=t.multiply(t.slice(e,{row:n}),o);t.sliceAssign(e,{row:r},t.add(s,a));var l=t.slice(i,{row:r}),u=t.multiply(t.slice(i,{row:n}),o);t.sliceAssign(i,{row:r},t.add(l,u))}))})),i}(t.slice(s,{row:{end:a}})),c=t.transpose(l);void 0===c[0].length&&(c=[c]);var h=t.multiply(t.multiply(u,c),n);return void 0===h.length&&(h=[[h]]),i?h.map((function(t){return t[0]})):h},jacobi:function(n){for(var i,r,o,s,a,l,u,c=1,h=n.length,d=t.identity(h,h),f=[];1===c;){for(a=n[0][1],o=0,s=1,i=0;i<h;i++)for(r=0;r<h;r++)i!=r&&a<e.abs(n[i][r])&&(a=e.abs(n[i][r]),o=i,s=r);for(l=n[o][o]===n[s][s]?n[o][s]>0?e.PI/4:-e.PI/4:e.atan(2*n[o][s]/(n[o][o]-n[s][s]))/2,(u=t.identity(h,h))[o][o]=e.cos(l),u[o][s]=-e.sin(l),u[s][o]=e.sin(l),u[s][s]=e.cos(l),d=t.multiply(d,u),n=t.multiply(t.multiply(t.inv(u),n),u),c=0,i=1;i<h;i++)for(r=1;r<h;r++)i!=r&&e.abs(n[i][r])>.001&&(c=1)}for(i=0;i<h;i++)f.push(n[i][i]);return[d,f]},rungekutta:function(t,e,n,i,r,o){var s,a,l;if(2===o)for(;i<=n;)r+=((s=e*t(i,r))+(a=e*t(i+e,r+s)))/2,i+=e;if(4===o)for(;i<=n;)r+=((s=e*t(i,r))+2*(a=e*t(i+e/2,r+s/2))+2*(l=e*t(i+e/2,r+a/2))+e*t(i+e,r+l))/6,i+=e;return r},romberg:function(t,n,i,r){for(var o,s,a,l,u,c=0,h=(i-n)/2,d=[],f=[],p=[];c<r/2;){for(u=t(n),a=n,l=0;a<=i;a+=h,l++)d[l]=a;for(o=d.length,a=1;a<o-1;a++)u+=(a%2!=0?4:2)*t(d[a]);u=h/3*(u+t(i)),p[c]=u,h/=2,c++}for(s=p.length,o=1;1!==s;){for(a=0;a<s-1;a++)f[a]=(e.pow(4,o)*p[a+1]-p[a])/(e.pow(4,o)-1);s=f.length,p=f,f=[],o++}return p},richardson:function(t,n,i,r){function o(t,e){for(var n,i=0,r=t.length;i<r;i++)t[i]===e&&(n=i);return n}for(var s,a,l,u,c,h=e.abs(i-t[o(t,i)+1]),d=0,f=[],p=[];r>=h;)s=o(t,i+r),a=o(t,i),f[d]=(n[s]-2*n[a]+n[2*a-s])/(r*r),r/=2,d++;for(u=f.length,l=1;1!=u;){for(c=0;c<u-1;c++)p[c]=(e.pow(4,l)*f[c+1]-f[c])/(e.pow(4,l)-1);u=p.length,f=p,p=[],l++}return f},simpson:function(t,e,n,i){for(var r,o=(n-e)/i,s=t(e),a=[],l=e,u=0,c=1;l<=n;l+=o,u++)a[u]=l;for(r=a.length;c<r-1;c++)s+=(c%2!=0?4:2)*t(a[c]);return o/3*(s+t(n))},hermite:function(t,e,n,i){for(var r,o=t.length,s=0,a=0,l=[],u=[],c=[],h=[];a<o;a++){for(l[a]=1,r=0;r<o;r++)a!=r&&(l[a]*=(i-t[r])/(t[a]-t[r]));for(u[a]=0,r=0;r<o;r++)a!=r&&(u[a]+=1/(t[a]-t[r]));c[a]=(1-2*(i-t[a])*u[a])*(l[a]*l[a]),h[a]=(i-t[a])*(l[a]*l[a]),s+=c[a]*e[a]+h[a]*n[a]}return s},lagrange:function(t,e,n){for(var i,r,o=0,s=0,a=t.length;s<a;s++){for(r=e[s],i=0;i<a;i++)s!=i&&(r*=(n-t[i])/(t[s]-t[i]));o+=r}return o},cubic_spline:function(e,n,i){for(var r,o,s=e.length,a=0,l=[],u=[],c=[],h=[],d=[],f=[];a<s-1;a++)h[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/h[a]*(n[a+1]-n[a])-3/h[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],u[a]=[],l[a][a-1]=h[a-1],l[a][a]=2*(h[a-1]+h[a]),l[a][a+1]=h[a],u[a][0]=c[a];for(o=t.multiply(t.inv(l),u),r=0;r<s-1;r++)d[r]=(n[r+1]-n[r])/h[r]-h[r]*(o[r+1][0]+2*o[r][0])/3,f[r]=(o[r+1][0]-o[r][0])/(3*h[r]);for(r=0;r<s&&!(e[r]>i);r++);return n[r-=1]+(i-e[r])*d[r]+t.sq(i-e[r])*o[r]+(i-e[r])*t.sq(i-e[r])*f[r]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,i,r,o,s,a=e.length,l=e[0].length,u=0,c=[],h=[],d=[],f=[],p=[],m=[],g=[];for(u=0;u<a;u++)c[u]=t.sum(e[u])/l;for(u=0;u<l;u++)for(p[u]=[],n=0;n<a;n++)p[u][n]=e[n][u]-c[n];for(p=t.transpose(p),u=0;u<a;u++)for(m[u]=[],n=0;n<a;n++)m[u][n]=t.dot([p[u]],[p[n]])/(l-1);for(s=(r=t.jacobi(m))[0],h=r[1],g=t.transpose(s),u=0;u<h.length;u++)for(n=u;n<h.length;n++)h[u]<h[n]&&(i=h[u],h[u]=h[n],h[n]=i,d=g[u],g[u]=g[n],g[n]=d);for(o=t.transpose(p),u=0;u<a;u++)for(f[u]=[],n=0;n<o.length;n++)f[u][n]=t.dot([g[u]],[o[n]]);return[e,h,g,f]}}),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(n,i){var r=this;return i?(setTimeout((function(){i.call(r,t.fn[e].call(r,n))}),15),this):"number"==typeof t[e](this,n)?t[e](this,n):t(t[e](this,n))}}(e[n])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(e,Math),function(t,e){var n=[].slice,i=t.utils.isNumber,r=t.utils.isArray;function o(t,n,i,r){if(t>1||i>1||t<=0||i<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+i*r)/(n+r);return(t-i)/e.sqrt(o*(1-o)*(1/n+1/r))}t.extend({zscore:function(){var e=n.call(arguments);return i(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var i,o=n.call(arguments);return r(o[1])?(i=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):o.length>2?(i=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):(i=o[0],1===o[1]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,i,r){var o=e.abs(this.zscore(n,r));return 1===i?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,0,1)}}),t.extend({tscore:function(){var i=n.call(arguments);return 4===i.length?(i[0]-i[1])/(i[2]/e.sqrt(i[3])):(i[0]-t.mean(i[1]))/(t.stdev(i[1],!0)/e.sqrt(i[1].length))},ttest:function(){var r,o=n.call(arguments);return 5===o.length?(r=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-r,o[3]-1):2*t.studentt.cdf(-r,o[3]-1)):i(o[1])?(r=e.abs(o[0]),1==o[2]?t.studentt.cdf(-r,o[1]-1):2*t.studentt.cdf(-r,o[1]-1)):(r=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-r,o[1].length-1):2*t.studentt.cdf(-r,o[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,i){return 1===i?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var i,r,o,s,a,l,u,c,h=n.call(arguments);if(1===h.length){for(a=new Array(h[0].length),u=0;u<h[0].length;u++)a[u]=h[0][u];h=a}for(r=new Array,u=0;u<h.length;u++)r=r.concat(h[u]);for(o=t.mean(r),i=0,u=0;u<h.length;u++)i+=h[u].length*e.pow(t.mean(h[u])-o,2);for(i/=h.length-1,l=0,u=0;u<h.length;u++)for(s=t.mean(h[u]),c=0;c<h[u].length;c++)l+=e.pow(h[u][c]-s,2);return i/(l/(r.length-h.length))},anovaftest:function(){var e,r,o,s,a=n.call(arguments);if(i(a[0]))return 1-t.centralF.cdf(a[0],a[1],a[2]);var l=t.anovafscore(a);for(e=a.length-1,o=0,s=0;s<a.length;s++)o+=a[s].length;return r=o-e-1,1-t.centralF.cdf(l,e,r)},ftest:function(e,n,i){return 1-t.centralF.cdf(e,n,i)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,n=0;for(e=0;e<this.length;e++)n+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,n-this.length)}}),t.extend({qscore:function(){var r,o,s,a,l,u=n.call(arguments);return i(u[0])?(r=u[0],o=u[1],s=u[2],a=u[3],l=u[4]):(r=t.mean(u[0]),o=t.mean(u[1]),s=u[0].length,a=u[1].length,l=u[2]),e.abs(r-o)/(l*e.sqrt((1/s+1/a)/2))},qtest:function(){var e,i=n.call(arguments);3===i.length?(e=i[0],i=i.slice(1)):7===i.length?(e=t.qscore(i[0],i[1],i[2],i[3],i[4]),i=i.slice(5)):(e=t.qscore(i[0],i[1],i[2]),i=i.slice(3));var r=i[0],o=i[1];return 1-t.tukey.cdf(e,o,r-o)},tukeyhsd:function(e){for(var n=t.pooledstdev(e),i=e.map((function(e){return t.mean(e)})),r=e.reduce((function(t,e){return t+e.length}),0),o=[],s=0;s<e.length;++s)for(var a=s+1;a<e.length;++a){var l=t.qtest(i[s],i[a],e[s].length,e[a].length,n,r,e.length);o.push([[s,a],l])}return o}}),t.extend({normalci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.normal.inv(r[1]/2,0,1)*r[2]/e.sqrt(r[3])):e.abs(t.normal.inv(r[1]/2,0,1)*t.stdev(r[2])/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},tci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.studentt.inv(r[1]/2,r[3]-1)*r[2]/e.sqrt(r[3])):e.abs(t.studentt.inv(r[1]/2,r[2].length-1)*t.stdev(r[2],!0)/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,n){return t.normalci(e,n,this.toArray())},tci:function(e,n){return t.tci(e,n,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,n,i,r){var s=o(e,n,i,r);return t.ztest(s,1)},twoSidedDifferenceOfProportions:function(e,n,i,r){var s=o(e,n,i,r);return t.ztest(s,2)}})}(e,Math),e.models=function(){function t(t,n){var i=t.length,r=n[0].length-1,o=i-r-1,s=e.lstsq(n,t),a=e.multiply(n,s.map((function(t){return[t]}))).map((function(t){return t[0]})),l=e.subtract(t,a),u=e.mean(t),c=e.sum(a.map((function(t){return Math.pow(t-u,2)}))),h=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),d=c+h;return{exog:n,endog:t,nobs:i,df_model:r,df_resid:o,coef:s,predict:a,resid:l,ybar:u,SST:d,SSE:c,SSR:h,R2:c/d}}function n(n){var i,r,o=(i=n.exog,r=i[0].length,e.arange(r).map((function(n){var o=e.arange(r).filter((function(t){return t!==n}));return t(e.col(i,n).map((function(t){return t[0]})),e.col(i,o))}))),s=Math.sqrt(n.SSR/n.df_resid),a=o.map((function(t){var e=t.SST,n=t.R2;return s/Math.sqrt(e*(1-n))})),l=n.coef.map((function(t,e){return(t-0)/a[e]})),u=l.map((function(t){var i=e.studentt.cdf(t,n.df_resid);return 2*(i>.5?1-i:i)})),c=e.studentt.inv(.975,n.df_resid),h=n.coef.map((function(t,e){var n=c*a[e];return[t-n,t+n]}));return{se:a,t:l,p:u,sigmaHat:s,interval95:h}}return{ols:function(i,r){var o=t(i,r),s=n(o),a=function(t){var n,i,r,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,i=t.df_model,r=t.df_resid,e.beta.cdf(n/(r/i+n),i/2,r/2))}}(o),l=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=s,o.f=a,o.adjust_R2=l,o}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n<arguments.length;n++)t[n]=[1].concat(arguments[n]);return e(t)},builddxmatrix:function(){for(var t=new Array(arguments[0].length),n=0;n<arguments[0].length;n++)t[n]=[1].concat(arguments[0][n]);return e(t)},buildjxmatrix:function(t){for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=t[i];return e.builddxmatrix(n)},buildymatrix:function(t){return e(t).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(t,n){var i,r,o,s,a;if(t.cols()==n.rows()){if(n.rows()>1){for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[o][r];s[i][r]=a}return e(s)}for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[r];s[i][r]=a}return e(s)}},regress:function(t,n){var i=e.xtranspxinv(t),r=t.transpose(),o=e.matrixmult(e(i),r);return e.matrixmult(o,n)},regresst:function(t,n,i){var r=e.regress(t,n),o={anova:{}},s=e.jMatYBar(t,r);o.yBar=s;var a=n.mean();o.anova.residuals=e.residuals(n,s),o.anova.ssr=e.ssr(s,a),o.anova.msr=o.anova.ssr/(t[0].length-1),o.anova.sse=e.sse(n,s),o.anova.mse=o.anova.sse/(n.length-(t[0].length-1)-1),o.anova.sst=e.sst(n,a),o.anova.mst=o.anova.sst/(n.length-1),o.anova.r2=1-o.anova.sse/o.anova.sst,o.anova.r2<0&&(o.anova.r2=0),o.anova.fratio=o.anova.msr/o.anova.mse,o.anova.pvalue=e.anovaftest(o.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),o.anova.rmse=Math.sqrt(o.anova.mse),o.anova.r2adj=1-o.anova.mse/o.anova.mst,o.anova.r2adj<0&&(o.anova.r2adj=0),o.stats=new Array(t[0].length);for(var l,u,c,h=e.xtranspxinv(t),d=0;d<r.length;d++)l=Math.sqrt(o.anova.mse*Math.abs(h[d][d])),u=Math.abs(r[d]/l),c=e.ttest(u,n.length-t[0].length-1,i),o.stats[d]=[r[d],l,u,c];return o.regress=r,o},xtranspx:function(t){return e.matrixmult(t.transpose(),t)},xtranspxinv:function(t){var n=e.matrixmult(t.transpose(),t);return e.inv(n)},jMatYBar:function(t,n){var i=e.matrixmult(t,n);return new e(i)},residuals:function(t,n){return e.matrixsubtract(t,n)},ssr:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},sse:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return n},sst:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},matrixsubtract:function(t,n){for(var i=new Array(t.length),r=0;r<t.length;r++){i[r]=new Array(t[r].length);for(var o=0;o<t[r].length;o++)i[r][o]=t[r][o]-n[r][o]}return e(i)}}),e.jStat=e,e)},4788:(t,e,n)=>{"use strict";var i=n(5072),r=n.n(i),o=n(7825),s=n.n(o),a=n(7659),l=n.n(a),u=n(5056),c=n.n(u),h=n(540),d=n.n(h),f=n(1113),p=n.n(f),m=n(365),g={};g.styleTagTransform=p(),g.setAttributes=c(),g.insert=l().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=d(),r()(m.A,g),m.A&&m.A.locals&&m.A.locals},5072:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var o={},s=[],a=0;a<t.length;a++){var l=t[a],u=i.base?l[0]+i.base:l[0],c=o[u]||0,h="".concat(u," ").concat(c);o[u]=c+1;var d=n(h),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var p=r(f,i);i.byIndex=a,e.splice(a,0,{identifier:h,updater:p,references:1})}s.push(h)}return s}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var o=i(t=t||[],r=r||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=i(t,r),u=0;u<o.length;u++){var c=n(o[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}o=l}}},7659:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},9484:(t,e,n)=>{"use strict";n.d(e,{i:()=>Y,q:()=>B});var i,r=n(7389),o=n(4328),s=n(6082),a=n(2003),l=n(9135),u=n(2738),c=n(3077),h=n(826);async function d(t,e,n,r){const o=(0,c.R)(e),a=h.GO.forColumn(e).getNewColumnFromList("ref",[n]),d=h.GO.forColumn(a).getSplitted(0),f=r===i.IDENTITY?function(t,e){const n=e.columns.length,i=new Array(n),r=new Array(n),o=new Array(n);for(let s=0;s<n;++s){const n=e.columns.byIndex(s);i[s]=n.getRawData(),r[s]=n.categories.indexOf("");const a=s<t.length?t.getOriginal(s):u._S;o[s]=n.categories.indexOf(a)}const a=s.Column.float("Identity",e.rowCount),l=a.getRawData();for(let n=0;n<e.rowCount;++n){l[n]=0;for(let e=0;e<t.length;++e)(i[e]?i[e][n]:0)===o[e]&&++l[n];l[n]/=t.length}return a}(d,o):r===i.SIMILARITY?await async function(t,e){const n=e.columns.toList();return await(0,l.uL)(n,t)}(d,o):null;if(null===f)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return f.name=t.columns.getUnusedName(f.name),t.columns.add(f),f}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(i||(i={}));var f,p=n(8774),m=n(144),g=n.n(m),v=n(7233),y=n.n(v),C=n(4139),w=n(115),b=n(8608),A=n(3541),E=n(2935),S=n(7923),T=n(7654),x=n(5480),_=n(5429),N=n(3273),M=n(3657);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(f||(f={}));var O,L,I,R,P,k,G,D=n(912);n(5540),n(4329),(L=O||(O={})).EUCLIDEAN="EUCLIDEAN",L.MANHATTAN="MANHATTAN",O.EUCLIDEAN,O.MANHATTAN,(R=I||(I={})).HAMMING="Hamming",R.EUCLIDEAN="Euclidean",R.MANHATTAN="Manhattan",R.TANIMOTO="Tanimoto",R.LEVENSTEIN="Levenshtein",R.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",R.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",R.SOKAL="Sokal",R.COSINE="Cosine",R.ASYMMETRIC="Asymmetric",R.Difference="Difference",R.OneHot="One-Hot",I.HAMMING,I.EUCLIDEAN,I.MANHATTAN,I.TANIMOTO,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.MONOMER_CHEMICAL_DISTANCE,I.SOKAL,I.COSINE,I.ASYMMETRIC,I.Difference,I.OneHot,I.HAMMING,I.EUCLIDEAN,I.MANHATTAN,I.TANIMOTO,I.SOKAL,I.COSINE,I.ASYMMETRIC,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.MONOMER_CHEMICAL_DISTANCE,I.Difference,I.OneHot,new Set([I.HAMMING,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.MONOMER_CHEMICAL_DISTANCE,I.OneHot]),new Set([I.HAMMING,I.EUCLIDEAN,I.MANHATTAN,I.MONOMER_CHEMICAL_DISTANCE,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.TANIMOTO,I.COSINE,I.SOKAL,I.ASYMMETRIC,I.OneHot,I.Difference]),new Set([I.EUCLIDEAN,I.MANHATTAN,I.OneHot,I.Difference]),new Set([I.EUCLIDEAN,I.MANHATTAN,I.Difference]),new Set([I.EUCLIDEAN,I.MANHATTAN,I.Difference]),new Set([I.TANIMOTO,I.COSINE,I.SOKAL,I.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(P||(P={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(k||(k={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(G||(G={})),Object.prototype.toString,Promise.resolve(),n(934),n(8903);var U,V,F=n(1858);!function(t){t.none="none",t.bold="bold",t.dashed="dashed"}(U||(U={}));class H{get currentLineId(){return this._currentLineIdx}set currentLineId(t){t!==this._currentLineIdx&&(this._currentLineIdx=t,this.sp.render(this.ctx))}set linesToRender(t){this.updateLines(t),this.sp.render(this.ctx)}set linesVisibility(t){this.visibility=t,this.sp.render(this.ctx)}constructor(t,e,n,i,r=U.none){var o;this._currentLineIdx=-1,this.lineClicked=new F.Subject,this.lineHover=new F.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=t,this.xAxisCol=this.sp.dataFrame.columns.byName(e),this.yAxisCol=this.sp.dataFrame.columns.byName(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=r,this.updateLines(i),this.visibility=null!==(o=i.visibility)&&void 0!==o?o:new p.A(this.lines.from.length),i.visibility||this.visibility.setAll(!0,!1),i.arrowSize&&(this.arrowWidth=i.arrowSize),this.canvas.onmousedown=t=>{var e;(null===(e=this.lines)||void 0===e?void 0:e.skipMouseOverDetection)&&(this.mouseOverLineId=this.checkCoordsOnLine(t.offsetX,t.offsetY)),-1!==this.mouseOverLineId&&this.lineClicked.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},this.canvas.onmousemove=t=>{var e;this.mouseOverLineId=(null===(e=this.lines)||void 0===e?void 0:e.skipMouseOverDetection)?-1:this.checkCoordsOnLine(t.offsetX,t.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},t.onEvent("d4-before-draw-scene").subscribe((t=>{this.renderLines()}))}updateLines(t){this.lines=t,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),t.skipMultiLineCalculation?this.multipleLinesCounts.fill(0):this.createMultiLinesIndices()}renderLines(){var t,e,n,i,r,o,s,a,l,u,c,h,d,f,p,m,g;const v=this.sp.getOptions().look,y=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;y||(this.ctx.lineWidth=null!==(t=this.lines.width)&&void 0!==t?t:1,this.ctx.strokeStyle=`rgba(${null!==(e=this.lines.color)&&void 0!==e?e:"0,128,0"},${null!==(n=this.lines.opacity)&&void 0!==n?n:1})`);const C=v.sizeColumnName?this.sp.dataFrame.col(v.sizeColumnName):null,w=this.sp.dataFrame.filter,b=Math.pow(null!==(i=this.lines.shortLineThreshold)&&void 0!==i?i:5,2);for(let t=0;t<this.lines.from.length;t++)if(w.get(this.lines.from[t])&&w.get(this.lines.to[t])&&this.visibility.getBit(t)){let e=0;const{sizeFrom:n,sizeTo:i}=this.getMarkersSizes(v,C,t),w=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[t]),this.yAxisCol.get(this.lines.from[t]));let A=null==w?void 0:w.x,E=null==w?void 0:w.y;const S=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[t]),this.yAxisCol.get(this.lines.to[t]));let T=null==S?void 0:S.x,x=null==S?void 0:S.y;const _=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),A&&E&&T&&x&&Math.hypot(T-A,x-E)/_>.01){if(y){const e=(null===(r=this.lines.colors)||void 0===r?void 0:r[t])?null===(o=this.lines.colors)||void 0===o?void 0:o[t]:null!==(s=this.lines.color)&&void 0!==s?s:"0,128,0",n=(null===(a=this.lines.opacities)||void 0===a?void 0:a[t])?null===(l=this.lines.opacities)||void 0===l?void 0:l[t]:null!==(u=this.lines.opacity)&&void 0!==u?u:1;this.ctx.strokeStyle=`rgba(${e},${n})`,this.ctx.lineWidth=(null===(c=this.lines.widths)||void 0===c?void 0:c[t])?null===(h=this.lines.widths)||void 0===h?void 0:h[t]:null!==(d=this.lines.width)&&void 0!==d?d:1}t===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const v=this.multipleLinesCounts[t];let C=null;if(v){e=this.getLineLength(A,E,T,x);const r=this.getPointOnDistance(A,E,T,x,i,e),o=this.getPointOnDistance(T,x,A,E,n,e);A=r.x,E=r.y,T=o.x,x=o.y,C=this.lines.from[t]>this.lines.to[t]?this.findControlPoint(v,A,E,T,x,t):this.findControlPoint(v,T,x,A,E,t),this.ctx.moveTo(A,E),this.ctx.quadraticCurveTo(C.x,C.y,T,x)}else(!this.lines.skipShortLines||Math.pow(T-A,2)+Math.pow(x-E,2)>b)&&(this.ctx.moveTo(A,E),this.ctx.lineTo(T,x));if((null!==(f=this.lines.drawArrows)&&void 0!==f?f:null===(p=this.lines.drawArrowsArr)||void 0===p?void 0:p.getBit(t))&&(e||(e=this.getLineLength(A,E,T,x)),e>this.arrowWidth)){const t=v?null:this.getPointOnDistance(A,E,T,x,i,e),n=v?C.x:A,r=v?C.y:E;this.canvasArrow(this.ctx,null!==(m=null==t?void 0:t.x)&&void 0!==m?m:A,null!==(g=null==t?void 0:t.y)&&void 0!==g?g:E,n,r)}this.ctx.stroke(),this.ctx.closePath(),t===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(t){switch(this.currentLineStyle){case U.bold:t?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case U.dashed:t?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(t,e,n){let i=3,r=3;return e?(i=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.from[n]))/2,r=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.to[n]))/2):t.markerDefaultSize&&(i=t.markerDefaultSize/2,r=t.markerDefaultSize/2),{sizeFrom:i,sizeTo:r}}fillLeftBottomRect(){const t=new Path2D;t.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(t),this.ctx.closePath()}createMultiLinesIndices(){const t={};for(let e=0;e<this.lines.from.length;e++){let n=0,i=0;this.lines.from[e]<this.lines.to[e]?(n=this.lines.from[e],i=this.lines.to[e]):(n=this.lines.to[e],i=this.lines.from[e]),t[`${n}|${i}`]?(1===t[`${n}|${i}`].length&&(this.multipleLinesCounts[t[`${n}|${i}`][0]]=1,t[`${n}|${i}`].push(1)),this.multipleLinesCounts[e]=++t[`${n}|${i}`][1]):t[`${n}|${i}`]=[e]}}checkCoordsOnLine(t,e){let n=-1,i=null,r=null;const o=this.sp.getOptions().look,s=o.sizeColumnName?this.sp.dataFrame.col(o.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:u}=this.getMarkersSizes(o,s,l),c=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const n=this.getLineLength(c.x,c.y,h.x,h.y),i=this.getPointOnDistance(c.x,c.y,h.x,h.y,u,n),o=this.getPointOnDistance(h.x,h.y,null==c?void 0:c.x,null==c?void 0:c.y,a,n),s=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,o.x,o.y,l):this.findControlPoint(this.multipleLinesCounts[l],o.x,o.y,i.x,i.y,l);r=this.calculateDistToCurveLine(l,t,e,i,o,s)}else r=this.calculateDistToStraightLine(t,e,c,h);(!i&&null!==r&&r<5||i&&null!==r&&r<i)&&(i=r,n=l)}return n}calculateDistToStraightLine(t,e,n,i){const r=Math.min(n.x,i.x),o=Math.max(n.x,i.x),s=Math.min(n.y,i.y),a=Math.max(n.y,i.y);return t>=r-2&&t<=o+2&&e>=s-2&&e<=a+2?this.distToStraightLineSegment(t,e,n,i):null}distToStraightLineSegment(t,e,n,i){const r=(t,e,n,i)=>Math.pow(t-n,2)+Math.pow(e-i,2),o=r(n.x,n.y,i.x,i.y);if(0==o)return r(t,e,n.x,n.y);let s=((t-n.x)*(i.x-n.x)+(e-n.y)*(i.y-n.y))/o;return s=Math.max(0,Math.min(1,s)),r(t,e,n.x+s*(i.x-n.x),n.y+s*(i.y-n.y))}calculateDistToCurveLine(t,e,n,i,r,o){const s=Math.min(i.x,r.x,o.x),a=Math.max(i.x,r.x,o.x),l=Math.min(i.y,r.y,o.y),u=Math.max(i.y,r.y,o.y);if(e>=s-2&&e<=a+2&&n>=l-2&&n<=u+2){const t=a-s,c=u-l;return this.calculateDistToCurveInRect(e,n,i,o,r,t,c)}return null}calculateDistToCurveInRect(t,e,n,i,r,o,s){const a=Math.floor((o+s)/3),l=1/a,u=new Uint32Array(a),c=new Uint32Array(a),h=new Uint32Array(a);let d=null;const f=new p.A(a);for(let o=0;o<u.length;o++){const s=o*l,a=Math.pow(1-s,2)*n.x+2*s*(1-s)*i.x+Math.pow(s,2)*r.x,f=Math.pow(1-s,2)*n.y+2*s*(1-s)*i.y+Math.pow(s,2)*r.y,p=Math.abs(t-a),m=Math.abs(e-f),g=p+m;(!d||d>g)&&(d=g),h[o]=Math.max(p,m),u[o]=a,c[o]=f}for(let t=0;t<u.length;t++)h[t]<d&&f.setBit(t,!0,!1);let m=null;for(let n=-1;-1!==(n=f.findNext(n));){const i=Math.hypot(u[n]-t,c[n]-e);(!m||m>i)&&(m=i)}return m}getLineLength(t,e,n,i){return Math.sqrt(Math.pow(n-t,2)+Math.pow(i-e,2))}getPointOnDistance(t,e,n,i,r,o){const a=n-r*((n-t)/o),l=i-r*((i-e)/o);return new s.Point(a,l)}findControlPoint(t,e,n,i,r,o){const a=e+(i-e)/2,l=n+(r-n)/2;let u=a-e,c=l-n;const h=Math.sqrt(u*u+c*c);u/=h,c/=h;const d=50*Math.ceil(t/2);return t%2==0?new s.Point(a+d/2*c,l-d/2*u):new s.Point(a-d/2*c,l+d/2*u)}canvasArrow(t,e,n,i,r){const o=Math.atan2(i-e,r-n)+Math.PI;t.moveTo(e-this.arrowWidth*Math.sin(o-Math.PI/10),n-this.arrowWidth*Math.cos(o-Math.PI/10)),t.lineTo(e,n),t.lineTo(e-this.arrowWidth*Math.sin(o+Math.PI/10),n-this.arrowWidth*Math.cos(o+Math.PI/10))}}!function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(V||(V={}));var B,q=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.SEQUENCE_VARIABILITY_MAP="Sequence Variability Map",t.MOST_POTENT_RESIDUES="Most Potent Residues",t.LOGO_SUMMARY_TABLE="Logo Summary Table",t.DENDROGRAM="Dendrogram",t.CLUSTER_MAX_ACTIVITY="Active peptide selection"}(B||(B={}));class Y{constructor(t){this.isBitsetChangedInitialized=!1,this.isUserChangedSelection=!0,this._dm=null,this.isInitialized=!1,this.isRibbonSet=!1,this.webLogoSelectedMonomers={},this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._layoutEventInitialized=!1,this.subs=[],this.isHighlighting=!1,this.controlFire=!1,this.accordionSource=null,this._sequenceSpaceViewer=null,this._mclViewer=null,this._monomerPositionStats=null,this._settings=null,this._sequenceSpaceCols=[],this._mclCols=[],this._webLogoSelection=null,this.df=t}get monomerPositionStats(){var t;if(null!==this._monomerPositionStats)return this._monomerPositionStats;const e=this.getScaledActivityColumn();return null===this.positionColumns||null===e?null:(null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,M.Ej)(e,this.df.filter,this.positionColumns)),this._monomerPositionStats)}get analysisView(){return void 0===this._analysisView&&(this._analysisView=g()(o.shell.tableViews).find((({dataFrame:t})=>(null==t?void 0:t.getTag(s.TAGS.ID))===this.id)),void 0===this._analysisView&&(this._analysisView=o.shell.addTableView(this.df))),"1"===this.df.getTag(C.gp.MULTIPLE_VIEWS)||this._layoutEventInitialized||o.shell.isInDemo||(o.shell.v=this._analysisView),this._analysisView.grid.invalidate(),this._analysisView}get settings(){var t;const e=this.df.getTag(C.gp.SETTINGS);return null==e?null:(null!==(t=this._settings)&&void 0!==t||(this._settings=JSON.parse(e)),this._settings)}set settings(t){var e,n,i;const r=Object.entries(t),o=Object.assign({},null!==(n=null===(e=this.settings)||void 0===e?void 0:e.sequenceSpaceParams)&&void 0!==n?n:{}),s=new Set;for(const[t,e]of r)switch(this.settings[t]=e,t){case"activityColumnName":case"activityScaling":s.add("activity"),s.add("stats");break;case"showDendrogram":s.add("dendrogram");break;case"showClusterMaxActivity":s.add("clusterMaxActivity");break;case"showSequenceSpace":s.add("showSequenceSpace");break;case"showLogoSummaryTable":s.add("logoSummaryTable");break;case"showMonomerPosition":s.add("monomerPosition");break;case"showMostPotentResidues":s.add("mostPotentResidues");break;case"columns":s.add("columns");break;case"sequenceSpaceParams":s.add("sequenceSpaceParams");break;case"mclSettings":s.add("mclSettings")}if(this.df.setTag("settings",JSON.stringify(this._settings)),this.isInitialized){if(s.has("sequenceSpaceParams")){const t=this.settings.sequenceSpaceParams;Object.entries(t).some((([t,e])=>o[t]!==e&&"epsilon"!==t&&"minPts"!==t&&"clusterEmbeddings"!==t))||(s.delete("sequenceSpaceParams"),this.settings.sequenceSpaceParams.clusterEmbeddings&&s.add("clusterParams"))}s.has("sequenceSpaceParams")&&s.delete("clusterParams");for(const t of s)switch(t){case"activity":this.createScaledCol();break;case"stats":this.webLogoSelection=(0,b.ZR)(this.positionColumns),this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._monomerPositionStats=null;break;case"dendrogram":this.settings.showDendrogram?this.addDendrogram():this.closeViewer(B.DENDROGRAM);break;case"clusterMaxActivity":this.settings.showClusterMaxActivity?this.addClusterMaxActivityViewer():this.closeViewer(B.CLUSTER_MAX_ACTIVITY);break;case"logoSummaryTable":this.settings.showLogoSummaryTable?this.addLogoSummaryTable():this.closeViewer(B.LOGO_SUMMARY_TABLE);break;case"monomerPosition":this.settings.showMonomerPosition?this.addMonomerPosition():this.closeViewer(B.SEQUENCE_VARIABILITY_MAP);break;case"mostPotentResidues":this.settings.showMostPotentResidues?this.addMostPotentResidues():this.closeViewer(B.MOST_POTENT_RESIDUES);break;case"columns":const t=this.findViewer(B.LOGO_SUMMARY_TABLE);t._viewerGrid=null,t._logoSummaryTable=null,t.render();const e=this.findViewer(B.MOST_POTENT_RESIDUES);e._viewerGrid=null,e.render();break;case"sequenceSpaceParams":case"showSequenceSpace":this.settings.showSequenceSpace&&this.addSequenceSpace({clusterEmbeddings:null===(i=this.settings.sequenceSpaceParams)||void 0===i?void 0:i.clusterEmbeddings});break;case"clusterParams":this.clusterEmbeddings();break;case"mclSettings":this.addMCLClusters()}}}get webLogoSelection(){var t;const e=this.df.getTag(`${C.YX.WL}${C.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._webLogoSelection)&&void 0!==t||(this._webLogoSelection=null===e&&null!==this.positionColumns?(0,b.ZR)(this.positionColumns):JSON.parse(null!=e?e:"{}")),this._webLogoSelection}set webLogoSelection(t){this._webLogoSelection=t,this.df.setTag(`${C.YX.WL}${C.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.fireBitsetChanged(null),this.analysisView.grid.invalidate()}get positionColumns(){const t=g()(this.df.columns.byTags({[C.gp.POSITION_COL]:"true"})).toArray();return 0===t.length?null:t}get id(){return this.df.getTag(s.TAGS.ID)}get alphabet(){return this.df.getCol(this.settings.sequenceColumnName).getTag(a.gp.alphabet)}static getInstance(t){var e,n,i;return t.columns.contains(C.$2.ACTIVITY_SCALED)&&!t.columns.contains(C.$2.ACTIVITY)&&(t.getCol(C.$2.ACTIVITY_SCALED).name=C.$2.ACTIVITY),null!==(e=(n=t.temp)[i=Y.modelName])&&void 0!==e||(n[i]=new Y(t)),t.temp[Y.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,l,u;const c=null===(t=o.shell.t)||void 0===t?void 0:t.temp[Y.modelName];if(!c)return null;const h=r.accordion("Peptides analysis panel");h.root.style.width="100%";const d=c.getVisibleSelection(),f=c.df.filter.anyFalse?` among ${c.df.filter.trueCount} filtered`:"",p=t=>{const e=[];for(const[n,i]of Object.entries(t))for(const t of i)e.push(`${n}:${t}`);return e.join(", ")},m=c.findViewer(B.LOGO_SUMMARY_TABLE),v=[],C=(null===m?[]:m.clusterSelection[x.W.ORIGINAL].concat(m.clusterSelection[x.W.CUSTOM])).join(", ");0!==C.length&&(v.push(r.h1("Logo summary table selection")),v.push(r.divText(`Selected clusters: ${C}`)));const w=c.findViewer(B.SEQUENCE_VARIABILITY_MAP),_=p(null!==(e=null==w?void 0:w.invariantMapSelection)&&void 0!==e?e:{}),N=p(null!==(n=null==w?void 0:w.mutationCliffsSelection)&&void 0!==n?n:{});0===_.length&&0===N.length||v.push(r.h1("Sequence Variabily Map viewer selection")),0!==_.length&&v.push(r.divText(`Selected monomer-positions: ${_}`)),0!==N.length&&v.push(r.divText(`Selected mutation cliffs pairs: ${N}`));const O=c.findViewer(B.MOST_POTENT_RESIDUES),L=p(null!==(i=null==O?void 0:O.mutationCliffsSelection)&&void 0!==i?i:{});0!==L.length&&(v.push(r.h1("Most Potent Residues viewer selection")),v.push(r.divText(`Selected monomer-positions: ${L}`)));const I=p(c.webLogoSelection);0!==I.length&&(v.push(r.h1("WebLogo selection")),v.push(r.divText(`Selected monomers: ${I}`)));const R=r.div(r.divV(v));h.addTitle(r.divV([r.h1(`${d.trueCount} selected rows${f}`),R],"css-gap-small")),d.anyTrue&&h.addPane("Actions",(()=>{try{const t=r.label("New view");if(y()(t).addClass("d4-link-action"),t.onclick=()=>c.createNewView(),t.onmouseover=t=>r.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===m)return r.divV([t]);const e=r.label("New cluster");y()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===m)throw new Error("Logo summary table viewer is not found");m.clusterFromSelection()},e.onmouseover=t=>r.tooltip.show("Creates a new cluster from selection",t.clientX+5,t.clientY+5);const n=r.label("Remove cluster");return y()(n).addClass("d4-link-action"),n.onclick=()=>{const t=c.findViewer(B.LOGO_SUMMARY_TABLE);if(null===t)throw new Error("Logo summary table viewer is not found");t.removeCluster()},n.onmouseover=t=>r.tooltip.show("Removes currently selected custom cluster",t.clientX+5,t.clientY+5),n.style.visibility=0===m.clusterSelection[x.W.CUSTOM].length?"hidden":"visible",r.divV([t,e,n])}catch(t){const e=r.divText("Error in Actions");return r.tooltip.bind(e,String(t)),e}}),!0);let P=c.settings;const k=[w,O,m].filter((t=>null!==t&&(t.type!==this.accordionSource||(P=t,!1))));if(null===P)throw new Error("PeptidesError: Model is the source of accordion but is not initialized");P!==c.settings&&k.push(c.settings);const G=k.filter((t=>null!==t&&(0,b.$s)(P,t)&&(t!==c.settings||c.isInitialized)));G.push(P);const D=s.BitSet.create(c.df.rowCount);for(const t of G){const e=t===this.settings?(0,b.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof x.s?(0,b.KT)(t.clusterSelection,t.clusterStats):t instanceof A.xN?(0,b.KT)(t.mutationCliffsSelection,(0,b.qI)(null!==(l=t.mutationCliffs)&&void 0!==l?l:new Map,c.df.rowCount)):null;if(null!==e&&D.or(e),t instanceof A.J){const e=(0,b.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&D.or(e)}}const U=P;P===c.settings||U instanceof x.s||null==U.mutationCliffs||h.addPane("Mutation Cliffs pairs",(()=>(0,S.F)(c.df,{mutationCliffs:U.mutationCliffs,mutationCliffsSelection:U.mutationCliffsSelection,gridColumns:c.analysisView.grid.columns,sequenceColumnName:U.sequenceColumnName,positionColumns:U.positionColumns,activityCol:U.getScaledActivityColumn()}).root),!0);const V=P===c.settings,F=V?this.webLogoSelection:P instanceof A.J?P.invariantMapSelection:{},H=P instanceof x.s?P.clusterSelection:null!==(u=null==m?void 0:m.clusterSelection)&&void 0!==u?u:{};h.addPane("Distribution",(()=>{var t;try{return(0,T.HV)(c.df,{peptideSelection:D,columns:V?null!==(t=c.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityCol:V?c.getScaledActivityColumn():P.getScaledActivityColumn(),monomerPositionSelection:F,clusterSelection:H,clusterColName:null==m?void 0:m.clustersColumnName})}catch(t){const e=r.divText("Error in Distribution");return r.tooltip.bind(e,String(t)),e}}),!0);const q=(t,e)=>{if(null==t||null==e)return!1;for(const[n,i]of Object.entries(t))if(i!==e[n])return!1;return!0};return h.addPane("Selection",(()=>{var t;try{return function(t,e){var n,i;if(0===e.tableSelection.trueCount)return r.divText("No compounds selected");const o=s.DataFrame.create(t.rowCount);o.name="Selected compounds",o.filter.copyFrom(e.tableSelection);const a=g()(t.columns.numerical);let l=null;for(let t=1;t<e.gridColumns.length;t++){const r=e.gridColumns.byIndex(t);if(!r.visible)continue;const u=r.column;if(u.type===s.COLUMN_TYPE.BOOL)continue;null===l&&r.grid&&(null===(n=r.grid.sortByColumns)||void 0===n?void 0:n.length)>0&&(null===(i=r.grid.sortTypes)||void 0===i?void 0:i.length)===r.grid.sortByColumns.length&&(l={cols:r.grid.sortByColumns,types:r.grid.sortTypes});let c=null,h=null;try{c=u.getRawData(),h=u.categories}catch(t){}const d=c&&h?a.some((t=>t.name===u.name))?t=>c[t]:t=>h[c[t]]:t=>u.get(t),f=u.name===e.activityColumn.name?o.columns.addNewFloat(r.name).init((t=>d(t))):o.columns.addNewVirtual(r.name,(t=>d(t)),u.type);for(const[t,e]of u.tags)f.setTag(t,e)}const u=o.plot.grid();u.props.showRowHeader=!1,u.root.style.maxWidth="100%",s.debounce(r.onSizeChanged(u.root),50).subscribe((t=>{var e;const n=u.root.parentElement;(null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.classList.contains("panel-content"))&&(u.root.style.height="calc(100% - 20px)",u.root.style.width="calc(100% - 20px)",u.root.style.position="absolute",u.root.style.right="10px",u.root.style.top="10px")})),(0,b.zz)(u);const c=r.box(u.root);c.style.marginLeft="0px",setTimeout((()=>{null!==l&&u.sort(l.cols,l.types);for(let t=1;t<e.gridColumns.length;t++){const n=e.gridColumns.byIndex(t);n.visible&&u.col(n.name)&&(u.col(n.name).width=n.width)}}),500);const h=(0,M.Ej)(e.activityColumn,o.filter,e.positionColumns,{isFiltered:o.filter.anyTrue||o.filter.anyFalse}),d={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},f={x:0,y:0,monomerPosition:{},mpStats:h};return e.isAnalysis&&(0,E.FZ)(u,h,e.positionColumns,e.activityColumn,d,f),c}(c.df,{positionColumns:V?c.positionColumns:P.positionColumns,columns:V?null!==(t=c.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityColumn:V?c.getScaledActivityColumn():P.getScaledActivityColumn(),gridColumns:c.analysisView.grid.columns,colorPalette:(0,a.SM)(c.df.getCol(V?c.settings.sequenceColumnName:P.sequenceColumnName)),tableSelection:c.getCombinedSelection(),isAnalysis:null!==c.settings&&(V||q(c.settings.columns,P.getAggregationColumns()))})}catch(t){const e=r.divText("Error in Selection");return r.tooltip.bind(e,String(t)),e}}),!0),h}getScaledActivityColumn(t=!1){const e=this.df.col(C.$2.ACTIVITY);return t&&null!==e?s.DataFrame.fromColumns([e]).clone(this.df.filter).getCol(e.name):e}updateGrid(){this.joinDataFrames(),this.createScaledCol(),this.webLogoBounds={};const t={selectionCallback:(t,e)=>this.modifyWebLogoSelection(t,e),unhighlightCallback:()=>this.unhighlight(),colorPalette:()=>(0,a.SM)(this.df.getCol(this.settings.sequenceColumnName)),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>(0,b.dl)(t,e,n),isSelectionTable:!1,headerSelectedMonomers:()=>this.webLogoSelectedMonomers};if(null===this.monomerPositionStats||null===this.positionColumns)throw new Error("PeptidesError: Could not updage grid: monomerPositionStats or positionColumns are null");E.FZ(this.analysisView.grid,this.monomerPositionStats,this.positionColumns,this.getScaledActivityColumn(),t),this._layoutEventInitialized||(o.events.onViewLayoutApplied.subscribe((t=>{t.view.id===this.analysisView.id&&this.updateGrid()})),this._layoutEventInitialized=!0),this.setTooltips(),this.setBitsetCallback(),this.setGridProperties()}joinDataFrames(){const t=this.df.name,e=this.df.columns,n=(0,c.R)(this.df.getCol(this.settings.sequenceColumnName)),i=n.columns.names();for(const t of i){let i=this.df.col(t);const r=n.getCol(t);null!==i&&e.remove(t);const o=r.categories,s=r.getRawData();i=e.addNew(r.name,r.type).init((t=>o[s[t]])),i.setTag(C.gp.ANALYSIS_COL,"true"),i.setTag(C.gp.POSITION_COL,"true"),E.rI(i,this.alphabet)}this.df.name=t}createScaledCol(){const t=this.analysisView.grid,e=(0,b.Y1)(this.df.getCol(this.settings.activityColumnName),this.settings.activityScaling);this.df.columns.replace(C.$2.ACTIVITY,e),t.columns.setOrder([e.name])}unhighlight(){this.isHighlighting&&(this.df.rows.highlight(null),this.isHighlighting=!1)}setTooltips(){this.analysisView.grid.onCellTooltip(((t,e,n)=>{var i,r;return!(!t.isColHeader||(null===(i=t.tableColumn)||void 0===i?void 0:i.semType)!==C.uF.MONOMER)||!(!t.isTableCell||(null===(r=t.tableColumn)||void 0===r?void 0:r.semType)!==C.uF.MONOMER)&&((0,D.cr)(t.cell.value,e,n),!0)}))}getCombinedSelection(){var t,e,n,i,r,o,a,l;const u=new p.A(this.df.rowCount,!1),c=(t,e)=>{for(const[n,i]of Object.entries(t))for(const t of i){const i=null==e?void 0:e[n];if(void 0===i)continue;const r=i[t];void 0!==r&&u.or(r.mask)}};c(this.webLogoSelection,this.monomerPositionStats);const h=this.findViewer(B.SEQUENCE_VARIABILITY_MAP);c(null!==(t=null==h?void 0:h.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==h?void 0:h.monomerPositionStats)&&void 0!==e?e:null);const d=(t,e)=>{var n,i;for(const[r,o]of Object.entries(t))for(const t of o){const o=null!==(i=null===(n=null==e?void 0:e.get(t))||void 0===n?void 0:n.get(r))&&void 0!==i?i:null;if(null!==o)for(const[t,e]of o.entries()){u.setTrue(t);for(const t of e)u.setTrue(t)}}};d(null!==(n=null==h?void 0:h.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==h?void 0:h.mutationCliffs)&&void 0!==i?i:null);const f=this.findViewer(B.MOST_POTENT_RESIDUES);d(null!==(r=null==f?void 0:f.mutationCliffsSelection)&&void 0!==r?r:{},null!==(o=null==f?void 0:f.mutationCliffs)&&void 0!==o?o:null);const m=this.findViewer(B.LOGO_SUMMARY_TABLE);for(const t of Object.keys(null!==(a=null==m?void 0:m.clusterSelection)&&void 0!==a?a:{}))for(const e of null!==(l=m.clusterSelection[t])&&void 0!==l?l:[]){const n=m.clusterStats[t][e];u.or(n.mask)}return s.BitSet.fromBytes(u.buffer.buffer,u.length)}setBitsetCallback(){if(this.isBitsetChangedInitialized)return;const t=this.df.selection,e=this.df.filter,n=()=>{try{const t=this.createAccordion();if(null===t)return;o.shell.o=t.root}catch(t){console.error(t)}};t.onChanged.subscribe((()=>{if(this.controlFire)this.controlFire=!1;else try{this.isUserChangedSelection||t.copyFrom(this.getCombinedSelection(),!1)}catch(t){N._package.logger.debug("Peptides: Error on selection changed"),N._package.logger.debug(t)}finally{n()}})),e.onChanged.subscribe((()=>{var t,e;try{if(this.controlFire)return void(this.controlFire=!1);const n=this.findViewer(B.LOGO_SUMMARY_TABLE);null!==n&&void 0!==n.model&&(n._logoSummaryTable=null!==(t=n.createLogoSummaryTable())&&void 0!==t?t:n._logoSummaryTable,n._viewerGrid=null!==(e=n.createLogoSummaryTableGrid())&&void 0!==e?e:n._viewerGrid,n.render())}catch(t){N._package.logger.debug("Peptides: Error on filter changed"),N._package.logger.debug(t)}finally{n()}})),this.isBitsetChangedInitialized=!0}fireBitsetChanged(t,e=!1){this.accordionSource=t,this.isBitsetChangedInitialized||this.setBitsetCallback(),this.isUserChangedSelection=!1,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.controlFire=!0,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.isUserChangedSelection=!0,this.webLogoSelectedMonomers=(0,b.qx)(this.df)}setGridProperties(t){var e,n,i,r;const o=this.analysisView.grid,s=o.props;s.allowColSelection=null!==(e=null==t?void 0:t.allowColSelection)&&void 0!==e&&e,s.allowEdit=null!==(n=null==t?void 0:t.allowEdit)&&void 0!==n&&n,s.showReadOnlyNotifications=null!==(i=null==t?void 0:t.showReadOnlyNotifications)&&void 0!==i&&i,s.showCurrentRowIndicator=null!==(r=null==t?void 0:t.showCurrentRowIndicator)&&void 0!==r&&r;const l=this.positionColumns;if(null===l)throw new Error("PeptidesError: Could not set grid properties: positionColumns are null");let u=10;const c=o.canvas.getContext("2d");if(null===c)throw new Error("PeptidesError: Could not set grid properties: canvas context is null");for(const t of l){const e=(0,a.zS)(t.categories.reduce(((t,e)=>t.length>e.length?t:e)),6),n=Math.ceil(c.measureText(e).width);u=Math.max(u,n)}const h=l.map((t=>t.name));for(let t=1;t<this.analysisView.grid.columns.length;++t){const e=this.analysisView.grid.columns.byIndex(t);if(null===e)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' is null`);if(null===e.column)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' has null column`);e.visible=h.includes(e.column.name)||e.column.name===C.$2.ACTIVITY}setTimeout((()=>{for(const t of l){const e=o.col(t.name);if(null===e)throw new Error(`PeptidesError: Could not set column width: grid column '${t.name}' is null`);e.width=u+15}}),100)}closeViewer(t){const e=this.findViewer(t);null==e||e.detach(),null==e||e.close()}findViewerNode(t){for(const e of this.analysisView.dockManager.rootNode.children)if(e.container.containerElement.innerHTML.includes(t))return e;return null}addDendrogram(){return q(this,void 0,void 0,(function*(){const t=s.TaskBarProgressIndicator.create("Calculating distance matrix...");try{const t=s.Func.find({package:"Dendrogram",name:"hierarchicalClustering"})[0];if(!t||4!==t.inputs.length)throw new Error("Correct dendrogram function is not found");yield t.apply({df:this.df,colNameList:[this.settings.sequenceColumnName],distance:"euclidean",linkage:"complete"})}catch(t){N._package.logger.error(t)}finally{t.close()}}))}init(t){if(!this.isInitialized){if(this.settings=t,this.isInitialized=!0,!this.isRibbonSet&&"1"!==this.df.getTag(C.gp.MULTIPLE_VIEWS)){const t=r.iconFA("wrench",(()=>(0,_.OH)(this)),"Peptides analysis settings");this.analysisView.setRibbonPanels([[t]],!1),this.isRibbonSet=!0,this.updateGrid()}this.subs.push(o.events.onAccordionConstructed.subscribe((t=>{if(!(o.shell.o instanceof s.SemanticValue||o.shell.o instanceof s.Column&&this.df.columns.toList().includes(o.shell.o)))return;const e=t.getPane("Actions"),n=y()(e.root).find(".d4-flex-col"),a=r.label("Calculate identity");a.classList.add("d4-link-action"),r.tooltip.bind(a,"Adds a column with fractions of matching monomers against sequence in the current row"),a.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);d(this.df,t,t.get(this.df.currentRowIdx),i.IDENTITY).then((e=>e.setTag(C.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>N._package.logger.debug(t)))},n.append(r.span([a],"d4-markdown-row"));const l=r.label("Calculate similarity");l.classList.add("d4-link-action"),r.tooltip.bind(l,"Adds a column with sequence similarity scores against sequence in the current row"),l.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);d(this.df,t,t.get(this.df.currentRowIdx),i.SIMILARITY).then((e=>e.setTag(C.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>N._package.logger.debug(t)))},n.append(r.span([l],"d4-markdown-row"))}))),this.subs.push(o.events.onViewRemoved.subscribe((t=>{t.id===this.analysisView.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: view ${t.name} removed`)}))),this.subs.push(o.events.onTableRemoved.subscribe((t=>{t.id===this.df.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: table ${t.name} removed`)}))),this.subs.push(o.events.onProjectClosed.subscribe((t=>{t.id===o.shell.project.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: project ${t.name} closed`)}))),this.fireBitsetChanged(null,!0),this.analysisView.grid.invalidate()}}findViewer(t){return g()(this.analysisView.viewers).find((e=>e.type===t))||null}addLogoSummaryTable(t){return q(this,void 0,void 0,(function*(){null!=t||(t={sequenceColumnName:this.settings.sequenceColumnName,clustersColumnName:g()(this.df.columns.categorical).next().value,activityColumnName:this.settings.activityColumnName,activityScaling:this.settings.activityScaling});const e=yield this.df.plot.fromType(B.LOGO_SUMMARY_TABLE,t);this.analysisView.dockManager.dock(e,s.DOCK_TYPE.RIGHT,null,B.LOGO_SUMMARY_TABLE),e.viewerGrid.invalidate()}))}addClusterMaxActivityViewer(t){return q(this,void 0,void 0,(function*(){var e,n,i,r,o,a,l;const u=null!==(r=null!==(n=null===(e=this._mclCols)||void 0===e?void 0:e.find((t=>t.toLowerCase().startsWith("cluster (mcl)"))))&&void 0!==n?n:null===(i=this.findViewer(B.LOGO_SUMMARY_TABLE))||void 0===i?void 0:i.clustersColumnName)&&void 0!==r?r:null===(o=this._sequenceSpaceCols)||void 0===o?void 0:o.find((t=>t.toLowerCase().startsWith("cluster")));null!=t||(t={activityColumnName:this.settings.activityColumnName,clusterColumnName:null!=u?u:null===(a=g()(this.df.columns.categorical).next().value)||void 0===a?void 0:a.name,activityTarget:C.wf.HIGH,connectivityColumnName:this._mclCols.find((t=>t.toLowerCase().startsWith("connectivity"))),clusterSizeThreshold:20,activityThreshold:1e3});const c=yield this.df.plot.fromType(B.CLUSTER_MAX_ACTIVITY,t),h=null!==(l=this.findViewerNode(B.LOGO_SUMMARY_TABLE))&&void 0!==l?l:null;this.analysisView.dockManager.dock(c,h?s.DOCK_TYPE.DOWN:s.DOCK_TYPE.RIGHT,h,B.CLUSTER_MAX_ACTIVITY)}))}addMonomerPosition(t){return q(this,void 0,void 0,(function*(){null!=t||(t={maxMutations:1,activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,activityTarget:C.wf.HIGH});const e=yield this.df.plot.fromType(B.SEQUENCE_VARIABILITY_MAP,t),n=this.findViewer(B.MOST_POTENT_RESIDUES),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.LEFT,this.findViewerNode(B.MOST_POTENT_RESIDUES),.7];i.dock(e,r,o,B.SEQUENCE_VARIABILITY_MAP,a)}))}addMostPotentResidues(t){return q(this,void 0,void 0,(function*(){null!=t||(t={activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,maxMutations:1,activityTarget:C.wf.HIGH});const e=yield this.df.plot.fromType(B.MOST_POTENT_RESIDUES,t),n=this.findViewer(B.SEQUENCE_VARIABILITY_MAP),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.RIGHT,this.findViewerNode(B.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,r,o,B.MOST_POTENT_RESIDUES,a)}))}createNewView(){const t=this.getVisibleSelection(),e=this.df.clone(t);for(const[t,n]of e.tags)e.setTag(t,t===C.gp.SETTINGS?n:"");e.name="Peptides Multiple Views",e.setTag(C.gp.MULTIPLE_VIEWS,"1");const n=o.shell.addTableView(e),i=this.findViewer(B.LOGO_SUMMARY_TABLE);return null!=i&&n.addViewer(B.LOGO_SUMMARY_TABLE,{[`sequence${C.To}`]:i.sequenceColumnName,[`activity${C.To}`]:i.activityColumnName,activityScaling:i.activityScaling,webLogoMode:i.webLogoMode,membersRatioThreshold:i.membersRatioThreshold,[`clusters${C.To}`]:i.clustersColumnName}),e.getTag(s.TAGS.ID)}clusterEmbeddings(){return q(this,void 0,void 0,(function*(){var t,e;if(!this._sequenceSpaceCols||0===this._sequenceSpaceCols.length)return void o.shell.warning("Embeddings columns are not initialized");const i=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("embed_")));if(2!==i.length)return void o.shell.warning(`Found ${i.length} embeddings columns, expected 2`);const r=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("cluster")));r.length>0&&this.df.columns.remove(r[0]);const s=this.df.getCol(i[0]).getRawData(),a=this.df.getCol(i[1]).getRawData(),l=null!==(t=this.settings.sequenceSpaceParams.epsilon)&&void 0!==t?t:.01,u=null!==(e=this.settings.sequenceSpaceParams.minPts)&&void 0!==e?e:4,c=yield function(t,e,i,r){return o=this,s=void 0,l=function*(){return new Promise((function(o,s){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:r,epsilon:i}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?s(t):o(e)}}))},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function i(t){try{r(l.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof a?r:new a((function(t){t(r)}))).then(n,i)}r((l=l.apply(o,s||[])).next())}));var o,s,a,l}(s,a,l,u),h=this.df.columns.getUnusedName("Cluster (DBSCAN)"),d=this.df.columns.addNewString(h);d.init((t=>c[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=d.name),this._sequenceSpaceCols=[i[0],i[1],d.name];const f=this.analysisView.grid.col(d.name);f&&(f.visible=!1)}))}addMCLClusters(){return q(this,void 0,void 0,(function*(){var t,e,i,a,l;if(null!==this._mclViewer)try{null===(t=this._mclViewer)||void 0===t||t.detach(),null===(e=this._mclViewer)||void 0===e||e.close()}catch(t){}0!==this._mclCols.length&&this._mclCols.forEach((t=>this.df.columns.remove(t))),this._mclCols=[];const u=this.df.getCol(this.settings.sequenceColumnName);null!==(i=(l=this.settings).mclSettings)&&void 0!==i||(l.mclSettings=new w.av);const c=this.settings.mclSettings;let h=0;const d=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if((e.name.toLowerCase().startsWith("embed")||e.name.toLowerCase().startsWith("cluster")||e.name.toLowerCase().startsWith("connectivity"))&&e.name.toLowerCase().includes("mcl")){const t=this.analysisView.grid.col(e.name);if(null==t||this._mclCols.includes(e.name))continue;t.visible=!1,this._mclCols.push(e.name),h++}5===h&&d.unsubscribe()})),f=o.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===s.VIEWER.SCATTER_PLOT){if(this._sequenceSpaceViewer&&this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root)){const t=this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,s.DOCK_TYPE.FILL,t)}))}f.unsubscribe()}}catch(t){console.error(t)}})),p=s.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0],m=yield async function(t,e,i,a,l,u,c,h=80,d=10,f=!1,p=2,m=5,g){const v=o.shell.tableView(t.name)??o.shell.addTableView(t),y=g??v.scatterPlot({showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1,title:"MCL"});r.setUpdateIndicator(y.root,!0);const C=[],w=[];for(let t=0;t<u.length;++t){const n=u[t];if(n){const r=n.inputs[0].name,o=n.inputs[1].name,{entries:s,options:a}=await n.apply({[r]:e[t],[o]:i[t],...c[t]??{}});w.push({entries:s,options:a}),C.push(a??{})}else{const n=e[t].toList(),i={};w.push({entries:n,options:i}),C.push(i)}}const b=function(t,e,i,r,o,s,a=10,l=!1,u=2){const c=new Worker(new URL(n.p+n.u(51),n.b));let h;return c.postMessage({data:t,threshold:e,weights:i,aggregationMethod:r,distanceFns:o,distanceFnArgs:s,maxIterations:a,useWebGPU:l,inflate:u}),{promise:new Promise(((t,e)=>{h=t,c.onmessage=e=>{setTimeout((()=>c.terminate()),100),t(e.data.res)},c.onerror=t=>{setTimeout((()=>c.terminate()),100),e(t)}})),terminate:()=>{try{h(null),c.terminate()}catch(t){console.error(t)}}}}(w.map((t=>t.entries)),h,a,l,i,C,d,f,p),A=o.events.onViewerClosed.subscribe((t=>{t.args.viewer?.props?.title===y.props.title&&y.type===t.args?.viewer?.type&&(A.unsubscribe(),b.terminate())})),E=await b.promise;if(!E)return;const S=t.columns.getUnusedName("Cluster (MCL)"),T=t.columns.getUnusedName("EmbedX (MCL)"),x=t.columns.getUnusedName("EmbedY (MCL)"),_={};E.clusters.forEach((t=>{_[t]||(_[t]=0),_[t]++}));const N=new Uint32Array(E.embedX.length);for(let t=0;t<E.is.length;t++)N[E.is[t]]++,N[E.js[t]]++;const M=t.columns.getUnusedName("Cluster size (MCL)"),O=t.columns.getUnusedName("Connectivity (MCL)"),L=t.columns.addNewFloat(T);L.init((t=>E.embedX[t]));const I=t.columns.addNewFloat(x);I.init((t=>E.embedY[t]));const R=t.columns.addNewString(S);R.init((t=>_[E.clusters[t]]>=m?E.clusters[t].toString():"-1"));const P={"-1":s.Color.setAlpha(s.Color.lightBlue,100)};R.setTag(s.TAGS.COLOR_CODING_CATEGORICAL,JSON.stringify(P)),R.temp[s.TAGS.COLOR_CODING_CATEGORICAL]=P;const k=t.columns.addNewInt(M);k.init((t=>_[E.clusters[t]]));const G=t.columns.addNewInt(O);G.init((t=>N[t])),y.props.xColumnName=T,y.props.yColumnName=x,y.props.colorColumnName=S,y.props.markerDefaultSize=6,A.unsubscribe();const D=[],V=[],F=new Map;for(let t=0;t<E.is.length;t++){let e=E.clusters[E.is[t]],n=E.clusters[E.js[t]];if(e===n){D.push(E.is[t]),V.push(E.js[t]);continue}if(e>n){const t=e;e=n,n=t}let i=F.get(e);i||(i=new Map,F.set(e,i));let r=i.get(n);r||(r=0),r>=20||(r++,i.set(n,r),D.push(E.is[t]),V.push(E.js[t]))}return new H(y,T,x,{from:new Uint32Array(D),to:new Uint32Array(V),drawArrows:!1,opacity:.3,skipMultiLineCalculation:!0,skipShortLines:!0,skipMouseOverDetection:!0,shortLineThreshold:6,width:.75,color:"128,128,128"},U.none),r.setUpdateIndicator(y.root,!1),{sc:y,embedXCol:L,embedYCol:I,clusterCol:R,clusterCounterCol:k,connectivityCol:G}}(this.df,[u],[c.distanceF],[1],V.MANHATTAN,[p],[{gapOpen:c.gapOpen,gapExtend:c.gapExtend,fingerprintType:c.fingerprintType}],c.threshold,c.maxIterations,c.useWebGPU,c.inflation,c.minClusterSize);f.unsubscribe();const g=this.findViewer(B.LOGO_SUMMARY_TABLE);if(g&&(g._clusterStats=null,g._clusterSelection=null,g._viewerGrid=null,g._logoSummaryTable=null,g.render()),null==m?void 0:m.sc){const t=JSON.stringify({cols:[u].map((t=>t.name)),metrics:[c.distanceF],weights:[1],aggregationMethod:V.MANHATTAN,preprocessingFuncs:[p].map((t=>{var e;return null!==(e=null==t?void 0:t.name)&&void 0!==e?e:null})),preprocessingFuncArgs:[{gapOpen:c.gapOpen,gapExtend:c.gapExtend,fingerprintType:c.fingerprintType}],threshold:c.threshold,maxIterations:c.maxIterations,useWebGPU:c.useWebGPU,inflate:c.inflation,minClusterSize:c.minClusterSize});this.df.setTag("MCL_OPTIONS",t),m.sc.props.initializationFunction="EDA:MCLInitializationFunction",this._mclViewer=null!==(a=null==m?void 0:m.sc)&&void 0!==a?a:null}}))}addSequenceSpace(){return q(this,arguments,void 0,(function*(t={}){var e,n,i,r;if(null!==this._sequenceSpaceViewer)try{null===(e=this._sequenceSpaceViewer)||void 0===e||e.detach(),null===(n=this._sequenceSpaceViewer)||void 0===n||n.close()}catch(t){}0!==this._sequenceSpaceCols.length&&this._sequenceSpaceCols.forEach((t=>this.df.columns.remove(t))),this._sequenceSpaceCols=[];let l=this.df.getCol(this.settings.sequenceColumnName);const u=h.GO.forColumn(l);if(u.isHelm())try{o.shell.warning("Column is in HELM notation. Sequences space will linearize sequences from position 0 prior to analysis");const t=u.convert(a.Hi.SEPARATOR,"/"),e=this.df.columns.getUnusedName(`Separator(${l.name})`);t.name=e,this.df.columns.add(t,!0),this.analysisView.grid.col(e).visible=!1,l=t}catch(t){return o.shell.error("Error on converting HELM notation to linear notation"),void o.shell.error(t)}const c=!t.clusterCol&&!!t.clusterEmbeddings,d=null!==(r=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==r?r:new w.GI(c);d.clusterEmbeddings=c;const p={table:this.df,molecules:l,methodName:f.UMAP,similarityMetric:d.distanceF,plotEmbeddings:!0,options:{bypassLargeDataWarning:!0,dbScanEpsilon:d.epsilon,dbScanMinPts:d.minPts,randomSeed:"1",preprocessingFuncArgs:{gapOpen:d.gapOpen,gapExtend:d.gapExtend,fingerprintType:d.fingerprintType}},clusterEmbeddings:d.clusterEmbeddings};let m=0;const g=d.clusterEmbeddings?3:2,v=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if(e.name.toLowerCase().startsWith("embed_")||d.clusterEmbeddings&&e.name.toLowerCase().startsWith("cluster")){const t=this.analysisView.grid.col(e.name);if(null==t||this._sequenceSpaceCols.includes(e.name))continue;t.visible=!1,this._sequenceSpaceCols.push(e.name),m++}m===g&&v.unsubscribe()})),y=o.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===s.VIEWER.SCATTER_PLOT){if(this._mclViewer&&this.analysisView.dockManager.findNode(this._mclViewer.root)){const t=this.analysisView.dockManager.findNode(this._mclViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,s.DOCK_TYPE.FILL,t)}))}y.unsubscribe()}}catch(t){console.error(t)}})),C=yield o.functions.call("Bio:sequenceSpaceTopMenu",p);y.unsubscribe(),C instanceof s.ScatterPlotViewer&&(d.clusterEmbeddings||t.clusterCol||(C.props.colorColumnName=this.getScaledActivityColumn().name),C.props.showXSelector=!1,C.props.showYSelector=!1,t.clusterCol&&(C.props.colorColumnName=t.clusterCol.name),this._sequenceSpaceViewer=C,C.onContextMenu.subscribe((t=>{try{t.item("Modify Sequence space parameters",(()=>{(0,_.OH)(this)}))}catch(t){}})))}))}}Y.modelName="peptidesModel"},3273:(t,e,n)=>{"use strict";n.d(e,{_package:()=>R,getMonomerWorksInstance:()=>P,getTreeHelperInstance:()=>k});var i,r,o=n(4328),s=n(7389),a=n(6082),l=(n(5082),n(7233)),u=n.n(l),c=(n(4788),n(9484));n(826),n(3541),n(5480),(r=i||(i={})).BASE="HELM_BASE",r.SUGAR="HELM_SUGAR",r.LINKER="HELM_LINKER",r.AA="HELM_AA",r.CHEM="HELM_CHEM",r.BLOB="HELM_BLOB",r.NUCLEOTIDE="HELM_NUCLETIDE";var h=n(4139);n(8608),n(2003),n(8070);var d=n(5072),f=n.n(d),p=n(7825),m=n.n(p),g=n(7659),v=n.n(g),y=n(5056),C=n.n(y),w=n(540),b=n.n(w),A=n(1113),E=n.n(A),S=n(6677),T={};T.styleTagTransform=E(),T.setAttributes=C(),T.insert=v().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=b(),f()(S.A,T),S.A&&S.A.locals&&S.A.locals;var x;!function(t){let e,n;!function(t){t.vert=function(t){return s.divV(t.map((t=>s.render(t))),{classes:"u2-panel"})},t.horz=function(t){return s.divH(t.map((t=>s.render(t))),{classes:"u2-panel"})}}(e=t.panels||(t.panels={})),t.appHeader=function(t){const n=s.iconImage("",t.iconPath);return u()(n).addClass("ui-app-header-icon").css("margin-right","20px"),e.horz([n,e.vert([s.markdown(t.description),t.learnMoreUrl?s.link("Learn more",t.learnMoreUrl):null])])},function(t){t.runAsync=function(t,e){return n=this,i=void 0,a=function*(){s.setUpdateIndicator(t,!0);try{return yield e()}catch(t){o.log.error(t)}finally{s.setUpdateIndicator(t,!1)}},new((r=void 0)||(r=Promise))((function(t,e){function o(t){try{l(a.next(t))}catch(t){e(t)}}function s(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(o,s)}l((a=a.apply(n,i||[])).next())}));var n,i,r,a}}(n=t.tools||(t.tools={}))}(x||(x={}));var _=n(144),N=n.n(_);const M=rxjs.operators;class O extends a.JsViewer{get scViewer(){return this._scViewer||(this._scViewer=this.createSCViewer()),this._scViewer}constructor(){super(),this._titleHost=s.divText(c.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=s.div(),this.activityTarget=h.wf.HIGH,this.viewerError="",this.renderTimeout=null,this.renderDebounceTime=500,this.scFilterQuery=`\${${O.maxActivityInClusterColName}} == 1`,this.selectionSubscription=null,this.linesDrawSubscription=null,this.clusterColumnName=this.column("cluster",{nullable:!1}),this.activityColumnName=this.column("activity",{nullable:!1}),this.colorColumnName=this.column("color",{nullable:!0,defaultValue:null}),this.activityTarget=this.string("activityTarget",h.wf.HIGH,{choices:[h.wf.HIGH,h.wf.LOW]}),this.clusterSizeThreshold=this.int("clusterSizeThreshold",20),this.activityThreshold=this.int("activityThreshold",1e3),this.connectivityColumnName=this.column("connectivity",{nullable:!0})}get model(){return c.i.getInstance(this.dataFrame)}createSCViewer(){var t;const e={showXAxis:!0,showYAxis:!0,showXSelector:!1,showYSelector:!1,showColorSelector:!1,xAxisType:a.AxisType.logarithmic,yAxisType:a.AxisType.logarithmic,invertYAxis:this.activityTarget===h.wf.LOW,xColumnName:O.clusterSizeColName,markerType:"circle",markerDefaultSize:10,showSizeSelector:!1};if(null==this.clusterColumnName||null==this.activityColumnName||!this.dataFrame.columns.contains(this.clusterColumnName)||!this.dataFrame.columns.contains(this.activityColumnName))return this.viewerError="Please set valid cluster and activity columns",null;const n=this.dataFrame.columns.byName(this.activityColumnName),i=this.dataFrame.columns.byName(this.clusterColumnName),r=null!=this.connectivityColumnName?this.dataFrame.columns.byName(this.connectivityColumnName):null;if(![a.COLUMN_TYPE.FLOAT,a.COLUMN_TYPE.INT,a.COLUMN_TYPE.BIG_INT,a.COLUMN_TYPE.QNUM].includes(n.type))return this.viewerError="Activity column should be numeric",null;const o=this.dataFrame.columns.getOrCreate(O.clusterSizeColName,a.TYPE.INT,this.dataFrame.rowCount),l={};for(let e=0;e<this.dataFrame.rowCount;e++){const n=i.get(e);null!=n&&"-1"!=n&&(l[n]=(null!==(t=l[n])&&void 0!==t?t:0)+1)}o.init((t=>{var e;return i.isNone(t)?null:null!==(e=l[i.get(t)])&&void 0!==e?e:null})),n.stats.min<=0&&(e.yAxisType=a.AxisType.linear);const u={},c={};for(let t=0;t<this.dataFrame.rowCount;t++){const e=i.get(t);if(null==e||i.isNone(t)||n.isNone(t))continue;const o=n.get(t),s=u[e];if((null==s||null==s||o>n.get(s)&&this.activityTarget===h.wf.HIGH||o<n.get(s)&&this.activityTarget===h.wf.LOW)&&(u[e]=t),r){const n=r.get(t),i=c[e];(null==i||null==i||n>r.get(i))&&(c[e]=t)}}const d=this.dataFrame.columns.getOrCreate(O.maxActivityInClusterColName,a.COLUMN_TYPE.INT,this.dataFrame.rowCount);d.init((t=>i.isNone(t)?0:t===u[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(O.maxConnectivityInClusterColName,a.COLUMN_TYPE.INT,this.dataFrame.rowCount).init((t=>i.isNone(t)?0:t===c[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(O.synSelectionColName,a.TYPE.STRING,this.dataFrame.rowCount).init((t=>{if(i.isNone(t))return null;let e=null;return t===u[i.get(t)]&&(e=O.maxActivityLabel),r&&t===c[i.get(t)]&&(e=e?`${e}, ${O.maxConnectivityLabel}`:O.maxConnectivityLabel),e})),e.xColumnName=O.clusterSizeColName,e.yColumnName=this.activityColumnName,e.filter=this.scFilterQuery,this.viewerError="";const f=a.Viewer.scatterPlot(this.dataFrame,e);this.selectionSubscription&&this.selectionSubscription.unsubscribe(),this.selectionSubscription=f.onDataEvent.pipe((0,M.filter)((t=>"d4-select"==t.type))).subscribe((t=>{var e,n;const r=null!==(n=null===(e=t.bitset)||void 0===e?void 0:e.getSelectedIndexes())&&void 0!==n?n:[],o=this.dataFrame.selection,s=a.BitSet.create(this.dataFrame.rowCount,(t=>1==d.get(t)));s.and(o);for(let t=0;t<r.length;t++){const e=r[t],n=i.get(e);i.isNone(e)||(s.set(e,!0),null!=c[n]&&s.set(c[n],!0))}s.fireChanged();const l=s.getSelectedIndexes();for(const t of l){const e=i.get(t);null!=e&&null!=c[e]&&s.set(c[e],!0)}setTimeout((()=>{this.dataFrame.selection.copyFrom(s,!0),setTimeout((()=>{this.model&&this.model.createAccordion()}),200)}),200)}));const p=()=>{const t=a.BitSet.create(this.dataFrame.rowCount);Object.entries(u).forEach((([e,i])=>{var r;if(null==e||null==i)return;const o=parseInt(e),s=n.get(i),a=null!==(r=l[o])&&void 0!==r?r:l[e];s<this.activityThreshold&&a<this.clusterSizeThreshold||(t.set(i,!0,!1),null!=c[o]&&t.set(c[o],!0,!1))})),t.fireChanged(),this.dataFrame.selection.copyFrom(t,!0)};return this._selsectIcon=s.iconSvg("select-all",(()=>{p()}),"Select 3 Active quadrants"),this._selsectIcon.style.cursor="pointer",this._selsectIcon.style.marginRight="5px",p(),this.linesDrawSubscription&&this.linesDrawSubscription.unsubscribe(),this.linesDrawSubscription=f.onBeforeDrawScene.subscribe((()=>{const t=f.getInfo().canvas.getContext("2d"),e=f.viewport,n=f.worldToScreen(e.x,this.activityThreshold),i=f.worldToScreen(this.clusterSizeThreshold,e.y),r=f.worldToScreen(e.x+e.width,this.activityThreshold),o=f.worldToScreen(this.clusterSizeThreshold,e.y+e.height);t.beginPath(),t.strokeStyle="rgb(0,0,0)",t.lineWidth=1,t.moveTo(n.x,n.y),t.lineTo(r.x,r.y),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),t.stroke(),t.closePath()})),f}onTableAttached(){var t,e,n,i,r,o,s,a,l,u,c,d;super.onTableAttached();const f=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(h.$2.ACTIVITY))&&void 0!==e?e:null===(i=N()(null===(n=this.dataFrame)||void 0===n?void 0:n.columns.numerical).next())||void 0===i?void 0:i.value;null!=f&&(null===(r=this.getProperty(`activity${h.To}`))||void 0===r||r.set(this,f.name));const p=null===(s=N()(null===(o=this.dataFrame)||void 0===o?void 0:o.columns.categorical).next())||void 0===s?void 0:s.value;null!=p&&(null===(a=this.getProperty(`cluster${h.To}`))||void 0===a||a.set(this,p.name));const m=null===(u=N()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===u?void 0:u.value;null!=m&&(null===(c=this.getProperty(`connectivity${h.To}`))||void 0===c||c.set(this,m.name)),this.render(),null===(d=this.dataFrame)||void 0===d||d.onDataChanged.subscribe((()=>{this.render()}))}render(){this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout((()=>{var t,e;if(!this.dataFrame)return;u()(this.root).empty();const n=this.scViewer;if(null==n)return void this.root.appendChild(s.divText(null!==(t=this.viewerError)&&void 0!==t?t:"Error creating scatter plot"));const i=s.div("Cluster Size",{style:{alignSelf:"center",color:"var(--grey-6)",marginBottom:"5px"}}),r=s.div(this.activityTarget===h.wf.HIGH?"Maximum Activity":"Minimum Activity",{style:{color:"var(--grey-6)",alignSelf:"center",textOrientation:"mixed",writingMode:"tb",transform:"rotate(180deg)",marginLeft:"5px"}});n.props.colorColumnName=null!==(e=this.colorColumnName)&&void 0!==e?e:null,this.root.appendChild(s.divH([r,s.divV([s.divH([this._titleHost,this._selsectIcon],{style:{alignSelf:"center",lineHeight:"normal",width:"100%"}}),n.root,i],{style:{flexGrow:"1"}})])),n.root.style.width="100%",setTimeout((()=>{n.props.filter=this.scFilterQuery,n.invalidateCanvas()}),100)}),this.renderDebounceTime)}onPropertyChanged(t){super.onPropertyChanged(t),(null==t?void 0:t.name)!==`color${h.To}`&&(this._scViewer=null),this.render()}}O.clusterSizeColName="~cluster.size",O.maxActivityInClusterColName="~max.activity.for.cluster",O.maxConnectivityInClusterColName="~max.connectivity.for.cluster",O.synSelectionColName="Syn Selection",O.maxActivityLabel="Max Activity",O.maxConnectivityLabel="Max Connectivity",n(2935);let L,I=null;const R=new a.Package;function P(){return I}function k(){return L}},3657:(t,e,n)=>{"use strict";n.d(e,{Lw:()=>h,eW:()=>p,Ej:()=>d,uz:()=>c});var i=n(6082),r=n(4139);class o{constructor(){const t=navigator.hardwareConcurrency;this._workerCount=Math.max(t-2,1),this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(216),n.b))))}calc(t,e){return n=this,i=arguments,o=function*(t,e,n={}){var i,r,o;const s=new Map;try{const a=null!==(r=null===(i=n.targetCol)||void 0===i?void 0:i.cat.indexOf(n.currentTarget))&&void 0!==r?r:-1,l=t.length,u=new Array(this._workerCount),c=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,c);const h=c/this._workerCount;e.forEach((t=>{var e;t.cat=null===(e=t.cat)||void 0===e?void 0:e.slice()})),(null===(o=n.targetCol)||void 0===o?void 0:o.cat)&&(n.targetCol.cat=n.targetCol.cat.slice());for(let i=0;i<this._workerCount;i++)u[i]=new Promise(((r,o)=>{const s=Math.floor(i*h),l=i===this._workerCount-1?c:Math.floor((i+1)*h);this._workers[i].postMessage({startIdx:s,endIdx:l,activityArray:t,monomerInfoArray:e,settings:n,currentTargetIdx:a}),this._workers[i].onmessage=({data:{pos:t,seq1Idxs:e,seq2Idxs:n,error:s}})=>{var a;s?(null===(a=this._workers[i])||void 0===a||a.terminate(),o(s)):(this._workers[i].terminate(),r({pos:t,seq1Idxs:e,seq2Idxs:n}))}}));const d=yield Promise.all(u),f=new Map;e.forEach(((t,e)=>{f.set(t.name,e)})),d.filter(Boolean).forEach((t=>{for(let n=0;n<t.pos.length;n++){const i=f.get(t.pos[n]),r=e[i].rawData[t.seq1Idxs[n]],o=e[i].cat[r],a=e[i].rawData[t.seq2Idxs[n]],l=e[i].cat[a];s.has(o)||s.set(o,new Map),s.has(l)||s.set(l,new Map);const u=s.get(o),c=s.get(l);u.has(t.pos[n])||u.set(t.pos[n],new Map),c.has(t.pos[n])||c.set(t.pos[n],new Map);const h=u.get(t.pos[n]),d=c.get(t.pos[n]);h.has(t.seq1Idxs[n])||h.set(t.seq1Idxs[n],[]),d.has(t.seq2Idxs[n])||d.set(t.seq2Idxs[n],[]);const p=h.get(t.seq1Idxs[n]),m=d.get(t.seq2Idxs[n]);p.push(t.seq2Idxs[n]),m.push(t.seq1Idxs[n])}}))}catch(t){this.terminate(),console.error(t)}return s},new((r=void 0)||(r=Promise))((function(t,e){function s(t){try{l(o.next(t))}catch(t){e(t)}}function a(t){try{l(o.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}l((o=o.apply(n,i||[])).next())}));var n,i,r,o}terminate(){var t;null===(t=this._workers)||void 0===t||t.forEach((t=>{try{null==t||t.terminate()}catch(t){console.error(t)}}))}}var s=n(5480),a=n(8774),l=n(5070),u=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function c(t,e){return u(this,arguments,void 0,(function*(t,e,n={}){var i,s;if(0===e.length)throw new Error(`PepAlgorithmError: Couldn't find any column of semType '${r.uF.MONOMER}'`);null!==(i=n.minActivityDelta)&&void 0!==i||(n.minActivityDelta=0),null!==(s=n.maxMutations)&&void 0!==s||(n.maxMutations=1);const a=new o,l=yield a.calc(t,e,n);return a.terminate(),l}))}function h(t,e){const n=new Map;let i=999999,r=-999999,o=2,s=2;for(const u of t.keys()){const c=new Map;n.set(u,c);const h=t.get(u);for(const t of h.keys()){const n=h.get(t),u=new a.A(e.length,!1);if(0===n.size)continue;for(const t of n.keys())u.setFast(t,!0),n.get(t).forEach((t=>u.setFast(t,!0)));const d=(0,l.GT)(e,u);i=Math.min(i,d.meanDifference),r=Math.max(r,d.meanDifference),o=Math.min(o,d.count),s=Math.max(s,d.count),c.set(t,d)}}return{stats:n,minDiff:i,maxDiff:r,minCount:o,maxCount:s}}function d(t,e,n,r={}){var o,s,u,c,h,d;null!==(o=r.isFiltered)&&void 0!==o||(r.isFiltered=!1);const p={general:{}};let m=t.getRawData(),g=t.length;if(r.isFiltered){g=e.trueCount;const t=new Float64Array(g),o=e.getSelectedIndexes();for(let e=0;e<g;++e)t[e]=m[o[e]];m=t,n=i.DataFrame.fromColumns(n).clone(e).columns.toList(),r.target&&(r.target.col=r.target.col.clone(e)),r.aggValue&&(r.aggValue.col=r.aggValue.col.clone(e))}null!==(s=r.columns)&&void 0!==s||(r.columns=n.map((t=>t.name)));const v=null===(c=null===(u=r.target)||void 0===u?void 0:u.col)||void 0===c?void 0:c.getRawData(),y=null===(h=r.target)||void 0===h?void 0:h.col.categories,C=(null===(d=r.target)||void 0===d?void 0:d.cat)?null==y?void 0:y.indexOf(r.target.cat):-1;for(const t of n){if(!r.columns.includes(t.name))continue;const e=t.getRawData(),n=t.categories,i={general:{}};for(let t=0;t<n.length;++t){const o=n[t];if(""===o)continue;const s=new Array(g).fill(!1);for(let n=0;n<g;++n)e[n]!==t||v&&-1!==C&&v[n]!==C||(s[n]=!0);const u=a.A.fromValues(s);if(u.allFalse)continue;const c=(0,l.GT)(m,u,r.aggValue);i[o]=c,f(i.general,c)}p[t.name]=i,f(p.general,null,i.general)}return p}function f(t,e=null,n=null){var i,r,o,s,a,l,u,c,h,d,f,p,m,g,v,y,C;if(null===e&&null===n)throw new Error("MonomerPositionStatsError: either stats or summaryStats must be present");const w=null!==(i=null==e?void 0:e.count)&&void 0!==i?i:n.maxCount;null!==(r=t.maxCount)&&void 0!==r||(t.maxCount=w),t.maxCount<w&&(t.maxCount=w);const b=null!==(o=null==e?void 0:e.count)&&void 0!==o?o:n.minCount;null!==(s=t.minCount)&&void 0!==s||(t.minCount=b),t.minCount>b&&(t.minCount=b);const A=null!==(a=null==e?void 0:e.meanDifference)&&void 0!==a?a:n.maxMeanDifference;null!==(l=t.maxMeanDifference)&&void 0!==l||(t.maxMeanDifference=A),t.maxMeanDifference<A&&(t.maxMeanDifference=A);const E=null!==(u=null==e?void 0:e.meanDifference)&&void 0!==u?u:n.minMeanDifference;if(null!==(c=t.minMeanDifference)&&void 0!==c||(t.minMeanDifference=E),t.minMeanDifference>E&&(t.minMeanDifference=E),!isNaN(null!==(h=null==e?void 0:e.pValue)&&void 0!==h?h:NaN)){const i=null!==(d=null==e?void 0:e.pValue)&&void 0!==d?d:n.maxPValue;null!==(f=t.maxPValue)&&void 0!==f||(t.maxPValue=i),t.maxPValue<i&&(t.maxPValue=i);const r=null!==(p=null==e?void 0:e.pValue)&&void 0!==p?p:n.minPValue;null!==(m=t.minPValue)&&void 0!==m||(t.minPValue=r),t.minPValue>r&&(t.minPValue=r)}const S=null!==(g=null==e?void 0:e.ratio)&&void 0!==g?g:n.maxRatio;null!==(v=t.maxRatio)&&void 0!==v||(t.maxRatio=S),t.maxRatio<S&&(t.maxRatio=S);const T=null!==(y=null==e?void 0:e.ratio)&&void 0!==y?y:n.minRatio;null!==(C=t.minRatio)&&void 0!==C||(t.minRatio=T),t.minRatio>T&&(t.minRatio=T)}function p(t,e,n,i){const r=t.rowCount,o=t.getCol(e),u=o.getRawData(),c=o.categories,h=Array.from({length:c.length},(()=>new a.A(r,!1)));for(let t=0;t<r;++t)h[u[t]].setTrue(t);const d=n.map((t=>a.A.fromUint32Array(r,t.getRawData()))),f=n.map((t=>t.name)),p=i.getRawData(),m={},g={};for(const t of Object.values(s.W)){const e=t===s.W.ORIGINAL?h:d,n=t===s.W.ORIGINAL?c:f,r=t===s.W.ORIGINAL?m:g;for(let t=0;t<e.length;++t){const o=e[t];r[n[t]]=o.allTrue||o.allFalse?{count:o.length,meanDifference:0,ratio:1,pValue:null,mask:o,mean:i.stats.avg}:(0,l.GT)(p,o)}}const v={};return v[s.W.ORIGINAL]=m,v[s.W.CUSTOM]=g,v}},2935:(t,e,n)=>{"use strict";n.d(e,{X5:()=>m,rW:()=>y,k8:()=>C,Yd:()=>v,rI:()=>g,FZ:()=>w});var i,r,o,s=n(7389),a=n(6082),l=n(4139),u=n(2003),c=n(3657),h=n(1858),d=n(912),f=n(5480),p=n(3541);function m(t,e){t.strokeStyle=a.Color.toHtml(a.Color.selectedRows),t.lineWidth=3,t.strokeRect(e.x+1,e.y+1,e.width-1,e.height-1)}function g(t,e,n){t.semType=l.uF.MONOMER,t.setTag(a.TAGS.CELL_RENDERER,l.uF.MONOMER),t.setTag(l.gp.ALPHABET,e),n&&t.setTag(r.applyToBackground,"true")}function v(t,e,n,i,r){var o,s,l,u,c,h,d;const f=r.width/2,g=Math.ceil(r.x+1+f),v=Math.ceil(r.y+1+r.height/2),y=.9*f/2;if(i instanceof p.UJ){const r=i.monomerPositionStats[n],o=r[e].pValue,s=r[e].meanDifference,l=1-r.general.maxPValue,u=1-r.general.minPValue,c=Math.min(l,u),h=l-c,d=u-c,p=Math.max(h,d),m=null===o?0:1-o-c,C=s>=0?m:-m,w=a.Color.toHtml(null===o?a.Color.lightLightGray:a.Color.scaleColor(C,-p,p,255)),b=Math.max(Math.abs(i.monomerPositionStats.general.minMeanDifference),i.monomerPositionStats.general.maxMeanDifference),A=Math.abs(s)/b,E=Math.floor(y*A);t.beginPath(),t.fillStyle=w,t.arc(g-f/2,v,E<3||null===o?3:E,0,2*Math.PI,!0),t.closePath(),t.fill()}else if(i instanceof p.J&&i.mutationCliffs&&i.cliffStats){const r=i.cliffStats.maxCount,u=i.cliffStats.minDiff,c=i.cliffStats.maxDiff,h=null===(l=null===(s=null===(o=i.cliffStats)||void 0===o?void 0:o.stats)||void 0===s?void 0:s.get(e))||void 0===l?void 0:l.get(n);if(h){const e=h.count,n=h.meanDifference,i=Math.floor(Math.abs(e/Math.max(r,2))*y),o=Math.max(Math.abs(u),Math.abs(c)),s=a.Color.toHtml(null===n?a.Color.lightLightGray:a.Color.scaleColor(n,-o,o,255));t.beginPath(),t.fillStyle=s,t.arc(g-f/2,v,i<3||0==e?3:i,0,2*Math.PI,!0),t.closePath(),t.fill()}}t.textBaseline="middle",t.textAlign="end",t.fillStyle="#606060",t.font="13px Roboto, Roboto Local, sans-serif",t.shadowBlur=5,t.shadowColor=a.Color.toHtml(a.Color.white);const C=new Set,w=null!==(d=null===(h=null===(c=null===(u=i.mutationCliffs)||void 0===u?void 0:u.get(e))||void 0===c?void 0:c.get(n))||void 0===h?void 0:h.entries())&&void 0!==d?d:null;if(null!==w)for(const[t,e]of w){C.add(t);for(const t of e)C.add(t)}0!==C.size&&t.fillText(C.size.toString(),g+f-5,v,f-5);const b=i.mutationCliffsSelection[n];b&&b.includes(e)&&m(t,r)}function y(t,e,n,i,r,o,s){s=a.Color.fromHtml(a.Color.toHtml(function(t,e){return(16777215&t|255<<24)>>>0}(s)));let l=r.toFixed(2);l.endsWith(".00")&&(l=r.toFixed(0)),l.endsWith("0")&&l.includes(".")&&(l=r.toFixed(1));const u=Math.min(13,Math.floor(o.width/40/l.length*6*13));t.fillStyle=a.Color.toHtml(s),t.fillRect(o.x,o.y,o.width,o.height),t.font=`${u}px Roboto, Roboto Local, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=a.Color.toHtml(a.Color.getContrastColor(s)),t.fillText(l,o.x+o.width/2,o.y+o.height/2,o.width);const c=i[n];c&&c.includes(e)&&m(t,o)}function C(t,e,n,i){t.font="13px Roboto, Roboto Local, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillStyle="#000",t.fillText(e.toString(),i.x+i.width/2,i.y+i.height/2,i.width),(n[f.W.CUSTOM].includes(e)||n[f.W.ORIGINAL].includes(e))&&m(t,i)}function w(t,e,n,i,r,o={x:0,y:0,mpStats:{},monomerPosition:{}}){var f;if(null!==(f=r.isSelectionTable)&&void 0!==f||(r.isSelectionTable=!1),0==Object.keys(o.mpStats).length&&(o.mpStats=e),r.isSelectionTable&&(!r.webLogoBounds||!r.cachedWebLogoTooltip))throw new Error("Peptides: Cannot set WebLogo renderer for selection table without `headerSelectedMonomers`, `webLogoBounds` and `cachedWebLogoTooltip` options.");const p=t.dataFrame;t.setOptions({colHeaderHeight:130});t.onCellRender.subscribe((t=>(t=>{var o;const s=t.g,h=t.bounds,d=t.cell.tableColumn;s.save();try{if(s.beginPath(),s.rect(h.x,h.y,h.width,h.height),s.clip(),t.cell.isColHeader&&(null==d?void 0:d.semType)===l.uF.MONOMER){let f;if(p.filter.anyFalse){const t=null!==(o=p.temp[l.gp.M_P_STATS_CACHE])&&void 0!==o?o:{},e=null==t?void 0:t[d.name],r=p.filter.getBuffer();if(t&&e&&e.filter.length===r.length&&e.filter.every(((t,e)=>t===r[e])))f=e.stats[d.name];else{const e=(0,c.Ej)(i,p.filter,n,{isFiltered:!0,columns:[d.name]});f=e[d.name],t[d.name]={filter:p.filter.getBuffer(),stats:e,selection:p.selection.getBuffer()}}p.temp[l.gp.M_P_STATS_CACHE]=t}else f=r.isSelectionTable?(0,c.Ej)(i,p.filter,n,{isFiltered:!0,columns:[d.name]})[d.name]:e[d.name];if(!f)return;const m=Object.keys(f).sort(((t,e)=>""===t||"-"===t?1:""===e||"-"===e?-1:0)).filter((t=>"general"!==t));r.webLogoBounds()[d.name]=function(t,e,n,i,r,o,s,l={},c={}){var h,d,f,p,m,g,v,y,C,w;const b=window.devicePixelRatio;null!==(h=c.symbolStyle)&&void 0!==h||(c.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(d=c.upperLetterHeight)&&void 0!==d||(c.upperLetterHeight=12.2),null!==(f=c.upperLetterAscent)&&void 0!==f||(c.upperLetterAscent=.25),null!==(p=c.marginVertical)&&void 0!==p||(c.marginVertical=1),null!==(m=c.marginHorizontal)&&void 0!==m||(c.marginHorizontal=1),null!==(g=c.selectionWidth)&&void 0!==g||(c.selectionWidth=2),null!==(v=c.textHeight)&&void 0!==v||(c.textHeight=13),null!==(y=c.headerStyle)&&void 0!==y||(c.headerStyle=`bold ${c.textHeight*b}px Roboto, Roboto Local, sans-serif`);const A=(r.length-1)*c.upperLetterAscent;let E=(e.y+c.marginVertical)*b;const S=(e.height-2*c.marginVertical-A-1.25*c.textHeight)*b,T=(e.x+c.marginHorizontal)*b,x=Math.max(c.selectionWidth*b,.05*e.width*b),_=2*c.marginHorizontal+c.selectionWidth,N=(e.width-(_+c.marginHorizontal))*b,M=(e.x+_)*b,O={};for(const e of r){const i=S*(n[e].count/o),r=S*((null!==(C=l[e])&&void 0!==C?C:0)/o);if(O[e]=new a.Rect(M/b,E/b,N/b,i/b),t.resetTransform(),"-"!==e&&""!==e){const n=(0,u.zS)(e,5),o=t.measureText(n);r>0&&(t.lineWidth=x,t.line(T,E,T,E+r,a.Color.rowSelection)),t.fillStyle=null!==(w=s.get(e))&&void 0!==w?w:s.get("other"),t.textAlign="left",t.textBaseline="top",t.font=c.symbolStyle;const l=N/o.width,h=i/c.upperLetterHeight;t.setTransform(l,0,0,h,M,E),t.fillText(n,0,0,o.width)}E+=i+c.upperLetterAscent*b}return t.resetTransform(),t.fillStyle=a.Color.toHtml(a.Color.black),t.textAlign="center",t.textBaseline="top",t.font=c.headerStyle,t.fillText(i,(e.x+e.width/2)*b,(e.y+e.height-c.textHeight)*b),O}(s,h,f,d.name,m,p.filter.trueCount,r.colorPalette(),r.headerSelectedMonomers?r.headerSelectedMonomers()[d.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${d.name}\`. See original error below.`),console.warn(t)}finally{s.restore()}})(t)));const m=n=>{var a;const u=t.hitTest(n.offsetX,n.offsetY);if((null==u?void 0:u.isColHeader)&&(null===(a=u.tableColumn)||void 0===a?void 0:a.semType)===l.uF.MONOMER){const t=function(t,e,n){const i=n[t.tableColumn.name];if(!i)return null;for(const[n,r]of Object.entries(i)){const i=e.offsetX>=r.x&&e.offsetX<=r.x+r.width,o=e.offsetY>=r.y&&e.offsetY<=r.y+r.height;if(i&&o)return{monomerOrCluster:n,positionOrClusterType:t.tableColumn.name}}return null}(u,n,r.webLogoBounds());if(null===t)return void(r.isSelectionTable||null==r.unhighlightCallback||r.unhighlightCallback());o.monomerPosition=t,function(t,e,n,i,r,o){if("click"!==t.type||r.isSelectionTable||null==r.selectionCallback){const a=`${e.positionOrClusterType} = ${e.monomerOrCluster}`;r.cachedWebLogoTooltip().bar===a?s.tooltip.show(r.cachedWebLogoTooltip().tooltip,t.clientX,t.clientY):(r.cachedWebLogoTooltip().bar=a,o.x=t.clientX,o.y=t.clientY,o.monomerPosition=e,r.cachedWebLogoTooltip().tooltip=(0,d.YE)(n,i,[],o))}else r.selectionCallback(e,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey})}(n,t,p,i,r,o),r.isSelectionTable||null==r.highlightCallback||r.highlightCallback(t,p,e)}};h.fromEvent(t.overlay,"mousemove").subscribe((t=>m(t))),h.fromEvent(t.overlay,"click").subscribe((t=>m(t)))}n(9634),function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(i||(i={})),function(t){t.applyToBackground=".m.cellRenderer.applyToBackground"}(r||(r={})),function(t){t.MSA="MSA",t.classic="classic"}(o||(o={})),new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=1,this.separator="",this.last=!1,this.drawStyle=o.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0}},a.GridCellRenderer},4139:(t,e,n)=>{"use strict";n.d(e,{$2:()=>i,To:()=>l,V5:()=>d,YX:()=>h,gp:()=>o,i6:()=>r,rg:()=>u,uF:()=>s,wf:()=>c,zW:()=>f});var i,r,o,s,a=n(6082);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="Activity",t.ACTIVITY_SCALED="Scaled activity",t.MONOMER="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference",t.COUNT="Count",t.RATIO="Ratio",t.MEAN="Mean"}(i||(i={})),function(t){t.MEMBERS="Members",t.WEB_LOGO="WebLogo",t.DISTRIBUTION="Distribution",t.MEAN_DIFFERENCE="Mean difference",t.P_VALUE="P-Value",t.RATIO="Ratio",t.CLUSTER="Cluster"}(r||(r={})),function(t){t.MONOMER="monomer",t.POSITION="pos",t.SEPARATOR="separator",t.SELECTION="selection",t.MUTATION_CLIFFS_SELECTION="mutationCliffsSelection",t.ALPHABET="alphabet",t.FILTER="filter",t.INVARIANT_MAP_SELECTION="invariantMapSelection",t.SAR_MODE="sarMode",t.CLUSTER_SELECTION="clusterSelection",t.VISIBLE="visible",t.SETTINGS="settings",t.CUSTOM_CLUSTER="customCluster",t.MONOMER_POSITION_MODE="monomerPositionMode",t.MULTIPLE_VIEWS="isMultipleViews",t.IDENTITY_TEMPLATE="Identity template",t.SIMILARITY_TEMPLATE="Similarity template",t.ANALYSIS_COL="isAnalysisCol",t.POSITION_COL="isPositionCol",t.M_P_STATS_CACHE=".MPStatsCache",t.INVARIANT_MAP_COLOR_CACHE=".InvariantMapColorCache",t.INVARIANT_MAP_COLOR_MAX_CACHE=".InvariantMapColorMaxCache",t.INVARIANT_MAP_COLOR_MIN_CACHE=".InvariantMapColorMinCache"}(o||(o={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference"}(s||(s={}));const l="ColumnName";var u,c,h;!function(t){t.NONE="none",t.LG="lg",t.MINUS_LG="-lg"}(u||(u={})),function(t){t.HIGH="High",t.LOW="Low"}(c||(c={})),function(t){t.LST="lst-",t.MP="mp-",t.MPR="mpr-",t.WL="wl-"}(h||(h={}));const d=Object.values(a.AGG).filter((t=>![a.AGG.FIRST,a.AGG.KEY,a.AGG.PIVOT,a.AGG.SELECTED_ROWS_COUNT].includes(t))),f={[a.AGG.TOTAL_COUNT]:"totalCount",[a.AGG.VALUE_COUNT]:"valueCount",[a.AGG.UNIQUE_COUNT]:"uniqueCount",[a.AGG.MISSING_VALUE_COUNT]:"missingValueCount",[a.AGG.MIN]:"min",[a.AGG.MAX]:"max",[a.AGG.SUM]:"sum",[a.AGG.MED]:"med",[a.AGG.AVG]:"avg",[a.AGG.STDEV]:"stdev",[a.AGG.VARIANCE]:"variance",[a.AGG.SKEW]:"skew",[a.AGG.KURT]:"kurt",[a.AGG.Q1]:"q1",[a.AGG.Q2]:"q2",[a.AGG.Q3]:"q3"}},8608:(t,e,n)=>{"use strict";n.d(e,{$s:()=>T,AN:()=>i,AY:()=>h,B2:()=>N,BE:()=>y,CD:()=>w,F2:()=>m,FZ:()=>g,KT:()=>S,Y1:()=>d,ZR:()=>E,dl:()=>A,eY:()=>p,qI:()=>x,qx:()=>f,sg:()=>M,vW:()=>b,vY:()=>C,zm:()=>_,zz:()=>v});var i,r=n(7389),o=n(6082),s=n(4139),a=n(8774),l=n(144),u=n.n(l),c=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function h(t){var e;return null!==(e=t.getTag(s.gp.SEPARATOR))&&void 0!==e?e:""}function d(t,e=s.rg.NONE){let n=t=>t;switch(e){case s.rg.NONE:break;case s.rg.LG:n=t=>Math.log10(t);break;case s.rg.MINUS_LG:n=t=>-Math.log10(t);break;default:throw new Error(`ScalingError: method \`${e}\` is not available.`)}const i=t.getRawData(),r=o.Column.float(s.$2.ACTIVITY,t.length).init((t=>{const e=i[t];return e===o.FLOAT_NULL||e===o.INT_NULL?e:n(e)}));return r.setTag(s.gp.ANALYSIS_COL,"true"),r.setTag(o.TAGS.FORMULA,e),r}function f(t){var e,n,i,r;const o=t.columns.bySemTypeAll(s.uF.MONOMER),a={},l=t.filter.clone().and(t.selection).getSelectedIndexes();for(const t of l)for(const s of o){const o=s.get(t);o&&(null!==(e=a[i=s.name])&&void 0!==e||(a[i]={}),null!==(n=(r=a[s.name])[o])&&void 0!==n||(r[o]=0),a[s.name][o]+=1)}return a}function p(t){return{name:t.name,cat:t.categories,rawData:t.getRawData()}}function m(t,e,n={}){var a;const l=t.dataFrame.getCol(s.$2.SPLIT_COL),u=[],c=l.categories,h=l.getRawData();for(let t=0;t<c.length;++t){if(!Object.values(i).includes(c[t]))continue;const e=o.Color.toHtml(l.meta.colors.getColor(h.indexOf(t))),s=r.label(null!==(a=n[c[t]])&&void 0!==a?a:c[t],{style:{color:e}});u.push(s)}const d=r.divV([r.divV(u),t.root,r.tableFromMap(e)]);return t.root.style.maxHeight="75px",d}function g(t,e,n){var r,a;const l=null!==(r=null==n?void 0:n.clone().xor(e).anyTrue)&&void 0!==r&&r,u=t.length,c=t.getRawData(),h=new Float32Array(u+e.trueCount+(l&&null!==(a=null==n?void 0:n.trueCount)&&void 0!==a?a:0)),d=new Array(h.length);for(let t=0,r=0,o=0;t<u;++t){const s=e.get(t);h[t]=c[t],d[t]=s?i.SELECTION:i.ALL,s&&(h[u+r]=c[t],d[u+r]=i.ALL,++r),l&&(null==n?void 0:n.get(t))&&(h[u+e.trueCount+o]=c[t],d[u+e.trueCount+o]=i.PEPTIDES_SELECTION,++o)}const f=o.Column.fromStrings(s.$2.SPLIT_COL,d),p=[i.ALL,i.SELECTION];return l&&p.push(i.PEPTIDES_SELECTION),f.setCategoryOrder(p),f.meta.colors.setCategorical(),o.DataFrame.fromColumns([o.Column.fromFloat32Array(s.$2.ACTIVITY,h),f])}function v(t){const e=r.iconFA("expand-alt",(()=>{const e=t.dataFrame.plot.grid();C(e,!1),e.root.style.height="100%";const n=r.dialog(t.dataFrame.name);n.add(e.root),n.showModal(!0),e.invalidate()}));t.root.appendChild(e),e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.visibility="hidden",t.root.addEventListener("mouseenter",(t=>{e.style.visibility="visible"})),t.root.addEventListener("mouseleave",(t=>{e.style.visibility="hidden"}))}function y(t,e,n,i){const o=r.iconFA("expand-alt",(()=>{const e=i(),n=r.dialog(t);n.add(e),n.showModal(!0)}),"Expand to full screen");o.style.marginLeft="auto",o.style.marginRight="15px",n.addEventListener("mouseenter",(()=>{o.style.visibility="visible"})),n.addEventListener("mouseleave",(()=>{o.style.visibility="hidden"})),e.appendChild(o)}function C(t,e=!0){t.props.allowEdit=!1,t.props.showReadOnlyNotifications=!1,t.props.allowRowSelection=!1,t.props.allowBlockSelection=!1,t.props.allowColSelection=!1,t.props.showRowHeader=!1,t.props.showCurrentRowIndicator=!1,t.root.style.width="100%",t.root.style.maxWidth="100%",e&&t.autoSize(1e3,175,0,0,!0)}function w(t){for(const e of Object.values(t))if(0!==e.length)return!1;return!0}function b(t,e,n){const i=t[e.positionOrClusterType],r=i.indexOf(e.monomerOrCluster);if(n.shiftPressed&&n.ctrlPressed)-1!==r&&i.splice(r,1);else if(n.ctrlPressed)-1===r?i.push(e.monomerOrCluster):i.splice(r,1);else if(n.shiftPressed)-1===r&&i.push(e.monomerOrCluster);else{const n=Object.keys(t);t={};for(const i of n)t[i]=[],i===e.positionOrClusterType&&t[i].push(e.monomerOrCluster)}return t}function A(t,e,n){if(!e)return;const i=new a.A(e.rowCount);if(t.positionOrClusterType===s.$2.MONOMER){const e=Object.values(n);for(const n of e){const e=n[t.monomerOrCluster];void 0!==e&&i.or(e.mask)}}else{const e=n[t.positionOrClusterType];if(void 0!==e){const n=e[t.monomerOrCluster];void 0!==n&&i.or(n.mask)}}e.rows.highlight((t=>i.getBit(t)))}function E(t){const e={};for(const n of t)e[n.name]=[];return e}function S(t,e){let n=null;const i=Object.entries(t);for(const[t,r]of i){const i=e[t];for(const t of r){const e=i[t];e&&(null!=n||(n=new a.A(e.mask.length,!1)),n.or(e.mask))}}return null!=n?o.BitSet.fromBytes(n.buffer.buffer,n.length):null}function T(t,e){return t.sequenceColumnName===e.sequenceColumnName&&t.activityColumnName===e.activityColumnName&&t.activityScaling===e.activityScaling}function x(t,e){var n;const i={};for(const[r,o]of t)for(const[t,s]of o){null!==(n=i[t])&&void 0!==n||(i[t]={});const o=new a.A(e,!1);for(const[t,e]of s){o.setTrue(t);for(const t of e)o.setTrue(t)}i[t][r]={mask:o}}return i}function _(t,e,n,i){const r=Object.entries(n),o=i?Object.entries(i).filter((t=>!e.includes(t[0])||n[t[0]]!==t[1])):[];return r.concat(o).filter((e=>t.columns.contains(e[0])&&t.col(e[0]).matches("numerical")))}function N(t,e=2){return t.columns.bySemTypeAll(o.SEMTYPE.MACROMOLECULE).length>0&&u()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function M(t,e=500){let n;return(...i)=>c(this,void 0,void 0,(function*(){return new Promise((r=>{clearTimeout(n),n=setTimeout((()=>r(t(...i))),e)}))}))}!function(t){t.SELECTION="Selection",t.ALL="All",t.PEPTIDES_SELECTION="Peptides selection"}(i||(i={}))},5070:(t,e,n)=>{"use strict";n.d(e,{hX:()=>s,I_:()=>u,m2:()=>c,lh:()=>l,GT:()=>a,J1:()=>h});var i=n(6082),r=n(6572),o=n(4139);const s=(t,e)=>`${t}(${e})`;function a(t,e,n){var o;if(t.length!==e.length&&t.some(((t,n)=>n>=e.length&&0!==t)))throw new Error("PeptidesError: Data and bit array have different lengths");const s=new Float32Array(e.trueCount()),a=new Float32Array(e.falseCount());let l;if(n)try{l=null===(o=i.DataFrame.fromColumns([n.col]).clone(i.BitSet.fromBytes(e.buffer.buffer,e.length)).col(n.col.name))||void 0===o?void 0:o.aggregate(n.type)}catch(t){console.error(t)}let u=0,c=0;for(let n=0;n<e.length;++n)e.getBit(n)?s[u++]=t[n]:a[c++]=t[n];const h=s.reduce(((t,e)=>t+e),0)/Math.max(s.length,1);if(s.length<2||a.length<2){const t=a.reduce(((t,e)=>t+e),0)/Math.max(a.length,1);return{count:s.length,pValue:null,mean:h,meanDifference:h-t,ratio:s.length/e.length,mask:e,aggValue:l}}const d=function(t,e,n=!1,i=!1){if(t.length<=1||e.length<=1)throw new Error(`StatisticsError: Wrong sample size; expected at least 2, got ${Math.min(t.length,e.length)})`);const o=r.mean(t),s=r.mean(e),a=r.variance(t),l=r.variance(e),u=t.length,c=e.length;let h,d,f;if(n){const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e);d=r.normal.pdf(n,0,1),h=1-d,f=2*(d<h?d:h)}else if(i){const t=u+c-2,e=(a*(u-1)+l*(c-1))/t,n=Math.sqrt(u*c/(u+c))*(o-s)/e;h=1-r.studentt.cdf(n,t),d=r.studentt.cdf(n,t),f=2*(d<h?d:h)}else{const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(u-1)+Math.pow(e,2)/(c-1));d=r.studentt.cdf(n,i),h=1-d,f=2*(d<h?d:h)}return{"p-value":f,"Mean difference":o-s,"p-value more":h,"p-value less":d}}(s,a),f=d["Mean difference"];return{count:s.length,pValue:d[f>=0?"p-value more":"p-value less"],mean:h,meanDifference:f,ratio:s.length/e.length,mask:e,aggValue:l}}function l(t,e,n){const r=o.zW[e],s=i.Stats.fromColumn(t,n);if(!(r in s))throw new Error(`Aggregation type ${r} is not supported`);return s[r]}function u(t,e,n={}){var i,r;null!==(i=n.filterDf)&&void 0!==i||(n.filterDf=!1),null!==(r=n.fractionDigits)&&void 0!==r||(n.fractionDigits=3);const o=n.filterDf&&t.filter.anyFalse?t.clone(t.filter):t,a={};for(const[t,i]of e){const e=s(i,t),r=l(o.getCol(t),i,n.mask);a[e]=r.toFixed(n.fractionDigits)}return a}function c(t,e,n,i){var r;null!==(r=i.fractionDigits)&&void 0!==r||(i.fractionDigits=3);const o={};for(const[r,a]of n){const n=s(a,r),l=t.get(n,e);o[n]=l.toFixed(i.fractionDigits)}return o}function h(t,e,n){var r;const o=t.col(e.substring(5,e.length-1));if(!o||!o.matches("categorical"))return"{}";null!=n||(n=i.BitSet.create(t.rowCount,(()=>!0)));const s=o.getRawData(),a=new Map;for(let t=-1;-1!==(t=n.findNext(t,!0));)a.set(s[t],(null!==(r=a.get(s[t]))&&void 0!==r?r:0)+1);const l={};for(const[t,e]of a)l[o.categories[t]]=e;return JSON.stringify(l)}},912:(t,e,n)=>{"use strict";n.d(e,{DK:()=>d,YE:()=>f,cr:()=>h});var i=n(7389),r=n(4328),o=n(6082),s=n(4139),a=n(7654),l=n(8608),u=n(3273),c=n(5070);function h(t,e,n){const o=[],s=t.toLowerCase(),a=(0,u.getMonomerWorksInstance)(),l=null==a?void 0:a.getCappedRotatedMonomer("PEPTIDE",t);if(l){o.push(i.div(s));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};o.push(r.chem.svgMol(l,void 0,void 0,t))}else{if(""===t)return!0;o.push(i.div(t))}return i.tooltip.show(i.divV(o),e,n),!0}function d(t,e,n,i){var r,o,a;return null!==(r=i.fromViewer)&&void 0!==r||(i.fromViewer=!1),null!==(o=i.isMutationCliffs)&&void 0!==o||(i.isMutationCliffs=!1),null!==(a=i.isMostPotentResidues)&&void 0!==a||(i.isMostPotentResidues=!1),i.monomerPosition.positionOrClusterType===s.$2.MONOMER?h(i.monomerPosition.monomerOrCluster,i.x,i.y):f(t,e,n,i),!0}function f(t,e,n,r){var s,u,h,d,f,p,m;if(null!==(s=r.fromViewer)&&void 0!==s||(r.fromViewer=!1),null!==(u=r.isMutationCliffs)&&void 0!==u||(r.isMutationCliffs=!1),null!==(h=r.isMostPotentResidues)&&void 0!==h||(r.isMostPotentResidues=!1),r.cliffStats&&r.isMutationCliffs){const s=null===(p=null===(f=r.cliffStats)||void 0===f?void 0:f.get(r.monomerPosition.monomerOrCluster))||void 0===p?void 0:p.get(r.monomerPosition.positionOrClusterType);if(!s)return null;const u=o.BitSet.fromBytes(s.mask.buffer.buffer,e.length),h=(0,a.M1)((0,l.FZ)(e,u),!0),d=(0,a.QD)(s);r.fromViewer&&(d["Mean difference"]=`${d["Mean difference"]} (Color)`,d.Count&&(d.Count=`${d.Count} (Size)`));const g=null!==(m=r.aggrColValues)&&void 0!==m?m:(0,c.I_)(t,n,{mask:u}),v=Object.assign(Object.assign({},d),g),y=(0,l.F2)(h,v);return i.tooltip.show(y,r.x,r.y),y}{const s=r.mpStats[r.monomerPosition.positionOrClusterType][r.monomerPosition.monomerOrCluster];if(!(null==s?void 0:s.count))return null;const u=o.BitSet.fromBytes(s.mask.buffer.buffer,e.length),h=(0,a.M1)((0,l.FZ)(e,u),!0),f=(0,a.QD)(s);r.fromViewer&&(f["Mean difference"]=`${f["Mean difference"]}${r.isMostPotentResidues?" (size)":""}`,f["p-value"]&&(f["p-value"]=`${f["p-value"]}${r.isMostPotentResidues?" (color)":""}`));const p=null!==(d=r.aggrColValues)&&void 0!==d?d:(0,c.I_)(t,n,{mask:u}),m=Object.assign(Object.assign({},f),p),g=(0,l.F2)(h,m);return i.tooltip.show(g,r.x,r.y),g}}},115:(t,e,n)=>{"use strict";n.d(e,{GI:()=>a,Ku:()=>o,av:()=>s});var i=n(4572),r=n(4329);const o="WebGPU is not supported on this device";class s{constructor(){this.maxIterations=16,this.inflation=1.4,this.threshold=70,this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.fingerprintType="Morgan",this.useWebGPU=!1,this.minClusterSize=5,this.webGPUDescription=o,this.webGPUDescriptionPromise=(0,r._)().then((t=>{t&&(this.webGPUDescription=t)}))}}class a{constructor(t){this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.clusterEmbeddings=!0,this.epsilon=.01,this.minPts=4,this.fingerprintType="Morgan",this.clusterEmbeddings=!!t}}},5480:(t,e,n)=>{"use strict";n.d(e,{W:()=>A,s:()=>S});var i=n(7389),r=n(4328),o=n(6082),s=n(7233),a=n.n(s),l=n(9484),u=n(4139),c=n(2935),h=n(4326),d=n(5070),f=n(144),p=n.n(f),m=n(7654),g=n(8608),v=n(8774),y=n(3273),C=n(3657),w=n(3077);const b=(t,e)=>`${t}(${e})`;var A,E;!function(t){t.ORIGINAL="original",t.CUSTOM="custom"}(A||(A={})),function(t){t.GENERAL="General",t.STYLE="WebLogo",t.AGGREGATION="Aggregation"}(E||(E={}));class S extends o.JsViewer{constructor(){super(),this._titleHost=i.divText(l.q.LOGO_SUMMARY_TABLE,{id:"pep-viewer-title"}),this.bitsets=[],this.keyPress=!1,this.currentRowIndex=null,this._scaledActivityColumn=null,this._viewerGrid=null,this._clusterStats=null,this._clusterSelection=null,this._logoSummaryTable=null,this._positionColumns=null,this.sequenceColumnName=this.column("sequence",{category:E.GENERAL,nullable:!1}),this.clustersColumnName=this.column("clusters",{category:E.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:E.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",u.rg.NONE,{category:E.GENERAL,choices:Object.values(u.rg)}),this.webLogoMode=this.string("webLogoMode",h.fH.Entropy,{choices:[h.fH.full,h.fH.Entropy],category:E.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:E.STYLE}),this.columns=this.columnList("columns",[],{category:E.AGGREGATION}),this.aggregation=this.string("aggregation",o.AGG.AVG,{category:E.AGGREGATION,choices:u.V5})}get model(){return l.i.getInstance(this.dataFrame)}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createLogoSummaryTableGrid()),this._viewerGrid}get clusterStats(){var t;return null!==(t=this._clusterStats)&&void 0!==t||(this._clusterStats=(0,C.eW)(this.dataFrame,this.clustersColumnName,this.customClusters.toArray(),this.getScaledActivityColumn())),this._clusterStats}get clusterSelection(){var t;const e=this.dataFrame.getTag(u.gp.CLUSTER_SELECTION);return null!==(t=this._clusterSelection)&&void 0!==t||(this._clusterSelection=null===e?this.initClusterSelection({notify:!1}):JSON.parse(e)),this._clusterSelection}set clusterSelection(t){this._clusterSelection=t,this.dataFrame.setTag(u.gp.CLUSTER_SELECTION,JSON.stringify(t)),this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),this.model.analysisView.grid.invalidate()}get logoSummaryTable(){var t;return null!==(t=this._logoSummaryTable)&&void 0!==t||(this._logoSummaryTable=this.createLogoSummaryTable()),this._logoSummaryTable}set logoSummaryTable(t){this._logoSummaryTable=t}get positionColumns(){var t,e,n,i;if(null!=this._positionColumns)return this._positionColumns;const r=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)&&(this._positionColumns=this.model.positionColumns),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(i=null!==(n=r(l.q.SEQUENCE_VARIABILITY_MAP))&&void 0!==n?n:r(l.q.MOST_POTENT_RESIDUES))&&void 0!==i?i:(0,w.R)(this.dataFrame.getCol(this.sequenceColumnName)).columns.toList()),this._positionColumns}get isClusterSelectionEmpty(){return 0===this.clusterSelection[A.ORIGINAL].length+this.clusterSelection[A.CUSTOM].length}get customClusters(){const t={};return t[u.gp.CUSTOM_CLUSTER]="1",p()(this.dataFrame.columns.byTags(t))}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,g.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?o.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.filter).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}onTableAttached(){var t,e,n;if(super.onTableAttached(),(0,g.B2)(this.dataFrame))null===(t=this.getProperty(`sequence${u.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(o.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${u.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`clusters${u.To}`))||void 0===n||n.set(this,p()(this.dataFrame.columns.categorical).next().value.name);else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";r.log.error(t),r.shell.warning(t)}this.render()}detach(){this.subs.forEach((t=>t.unsubscribe()))}render(){if(a()(this.root).empty(),null==this.clustersColumnName||null==this.sequenceColumnName||null==this.activityColumnName)return void this.root.appendChild(i.divText("Please, select a sequence, cluster and activity columns in the viewer properties"));if(!this.logoSummaryTable.filter.anyTrue){const t=i.divText("No clusters to satisfy the threshold. Please, lower the threshold in viewer proeperties to include clusters");return void this.root.appendChild(i.divV([this._titleHost,t]))}const t=i.iconFA("expand-alt",(()=>{const t=i.dialog("Logo Summary Table");t.add(this.viewerGrid.root),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Logo Summary Table in full screen");a()(t).addClass("pep-help-icon"),this.viewerGrid.root.style.width="auto",this.root.appendChild(i.divV([i.divH([this._titleHost,t],{style:{alignSelf:"center",lineHeight:"normal"}}),this.viewerGrid.root])),this.viewerGrid.invalidate()}onPropertyChanged(t){super.onPropertyChanged(t);let e=!1;switch(t.name){case"membersRatioThreshold":this.logoSummaryTable.filter.anyTrue||(e=!0),this.updateFilter();break;case`sequence${u.To}`:this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`clusters${u.To}`:this._clusterStats=null,this._clusterSelection=null,this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`activity${u.To}`:case"activityScaling":this._scaledActivityColumn=null,this._viewerGrid=null,this._clusterStats=null,this._logoSummaryTable=null,e=!0;break;case"columns":case"aggregation":this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case"webLogoMode":this.viewerGrid.invalidate()}e&&this.render()}initClusterSelection(t={}){var e;null!==(e=t.notify)&&void 0!==e||(t.notify=!0);const n={};return n[A.ORIGINAL]=[],n[A.CUSTOM]=[],t.notify?this.clusterSelection=n:this._clusterSelection=n,this.clusterSelection}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,g.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}getStringAggregatedColumns(){return this.columns.filter((t=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("categorical"))).map((t=>`dist(${t})`))}createLogoSummaryTable(){var t,e,n;const i=this.clustersColumnName,r=this.dataFrame.filter.anyFalse,s=r?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,a=s.columns,l=s.rowCount,c=this.getScaledActivityColumn(r).getRawData(),h=s.getCol(i),f=h.getRawData(),m=h.categories,g={};g[u.gp.CUSTOM_CLUSTER]="1";const y=p()(a.byTags(g)).filter((t=>t.max>0)).toArray(),C=o.DataFrame.create(y.length),w=C.columns,E=w.addNewString(u.i6.CLUSTER),S=w.addNewInt(u.i6.MEMBERS).getRawData(),T=w.addNewString(u.i6.WEB_LOGO),x=w.addNewString(u.i6.DISTRIBUTION),_=w.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),N=w.addNewFloat(u.i6.P_VALUE).getRawData(),M=w.addNewFloat(u.i6.RATIO).getRawData();let O=s.groupBy([i]);const L=this.getTotalViewerAggColumns(),I=this.getStringAggregatedColumns(),R=I.map((t=>w.addNewString(t))),P=L.map((([t,e])=>b(e,t))),k=new Array(P.length+I.length),G=L.map((([t,e])=>[s.getCol(t),e]));for(let t=0;t<L.length;++t){const[e,n]=L[t];O=O.add(n,e,P[t]);const i=w.addNewFloat(P[t]);k[t]=i.getRawData()}const D=new Array(y.length);for(let e=0;e<y.length;++e){const n=y[e];E.set(e,n.name);const i=v.A.fromUint32Array(l,n.getRawData());if(i.allFalse)continue;const a=o.BitSet.fromBytes(i.buffer.buffer,l),u=r?(0,d.GT)(c,i):this.clusterStats[A.CUSTOM][n.name];S[e]=u.count,D[e]=a,_[e]=u.meanDifference,N[e]=null!==(t=u.pValue)&&void 0!==t?t:o.FLOAT_NULL,M[e]=u.ratio;for(let t=0;t<P.length;++t){const[n,i]=G[t];k[t][e]=(0,d.lh)(n,i,a)}for(let t=P.length;t<k.length;++t){const n=I[t-P.length];R[t-P.length].set(e,(0,d.J1)(s,n,a))}}T.setTag(o.TAGS.CELL_RENDERER,"html"),x.setTag(o.TAGS.CELL_RENDERER,"html");const U=O.aggregate(),V=U.rowCount,F=U.columns;let H=U.getCol(i);H.name=u.i6.CLUSTER,H.type!==o.COLUMN_TYPE.STRING&&(U.columns.replace(H,H.convertTo(o.COLUMN_TYPE.STRING)),H=U.getCol(H.name));const B=H.categories,q=F.addNewInt(u.i6.MEMBERS).getRawData(),Y=F.addNewString(u.i6.WEB_LOGO),$=F.addNewString(u.i6.DISTRIBUTION),j=F.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),W=F.addNewFloat(u.i6.P_VALUE).getRawData(),z=F.addNewFloat(u.i6.RATIO).getRawData(),K=I.map((t=>F.addNewString(t))),Q=new Array(V),X=Array.from({length:V},(()=>new v.A(l,!1)));for(let t=0;t<l;++t){const n=m[f[t]];null===(e=X[B.indexOf(n)])||void 0===e||e.setTrue(t)}for(let t=0;t<V;++t){const e=X[t];if(e.allFalse)continue;const i=o.BitSet.fromBytes(e.buffer.buffer,l),a=r?(0,d.GT)(c,e):this.clusterStats[A.ORIGINAL][B[t]];for(let e=0;e<I.length;++e){const n=I[e];K[e].set(t,(0,d.J1)(s,n,i))}q[t]=a.count,Q[t]=i,j[t]=a.meanDifference,W[t]=null!==(n=a.pValue)&&void 0!==n?n:o.FLOAT_NULL,z[t]=a.ratio}Y.setTag(o.TAGS.CELL_RENDERER,"html"),$.setTag(o.TAGS.CELL_RENDERER,"html");const J=U.append(C);return this.bitsets=Q.concat(D),I.forEach((t=>J.col(t).semType="lst-pie-chart")),J}createLogoSummaryTableGrid(){const t=this.dataFrame.filter.anyFalse,e=t?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,n=this.getTotalViewerAggColumns().map((([t,e])=>b(e,t))),s=this.logoSummaryTable.plot.grid();s.sort([u.i6.MEMBERS],[!1]),this.updateFilter(),s.col(u.i6.CLUSTER).visible=!0,s.columns.setOrder([u.i6.CLUSTER,u.i6.MEMBERS,u.i6.WEB_LOGO,...this.getStringAggregatedColumns(),u.i6.DISTRIBUTION,u.i6.MEAN_DIFFERENCE,u.i6.P_VALUE,u.i6.RATIO,...n]),s.columns.rowHeader.visible=!1,s.props.rowHeight=55;const d=new o.LruCache,f=new o.LruCache,p=this.positionColumns.length,m=s.columns.byName(u.i6.WEB_LOGO);m.cellType="html",m.width=350;const v=this.getScaledActivityColumn(t),C=e.getCol(this.sequenceColumnName);s.onCellRender.subscribe((t=>{return e=this,n=void 0,r=function*(){var e,n,i;const r=t.cell,s=r.tableRowIndex;if(!r.isTableCell||null==s||-1===s)return;const l=t.g,m=t.bounds;l.save(),l.beginPath(),l.rect(m.x,m.y,m.width,m.height),l.clip();try{const y=Math.max(r.bounds.height-2,0),w=this.bitsets[s];if((null===(e=r.tableColumn)||void 0===e?void 0:e.name)===u.i6.CLUSTER)c.k8(l,r.cell.value,this.clusterSelection,m),t.preventDefault();else if((null===(n=r.tableColumn)||void 0===n?void 0:n.name)===u.i6.WEB_LOGO){const e=Math.floor((r.bounds.width-2-4*(p-1))/p);let n=d.get(s);if(void 0!==n){const t=n.getProperties();for(const i of t)"positionHeight"===i.name&&i.get(n)!==this.webLogoMode?i.set(n,this.webLogoMode):"positionWidth"===i.name&&i.get(n)!==e?i.set(n,e):"minHeight"===i.name&&i.get(n)!==y&&i.set(n,y);a()(n.root).css("height",`${y}px`).children().first().css("overflow-y","hidden !important")}else{const t=this.createWebLogoDf(C,w);n=yield t.plot.fromType("WebLogo",{positionHeight:this.webLogoMode,horizontalAlignment:h.P4.LEFT,maxHeight:1e3,minHeight:y,positionWidth:e,showPositionLabels:!1}),d.set(s,n)}n.root.style.height=`${y}px`,r.element=n.root,t.preventDefault()}else if((null===(i=r.tableColumn)||void 0===i?void 0:i.name)===u.i6.DISTRIBUTION){let e=f.get(s);void 0===e&&(e=(0,g.FZ)(v,w).plot.histogram({filteringEnabled:!1,valueColumnName:v.name,splitColumnName:u.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!1,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:o.Color.toHtml(o.Color.white),xAxisHeight:1,showSplitSelector:!1}),e.root.style.width="auto",f.set(s,e)),e.root.style.height=`${y}px`,r.element=e.root,t.preventDefault()}}finally{l.restore()}},new((i=void 0)||(i=Promise))((function(t,o){function s(t){try{l(r.next(t))}catch(t){o(t)}}function a(t){try{l(r.throw(t))}catch(t){o(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(s,a)}l((r=r.apply(e,n||[])).next())}));var e,n,i,r})),s.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),o.debounce(s.onCurrentCellChanged,500).subscribe((t=>{var e;if(t.isTableCell)try{if(!this.keyPress||(null===(e=t.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;null!==this.currentRowIndex&&-1!==this.currentRowIndex&&this.modifyClusterSelection(this.getCluster(s.cell(u.i6.CLUSTER,this.currentRowIndex)),{shiftPressed:!0,ctrlPressed:!0},!1),this.modifyClusterSelection(this.getCluster(t),{shiftPressed:!0,ctrlPressed:!1}),s.invalidate()}finally{this.keyPress=!1,this.currentRowIndex=t.gridRow}})),s.root.addEventListener("keydown",(t=>{if(this.keyPress=t.key.startsWith("Arrow"),!this.keyPress){if("Escape"===t.key||"KeyA"===t.code&&t.shiftKey&&t.ctrlKey)this.initClusterSelection({notify:!1});else if("KeyA"===t.code&&t.ctrlKey)for(let t=0;t<this.logoSummaryTable.rowCount;++t)this.modifyClusterSelection(this.getCluster(s.cell(u.i6.CLUSTER,t)),{shiftPressed:!0,ctrlPressed:!1},!1);this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),s.invalidate()}})),s.root.addEventListener("click",(t=>{var e;const n=s.hitTest(t.offsetX,t.offsetY);if(!n||!n.isTableCell||(null===(e=n.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;const o=this.getCluster(n);this.modifyClusterSelection(o,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),s.invalidate(),y._package.files.readAsText("help/logo-summary-table.md").then((t=>{r.shell.windows.help.showHelp(i.markdown(t))})).catch((t=>r.log.error(t)))})),s.onCellTooltip(((t,e,n)=>{var i;if(!t.isTableCell)return this.model.unhighlight(),!0;const r=this.getCluster(t);return this.highlightCluster(r),(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===u.i6.CLUSTER&&this.showTooltip(r,e,n),!0}));const w=s.props;return w.allowEdit=!1,w.allowRowSelection=!1,w.allowBlockSelection=!1,w.allowColSelection=!1,w.showCurrentRowIndicator=!1,w.showReadOnlyNotifications=!1,s}highlightCluster(t){const e=this.clusterStats[t.positionOrClusterType][t.monomerOrCluster].mask;this.dataFrame.rows.highlight((t=>e.getBit(t))),this.model.isHighlighting=!0}getCluster(t){const e=this.logoSummaryTable.get(u.i6.CLUSTER,t.tableRowIndex);return{positionOrClusterType:this.dataFrame.getCol(this.clustersColumnName).categories.includes(e)?A.ORIGINAL:A.CUSTOM,monomerOrCluster:e}}updateFilter(){const t=this.logoSummaryTable.getCol(u.i6.MEMBERS),e=this.logoSummaryTable.getCol(u.i6.CLUSTER),n=e.getRawData(),i=e.categories,r=i.indexOf("-1"),o=t.getRawData();let s=0;o.forEach(((t,e)=>{"-1"!==i[n[e]]&&(s=Math.max(s,o[e]))}));const a=Math.ceil(s*this.membersRatioThreshold);this.logoSummaryTable.filter.init((t=>o[t]>a&&(-1===r||"-1"!==i[n[t]])))}clusterFromSelection(){const t=this.model.getVisibleSelection(),e=this.logoSummaryTable.columns,n=e.length,i=new Array(e.length),r=this.getScaledActivityColumn(),o=v.A.fromString(t.toBinaryString()),s=(0,d.GT)(r.getRawData(),o);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},c={},h=this.getTotalViewerAggColumns(),f=this.getStringAggregatedColumns();for(const[e,n]of h){const i=b(n,e),r=this.dataFrame.getCol(e);l[i]=(0,d.lh)(r,n,t)}for(const e of f)c[e]=(0,d.J1)(this.dataFrame,e,t);for(let r=0;r<n;++r){const n=e.byIndex(r);i[r]=n.name===u.i6.CLUSTER?a:n.name===u.i6.MEMBERS?t.trueCount:n.name===u.i6.WEB_LOGO||n.name===u.i6.DISTRIBUTION?null:n.name===u.i6.MEAN_DIFFERENCE?s.meanDifference:n.name===u.i6.P_VALUE?s.pValue:n.name===u.i6.RATIO?s.ratio:n.name in l?l[n.name]:n.name in c?c[n.name]:void 0,void 0===i[r]&&y._package.logger.warning(`PeptidesLSTWarn: value for column ${n.name} is undefined`)}this.logoSummaryTable.rows.addNew(i),this.clusterStats[A.CUSTOM][a]=s,this.addNewCluster(a)}removeCluster(){const t=this.clusterSelection[A.CUSTOM];if(0===t.length)return void r.shell.warning("No custom clusters selected to be removed");const e=this.logoSummaryTable.rows,n=this.logoSummaryTable.getCol(u.i6.CLUSTER),i=n.categories,o=this.dataFrame.columns;for(const n of t){t.splice(t.indexOf(n),1),o.remove(n),delete this.clusterStats[A.CUSTOM][n];const r=i.indexOf(n);e.removeAt(r),this.bitsets.splice(r,1)}n.compact(),this.clusterSelection[A.CUSTOM]=t,this.render()}addNewCluster(t){const e=o.Column.fromBitSet(t,this.model.getVisibleSelection());e.setTag(u.gp.CUSTOM_CLUSTER,"1"),e.setTag(u.gp.ANALYSIS_COL,"true"),this.dataFrame.columns.add(e),this.model.analysisView.grid.col(e.name).visible=!1}modifyClusterSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.clusterSelection=(0,g.vW)(this.clusterSelection,t,e):this._clusterSelection=(0,g.vW)(this.clusterSelection,t,e)}showTooltip(t,e,n){const r=this.dataFrame.filter,s=r.anyFalse?this.dataFrame.clone(r):this.dataFrame,a=s.rowCount,l=new v.A(a,!1),u=this.getScaledActivityColumn(r.anyFalse),c=u.getRawData();if(t.positionOrClusterType===A.ORIGINAL){const e=s.getCol(this.clustersColumnName),n=e.getRawData(),i=e.categories.indexOf(t.monomerOrCluster);for(let t=0;t<a;++t)n[t]===i&&l.setTrue(t);l.incrementVersion()}else{const e=s.getCol(t.monomerOrCluster);l.buffer=e.getRawData()}const h=r.anyFalse?(0,d.GT)(c,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!h.count)return null;const f=o.BitSet.fromBytes(l.buffer.buffer,a),p=(0,g.FZ)(u,f),y=(0,m.M1)(p,!0),C=(0,m.QD)(h),w=(0,d.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:f}),b=Object.assign(Object.assign({},C),w),E=(0,g.F2)(y,b);return i.tooltip.show(E,e,n),E}createWebLogoDf(t,e){const n=o.DataFrame.fromColumns([t]);return n.filter.copyFrom(e),n}}},3541:(t,e,n)=>{"use strict";n.d(e,{J:()=>_,UJ:()=>N,ds:()=>i,xN:()=>x});var i,r,o,s,a=n(4328),l=n(7389),u=n(6082),c=n(7233),h=n.n(c),d=n(4139),f=n(2935),p=n(9484),m=n(144),g=n.n(m),v=n(5070),y=n(3273),C=n(912),w=n(3657),b=n(8608),A=n(3077),E=n(439),S=n(2003),T=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.MUTATION_CLIFFS="Mutation Cliffs",t.INVARIANT_MAP="Invariant Map"}(i||(i={})),function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.ACTIVITY_SCALING="activityScaling",t.TARGET="target",t.TARGET_CATEGORY="targetCategory",t.MIN_ACTIVITY_DELTA="minActivityDelta",t.MAX_MUTATIONS="maxMutations",t.COLUMNS="columns",t.AGGREGATION="aggregation",t.ACTIVITY_TARGET="activityTarget",t.VALUE_INVARIANT_MAP="value",t.AGGREGATION_INVARIANT_MAP_VALUE="valueAggregation"}(r||(r={})),function(t){t.COLOR="color",t.COLOR_AGGREGATION="colorAggregation",t.CUSTOM_COLOR_RANGE="customColorRange",t.MIN_COLOR_VALUE="minColorValue",t.MAX_COLOR_VALUE="maxColorValue",t.LOWER_BOUND_COLOR="lowerBoundColor",t.MIDDLE_COLOR="middleColor",t.UPPER_BOUND_COLOR="upperBoundColor",t.LOG_SCALE_COLOR="logScaleColor"}(o||(o={})),function(t){t.GENERAL="General",t.INVARIANT_MAP="Invariant Map",t.MUTATION_CLIFFS="Mutation Cliffs",t.AGGREGATION="Aggregation"}(s||(s={}));class x extends u.JsViewer{constructor(){super(),this.keyPressed=!1,this._scaledActivityColumn=null,this.doRender=!0,this._viewerGrid=null,this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._invariantMapSelection=null,this._mutationCliffsSelection=null,this.sequenceColumnName=this.column(r.SEQUENCE,{category:s.GENERAL,semType:u.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(r.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(r.ACTIVITY_SCALING,d.rg.NONE,{category:s.GENERAL,choices:Object.values(d.rg),nullable:!1}),this.activityTarget=this.string(r.ACTIVITY_TARGET,d.wf.HIGH,{category:s.GENERAL,choices:Object.values(d.wf),nullable:!1}),this.targetColumnName=this.column(r.TARGET,{category:s.GENERAL,nullable:!0,columnTypeFilter:"categorical",userEditable:!0}),this.minActivityDelta=this.float(r.MIN_ACTIVITY_DELTA,0,{category:s.MUTATION_CLIFFS,min:0,max:100}),this.maxMutations=this.int(r.MAX_MUTATIONS,1,{category:s.MUTATION_CLIFFS,min:1,max:20}),this.columns=this.columnList(r.COLUMNS,[],{category:s.AGGREGATION}),this.aggregation=this.string(r.AGGREGATION,u.AGG.AVG,{category:s.AGGREGATION,choices:d.V5}),this.valueColumnName=this.column(r.VALUE_INVARIANT_MAP,{category:s.INVARIANT_MAP,userEditable:!0,nullable:!1,columnTypeFilter:"numerical"}),this.valueAggregation=this.string(r.AGGREGATION_INVARIANT_MAP_VALUE,u.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:d.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,b.sg)(((t,e,n)=>T(this,void 0,void 0,(function*(){return yield(0,w.uz)(t,e,n)})))),this.targetCategoryInput=l.input.choice("Category",{value:null,items:[],nullable:!0,onValueChanged:()=>{var t;this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._invariantMapSelection=null,this.doRender=!1,this._monomerPositionStats=null,null===(t=this.positionColumns)||void 0===t||t.forEach((t=>{t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),this.viewerGrid.invalidate()}}),this.targetCategoryInput.root.style.display="none",this.targetCategoryInput.root.style.width="50%",this.targetCategoryInput.root.style.marginLeft="8px"}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createViewerGrid()),this._viewerGrid}get alphabet(){var t;return null!==(t=this.dataFrame.getCol(this.sequenceColumnName).getTag(E.gp.alphabet))&&void 0!==t?t:S.YI.UN}get model(){return p.i.getInstance(this.dataFrame)}get positionColumns(){var t,e,n;if(null!=this._positionColumns)return this._positionColumns;const i=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)?this._positionColumns=this.model.positionColumns:this instanceof _?this._positionColumns=i(p.q.MOST_POTENT_RESIDUES):this instanceof N&&(this._positionColumns=i(p.q.SEQUENCE_VARIABILITY_MAP)),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(n=i(p.q.LOGO_SUMMARY_TABLE))&&void 0!==n?n:(0,A.R)(this.dataFrame.getCol(this.sequenceColumnName)).columns.toList()),this._positionColumns}get monomerPositionStats(){var t;if(null!=this._monomerPositionStats)return this._monomerPositionStats;const e=t=>{var e,n,i;return!(this.sequenceColumnName!==(null==t?void 0:t.sequenceColumnName)||this.activityColumnName!==(null==t?void 0:t.activityColumnName)||this.activityScaling!==(null==t?void 0:t.activityScaling)||!(t instanceof x&&this.targetColumnName==(null==t?void 0:t.targetColumnName)&&(null===(e=this.targetCategoryInput)||void 0===e?void 0:e.value)===(null===(n=null==t?void 0:t.targetCategoryInput)||void 0===n?void 0:n.value))&&(t instanceof x||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof x&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof x||this.valueColumnName&&this.valueAggregation&&this.valueAggregation!=u.AGG.VALUE_COUNT&&this.valueAggregation!=u.AGG.TOTAL_COUNT))},n=t=>{const n=this.model.findViewer(t);return e(n)?n._monomerPositionStats:null};null!==this.model.monomerPositionStats&&e(this.model.settings)?this._monomerPositionStats=this.model.monomerPositionStats:this instanceof _?this._monomerPositionStats=n(p.q.MOST_POTENT_RESIDUES):this instanceof N&&(this._monomerPositionStats=n(p.q.SEQUENCE_VARIABILITY_MAP));const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,r=this.targetCategoryInput.value,o=this.dataFrame.col(this.valueColumnName),s=this.valueAggregation;return null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,w.Ej)(this.getScaledActivityColumn(),this.dataFrame.filter,this.positionColumns,{target:i&&r?{col:i,cat:r}:void 0,aggValue:s&&o?{col:o,type:s}:void 0})),this._monomerPositionStats}get mutationCliffs(){if(null!=this._mutationCliffs)return this._mutationCliffs;const t=t=>{const e=this.model.findViewer(t);return i=e,(n=this).sequenceColumnName===(null==i?void 0:i.sequenceColumnName)&&n.activityColumnName===i.activityColumnName&&n.activityScaling===i.activityScaling&&n.targetColumnName===(null==i?void 0:i.targetColumnName)&&(null===(r=n.targetCategoryInput)||void 0===r?void 0:r.value)===(null===(o=null==i?void 0:i.targetCategoryInput)||void 0===o?void 0:o.value)&&n.minActivityDelta===(null==i?void 0:i.minActivityDelta)&&n.maxMutations===(null==i?void 0:i.maxMutations)?e._mutationCliffs:null;var n,i,r,o};return this instanceof _?this._mutationCliffs=t(p.q.MOST_POTENT_RESIDUES):this instanceof N&&(this._mutationCliffs=t(p.q.SEQUENCE_VARIABILITY_MAP)),this._mutationCliffs}set mutationCliffs(t){this._mutationCliffs=t,this.viewerGrid.invalidate()}get cliffStats(){if(!this._mutationCliffStats&&this.mutationCliffs&&this.activityColumnName&&this.sequenceColumnName&&this.dataFrame.col(this.activityColumnName)){const t=this.dataFrame.col(this.activityColumnName).getRawData();this._mutationCliffStats=(0,w.Lw)(this.mutationCliffs,t)}return this._mutationCliffStats}set cliffStats(t){this._mutationCliffStats=t,this.viewerGrid.invalidate}get mutationCliffsSelection(){var t;const e=this instanceof _?d.YX.MP:d.YX.MPR,n=this.dataFrame.getTag(`${e}${d.gp.MUTATION_CLIFFS_SELECTION}`);return null!==(t=this._mutationCliffsSelection)&&void 0!==t||(this._mutationCliffsSelection=null===n?(0,b.ZR)(this.positionColumns):JSON.parse(n)),this._mutationCliffsSelection}set mutationCliffsSelection(t){this._mutationCliffsSelection=t;const e=this instanceof _?d.YX.MP:d.YX.MPR;this.dataFrame.setTag(`${e}${d.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof _?p.q.SEQUENCE_VARIABILITY_MAP:p.q.MOST_POTENT_RESIDUES);const n=this.model.findViewer(p.q.SEQUENCE_VARIABILITY_MAP);null==n||n.viewerGrid.invalidate();const i=this.model.findViewer(p.q.MOST_POTENT_RESIDUES);null==i||i.viewerGrid.invalidate(),this.model.analysisView.grid.invalidate()}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,b.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?u.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.filter).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}modifyMutationCliffsSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.mutationCliffsSelection=(0,b.vW)(this.mutationCliffsSelection,t,e):this._mutationCliffsSelection=(0,b.vW)(this.mutationCliffsSelection,t,e)}resetTargetCategoryValue(){var t;const e=this.targetColumnName,n=this.dataFrame.col(e);this.targetCategoryInput.items=null!==(t=null==n?void 0:n.categories)&&void 0!==t?t:[],this.targetCategoryInput.value=null,this.targetCategoryInput.root.style.display=e?"flex":"none"}onPropertyChanged(t){switch(super.onPropertyChanged(t),this.doRender=!0,t.name){case`${r.SEQUENCE}${d.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${r.ACTIVITY}${d.To}`:case r.ACTIVITY_SCALING:this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null,this._scaledActivityColumn=null;break;case`${r.VALUE_INVARIANT_MAP}${d.To}`:case r.AGGREGATION_INVARIANT_MAP_VALUE:this._monomerPositionStats=null,this._viewerGrid=null,this._invariantMapSelection=null;break;case r.MIN_ACTIVITY_DELTA:case r.MAX_MUTATIONS:this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this.doRender=!1;break;case r.COLUMNS:case r.AGGREGATION:this instanceof N&&(this._viewerGrid=null);break;case r.ACTIVITY_TARGET:(this instanceof N||this instanceof _)&&(this._viewerGrid=null)}null===this._mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),t.name===`${r.TARGET}${d.To}`&&this.targetColumnInput&&(this.targetColumnInput.value=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,this.resetTargetCategoryValue())}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,b.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}createViewerGrid(){throw new Error("Not implemented")}detach(){this.subs.forEach((t=>t.unsubscribe()))}onTableAttached(){var t,e,n;if(super.onTableAttached(),this.helpUrl="https://datagrok.ai/help/datagrok/solutions/domains/bio/peptides-sar",(0,b.B2)(this.dataFrame))null===(t=this.getProperty(`${r.SEQUENCE}${d.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(u.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${r.ACTIVITY}${d.To}`))||void 0===e||e.set(this,g()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${r.VALUE_INVARIANT_MAP}${d.To}`))||void 0===n||n.set(this,g()(this.dataFrame.columns.numerical).next().value.name),null===this.mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats}));else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}}calculateMutationCliffs(){return T(this,void 0,void 0,(function*(){const t=this.dataFrame.getCol(this.activityColumnName),e=this.positionColumns.map(b.eY),n=this.targetColumnName?(0,b.eY)(this.dataFrame.getCol(this.targetColumnName)):null,i={maxMutations:this.maxMutations,minActivityDelta:this.minActivityDelta,targetCol:n,currentTarget:this.targetCategoryInput.value},r=t.getRawData(),o=yield this.mutationCliffsDebouncer(r,e,i);return{cliffs:o,cliffStats:(0,w.Lw)(o,r)}}))}}class _ extends x{constructor(){super(),this.currentGridCell=null,this.customColorRange=!1,this.minColorValue=0,this.maxColorValue=0,this.logScaleColor=!1,this.colorColumnName=this.column(o.COLOR,{category:s.INVARIANT_MAP,nullable:!1,columnTypeFilter:"numerical"}),this.colorAggregation=this.string(o.COLOR_AGGREGATION,u.AGG.AVG,{category:s.INVARIANT_MAP,choices:d.V5}),this.lowerBoundColor=this.int(o.LOWER_BOUND_COLOR,4278190335,{category:s.INVARIANT_MAP,editor:"color"}),this.middleColor=this.int(o.MIDDLE_COLOR,4294967295,{category:s.INVARIANT_MAP,editor:"color"}),this.upperBoundColor=this.int(o.UPPER_BOUND_COLOR,4294901760,{category:s.INVARIANT_MAP,editor:"color"}),this.logScaleColor=this.bool(o.LOG_SCALE_COLOR,!1,{category:s.INVARIANT_MAP}),this.customColorRange=this.bool(o.CUSTOM_COLOR_RANGE,!1,{category:s.INVARIANT_MAP}),this.minColorValue=this.float(o.MIN_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.maxColorValue=this.float(o.MAX_COLOR_VALUE,0,{category:s.INVARIANT_MAP})}get name(){return p.q.SEQUENCE_VARIABILITY_MAP}get mode(){var t;return null!==(t=this.dataFrame.getTag(d.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(d.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${d.YX.MP}${d.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._invariantMapSelection)&&void 0!==t||(this._invariantMapSelection=null===e?(0,b.ZR)(this.positionColumns):JSON.parse(e)),this._invariantMapSelection}set invariantMapSelection(t){this._invariantMapSelection=t,this.dataFrame.setTag(`${d.YX.MP}${d.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(p.q.SEQUENCE_VARIABILITY_MAP),this.model.analysisView.grid.invalidate()}onTableAttached(){var t;if(super.onTableAttached(),(0,b.B2)(this.dataFrame))null===(t=this.getProperty(`${o.COLOR}${d.To}`))||void 0===t||t.set(this,this.activityColumnName),this.targetColumnInput=l.input.column("Target",{value:void 0,nullable:!0,table:this.dataFrame,onValueChanged:t=>{var e;const n=this.getProperty(`${r.TARGET}${d.To}`);n&&n.get(this)!==t.name&&(null==n||n.set(this,null!==(e=t.name)&&void 0!==e?e:null))}});else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}this.render()}modifyInvariantMapSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e):this._invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e)}onPropertyChanged(t){var e;super.onPropertyChanged(t),t.name===r.SEQUENCE&&(this._invariantMapSelection=null),null===(e=this.positionColumns)||void 0===e||e.forEach((t=>{t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.doRender?this.render():this.viewerGrid.invalidate()}createMonomerPositionDf(){const t=new Set,e=this.positionColumns;for(const n of e){const e=n.categories;for(const n of e)""!==n&&t.add(n)}const n=u.Column.fromStrings(d.$2.MONOMER,Array.from(t)),i=u.DataFrame.fromColumns([n]);i.name="SAR";for(const t of e)i.columns.addNewBool(t.name);return i}cacheInvariantMapColors(){if(this.colorColumnName&&this.dataFrame.col(this.colorColumnName)){const t=this.dataFrame.getCol(this.colorColumnName).getRawData();let e=9999999,n=-9999999;const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,r=null==i?void 0:i.getRawData(),o=this.targetCategoryInput.value,s=null==o?null:null==i?void 0:i.categories.indexOf(o);for(const i of this.positionColumns){i.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]={};const o=i.temp[d.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),c=i.categories;if(!this.monomerPositionStats[a])continue;const h=this.monomerPositionStats[a];for(const a of Object.keys(h)){if("general"===a)continue;const h=[];for(let t=0;t<i.length;++t){const e=c[l[t]]===a,n=!r||null==s||-1==s||r[t]===s;e&&n&&h.push(t)}const d=u.Column.float("color",h.length).init((e=>t[h[e]])).aggregate(this.colorAggregation);o[a]=d,e=Math.min(e,d),n=Math.max(n,d)}i.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=o}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,c=a?this.maxColorValue:n;const h=this.logScaleColor&&l>1e-30&&c>1e-30&&e>1e-30&&n>1e-30;h&&(l=Math.log(l),c=Math.log(c));for(const t of this.positionColumns){const i=t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===d.wf.LOW&&(i[t]=c-i[t]+l),i[t]=u.Color.scaleColor(h?Math.log(i[t]):i[t],l,c,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[d.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[d.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([d.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([d.$2.MONOMER,...n]);const r=t.getCol(d.$2.MONOMER);f.rI(r,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>M(t,this,this.mode===i.INVARIANT_MAP,this.dataFrame.getCol(this.colorColumnName),this.colorAggregation))),e.onCellTooltip(((t,e,n)=>{var r,o;if(!t.isTableCell)return this.model.unhighlight(),!0;const s=this.getMonomerPosition(t);(0,b.dl)(s,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0;const a=this.getTotalViewerAggColumns();return this.mode===i.INVARIANT_MAP&&(this.colorColumnName&&this.colorAggregation&&a.unshift([this.colorColumnName,this.colorAggregation]),this.valueColumnName&&this.valueAggregation&&this.valueAggregation!==u.AGG.VALUE_COUNT&&this.valueAggregation!==u.AGG.TOTAL_COUNT&&a.unshift([this.valueColumnName,this.valueAggregation])),(0,C.DK)(this.model.df,this.getScaledActivityColumn(),a,{fromViewer:!0,isMutationCliffs:this.mode===i.MUTATION_CLIFFS,monomerPosition:s,x:e,y:n,mpStats:this.monomerPositionStats,cliffStats:null!==(o=null===(r=this.cliffStats)||void 0===r?void 0:r.stats)&&void 0!==o?o:void 0})})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),u.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,r,o,s,a,l;try{if(!this.keyPressed)return;if(null!==this.currentGridCell){const t=this.getMonomerPosition(this.currentGridCell);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1):(null===(o=null===(r=null===(n=this.mutationCliffs)||void 0===n?void 0:n.get(t.monomerOrCluster))||void 0===r?void 0:r.get(t.positionOrClusterType))||void 0===o?void 0:o.size)&&this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}const u=this.getMonomerPosition(t);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0):(null===(l=null===(a=null===(s=this.mutationCliffs)||void 0===s?void 0:s.get(u.monomerOrCluster))||void 0===a?void 0:a.get(u.positionOrClusterType))||void 0===l?void 0:l.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:!0,ctrlPressed:!1},!0),e.invalidate(),setTimeout((()=>null==e?void 0:e.invalidate()),300)}finally{this.keyPressed=!1,this.currentGridCell=t}})),e.root.addEventListener("keydown",(t=>{if(this.keyPressed=t.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===t.key||"KeyA"===t.code&&t.ctrlKey&&t.shiftKey)this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,b.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,b.ZR)(this.positionColumns);else{if("KeyA"!==t.code||!t.ctrlKey)return;{const t=Object.keys(this.monomerPositionStats).filter((t=>"general"!==t));for(const e of t){const t=Object.keys(this.monomerPositionStats[e]).filter((t=>"general"!==t));for(const n of t){const t={monomerOrCluster:n,positionOrClusterType:e};this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1):this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}}}this.model.fireBitsetChanged(p.q.SEQUENCE_VARIABILITY_MAP),e.invalidate()}})),e.root.addEventListener("click",(n=>{var r,o,s,a;const l=e.hitTest(n.offsetX,n.offsetY);if(!(null==l?void 0:l.isTableCell)||(null===(r=null==l?void 0:l.tableColumn)||void 0===r?void 0:r.name)===d.$2.MONOMER)return;const u=this.getMonomerPosition(l);this.mode===i.INVARIANT_MAP?(this.modifyInvariantMapSelection(u,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),(0,b.CD)(this.invariantMapSelection)&&(t.currentRowIdx=-1)):(null===(a=null===(s=null===(o=this.mutationCliffs)||void 0===o?void 0:o.get(u.monomerOrCluster))||void 0===s?void 0:s.get(u.positionOrClusterType))||void 0===a?void 0:a.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),e.invalidate(),this.showHelp()})),O(e);const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(d.$2.MONOMER);if(40!==t.width){t.width=40;for(const t of n)e.col(t).width=40}else o.unsubscribe()}));return e}showHelp(){y._package.files.readAsText("help/monomer-position.md").then((t=>{a.shell.windows.help.showHelp(l.markdown(t))})).catch((t=>a.log.error(t)))}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(d.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(h()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const r=this.getProperty(o.COLOR);r&&(r.choices=g()(a.shell.t.columns.numerical).toArray().map((t=>t.name)),r.get(this)===d.$2.ACTIVITY_SCALED&&r.set(this,d.$2.ACTIVITY)),h()(this.root).empty();let s=l.divText(p.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"});if(this.name===p.q.SEQUENCE_VARIABILITY_MAP){const t=l.input.bool(i.MUTATION_CLIFFS,{value:this.mode===i.MUTATION_CLIFFS});t.root.addEventListener("click",(()=>{e.value=!1,t.value=!0,this.mode=i.MUTATION_CLIFFS,this.showHelp()})),t.setTooltip("Statistically significant changes in activity");const e=l.input.bool(i.INVARIANT_MAP,{value:this.mode===i.INVARIANT_MAP});e.root.addEventListener("click",(()=>{t.value=!1,e.value=!0,this.mode=i.INVARIANT_MAP,this.showHelp()})),e.setTooltip("Number of sequences having monomer-position");const n=t=>{h()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),h()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),h()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),h()(s).css("width","auto").css("align-self","center")}const u=this.viewerGrid.root;u.style.width="auto";const c=l.iconFA("expand-alt",(()=>{const t=l.dialog();t.add(l.divV([s,u],{style:{height:"100%"}})),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Sequence Variability Map Table in full screen");h()(c).addClass("pep-help-icon"),this.targetColumnInput&&(this.targetColumnInput.root.style.width="50%");const f=l.divH([null!==(e=null===(t=this.targetColumnInput)||void 0===t?void 0:t.root)&&void 0!==e?e:l.div(),this.targetCategoryInput.root],{style:{alignSelf:"center",justifyContent:"center"}}),m=l.divH([c,s,f],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column"}});this.root.appendChild(l.divV([m,u])),null===(n=this.viewerGrid)||void 0===n||n.invalidate()}}class N extends x{constructor(){super(),this.currentGridRowIdx=null}get name(){return p.q.MOST_POTENT_RESIDUES}onTableAttached(){super.onTableAttached(),this.helpUrl="https://datagrok.ai/help/datagrok/solutions/domains/bio/peptides-sar",this.render()}onPropertyChanged(t){super.onPropertyChanged(t),this.doRender&&this.render()}createMostPotentResiduesDf(){var t;const e=Object.entries(this.monomerPositionStats),n=new Array(e.length-1),i=new Array(n.length),r=new Array(n.length),o=new Array(n.length),s=new Array(n.length),a=new Array(n.length),l=new Array(n.length),c=this.getTotalViewerAggColumns(),h=c.map((([t,e])=>(0,v.hX)(e,t))),f=new Array(h.length);h.forEach(((t,e)=>f[e]=new Array(n.length)));let p=0;for(const[m,g]of e){const e=g.general;if(!e)continue;if(1===Object.entries(g).length)continue;const y=[];for(const[n,i]of Object.entries(g))"general"!==n&&(i.count>1&&(null==i.pValue||(null!==(t=i.pValue)&&void 0!==t?t:1)<=.05)&&y.push([n,i]),i.pValue===e.minPValue&&y.push([n,i]));if(0===y.length)continue;let C=null;for(const[t,e]of y)(null===C||this.activityTarget===d.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===d.wf.LOW&&C[1].meanDifference>e.meanDifference)&&(C=[t,e]);if(null===C)continue;n[p]=parseInt(m),i[p]=C[0],r[p]=C[1].meanDifference,o[p]=C[1].pValue,s[p]=C[1].count,a[p]=C[1].ratio,l[p]=C[1].mean;const w=this.monomerPositionStats[m][C[0]],b=u.BitSet.fromBytes(w.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<h.length;t++){const[e,n]=c[t];f[t][p]=(0,v.lh)(this.model.df.getCol(e),n,b)}++p}n.length=p,i.length=p,r.length=p,o.length=p,s.length=p,a.length=p,l.length=p;const m=u.DataFrame.create(p),g=m.columns;return g.add(u.Column.fromList(u.TYPE.INT,d.$2.POSITION,n)),g.add(u.Column.fromList(u.TYPE.STRING,d.$2.MONOMER,i)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.MEAN_DIFFERENCE,r)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.MEAN,l)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.P_VALUE,o)),g.add(u.Column.fromList(u.TYPE.INT,d.$2.COUNT,s)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.RATIO,a)),h.forEach(((t,e)=>g.add(u.Column.fromList(u.TYPE.FLOAT,t,f[e])))),m}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([d.$2.POSITION]);const n=e.col(d.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(d.$2.MONOMER);f.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>M(t,this,!1))),e.onCellTooltip(((t,e,n)=>{var i,r;if(!t.isTableCell)return this.model.unhighlight(),!0;const o=this.getMonomerPosition(t);if((0,b.dl)(o,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0,(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===d.$2.MONOMER)o.positionOrClusterType=d.$2.MONOMER;else if((null===(r=t.tableColumn)||void 0===r?void 0:r.name)!==d.$2.MEAN_DIFFERENCE)return!1;const s=this.getTotalViewerAggColumns(),a=null==t.tableRowIndex?void 0:(0,v.m2)(t.grid.dataFrame,t.tableRowIndex,s,{});return(0,C.DK)(this.model.df,this.getScaledActivityColumn(),s,{fromViewer:!0,isMostPotentResidues:!0,monomerPosition:o,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),u.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,r,o;try{if(this.keyPressed&&t.currentCol.name!==d.$2.MEAN_DIFFERENCE||!this.keyPressed)return;const s=this.getMonomerPosition(n);if(null!==this.currentGridRowIdx){const t=this.getMonomerPosition(e.cell("Diff",this.currentGridRowIdx));this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}(null===(o=null===(r=null===(i=this.mutationCliffs)||void 0===i?void 0:i.get(s.monomerOrCluster))||void 0===r?void 0:r.get(s.positionOrClusterType))||void 0===o?void 0:o.size)&&this.modifyMutationCliffsSelection(s,{shiftPressed:!0,ctrlPressed:!1}),e.invalidate()}finally{this.keyPressed=!1,this.currentGridRowIdx=n.gridRow}})),e.root.addEventListener("keydown",(n=>{if(this.keyPressed=n.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===n.key||"KeyA"===n.code&&n.ctrlKey&&n.shiftKey)this._mutationCliffsSelection=(0,b.ZR)(this.positionColumns);else{if("KeyA"!==n.code||!n.ctrlKey)return;for(let n=0;n<t.rowCount;++n){const t=this.getMonomerPosition(e.cell("Diff",n));this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}this.model.fireBitsetChanged(p.q.MOST_POTENT_RESIDUES),e.invalidate()}})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),e.root.addEventListener("click",(t=>{var n,i,r;const o=e.hitTest(t.offsetX,t.offsetY);if(!(null==o?void 0:o.isTableCell)||o.tableColumn.name!==d.$2.MEAN_DIFFERENCE)return;const s=this.getMonomerPosition(o);(null===(r=null===(i=null===(n=this.mutationCliffs)||void 0===n?void 0:n.get(s.monomerOrCluster))||void 0===i?void 0:i.get(s.positionOrClusterType))||void 0===r?void 0:r.size)&&(this.modifyMutationCliffsSelection(s,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),e.invalidate(),y._package.files.readAsText("help/most-potent-residues.md").then((t=>{a.shell.windows.help.showHelp(l.markdown(t))})).catch((t=>a.log.error(t))))})),O(e);const r=e.col(d.$2.MEAN_DIFFERENCE);r.name="Diff";const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(d.$2.MONOMER);40!==t.width?(t.width=40,r.width=40):o.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(d.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(d.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(h()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const e=l.divText(p.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"}),n=this.viewerGrid.root;n.style.width="auto";const i=l.divH([e],{style:{alignSelf:"center",lineHeight:"normal"}});this.root.appendChild(l.divV([i,n])),null===(t=this.viewerGrid)||void 0===t||t.invalidate()}}function M(t,e,n,i,r){var o,s,a,l,c;const h=[...e.positionColumns.map((t=>t.name)),d.$2.MEAN_DIFFERENCE],p=t.g,m=t.bounds;p.save(),p.beginPath(),p.rect(m.x,m.y,m.width,m.height),p.clip();const g=t.cell;if(g.isRowHeader&&g.gridColumn.visible)return g.gridColumn.visible=!1,t.preventDefault(),void p.restore();const v=null===(o=g.tableColumn)||void 0===o?void 0:o.name,y=g.tableRowIndex;if(!g.isTableCell||-1===h.indexOf(v))return void p.restore();const C=g.grid.table,w=C.get(d.$2.MONOMER,y),b=v!==d.$2.MEAN_DIFFERENCE?v:C.get(d.$2.POSITION,y).toFixed(),A=e.monomerPositionStats[b];if(!A[w])return t.preventDefault(),void p.restore();if(n){const t=null!==(s=A[w].aggValue)&&void 0!==s?s:A[w].count,n=e.positionColumns.find((t=>t.name===b)),i=null!==(a=n.temp[d.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let r=u.Color.white;null!=i[w]?r=i[w]:e instanceof _&&(e.cacheInvariantMapColors(),r=null!==(c=(null!==(l=n.temp[d.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[w])&&void 0!==c?c:u.Color.white),f.rW(p,w,b,e.invariantMapSelection,t,m,r)}else f.Yd(p,w,b,e,m);t.preventDefault(),p.restore()}function O(t){const e=t.props;e.allowEdit=!1,e.allowRowSelection=!1,e.allowBlockSelection=!1,e.allowColSelection=!1,e.showRowHeader=!1,e.showCurrentRowIndicator=!1,e.showReadOnlyNotifications=!1,e.rowHeight=20}},7654:(t,e,n)=>{"use strict";n.d(e,{HV:()=>m,M1:()=>g,QD:()=>v});var i,r=n(7389),o=n(6082),s=n(7233),a=n.n(s),l=n(4139),u=n(5070),c=n(8608),h=n(5480),d=n(8774);!function(t){t.SEPARATE_MONOMERS="separateMonomers",t.SEPARATE_POSITIONS="separatePositions",t.SEPARATE_CLUSTERS="separateClusters"}(i||(i={}));const f="general",p=t=>t===f?"General":t.substring(8);function m(t,e){if(!t.selection.anyTrue)return r.divText("No distribution");const n=()=>{const n=[C(f,t,e)];for(const r of Object.values(i))"true"!==t.getTag(r)||r===i.SEPARATE_CLUSTERS&&!e.clusterColName||n.push(C(r,t,e));return 1===n.length?n[0]:r.div(n)},o=r.div(n()),s=Object.values(i),l=new Array(s.length);for(let u=0;u<s.length;u++){const c=s[u].substring(8);l[u]=r.input.bool(c,{value:"true"===t.getTag(s[u]),onValueChanged:e=>{t.setTag(s[u],`${e}`),a()(o).empty(),o.append(n())}}),a()(l[u].captionLabel).addClass("ui-label-right").css("text-align","left"),a()(l[u].root).find(".ui-input-editor").css("margin","0px"),a()(l[u].root).find(".ui-input-description").css("margin","0px"),l[u].setTooltip(`Show distribution for each ${c}`),c===i.SEPARATE_CLUSTERS?l[u].enabled=!(!e.clusterColName||!e.clusterSelection[h.W.ORIGINAL]):c!==i.SEPARATE_MONOMERS&&c!==i.SEPARATE_POSITIONS||(l[u].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const u=r.form(l);return r.divV([u,o])}function g(t,e=!1){const n=t.plot.histogram({filteringEnabled:!1,valueColumnName:l.$2.ACTIVITY,splitColumnName:l.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:e?"#fdffe5":"#fffff"});return n.root.style.width="auto",n}function v(t,e={}){var n;null!==(n=e.fractionDigits)&&void 0!==n||(e.fractionDigits=3);const i={Count:`${t.count} (${(100*t.ratio).toFixed(e.fractionDigits)}%)`,"Mean difference":t.meanDifference.toFixed(e.fractionDigits),"Mean activity":t.mean.toFixed(e.fractionDigits)};return null!=t.pValue&&(i["p-value"]=t.pValue<.01?"<0.01":t.pValue.toFixed(e.fractionDigits)),i}function y(t,e,n,i={}){const r=g((0,c.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,u.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:o.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),h=Object.assign(Object.assign({},l),s),d=(0,c.F2)(r,h,i);return a()(d).addClass("d4-flex-col"),d}function C(t,e,n){let o=r.divText("No distribution");switch(t){case f:const t=d.A.fromSeq(e.selection.length,(t=>e.selection.get(t))),s=e.selection.anyTrue&&e.selection.anyFalse?(0,u.GT)(n.activityCol.getRawData(),t):{count:n.activityCol.length,pValue:null,meanDifference:0,ratio:1,mask:t,mean:n.activityCol.stats.avg};o=y(e,s,n);break;case i.SEPARATE_CLUSTERS:o=function(t,e,n){const i=t.rowCount,o=[],s=e.activityCol.getRawData(),a=t.getCol(e.clusterColName),l=a.categories,f=a.getRawData(),p=n[h.W.ORIGINAL].map((t=>l.indexOf(t))),m=new Array(p.length).fill(new d.A(i));for(let t=0;t<i;t++){const e=f[t],n=p.indexOf(e);-1!==n&&m[n].setTrue(t)}for(let n=0;n<p.length;n++){const i=p[n],r=(0,u.GT)(s,m[n]);o.push(y(t,r,e,{[c.AN.SELECTION]:l[i]}))}const g=n[h.W.CUSTOM];for(const n of g){const r=t.getCol(n),a=d.A.fromUint32Array(i,r.getRawData()),l=(0,u.GT)(s,a);o.push(y(t,l,e,{[c.AN.SELECTION]:n}))}return r.div(o,"d4-flex-wrap")}(e,n,n.clusterSelection);break;case i.SEPARATE_MONOMERS:const a=function(t){const e={},n=Object.keys(t);for(const i of n)for(const n of t[i])e.hasOwnProperty(n)?e[n].includes(i)||e[n].push(i):e[n]=[i];return e}(n.monomerPositionSelection);o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,h=[],f=[],p=[],m=[],g=e.activityCol.getRawData();for(const r of a){const a=n[r],v=new d.A(l);for(let e=0;e<a.length;e++){const n=a[e];null!==(i=f[e])&&void 0!==i||(f[e]=t.getCol(n)),null!==(o=p[e])&&void 0!==o||(p[e]=f[e].categories),null!==(s=m[e])&&void 0!==s||(m[e]=f[e].getRawData());const u=p[e].indexOf(r);for(let t=0;t<l;t++)m[e][t]===u&&v.setTrue(t)}const C=(0,u.GT)(g,v);h.push(y(t,C,e,{[c.AN.SELECTION]:r}))}return r.div(h,"d4-flex-wrap")}(e,n,a);break;case i.SEPARATE_POSITIONS:o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,h=[],f=e.activityCol.getRawData(),p=[],m=[],g=[];for(let r=0;r<a.length;r++){const v=a[r],C=n[v];if(0===C.length)continue;null!==(i=p[r])&&void 0!==i||(p[r]=t.getCol(v)),null!==(o=m[r])&&void 0!==o||(m[r]=p[r].categories),null!==(s=g[r])&&void 0!==s||(g[r]=p[r].getRawData());const w=new d.A(t.rowCount);for(let t=0;t<C.length;t++){const e=C[t],n=m[r].indexOf(e);for(let t=0;t<l;t++)g[r][t]===n&&w.setTrue(t)}const b=(0,u.GT)(f,w);h.push(y(t,b,e,{[c.AN.SELECTION]:v}))}return r.div(h,"d4-flex-wrap")}(e,n,n.monomerPositionSelection)}return r.divV([r.h1(p(t)),o])}},7923:(t,e,n)=>{"use strict";n.d(e,{F:()=>l});var i=n(7389),r=n(6082),o=n(4139),s=n(8608),a=n(2935);function l(t,e,n=!0){const o=u(t,e);if(!o)return new r.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:c}=o,h=[a,l],d=i.divV([c.root,...h.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",c.root,d,(()=>{const n=u(t,e);return i.divV([n.aminoToInput.root,n.pairsGrid.root,n.uniqueSequencesGrid.root],{style:{width:"100%",height:"100%"}})})),new r.Widget(d)}function u(t,e){var n,l;const u=t.filter.getSelectedIndexes(),c=Object.keys(e.mutationCliffsSelection);if(!c.length||null===e.mutationCliffs)return null;const h=[],d=[],f=[],p=[],m=[],g=t.getCol(e.sequenceColumnName),v=g.categories,y=g.getRawData(),C=e.activityCol.getRawData(),w=new Map,b=r.BitSet.create(t.rowCount),A=Object.fromEntries(e.positionColumns.map((t=>[t.name,t])));for(const t of c){const i=A[t],r=i.categories,o=i.getRawData();for(const i of e.mutationCliffsSelection[t]){const s=null===(n=e.mutationCliffs.get(i))||void 0===n?void 0:n.get(t);if(void 0!==s)for(const[t,e]of s.entries()){if(!u.includes(t))continue;const n=null!==(l=w.get(t))&&void 0!==l?l:[],i=v[y[t]],s=C[t];for(const a of e){if(n.includes(a)||!u.includes(a))continue;w.has(a)||w.set(a,[]);const e=v[y[a]];w.get(a).push(t),h.push(`${i}#${e}`),d.push(s-C[a]),f.push(r[o[a]]),p.push(t),m.push(a),b.set(t,!0),b.set(a,!0)}}}}if(0===h.length)return null;const E=r.Column.fromStrings("Mutation",h),S=r.Column.fromList("double","Delta",d),T=r.Column.fromStrings("~to",f),x=r.Column.fromList(r.COLUMN_TYPE.INT,"~toIdx",m),_=r.Column.fromList(r.COLUMN_TYPE.INT,"~fromIdx",p),N=r.DataFrame.fromColumns([E,S,T,x,_]);N.name="Mutation Cliff pairs";const M=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?N.filter.init((t=>T.get(t)===e)):N.filter.setAll(!0)}});M.setTooltip("Filter the rows by the monomer that the mutation was substituted to");const O=N.plot.grid();(0,s.vY)(O,!0),E.semType=o.uF.MACROMOLECULE_DIFFERENCE,E.tags[o.gp.SEPARATOR]=(0,s.AY)(g),E.tags[r.TAGS.UNITS]=g.tags[r.TAGS.UNITS],E.tags[r.TAGS.CELL_RENDERER]="MacromoleculeDifference";let L=!1,I=null;const R=[];O.onCurrentCellChanged.subscribe((t=>{try{if(!t||!t.dart)return R.length=0,void H();const e=t.tableRowIndex;if(!L)return;if(null===e)return R.length=0,void H();null!==I&&R.splice(R.indexOf(I),1),R.includes(e)||(R.push(e),O.invalidate()),H()}finally{L=!1,I=t&&t.dart?t.tableRowIndex:null}})),O.root.addEventListener("keydown",(t=>{L=t.key.startsWith("Arrow")})),O.root.addEventListener("click",(t=>{const e=O.hitTest(t.offsetX,t.offsetY);if(!e||null===e.tableRowIndex)return;const n=e.tableRowIndex;if(t.shiftKey){const t=R.indexOf(n);-1===t?R.push(n):R.splice(t,1)}else R.length=0,R.push(n);H(),O.invalidate(),F.invalidate()})),O.onCellRender.subscribe((t=>{var e;(null===(e=t.cell.tableColumn)||void 0===e?void 0:e.name)===E.name&&R.includes(t.cell.tableRowIndex)&&(0,a.X5)(t.g,t.bounds)}));const P=e.gridColumns.length,k=[];for(let t=1;t<P;t++){const n=e.gridColumns.byIndex(t);((null==n?void 0:n.name)===e.sequenceColumnName||!0===(null==n?void 0:n.visible)&&!Object.hasOwn(A,n.name))&&k.push(n.name)}const G=t.clone(b,k);G.name="Unique sequences that form Mutation Cliffs pairs";const D=G.columns.addNewInt("~seqIdx"),U=D.getRawData(),V=b.getSelectedIndexes();D.init((t=>V[t]));const F=G.plot.grid();function H(){const t=[];for(const e of R)t.push(_.get(e)),t.push(x.get(e));G.filter.init((e=>0===R.length||t.includes(U[e])),!0),O.invalidate(),F.invalidate()}return(0,s.vY)(F,!0),F.props.rowHeight=20,O.root.style.width="100% !important",F.root.style.width="100% !important",setTimeout((()=>{O.root.style.removeProperty("width"),O.root.style.setProperty("width","100%"),F.root.style.removeProperty("width"),F.root.style.setProperty("width","100%"),O.root.style.minHeight="250px",F.root.style.minHeight="250px"}),200),{pairsGrid:O,uniqueSequencesGrid:F,aminoToInput:M}}},5082:(t,e,n)=>{"use strict";n.d(e,{n:()=>u});var i=n(4328),r=(n(7389),n(6082)),o=(n(4788),n(4139)),s=n(115),a=n(9484),l=(n(7233),n(8608),n(2003),n(4572),n(5429),function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))});function u(t,e,n,u,c,h){return l(this,arguments,void 0,(function*(t,e,n,l,u,c,h={}){var d,f,p,m,g;let v=null;if(t.type!==r.COLUMN_TYPE.FLOAT&&t.type!==r.COLUMN_TYPE.INT&&t.type!==r.COLUMN_TYPE.QNUM)return i.shell.error("The activity column must be of numeric type!"),v;const y=r.TaskBarProgressIndicator.create("Loading SAR..."),C=r.DataFrame.create(l.rowCount);C.name="Peptides analysis";const w=C.columns;w.add(u);for(const t of l.columns)"true"!==t.getTag(o.gp.ANALYSIS_COL)&&(t.name.toLowerCase()===u.name.toLowerCase()&&(t.name=l.columns.getUnusedName(t.name)),w.add(t));const b={sequenceColumnName:e.name,activityColumnName:t.name,activityScaling:c,columns:{},showDendrogram:!1,showSequenceSpace:!1,sequenceSpaceParams:new s.GI(!!h.useEmbeddingsClusters&&!n),mclSettings:null!==(d=h.mclSettings)&&void 0!==d?d:new s.av};if(n){const t=C.getCol(n.name);t.type!==r.COLUMN_TYPE.STRING&&w.replace(t,t.convertTo(r.COLUMN_TYPE.STRING))}C.setTag(o.gp.SETTINGS,JSON.stringify(b));const A=r.BitSet.create(l.rowCount,(n=>!t.isNone(n)&&!e.isNone(n)&&l.filter.get(n)));if(v=a.i.getInstance(C.clone(A)),v.init(b),n){const i={clustersColumnName:n.name,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i)}if(yield v.addMonomerPosition(),yield v.addMostPotentResidues(),null!==(f=h.addSequenceSpace)&&void 0!==f&&f){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:h.useEmbeddingsClusters}),!n&&null!==(p=h.useEmbeddingsClusters)&&void 0!==p&&p){const n=v._sequenceSpaceCols.find((t=>{var e;return v.df.col(t)&&(null===(e=v.df.col(t))||void 0===e?void 0:e.type)===r.COLUMN_TYPE.STRING}));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}}else if(null!==(m=h.addMCL)&&void 0!==m&&m&&(yield v.addMCLClusters(),!n&&null!==(g=h.useEmbeddingsClusters)&&void 0!==g&&g)){const n=v._mclCols.find((t=>(null==v?void 0:v.df.col(t))&&t.toLowerCase().startsWith("cluster")&&!t.toLowerCase().includes("size")));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}return y.close(),v}))}},5429:(t,e,n)=>{"use strict";n.d(e,{Av:()=>b,OH:()=>A,OO:()=>i});var i,r,o,s,a,l,u=n(7389),c=n(4328),h=n(6082),d=n(115),f=n(4139),p=n(9484),m=n(7233),g=n.n(m),v=n(144),y=n.n(v),C=n(3273),w=n(4572);!function(t){t.GENERAL="General",t.VIEWERS="Viewers",t.COLUMNS="Columns",t.SEQUENCE_SPACE="Sequence space",t.MCL="MCL"}(i||(i={})),function(t){t.ACTIVITY="Activity",t.ACTIVITY_SCALING="Activity scaling"}(r||(r={})),function(t){t.DENDROGRAM="Dendrogram"}(o||(o={})),function(t){t.IS_INCLUDED="",t.AGGREGATION="Aggregation"}(s||(s={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.CLUSTER_EMBEDDINGS="Cluster Embeddings",t.EPSILON="Epsilon",t.MIN_PTS="Minimum Points",t.FINGERPRINT_TYPE="Fingerprint Type"}(a||(a={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.FINGERPRINT_TYPE="Fingerprint Type",t.THRESHOLD="Similarity Threshold",t.INFLATION="Inflation Factor",t.MAX_ITERATIONS="Max Iterations",t.USE_WEBGPU="Use WebGPU",t.MIN_CLUSTER_SIZE="Min Cluster Size"}(l||(l={}));const b={[i.GENERAL]:r,[i.VIEWERS]:o,[i.COLUMNS]:s,[i.SEQUENCE_SPACE]:a,[i.MCL]:l};function A(t){var e,n,o,m,v,b,A,E,S,T;null==t.settings&&c.log.error("PeptidesError: Settings are not initialized");const x=u.accordion(),_=t.settings,N=null!==(e=null==_?void 0:_.activityScaling)&&void 0!==e?e:f.rg.NONE,M=null!==(n=null==_?void 0:_.columns)&&void 0!==n?n:{},O={},L={},I=null!==(o=null==_?void 0:_.sequenceSpaceParams)&&void 0!==o?o:new d.GI,R=null!==(m=null==_?void 0:_.mclSettings)&&void 0!==m?m:new d.av,P=u.input.column(r.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{O.activityColumnName=t.name},filter:t=>(t.type===h.TYPE.FLOAT||t.type===h.TYPE.INT)&&t.name!==f.$2.ACTIVITY&&0===t.stats.missingValueCount});P.setTooltip("Numeric activity column");const k=u.input.choice(r.ACTIVITY_SCALING,{value:N,items:Object.values(f.rg),onValueChanged:t=>O.activityScaling=t});k.setTooltip("Activity column transformation method"),x.addPane(i.GENERAL,(()=>u.inputs([P,k])),!0),L[i.GENERAL]=[P,k];const G=y()(t.analysisView.viewers).some((t=>t.type===p.q.DENDROGRAM)),D=u.input.bool(p.q.DENDROGRAM,{value:null!=G&&G,onValueChanged:t=>O.showDendrogram=t}),U=u.input.bool(p.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==_?void 0:_.showClusterMaxActivity),onValueChanged:t=>{O.showClusterMaxActivity=null!=t?t:void 0}}),V=u.input.bool("Sequence space",{value:!!(null==_?void 0:_.showSequenceSpace),onValueChanged:t=>{O.showSequenceSpace=null!=t?t:void 0,t?(ft.root.style.display="flex",(null==_?void 0:_.showSequenceSpace)||(O.sequenceSpaceParams=I)):(ft.root.style.display="none",delete O.sequenceSpaceParams),O.showSequenceSpace===(null==_?void 0:_.showSequenceSpace)&&delete O.showSequenceSpace}});U.setTooltip("Show cluster max activity viewer"),D.setTooltip("Show dendrogram viewer"),D.enabled=null!==(0,C.getTreeHelperInstance)(),x.addPane(i.VIEWERS,(()=>u.inputs([D,V,U])),!0),L[i.VIEWERS]=[D,V,U];const F=[],H=[];for(const e of t.df.columns.numerical){const t=e.name;if(t===_.activityColumnName||t===f.$2.ACTIVITY)continue;const n=u.input.bool(s.IS_INCLUDED,{value:void 0!==M[t],onValueChanged:e=>{var n;null!==(n=O.columns)&&void 0!==n||(O.columns={}),e?O.columns[t]=i.value:(delete O.columns[t],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});n.setTooltip("Include aggregated column value in tooltips, Logo Summary Table and Distribution panel");const i=u.input.choice(s.AGGREGATION,{value:null!==(v=M[t])&&void 0!==v?v:h.AGG.AVG,items:Object.values(h.STATS),onValueChanged:i=>{var r;null!==(r=O.columns)&&void 0!==r||(O.columns={}),n.value?O.columns[t]=i:(delete O.columns[e.name],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});i.setTooltip("Aggregation method"),g()(i.root).find("label").css("width","auto");const r=u.inputsRow(e.name,[n,i]);H.push(n,i),g()(r).find("div.ui-div").css("display","inline-flex"),F.push(r)}0!==F.length&&(x.addPane(i.COLUMNS,(()=>u.divV(F)),!1),L[i.COLUMNS]=H);const B={};function q(t,e){if(J(),null==e||""===e)return;B[t]=e;let n=!0;for(const[t,e]of Object.entries(B))if(e!==I[t]){n=!1;break}n?delete O.sequenceSpaceParams:O.sequenceSpaceParams=Object.assign(Object.assign({},I),B)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const $=u.input.choice(a.DISTANCE_FUNCTION,{value:I.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.HAMMING,w.Z.LEVENSHTEIN,w.Z.MONOMER_CHEMICAL_DISTANCE],onValueChanged:t=>q("distanceF",t)});$.setTooltip("Distance function for sequences");const j=u.input.float(a.GAP_OPEN,{value:I.gapOpen,onValueChanged:t=>q("gapOpen",t)}),W=u.input.float(a.GAP_EXTEND,{value:I.gapExtend,onValueChanged:t=>q("gapExtend",t)}),z=u.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(b=I.clusterEmbeddings)&&void 0!==b&&b,onValueChanged:t=>q("clusterEmbeddings",t)});z.setTooltip("Cluster embeddings using DBSCAN algorithm");const K=u.input.float(a.EPSILON,{value:I.epsilon,onValueChanged:t=>q("epsilon",t)});K.setTooltip("Epsilon parameter for DBSCAN. Minimum distance between two points to be considered as a cluster");const Q=u.input.int(a.MIN_PTS,{value:I.minPts,onValueChanged:t=>q("minPts",t)});Q.setTooltip("Minimum number of points in a cluster");const X=u.input.choice(a.FINGERPRINT_TYPE,{value:I.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>q("fingerprintType",t)});function J(){Y([j,W],$.value===w.Z.NEEDLEMANN_WUNSCH),Y([K,Q],!0===z.value),Y([X],$.value===w.Z.MONOMER_CHEMICAL_DISTANCE||$.value===w.Z.NEEDLEMANN_WUNSCH)}J();const Z={};function tt(t,e){if(et(),null==e||""===e)return;Z[t]=e;let n=!0;for(const[t,e]of Object.entries(Z))if(e!==R[t]){n=!1;break}n?delete O.mclSettings:O.mclSettings=Object.assign(Object.assign({},R),Z)}function et(){Y([it,rt],nt.value===w.Z.NEEDLEMANN_WUNSCH),Y([ot],nt.value===w.Z.MONOMER_CHEMICAL_DISTANCE||nt.value===w.Z.NEEDLEMANN_WUNSCH)}const nt=u.input.choice(l.DISTANCE_FUNCTION,{value:R.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.MONOMER_CHEMICAL_DISTANCE,w.Z.HAMMING,w.Z.LEVENSHTEIN],onValueChanged:t=>tt("distanceF",t)}),it=u.input.float(l.GAP_OPEN,{value:R.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),rt=u.input.float(l.GAP_EXTEND,{value:R.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),ot=u.input.choice(l.FINGERPRINT_TYPE,{value:R.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=u.input.int(l.THRESHOLD,{value:null!==(A=R.threshold)&&void 0!==A?A:80,onValueChanged:t=>tt("threshold",t)}),at=u.input.int(l.MAX_ITERATIONS,{value:null!==(E=R.maxIterations)&&void 0!==E?E:5,onValueChanged:t=>tt("maxIterations",t)}),lt=u.input.float(l.INFLATION,{value:null!==(S=R.inflation)&&void 0!==S?S:1.4,onValueChanged:t=>{tt("inflation",t)}}),ut=u.input.bool(l.USE_WEBGPU,{value:R.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ut.enabled=!1,R.webGPUDescriptionPromise.then((()=>{R.webGPUDescription!==d.Ku?(ut.setTooltip(`Use WebGPU for MCL algorithm (${R.webGPUDescription})`),ut.enabled=!0):(ut.setTooltip(d.Ku),ut.enabled=!1,ut.value=!1)}));const ct=u.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(T=R.minClusterSize)&&void 0!==T?T:5,onValueChanged:t=>tt("minClusterSize",t)});et();const ht=[st,nt,ot,it,rt,lt,at,ct,ut];x.addPane(i.MCL,(()=>u.inputs(ht)),!0),L[i.MCL]=ht;const dt=[$,X,j,W,z,K,Q],ft=x.addPane(i.SEQUENCE_SPACE,(()=>u.inputs(dt)),!0);L[i.SEQUENCE_SPACE]=dt,V.fireChanged();const pt=u.dialog("Peptides settings").add(x);return pt.root.style.width="400px",pt.onOK((()=>{t.settings=O})),pt.show(),{dialog:pt,accordion:x,inputs:L}}},144:function(t){var e;e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var i=n(1).default,r=n(39).default,o=n(52).default,s=n(40).default,a=n(54).default,l=n(80).default,u=n(84).default,c=n(65).default,h=t.exports=function(t){if(!p(t))throw new Error("wu: `"+t+"` is not iterable!");return new d(t)};function d(t){var e=m(t);this.next=e.next.bind(e)}h.prototype=d.prototype,h.prototype[o]=function(){return this};var f={},p=function(t){return t&&"function"==typeof t[o]},m=function(t){if(p(t))return s(t);throw new TypeError("Not iterable: "+t)},g=function(t,e){e.prototype=d.prototype,h[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=d.prototype,d.prototype[t]=e,n+=1,void(h[t]=h.curryable((function(){for(var e,n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=i.pop();return(e=h(o))[t].apply(e,i)}),n))},y=function(t){return function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return h(t.call.apply(t,[this].concat(n)))}},C=function(t,e){return g(t,y(e))},w=function(t,e,n){return v(t,y(e),n)};g("curryable",(function(t){var e=arguments.length<=1||void 0===arguments[1]?t.length:arguments[1];return function n(){for(var r=arguments.length,o=Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e?t.apply(this,o):function(t,e){return function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.call.apply(t,[this].concat(i(e),r))}}(n,o)}})),C("entries",a.mark((function t(e){var n,i,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.next()).done){t.next=12;break}return c=u.value,t.next=9,[c,e[c]];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),C("keys",a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(l(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("values",a.mark((function t(e){var n,i,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.next()).done){t.next=12;break}return c=u.value,t.next=9,e[c];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("cycle",a.mark((function t(){var e,n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.next()).done){t.next=14;break}return u=l.value,t.next=10,u;case 10:e.push(u);case 11:n=!0,t.next=6;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(4),i=!0,r=t.t0;case 20:t.prev=20,t.prev=21,!n&&o.return&&o.return();case 23:if(t.prev=23,!i){t.next=26;break}throw r;case 26:return t.finish(23);case 27:return t.finish(20);case 28:if(!e){t.next=32;break}return t.delegateYield(e,"t1",30);case 30:t.next=28;break;case 32:case"end":return t.stop()}}),t,this,[[4,16,20,28],[21,,23,27]])}))),C("count",a.mark((function t(){var e,n=arguments.length<=0||void 0===arguments[0]?0:arguments[0],i=arguments.length<=1||void 0===arguments[1]?1:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=n;case 1:return t.next=4,e;case 4:e+=i,t.next=1;break;case 7:case"end":return t.stop()}}),t,this)}))),C("repeat",a.mark((function t(e){var n,i=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i!==1/0){t.next=8;break}case 1:return t.next=4,e;case 4:t.next=1;break;case 6:t.next=15;break;case 8:n=0;case 9:if(!(n<i)){t.next=15;break}return t.next=12,e;case 12:n++,t.next=9;break;case 15:case"end":return t.stop()}}),t,this)}))),C("chain",a.mark((function t(){var e,n,i,r,o,l,u,c,h,d=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=!0,n=!1,i=void 0,t.prev=3,r=d.length,o=Array(r),l=0;l<r;l++)o[l]=d[l];u=s(o);case 6:if(e=(c=u.next()).done){t.next=12;break}return h=c.value,t.delegateYield(h,"t0",9);case 9:e=!0,t.next=6;break;case 12:t.next=18;break;case 14:t.prev=14,t.t1=t.catch(3),n=!0,i=t.t1;case 18:t.prev=18,t.prev=19,!e&&u.return&&u.return();case 21:if(t.prev=21,!n){t.next=24;break}throw i;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("chunk",a.mark((function t(){var e,n,i,r,o,l,u,c,h=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=0,i=!0,r=!1,o=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=18;break}if(c=u.value,e[n++]=c,n!==h){t.next=15;break}return t.next=13,e;case 13:e=[],n=0;case 15:i=!0,t.next=7;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(5),r=!0,o=t.t0;case 24:t.prev=24,t.prev=25,!i&&l.return&&l.return();case 27:if(t.prev=27,!r){t.next=30;break}throw o;case 30:return t.finish(27);case 31:return t.finish(24);case 32:if(!n){t.next=35;break}return t.next=35,e;case 35:case"end":return t.stop()}}),t,this,[[5,20,24,32],[25,,27,31]])})),1),w("concatMap",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.next()).done){t.next=11;break}return u=l.value,t.delegateYield(e(u),"t0",8);case 8:n=!0,t.next=5;break;case 11:t.next=17;break;case 13:t.prev=13,t.t1=t.catch(3),i=!0,r=t.t1;case 17:t.prev=17,t.prev=18,!n&&o.return&&o.return();case 20:if(t.prev=20,!i){t.next=23;break}throw r;case 23:return t.finish(20);case 24:return t.finish(17);case 25:case"end":return t.stop()}}),t,this,[[3,13,17,25],[18,,20,24]])}))),w("drop",a.mark((function t(e){var n,i,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,i=!0,r=!1,o=void 0,t.prev=4,l=s(this);case 6:if(i=(u=l.next()).done){t.next=16;break}if(c=u.value,!(n++<e)){t.next=10;break}return t.abrupt("continue",13);case 10:return t.next=12,c;case 12:return t.abrupt("break",16);case 13:i=!0,t.next=6;break;case 16:t.next=22;break;case 18:t.prev=18,t.t0=t.catch(4),r=!0,o=t.t0;case 22:t.prev=22,t.prev=23,!i&&l.return&&l.return();case 25:if(t.prev=25,!r){t.next=28;break}throw o;case 28:return t.finish(25);case 29:return t.finish(22);case 30:return t.delegateYield(this,"t1",31);case 31:case"end":return t.stop()}}),t,this,[[4,18,22,30],[23,,25,29]])}))),w("dropWhile",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=15;break}if(l=o.value,!u(l)){t.next=9;break}return t.abrupt("continue",12);case 9:return t.next=11,l;case 11:return t.abrupt("break",15);case 12:e=!0,t.next=5;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(3),n=!0,i=t.t0;case 21:t.prev=21,t.prev=22,!e&&r.return&&r.return();case 24:if(t.prev=24,!n){t.next=27;break}throw i;case 27:return t.finish(24);case 28:return t.finish(21);case 29:return t.delegateYield(this,"t1",30);case 30:case"end":return t.stop()}}),t,this,[[3,17,21,29],[22,,24,28]])})),1),w("enumerate",a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b([this,h.count()]),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),w("filter",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.value,!u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&r.return&&r.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("flatten",a.mark((function t(){var e,n,i,r,o,l,u=!(arguments.length<=0||void 0===arguments[0])&&arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=16;break}if("string"==typeof(l=o.value)||!p(l)){t.next=11;break}return t.delegateYield(u?l:h(l).flatten(),"t0",9);case 9:t.next=13;break;case 11:return t.next=13,l;case 13:e=!0,t.next=5;break;case 16:t.next=22;break;case 18:t.prev=18,t.t1=t.catch(3),n=!0,i=t.t1;case 22:t.prev=22,t.prev=23,!e&&r.return&&r.return();case 25:if(t.prev=25,!n){t.next=28;break}throw i;case 28:return t.finish(25);case 29:return t.finish(22);case 30:case"end":return t.stop()}}),t,this,[[3,18,22,30],[23,,25,29]])})),1),w("invoke",a.mark((function t(e){var n,i,r,o,l,u,c,h,d,f=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=!0,i=!1,r=void 0,t.prev=3,o=f.length,l=Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=f[u];c=s(this);case 6:if(n=(h=c.next()).done){t.next=13;break}return d=h.value,t.next=10,d[e].apply(d,l);case 10:n=!0,t.next=6;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),i=!0,r=t.t0;case 19:t.prev=19,t.prev=20,!n&&c.return&&c.return();case 22:if(t.prev=22,!i){t.next=25;break}throw r;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])}))),w("map",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.next()).done){t.next=12;break}return u=l.value,t.next=9,e(u);case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("pluck",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.next()).done){t.next=12;break}return u=l.value,t.next=9,u[e];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("reductions",a.mark((function t(e){var n,i,r,o,l,u,c,h,d,f,p,m,g=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=g)){t.next=28;break}i=!0,r=!1,o=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=14;break}return c=u.value,n=c,t.abrupt("break",14);case 11:i=!0,t.next=7;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(5),r=!0,o=t.t0;case 20:t.prev=20,t.prev=21,!i&&l.return&&l.return();case 23:if(t.prev=23,!r){t.next=26;break}throw o;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return t.next=30,n;case 30:h=!0,d=!1,f=void 0,t.prev=33,p=s(this);case 35:if(h=(m=p.next()).done){t.next=42;break}return c=m.value,t.next=39,n=e(n,c);case 39:h=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),d=!0,f=t.t1;case 48:t.prev=48,t.prev=49,!h&&p.return&&p.return();case 51:if(t.prev=51,!d){t.next=54;break}throw f;case 54:return t.finish(51);case 55:return t.finish(48);case 56:return t.abrupt("return",n);case 57:case"end":return t.stop()}}),t,this,[[5,16,20,28],[21,,23,27],[33,44,48,56],[49,,51,55]])})),2),w("reject",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.value,u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&r.return&&r.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("slice",a.mark((function t(){var e,n,i,o,l,u,c,h,d=arguments.length<=0||void 0===arguments[0]?0:arguments[0],f=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(f<d)){t.next=2;break}throw new RangeError("parameter `stop` (= "+f+") must be >= `start` (= "+d+")");case 2:e=!0,n=!1,i=void 0,t.prev=5,o=s(this.enumerate());case 7:if(e=(l=o.next()).done){t.next=20;break}if(u=r(l.value,2),c=u[0],!((h=u[1])<d)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(h>=f)){t.next=15;break}return t.abrupt("break",20);case 15:return t.next=17,c;case 17:e=!0,t.next=7;break;case 20:t.next=26;break;case 22:t.prev=22,t.t0=t.catch(5),n=!0,i=t.t0;case 26:t.prev=26,t.prev=27,!e&&o.return&&o.return();case 29:if(t.prev=29,!n){t.next=32;break}throw i;case 32:return t.finish(29);case 33:return t.finish(26);case 34:case"end":return t.stop()}}),t,this,[[5,22,26,34],[27,,29,33]])})),2),w("spreadMap",a.mark((function t(e){var n,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,r=!1,o=void 0,t.prev=3,l=s(this);case 5:if(n=(u=l.next()).done){t.next=12;break}return c=u.value,t.next=9,e.apply(void 0,i(c));case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),r=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&l.return&&l.return();case 21:if(t.prev=21,!r){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("take",a.mark((function t(e){var n,i,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e<1)){t.next=2;break}return t.abrupt("return");case 2:n=0,i=!0,r=!1,o=void 0,t.prev=6,l=s(this);case 8:if(i=(u=l.next()).done){t.next=17;break}return c=u.value,t.next=12,c;case 12:if(!(++n>=e)){t.next=14;break}return t.abrupt("break",17);case 14:i=!0,t.next=8;break;case 17:t.next=23;break;case 19:t.prev=19,t.t0=t.catch(6),r=!0,o=t.t0;case 23:t.prev=23,t.prev=24,!i&&l.return&&l.return();case 26:if(t.prev=26,!r){t.next=29;break}throw o;case 29:return t.finish(26);case 30:return t.finish(23);case 31:case"end":return t.stop()}}),t,this,[[6,19,23,31],[24,,26,30]])}))),w("takeWhile",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=14;break}if(l=o.value,u(l)){t.next=9;break}return t.abrupt("break",14);case 9:return t.next=11,l;case 11:e=!0,t.next=5;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(3),n=!0,i=t.t0;case 20:t.prev=20,t.prev=21,!e&&r.return&&r.return();case 23:if(t.prev=23,!n){t.next=26;break}throw i;case 26:return t.finish(23);case 27:return t.finish(20);case 28:case"end":return t.stop()}}),t,this,[[3,16,20,28],[21,,23,27]])})),1),w("tap",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?console.log.bind(console):arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}return l=o.value,u(l),t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&r.return&&r.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("unique",a.mark((function t(){var e,n,i,r,o,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new u,n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.next()).done){t.next=15;break}if(c=l.value,e.has(c)){t.next=12;break}return t.next=11,c;case 11:e.add(c);case 12:n=!0,t.next=6;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(4),i=!0,r=t.t0;case 21:t.prev=21,t.prev=22,!n&&o.return&&o.return();case 24:if(t.prev=24,!i){t.next=27;break}throw r;case 27:return t.finish(24);case 28:return t.finish(21);case 29:e.clear();case 30:case"end":return t.stop()}}),t,this,[[4,17,21,29],[22,,24,28]])})));var b=y(a.mark((function t(e){var n,i,r,o,l,u,c,h,d,f,p,g,v,y=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.length){t.next=2;break}return t.abrupt("return");case 2:n=e.map(m),i=e.length,r=0,o=!1;case 6:if(o){t.next=44;break}l=[],u=!0,c=!1,h=void 0,t.prev=11,d=s(n);case 13:if(u=(f=d.next()).done){t.next=26;break}if(p=f.value,g=p.next(),v=g.value,!g.done){t.next=22;break}if(y){t.next=21;break}return t.abrupt("return");case 21:++r==i&&(o=!0);case 22:void 0===v?l.length++:l.push(v);case 23:u=!0,t.next=13;break;case 26:t.next=32;break;case 28:t.prev=28,t.t0=t.catch(11),c=!0,h=t.t0;case 32:t.prev=32,t.prev=33,!u&&d.return&&d.return();case 35:if(t.prev=35,!c){t.next=38;break}throw h;case 38:return t.finish(35);case 39:return t.finish(32);case 40:return t.next=42,l;case 42:t.next=6;break;case 44:case"end":return t.stop()}}),t,this,[[11,28,32,40],[33,,35,39]])})));C("zip",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(n),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipLongest",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(n,!0),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipWith",a.mark((function t(e){for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(i).spreadMap(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),h.MAX_BLOCK=15,h.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?h.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?h.TIMEOUT:arguments[2],i=m(this);return new c((function(r,o){!function a(){var l=Date.now(),u=!0,c=!1,h=void 0;try{for(var d,f=s(i);!(u=(d=f.next()).done);u=!0){var p=d.value;try{t(p)}catch(t){return void o(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){c=!0,h=t}finally{try{!u&&f.return&&f.return()}finally{if(c)throw h}}r()}()}))}),3),v("every",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)if(!t(r.value))return!1}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}return!0}),1),v("find",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0){var a=r.value;if(t(a))return a}}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}})),v("forEach",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)t(r.value)}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}})),v("has",(function(t){return this.some((function(e){return e===t}))})),v("reduce",(function(t){var e=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];if(void 0===e){var n=!0,i=!1,r=void 0;try{for(var o,a=s(this);!(n=(o=a.next()).done);n=!0){e=o.value;break}}catch(t){i=!0,r=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw r}}}var l=!0,u=!1,c=void 0;try{for(var h,d=s(this);!(l=(h=d.next()).done);l=!0)e=t(e,h.value)}catch(t){u=!0,c=t}finally{try{!l&&d.return&&d.return()}finally{if(u)throw c}}return e}),2),v("some",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)if(t(r.value))return!0}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}return!1}),1),v("toArray",(function(){return[].concat(i(this))}));var A=y(a.mark((function t(e,n){var i,r,o,s,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n.items,r=0;case 2:if(r!==i.length){t.next=14;break}if(o=e.next(),s=o.done,l=o.value,!s){t.next=10;break}return n.returned===f&&(n.returned=l),t.abrupt("break",25);case 10:return t.next=12,i[r++]=l;case 12:t.next=23;break;case 14:if(r!==n.tail){t.next=21;break}return l=i[r],500===r?(i=n.items=i.slice(r),r=0,n.tail=0):(i[r]=void 0,n.tail=++r),t.next=19,l;case 19:t.next=23;break;case 21:return t.next=23,i[r++];case 23:t.next=2;break;case 25:return n.tail===r&&(i.length=0),t.abrupt("return",n.returned);case 27:case"end":return t.stop()}}),t,this)})));A.prototype=d.prototype,v("tee",(function(){for(var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0],e=new Array(t),n={tail:0,items:[],returned:f};t--;)e[t]=A(this,n);return e}),1),v("unzip",(function(){var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return this.tee(t).map((function(t,e){return t.pluck(e)}))}),1),h.tang={clan:36}},function(t,e,n){"use strict";var i=n(2).default;e.default=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return i(t)},e.__esModule=!0},function(t,e,n){t.exports={default:n(3),__esModule:!0}},function(t,e,n){n(4),n(26),t.exports=n(12).Array.from},function(t,e,n){"use strict";var i=n(5)(!0);n(8)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})}))},function(t,e,n){var i=n(6),r=n(7);t.exports=function(t){return function(e,n){var o,s,a=String(r(e)),l=i(n),u=a.length;return l<0||l>=u?t?"":void 0:(o=a.charCodeAt(l))<55296||o>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):o:t?a.slice(l,l+2):s-56320+(o-55296<<10)+65536}}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var i=n(9),r=n(10),o=n(13),s=n(14),a=n(19),l=n(20)("iterator"),u=n(23),c=!([].keys&&"next"in[].keys()),h="@@iterator",d="keys",f="values",p=function(){return this};t.exports=function(t,e,m,g,v,y,C){n(24)(m,e,g);var w,b,A=function(t){switch(t){case d:case f:return function(){return new m(this,t)}}return function(){return new m(this,t)}},E=e+" Iterator",S=t.prototype,T=S[l]||S[h]||v&&S[v],x=T||A(v);if(T){var _=n(15).getProto(x.call(new t));n(25)(_,E,!0),!i&&a(S,h)&&s(_,l,p)}if(i&&!C||s(S,l,x),u[e]=x,u[E]=p,v)if(w={keys:y?x:A(d),values:v==f?x:A(f),entries:v!=f?x:A("entries")},C)for(b in w)b in S||o(S,b,w[b]);else r(r.P+r.F*c,e,w)}},function(t,e){t.exports=!0},function(t,e,n){var i=n(11),r=n(12),o="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e,n){var l,u,c,h,d=t&a.G,f=t&a.P,p=d?i:t&a.S?i[e]:(i[e]||{})[o],m=d?r:r[e]||(r[e]={});for(l in d&&(n=e),n)(u=!(t&a.F)&&p&&l in p)&&l in m||(c=u?p[l]:n[l],d&&"function"!=typeof p[l]?h=n[l]:t&a.B&&u?h=s(c,i):t&a.W&&p[l]==c?function(t){(h=function(e){return this instanceof t?new t(e):t(e)})[o]=t[o]}(c):h=f&&"function"==typeof c?s(Function.call,c):c,m[l]=h,f&&((m[o]||(m[o]={}))[l]=c))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,t.exports=a},function(t,e){var n="undefined",i=t.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var n=t.exports={version:"1.2.0"};"number"==typeof __e&&(__e=n)},function(t,e,n){t.exports=n(14)},function(t,e,n){var i=n(15),r=n(16);t.exports=n(17)?function(t,e,n){return i.setDesc(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){t.exports=!n(18)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(21)("wks"),r=n(11).Symbol;t.exports=function(t){return i[t]||(i[t]=r&&r[t]||(r||n(22))("Symbol."+t))}},function(t,e,n){var i=n(11),r="__core-js_shared__",o=i[r]||(i[r]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e){var n=0,i=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+i).toString(36))}},function(t,e){t.exports={}},function(t,e,n){"use strict";var i=n(15),r={};n(14)(r,n(20)("iterator"),(function(){return this})),t.exports=function(t,e,o){t.prototype=i.create(r,{next:n(16)(1,o)}),n(25)(t,e+" Iterator")}},function(t,e,n){var i=n(19),r=n(14),o=n(20)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,e)}},function(t,e,n){"use strict";var i=n(27),r=n(10),o=n(29),s=n(30),a=n(33),l=n(34),u=n(35);r(r.S+r.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,r,c,h=o(t),d="function"==typeof this?this:Array,f=arguments[1],p=void 0!==f,m=0,g=u(h);if(p&&(f=i(f,arguments[2],2)),null==g||d==Array&&a(g))for(n=new d(e=l(h.length));e>m;m++)n[m]=p?f(h[m],m):h[m];else for(c=g.call(h),n=new d;!(r=c.next()).done;m++)n[m]=p?s(c,f,[r.value,m],!0):r.value;return n.length=m,n}})},function(t,e,n){var i=n(28);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var i=n(7);t.exports=function(t){return Object(i(t))}},function(t,e,n){var i=n(31);t.exports=function(t,e,n,r){try{return r?e(i(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&i(o.call(t)),e}}},function(t,e,n){var i=n(32);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var i=n(23),r=n(20)("iterator");t.exports=function(t){return(i.Array||Array.prototype[r])===t}},function(t,e,n){var i=n(6),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(36),r=n(20)("iterator"),o=n(23);t.exports=n(12).getIteratorMethod=function(t){if(null!=t)return t[r]||t["@@iterator"]||o[i(t)]}},function(t,e,n){var i=n(37),r=n(20)("toStringTag"),o="Arguments"==i(function(){return arguments}());t.exports=function(t){var e,n,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=(e=Object(t))[r])?n:o?i(e):"Object"==(s=i(e))&&"function"==typeof e.callee?"Arguments":s}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var i=n(20)("iterator"),r=!1;try{var o=[7][i]();o.return=function(){r=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t){if(!r)return!1;var e=!1;try{var n=[7],o=n[i]();o.next=function(){e=!0},n[i]=function(){return o},t(n)}catch(t){}return e}},function(t,e,n){"use strict";var i=n(40).default,r=n(49).default;e.default=function(t,e){if(Array.isArray(t))return t;if(r(Object(t)))return function(t,e){var n=[],r=!0,o=!1,s=void 0;try{for(var a,l=i(t);!(r=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(o)throw s}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},e.__esModule=!0},function(t,e,n){t.exports={default:n(41),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(48)},function(t,e,n){n(43);var i=n(23);i.NodeList=i.HTMLCollection=i.Array},function(t,e,n){"use strict";var i=n(44),r=n(45),o=n(23),s=n(46);n(8)(Array,"Array",(function(t,e){this._t=s(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,r(1)):r(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var i=n(47),r=n(7);t.exports=function(t){return i(r(t))}},function(t,e,n){var i=n(37);t.exports=0 in Object("z")?Object:function(t){return"String"==i(t)?t.split(""):Object(t)}},function(t,e,n){var i=n(31),r=n(35);t.exports=n(12).getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},function(t,e,n){t.exports={default:n(50),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(51)},function(t,e,n){var i=n(36),r=n(20)("iterator"),o=n(23);t.exports=n(12).isIterable=function(t){var e=Object(t);return r in e||"@@iterator"in e||o.hasOwnProperty(i(e))}},function(t,e,n){t.exports={default:n(53),__esModule:!0}},function(t,e,n){n(4),n(42),t.exports=n(20)("iterator")},function(t,e,n){(function(e){var i="object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:this,r=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,o=r&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n(55),r)i.regeneratorRuntime=o;else try{delete i.regeneratorRuntime}catch(t){i.regeneratorRuntime=void 0}t.exports={default:t.exports,__esModule:!0}}).call(e,function(){return this}())},function(t,e,n){(function(e,i){"use strict";var r=n(57).default,o=n(52).default,s=n(63).default,a=n(65).default;!function(e){var n,l=Object.prototype.hasOwnProperty,u="function"==typeof r&&o||"@@iterator",c="object"==typeof t,h=e.regeneratorRuntime;if(h)c&&(t.exports=h);else{(h=e.regeneratorRuntime=c?t.exports:{}).wrap=y;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",g={},v=A.prototype=w.prototype;b.prototype=v.constructor=A,A.constructor=b,b.displayName="GeneratorFunction",h.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},h.mark=function(t){return t.__proto__=A,t.prototype=s(v),t},h.awrap=function(t){return new S(t)},E(T.prototype),h.async=function(t,e,n,i){var r=new T(y(t,e,n,i));return h.isGeneratorFunction(e)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},E(v),v[u]=function(){return this},v.toString=function(){return"[object Generator]"},h.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},h.values=M,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=n,this.done=!1,this.delegate=null,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return o.type="throw",o.arg=t,e.next=n,!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var s=l.call(r,"catchLoc"),a=l.call(r,"finallyLoc");if(s&&a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(s){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&l.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?this.next=r.finallyLoc:this.complete(o),g},complete:function(t,e){if("throw"===t.type)throw t.arg;"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=t.arg,this.next="end"):"normal"===t.type&&e&&(this.next=e)},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;_(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:M(t),resultName:e,nextLoc:n},g}}}function y(t,e,i,r){var o=s((e||w).prototype);return o._invoke=function(t,e,i){var r=d;return function(o,s){if(r===p)throw new Error("Generator is already running");if(r===m){if("throw"===o)throw s;return O()}for(;;){var a=i.delegate;if(a){if("return"===o||"throw"===o&&a.iterator[o]===n){i.delegate=null;var l=a.iterator.return;if(l&&"throw"===(u=C(l,a.iterator,s)).type){o="throw",s=u.arg;continue}if("return"===o)continue}var u;if("throw"===(u=C(a.iterator[o],a.iterator,s)).type){i.delegate=null,o="throw",s=u.arg;continue}if(o="next",s=n,!(c=u.arg).done)return r=f,c;i[a.resultName]=c.value,i.next=a.nextLoc,i.delegate=null}if("next"===o)i.sent=r===f?s:n;else if("throw"===o){if(r===d)throw r=m,s;i.dispatchException(s)&&(o="next",s=n)}else"return"===o&&i.abrupt("return",s);if(r=p,"normal"===(u=C(t,e,i)).type){r=i.done?m:f;var c={value:u.arg,done:i.done};if(u.arg!==g)return c;i.delegate&&"next"===o&&(s=n)}else"throw"===u.type&&(r=m,o="throw",s=u.arg)}}}(t,i||null,new N(r||[])),o}function C(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function w(){}function b(){}function A(){}function E(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function S(t){this.arg=t}function T(t){function e(e,n){var i=t[e](n),s=i.value;return s instanceof S?a.resolve(s.arg).then(r,o):a.resolve(s).then((function(t){return i.value=t,i}))}"object"==typeof i&&i.domain&&(e=i.domain.bind(e));var n,r=e.bind(t,"next"),o=e.bind(t,"throw");e.bind(t,"return"),this._invoke=function(t,i){var r=n?n.then((function(){return e(t,i)})):new a((function(n){n(e(t,i))}));return n=r.catch((function(t){})),r}}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function M(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i<t.length;)if(l.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return r.next=r}}return{next:O}}function O(){return{value:n,done:!0}}}("object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:void 0)}).call(e,function(){return this}(),n(56))},function(t,e){var n,i=t.exports={},r=[],o=!1,s=-1;function a(){o=!1,n.length?r=n.concat(r):s=-1,r.length&&l()}function l(){if(!o){var t=setTimeout(a);o=!0;for(var e=r.length;e;){for(n=r,r=[];++s<e;)n&&n[s].run();s=-1,e=r.length}n=null,o=!1,clearTimeout(t)}}function u(t,e){this.fun=t,this.array=e}function c(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];r.push(new u(t,e)),1!==r.length||o||setTimeout(l,0)},u.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=c,i.addListener=c,i.once=c,i.off=c,i.removeListener=c,i.removeAllListeners=c,i.emit=c,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){t.exports={default:n(58),__esModule:!0}},function(t,e,n){n(59),t.exports=n(12).Symbol},function(t,e,n){"use strict";var i=n(15),r=n(11),o=n(19),s=n(17),a=n(10),l=n(13),u=n(18),c=n(21),h=n(25),d=n(22),f=n(20),p=n(60),m=n(61),g=n(62),v=n(32),y=n(31),C=n(46),w=n(16),b=i.getDesc,A=i.setDesc,E=i.create,S=m.get,T=r.Symbol,x=!1,_=f("_hidden"),N=i.isEnum,M=c("symbol-registry"),O=c("symbols"),L="function"==typeof T,I=Object.prototype,R=s&&u((function(){return 7!=E(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a}))?function(t,e,n){var i=b(I,e);i&&delete I[e],A(t,e,n),i&&t!==I&&A(I,e,i)}:A,P=function(t){var e=O[t]=E(T.prototype);return e._k=t,s&&x&&R(I,t,{configurable:!0,set:function(e){o(this,_)&&o(this[_],t)&&(this[_][t]=!1),R(this,t,w(1,e))}}),e},k=function(t,e,n){return n&&o(O,e)?(n.enumerable?(o(t,_)&&t[_][e]&&(t[_][e]=!1),n=E(n,{enumerable:w(0,!1)})):(o(t,_)||A(t,_,w(1,{})),t[_][e]=!0),R(t,e,n)):A(t,e,n)},G=function(t,e){y(t);for(var n,i=g(e=C(e)),r=0,o=i.length;o>r;)k(t,n=i[r++],e[n]);return t},D=function(t,e){return void 0===e?E(t):G(E(t),e)},U=function(t){var e=N.call(this,t);return!(e||!o(this,t)||!o(O,t)||o(this,_)&&this[_][t])||e},V=function(t,e){var n=b(t=C(t),e);return!n||!o(O,e)||o(t,_)&&t[_][e]||(n.enumerable=!0),n},F=function(t){for(var e,n=S(C(t)),i=[],r=0;n.length>r;)o(O,e=n[r++])||e==_||i.push(e);return i},H=function(t){for(var e,n=S(C(t)),i=[],r=0;n.length>r;)o(O,e=n[r++])&&i.push(O[e]);return i};L||(T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor");return P(d(arguments[0]))},l(T.prototype,"toString",(function(){return this._k})),i.create=D,i.isEnum=U,i.getDesc=V,i.setDesc=k,i.setDescs=G,i.getNames=m.get=F,i.getSymbols=H,s&&!n(9)&&l(I,"propertyIsEnumerable",U,!0)),L&&!u((function(){return"[null]"!=JSON.stringify([T()])}))||l(T.prototype,"toJSON",(function(){if(L&&v(this))return this}));var B={for:function(t){return o(M,t+="")?M[t]:M[t]=T(t)},keyFor:function(t){return p(M,t)},useSetter:function(){x=!0},useSimple:function(){x=!1}};i.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),(function(t){var e=f(t);B[t]=L?e:P(e)})),x=!0,a(a.G+a.W,{Symbol:T}),a(a.S,"Symbol",B),a(a.S+a.F*!L,"Object",{create:D,defineProperty:k,defineProperties:G,getOwnPropertyDescriptor:V,getOwnPropertyNames:F,getOwnPropertySymbols:H}),h(T,"Symbol"),h(Math,"Math",!0),h(r.JSON,"JSON",!0)},function(t,e,n){var i=n(15),r=n(46);t.exports=function(t,e){for(var n,o=r(t),s=i.getKeys(o),a=s.length,l=0;a>l;)if(o[n=s[l++]]===e)return n}},function(t,e,n){var i={}.toString,r=n(46),o=n(15).getNames,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.get=function(t){return s&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return s.slice()}}(t):o(r(t))}},function(t,e,n){var i=n(15);t.exports=function(t){var e=i.getKeys(t),n=i.getSymbols;if(n)for(var r,o=n(t),s=i.isEnum,a=0;o.length>a;)s.call(t,r=o[a++])&&e.push(r);return e}},function(t,e,n){t.exports={default:n(64),__esModule:!0}},function(t,e,n){var i=n(15);t.exports=function(t,e){return i.create(t,e)}},function(t,e,n){t.exports={default:n(66),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(68),t.exports=n(12).Promise},function(t,e){},function(t,e,n){"use strict";var i,r=n(15),o=n(9),s=n(11),a=n(27),l=n(36),u=n(10),c=n(32),h=n(31),d=n(28),f=n(69),p=n(70),m=n(71).set,g=n(72),v=n(73),y=n(20)("species"),C=n(22)("record"),w=n(74),b="Promise",A=s.process,E="process"==l(A),S=s[b],T=function(t){var e=new S((function(){}));return t&&(e.constructor=Object),S.resolve(e)===e},x=function(){var t=!1;function e(t){var n=new S(t);return m(n,e.prototype),n}try{if(t=S&&S.resolve&&T(),m(e,S),e.prototype=r.create(S.prototype,{constructor:{value:e}}),e.resolve(5).then((function(){}))instanceof e||(t=!1),t&&n(17)){var i=!1;S.resolve(r.setDesc({},"then",{get:function(){i=!0}})),t=i}}catch(e){t=!1}return t}(),_=function(t){var e=h(t)[y];return null!=e?e:t},N=function(t){var e;return!(!c(t)||"function"!=typeof(e=t.then))&&e},M=function(t,e){if(!t.n){t.n=!0;var n=t.c;w((function(){for(var i=t.v,r=1==t.s,o=0,a=function(e){var n,o,s=r?e.ok:e.fail;try{s?(r||(t.h=!0),(n=!0===s?i:s(i))===e.P?e.rej(TypeError("Promise-chain cycle")):(o=N(n))?o.call(n,e.res,e.rej):e.res(n)):e.rej(i)}catch(t){e.rej(t)}};n.length>o;)a(n[o++]);n.length=0,t.n=!1,e&&setTimeout((function(){var e,n,r=t.p;O(r)&&(E?A.emit("unhandledRejection",i,r):(e=s.onunhandledrejection)?e({promise:r,reason:i}):(n=s.console)&&n.error&&n.error("Unhandled promise rejection",i)),t.a=void 0}),1)}))}},O=function(t){var e,n=t[C],i=n.a||n.c,r=0;if(n.h)return!1;for(;i.length>r;)if((e=i[r++]).fail||!O(e.P))return!1;return!0},L=function(t){var e=this;e.d||(e.d=!0,(e=e.r||e).v=t,e.s=2,e.a=e.c.slice(),M(e,!0))},I=function(t){var e,n=this;if(!n.d){n.d=!0,n=n.r||n;try{(e=N(t))?w((function(){var i={r:n,d:!1};try{e.call(t,a(I,i,1),a(L,i,1))}catch(t){L.call(i,t)}})):(n.v=t,n.s=1,M(n,!1))}catch(t){L.call({r:n,d:!1},t)}}};x||(S=function(t){d(t);var e={p:f(this,S,b),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};this[C]=e;try{t(a(I,e,1),a(L,e,1))}catch(t){L.call(e,t)}},n(79)(S.prototype,{then:function(t,e){var n=h(h(this).constructor)[y],i={ok:"function"!=typeof t||t,fail:"function"==typeof e&&e},r=i.P=new(null!=n?n:S)((function(t,e){i.res=t,i.rej=e}));d(i.res),d(i.rej);var o=this[C];return o.c.push(i),o.a&&o.a.push(i),o.s&&M(o,!1),r},catch:function(t){return this.then(void 0,t)}})),u(u.G+u.W+u.F*!x,{Promise:S}),n(25)(S,b),v(S),v(i=n(12)[b]),u(u.S+u.F*!x,b,{reject:function(t){return new this((function(e,n){n(t)}))}}),u(u.S+u.F*(!x||T(!0)),b,{resolve:function(t){return c(n=t)&&(x?"Promise"==l(n):C in n)&&(e=t.constructor,o&&e===S&&this===i||g(e,this))?t:new this((function(e){e(t)}));var e,n}}),u(u.S+u.F*!(x&&n(38)((function(t){S.all(t).catch((function(){}))}))),b,{all:function(t){var e=_(this),n=[];return new e((function(i,o){p(t,!1,n.push,n);var s=n.length,a=Array(s);s?r.each.call(n,(function(t,n){e.resolve(t).then((function(t){a[n]=t,--s||i(a)}),o)})):i(a)}))},race:function(t){var e=_(this);return new e((function(n,i){p(t,!1,(function(t){e.resolve(t).then(n,i)}))}))}})},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError(n+": use the 'new' operator!");return t}},function(t,e,n){var i=n(27),r=n(30),o=n(33),s=n(31),a=n(34),l=n(35);t.exports=function(t,e,n,u){var c,h,d,f=l(t),p=i(n,u,e?2:1),m=0;if("function"!=typeof f)throw TypeError(t+" is not iterable!");if(o(f))for(c=a(t.length);c>m;m++)e?p(s(h=t[m])[0],h[1]):p(t[m]);else for(d=f.call(t);!(h=d.next()).done;)r(d,p,h.value,e)}},function(t,e,n){var i=n(15).getDesc,r=n(32),o=n(31),s=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(27)(Function.call,i(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return s(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:s}},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,n){"use strict";var i=n(15),r=n(20)("species");t.exports=function(t){n(17)&&!(r in t)&&i.setDesc(t,r,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i,r,o,s=n(11),a=n(75).set,l=s.MutationObserver||s.WebKitMutationObserver,u=s.process,c="process"==n(37)(u),h=function(){var t,e;for(c&&(t=u.domain)&&(u.domain=null,t.exit());i;)(e=i.domain)&&e.enter(),i.fn.call(),e&&e.exit(),i=i.next;r=void 0,t&&t.enter()};if(c)o=function(){u.nextTick(h)};else if(l){var d=1,f=document.createTextNode("");new l(h).observe(f,{characterData:!0}),o=function(){f.data=d=-d}}else o=function(){a.call(s,h)};t.exports=function(t){var e={fn:t,next:void 0,domain:c&&u.domain};r&&(r.next=e),i||(i=e,o()),r=e}},function(t,e,n){"use strict";var i,r,o,s=n(27),a=n(76),l=n(77),u=n(78),c=n(11),h=c.process,d=c.setImmediate,f=c.clearImmediate,p=c.MessageChannel,m=0,g={},v="onreadystatechange",y=function(){var t=+this;if(g.hasOwnProperty(t)){var e=g[t];delete g[t],e()}},C=function(t){y.call(t.data)};d&&f||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return g[++m]=function(){a("function"==typeof t?t:Function(t),e)},i(m),m},f=function(t){delete g[t]},"process"==n(37)(h)?i=function(t){h.nextTick(s(y,t,1))}:p?(o=(r=new p).port2,r.port1.onmessage=C,i=s(o.postMessage,o,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScript?(i=function(t){c.postMessage(t+"","*")},c.addEventListener("message",C,!1)):i=v in u("script")?function(t){l.appendChild(u("script"))[v]=function(){l.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:d,clear:f}},function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){t.exports=n(11).document&&document.documentElement},function(t,e,n){var i=n(32),r=n(11).document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.createElement(t):{}}},function(t,e,n){var i=n(13);t.exports=function(t,e){for(var n in e)i(t,n,e[n]);return t}},function(t,e,n){t.exports={default:n(81),__esModule:!0}},function(t,e,n){n(82),t.exports=n(12).Object.keys},function(t,e,n){var i=n(29);n(83)("keys",(function(t){return function(e){return t(i(e))}}))},function(t,e,n){t.exports=function(t,e){var i=n(10),r=(n(12).Object||{})[t]||Object[t],o={};o[t]=e(r),i(i.S+i.F*n(18)((function(){r(1)})),"Object",o)}},function(t,e,n){t.exports={default:n(85),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(86),n(89),t.exports=n(12).Set},function(t,e,n){"use strict";var i=n(87);n(88)("Set",(function(t){return function(){return t(this,arguments[0])}}),{add:function(t){return i.def(this,t=0===t?0:t,t)}},i)},function(t,e,n){"use strict";var i=n(15),r=n(14),o=n(27),s=n(73),a=n(69),l=n(7),u=n(70),c=n(45),h=n(22)("id"),d=n(19),f=n(32),p=Object.isExtensible||f,m=n(17),g=m?"_s":"size",v=0,y=function(t,e){if(!f(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!d(t,h)){if(!p(t))return"F";if(!e)return"E";r(t,h,++v)}return"O"+t[h]},C=function(t,e){var n,i=y(e);if("F"!==i)return t._i[i];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,r,s){var c=t((function(t,n){a(t,c,e),t._i=i.create(null),t._f=void 0,t._l=void 0,t[g]=0,null!=n&&u(n,r,t[s],t)}));return n(79)(c.prototype,{clear:function(){for(var t=this,e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[g]=0},delete:function(t){var e=this,n=C(e,t);if(n){var i=n.n,r=n.p;delete e._i[n.i],n.r=!0,r&&(r.n=i),i&&(i.p=r),e._f==n&&(e._f=i),e._l==n&&(e._l=r),e[g]--}return!!n},forEach:function(t){for(var e,n=o(t,arguments[1],3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!C(this,t)}}),m&&i.setDesc(c.prototype,"size",{get:function(){return l(this[g])}}),c},def:function(t,e,n){var i,r,o=C(t,e);return o?o.v=n:(t._l=o={i:r=y(e,!0),k:e,v:n,p:i=t._l,n:void 0,r:!1},t._f||(t._f=o),i&&(i.n=o),t[g]++,"F"!==r&&(t._i[r]=o)),t},getEntry:C,setStrong:function(t,e,i){n(8)(t,e,(function(t,e){this._t=t,this._k=e,this._l=void 0}),(function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?c(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,c(1))}),i?"entries":"values",!i,!0),s(t),s(n(12)[e])}}},function(t,e,n){"use strict";var i=n(15),r=n(10),o=n(14),s=n(70),a=n(69);t.exports=function(t,e,l,u,c,h){var d=n(11)[t],f=d,p=c?"set":"add",m=f&&f.prototype,g={};return n(17)&&"function"==typeof f&&(h||m.forEach&&!n(18)((function(){(new f).entries().next()})))?(f=e((function(e,n){a(e,f,t),e._c=new d,null!=n&&s(n,c,e[p],e)})),i.each.call("add,clear,delete,forEach,get,has,set,keys,values,entries".split(","),(function(t){var e="add"==t||"set"==t;!(t in m)||h&&"clear"==t||o(f.prototype,t,(function(n,i){var r=this._c[t](0===n?0:n,i);return e?this:r}))})),"size"in m&&i.setDesc(f.prototype,"size",{get:function(){return this._c.size}})):(f=u.getConstructor(e,t,c,p),n(79)(f.prototype,l)),n(25)(f,t),g[t]=f,r(r.G+r.W+r.F,g),h||u.setStrong(f,t,c),f}},function(t,e,n){var i=n(10);i(i.P,"Set",{toJSON:n(90)("Set")})},function(t,e,n){var i=n(70),r=n(36);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");var e=[];return i(this,!1,e.push,e),e}}}])},t.exports=e()},6082:t=>{"use strict";t.exports=DG},4328:t=>{"use strict";t.exports=grok},1858:t=>{"use strict";t.exports=rxjs},7389:t=>{"use strict";t.exports=ui}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.m=t,n.amdO={},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=i[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};(()=>{"use strict";n.r(i),n.d(i,{_package:()=>I,initAutoTests:()=>P,test:()=>R,tests:()=>e.CN});var t=n(6082),e=n(8070),r=n(4328),o=n(5082),s=n(9484),a=n(4139),l=n(8608),u=n(2003),c=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Core",(()=>{const n="AlignedSequence";let i=null;(0,e.t6)("Start analysis: simple",(()=>c(void 0,void 0,void 0,(function*(){const r=t.DataFrame.fromCsv(yield I.files.readAsText("aligned.csv")),c=r.getCol("IC50"),h=r.getCol(n);h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(a.gp.ALPHABET,u.YI.PT),h.setTag(t.TAGS.UNITS,u.Hi.FASTA),h.setTag(u.gp.aligned,"SEQ.MSA");const d=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,o.n)(c,h,null,r,d,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={11:["D"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Start analysis: сomplex",(()=>c(void 0,void 0,void 0,(function*(){const n=t.DataFrame.fromCsv(yield I.files.readAsText("aligned_2.csv")),r=n.getCol("Activity"),c=n.getCol("MSA");c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(a.gp.ALPHABET,u.YI.UN),c.setTag(t.TAGS.UNITS,u.Hi.SEPARATOR),c.setTag(u.gp.aligned,"SEQ.MSA"),c.setTag(a.gp.SEPARATOR,"/");const h=(0,l.Y1)(r,a.rg.MINUS_LG);i=yield(0,o.n)(r,c,null,n,h,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={13:["-"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Save and load project",(()=>c(void 0,void 0,void 0,(function*(){const s=t.DataFrame.fromCsv(yield I.files.readAsText("aligned.csv")),c=s.getCol("IC50"),h=s.getCol(n);h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(a.gp.ALPHABET,u.YI.PT),h.setTag(t.TAGS.UNITS,u.Hi.FASTA),h.setTag(u.gp.aligned,"SEQ.MSA");const d=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,o.n)(c,h,null,s,d,a.rg.MINUS_LG);let f=r.shell.getTableView("Peptides analysis");const p=f.dataFrame,m=f.saveLayout(),g=p.getTableInfo(),v=t.Project.create();v.name="Peptides project unique test",v.addChild(g),v.addChild(m);const y=yield r.dapi.layouts.save(m);yield r.dapi.tables.uploadDataFrame(p);const C=yield r.dapi.tables.save(g),w=yield r.dapi.projects.save(v);f.close(),yield(0,e.bk)((()=>void 0===r.shell.tableView("Peptides analysis")),"Table never closed",3e3),yield w.open(),f=r.shell.getTableView("Peptides analysis"),yield r.dapi.layouts.delete(y),yield r.dapi.tables.delete(C),yield r.dapi.projects.delete(w)}))),{skipReason:"ViewLayout should become ViewInfo in 1.18."})}),{clear:!0});var h=n(3657),d=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const f=[5,50,100,200];function p(e){return d(this,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const n=(yield I.files.readBinaryDataFrames(`tests/${e}k.d42`))[0],i=n.getCol("activity").getRawData(),r=[];let o=1;for(;null!==n.col(o.toString());){const t=n.getCol(o.toString());r.push({name:t.name,rawData:t.getRawData(),cat:t.categories}),++o}yield t.timeAsync("Mutation Cliffs",(()=>d(this,void 0,void 0,(function*(){return yield(0,h.uz)(i,r)}))))}))}(0,e.L1)("Benchmarks: Mutation Cliffs",(()=>{for(const t of f)(0,e.t6)(`${t}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){return yield p(t)}))),{timeout:3e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Cluster stats",(()=>{for(const n of f)(0,e.t6)(`${n}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield I.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(i.name.toLowerCase())&&e.columns.remove(i.name),e.columns.add(i),t.time(`Cluster stats benchmark - ${n}k`,(()=>(0,h.eW)(e,"cluster",[],i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Monomer-Position stats",(()=>{for(const n of f)(0,e.t6)(`${n}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield I.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=[];let r=1;for(;null!==e.col(r.toString());)i.push(e.getCol(r.toString())),++r;const o=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(o.name.toLowerCase())&&e.columns.remove(o.name),e.columns.add(o),t.time(`Monomer-Position stats benchmark - ${n}k`,(()=>(0,h.Ej)(o,t.BitSet.create(0),i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Analysis start",(()=>{for(const n of f)(0,e.t6)(`${n}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const e=(yield I.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=e.getCol("activity"),s=(0,l.Y1)(i,a.rg.NONE),c=e.getCol("cluster"),h=e.getCol("sequence");h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(t.TAGS.UNITS,n===f[0]?u.Hi.HELM:u.Hi.FASTA),yield t.timeAsync("Analysis start",(()=>d(void 0,void 0,void 0,(function*(){const t=yield(0,o.n)(i,h,c,e,s,a.rg.NONE);t&&r.shell.closeTable(t.df)}))))}))),{timeout:1e5})}),{benchmarks:!0});var m,g=n(3541),v=n(5480),y=n(4326);!function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.CLUSTER="cluster"}(m||(m={}));var C=n(912),w=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Viewers: Basic",(()=>{let n;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),yield(0,e.cb)(500)}))));const i=t.Func.find({package:"Peptides",tags:["viewer"]}).map((t=>t.friendlyName));for(const t of i)(0,e.t6)(t,(()=>w(void 0,void 0,void 0,(function*(){yield(0,e.Bl)(t,n.clone(),{detectSemanticTypes:!0,arbitraryDfTest:!1,readOnly:!0}),yield(0,e.cb)(1e3)}))))})),(0,e.L1)("Viewers: Monomer-Position",(()=>{let n,i,r,c,h,d,f;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const p=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===p)throw new Error("Model is null");i=p,f=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>w(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>w(void 0,void 0,void 0,(function*(){const t=f.viewerGrid.cell("9",6),n=f.getMonomerPosition(t);(0,e.E3)((0,C.DK)(i.df,r,Object.entries(i.settings.columns),{monomerPosition:n,x:0,y:0,mpStats:i.monomerPositionStats}),!0,"Tooltip is not shown for grid cell at column '9', row 6")})))),(0,e.t6)("Modes",(()=>w(void 0,void 0,void 0,(function*(){if(null===f)throw new Error("Monomer-Position viewer doesn't exist");(0,e.E3)(f.mode,g.ds.MUTATION_CLIFFS,`Default Monomer-Position mode is not ${g.ds.MUTATION_CLIFFS}`),f.mode=g.ds.INVARIANT_MAP,(0,e.E3)(f.mode,g.ds.INVARIANT_MAP,`Monomer-Position mode is not ${g.ds.INVARIANT_MAP} after switching`),f.mode=g.ds.MUTATION_CLIFFS,(0,e.E3)(f.mode,g.ds.MUTATION_CLIFFS,`Monomer-Position mode is not ${g.ds.MUTATION_CLIFFS} after switching`)}))))}),{clear:!1}),(0,e.L1)("Viewers: Most Potent Residues",(()=>{let n,i,r,c,h,d,f;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const p=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===p)throw new Error("Model is null");i=p,f=i.findViewer(s.q.MOST_POTENT_RESIDUES),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>w(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>w(void 0,void 0,void 0,(function*(){const t="Diff",n=f.viewerGrid.cell(t,6),o=f.getMonomerPosition(n);(0,e.E3)((0,C.DK)(i.df,r,Object.entries(i.settings.columns),{monomerPosition:o,x:0,y:0,mpStats:i.monomerPositionStats}),!0,`Tooltip is not shown for grid cell at column '${t}', row 6`)}))))})),(0,e.L1)("Viewers: Logo Summary Table",(()=>{let n,i,r,c,h,d,f;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const p=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===p)throw new Error("Model is null");i=p,f=i.findViewer(s.q.LOGO_SUMMARY_TABLE),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>w(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Properties",(()=>w(void 0,void 0,void 0,(function*(){f.getProperty("webLogoMode").set(f,y.fH.full),(0,e.E3)(f.webLogoMode,y.fH.full,`Web Logo Mode property is not changed to ${y.fH.full}, got ${f.webLogoMode} instead`),f.getProperty("membersRatioThreshold").set(f,0),(0,e.E3)(f.membersRatioThreshold,0,`Members Ratio Threshold property is not changed to 0, got ${f.membersRatioThreshold} instead`),(0,e.E3)(f.viewerGrid.table.filter.anyTrue,!0,`Expected to filter out all rows, but ${f.viewerGrid.table.filter.trueCount} rows are left unfiltered`)})))),(0,e.t6)("Tooltip",(()=>w(void 0,void 0,void 0,(function*(){const t=f.showTooltip({monomerOrCluster:"0",positionOrClusterType:v.W.ORIGINAL},0,0);(0,e.E3)(null!==t,!0,"Tooltip is not shown for cluster '0'")}))))}),{clear:!1});var b=n(5429),A=n(7654),E=n(7923),S=n(144),T=n.n(S),x=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Widgets: Settings",(()=>{let n,i,r,s,c,h;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),s=n.getCol(m.SEQUENCE),s.semType=t.SEMTYPE.MACROMOLECULE,s.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(r,a.rg.NONE),c=n.getCol(m.CLUSTER);const d=yield(0,o.n)(r,s,c,n,h,a.rg.NONE);if(null===d)throw new Error("Model is null");i=d,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>x(void 0,void 0,void 0,(function*(){const t=(0,b.OH)(i),n=t.accordion.panes.map((t=>t.name));(0,e.E3)(n.length,5,`Expected 5 panes, got ${t.accordion.panes.length}`);for(const t of Object.values(b.OO))(0,e.E3)(n.includes(t),!0,`Pane ${t} is missing`);for(const n of Object.values(b.OO)){const i=t.inputs[n].map((t=>t.caption));for(const t of Object.values(b.Av[n]))(0,e.E3)(i.includes(t),!0,`Input ${t} is missing from ${n}`)}}))))})),(0,e.L1)("Widgets: Distribution panel",(()=>{let n,i,r,c,h,d;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>x(void 0,void 0,void 0,(function*(){i.df.selection.set(0,!0),yield(0,e.cb)(1e3);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,A.HV)(i.df,{peptideSelection:t.BitSet.create(i.df.rowCount),columns:i.settings.columns,activityCol:d,clusterSelection:n.clusterSelection,clusterColName:h.name,monomerPositionSelection:i.webLogoSelection})}))))})),(0,e.L1)("Widgets: Mutation cliffs",(()=>{let n,i,r,c,h,d;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>x(void 0,void 0,void 0,(function*(){var t;const n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);n.keyPressed=!0,n._viewerGrid.dataFrame.currentCell=null===(t=n._viewerGrid)||void 0===t?void 0:t.dataFrame.cell(0,"1"),yield(0,e.cb)(1e3),(0,E.F)(i.df,{mutationCliffs:n.mutationCliffs,mutationCliffsSelection:n.mutationCliffsSelection,gridColumns:i.analysisView.grid.columns,sequenceColumnName:n.sequenceColumnName,positionColumns:n.positionColumns,activityCol:d})}))))})),(0,e.L1)("Widgets: Actions",(()=>{let n,i,c,h,d,f;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),yield n.meta.detectSemanticTypes(),c=n.getCol(m.ACTIVITY),h=n.getCol(m.SEQUENCE),h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(c,a.rg.NONE),d=n.getCol(m.CLUSTER);const r=yield(0,o.n)(c,h,d,n,f,a.rg.NONE);if(null===r)throw new Error("Model is null");i=r,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("New view",(()=>x(void 0,void 0,void 0,(function*(){const n=i.df.filter;n.setAll(!1,!1),n.set(0,!0,!1),n.set(1,!0,!1);const o=i.df.selection;o.set(0,!0,!1),o.set(1,!0,!1);const l=i.createNewView(),u=r.shell.t;(0,e.E3)(u.getTag(a.gp.MULTIPLE_VIEWS),"1","Current table is expected to have multiple views tag"),(0,e.E3)(u.getTag(t.TAGS.ID),l,"Current table is expected to have the same UUID as new view"),(0,e.E3)(u.rowCount,2,"Current table is expected to have 2 rows"),yield(0,e.cb)(500);const c=u.temp[s.i.modelName].findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==c,!0,"New view is expected to have Logo Summary Table viewer attached")})))),(0,e.t6)("Custom clusters",(()=>x(void 0,void 0,void 0,(function*(){const t=i.df.filter;t.setAll(!1,!1),t.set(0,!0,!1),t.set(1,!0,!1),i.df.selection.set(0,!0,!1);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);if(null===n)throw new Error("Logo summary table viewer is not found");(0,e.E3)(T()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters before creating one"),n.clusterFromSelection();const r=T()(n.customClusters).toArray();(0,e.E3)(r.length,1,"Expected to have 1 custom cluster");const o=r[0].name;(0,e.E3)(null!==i.df.col(o),!0,"Expected to have custom cluster column in the table"),(0,e.E3)(-1!==n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(o),!0,"Expected to have custom cluster in the Logo Summary Table"),n.modifyClusterSelection({monomerOrCluster:o,positionOrClusterType:v.W.CUSTOM}),n.removeCluster(),(0,e.E3)(T()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters after removing one"),(0,e.E3)(null===i.df.col(o),!0,"Expected to have no custom cluster column in the table"),(0,e.E3)(-1===n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(o),!0,"Expected to have no custom cluster in the Logo Summary Table")}))))}),{clear:!1});var _=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Table view",(()=>{let n,i,r,c,h,d;const f="none",p={monomerOrCluster:"Aze",positionOrClusterType:"10",mcCount:3,imCount:1},g={monomerOrCluster:"meI",positionOrClusterType:"1",mcCount:2,imCount:10},y={monomerOrCluster:"0",positionOrClusterType:v.W.ORIGINAL,count:3},w={monomerOrCluster:"1",positionOrClusterType:v.W.ORIGINAL,count:3};(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,f),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,f);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>_(void 0,void 0,void 0,(function*(){(0,e.E3)((0,C.cr)(p.monomerOrCluster,0,0),!0,`Couldn't structure for monomer ${p.monomerOrCluster}`)}))),{skipReason:"Need to find a way to replace _package variable to call for Bio function with tests"}),(0,e.t6)("Visible columns",(()=>_(void 0,void 0,void 0,(function*(){const t=i.analysisView.grid.columns,n=i.positionColumns.map((t=>t.name));for(let i=1;i<t.length;i++){const r=t.byIndex(i),o=r.column.name,s=n.includes(o)||o===a.$2.ACTIVITY;(0,e.E3)(r.visible,s,`Column ${o} is visible === ${r.visible} but should be ${s}`)}})))),(0,e.t6)("Mutation Cliffs selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection,n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);yield(0,e.bk)((()=>null!==n.mutationCliffs),"mutation cliffs haven't been generated",2e3);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after initialization`);n.modifyMutationCliffsSelection(p),(0,e.E3)(n.mutationCliffsSelection[p.positionOrClusterType].includes(p.monomerOrCluster),!0,`Monomer ${p.monomerOrCluster} is not selected at position ${p.positionOrClusterType}`),(0,e.E3)(t.trueCount,p.mcCount,`Selection count is not equal to ${p.mcCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType}`),n.modifyMutationCliffsSelection(g,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(n.mutationCliffsSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not selected at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.mcCount+p.mcCount,`Selection count is not equal to ${g.mcCount+p.mcCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),n.modifyMutationCliffsSelection(g,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(n.mutationCliffsSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!1,`Monomer ${g.monomerOrCluster} is still selected at position ${g.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,p.mcCount,`Selection count is not equal to ${p.mcCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType}`),n.mutationCliffsSelection=(0,l.ZR)(n.positionColumns);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after clearing monomer-position selection`);(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing monomer-position selection");const r=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==r,!0,"Couldn't find Logo Summary Table viewer"),r.modifyClusterSelection(y),(0,e.E3)(r.clusterSelection[y.positionOrClusterType].includes(y.monomerOrCluster),!0,`Cluster ${y.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,y.count,`Selection count is not equal to ${y.count} for cluster ${y.monomerOrCluster}`),r.modifyClusterSelection(w,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(r.clusterSelection[w.positionOrClusterType].includes(w.monomerOrCluster),!0,`Cluster ${w.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,y.count+w.count,`Selection count is not equal to ${y.count+w.count} for cluster ${y.monomerOrCluster} and cluster \n ${w.monomerOrCluster}`),r.modifyClusterSelection(y,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(r.clusterSelection[y.positionOrClusterType].includes(y.monomerOrCluster),!1,`Cluster ${y.monomerOrCluster} is still selected after deselection`),(0,e.E3)(t.trueCount,w.count,`Selection count is not equal to ${w.count} for cluster ${w.monomerOrCluster} after deselection of cluster ${y.monomerOrCluster}`),r.initClusterSelection(),(0,e.E3)(r.isClusterSelectionEmpty,!0,"Selection is not empty after clearing cluster selection"),(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing cluster selection")})))),(0,e.t6)("Invariant Map selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection;for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after initialization`);i.modifyWebLogoSelection(g),(0,e.E3)(i.webLogoSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not filtered at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.imCount,`Filter count is not equal to ${g.imCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),i.modifyWebLogoSelection(p,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(i.webLogoSelection[p.positionOrClusterType].includes(p.monomerOrCluster),!0,`Monomer ${p.monomerOrCluster} is not filtered at position ${p.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.imCount,`Filter count is not equal to ${g.imCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType}`),i.modifyWebLogoSelection(g,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(i.webLogoSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!1,`Monomer ${g.monomerOrCluster} is still filtered at position \n ${g.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,p.imCount,`Filter count is not equal to ${p.imCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType} after deselection of monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),(0,e.E3)(null!==i.positionColumns,!0,"Position columns are not initialized"),i.webLogoSelection=(0,l.ZR)(i.positionColumns),(0,e.E3)(t.trueCount,0,"Filter count is not equal to 0 after clearing monomer-position filter");for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after clearing monomer-position filter`)}))))}),{clear:!1});var N=n(5070),M=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Model: Settings",(()=>{let n,i,r,c,h,d;(0,e.gM)((()=>M(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>M(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Activity scaling",(()=>M(void 0,void 0,void 0,(function*(){var t;const n=(t,e)=>`Activity mismatch at row ${t} for scaling method '${e}'`,o=1e-4,s=i.df.getCol(null===(t=i.settings)||void 0===t?void 0:t.activityColumnName).getRawData(),u=i.df.getCol(a.$2.ACTIVITY),c=i.df.rowCount;let h=u.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],s[t],o,n(t,a.rg.NONE));h=(0,l.Y1)(r,a.rg.LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],Math.log10(s[t]),o,n(t,a.rg.LG));h=(0,l.Y1)(r,a.rg.MINUS_LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],-Math.log10(s[t]),o,n(t,a.rg.MINUS_LG));h=d.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],s[t],o,n(t,a.rg.NONE))})))),(0,e.t6)("Mutation Cliffs",(()=>M(void 0,void 0,void 0,(function*(){const t=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);(0,e.E3)(t.maxMutations,1,`Max mutations mismatch: expected 1, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,0,`Min activity delta mismatch: expected 0, actual ${t.minActivityDelta}`),t.maxMutations=2,t.minActivityDelta=.5,(0,e.E3)(t.maxMutations,2,`Max mutations mismatch: expected 2, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,.5,`Min activity delta mismatch: expected 0.5, actual ${t.minActivityDelta}`)})))),(0,e.t6)("Include columns",(()=>M(void 0,void 0,void 0,(function*(){var n,r;const o="rank",a={[o]:t.AGG.AVG};i.settings={columns:a};const l=i.findViewer(s.q.LOGO_SUMMARY_TABLE),u=(0,N.hX)(t.AGG.AVG,o);(0,e.E3)(null!==l.viewerGrid.col(u),!0,`Expected to include column '${o}' in ${s.q.LOGO_SUMMARY_TABLE} but it is absent`),i.settings={columns:{}},(0,e.E3)(Object.keys(null===(n=i.settings)||void 0===n?void 0:n.columns).length,0,`Expected to remove all column aggregations but columns {${Object.keys(null===(r=i.settings)||void 0===r?void 0:r.columns).join(" & ")}} are still included`),(0,e.E3)(null===l.viewerGrid.col(u),!0,`Expected to remove column '${o}' from ${s.q.LOGO_SUMMARY_TABLE} but it is still present`)})))),(0,e.t6)("Dendrogram",(()=>M(void 0,void 0,void 0,(function*(){var t,n;i.settings={showDendrogram:!0},(0,e.E3)(null===(t=i.settings)||void 0===t?void 0:t.showDendrogram,!0,"Dendrogram is disabled after enabling"),yield(0,e.bk)((()=>null!==i.findViewer(s.q.DENDROGRAM)),"Dendrogram is not present in the view after 5s delay",5e3),i.settings={showDendrogram:!1},(0,e.E3)(null===(n=i.settings)||void 0===n?void 0:n.showDendrogram,!1,"Dendrogram is enabled after disabling"),(0,e.E3)(null===i.findViewer(s.q.DENDROGRAM),!0,"Dendrogram is present in the view after disabling")}))),{skipReason:"Need to find a way to replace _package variable to call for Bio function with tests"})}),{clear:!1});var O=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Algorithms",(()=>{let n,i,r,o;(0,e.gM)((()=>O(void 0,void 0,void 0,(function*(){n=t.Column.fromList("int","test",[1,2,5]).getRawData(),i=[t.Column.fromList("string","1","AAA".split("")),t.Column.fromList("string","2","BCC".split("")),t.Column.fromList("string","3","CCD".split(""))].map((t=>({name:t.name,rawData:t.getRawData(),cat:t.categories}))),o=(0,l.eY)(t.Column.fromList("string","target",["1","2","2"])),r={maxMutations:1,minActivityDelta:2}})))),(0,e.t6)("MutationCliffs",(()=>O(void 0,void 0,void 0,(function*(){let t=yield(0,h.uz)(n,i,r);(0,e.E3)(t.has("C"),!0,"MutationCliffsInfo should have key 'C'"),(0,e.E3)(t.has("D"),!0,"MutationCliffsInfo should have key 'D'"),(0,e.E3)(t.has("A"),!1,"MutationCliffsInfo should not have key 'A'");const s=t.get("C"),a=t.get("D");(0,e.E3)(s.has("3"),!0,"MutationCliffsInfo['C'] should have key '3'"),(0,e.E3)(a.has("3"),!0,"MutationCliffsInfo['D'] should have key '3'");const l=s.get("3"),u=a.get("3");(0,e.E3)(l.has(1),!0,"MutationCliffsInfo['C']['3'] should have key 1"),(0,e.E3)(u.has(2),!0,"MutationCliffsInfo['D']['3'] should have key 2");const c=l.get(1),d=u.get(2);(0,e.E3)(c[0],2,"MutationCliffsInfo['C']['3'][1] should have value 2"),(0,e.E3)(d[0],1,"MutationCliffsInfo['D']['3'][2] should have value 1"),r.targetCol=o,r.currentTarget="1",t=yield(0,h.uz)(n,i,r),(0,e.E3)(t.size,0,"MutationCliffsInfo should be empty for target '1'")}))))}));var L=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const I=new t.Package;function R(n,i,r){return L(this,void 0,void 0,(function*(){r.catchUnhandled=!1;const o=yield(0,e.N$)({category:n,test:i,testContext:r});return t.DataFrame.fromObjects(o)}))}function P(){return L(this,void 0,void 0,(function*(){yield(0,e.Xb)(I,I.getModule("package-test.js"))}))}})(),peptides_test=i})();
|
|
1
|
+
var peptides_test;(()=>{var t={9135:(t,e,n)=>{"use strict";n.d(e,{pj:()=>m,uL:()=>g});var i,r,o,s,a,l,u,c=n(6082),h=n(4328);n(8774),function(t){t.Levenshtein="Levenshtein",t.JaroWinkler="Jaro-Winkler",t.Manhattan="Manhattan",t.Onehot="One-Hot"}(i||(i={})),function(t){t.Euclidean="Euclidean"}(r||(r={})),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"}(o||(o={})),function(t){t.TanimotoIntArray="TanimotoIntArray"}(s||(s={})),function(t){t.Vector="Vector",t.String="String",t.BitArray="BitArray",t.MacroMolecule="MacroMolecule",t.Number="Number",t.IntArray="IntArray",t.NumberArray="NumberArray"}(a||(a={})),function(t){t.Difference="Difference"}(l||(l={})),function(t){t.CommonItems="Common Items"}(u||(u={}));var d=n(4572);o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Asymmetric,o.BraunBlanquet,o.Cosine,o.Kulczynski,o.McConnaughey,o.RogotGoldberg,o.Russel,o.Sokal,o.Hamming,o.Euclidean,o.Tanimoto,o.Dice,o.Cosine,o.Tanimoto,o.Asymmetric,o.Cosine,o.Sokal,d.Z.HAMMING,d.Z.LEVENSHTEIN,d.Z.MONOMER_CHEMICAL_DISTANCE,d.Z.NEEDLEMANN_WUNSCH,n(3151);var f=n(2738),p=(n(826),n(3077));async function m(){const t=c.Func.find({package:"Bio",name:"getMonomerLibHelper"});if(0===t.length)throw new Error('Package "Bio" must be installed for MonomerLibHelper.');return(await t[0].prepare().call()).getOutputParamValue()}async function g(t,e){t instanceof c.Column&&(t=(0,p.R)(t).columns.toList());const n=(await m()).getMonomerLib(),i=new Array(t.length),r=t[0].length,o=new Float32Array(r);for(let s=0;s<t.length;++s){const a=s<e.length?e.getCanonical(s):f._S,l=n.getMonomer("PEPTIDE",a)?.smiles??"",u=t[s],d=u.getRawData(),p=u.categories,m=p.indexOf("");if(i[s]={categories:p,data:d,emptyIndex:m},void 0===a)continue;const g=c.Column.fromStrings("smiles",p.map((t=>n.getMonomer("PEPTIDE",t)?.smiles??""))),v=(c.DataFrame.fromColumns([g]),await h.chem.getSimilarities(g,l)),y=v?v.getRawData():null;for(let t=0;t<r;++t){const e=d[t];a!==f._S&&e!==m?o[t]+=y[e]:a===f._S&&e===m&&(o[t]+=1)}}for(let n=0;n<o.length;++n){let r=o[n]/e.length;for(let o=0;o<t.length;++o){const t=i[o];if(o>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&o<e.length){r=c.FLOAT_NULL;break}}o[n]=r}return c.Column.fromFloat32Array("Similarity",o)}},3151:(t,e,n)=>{"use strict";n.d(e,{EK:()=>r,q7:()=>i});const i="p",r=new RegExp(`[rd]\\((\\w)\\)${i}?`,"g")},439:(t,e,n)=>{"use strict";n.d(e,{B5:()=>l,Hi:()=>i,YI:()=>r,gp:()=>o,q7:()=>c,z1:()=>a});var i,r,o,s=n(2738);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm"}(i||(i={})),function(t){t.DNA="DNA",t.RNA="RNA",t.PT="PT",t.UN="UN"}(r||(r={})),function(t){t.aligned="aligned",t.alphabet="alphabet",t.alphabetSize=".alphabetSize",t.alphabetIsMultichar=".alphabetIsMultichar",t.separator="separator",t.isHelmCompatible=".isHelmCompatible",t.positionNames=".positionNames",t.positionLabels=".positionLabels",t.regions=".regions"}(o||(o={}));const a=", ",l=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,u=new class{constructor(){this.fasta={peptide:new Set(["G","L","Y","S","E","Q","D","N","F","A","K","R","H","C","V","P","W","I","M","T"]),dna:new Set(["A","C","G","T"]),rna:new Set(["A","C","G","U"])}}},c=[new s.aD(r.PT,u.fasta.peptide,.5),new s.aD(r.DNA,u.fasta.dna,.55),new s.aD(r.RNA,u.fasta.rna,.55)]},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,J9:()=>r.J9,SM:()=>r.SM,YI:()=>i.YI,dh:()=>r.dh,gp:()=>i.gp,q7:()=>i.q7,qp:()=>r.qp,z1:()=>i.z1,zS:()=>r.zS});var i=n(439),r=n(9634)},2738:(t,e,n)=>{"use strict";n.d(e,{XN:()=>o,_S:()=>i,aD:()=>r});const i="";class r{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class o extends r{constructor(t,e,n){super(t.name,t.alphabet,t.cutoff),this.freq=e,this.similarity=n}}},9634:(t,e,n)=>{"use strict";n.d(e,{Mu:()=>E,pc:()=>R,dh:()=>_,zS:()=>I,SM:()=>P,J9:()=>T,tm:()=>x,qp:()=>O});var i=n(6082),r=n(144),o=n.n(r),s=n(2738),a=n(439),l=n(826);class u extends Float32Array{}function c(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}class h{static makePalette(t,e=!1,n=h){const i={};return t.forEach((t=>{const n=t[0],r=t[1];n.forEach(((t,n)=>{i[t]=this.colourPalette[r][e?0:n]}))})),new n(i)}constructor(t){this._palette=t}get(t,e){return this._palette[t]}}h.undefinedColor="rgb(100,100,100)",h.colourPalette={orange:["rgb(255,187,120)","rgb(245,167,100)","rgb(235,137,70)","rgb(205, 111, 71)"],all_green:["rgb(44,160,44)","rgb(74,160,74)","rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)","rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],all_blue:["rgb(31,119,180)","rgb(23,190,207)","rgb(122, 102, 189)","rgb(158,218,229)","rgb(141, 124, 217)","rgb(31, 120, 150)"],magenta:["rgb(162,106,192)","rgb(197,165,224)","rgb(208,113,218)"],red:["rgb(214,39,40)","rgb(255,152,150)"],st_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(31,119,180)"],dark_blue:["rgb(31,119,180)","rgb(31, 120, 150)"],light_blue:["rgb(23,190,207)","rgb(158,218,229)","rgb(108, 218, 229)","rgb(23,190,227)"],lilac_blue:["rgb(124,102,211)","rgb(149,134,217)","rgb(97, 81, 150)"],dark_green:["rgb(23,103,57)","rgb(30,110,96)","rgb(60,131,95)","rgb(24,110,79)"],green:["rgb(44,160,44)","rgb(74,160,74)"],light_green:["rgb(152,223,138)","rgb(182, 223, 138)","rgb(152, 193, 138)"],st_green:["rgb(44,160,44)","rgb(152,223,138)","rgb(39, 174, 96)","rgb(74,160,74)"],pink:["rgb(247,182,210)"],brown:["rgb(140,86,75)","rgb(102, 62, 54)"],gray:["rgb(127,127,127)","rgb(199,199,199)","rgb(196,156,148)","rgb(222, 222, 180)"],yellow:["rgb(188,189,34)"],white:["rgb(230,230,230)"]};class d extends h{static get Lesk(){return void 0===this.lesk&&(this.lesk=this.makePalette([[["G","A","S","T"],"orange"],[["C","V","I","L","P","F","Y","M","W"],"all_green"],[["N","Q","H"],"magenta"],[["D","E"],"red"],[["K","R"],"all_blue"]],!1,d)),this.lesk}static get GrokGroups(){return void 0===this.grokGroups&&(this.grokGroups=this.makePalette([[["C","U"],"yellow"],[["G","P"],"red"],[["A","V","I","L","M","F","Y","W"],"all_green"],[["R","H","K"],"light_blue"],[["D","E"],"dark_blue"],[["S","T","N","Q"],"orange"]],!1,d)),this.grokGroups}static get RasMol(){return void 0===this.rasMol&&(this.rasMol=new d({D:"#E60A0A",E:"#E60A0A",C:"#E6E600",M:"#E6E600",K:"#145AFF",R:"#145AFF",S:"#FA9600",T:"#FA9600",F:"#3232AA",Y:"#3232AA",N:"#00DCDC",Q:"#00DCDC",G:"#EBEBEB",L:"#0F820F",V:"#0F820F",I:"#0F820F",A:"#C8C8C8",W:"#B45AB4",H:"#8282D2",P:"#DC9682",others:"#BEA06E"})),this.rasMol}get(t){const e=t in d.aaSynonyms?d.aaSynonyms[t]:t;return super.get(e)}}d.aaSynonyms={MeNle:"L",MeA:"A",MeG:"G",MeF:"F"};class f{static getPalette(t="grok"){switch(t){case"grok":return d.GrokGroups;case"lesk":return d.Lesk;default:throw new Error(`ChemPalette: scheme \`${t}\` does not exist`)}}static getInnerOuter(t){let e=0,n="",i="";for(const r of t)"("==r?e++:")"==r?e--:e?n+=r:i+=r;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[i,r]=this.getInnerOuter(t);if(i=i.length>6?`${i.slice(0,3)}...`:i,r=r.length>6?`${r.slice(0,3)}...`:r,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,r,1]:[this.undefinedColor,i,r,1]}if("d"==t[0]&&t[1]in n&&(2==t.length||"("==t[2])){const e=t[1]?.toUpperCase();return e in n?[n.get(e),e,r,2]:[this.undefinedColor,i,r,2]}if(t.substring(0,3)in this.AAFullNames&&(3==t.length||"("==t[3])){const e=this.AAFullNames[t.substring(0,3)];return e in n?[n.get(e),e,r,3]:[this.undefinedColor,i,r,3]}if(t[0]?.toLowerCase()==t[0]&&t.substring(1,3)in this.AAFullNames&&(4==t.length||"("==t[4])){const e=this.AAFullNames[t.substring(1,3)];return e in n?[n.get(e),e,r,4]:[this.undefinedColor,i,r,4]}return[this.undefinedColor,i,r,0]}}f.SemType="Aminoacids",f.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",f.undefinedColor="rgb(100,100,100)",f.Names={G:"Glycine",L:"Leucine",Y:"Tyrosine",S:"Serine",E:"Glutamic acid",Q:"Glutamine",D:"Aspartic acid",N:"Asparagine",F:"Phenylalanine",A:"Alanine",K:"Lysine",R:"Arginine",H:"Histidine",C:"Cysteine",V:"Valine",P:"Proline",W:"Tryptophan",I:"Isoleucine",M:"Methionine",T:"Threonine"},f.AASmiles={G:"NCC(=O)O",L:"N[C@H](CC(C)C)C(=O)O",Y:"NC(CC1=CC=C(O)C=C1)C(=O)O",S:"NC(CO)C(=O)O",E:"N[C@@H](CCC(O)=O)C(=O)O",Q:"N[C@@H](CCC(N)=O)C(=O)O",D:"N[C@@H](CC(O)=O)C(=O)O",N:"N[C@@H](CC(N)=O)C(=O)O",F:"NC(CC1=CC=CC=C1)C(=O)O",A:"N[C@H](C)C(=O)O",K:"NC(CCCCN)C(=O)O",R:"N[C@H](CCCNC(=N)C)C(=O)O",H:"NC(CC1=CN=C[N]1)C(=O)O",C:"N[C@@H](CS)C(=O)O",V:"NC(C(C)C)C(=O)O",P:"N(CCC1)C1C(=O)O",W:"N[C@@H](Cc1c2ccccc2n([H])c1)C(=O)O",I:"N[C@H]([C@H](C)CC)C(=O)O",M:"NC(CCSC)C(=O)O",T:"NC(C(O)C)C(=O)O"},f.AASmilesTruncated={G:"*C*",L:"CC(C)C[C@H](*)*",Y:"C1=CC(=CC=C1CC(*)*)O",S:"OCC(*)C*",E:"*[C@@H](CCC(O)=O)*",Q:"*N[C@@H](CCC(N)=O)*",D:"*[C@@H](CC(O)=O)*",N:"*[C@@H](CC(N)=O)*",F:"C1=CC=C(C=C1)CC(*)*",A:"C[C@H](*)*",K:"C(CCN)CC(*)*",R:"*[C@H](CCCNC(=N)C)*",H:"C1=C(NC=N1)CC(*)*",C:"C([C@@H](*)*)S",V:"CC(C)C(*)*",P:"C1CCN(*)C1*",W:"*[C@@H](Cc1c2ccccc2n([H])c1)*",I:"CC[C@H](C)[C@H](*)*",M:"CSCCC(*)*",T:"CC(O)C(*)*"},f.AAFullNames={Ala:"A",Arg:"R",Asn:"N",Asp:"D",Cys:"C",Gln:"Q",Glu:"E",Gly:"G",His:"H",Ile:"I",Leu:"L",Lys:"K",Met:"M",Phe:"F",Pro:"P",Ser:"S",Thr:"T",Trp:"W",Tyr:"Y",Val:"V"};class p extends h{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new p({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class m{}m.SemType="Nucleotides",m.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",m.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};var g=n(9135);function v(t,e=!0){if(null==t)return"rgb(100,100,100)";const n=i.Color.fromHtml(t);if(e){const t=i.Color.g(n),e=i.Color.r(n),r=i.Color.b(n),o=Math.sqrt(Math.pow(0-e,2)+Math.pow(0-t,2)+Math.pow(0-r,2));if(o>210)return`rgb(${e/o*210},${t/o*210},${r/o*210})`}return i.Color.toRgb(n)}class y{static hashCode(t){let e=0;if(0===t.length)return e;for(let n=0;n<t.length;n++)e=(e<<5)-e+t.charCodeAt(n),e|=0;return e}}class C{}class w extends C{get(t,e){return"#666666"}}class b extends C{static buildPalette(){return(0,g.pj)().then((t=>{t.awaitLoaded().then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{b.customMonomerColors={},b.polymerTypes=e.getPolymerTypes();for(const t of this.polymerTypes){const n=e.getMonomerSymbolsByType(t);for(const i of n){const n=e.getMonomer(t,i);n?.meta?.colors?.default?.background&&(this.customMonomerColors[i]||(this.customMonomerColors[i]={}),this.customMonomerColors[i][t]=v(n.meta.colors.default.background,!1))}}}))}))})),[].concat(...Object.values(h.colourPalette))}get(t,e){const n=b.customMonomerColors[t],i=e??"PEPTIDE";if(n&&n[i])return n[i];const r=y.hashCode(t)%b.palette.length;return v(b.palette[r])}}b.palette=b.buildPalette(),b.customMonomerColors={},b.polymerTypes=[];class A extends h{static get Gray(){return void 0===this.gray&&(this.gray=new w),this.gray}static get Color(){return void 0===this.color&&(this.color=new b),this.color}}class E{get length(){return this.mList.length}get canonicals(){return this.mList}get originals(){return this.mList}isGap(t){return this.getOriginal(t)===this.gapOriginalMonomer}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.mList[t]}constructor(t,e){this.mList=t,this.gapOriginalMonomer=e}}class S{get length(){return this.seqS.length}get canonicals(){return this.seqS}get originals(){return this.seqS}isGap(t){return this.getOriginal(t)===l.b9[a.Hi.FASTA]}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");return this.isGap(t)?s._S:this.seqS[t]}getOriginal(t){if(this.length<=t)throw new Error("Index out of bounds");return this.seqS[t]}constructor(t){this.seqS=t}}const T=t=>{const e=o()(t.toString().matchAll(a.B5)).map((t=>t[2]??t[1])).toArray();return new E(e,l.b9[a.Hi.FASTA])},x=t=>t?new S(t):new E([],l.b9[a.Hi.FASTA]);function _(t,e=void 0){return n=>{if(n){let i;const r=new RegExp(String.raw`"-"|'-'|[^${t}]+`,"g");if(void 0!==e){r.lastIndex=0,i=new Array(Math.ceil(e));let t=null,o=0;for(;null!==(t=r.exec(n))&&o<e;)i[o++]=t[0].replace('"-"',"").replace("'-'","");i.splice(o)}else i=n.replaceAll('"-"',"").replaceAll("'-'","").split(t,e);return new E(i,l.b9[a.Hi.SEPARATOR])}return new E([],l.b9[a.Hi.SEPARATOR])}}const N=/(PEPTIDE1|DNA1|RNA1)\{([^}]+)}/g,M=/\[([^\[\]]+)]/g,O=t=>{N.lastIndex=0;const e=N.exec(t.toString()),n=e?e[2]:null,i=n?n.split("."):[];return new E(i.map((t=>{M.lastIndex=0;const e=M.exec(t);return e&&e.length>=2?e[1]:t})),l.b9[a.Hi.HELM])},L=/([^\W_]+)/g;function I(t,e){if(t.length<=e)return t;const n=t.match(L),i=t.length>e||(n?.length??0)>1,r=n?.[0]??" ";return i?r.substring(0,e-1)+"…":r}function R(t,e,n="-"){const i=e.map((e=>{const i=function(t,e,n="-"){const i=new Set([...new Set(Object.keys(t)),...e]);i.delete(n);const r=[],o=[];for(const n of i)r.push(n in t?t[n]:0),o.push(e.has(n)?1:0);const s=new u(r),a=new u(o);return function(t,e){if(t.length!=e.length)throw new Error("The dimensionality of the vectors must match");let n=0;for(let i=0;i<t.length;i++)n+=t[i]*e[i];return n}(s,a)/(c(s)*c(a))}(t,e.alphabet,n);return new s.XN(e,t,i)}));let r;const o=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return r=o>0?i.find((t=>t.similarity===o)).name:a.YI.UN,r}function P(t,e=5){let n;if(t.semType==i.SEMTYPE.MACROMOLECULE)n=l.GO.forColumn(t).alphabet;else{const i=function(t,e,n){const i=t.categories;return function(t,e){const n={};let i=!0,r=null;for(const o of t)if(null==r?r=o.length:o.length!==r&&(i=!1),o.length>=e)for(const t of o.canonicals)t in n||(n[t]=0),n[t]+=1;return{freq:n,sameLength:i}}(o().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,e,T);n=R(i.freq,a.q7)}return function(t){switch(t){case a.YI.PT:return d.GrokGroups;case a.YI.DNA:case a.YI.RNA:return p.Chromatogram;default:return A.Color}}(n)}},826:(t,e,n)=>{"use strict";n.d(e,{GO:()=>p,b9:()=>f});var i=n(6082),r=n(144),o=n.n(r),s=n(2003),a=n(2738),l=n(9634),u=n(4572),c=n(9135),h=n(3151);const d=new class{constructor(){this.seqHandler="seq-handler",this.notationProvider="seq-handler.notation-provider"}},f={[s.Hi.FASTA]:"-",[s.Hi.SEPARATOR]:"",[s.Hi.HELM]:"*"};class p{constructor(t){if(this._splitter=null,this.cached=!0,this._splitted=null,this.columnVersion=null,this._stats=null,this._maxLength=null,this._posList=null,this._joiner=void 0,t.type!==i.TYPE.STRING)throw new Error(`Unexpected column type '${t.type}', must be '${i.TYPE.STRING}'.`);this._column=t;const e=this._column.meta.units;if(null==e)throw new Error("Units are not specified in column");if(this._units=e,this._notation=this.getNotation(),this._defaultGapOriginal=this.isFasta()?f[s.Hi.FASTA]:this.isHelm()?f[s.Hi.HELM]:f[s.Hi.SEPARATOR],!this.column.tags.has(s.gp.aligned)||!this.column.tags.has(s.gp.alphabet)||!this.column.tags.has(s.gp.alphabetIsMultichar)&&!this.isHelm()&&this.alphabet===s.YI.UN)if(this.isFasta())p.setUnitsToFastaColumn(this);else if(this.isSeparator()){const e=t.getTag(s.gp.separator);p.setUnitsToSeparatorColumn(this,e)}else{if(!this.isHelm())throw new Error(`Unexpected units '${this.column.meta.units}'.`);p.setUnitsToHelmColumn(this)}if(!this.column.tags.has(s.gp.alphabetIsMultichar))if(this.isHelm())this.column.setTag(s.gp.alphabetIsMultichar,"true");else if(["UN"].includes(this.alphabet))throw new Error(`For column '${this.column.name}' of alphabet '${this.alphabet}' tag '${s.gp.alphabetIsMultichar}' is mandatory.`);this.notationProvider=this.column.temp[d.notationProvider]??null,this.columnVersion=this.column.version}static setUnitsToFastaColumn(t){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE||t.column.meta.units!==s.Hi.FASTA)throw new Error(`The column of notation '${s.Hi.FASTA}' must be '${i.SEMTYPE.MACROMOLECULE}'.`);t.column.meta.units=s.Hi.FASTA,p.setTags(t)}static setUnitsToSeparatorColumn(t,e){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE||t.column.meta.units!==s.Hi.SEPARATOR)throw new Error(`The column of notation '${s.Hi.SEPARATOR}' must be '${i.SEMTYPE.MACROMOLECULE}'.`);if(!e)throw new Error(`The column of notation '${s.Hi.SEPARATOR}' must have the separator tag.`);t.column.meta.units=s.Hi.SEPARATOR,t.column.setTag(s.gp.separator,e),p.setTags(t)}static setUnitsToHelmColumn(t){if(t.column.semType!==i.SEMTYPE.MACROMOLECULE)throw new Error(`The column of notation '${s.Hi.HELM}' must be '${i.SEMTYPE.MACROMOLECULE}'`);t.column.meta.units=s.Hi.HELM,p.setTags(t)}static setTags(t){const e=t.column.meta.units;if([s.Hi.FASTA,s.Hi.SEPARATOR].includes(e)){if(!t.column.getTag(s.gp.alphabet)&&0===Object.keys(t.stats.freq).length)throw new Error("Alphabet is empty and not annotated.");let e=t.column.getTag(s.gp.aligned);null===e&&(e=t.stats.sameLength?"SEQ.MSA":"SEQ",t.column.setTag(s.gp.aligned,e));let n=t.column.getTag(s.gp.alphabet);if(null===n&&(n=(0,l.pc)(t.stats.freq,s.q7),t.column.setTag(s.gp.alphabet,n)),n===s.YI.UN){const e=Object.keys(t.stats.freq).length,n=Object.keys(t.stats.freq).some((t=>t.length>1));t.column.setTag(s.gp.alphabetSize,e.toString()),t.column.setTag(s.gp.alphabetIsMultichar,n?"true":"false")}}}get column(){return this._column}get length(){return this._column.length}get units(){return this._units}get notation(){return this._notation}get defaultGapOriginal(){return this._defaultGapOriginal}get separator(){const t=this.column.getTag(s.gp.separator)??void 0;if(this.notation===s.Hi.SEPARATOR&&void 0===t)throw new Error(`Separator is mandatory for column '${this.column.name}' of notation '${this.notation}'.`);return t}get aligned(){const t=this.column.getTag(s.gp.aligned);if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag aligned not set");return t}get alphabet(){const t=this.column.getTag(s.gp.alphabet);if(!t&&(this.isFasta()||this.isSeparator()))throw new Error("Tag alphabet not set");return t}get helmCompatible(){return this.column.getTag(s.gp.isHelmCompatible)}getAlphabetSize(){if(this.notation==s.Hi.HELM||this.alphabet==s.YI.UN){const t=this.column.getTag(s.gp.alphabetSize);let e;if(t)e=parseInt(t);else{const t=this.stats;e=Object.keys(t.freq).length}return e}switch(this.alphabet){case s.YI.PT:return 20;case s.YI.DNA:case s.YI.RNA:return 4;case"NT":return console.warn("Unexpected alphabet 'NT'."),4;default:throw new Error(`Unexpected alphabet '${this.alphabet}'.`)}}getAlphabetIsMultichar(){return this.notation===s.Hi.HELM||this.alphabet===s.YI.UN&&"true"===this.column.getTag(s.gp.alphabetIsMultichar)}getSplitted(t,e){if(this.cached&&void 0===e){this.column.version===this.columnVersion&&null!==this._splitted||(this.columnVersion=this.column.version,this._splitted=new Array(this.column.length));let e=this._splitted[t]?this._splitted[t].deref():void 0;if(!e){const n=this.column.get(t);e=this.splitter(n),this._splitted[t]=new WeakRef(e)}return e}{const n=this.column.get(t);return this.getSplitter(e)(n)}}async getHelm(t,e){const n=this.column.get(t);return this.notationProvider?(await this.notationProvider.getHelm(this.column,e)).get(t):this.convertToHelm(n)}get stats(){if(null===this._stats){const t={};let e=!0,n=null;const i=this.column.length;for(let r=0;r<i;++r){const i=this.getSplitted(r);null==n?n=i.length:i.length!==n&&(e=!1);for(const e of i.canonicals)e in t||(t[e]=0),t[e]+=1}this._stats={freq:t,sameLength:e}}return this._stats}get maxLength(){return null===this._maxLength&&(this._maxLength=0===this.column.length?0:Math.max(...o().count(0).take(this.column.length).map((t=>this.getSplitted(t).length)))),this._maxLength}get posList(){if(null===this._posList){const t=this.column.getTag(s.gp.positionNames);this._posList=t?t.split(s.z1).map((t=>t.trim())):o().count(1).take(this.maxLength).map((t=>t.toString())).toArray()}return this._posList}isFasta(){return this.notation===s.Hi.FASTA}isSeparator(){return this.notation===s.Hi.SEPARATOR}isHelm(){return this.notation===s.Hi.HELM}isRna(){return this.alphabet===s.YI.RNA}isDna(){return this.alphabet===s.YI.DNA}isPeptide(){return this.alphabet===s.YI.PT}isMsa(){return!!this.aligned&&this.aligned.toUpperCase().includes("MSA")}isHelmCompatible(){return"true"===this.helmCompatible}isGap(t){return!t||t===this._defaultGapOriginal}getNotation(){if(this.units.toLowerCase().startsWith(s.Hi.FASTA))return s.Hi.FASTA;if(this.units.toLowerCase().startsWith(s.Hi.SEPARATOR))return s.Hi.SEPARATOR;if(this.units.toLowerCase().startsWith(s.Hi.HELM))return s.Hi.HELM;throw new Error(`Column '${this.column.name}' has unexpected notation '${this.units}'.`)}getHelmWrappers(){return[this.isDna()||this.isRna()||this.isHelmCompatible()?"RNA1{":"PEPTIDE1{",this.isDna()?"d(":this.isRna()?"r(":"",this.isDna()||this.isRna()?")p":"","}$$$$"]}getNewColumn(t,e,n,r){const o=this.column,a=t.toLowerCase()+"("+o.name+")",l=n??o.dataFrame.columns.getUnusedName(a),u=i.Column.fromList("string",l,r??new Array(this.column.length).fill(""));if(u.semType=i.SEMTYPE.MACROMOLECULE,u.meta.units=t,t===s.Hi.SEPARATOR){if(!e)throw new Error(`Notation '${s.Hi.SEPARATOR}' requires separator value.`);u.setTag(s.gp.separator,e)}u.setTag(i.TAGS.CELL_RENDERER,t===s.Hi.HELM?"helm":"sequence");const c=o.getTag(s.gp.aligned);c&&u.setTag(s.gp.aligned,c);let h=o.getTag(s.gp.alphabet);h||this.notation!==s.Hi.HELM||t===s.Hi.HELM||(h=s.YI.UN),null!=h&&u.setTag(s.gp.alphabet,h);let d=o.getTag(s.gp.alphabetSize);null!=h&&d&&u.setTag(s.gp.alphabetSize,d);const f=o.getTag(s.gp.alphabetIsMultichar);return null!=h&&void 0!==f&&u.setTag(s.gp.alphabetIsMultichar,f),t==s.Hi.HELM&&(d=this.getAlphabetSize().toString(),u.setTag(s.gp.alphabetSize,d)),u}getNewColumnFromList(t,e){return this.getNewColumn(this.notation,this.separator,t,e)}static getNewColumn(t){const e=p.forColumn(t),n=e.notation;return e.getNewColumn(n)}static unitsStringIsValid(t){return t=t.toLowerCase(),[s.Hi.FASTA,s.Hi.SEPARATOR,s.Hi.HELM].some((e=>t.startsWith(e.toLowerCase())))}static getNewColumnFromParams(t,e,n){if(!p.unitsStringIsValid(n))throw new Error("Invalid format of 'units' parameter");const r=i.Column.fromList("string",e,new Array(t).fill(""));return r.semType=i.SEMTYPE.MACROMOLECULE,r.meta.units=n,r}getSplitter(t){let e=null;if(e=this.notationProvider?this.notationProvider.splitter:null,e)return e;if(this.units.toLowerCase().startsWith(s.Hi.FASTA))return null===this.column.getTag(s.gp.alphabet)||this.getAlphabetIsMultichar()?s.J9:l.tm;if(this.units.toLowerCase().startsWith(s.Hi.SEPARATOR))return(0,s.dh)(this.separator,t);if(this.units.toLowerCase().startsWith(s.Hi.HELM))return s.qp;throw new Error(`Unexpected units ${this.units} .`)}split(t){return this.splitter(t)}getDistanceFunctionName(){if(!this.isFasta())throw new Error("Only FASTA notation is supported");if(this.isMsa())return u.Z.HAMMING;switch(this.alphabet){case s.YI.DNA:case s.YI.RNA:case s.YI.PT:}return u.Z.LEVENSHTEIN}getDistanceFunction(){return u.V[this.getDistanceFunctionName()]()}async checkHelmCompatibility(){if(this.column.tags.has(s.gp.isHelmCompatible))return"true"===this.column.getTag(s.gp.isHelmCompatible);const t=(await(0,c.pj)()).getMonomerLib().getMonomerSymbolsByType("PEPTIDE"),e=new Set(t),n=((0,s.dh)(this.separator),new Set),i=this.column.length,r=this.column.getRawData();for(let t=0;t<i;++t){const i=r[t];if(!(i in n)){n.add(i);const r=this.getSplitted(t);for(const t of r.canonicals)if(!e.has(t))return this.column.setTag(s.gp.isHelmCompatible,"false"),!1}}return this.column.setTag(s.gp.isHelmCompatible,"true"),!0}get splitter(){return null===this._splitter&&(this._splitter=this.getSplitter()),this._splitter}toFasta(t){return t===s.Hi.FASTA}toSeparator(t){return t===s.Hi.SEPARATOR}toHelm(t){return t===s.Hi.HELM}convertHelmToFastaSeparator(t,e,n,i){i||(i=this.toFasta(e)?f[s.Hi.FASTA]:f[s.Hi.SEPARATOR]),n||(n=this.toFasta(e)?"":this.separator);const r=t.startsWith("RNA"),o=this.splitter(t),a=[];for(let t=0;t<o.length;++t){let n=o.getOriginal(t);if(r&&(n=n.replace(h.EK,"")),n===f[s.Hi.HELM])a.push(i);else if(this.toFasta(e)&&n.length>1){const t="["+n+"]";a.push(t)}else a.push(n)}return a.join(n)}convert(t,e){const n=this.getJoiner({notation:t,separator:e}),i=this.getNewColumn(t,e);return i.init((t=>{const e=this.getSplitted(t);return n(e)})),i}getRegion(t,e,n){const i=this.getNewColumn(this.notation,this.separator);i.name=n;const r=t??0,o=e??this.maxLength-1,a=this.getJoiner(),u=o-r+1,c=f[this.notation];i.init((t=>{const e=this.getSplitted(t),n=new Array(u);for(let t=0;t<u;++t){const i=r+t;n[t]=i<e.length?e.getOriginal(i):c}return a(new l.Mu(n,c))}));const h=t=>{const e=t.split(",").map((t=>t.trim())),n=new Array(u);for(let t=0;t<u;++t){const i=r+t;n[t]=i<e.length?e[i]:"?"}return n.join(s.z1)},d=this.column.getTag(s.gp.positionNames);d&&i.setTag(s.gp.positionNames,h(d));const p=this.column.getTag(s.gp.positionLabels);return p&&i.setTag(s.gp.positionLabels,h(p)),i}get joiner(){return this._joiner||(this._joiner=this.getJoiner()),this._joiner}getJoiner(t){const e=t?t.notation:this.notation,n=t?t.separator:this.separator;let i;const r=this;switch(e){case s.Hi.FASTA:i=function(t){return r.joinToFasta(t,r.isHelm())};break;case s.Hi.SEPARATOR:if(!n)throw new Error(`Separator is mandatory for notation '${e}'.`);i=function(t){return m(t,n,r.isHelm())};break;case s.Hi.HELM:{const t=r.alphabet===s.YI.DNA||r.alphabet===s.YI.RNA,e=r.getHelmWrappers();i=function(n){return g(n,e,t)};break}default:throw new Error(`Unexpected notation '${e}'.`)}return i}getConverter(t,e=void 0){if(t===s.Hi.SEPARATOR&&!e)throw new Error(`Target separator is not specified for target units '${s.Hi.SEPARATOR}'.`);const n=this;if(t===s.Hi.FASTA)return function(t){return n.convertToFasta(t)};if(t===s.Hi.HELM)return function(t){return n.convertToHelm(t)};if(t===s.Hi.SEPARATOR)return function(t){return n.convertToSeparator(t,e)};throw new Error}static forColumn(t){let e=t.temp[d.seqHandler];return e&&e.columnVersion===t.version||(e=t.temp[d.seqHandler]=new p(t)),e}joinToFasta(t,e){const n=new Array(t.length);for(let i=0;i<t.length;++i){const r=t.getOriginal(i);let o=t.getOriginal(i);e&&(o=o.replace(h.EK,"$1")),r===a._S?o=f[s.Hi.FASTA]:r===h.q7?o="":o.length>1&&(o="["+o+"]"),n[i]=o}return n.join("")}convertToFasta(t){const e=this.splitter,n=this.isHelm()?this.splitterAsHelmNucl(t):e(t);return this.joinToFasta(n,this.isHelm())}convertToSeparator(t,e){return m(this.isHelm()?this.splitterAsHelmNucl(t):this.splitter(t),e,this.isHelm())}convertToHelm(t){if(this.notation==s.Hi.HELM)return t;const e=this.getHelmWrappers(),n=t.startsWith("DNA")||t.startsWith("RNA");return g(this.splitter(t),e,n)}splitterAsHelmNucl(t){const e=this.splitter(t),n=new Array(e.length),i=t.startsWith("DNA"),r=t.startsWith("RNA");for(let t=0;t<e.length;++t){let o=e.getOriginal(t);(i||r)&&(o=o.replace(h.EK,"$1"),o=o===h.q7?null:o),n[t]=o||null}return new l.Mu(n.filter((t=>!!t)),f[s.Hi.HELM])}}function m(t,e,n){const i=new Array(t.length);for(let e=0;e<t.length;++e){const r=t.getCanonical(e);let o=t.getOriginal(e);n&&(o=o.replace(h.EK,"$1")),r===a._S?o=f[s.Hi.SEPARATOR]:r===h.q7&&(o=""),i[e]=o}return i.join(e)}function g(t,e,n){const[i,r,o,l]=e,u=new Array(t.length);for(let e=0;e<t.length;++e){const i=t.getCanonical(e);let l=t.getOriginal(e);i===a._S?l=f[s.Hi.HELM]:(n&&(l=l.replace(h.EK,"$1")),l=1===l.length?`${r}${l}${o}`:`${r}[${l}]${o}`),u[e]=l}return`${i}${u.join(".")}${l}`}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>o});var i=n(6082),r=n(826);function o(t){const e=t=>{const e=s.columns.addNewString((t+1).toString());return n.push(e),e},n=[],o=t.length,s=i.DataFrame.create(o),a=r.GO.forColumn(t);for(let t=0;t<o;++t){const i=a.getSplitted(t);for(let r=0;r<i.length;++r){const o=i.getOriginal(r);((n[r]??null)||e(r)).set(t,o,!1)}}return s}},4326:(t,e,n)=>{"use strict";n.d(e,{P4:()=>s,fH:()=>r});var i,r,o,s,a,l,u=n(6082);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(t){t.Entropy="Entropy",t.full="100%"}(r||(r={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(o||(o={})),function(t){t.LEFT="left",t.CENTER="center",t.RIGHT="right"}(s||(s={})),function(t){t.AUTO="auto",t.ON="on",t.OFF="off"}(a||(a={})),function(t){t.Filtered="Filtered",t.Selected="Selected"}(l||(l={})),new class{constructor(){this.sequenceColumnName=null,this.valueAggrType=u.AGG.TOTAL_COUNT,this.valueColumnName="Activity",this.startPositionName=null,this.endPositionName=null,this.skipEmptySequences=!0,this.skipEmptyPositions=!1,this.shrinkEmptyTail=!0,this.backgroundColor=4294967295,this.positionHeight=r.Entropy,this.positionWidth=16,this.verticalAlignment=o.MIDDLE,this.horizontalAlignment=s.CENTER,this.fixWidth=!1,this.fitArea=!0,this.minHeight=50,this.maxHeight=100,this.showPositionLabels=!0,this.positionMarginState=a.AUTO,this.positionMargin=0,this.filterSource=l.Filtered}}},5540:(t,e,n)=>{"use strict";t=n.hmd(t);var i,r=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,r=void 0!==t?t:{};r.ready=new Promise((function(t,i){e=t,n=i}));var o,s=Object.assign({},r),a="object"==typeof window,l="function"==typeof importScripts,u=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?u=self.location.href:"undefined"!=typeof document&&document.currentScript&&(u=document.currentScript.src),i&&(u=i),u=0!==u.indexOf("blob:")?u.substr(0,u.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(o=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),r.print||console.log.bind(console);var c,h,d=r.printErr||console.warn.bind(console);Object.assign(r,s),s=null,r.arguments&&r.arguments,r.thisProgram&&r.thisProgram,r.quit&&r.quit,r.wasmBinary&&(c=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var f,p,m,g=!1;function v(){var t=h.buffer;r.HEAP8=f=new Int8Array(t),r.HEAP16=new Int16Array(t),r.HEAP32=new Int32Array(t),r.HEAPU8=p=new Uint8Array(t),r.HEAPU16=new Uint16Array(t),r.HEAPU32=m=new Uint32Array(t),r.HEAPF32=new Float32Array(t),r.HEAPF64=new Float64Array(t)}var y=[],C=[],w=[],b=0,A=null,E=null;function S(t){r.onAbort&&r.onAbort(t),d(t="Aborted("+t+")"),g=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var T,x;function _(t){return t.startsWith("data:application/octet-stream;base64,")}function N(t){try{if(t==T&&c)return new Uint8Array(c);if(o)return o(t);throw"both async and sync fetching of the wasm failed"}catch(t){S(t)}}function M(t,e,n){return function(t){return c||!a&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return N(t)})):fetch(t,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+t+"'";return e.arrayBuffer()})).catch((function(){return N(t)}))}(t).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(t){return t})).then(n,(function(t){d("failed to asynchronously prepare wasm: "+t),S(t)}))}function O(t){for(;t.length>0;)t.shift()(r)}function L(t){this.excPtr=t,this.ptr=t-24,this.set_type=function(t){m[this.ptr+4>>2]=t},this.get_type=function(){return m[this.ptr+4>>2]},this.set_destructor=function(t){m[this.ptr+8>>2]=t},this.get_destructor=function(){return m[this.ptr+8>>2]},this.set_caught=function(t){t=t?1:0,f[this.ptr+12|0]=t},this.get_caught=function(){return 0!=f[this.ptr+12|0]},this.set_rethrown=function(t){t=t?1:0,f[this.ptr+13|0]=t},this.get_rethrown=function(){return 0!=f[this.ptr+13|0]},this.init=function(t,e){this.set_adjusted_ptr(0),this.set_type(t),this.set_destructor(e)},this.set_adjusted_ptr=function(t){m[this.ptr+16>>2]=t},this.get_adjusted_ptr=function(){return m[this.ptr+16>>2]},this.get_exception_ptr=function(){if(H(this.get_type()))return m[this.excPtr>>2];var t=this.get_adjusted_ptr();return 0!==t?t:this.excPtr}}function I(t){var e=h.buffer;try{return h.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function R(t){return r["_"+t]}_(T="wasmDbscan.wasm")||(x=T,T=r.locateFile?r.locateFile(x,u):u+x);var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,n,i,r){var o={string:t=>{var e=0;return null!=t&&0!==t&&(e=function(t){var e=function(t){for(var e=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);i<=127?e++:i<=2047?e+=2:i>=55296&&i<=57343?(e+=4,++n):e+=3}return e}(t)+1,n=F(e);return function(t,e,n){!function(t,e,n,i){if(!(i>0))return 0;for(var r=n+i-1,o=0;o<t.length;++o){var s=t.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++o)),s<=127){if(n>=r)break;e[n++]=s}else if(s<=2047){if(n+1>=r)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=r)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=r)break;e[n++]=240|s>>18,e[n++]=128|s>>12&63,e[n++]=128|s>>6&63,e[n++]=128|63&s}}e[n]=0}(t,p,e,n)}(t,n,e),n}(t)),e},array:t=>{var e,n,i=F(t.length);return e=t,n=i,f.set(e,n),i}},s=R(t),a=[],l=0;if(i)for(var u=0;u<i.length;u++){var c=o[n[u]];c?(0===l&&(l=U()),a[u]=c(i[u])):a[u]=i[u]}var h=s.apply(null,a);return function(t){return 0!==l&&V(l),function(t){return"string"===e?(n=t)?function(t,e,n){for(var i=e+n,r=e;t[r]&&!(r>=i);)++r;if(r-e>16&&t.buffer&&P)return P.decode(t.subarray(e,r));for(var o="";e<r;){var s=t[e++];if(128&s){var a=63&t[e++];if(192!=(224&s)){var l=63&t[e++];if((s=224==(240&s)?(15&s)<<12|a<<6|l:(7&s)<<18|a<<12|l<<6|63&t[e++])<65536)o+=String.fromCharCode(s);else{var u=s-65536;o+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else o+=String.fromCharCode((31&s)<<6|a)}else o+=String.fromCharCode(s)}return o}(p,n,i):"":"boolean"===e?Boolean(t):t;var n,i}(t)}(h)}var D,G={__cxa_throw:function(t,e,n){throw new L(t).init(e,n),t},abort:function(){S("")},emscripten_memcpy_big:function(t,e,n){p.copyWithin(t,e,e+n)},emscripten_resize_heap:function(t){var e,n=p.length,i=2147483648;if((t>>>=0)>i)return!1;for(var r=1;r<=4;r*=2){var o=n*(1+.2/r);if(o=Math.min(o,t+100663296),I(Math.min(i,(e=Math.max(t,o))+(65536-e%65536)%65536)))return!0}return!1}},U=(function(){var t,e,i,o,s={env:G,wasi_snapshot_preview1:G};function a(t,e){var n,i=t.exports;return r.asm=i,h=r.asm.memory,v(),r.asm.__indirect_function_table,n=r.asm.__wasm_call_ctors,C.unshift(n),function(t){if(b--,r.monitorRunDependencies&&r.monitorRunDependencies(b),0==b&&(null!==A&&(clearInterval(A),A=null),E)){var e=E;E=null,e()}}(),i}if(b++,r.monitorRunDependencies&&r.monitorRunDependencies(b),r.instantiateWasm)try{return r.instantiateWasm(s,a)}catch(t){d("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=c,e=T,i=s,o=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||_(e)||"function"!=typeof fetch?M(e,i,o):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(o,(function(t){return d("wasm streaming compile failed: "+t),d("falling back to ArrayBuffer instantiation"),M(e,i,o)}))}))).catch(n)}(),r._dbscan=function(){return(r._dbscan=r.asm.dbscan).apply(null,arguments)},r._malloc=function(){return(r._malloc=r.asm.malloc).apply(null,arguments)},r._free=function(){return(r._free=r.asm.free).apply(null,arguments)},function(){return(U=r.asm.stackSave).apply(null,arguments)}),V=function(){return(V=r.asm.stackRestore).apply(null,arguments)},F=function(){return(F=r.asm.stackAlloc).apply(null,arguments)},H=function(){return(H=r.asm.__cxa_is_pointer_type).apply(null,arguments)};function B(){function t(){D||(D=!0,r.calledRun=!0,g||(O(C),e(r),r.onRuntimeInitialized&&r.onRuntimeInitialized(),function(){if(r.postRun)for("function"==typeof r.postRun&&(r.postRun=[r.postRun]);r.postRun.length;)t=r.postRun.shift(),w.unshift(t);var t;O(w)}()))}b>0||(function(){if(r.preRun)for("function"==typeof r.preRun&&(r.preRun=[r.preRun]);r.preRun.length;)t=r.preRun.shift(),y.unshift(t);var t;O(y)}(),b>0||(r.setStatus?(r.setStatus("Running..."),setTimeout((function(){setTimeout((function(){r.setStatus("")}),1),t()}),1)):t()))}if(r.ccall=k,r.cwrap=function(t,e,n,i){var r=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&r&&!i?R(t):function(){return k(t,e,n,arguments)}},E=function t(){D||B(),D||(E=t)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return B(),t.ready});"object"==typeof exports?t.exports=r:"function"==typeof define&&n.amdO?define([],(function(){return r})):"object"==typeof exports&&(exports.exportCppDbscanLib=r)},4329:(t,e,n)=>{"use strict";n.d(e,{_:()=>o});var i=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};let r=null;function o(){return i(this,void 0,void 0,(function*(){if(!r&&(r=yield navigator.gpu.requestAdapter(),null==r))return null;const t=yield r.requestAdapterInfo();return t?s(t.description,s(t.vendor,"No GPU description available")):null}))}function s(t,e){return t&&""!=t?t:e}},5395:(t,e,n)=>{"use strict";function i(t={}){const e=function(){if(!t||!t.scoringMatrix||!t.alphabetIndexes)return(t,e)=>t===e?0:1;if(t.scoringMatrix.length!==Object.keys(t.alphabetIndexes).length)throw new Error("Scoring matrix and alphabet indexes should have the same length");const e=t.alphabetIndexes,n=t.scoringMatrix,i=Math.min(...Object.keys(e).map((t=>t.charCodeAt(0))))+1,r=new Float32Array((n.length+i)*(n.length+i));return Object.entries(e).forEach((([t,i])=>{const o=n[i];Object.entries(e).forEach((([e,i])=>{r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=o[i]}))})),(t,e)=>1-r[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,i)=>{let r=0;const o=t.length,s=i.length,a=Math.ceil(Math.max(o,s)*(1-n));o!==s&&(r=Math.abs(o-s));let l=0;for(let n=0;n<Math.min(o,s);n++)if(t[n]!==i[n]&&(l+=e(t[n],i[n]),l>a))return 1;return l+=r,l/=Math.max(o,s),l}}n.d(e,{k:()=>i})},4572:(t,e,n)=>{"use strict";n.d(e,{V:()=>i.V,Z:()=>i.Z});var i=n(2362)},3359:(t,e,n)=>{"use strict";n.d(e,{Q:()=>r});var i=n(2787);function r(){return(t,e)=>(0,i.I)(t,e)/Math.max(t.length,e.length)}},2362:(t,e,n)=>{"use strict";n.d(e,{V:()=>a,Z:()=>i});var i,r=n(5395),o=n(3359),s=n(250);!function(t){t.HAMMING="Hamming",t.LEVENSHTEIN="Levenshtein",t.NEEDLEMANN_WUNSCH="Needlemann-Wunsch",t.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance"}(i||(i={}));const a={[i.HAMMING]:r.k,[i.LEVENSHTEIN]:o.Q,[i.NEEDLEMANN_WUNSCH]:s.i,[i.MONOMER_CHEMICAL_DISTANCE]:r.k}},250:(t,e,n)=>{"use strict";n.d(e,{i:()=>r});const i={gapOpen:1,gapExtend:.6,scoringMatrix:[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0,-4],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1,-4],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1,-4],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1,-4],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1,-4],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1,-4],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1,-4],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1,-4],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1,-4],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1,-4],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1,-4],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1,-4],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2,-4],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0,-4],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0,-4],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2,-4],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1,-4],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1,-4],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1,-4],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1,-4],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1,-4],[-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,1]],alphabetIndexes:{A:0,R:1,N:2,D:3,C:4,Q:5,E:6,G:7,H:8,I:9,L:10,K:11,M:12,F:13,P:14,S:15,T:16,W:17,Y:18,V:19,B:20,Z:21,X:22,"*":23}};function r(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:r,scoringMatrix:o,alphabetIndexes:s}={...i,...t};Object.entries(s).forEach((([t,n])=>e[t.charCodeAt(0)]=n));const a=[new Float32Array(1e4),new Float32Array(1e4)];return(t,i)=>{const s=new Array(t.length+1).fill(!1),l=new Array(t.length+1).fill(!1);let u=0,c=1;for(let e=1;e<t.length+1;e++)a[0][e]=-r-(e-1)*r,a[1][e]=0;a[0][0]=0;for(let h=1;h<i.length+1;h++){a[c][0]=-r-(h-1)*r;for(let d=1;d<t.length+1;d++){const f=a[u][d-1]+o[e[t.charCodeAt(d-1)]][e[i.charCodeAt(h-1)]],p=a[u][d]-(s[d]||1===h||h===i.length?r:n),m=a[c][d-1]-(l[d-1]||1===d||d===t.length?r:n);a[c][d]=Math.max(f,m,p),a[c][d]===f?(s[d]=!1,l[d]=!1):a[c][d]===m?(s[d]=!1,l[d]=!0):(s[d]=!0,l[d]=!1)}u=c,c=(c+1)%2}const h=Math.min(t.length,i.length);return(h-a[u][t.length])/h}}},8774:(t,e,n)=>{"use strict";n.d(e,{A:()=>i});class i{constructor(t,e=!1){if(this._length=0,this._version=0,this._updateLevel=0,this._selectedCount=0,this._selectedCountVersion=-1,this._selectedIndexesVersion=-1,this._versionedName="",this._versionedNameVersion=-1,this.SHRINK_THRESHOLD=256,"number"==typeof t){const n=t,r=i._createBuffer(n);if(e)for(let t=0;t<r.length;t++)r[t]=-1;this._data=r,this._length=n}else{if(!(t instanceof Uint32Array))throw new Error("Invalid constructor");this._data=t,this._length=e}}getRawData(){return this._data}assureGoez(t,e){if(t<0)throw new Error(`${e} should be greater than zero`)}assureInRange(t,e,n,i){if(t<e||t>n)throw new Error(`Argument ${i} (${t}) out of range (${e}, ${n})`)}copy(t,e,n){for(let i=0;i<n;i++)e[i]=t[i]}copyFrom(t){if(this._length!=t._length)throw new Error(`Lengths differ (${this._length} != ${t._length})`);this.copy(t._data,this._data,this.lengthInInts),this._version++}get length(){return this._length}get buffer(){return this._data}set buffer(t){this._data=t,this._version++}get version(){return this._version}set version(t){this._version=t}incrementVersion(t=!0){this._version++}get lengthInInts(){return Math.floor((this._length+31)/32)}get versionedName(){return this._version==this._versionedNameVersion?this._versionedName:""}set versionedName(t){this._versionedName=t,this._versionedNameVersion=this._version}get self(){return this}setLength(t){if(t<0)throw new Error("should be >= 0");if(t==this._length)return;const e=Math.floor((t+31)/32);if(e>this._data.length||e+this.SHRINK_THRESHOLD<this._data.length){const t=new Uint32Array(e);this.copy(this._data,t,e>this._data.length?this._data.length:e),this._data=t}t>this._length&&(this._length%32>0&&(this._data[this.lengthInInts-1]&=(1<<(this._length%32&31))-1),this._data.fill(0,this.lengthInInts,e)),this._length=t,this._version++}static fromAnd(t,e){if(t._length!=e._length)throw new Error(`Lengths differ (${t._length} != ${e._length})`);const n=new i(t._length);n._length=t._length,n._data=i._createBuffer(n._length),n._version=0;const r=t.lengthInInts;for(let i=0;i<r;i++)n._data[i]=t._data[i]&e._data[i];return n}static _createBuffer(t){return new Uint32Array(Math.floor((t+31)/32))}static fromValues(t){const e=new i(t.length);e._version=0;for(let n=0;n<e._length;n++)t[n]&&(e._data[Math.floor(n/32)]|=1<<(n%32&31));return e}static fromSeq(t,e){const n=new i(t);for(let i=0;i<t;++i)n.setBit(i,e(i));return n._version=0,n}static fromString(t){return i.fromSeq(t.length,(e=>"1"==t.charAt(e)))}static fromUint32Array(t,e){const n=new i(t);return n._data=e,n}static fromBytes(t){const e=t.length,n=new i(8*e);n._data=new Uint32Array(Math.floor((e+3)/4)),n._length=8*e;let r=0,o=0;for(;e-o>=4;)n._data[r++]=255&t[o]|(255&t[o+1])<<8|(255&t[o+2])<<16|(255&t[o+3])<<24,o+=4;return e-o==3&&(n._data[r]=(255&t[o+2])<<16),e-o==2&&(n._data[r]|=(255&t[o+1])<<8),e-o==1&&(n._data[r]|=255&t[o]),n._version=0,n}toString(){return`${this._length} bits, ${this.countBits(!0)} set`}equals(t){if(this==t)return!0;if(null==t)return!1;if(this._length!=t._length)return!1;if(0==this._length)return!0;for(let e=0;e<this._data.length-1;e++)if(this._data[e]!=t._data[e])return!1;for(let e=8*(this._data.length-1);e<this._length;e++)if(this.getBit(e)!=t.getBit(e))return!1;return!0}clone(){const t=new i(0,!1);return t._data=Uint32Array.from(this._data),t._length=this._length,t._version=this._version,t}init(t,e){this.setAll(!1,!1);for(let e=0;e<this._length;e++)t(e)&&(this._data[Math.floor(e/32)]|=1<<(e%32&31));return this.incrementVersion(e),this}invert(t=!0){for(let t=0;t<this._data.length;t++)this._data[t]^=-1;this.incrementVersion(t)}setAll(t,e=!1){const n=t?-1:0,i=this.lengthInInts;for(let t=0;t<i;t++)this._data[t]=n;this.incrementVersion(e)}setIndexes(t,e=!0,n=!0,i=!0){n&&this.setAll(!e,!1);for(const n of t)this.setFast(n,e);this.incrementVersion(i)}everyIndex(t,e=!0){for(const n of t)if(this.getBit(n)!=e)return!1;return!0}anyIndex(t,e=!0){for(const n of t)if(this.getBit(n)==e)return!0;return!1}setWhere(t,e=!0,n=!0,i=!0,r=!0){if(n&&r&&this.setAll(!e,!1),r)for(let n=0;n<this._length;n++)t(n)&&this.setFast(n,e);else for(let n=0;n<this._length;n++)this.setFast(n,t(n)?e:!e);this.incrementVersion(i)}getRange(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return i.fromValues(n)}getRangeAsList(t,e){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length,"to");const n=[];for(let i=t;i<e;++i)n.push(this.getBit(i));return n}setRange(t,e,n,i=!0){this.assureInRange(t,0,this._length-1,"from"),this.assureInRange(e,0,this._length-1,"to");const r=Math.min(t,e),o=Math.max(t,e);if(n)for(let t=r;t<=o;t++)this.setTrue(t);else for(let t=r;t<=o;t++)this.setFalse(t);return this.incrementVersion(i),this}setRandom(t,e,n=!0){if(t<0||t>this._length)throw new Error("n must be >= 0 && <= Count");t>this._length/2&&this.setRandom(this._length-t,!e),this.setAll(!e);for(let n=0;n<t;){const t=Math.floor(Math.random()*this._length);this.getBit(t)!=e&&(this.setFast(t,e),n++)}this.incrementVersion(n)}and(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]&=t._data[e];return this.incrementVersion(e),this}andNot(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");const n=this.lengthInInts;for(let e=0;e<n;e++)this._data[e]&=~t._data[e];return this.incrementVersion(e),this}notAnd(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]=~this._data[e]&t._data[e];return this.incrementVersion(e),this}not(t=!0){for(let t=0,e=this.lengthInInts;t<e;t++)this._data[t]=~this._data[t];return this.incrementVersion(t),this}or(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]|=t._data[e];return this.incrementVersion(e),this}xor(t,e=!0){if(this._length!=t._length)throw new Error("Array lengths differ.");for(let e=0,n=this.lengthInInts;e<n;e++)this._data[e]^=t._data[e];return this.incrementVersion(e),this}insertAt(t,e,n=!1){if(this.assureInRange(t,0,this._length,"pos"),0==e)return;const i=this._length;this.setLength(this._length+e);for(let n=i-1;n>=t;n--)this.setBit(n+e,this.getBit(n));for(let i=t;i<t+e;i++)this.setBit(i,n)}removeAt(t,e=1){if(e<0)throw new Error("n cannot be negative");if(this.assureInRange(t,0,this._length-e,"pos"),this.contains(!0))for(let n=t;n<this._length-e;n++)this.setBit(n,this.getBit(n+e));this.setLength(this._length-e)}removeByMask(t,e=!0){if(this._length!=t.length)throw new Error("length != mask.length");if(t==this)this.setLength(t.countBits(!e)),this.setAll(!e);else{let n=0;for(let i=-1;-1!=(i=t.findNext(i,!e));)this.setFast(n++,this.getBit(i));this._length=n,this._version++}return this}getBit(t){return!!(this._data[Math.floor(t/32)]&1<<(31&t))}setBit(t,e,n=!0){this.setFast(t,e),this._version++}setFast(t,e){e?this._data[Math.floor(t/32)]|=1<<(31&t):this._data[Math.floor(t/32)]&=~(1<<(31&t))}setTrue(t){this._data[Math.floor(t/32)]|=1<<(31&t)}setFalse(t){this._data[Math.floor(t/32)]&=~(1<<(31&t))}trueCount(){return this.countBits(!0)}falseCount(){return this.countBits(!1)}countBits(t){if(0==this._length)return 0;if(this._selectedCountVersion!=this._version){this._selectedCount=0;const t=this.lengthInInts;let e=0;for(;e<t-1;e++)for(let t=this._data[e];0!=t;t>>>=8)this._selectedCount+=i._onBitCount[255&t];let n=this._data[e];const r=31&this._length;for(0!=r&&(n&=~(4294967295<<r));0!=n;n>>>=8)this._selectedCount+=i._onBitCount[255&n];this._selectedCountVersion=this._version}return t?this._selectedCount:this._length-this._selectedCount}countWhere(t){let e=0;if(this.trueCount()==this._length)for(let n=0;n<this._length;n++)e+=t(n)?1:0;else for(let n=-1;-1!=(n=this.findNext(n,!0));)e+=t(n)?1:0;return e}andWithCountBits(t,e){if(0==this._length)return 0;let n=0;const r=this.lengthInInts;let o=0;for(;o<r-1;o++)for(let e=this._data[o]&t._data[o];0!=e;e>>>=8)n+=i._onBitCount[255&e];let s=this._data[o]&t._data[o];const a=31&this._length;for(0!=a&&(s&=~(4294967295<<a));0!=s;s>>>=8)n+=i._onBitCount[255&s];return e?n:this._length-n}clear(){this.setLength(0)}contains(t){return this.findNext(-1,t)>=0}get allTrue(){return this.countBits(!0)==this._length}get allFalse(){return this.countBits(!1)==this._length}get anyTrue(){return this.countBits(!0)>0}get anyFalse(){return this.countBits(!1)>0}findNext(t,e=!0){if(this.assureInRange(t,-1,this._length,"index"),t>=this._length-1)return-1;let n=31&(t=t<0?0:t+1);const r=this.lengthInInts;for(let o=Math.floor(t/32);o<r;o++){let r=e?this._data[o]:~this._data[o];if(0!=n)r&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==r)continue;for(let e=0;0!=r;e+=8,r>>>=8){const n=i._firstOnBit[255&r];if(n>=0)return(t=n+32*o+e)>=this._length?-1:t}}return-1}findPrev(t,e=!0){if(0==t)return-1;this.assureInRange(t,-1,this._length,"index");let n=1+(t=t<0?this._length-1:t-1)&31;for(let r=Math.floor(t/32);r>=0;r--){let t=e?this._data[r]:~this._data[r];0!=n&&(t&=~(4294967295<<n),n=0);for(let e=24;0!=t;e-=8,t<<=8){const n=i._lastOnBit[t>>>24];if(n>=0)return n+32*r+e}}return-1}}i._onBitCount=Int8Array.from([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8]),i._firstOnBit=Int8Array.from([-1,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0]),i._lastOnBit=Int8Array.from([-1,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7])},8070:(t,e,n)=>{"use strict";n.d(e,{Pl:()=>D,bk:()=>q,gM:()=>k,L1:()=>P,cb:()=>B,E3:()=>I,Wj:()=>R,Xb:()=>U,N$:()=>V,t6:()=>L,PE:()=>M,rd:()=>O,Bl:()=>j,CN:()=>C});var i=n(4328),r=n(6082);n(9982);const o=r.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');o.columns.add(r.Column.fromList(r.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var s=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function a(t,e,n,r,o,a,l,u,c=!0){return s(this,void 0,void 0,(function*(){let h=null;if(yield O(r,(n=>s(this,void 0,void 0,(function*(){let n=null;for(const i of t.viewers)i.type===e&&(n=i);if(!n)throw Error("Viewer hasn't been added");if(yield Promise.resolve(),a&&(yield a(n)),o){const e=null!=u?u:{};e.tv=t,e.viewer=n,h=yield o(e,c)}yield M(i.events.onViewerClosed,(()=>{I(n.subs.some((t=>!t.closed)),!1)}),(()=>n.close()),3e3)}))),(()=>s(this,void 0,void 0,(function*(){l?t.loadLayout(l):yield function(t,e,n){return s(this,void 0,void 0,(function*(){let i;return n?(i=yield t.dataFrame.plot.fromType(e),t.dockManager.dock(i)):i=t.addViewer(e),i}))}(t,e,n)}))),6e4,"TEST_EVENT_ASYNC"),h)return h}))}function l(t,e=!0){return s(this,void 0,void 0,(function*(){const n=t.tv.dataFrame,i=n.clone();Array.from(n.row(0).cells).forEach((t=>t.value=null));const r=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((t=>t.idx>=0&&t.idx<r)),e&&(yield B(50));for(let t=r;t<2*r;t++)n.filter.set(t,!1);e&&(yield B(50)),n.currentRowIdx=1,n.columns.names().slice(0,Math.ceil(n.columns.length/2)).forEach((t=>n.columns.remove(t))),e&&(yield B(100)),t.tv.dataFrame=i,yield B(50)}))}function u(t,e=!0){return s(this,void 0,void 0,(function*(){const e=t.tv.dataFrame;setTimeout((()=>e.filter.set(0,!e.filter.get(0))),0)}))}function c(t,e=!0){return s(this,void 0,void 0,(function*(){let e,n;try{e=t.viewer.getOptions(!0).look}catch(t){throw new Error("Viewer's .getOptions() error.",{cause:t})}try{n=t.viewer.getProperties()}catch(t){throw new Error("Viewer's .getProperties() error.",{cause:t})}const i={};return Object.keys(e).filter((t=>"boolean"==typeof e[t])).forEach((t=>i[t]=!e[t])),n.filter((t=>null!==t.choices)).forEach((t=>i[t.name]=t.choices.find((n=>n!==e[t.name])))),t.viewer.setOptions(i),yield B(300),{layout:t.tv.saveLayout(),savedProps:t.viewer.getOptions().look}}))}function h(t,e=!0){return s(this,void 0,void 0,(function*(){I(JSON.stringify(t.viewer.getOptions().look),JSON.stringify(t.savedProps))}))}var d=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const f=3e4,p=108e5,m=console.log.bind(console),g=console.info.bind(console),v=console.warn.bind(console),y=console.error.bind(console),C={},w="Auto Tests",b="Demo",A="Detectors",E="Core",S={};let T;var x;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(x||(x={}));class _{constructor(t,e){this.catchUnhandled=!0,this.report=!1,void 0!==t&&(this.catchUnhandled=t),void 0!==e&&(this.report=e)}}class N{constructor(t,e,n,i){var r;this.category=t,this.name=e,null!=i||(i={}),null!==(r=i.timeout)&&void 0!==r||(i.timeout=f),this.options=i,this.test=()=>d(this,void 0,void 0,(function*(){return new Promise(((t,e)=>d(this,void 0,void 0,(function*(){let i="";try{i=yield n()}catch(t){e(t)}t(i)}))))}))}}function M(t,e,n,i=0,r="timeout"){return d(this,void 0,void 0,(function*(){return new Promise(((o,s)=>{const a=t.subscribe((t=>{try{e(t),o("OK")}catch(t){s(t)}finally{a.unsubscribe(),clearTimeout(l)}})),l=setTimeout((()=>{a.unsubscribe(),s(r)}),i);n()}))}))}function O(t,e,n,i=0,r="timeout"){return d(this,void 0,void 0,(function*(){return new Promise(((o,s)=>{const a=t.subscribe((t=>{e(t).then((()=>{o("OK")})).catch((t=>{s(t)})).finally((()=>{a.unsubscribe(),clearTimeout(l)}))})),l=setTimeout((()=>{a.unsubscribe(),s(r)}),i);n()}))}))}function L(t,e,n){null==C[T]&&(C[T]={}),null==C[T].tests&&(C[T].tests=[]),C[T].tests.push(new N(T,t,e,n))}function I(t,e=!0,n){if(n=n?`${n}, `:"",t!==e)throw new Error(`${n}Expected "${e}", got "${t}"`)}function R(t,e,n=.001,i){if(t===Number.POSITIVE_INFINITY&&e===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY&&e===Number.NEGATIVE_INFINITY||t===Number.NaN&&e===Number.NaN||isNaN(t)&&isNaN(e))return;const r=Math.abs(t-e)<n;if(I(r,!0,`${null!=i?i:""} (tolerance = ${n})`),!r)throw new Error(`Expected ${e}, got ${t} (tolerance = ${n})`)}function P(t,e,n){var i;T=t,e(),C[T]&&(C[T].clear=null===(i=null==n?void 0:n.clear)||void 0===i||i,C[T].timeout=null==n?void 0:n.timeout,C[T].benchmarks=null==n?void 0:n.benchmarks,C[T].stressTests=null==n?void 0:n.stressTests)}function k(t){null==C[T]&&(C[T]={}),C[T].before=t}function D(t){null==C[T]&&(C[T]={}),C[T].after=t}function G(t,e){return t.replace(new RegExp(e.name,"gi"),e.nqName)}function U(t,e){var n,s,a,l;return d(this,void 0,void 0,(function*(){const u=t.id;if(S[u])return;const c=e?e.tests:C;if(void 0!==c[w]||void 0!==c[b]||Object.keys(c).find((t=>t.startsWith(w)||t.startsWith(E))))return void(S[u]=!0);if("DevTools"===t.name||e&&"DevTools"===e._package.name)for(const t of window.dartTests){const e=t.name.split(/\s*\|\s*!/g);let i=null!==(n=e.pop())&&void 0!==n?n:t.name,r=e.length?E+": "+e.join(": "):E,o=i.split(" | ");i=o[o.length-1],o.unshift(r),o.pop(),r=o.join(": "),void 0===c[r]&&(c[r]={tests:[],clear:!0}),c[r].tests.push(new N(r,i,t.test,{isAggregated:!1,timeout:null!==(a=null===(s=t.options)||void 0===s?void 0:s.timeout)&&void 0!==a?a:f,skipReason:null===(l=t.options)||void 0===l?void 0:l.skipReason}))}const h=[],p=[],m=[],g=yield i.dapi.functions.filter(`package.id = "${u}"`).list(),v=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const t of g){const e=t.options.test,n=t.options.demoPath;if(e&&Array.isArray(e)&&e.length)for(let n=0;n<e.length;n++){const o=e[n].matchAll(v),s={};Array.from(o).forEach((t=>{t[0].startsWith("skip")?s.skip=t[1]:t[0].startsWith("wait")?s.wait=parseInt(t[2]):t[0].startsWith("cat")?s.cat=t[3]:t[0].startsWith("timeout")&&(s.timeout=parseInt(t[4]))}));const a=new N(w,1===e.length?t.name:`${t.name} ${n+1}`,(()=>d(this,void 0,void 0,(function*(){const r=yield i.functions.eval(G(e[n],t));if(s.wait&&(yield B(s.wait)),"boolean"==typeof r&&!r)throw`Failed: ${e[n]}, expected true, got ${r}`}))),{skipReason:s.skip,timeout:r.Test.isInBenchmark?s.benchmarkTimeout:s.timeout});if(s.cat){const t=w+": "+s.cat;a.category=t,void 0===c[t]&&(c[t]={tests:[],clear:!0}),c[t].tests.push(a)}else h.push(a)}if(n){const e=t.options.demoWait?parseInt(t.options.demoWait):void 0,n=new N(b,t.friendlyName,(()=>d(this,void 0,void 0,(function*(){i.shell.isInDemo=!0,void 0===i.shell.view(r.View.BROWSE)&&(i.shell.v=r.View.createByType(r.View.BROWSE)),yield B(300),i.shell.clearLastError(),yield t.apply(),yield B(e||2e3);const n=yield i.shell.lastError;if(n)throw new Error(n);i.shell.isInDemo=!1}))),{skipReason:t.options.demoSkip});p.push(n)}if(t.hasTag("semTypeDetector")){const e=new N(A,t.friendlyName,(()=>d(this,void 0,void 0,(function*(){const e=[];for(const n of o.clone().columns){const i=yield t.apply([n]);e.push(i||n.semType)}I(e.filter((t=>t)).length,1)}))),{skipReason:t.options.skipTest});m.push(e)}}S[u]=!0,h.length&&(c[w]={tests:h,clear:!0}),p.length&&(c[b]={tests:p,clear:!0}),m.length&&(c[A]={tests:m,clear:!1})}))}function V(t){var e,n,o,s;return d(this,void 0,void 0,(function*(){const a=null===(n=null===(e=i.functions.getCurrentCall())||void 0===e?void 0:e.func)||void 0===n?void 0:n.package;yield U(a);const l=[];console.log("Running tests"),null!=t||(t={}),null!==(o=(s=t).testContext)&&void 0!==o||(s.testContext=new _),i.shell.clearLastError();const u=function(){const t=[];return console.log=(...e)=>{t.push(...e),m(...e)},console.info=(...e)=>{t.push(...e),g(...e)},console.warn=(...e)=>{t.push(...e),v(...e)},console.error=(...e)=>{t.push(...e),y(...e)},t}();(null==t?void 0:t.stressTest)?yield function(t){var e,n,i,o,s,h;return d(this,void 0,void 0,(function*(){let d=[];for(const[t,r]of Object.entries(C)){let t=null===(e=r.tests)||void 0===e?void 0:e.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest}));r.stressTests&&(t=null===(n=r.tests)||void 0===n?void 0:n.filter((t=>{var e,n;return void 0===(null===(e=t.options)||void 0===e?void 0:e.stressTest)||!0===(null===(n=t.options)||void 0===n?void 0:n.stressTest)})));const s=null===(i=r.tests)||void 0===i?void 0:i.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));if(!s)for(let e of null!=t?t:[])null==(null===(o=e.options)||void 0===o?void 0:o.skipReason)&&d.push({test:e,value:r})}d=function(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}(d);const f=[];for(let e of d){yield c(e.value.before,null!==(s=t.category)&&void 0!==s?s:"");let n=yield H(e.test,null==t?void 0:t.test,u,r.Test.isInBenchmark?e.value.benchmarkTimeout:e.value.timeout,a.name,t.verbose);n&&f.push(n),console.log(`Test: ${null==L?void 0:L.name}; result: ${n}`),yield c(e.value.after,null!==(h=t.category)&&void 0!==h?h:"")}l.push(...f)}))}(t):yield function(t,e){var n,o,s,h,f,p,C;return d(this,void 0,void 0,(function*(){try{for(const[d,g]of Object.entries(t)){if((null==e?void 0:e.category)&&!d.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(n=e.exclude)||void 0===n?void 0:n.some((t=>d.startsWith(t)))))continue;m(`Started ${d} category`);const t=null===(o=g.tests)||void 0===o?void 0:o.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));t||(g.beforeStatus=yield c(g.before,null!==(s=e.category)&&void 0!==s?s:""));const v=null!==(h=g.tests)&&void 0!==h?h:[],y=[];if(g.clear)for(let t=0;t<v.length;t++){v[t].options&&void 0===(null===(f=v[t].options)||void 0===f?void 0:f.benchmark)&&(v[t].options||(v[t].options={}),v[t].options.benchmark=null!==(p=g.benchmarks)&&void 0!==p&&p);let n=yield H(v[t],null==e?void 0:e.test,u,r.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,a.name,e.verbose);n&&y.push(n),i.shell.closeAll(),r.Balloon.closeAll()}else for(let t=0;t<v.length;t++){let n=yield H(v[t],null==e?void 0:e.test,u,r.Test.isInBenchmark?g.benchmarkTimeout:g.timeout,a.name,e.verbose);n&&y.push(n)}const w=y.filter((t=>"skipped"!=t.result));t||(g.afterStatus=yield c(g.after,null!==(C=e.category)&&void 0!==C?C:"")),g.afterStatus&&w.push({date:(new Date).toISOString(),logs:"",category:d,name:"after",result:g.afterStatus,success:!1,ms:0,skipped:!1}),g.beforeStatus&&w.push({date:(new Date).toISOString(),logs:"",category:d,name:"before",result:g.beforeStatus,success:!1,ms:0,skipped:!1}),l.push(...w)}}finally{console.log=m,console.info=g,console.warn=v,console.error=y}if(e.testContext.catchUnhandled&&!r.Test.isInBenchmark){yield B(1e3);const t=yield i.shell.lastError,e={logs:"",date:(new Date).toISOString(),category:"Unhandled exceptions",name:"Exception",result:null!=t?t:"",success:!t,ms:0,skipped:!1};l.push(e),e.package=a.name,null!=i.shell.reportTest?yield i.shell.reportTest("package",e):yield fetch(`${i.dapi.root}/log/tests/package`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}}))}(C,t);for(let t of l)t.result=t.result.toString().replace(/"/g,"'"),null!=t.logs&&(t.logs=t.logs.toString().replace(/"/g,"'"));return l;function c(t,e){return d(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==t&&(yield Y((()=>d(this,void 0,void 0,(function*(){yield t()}))),1e5,`before ${e}: timeout error`))}catch(t){n=yield F(t)}return n}))}}))}function F(t){return d(this,void 0,void 0,(function*(){return`${t.toString()}\n${t.stack?yield r.Logger.translateStackTrace(t.stack):""}`}))}function H(t,e,n,o,s,a){var l,u,c,h,g,v,C,w;return d(this,void 0,void 0,(function*(){let d;n.length=0;let b="package";const A=null!=e&&t.name.toLowerCase()!==e.toLowerCase();let E=(null===(l=t.options)||void 0===l?void 0:l.skipReason)||A,S=A?"skipped":null===(u=t.options)||void 0===u?void 0:u.skipReason;if(r.Test.isInBenchmark&&!(null===(c=t.options)||void 0===c?void 0:c.benchmark))return void m(`SKIPPED: ${t.category} ${t.name} doesnt available in benchmark mode`);E||m(`Started ${t.category} ${t.name}`);const T=Date.now();try{if(E)d={date:(new Date).toISOString(),success:!0,result:S,ms:0,skipped:!0};else{let e=(null===(h=t.options)||void 0===h?void 0:h.timeout)===f&&o?o:null===(g=t.options)||void 0===g?void 0:g.timeout;e=e===f&&r.Test.isInBenchmark?p:e,d={date:(new Date).toISOString(),success:!0,result:null!==(v=yield Y(t.test,e))&&void 0!==v?v:"OK",ms:0,skipped:!1}}}catch(t){y(t),d={date:(new Date).toISOString(),success:!1,result:yield F(t),ms:0,skipped:!1}}if((null===(C=t.options)||void 0===C?void 0:C.isAggregated)&&d.result.constructor===r.DataFrame){const t=d.result.col("success");if(t&&(d.success=t.stats.sum===t.length),!a){const t=d.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),d.result=t}d.result=d.result.toCsv()}if(d.logs=n.join("\n"),d.ms=Date.now()-T,E||m(`Finished ${t.category} ${t.name} for ${d.ms} ms`),d.category=t.category,d.name=t.name,!A){let e={success:d.success,result:d.result,ms:d.ms,skipped:d.skipped,package:s,category:t.category,name:t.name,logs:d.logs};if(d.result.constructor==Object){const t=Object.keys(d.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:d.result[e]})),{});e=Object.assign(Object.assign({},e),t)}e.result instanceof r.DataFrame&&(e.result=JSON.stringify(null===(w=e.result)||void 0===w?void 0:w.toJson())||""),null!=i.shell.reportTest?yield i.shell.reportTest(b,e):yield fetch(`${i.dapi.root}/log/tests/${b}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}return d}))}function B(t){return d(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function q(t,e="Timeout exceeded",n=500,i=50){return d(this,void 0,void 0,(function*(){return new Promise(((r,o)=>{setTimeout((()=>{clearInterval(s),o(new Error(e))}),n);const s=setInterval((()=>{t()&&(clearInterval(s),r())}),i)}))}))}function Y(t,e,n="EXECUTION TIMEOUT"){return d(this,void 0,void 0,(function*(){let i=null;const r=new Promise(((t,r)=>{i=setTimeout((()=>{r(n)}),e)}));try{return yield Promise.race([t(),r])}finally{i&&clearTimeout(i)}}))}const $=r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])]);function j(t,e,n){var r;return d(this,void 0,void 0,(function*(){const o=null!==(r=null==n?void 0:n.packageName)&&void 0!==r?r:"";(null==n?void 0:n.detectSemanticTypes)&&(yield i.data.detectSemanticTypes(e));const s=i.shell.addTableView(e);try{yield a(s,t,o,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(s,t,o,i.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,l,n.awaitViewer)));let e=null;e=yield a(s,t,o,i.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(e=yield a(s,t,o,i.events.onViewerAdded,c,n.awaitViewer)),yield a(s,t,o,i.events.onViewLayoutApplied,h,void 0,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps}),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewLayoutApplied,h,n.awaitViewer,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(s.dataFrame=$,yield B(50),yield a(s,t,o,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,void 0,n.awaitViewer))),yield a(s,t,o,i.events.onViewerAdded,u),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,u,n.awaitViewer))}finally{}}))}},7233:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,r=e.createElement.bind(e),o=r("div"),s=r("table"),a=r("tbody"),l=r("tr"),u=Array.isArray,c=Array.prototype,h=c.concat,d=c.filter,f=c.indexOf,p=c.map,m=c.push,g=c.slice,v=c.some,y=c.splice,C=/^#(?:[\w-]|\\.|[^\x00-\xa0])*$/,w=/^\.(?:[\w-]|\\.|[^\x00-\xa0])*$/,b=/<.+>/,A=/^\w+$/;function E(t,e){var n,i=!!(n=e)&&11===n.nodeType;return t&&(i||M(e)||O(e))?!i&&w.test(t)?e.getElementsByClassName(t.slice(1).replace(/\\/g,"")):!i&&A.test(t)?e.getElementsByTagName(t):e.querySelectorAll(t):[]}var S=function(){function t(t,i){if(t){if(_(t))return t;var r=t;if(I(t)){var o=i||e;if(!(r=C.test(t)&&M(o)?o.getElementById(t.slice(1).replace(/\\/g,"")):b.test(t)?J(t):_(o)?o.find(t):I(o)?x(o).find(t):E(t,o)))return}else if(L(t))return this.ready(t);(r.nodeType||r===n)&&(r=[r]),this.length=r.length;for(var s=0,a=this.length;s<a;s++)this[s]=r[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),T=S.prototype,x=T.init;function _(t){return t instanceof S}function N(t){return!!t&&t===t.window}function M(t){return!!t&&9===t.nodeType}function O(t){return!!t&&1===t.nodeType}function L(t){return"function"==typeof t}function I(t){return"string"==typeof t}function R(t){return void 0===t}function P(t){return null===t}function k(t){return!isNaN(parseFloat(t))&&isFinite(t)}function D(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}function G(t,e,n){if(n){for(var i=t.length;i--;)if(!1===e.call(t[i],i,t[i]))return t}else if(D(t))for(var r=Object.keys(t),o=(i=0,r.length);i<o;i++){var s=r[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,o=t.length;i<o;i++)if(!1===e.call(t[i],i,t[i]))return t;return t}function U(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="boolean"==typeof t[0]&&t.shift(),i=t.shift(),r=t.length;if(!i)return{};if(!r)return U(n,x,i);for(var o=0;o<r;o++){var s=t[o];for(var a in s)n&&(u(s[a])||D(s[a]))?(i[a]&&i[a].constructor===s[a].constructor||(i[a]=new s[a].constructor),U(n,i[a],s[a])):i[a]=s[a]}return i}x.fn=x.prototype=T,T.length=0,T.splice=y,"function"==typeof Symbol&&(T[Symbol.iterator]=c[Symbol.iterator]),x.isWindow=N,x.isFunction=L,x.isArray=u,x.isNumeric=k,x.isPlainObject=D,x.each=G,T.each=function(t){return G(this,t)},T.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},x.extend=U,T.extend=function(t){return U(T,t)};var V=/\S+/g;function F(t){return I(t)&&t.match(V)||[]}function H(t,e,i){if(O(t)){var r=n.getComputedStyle(t,null);return i?r.getPropertyValue(e)||void 0:r[e]||t.style[e]}}function B(t,e){return parseInt(H(t,e),10)||0}function q(t,e){return B(t,"border".concat(e?"Left":"Top","Width"))+B(t,"padding".concat(e?"Left":"Top"))+B(t,"padding".concat(e?"Right":"Bottom"))+B(t,"border".concat(e?"Right":"Bottom","Width"))}T.toggleClass=function(t,e){var n=F(t),i=!R(e);return this.each((function(t,r){O(r)&&G(n,(function(t,n){i?e?r.classList.add(n):r.classList.remove(n):r.classList.toggle(n)}))}))},T.addClass=function(t){return this.toggleClass(t,!0)},T.removeAttr=function(t){var e=F(t);return this.each((function(t,n){O(n)&&G(e,(function(t,e){n.removeAttribute(e)}))}))},T.attr=function(t,e){if(t){if(I(t)){if(arguments.length<2){if(!this[0]||!O(this[0]))return;var n=this[0].getAttribute(t);return P(n)?void 0:n}return R(e)?this:P(e)?this.removeAttr(t):this.each((function(n,i){O(i)&&i.setAttribute(t,e)}))}for(var i in t)this.attr(i,t[i]);return this}},T.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},T.hasClass=function(t){return!!t&&v.call(this,(function(e){return O(e)&&e.classList.contains(t)}))},T.get=function(t){return R(t)?g.call(this):this[(t=Number(t))<0?t+this.length:t]},T.eq=function(t){return x(this.get(t))},T.first=function(){return this.eq(0)},T.last=function(){return this.eq(-1)},T.text=function(t){return R(t)?this.get().map((function(t){return O(t)||(e=t)&&3===e.nodeType?t.textContent:"";var e})).join(""):this.each((function(e,n){O(n)&&(n.textContent=t)}))};var Y={};function $(t){return"none"===H(t,"display")}function j(t,e){var n=t&&(t.matches||t.webkitMatchesSelector||t.msMatchesSelector);return!!n&&!!e&&n.call(t,e)}function W(t){return I(t)?function(e,n){return j(n,t)}:L(t)?t:_(t)?function(e,n){return t.is(n)}:t?function(e,n){return n===t}:function(){return!1}}function z(t,e){return e?t.filter(e):t}T.filter=function(t){var e=W(t);return x(d.call(this,(function(t,n){return e.call(t,n,t)})))},T.detach=function(t){return z(this,t).each((function(t,e){e.parentNode&&e.parentNode.removeChild(e)})),this};var K=/^\s*<(\w+)[^>]*>/,Q=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,X={"*":o,tr:a,td:l,th:l,thead:s,tbody:s,tfoot:s};function J(t){if(!I(t))return[];if(Q.test(t))return[r(RegExp.$1)];var e=K.test(t)&&RegExp.$1,n=X[e]||X["*"];return n.innerHTML=t,x(n.childNodes).detach().get()}function Z(t,e,n,i){for(var r=[],o=L(e),s=i&&W(i),a=0,l=t.length;a<l;a++)if(o){var u=e(t[a]);u.length&&m.apply(r,u)}else for(var c=t[a][e];!(null==c||i&&s(-1,c));)r.push(c),c=n?c[e]:null;return r}function tt(t){return t.multiple&&t.options?Z(d.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?d.call(t,(function(t,e,n){return f.call(n,t)===e})):t}x.parseHTML=J,T.has=function(t){var e=I(t)?function(e,n){return E(t,n).length}:function(e,n){return n.contains(t)};return this.filter(e)},T.not=function(t){var e=W(t);return this.filter((function(n,i){return(!I(t)||O(i))&&!e.call(i,n,i)}))},T.val=function(t){return arguments.length?this.each((function(e,n){var i=n.multiple&&n.options;if(i||It.test(n.type)){var r=u(t)?p.call(t,String):P(t)?[]:[String(t)];i?G(n.options,(function(t,e){e.selected=r.indexOf(e.value)>=0}),!0):n.checked=r.indexOf(n.value)>=0}else n.value=R(t)||P(t)?"":t})):this[0]&&tt(this[0])},T.is=function(t){var e=W(t);return v.call(this,(function(t,n){return e.call(t,n,t)}))},x.guid=1,x.unique=et,T.add=function(t,e){return x(et(this.get().concat(x(t,e).get())))},T.children=function(t){return z(x(et(Z(this,(function(t){return t.children})))),t)},T.parent=function(t){return z(x(et(Z(this,"parentNode"))),t)},T.index=function(t){var e=t?x(t)[0]:this[0],n=t?this:x(e).parent().children();return f.call(n,e)},T.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},T.siblings=function(t){return z(x(et(Z(this,(function(t){return x(t).parent().children().not(t)})))),t)},T.find=function(t){return x(et(Z(this,(function(e){return E(t,e)}))))};var nt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,it=/^$|^module$|\/(java|ecma)script/i,rt=["type","src","nonce","noModule"];function ot(t,e,n,o,s,a,l,u){return G(t,(function(t,a){G(x(a),(function(t,a){G(x(e),(function(e,l){var u=n?l:a,c=n?t:e;!function(t,e,n,o,s){o?t.insertBefore(e,n?t.firstChild:null):"HTML"===t.nodeName?t.parentNode.replaceChild(e,t):t.parentNode.insertBefore(e,n?t:t.nextSibling),s&&function(t,e){var n=x(t);n.filter("script").add(n.find("script")).each((function(t,n){if(it.test(n.type)&&i.contains(n)){var o=r("script");o.text=n.textContent.replace(nt,""),G(rt,(function(t,e){n[e]&&(o[e]=n[e])})),e.head.insertBefore(o,null),e.head.removeChild(o)}}))}(e,t.ownerDocument)}(n?a:l,c?u.cloneNode(!0):u,o,s,!c)}),u)}),l)}),a),e}T.after=function(){return ot(arguments,this,!1,!1,!1,!0,!0)},T.append=function(){return ot(arguments,this,!1,!1,!0)},T.html=function(t){if(!arguments.length)return this[0]&&this[0].innerHTML;if(R(t))return this;var e=/<script[\s>]/.test(t);return this.each((function(n,i){O(i)&&(e?x(i).empty().append(t):i.innerHTML=t)}))},T.appendTo=function(t){return ot(arguments,this,!0,!1,!0)},T.wrapInner=function(t){return this.each((function(e,n){var i=x(n),r=i.contents();r.length?r.wrapAll(t):i.append(t)}))},T.before=function(){return ot(arguments,this,!1,!0)},T.wrapAll=function(t){for(var e=x(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},T.wrap=function(t){return this.each((function(e,n){var i=x(t)[0];x(n).wrapAll(e?i.cloneNode(!0):i)}))},T.insertAfter=function(t){return ot(arguments,this,!0,!1,!1,!1,!1,!0)},T.insertBefore=function(t){return ot(arguments,this,!0,!0)},T.prepend=function(){return ot(arguments,this,!1,!0,!0,!0,!0)},T.prependTo=function(t){return ot(arguments,this,!0,!0,!0,!1,!1,!0)},T.contents=function(){return x(et(Z(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},T.next=function(t,e,n){return z(x(et(Z(this,"nextElementSibling",e,n))),t)},T.nextAll=function(t){return this.next(t,!0)},T.nextUntil=function(t,e){return this.next(e,!0,t)},T.parents=function(t,e){return z(x(et(Z(this,"parentElement",!0,e))),t)},T.parentsUntil=function(t,e){return this.parents(e,t)},T.prev=function(t,e,n){return z(x(et(Z(this,"previousElementSibling",e,n))),t)},T.prevAll=function(t){return this.prev(t,!0)},T.prevUntil=function(t,e){return this.prev(e,!0,t)},T.map=function(t){return x(h.apply([],p.call(this,(function(e,n){return t.call(e,n,e)}))))},T.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},T.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===H(n,"position");)n=n.offsetParent;return n||i}))},T.slice=function(t,e){return x(g.call(this,t,e))};var st=/-([a-z])/g;function at(t){return t.replace(st,(function(t,e){return e.toUpperCase()}))}T.ready=function(t){var n=function(){return setTimeout(t,0,x)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},T.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=x(e);n.replaceWith(n.children())}})),this},T.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},T.position=function(){var t=this[0];if(t){var e="fixed"===H(t,"position"),n=e?t.getBoundingClientRect():this.offset();if(!e){for(var i=t.ownerDocument,r=t.offsetParent||i.documentElement;(r===i.body||r===i.documentElement)&&"static"===H(r,"position");)r=r.parentNode;if(r!==t&&O(r)){var o=x(r).offset();n.top-=o.top+B(r,"borderTopWidth"),n.left-=o.left+B(r,"borderLeftWidth")}}return{top:n.top-B(t,"marginTop"),left:n.left-B(t,"marginLeft")}}};var lt={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};T.prop=function(t,e){if(t){if(I(t))return t=lt[t]||t,arguments.length<2?this[0]&&this[0][t]:this.each((function(n,i){i[t]=e}));for(var n in t)this.prop(n,t[n]);return this}},T.removeProp=function(t){return this.each((function(e,n){delete n[lt[t]||t]}))};var ut=/^--/;function ct(t){return ut.test(t)}var ht={},dt=o.style,ft=["webkit","moz","ms"],pt={animationIterationCount:!0,columnCount:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0};function mt(t,e,n){return void 0===n&&(n=ct(t)),n||pt[t]||!k(e)?e:"".concat(e,"px")}function gt(t,e){try{return t(e)}catch(t){return e}}T.css=function(t,e){if(I(t)){var n=ct(t);return t=function(t,e){if(void 0===e&&(e=ct(t)),e)return t;if(!ht[t]){var n=at(t),i="".concat(n[0].toUpperCase()).concat(n.slice(1));G("".concat(n," ").concat(ft.join("".concat(i," "))).concat(i).split(" "),(function(e,n){if(n in dt)return ht[t]=n,!1}))}return ht[t]}(t,n),arguments.length<2?this[0]&&H(this[0],t,n):t?(e=mt(t,e,n),this.each((function(i,r){O(r)&&(n?r.style.setProperty(t,e):r.style[t]=e)}))):this}for(var i in t)this.css(i,t[i]);return this};var vt=/^\s+|\s+$/;function yt(t,e){var n=t.dataset[e]||t.dataset[at(e)];return vt.test(n)?n:gt(JSON.parse,n)}function Ct(t,e){var n=t.documentElement;return Math.max(t.body["scroll".concat(e)],n["scroll".concat(e)],t.body["offset".concat(e)],n["offset".concat(e)],n["client".concat(e)])}T.data=function(t,e){if(!t){if(!this[0])return;var n={};for(var i in this[0].dataset)n[i]=yt(this[0],i);return n}if(I(t))return arguments.length<2?this[0]&&yt(this[0],t):R(e)?this:this.each((function(n,i){!function(t,e,n){n=gt(JSON.stringify,n),t.dataset[at(e)]=n}(i,t,e)}));for(var i in t)this.data(i,t[i]);return this},G([!0,!1],(function(t,e){G(["Width","Height"],(function(t,n){var i="".concat(e?"outer":"inner").concat(n);T[i]=function(i){if(this[0])return N(this[0])?e?this[0]["inner".concat(n)]:this[0].document.documentElement["client".concat(n)]:M(this[0])?Ct(this[0],n):this[0]["".concat(e?"offset":"client").concat(n)]+(i&&e?B(this[0],"margin".concat(t?"Top":"Left"))+B(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),G(["Width","Height"],(function(t,e){var n=e.toLowerCase();T[n]=function(i){if(!this[0])return R(i)?void 0:this;if(!arguments.length)return N(this[0])?this[0].document.documentElement["client".concat(e)]:M(this[0])?Ct(this[0],e):this[0].getBoundingClientRect()[n]-q(this[0],!t);var r=parseInt(i,10);return this.each((function(e,i){if(O(i)){var o=H(i,"boxSizing");i.style[n]=mt(n,r+("border-box"===o?q(i,!t):0))}}))}}));var wt="___cd";T.toggle=function(t){return this.each((function(n,i){if(O(i)){var o=$(i);(R(t)?o:t)?(i.style.display=i[wt]||"",$(i)&&(i.style.display=function(t){if(Y[t])return Y[t];var n=r(t);e.body.insertBefore(n,null);var i=H(n,"display");return e.body.removeChild(n),Y[t]="none"!==i?i:"block"}(i.tagName))):o||(i[wt]=H(i,"display"),i.style.display="none")}}))},T.hide=function(){return this.toggle(!1)},T.show=function(){return this.toggle(!0)};var bt="___ce",At={focus:"focusin",blur:"focusout"},Et={mouseenter:"mouseover",mouseleave:"mouseout"},St=/^(mouse|pointer|contextmenu|drag|drop|click|dblclick)/i;function Tt(t){return Et[t]||At[t]||t}function xt(t){var e=t.split(".");return[e[0],e.slice(1).sort()]}function _t(t){return t[bt]=t[bt]||{}}function Nt(t,e){return!e||!v.call(e,(function(e){return t.indexOf(e)<0}))}function Mt(t,e,n,i,r){var o=_t(t);if(e)o[e]&&(o[e]=o[e].filter((function(o){var s=o[0],a=o[1],l=o[2];if(r&&l.guid!==r.guid||!Nt(s,n)||i&&i!==a)return!0;t.removeEventListener(e,l)})));else for(e in o)Mt(t,e,n,i,r)}T.trigger=function(t,n){if(I(t)){var i=xt(t),r=i[0],o=i[1],s=Tt(r);if(!s)return this;var a=St.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(a)).initEvent(s,!0,!0),t.namespace=o.join("."),t.___ot=r}t.___td=n;var l=t.___ot in At;return this.each((function(e,n){l&&L(n[t.___ot])&&(n["___i".concat(t.type)]=!0,n[t.___ot](),n["___i".concat(t.type)]=!1),n.dispatchEvent(t)}))},T.off=function(t,e,n){var i=this;if(R(t))this.each((function(t,e){(O(e)||M(e)||N(e))&&Mt(e)}));else if(I(t))L(e)&&(n=e,e=""),G(F(t),(function(t,r){var o=xt(r),s=o[0],a=o[1],l=Tt(s);i.each((function(t,i){(O(i)||M(i)||N(i))&&Mt(i,l,a,e,n)}))}));else for(var r in t)this.off(r,t[r]);return this},T.remove=function(t){return z(this,t).detach().off(),this},T.replaceWith=function(t){return this.before(t).remove()},T.replaceAll=function(t){return x(t).replaceWith(this),this},T.on=function(t,e,n,i,r){var o=this;if(!I(t)){for(var s in t)this.on(s,e,n,t[s],r);return this}return I(e)||(R(e)||P(e)?e="":R(n)?(n=e,e=""):(i=n,n=e,e="")),L(i)||(i=n,n=void 0),i?(G(F(t),(function(t,s){var a=xt(s),l=a[0],u=a[1],c=Tt(l),h=l in Et,d=l in At;c&&o.each((function(t,o){if(O(o)||M(o)||N(o)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||Nt(u,t.namespace.split(".")))&&(e||!(d&&(t.target!==o||t.___ot===c)||h&&t.relatedTarget&&o.contains(t.relatedTarget)))){var a=o;if(e){for(var l=t.target;!j(l,e);){if(l===o)return;if(!(l=l.parentNode))return}a=l}Object.defineProperty(t,"currentTarget",{configurable:!0,get:function(){return a}}),Object.defineProperty(t,"delegateTarget",{configurable:!0,get:function(){return o}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var f=i.call(a,t,t.___td);r&&Mt(o,c,u,e,s),!1===f&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||x.guid++,function(t,e,n,i,r){var o=_t(t);o[e]=o[e]||[],o[e].push([n,i,r]),t.addEventListener(e,r)}(o,c,u,e,s)}}))})),this):this},T.one=function(t,e,n,i){return this.on(t,e,n,i,!0)};var Ot=/\r?\n/g,Lt=/file|reset|submit|button|image/i,It=/radio|checkbox/i;T.serialize=function(){var t="";return this.each((function(e,n){G(n.elements||[n],(function(e,n){if(!(n.disabled||!n.name||"FIELDSET"===n.tagName||Lt.test(n.type)||It.test(n.type)&&!n.checked)){var i=tt(n);R(i)||G(u(i)?i:[i],(function(e,i){t+=function(t,e){return"&".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(e.replace(Ot,"\r\n")))}(n.name,i)}))}}))})),t.slice(1)},t.exports=x}()},6677:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),r=n.n(i),o=n(6314),s=n.n(o)()(r());s.push([t.id,".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}","",{version:3,sources:["webpack://./node_modules/@datagrok-libraries/utils/src/u2.css"],names:[],mappings:"AAAA;;AAEA;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,kBAAkB;AACtB;;AAEA;IACI,SAAS;AACb",sourcesContent:[".ui-app-header {\n\n}\n\n.ui-app-header-icon {\n width: 150px;\n height: 150px;\n margin-right: 20px;\n}\n\n.u2-panel {\n gap: 10px;\n}"],sourceRoot:""}]);const a=s},365:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),r=n.n(i),o=n(6314),s=n.n(o)()(r());s.push([t.id,".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n","",{version:3,sources:["webpack://./src/styles.css"],names:[],mappings:"AAAA;EACE,kBAAkB;AACpB;;AAEA;EACE,mBAAmB;AACrB;;AAEA;EACE,kBAAkB;EAClB,QAAQ;EACR,kBAAkB;EAClB,WAAW;EACX,UAAU;AACZ;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,gCAAgC;EAChC,kBAAkB;AACpB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,YAAY;EACZ,gBAAgB;AAClB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,aAAa;EACb,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,iDAAiD;EACjD,cAAc;EACd,kBAAkB;EAClB,WAAW;EACX,eAAe;AACjB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;AACV",sourcesContent:[".pep-textarea-box {\n position: relative;\n}\n\n.pep-textarea-box:hover .pep-snippet-editor-icon {\n visibility: visible;\n}\n\n.pep-snippet-editor-icon {\n position: absolute;\n top: 5px;\n visibility: hidden;\n margin: 5px;\n z-index: 1;\n}\n\n.pep-reset-icon {\n right: 10px;\n}\n\n.pep-snippet-editor-icon i {\n font-size: 13px;\n}\n\n.pep-snippet-editor-icon:hover {\n background-color: var(--steel-1);\n border-radius: 2px;\n}\n\n.pep-snippet-inline-icon i {\n font-size: 13px;\n}\n\n.pep-textinput {\n height: 50px;\n overflow: hidden;\n}\n\n#pep-hist-host #center {\n height: 131px;\n}\n\n#pep-hist-host > #root {\n height: unset;\n width: 100%;\n}\n\n#pep-viewer-title {\n height: 23px;\n font-size: 1.2rem;\n font-family: 'Roboto', 'Roboto Local', sans-serif;\n color: #4D5261;\n text-align: center;\n width: 100%;\n align-self: end;\n}\n\n.pep-help-icon {\n position: absolute;\n left: 5px;\n top: 1px;\n}\n"],sourceRoot:""}]);const a=s},6314:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,r,o){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var u=0;u<t.length;u++){var c=[].concat(t[u]);i&&s[c[0]]||(void 0!==o&&(void 0===c[5]||(c[1]="@layer".concat(c[5].length>0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=o),n&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=n):c[2]=n),r&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=r):c[4]="".concat(r)),e.push(c))}},e}},1354:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),o="/*# ".concat(r," */");return[e].concat([o]).join("\n")}return[e].join("\n")}},9982:function(t,e,n){var i;!function(e,r){var o={};!function(t){"use strict";t.__esModule=!0,t.digestLength=32,t.blockSize=64;var e=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function n(t,n,i,r,o){for(var s,a,l,u,c,h,d,f,p,m,g,v,y;o>=64;){for(s=n[0],a=n[1],l=n[2],u=n[3],c=n[4],h=n[5],d=n[6],f=n[7],m=0;m<16;m++)g=r+4*m,t[m]=(255&i[g])<<24|(255&i[g+1])<<16|(255&i[g+2])<<8|255&i[g+3];for(m=16;m<64;m++)v=((p=t[m-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,y=((p=t[m-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,t[m]=(v+t[m-7]|0)+(y+t[m-16]|0);for(m=0;m<64;m++)v=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&h^~c&d)|0)+(f+(e[m]+t[m]|0)|0)|0,y=((s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10))+(s&a^s&l^a&l)|0,f=d,d=h,h=c,c=u+v|0,u=l,l=a,a=s,s=v+y|0;n[0]+=s,n[1]+=a,n[2]+=l,n[3]+=u,n[4]+=c,n[5]+=h,n[6]+=d,n[7]+=f,r+=64,o-=64}return r}var i=function(){function e(){this.digestLength=t.digestLength,this.blockSize=t.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return e.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},e.prototype.clean=function(){for(var t=0;t<this.buffer.length;t++)this.buffer[t]=0;for(t=0;t<this.temp.length;t++)this.temp[t]=0;this.reset()},e.prototype.update=function(t,e){if(void 0===e&&(e=t.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var i=0;if(this.bytesHashed+=e,this.bufferLength>0){for(;this.bufferLength<64&&e>0;)this.buffer[this.bufferLength++]=t[i++],e--;64===this.bufferLength&&(n(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(e>=64&&(i=n(this.temp,this.state,t,i,e),e%=64);e>0;)this.buffer[this.bufferLength++]=t[i++],e--;return this},e.prototype.finish=function(t){if(!this.finished){var e=this.bytesHashed,i=this.bufferLength,r=e/536870912|0,o=e<<3,s=e%64<56?64:128;this.buffer[i]=128;for(var a=i+1;a<s-8;a++)this.buffer[a]=0;this.buffer[s-8]=r>>>24&255,this.buffer[s-7]=r>>>16&255,this.buffer[s-6]=r>>>8&255,this.buffer[s-5]=r>>>0&255,this.buffer[s-4]=o>>>24&255,this.buffer[s-3]=o>>>16&255,this.buffer[s-2]=o>>>8&255,this.buffer[s-1]=o>>>0&255,n(this.temp,this.state,this.buffer,0,s),this.finished=!0}for(a=0;a<8;a++)t[4*a+0]=this.state[a]>>>24&255,t[4*a+1]=this.state[a]>>>16&255,t[4*a+2]=this.state[a]>>>8&255,t[4*a+3]=this.state[a]>>>0&255;return this},e.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},e.prototype._saveState=function(t){for(var e=0;e<this.state.length;e++)t[e]=this.state[e]},e.prototype._restoreState=function(t,e){for(var n=0;n<this.state.length;n++)this.state[n]=t[n];this.bytesHashed=e,this.finished=!1,this.bufferLength=0},e}();t.Hash=i;var r=function(){function t(t){this.inner=new i,this.outer=new i,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var e=new Uint8Array(this.blockSize);if(t.length>this.blockSize)(new i).update(t).finish(e).clean();else for(var n=0;n<t.length;n++)e[n]=t[n];for(n=0;n<e.length;n++)e[n]^=54;for(this.inner.update(e),n=0;n<e.length;n++)e[n]^=106;for(this.outer.update(e),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),n=0;n<e.length;n++)e[n]=0}return t.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},t.prototype.clean=function(){for(var t=0;t<this.istate.length;t++)this.ostate[t]=this.istate[t]=0;this.inner.clean(),this.outer.clean()},t.prototype.update=function(t){return this.inner.update(t),this},t.prototype.finish=function(t){return this.outer.finished?this.outer.finish(t):(this.inner.finish(t),this.outer.update(t,this.digestLength).finish(t)),this},t.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},t}();function o(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new r(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var r=i[0];if(0===r)throw new Error("hkdf: cannot expand more");e.reset(),r>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=r,t.hash=o,t.default=o,t.hmac=s;var l=new Uint8Array(t.digestLength);t.hkdf=function(t,e,n,i){void 0===e&&(e=l),void 0===i&&(i=32);for(var o=new Uint8Array([1]),u=s(e,t),c=new r(u),h=new Uint8Array(c.digestLength),d=h.length,f=new Uint8Array(i),p=0;p<i;p++)d===h.length&&(a(h,c,n,o),d=0),f[p]=h[d++];return c.clean(),h.fill(0),o.fill(0),f},t.pbkdf2=function(t,e,n,i){for(var o=new r(t),s=o.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),u=new Uint8Array(s),c=new Uint8Array(i),h=0;h*s<i;h++){var d=h+1;a[0]=d>>>24&255,a[1]=d>>>16&255,a[2]=d>>>8&255,a[3]=d>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(u);for(var f=0;f<s;f++)l[f]=u[f];for(f=2;f<=n;f++){o.reset(),o.update(u).finish(u);for(var p=0;p<s;p++)l[p]^=u[p]}for(f=0;f<s&&h*s+f<i;f++)c[h*s+f]=l[f]}for(h=0;h<s;h++)l[h]=u[h]=0;for(h=0;h<4;h++)a[h]=0;return o.clean(),c}}(o);var s=o.default;for(var a in o)s[a]=o[a];"object"==typeof t.exports?t.exports=s:void 0===(i=function(){return s}.call(o,n,o,t))||(t.exports=i)}()},2787:(t,e,n)=>{"use strict";n.d(e,{I:()=>r});const i=new Uint32Array(65536),r=(t,e)=>{if(t.length<e.length){const n=e;e=t,t=n}return 0===e.length?t.length:t.length<=32?((t,e)=>{const n=t.length,r=e.length,o=1<<n-1;let s=-1,a=0,l=n,u=n;for(;u--;)i[t.charCodeAt(u)]|=1<<u;for(u=0;u<r;u++){let t=i[e.charCodeAt(u)];const n=t|a;t|=(t&s)+s^s,a|=~(t|s),s&=t,a&o&&l++,s&o&&l--,a=a<<1|1,s=s<<1|~(n|a),a&=n}for(u=n;u--;)i[t.charCodeAt(u)]=0;return l})(t,e):((t,e)=>{const n=e.length,r=t.length,o=[],s=[],a=Math.ceil(n/32),l=Math.ceil(r/32);for(let t=0;t<a;t++)s[t]=-1,o[t]=0;let u=0;for(;u<l-1;u++){let a=0,l=-1;const c=32*u,h=Math.min(32,r)+c;for(let e=c;e<h;e++)i[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],r=s[t/32|0]>>>t&1,u=o[t/32|0]>>>t&1,c=n|a,h=((n|u)&l)+l^l|n|u;let d=a|~(h|l),f=l&h;d>>>31^r&&(s[t/32|0]^=1<<t),f>>>31^u&&(o[t/32|0]^=1<<t),d=d<<1|r,f=f<<1|u,l=f|~(c|d),a=d&c}for(let e=c;e<h;e++)i[t.charCodeAt(e)]=0}let c=0,h=-1;const d=32*u,f=Math.min(32,r-d)+d;for(let e=d;e<f;e++)i[t.charCodeAt(e)]|=1<<e;let p=r;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],a=s[t/32|0]>>>t&1,l=o[t/32|0]>>>t&1,u=n|c,d=((n|l)&h)+h^h|n|l;let f=c|~(d|h),m=h&d;p+=f>>>r-1&1,p-=m>>>r-1&1,f>>>31^a&&(s[t/32|0]^=1<<t),m>>>31^l&&(o[t/32|0]^=1<<t),f=f<<1|a,m=m<<1|l,h=m|~(u|f),c=f&u}for(let e=d;e<f;e++)i[t.charCodeAt(e)]=0;return p})(t,e)}},9937:t=>{t.exports={linLogMode:!1,outboundAttractionDistribution:!1,adjustSizes:!1,edgeWeightInfluence:1,scalingRatio:1,strongGravityMode:!1,gravity:1,slowDown:1,barnesHutOptimize:!1,barnesHutTheta:.5}},1782:(t,e)=>{e.assign=function(t){t=t||{};var e,n,i,r=Array.prototype.slice.call(arguments).slice(1);for(e=0,i=r.length;e<i;e++)if(r[e])for(n in r[e])t[n]=r[e][n];return t},e.validateSettings=function(t){return"linLogMode"in t&&"boolean"!=typeof t.linLogMode?{message:"the `linLogMode` setting should be a boolean."}:"outboundAttractionDistribution"in t&&"boolean"!=typeof t.outboundAttractionDistribution?{message:"the `outboundAttractionDistribution` setting should be a boolean."}:"adjustSizes"in t&&"boolean"!=typeof t.adjustSizes?{message:"the `adjustSizes` setting should be a boolean."}:"edgeWeightInfluence"in t&&"number"!=typeof t.edgeWeightInfluence?{message:"the `edgeWeightInfluence` setting should be a number."}:!("scalingRatio"in t)||"number"==typeof t.scalingRatio&&t.scalingRatio>=0?"strongGravityMode"in t&&"boolean"!=typeof t.strongGravityMode?{message:"the `strongGravityMode` setting should be a boolean."}:!("gravity"in t)||"number"==typeof t.gravity&&t.gravity>=0?"slowDown"in t&&!("number"==typeof t.slowDown||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&"boolean"!=typeof t.barnesHutOptimize?{message:"the `barnesHutOptimize` setting should be a boolean."}:!("barnesHutTheta"in t)||"number"==typeof t.barnesHutTheta&&t.barnesHutTheta>=0?null:{message:"the `barnesHutTheta` setting should be a number >= 0."}:{message:"the `gravity` setting should be a number >= 0."}:{message:"the `scalingRatio` setting should be a number >= 0."}},e.graphToByteArrays=function(t,e){var n,i=t.order,r=t.size,o={},s=new Float32Array(10*i),a=new Float32Array(3*r);return n=0,t.forEachNode((function(t,e){o[t]=n,s[n]=e.x,s[n+1]=e.y,s[n+2]=0,s[n+3]=0,s[n+4]=0,s[n+5]=0,s[n+6]=1,s[n+7]=1,s[n+8]=e.size||1,s[n+9]=e.fixed?1:0,n+=10})),n=0,t.forEachEdge((function(t,i,r,l,u,c,h){var d=o[r],f=o[l],p=e(t,i,r,l,u,c,h);s[d+6]+=p,s[f+6]+=p,a[n]=d,a[n+1]=f,a[n+2]=p,n+=3})),{nodes:s,edges:a}},e.assignLayoutChanges=function(t,e,n){var i=0;t.updateEachNodeAttributes((function(t,r){return r.x=e[i],r.y=e[i+1],i+=10,n?n(t,r):r}))},e.readGraphPositions=function(t,e){var n=0;t.forEachNode((function(t,i){e[n]=i.x,e[n+1]=i.y,n+=10}))},e.collectLayoutChanges=function(t,e,n){for(var i=t.nodes(),r={},o=0,s=0,a=e.length;o<a;o+=10){if(n){var l=Object.assign({},t.getNodeAttributes(i[s]));l.x=e[o],l.y=e[o+1],l=n(i[s],l),r[i[s]]={x:l.x,y:l.y}}else r[i[s]]={x:e[o],y:e[o+1]};s++}return r},e.createWorker=function(t){var e=window.URL||window.webkitURL,n=t.toString(),i=e.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),r=new Worker(i);return e.revokeObjectURL(i),r}},8903:(t,e,n)=>{var i=n(1736),r=n(8153).Fd,o=n(2561),s=n(1782),a=n(9937);function l(t,e,n){if(!i(e))throw new Error("graphology-layout-forceatlas2: the given graph is not a valid graphology instance.");"number"==typeof n&&(n={iterations:n});var l=n.iterations;if("number"!=typeof l)throw new Error("graphology-layout-forceatlas2: invalid number of iterations.");if(l<=0)throw new Error("graphology-layout-forceatlas2: you should provide a positive number of iterations.");var u=r("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,c="function"==typeof n.outputReducer?n.outputReducer:null,h=s.assign({},a,n.settings),d=s.validateSettings(h);if(d)throw new Error("graphology-layout-forceatlas2: "+d.message);var f,p=s.graphToByteArrays(e,u);for(f=0;f<l;f++)o(h,p.nodes,p.edges);if(!t)return s.collectLayoutChanges(e,p.nodes);s.assignLayoutChanges(e,p.nodes,c)}var u=l.bind(null,!1);u.assign=l.bind(null,!0),u.inferSettings=function(t){var e="number"==typeof t?t:t.order;return{barnesHutOptimize:e>2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}},t.exports=u},2561:t=>{var e=10;t.exports=function(t,n,i){var r,o,s,a,l,u,c,h,d,f,p,m,g,v,y,C,w,b,A,E,S,T,x,_=n.length,N=i.length,M=t.adjustSizes,O=t.barnesHutTheta*t.barnesHutTheta,L=[];for(s=0;s<_;s+=e)n[s+4]=n[s+2],n[s+5]=n[s+3],n[s+2]=0,n[s+3]=0;if(t.outboundAttractionDistribution){for(p=0,s=0;s<_;s+=e)p+=n[s+6];p/=_/e}if(t.barnesHutOptimize){var I,R,P,k=1/0,D=-1/0,G=1/0,U=-1/0;for(s=0;s<_;s+=e)k=Math.min(k,n[s+0]),D=Math.max(D,n[s+0]),G=Math.min(G,n[s+1]),U=Math.max(U,n[s+1]);var V=D-k,F=U-G;for(V>F?U=(G-=(V-F)/2)+V:D=(k-=(F-V)/2)+F,L[0]=-1,L[1]=(k+D)/2,L[2]=(G+U)/2,L[3]=Math.max(D-k,U-G),L[4]=-1,L[5]=-1,L[6]=0,L[7]=0,L[8]=0,r=1,s=0;s<_;s+=e)for(o=0,P=3;;){if(!(L[o+5]>=0)){if(L[o+0]<0){L[o+0]=s;break}if(L[o+5]=9*r,h=L[o+3]/2,L[(d=L[o+5])+0]=-1,L[d+1]=L[o+1]-h,L[d+2]=L[o+2]-h,L[d+3]=h,L[d+4]=d+9,L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,L[(d+=9)+0]=-1,L[d+1]=L[o+1]-h,L[d+2]=L[o+2]+h,L[d+3]=h,L[d+4]=d+9,L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,L[(d+=9)+0]=-1,L[d+1]=L[o+1]+h,L[d+2]=L[o+2]-h,L[d+3]=h,L[d+4]=d+9,L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,L[(d+=9)+0]=-1,L[d+1]=L[o+1]+h,L[d+2]=L[o+2]+h,L[d+3]=h,L[d+4]=L[o+4],L[d+5]=-1,L[d+6]=0,L[d+7]=0,L[d+8]=0,r+=4,I=n[L[o+0]+0]<L[o+1]?n[L[o+0]+1]<L[o+2]?L[o+5]:L[o+5]+9:n[L[o+0]+1]<L[o+2]?L[o+5]+18:L[o+5]+27,L[o+6]=n[L[o+0]+6],L[o+7]=n[L[o+0]+0],L[o+8]=n[L[o+0]+1],L[I+0]=L[o+0],L[o+0]=-1,I===(R=n[s+0]<L[o+1]?n[s+1]<L[o+2]?L[o+5]:L[o+5]+9:n[s+1]<L[o+2]?L[o+5]+18:L[o+5]+27)){if(P--){o=I;continue}P=3;break}L[R+0]=s;break}I=n[s+0]<L[o+1]?n[s+1]<L[o+2]?L[o+5]:L[o+5]+9:n[s+1]<L[o+2]?L[o+5]+18:L[o+5]+27,L[o+7]=(L[o+7]*L[o+6]+n[s+0]*n[s+6])/(L[o+6]+n[s+6]),L[o+8]=(L[o+8]*L[o+6]+n[s+1]*n[s+6])/(L[o+6]+n[s+6]),L[o+6]+=n[s+6],o=I}}if(t.barnesHutOptimize){for(m=t.scalingRatio,s=0;s<_;s+=e)for(o=0;;)if(L[o+5]>=0){if(C=Math.pow(n[s+0]-L[o+7],2)+Math.pow(n[s+1]-L[o+8],2),4*(f=L[o+3])*f/C<O){if(g=n[s+0]-L[o+7],v=n[s+1]-L[o+8],!0===M?C>0?(w=m*n[s+6]*L[o+6]/C,n[s+2]+=g*w,n[s+3]+=v*w):C<0&&(w=-m*n[s+6]*L[o+6]/Math.sqrt(C),n[s+2]+=g*w,n[s+3]+=v*w):C>0&&(w=m*n[s+6]*L[o+6]/C,n[s+2]+=g*w,n[s+3]+=v*w),(o=L[o+4])<0)break;continue}o=L[o+5]}else if((u=L[o+0])>=0&&u!==s&&(C=(g=n[s+0]-n[u+0])*g+(v=n[s+1]-n[u+1])*v,!0===M?C>0?(w=m*n[s+6]*n[u+6]/C,n[s+2]+=g*w,n[s+3]+=v*w):C<0&&(w=-m*n[s+6]*n[u+6]/Math.sqrt(C),n[s+2]+=g*w,n[s+3]+=v*w):C>0&&(w=m*n[s+6]*n[u+6]/C,n[s+2]+=g*w,n[s+3]+=v*w)),(o=L[o+4])<0)break}else for(m=t.scalingRatio,a=0;a<_;a+=e)for(l=0;l<a;l+=e)g=n[a+0]-n[l+0],v=n[a+1]-n[l+1],!0===M?(C=Math.sqrt(g*g+v*v)-n[a+8]-n[l+8])>0?(w=m*n[a+6]*n[l+6]/C/C,n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w):C<0&&(w=100*m*n[a+6]*n[l+6],n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w):(C=Math.sqrt(g*g+v*v))>0&&(w=m*n[a+6]*n[l+6]/C/C,n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w);for(d=t.gravity/t.scalingRatio,m=t.scalingRatio,s=0;s<_;s+=e)w=0,g=n[s+0],v=n[s+1],C=Math.sqrt(Math.pow(g,2)+Math.pow(v,2)),t.strongGravityMode?C>0&&(w=m*n[s+6]*d):C>0&&(w=m*n[s+6]*d/C),n[s+2]-=g*w,n[s+3]-=v*w;for(m=1*(t.outboundAttractionDistribution?p:1),c=0;c<N;c+=3)a=i[c+0],l=i[c+1],h=i[c+2],y=Math.pow(h,t.edgeWeightInfluence),g=n[a+0]-n[l+0],v=n[a+1]-n[l+1],!0===M?(C=Math.sqrt(g*g+v*v)-n[a+8]-n[l+8],t.linLogMode?t.outboundAttractionDistribution?C>0&&(w=-m*y*Math.log(1+C)/C/n[a+6]):C>0&&(w=-m*y*Math.log(1+C)/C):t.outboundAttractionDistribution?C>0&&(w=-m*y/n[a+6]):C>0&&(w=-m*y)):(C=Math.sqrt(Math.pow(g,2)+Math.pow(v,2)),t.linLogMode?t.outboundAttractionDistribution?C>0&&(w=-m*y*Math.log(1+C)/C/n[a+6]):C>0&&(w=-m*y*Math.log(1+C)/C):t.outboundAttractionDistribution?(C=1,w=-m*y/n[a+6]):(C=1,w=-m*y)),C>0&&(n[a+2]+=g*w,n[a+3]+=v*w,n[l+2]-=g*w,n[l+3]-=v*w);if(!0===M)for(s=0;s<_;s+=e)1!==n[s+9]&&((b=Math.sqrt(Math.pow(n[s+2],2)+Math.pow(n[s+3],2)))>10&&(n[s+2]=10*n[s+2]/b,n[s+3]=10*n[s+3]/b),A=n[s+6]*Math.sqrt((n[s+4]-n[s+2])*(n[s+4]-n[s+2])+(n[s+5]-n[s+3])*(n[s+5]-n[s+3])),E=Math.sqrt((n[s+4]+n[s+2])*(n[s+4]+n[s+2])+(n[s+5]+n[s+3])*(n[s+5]+n[s+3]))/2,S=.1*Math.log(1+E)/(1+Math.sqrt(A)),T=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=T,x=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=x);else for(s=0;s<_;s+=e)1!==n[s+9]&&(A=n[s+6]*Math.sqrt((n[s+4]-n[s+2])*(n[s+4]-n[s+2])+(n[s+5]-n[s+3])*(n[s+5]-n[s+3])),E=Math.sqrt((n[s+4]+n[s+2])*(n[s+4]+n[s+2])+(n[s+5]+n[s+3])*(n[s+5]+n[s+3]))/2,S=n[s+7]*Math.log(1+E)/(1+Math.sqrt(A)),n[s+7]=Math.min(1,Math.sqrt(S*(Math.pow(n[s+2],2)+Math.pow(n[s+3],2))/(1+Math.sqrt(A)))),T=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=T,x=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=x);return{}}},8153:(t,e)=>{function n(t){return"number"!=typeof t||isNaN(t)?1:t}e.Fd=function(t){return function(t,e){var n={},i=function(t){return void 0===t?e:t};"function"==typeof e&&(i=e);var r=function(e){return i(e[t])},o=function(){return i(void 0)};return"string"==typeof t?(n.fromAttributes=r,n.fromGraph=function(t,e){return r(t.getEdgeAttributes(e))},n.fromEntry=function(t,e){return r(e)},n.fromPartialEntry=n.fromEntry,n.fromMinimalEntry=n.fromEntry):"function"==typeof t?(n.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},n.fromGraph=function(e,n){var r=e.extremities(n);return i(t(n,e.getEdgeAttributes(n),r[0],r[1],e.getNodeAttributes(r[0]),e.getNodeAttributes(r[1]),e.isUndirected(n)))},n.fromEntry=function(e,n,r,o,s,a,l){return i(t(e,n,r,o,s,a,l))},n.fromPartialEntry=function(e,n,r,o){return i(t(e,n,r,o))},n.fromMinimalEntry=function(e,n){return i(t(e,n))}):(n.fromAttributes=o,n.fromGraph=o,n.fromEntry=o,n.fromMinimalEntry=o),n}(t,n)}},1736:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},934:function(t){t.exports=function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function e(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function n(t){return n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},n(t)}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function r(t,e,n){return r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var o=new(Function.bind.apply(t,r));return n&&i(o,n.prototype),o},r.apply(null,arguments)}function o(t){var e="function"==typeof Map?new Map:void 0;return o=function(t){if(null===t||(o=t,-1===Function.toString.call(o).indexOf("[native code]")))return t;var o;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,s)}function s(){return r(t,arguments,n(this).constructor)}return s.prototype=Object.create(t.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),i(s,t)},o(t)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var a=function(){for(var t=arguments[0],e=1,n=arguments.length;e<n;e++)if(arguments[e])for(var i in arguments[e])t[i]=arguments[e][i];return t};function l(t,e,n,i){var r=t._nodes.get(e),o=null;return r?o="mixed"===i?r.out&&r.out[n]||r.undirected&&r.undirected[n]:"directed"===i?r.out&&r.out[n]:r.undirected&&r.undirected[n]:o}function u(e){return"object"===t(e)&&null!==e}function c(t){var e;for(e in t)return!1;return!0}function h(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function d(t,e,n){var i={enumerable:!0,configurable:!0};"function"==typeof n?i.get=n:(i.value=n,i.writable=!1),Object.defineProperty(t,e,i)}function f(t){return!(!u(t)||t.attributes&&!Array.isArray(t.attributes))}"function"==typeof Object.assign&&(a=Object.assign);var p,m={exports:{}},g="object"==typeof Reflect?Reflect:null,v=g&&"function"==typeof g.apply?g.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};p=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var y=Number.isNaN||function(t){return t!=t};function C(){C.init.call(this)}m.exports=C,m.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}M(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&M(t,"error",e,{once:!0})}(t,r)}))},C.EventEmitter=C,C.prototype._events=void 0,C.prototype._eventsCount=0,C.prototype._maxListeners=void 0;var w=10;function b(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function A(t){return void 0===t._maxListeners?C.defaultMaxListeners:t._maxListeners}function E(t,e,n,i){var r,o,s,a;if(b(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),s=o[e]),void 0===s)s=o[e]=n,++t._eventsCount;else if("function"==typeof s?s=o[e]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(r=A(t))>0&&s.length>r&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return t}function S(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function T(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=S.bind(i);return r.listener=n,i.wrapFn=r,r}function x(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(r):N(r,r.length)}function _(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function N(t,e){for(var n=new Array(e),i=0;i<e;++i)n[i]=t[i];return n}function M(t,e,n,i){if("function"==typeof t.on)i.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function r(o){i.once&&t.removeEventListener(e,r),n(o)}))}}function O(t){if("function"!=typeof t)throw new Error("obliterator/iterator: expecting a function!");this.next=t}Object.defineProperty(C,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(t){if("number"!=typeof t||t<0||y(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");w=t}}),C.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},C.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||y(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},C.prototype.getMaxListeners=function(){return A(this)},C.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,r=this._events;if(void 0!==r)i=i&&void 0===r.error;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=r[t];if(void 0===a)return!1;if("function"==typeof a)v(a,this,e);else{var l=a.length,u=N(a,l);for(n=0;n<l;++n)v(u[n],this,e)}return!0},C.prototype.addListener=function(t,e){return E(this,t,e,!1)},C.prototype.on=C.prototype.addListener,C.prototype.prependListener=function(t,e){return E(this,t,e,!0)},C.prototype.once=function(t,e){return b(e),this.on(t,T(this,t,e)),this},C.prototype.prependOnceListener=function(t,e){return b(e),this.prependListener(t,T(this,t,e)),this},C.prototype.removeListener=function(t,e){var n,i,r,o,s;if(b(e),void 0===(i=this._events))return this;if(void 0===(n=i[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(r=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){s=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,r),1===n.length&&(i[t]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",t,s||e)}return this},C.prototype.off=C.prototype.removeListener,C.prototype.removeAllListeners=function(t){var e,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var r,o=Object.keys(n);for(i=0;i<o.length;++i)"removeListener"!==(r=o[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},C.prototype.listeners=function(t){return x(this,t,!0)},C.prototype.rawListeners=function(t){return x(this,t,!1)},C.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},C.prototype.listenerCount=_,C.prototype.eventNames=function(){return this._eventsCount>0?p(this._events):[]},"undefined"!=typeof Symbol&&(O.prototype[Symbol.iterator]=function(){return this}),O.of=function(){var t=arguments,e=t.length,n=0;return new O((function(){return n>=e?{done:!0}:{done:!1,value:t[n++]}}))},O.empty=function(){return new O((function(){return{done:!0}}))},O.fromSequence=function(t){var e=0,n=t.length;return new O((function(){return e>=n?{done:!0}:{done:!1,value:t[e++]}}))},O.is=function(t){return t instanceof O||"object"==typeof t&&null!==t&&"function"==typeof t.next};var L=O,I={};I.ARRAY_BUFFER_SUPPORT="undefined"!=typeof ArrayBuffer,I.SYMBOL_SUPPORT="undefined"!=typeof Symbol;var R=L,P=I,k=P.ARRAY_BUFFER_SUPPORT,D=P.SYMBOL_SUPPORT,G=function(t){var e=function(t){return"string"==typeof t||Array.isArray(t)||k&&ArrayBuffer.isView(t)?R.fromSequence(t):"object"!=typeof t||null===t?null:D&&"function"==typeof t[Symbol.iterator]?t[Symbol.iterator]():"function"==typeof t.next?t:null}(t);if(!e)throw new Error("obliterator: target is not iterable nor a valid iterator.");return e},U=G,V=function(t,e){for(var n,i=arguments.length>1?e:1/0,r=i!==1/0?new Array(i):[],o=0,s=U(t);;){if(o===i)return r;if((n=s.next()).done)return o!==e&&(r.length=o),r;r[o++]=n.value}},F=function(t){function n(e){var n;return(n=t.call(this)||this).name="GraphError",n.message=e,n}return e(n,t),n}(o(Error)),H=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="InvalidArgumentsGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(s(i),n.prototype.constructor),i}return e(n,t),n}(F),B=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="NotFoundGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(s(i),n.prototype.constructor),i}return e(n,t),n}(F),q=function(t){function n(e){var i;return(i=t.call(this,e)||this).name="UsageGraphError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(s(i),n.prototype.constructor),i}return e(n,t),n}(F);function Y(t,e){this.key=t,this.attributes=e,this.clear()}function $(t,e){this.key=t,this.attributes=e,this.clear()}function j(t,e){this.key=t,this.attributes=e,this.clear()}function W(t,e,n,i,r){this.key=e,this.attributes=r,this.undirected=t,this.source=n,this.target=i}function z(t,e,n,i,r,o,s){var a,l,u,c;if(i=""+i,0===n){if(!(a=t._nodes.get(i)))throw new B("Graph.".concat(e,': could not find the "').concat(i,'" node in the graph.'));u=r,c=o}else if(3===n){if(r=""+r,!(l=t._edges.get(r)))throw new B("Graph.".concat(e,': could not find the "').concat(r,'" edge in the graph.'));var h=l.source.key,d=l.target.key;if(i===h)a=l.target;else{if(i!==d)throw new B("Graph.".concat(e,': the "').concat(i,'" node is not attached to the "').concat(r,'" edge (').concat(h,", ").concat(d,")."));a=l.source}u=o,c=s}else{if(!(l=t._edges.get(i)))throw new B("Graph.".concat(e,': could not find the "').concat(i,'" edge in the graph.'));a=1===n?l.source:l.target,u=r,c=o}return[a,u,c]}Y.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}},$.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}},j.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}},W.prototype.attach=function(){var t="out",e="in";this.undirected&&(t=e="undirected");var n=this.source.key,i=this.target.key;this.source[t][i]=this,this.undirected&&n===i||(this.target[e][n]=this)},W.prototype.attachMulti=function(){var t="out",e="in",n=this.source.key,i=this.target.key;this.undirected&&(t=e="undirected");var r=this.source[t],o=r[i];if(void 0===o)return r[i]=this,void(this.undirected&&n===i||(this.target[e][n]=this));o.previous=this,this.next=o,r[i]=this,this.target[e][n]=this},W.prototype.detach=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),delete this.source[n][e],delete this.target[i][t]},W.prototype.detachMulti=function(){var t=this.source.key,e=this.target.key,n="out",i="in";this.undirected&&(n=i="undirected"),void 0===this.previous?void 0===this.next?(delete this.source[n][e],delete this.target[i][t]):(this.next.previous=void 0,this.source[n][e]=this.next,this.target[i][t]=this.next):(this.previous.next=this.next,void 0!==this.next&&(this.next.previous=this.previous))};var K=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];return s.attributes[a]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){return z(this,e,n,t,i)[0].attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];return s.attributes.hasOwnProperty(a)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var s=z(this,e,n,t,i,r,o),a=s[0],l=s[1],u=s[2];return a.attributes[l]=u,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r,o){var s=z(this,e,n,t,i,r,o),a=s[0],l=s[1],u=s[2];if("function"!=typeof u)throw new H("Graph.".concat(e,": updater should be a function."));var c=a.attributes,h=u(c[l]);return c[l]=h,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];return delete s.attributes[a],this.emit("nodeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:a}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];if(!u(a))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return s.attributes=a,this.emit("nodeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],l=o[1];if(!u(l))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return a(s.attributes,l),this.emit("nodeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:l}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o=z(this,e,n,t,i,r),s=o[0],a=o[1];if("function"!=typeof a)throw new H("Graph.".concat(e,": provided updater is not a function."));return s.attributes=a(s.attributes),this.emit("nodeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}}],Q=[{name:function(t){return"get".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes[i]}}},{name:function(t){return"get".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t){var i;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var r=""+t,o=""+arguments[1];if(!(i=l(this,r,o,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(i=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return i.attributes}}},{name:function(t){return"has".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes.hasOwnProperty(i)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+t,a=""+i;if(i=arguments[2],r=arguments[3],!(o=l(this,s,a,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return o.attributes[i]=r,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,r){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var s=""+t,a=""+i;if(i=arguments[2],r=arguments[3],!(o=l(this,s,a,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(o=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof r)throw new H("Graph.".concat(e,": updater should be a function."));return o.attributes[i]=r(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return delete r.attributes[i],this.emit("edgeAttributesUpdated",{key:r.key,type:"remove",attributes:r.attributes,name:i}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return r.attributes=i,this.emit("edgeAttributesUpdated",{key:r.key,type:"replace",attributes:r.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!u(i))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return a(r.attributes,i),this.emit("edgeAttributesUpdated",{key:r.key,type:"merge",attributes:r.attributes,data:i}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new q("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new q("Graph.".concat(e,": cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about."));var o=""+t,s=""+i;if(i=arguments[2],!(r=l(this,o,s,n)))throw new B("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new q("Graph.".concat(e,": calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type."));if(t=""+t,!(r=this._edges.get(t)))throw new B("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof i)throw new H("Graph.".concat(e,": provided updater is not a function."));return r.attributes=i(r.attributes),this.emit("edgeAttributesUpdated",{key:r.key,type:"update",attributes:r.attributes}),this}}}],X=L,J=G,Z=function(){var t=arguments,e=null,n=-1;return new X((function(){for(var i=null;;){if(null===e){if(++n>=t.length)return{done:!0};e=J(t[n])}if(!0!==(i=e.next()).done)break;e=null}return i}))},tt=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function et(t,e,n,i){var r=!1;for(var o in e)if(o!==i){var s=e[o];if(r=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),t&&r)return s.key}}function nt(t,e,n,i){var r,o,s,a=!1;for(var l in e)if(l!==i){r=e[l];do{if(o=r.source,s=r.target,a=n(r.key,r.attributes,o.key,s.key,o.attributes,s.attributes,r.undirected),t&&a)return r.key;r=r.next}while(void 0!==r)}}function it(t,e){var n,i=Object.keys(t),r=i.length,o=0;return new L((function(){do{if(n)n=n.next;else{if(o>=r)return{done:!0};var s=i[o++];if(s===e){n=void 0;continue}n=t[s]}}while(!n);return{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}}}))}function rt(t,e,n,i){var r=e[n];if(r){var o=r.source,s=r.target;return i(r.key,r.attributes,o.key,s.key,o.attributes,s.attributes,r.undirected)&&t?r.key:void 0}}function ot(t,e,n,i){var r=e[n];if(r){var o=!1;do{if(o=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),t&&o)return r.key;r=r.next}while(void 0!==r)}}function st(t,e){var n=t[e];return void 0!==n.next?new L((function(){if(!n)return{done:!0};var t={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:t}})):L.of({edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected})}function at(t,e,n,i){if(0!==e.size)for(var r,o,s="mixed"!==n&&n!==e.type,a="undirected"===n,l=!1,u=e._edges.values();!0!==(r=u.next()).done;)if(o=r.value,!s||o.undirected===a){var c=o,h=c.key,d=c.attributes,f=c.source,p=c.target;if(l=i(h,d,f.key,p.key,f.attributes,p.attributes,o.undirected),t&&l)return h}}function lt(t,e,n,i,r,o){var s,a=e?nt:et;if("undirected"!==n){if("out"!==i&&(s=a(t,r.in,o),t&&s))return s;if("in"!==i&&(s=a(t,r.out,o,i?void 0:r.key),t&&s))return s}if("directed"!==n&&(s=a(t,r.undirected,o),t&&s))return s}function ut(t,e,n,i,r,o,s){var a,l=n?ot:rt;if("undirected"!==e){if(void 0!==r.in&&"out"!==i&&(a=l(t,r.in,o,s),t&&a))return a;if(void 0!==r.out&&"in"!==i&&(i||r.key!==o)&&(a=l(t,r.out,o,s),t&&a))return a}if("directed"!==e&&void 0!==r.undirected&&(a=l(t,r.undirected,o,s),t&&a))return a}var ct=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function ht(){this.A=null,this.B=null}function dt(t,e,n,i,r){for(var o in i){var s=i[o],a=s.source,l=s.target,u=a===n?l:a;if(!e||!e.has(u.key)){var c=r(u.key,u.attributes);if(t&&c)return u.key}}}function ft(t,e,n,i,r){if("mixed"!==e){if("undirected"===e)return dt(t,null,i,i.undirected,r);if("string"==typeof n)return dt(t,null,i,i[n],r)}var o,s=new ht;if("undirected"!==e){if("out"!==n){if(o=dt(t,null,i,i.in,r),t&&o)return o;s.wrap(i.in)}if("in"!==n){if(o=dt(t,s,i,i.out,r),t&&o)return o;s.wrap(i.out)}}if("directed"!==e&&(o=dt(t,s,i,i.undirected,r),t&&o))return o}function pt(t,e,n){var i=Object.keys(n),r=i.length,o=0;return new L((function(){var s=null;do{if(o>=r)return t&&t.wrap(n),{done:!0};var a=n[i[o++]],l=a.source,u=a.target;s=l===e?u:l,t&&t.has(s.key)&&(s=null)}while(null===s);return{done:!1,value:{neighbor:s.key,attributes:s.attributes}}}))}function mt(t,e,n,i,r){for(var o,s,a,l,u,c,h,d=i._nodes.values(),f=i.type;!0!==(o=d.next()).done;){var p=!1;if(s=o.value,"undirected"!==f)for(a in l=s.out){u=l[a];do{if(c=u.target,p=!0,h=r(s.key,c.key,s.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&h)return u;u=u.next}while(u)}if("directed"!==f)for(a in l=s.undirected)if(!(e&&s.key>a)){u=l[a];do{if((c=u.target).key!==a&&(c=u.source),p=!0,h=r(s.key,c.key,s.attributes,c.attributes,u.key,u.attributes,u.undirected),t&&h)return u;u=u.next}while(u)}if(n&&!p&&(h=r(s.key,null,s.attributes,null,null,null,null),t&&h))return null}}function gt(t){if(!u(t))throw new H('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in t))throw new H("Graph.import: serialized node is missing its key.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new H("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function vt(t){if(!u(t))throw new H('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in t))throw new H("Graph.import: serialized edge is missing its source.");if(!("target"in t))throw new H("Graph.import: serialized edge is missing its target.");if("attributes"in t&&(!u(t.attributes)||null===t.attributes))throw new H("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in t&&"boolean"!=typeof t.undirected)throw new H("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}ht.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},ht.prototype.has=function(t){return null!==this.A&&t in this.A||null!==this.B&&t in this.B};var yt,Ct=(yt=255&Math.floor(256*Math.random()),function(){return yt++}),wt=new Set(["directed","undirected","mixed"]),bt=new Set(["domain","_events","_eventsCount","_maxListeners"]),At={allowSelfLoops:!0,multi:!1,type:"mixed"};function Et(t,e,n){var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}function St(t,e,n,i,r,o,s,a){if(!i&&"undirected"===t.type)throw new q("Graph.".concat(e,": you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new q("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!u(a))throw new H("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(a,'"'));if(o=""+o,s=""+s,a=a||{},!t.allowSelfLoops&&o===s)throw new q("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var l=t._nodes.get(o),c=t._nodes.get(s);if(!l)throw new B("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!c)throw new B("Graph.".concat(e,': target node "').concat(s,'" not found.'));var h={key:null,undirected:i,source:o,target:s,attributes:a};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new q("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));if(!t.multi&&(i?void 0!==l.undirected[s]:void 0!==l.out[s]))throw new q("Graph.".concat(e,': an edge linking "').concat(o,'" to "').concat(s,"\" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option."));var d=new W(i,r,l,c,a);t._edges.set(r,d);var f=o===s;return i?(l.undirectedDegree++,c.undirectedDegree++,f&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,c.inDegree++,f&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?d.attachMulti():d.attach(),i?t._undirectedSize++:t._directedSize++,h.key=r,t.emit("edgeAdded",h),r}function Tt(t,e,n,i,r,o,s,l,c){if(!i&&"undirected"===t.type)throw new q("Graph.".concat(e,": you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead."));if(i&&"directed"===t.type)throw new q("Graph.".concat(e,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(l)if(c){if("function"!=typeof l)throw new H("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(l,'"'))}else if(!u(l))throw new H("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(l,'"'));var h;if(o=""+o,s=""+s,c&&(h=l,l=void 0),!t.allowSelfLoops&&o===s)throw new q("Graph.".concat(e,': source & target are the same ("').concat(o,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var d,f,p=t._nodes.get(o),m=t._nodes.get(s);if(!n&&(d=t._edges.get(r))){if(!(d.source.key===o&&d.target.key===s||i&&d.source.key===s&&d.target.key===o))throw new q("Graph.".concat(e,': inconsistency detected when attempting to merge the "').concat(r,'" edge with "').concat(o,'" source & "').concat(s,'" target vs. ("').concat(d.source.key,'", "').concat(d.target.key,'").'));f=d}if(f||t.multi||!p||(f=i?p.undirected[s]:p.out[s]),f){var g=[f.key,!1,!1,!1];if(c?!h:!l)return g;if(c){var v=f.attributes;f.attributes=h(v),t.emit("edgeAttributesUpdated",{type:"replace",key:f.key,attributes:f.attributes})}else a(f.attributes,l),t.emit("edgeAttributesUpdated",{type:"merge",key:f.key,attributes:f.attributes,data:l});return g}l=l||{},c&&h&&(l=h(l));var y={key:null,undirected:i,source:o,target:s,attributes:l};if(n)r=t._edgeKeyGenerator();else if(r=""+r,t._edges.has(r))throw new q("Graph.".concat(e,': the "').concat(r,'" edge already exists in the graph.'));var C=!1,w=!1;p||(p=Et(t,o,{}),C=!0,o===s&&(m=p,w=!0)),m||(m=Et(t,s,{}),w=!0),d=new W(i,r,p,m,l),t._edges.set(r,d);var b=o===s;return i?(p.undirectedDegree++,m.undirectedDegree++,b&&(p.undirectedLoops++,t._undirectedSelfLoopCount++)):(p.outDegree++,m.inDegree++,b&&(p.directedLoops++,t._directedSelfLoopCount++)),t.multi?d.attachMulti():d.attach(),i?t._undirectedSize++:t._directedSize++,y.key=r,t.emit("edgeAdded",y),[r,!0,C,w]}function xt(t,e){t._edges.delete(e.key);var n=e.source,i=e.target,r=e.attributes,o=e.undirected,s=n===i;o?(n.undirectedDegree--,i.undirectedDegree--,s&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,s&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),o?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:r,source:n.key,target:i.key,undirected:o})}var _t=function(n){function i(t){var e;if(e=n.call(this)||this,"boolean"!=typeof(t=a({},At,t)).multi)throw new H("Graph.constructor: invalid 'multi' option. Expecting a boolean but got \"".concat(t.multi,'".'));if(!wt.has(t.type))throw new H('Graph.constructor: invalid \'type\' option. Should be one of "mixed", "directed" or "undirected" but got "'.concat(t.type,'".'));if("boolean"!=typeof t.allowSelfLoops)throw new H("Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got \"".concat(t.allowSelfLoops,'".'));var i="mixed"===t.type?Y:"directed"===t.type?$:j;h(s(e),"NodeDataClass",i);var r="geid_"+Ct()+"_",o=0;return h(s(e),"_attributes",{}),h(s(e),"_nodes",new Map),h(s(e),"_edges",new Map),h(s(e),"_directedSize",0),h(s(e),"_undirectedSize",0),h(s(e),"_directedSelfLoopCount",0),h(s(e),"_undirectedSelfLoopCount",0),h(s(e),"_edgeKeyGenerator",(function(){var t;do{t=r+o++}while(e._edges.has(t));return t})),h(s(e),"_options",t),bt.forEach((function(t){return h(s(e),t,e[t])})),d(s(e),"order",(function(){return e._nodes.size})),d(s(e),"size",(function(){return e._edges.size})),d(s(e),"directedSize",(function(){return e._directedSize})),d(s(e),"undirectedSize",(function(){return e._undirectedSize})),d(s(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),d(s(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),d(s(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),d(s(e),"multi",e._options.multi),d(s(e),"type",e._options.type),d(s(e),"allowSelfLoops",e._options.allowSelfLoops),d(s(e),"implementation",(function(){return"graphology"})),e}e(i,n);var r=i.prototype;return r._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},r.hasNode=function(t){return this._nodes.has(""+t)},r.hasDirectedEdge=function(t,e){if("undirected"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&!i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.out.hasOwnProperty(e)}throw new H("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasUndirectedEdge=function(t,e){if("directed"===this.type)return!1;if(1===arguments.length){var n=""+t,i=this._edges.get(n);return!!i&&i.undirected}if(2===arguments.length){t=""+t,e=""+e;var r=this._nodes.get(t);return!!r&&r.undirected.hasOwnProperty(e)}throw new H("Graph.hasDirectedEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.hasEdge=function(t,e){if(1===arguments.length){var n=""+t;return this._edges.has(n)}if(2===arguments.length){t=""+t,e=""+e;var i=this._nodes.get(t);return!!i&&(void 0!==i.out&&i.out.hasOwnProperty(e)||void 0!==i.undirected&&i.undirected.hasOwnProperty(e))}throw new H("Graph.hasEdge: invalid arity (".concat(arguments.length,", instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target."))},r.directedEdge=function(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new q("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");var n=this._nodes.get(t);if(!n)throw new B('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B('Graph.directedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||void 0;return i?i.key:void 0}},r.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new q("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");var n=this._nodes.get(t);if(!n)throw new B('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B('Graph.undirectedEdge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.undirected&&n.undirected[e]||void 0;return i?i.key:void 0}},r.edge=function(t,e){if(this.multi)throw new q("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B('Graph.edge: could not find the "'.concat(e,'" target node in the graph.'));var i=n.out&&n.out[e]||n.undirected&&n.undirected[e]||void 0;if(i)return i.key},r.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},r.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},r.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},r.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},r.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)||"directed"!==this.type&&e in n.undirected},r.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areInboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in||"directed"!==this.type&&e in n.undirected},r.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new B('Graph.areOutboundNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out||"directed"!==this.type&&e in n.undirected},r.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},r.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},r.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},r.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},r.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree),n},r.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outboundDegree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.outDegree),n},r.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.degree: could not find the "'.concat(t,'" node in the graph.'));var n=0;return"directed"!==this.type&&(n+=e.undirectedDegree),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree),n},r.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},r.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},r.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},r.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},r.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.inboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree,i+=e.directedLoops),n-i},r.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.outboundDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.outDegree,i+=e.directedLoops),n-i},r.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new B('Graph.degreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));var n=0,i=0;return"directed"!==this.type&&(n+=e.undirectedDegree,i+=2*e.undirectedLoops),"undirected"!==this.type&&(n+=e.inDegree+e.outDegree,i+=2*e.directedLoops),n-i},r.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},r.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},r.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},r.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new B('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var i=n.source.key,r=n.target.key;if(t===i)return r;if(t===r)return i;throw new B('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(i,", ").concat(r,")."))},r.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new B('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},r.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},r.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},r.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new B('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},r.addNode=function(t,e){var n=function(t,e,n){if(n&&!u(n))throw new H('Graph.addNode: invalid attributes. Expecting an object but got "'.concat(n,'"'));if(e=""+e,n=n||{},t._nodes.has(e))throw new q('Graph.addNode: the "'.concat(e,'" node already exist in the graph.'));var i=new t.NodeDataClass(e,n);return t._nodes.set(e,i),t.emit("nodeAdded",{key:e,attributes:n}),i}(this,t,e);return n.key},r.mergeNode=function(t,e){if(e&&!u(e))throw new H('Graph.mergeNode: invalid attributes. Expecting an object but got "'.concat(e,'"'));t=""+t,e=e||{};var n=this._nodes.get(t);return n?(e&&(a(n.attributes,e),this.emit("nodeAttributesUpdated",{type:"merge",key:t,attributes:n.attributes,data:e})),[t,!1]):(n=new this.NodeDataClass(t,e),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:e}),[t,!0])},r.updateNode=function(t,e){if(e&&"function"!=typeof e)throw new H('Graph.updateNode: invalid updater function. Expecting a function but got "'.concat(e,'"'));t=""+t;var n=this._nodes.get(t);if(n){if(e){var i=n.attributes;n.attributes=e(i),this.emit("nodeAttributesUpdated",{type:"replace",key:t,attributes:n.attributes})}return[t,!1]}var r=e?e({}):{};return n=new this.NodeDataClass(t,r),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:r}),[t,!0]},r.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new B('Graph.dropNode: could not find the "'.concat(t,'" node in the graph.'));if("undirected"!==this.type){for(var i in n.out){e=n.out[i];do{xt(this,e),e=e.next}while(e)}for(var r in n.in){e=n.in[r];do{xt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{xt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},r.dropEdge=function(t){var e;if(arguments.length>1){var n=""+arguments[0],i=""+arguments[1];if(!(e=l(this,n,i,this.type)))throw new B('Graph.dropEdge: could not find the "'.concat(n,'" -> "').concat(i,'" edge in the graph.'))}else if(t=""+t,!(e=this._edges.get(t)))throw new B('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return xt(this,e),this},r.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new q("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new q("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=l(this,t=""+t,e=""+e,"directed");if(!n)throw new B('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return xt(this,n),this},r.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new q("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new q("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");var n=l(this,t,e,"undirected");if(!n)throw new B('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return xt(this,n),this},r.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},r.clearEdges=function(){for(var t,e=this._nodes.values();!0!==(t=e.next()).done;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")},r.getAttribute=function(t){return this._attributes[t]},r.getAttributes=function(){return this._attributes},r.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},r.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.updateAttribute=function(t,e){if("function"!=typeof e)throw new H("Graph.updateAttribute: updater should be a function.");var n=this._attributes[t];return this._attributes[t]=e(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},r.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},r.replaceAttributes=function(t){if(!u(t))throw new H("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=t,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this},r.mergeAttributes=function(t){if(!u(t))throw new H("Graph.mergeAttributes: provided attributes are not a plain object.");return a(this._attributes,t),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:t}),this},r.updateAttributes=function(t){if("function"!=typeof t)throw new H("Graph.updateAttributes: provided updater is not a function.");return this._attributes=t(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this},r.updateEachNodeAttributes=function(t,e){if("function"!=typeof t)throw new H("Graph.updateEachNodeAttributes: expecting an updater function.");if(e&&!f(e))throw new H("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r=this._nodes.values();!0!==(n=r.next()).done;)(i=n.value).attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},r.updateEachEdgeAttributes=function(t,e){if("function"!=typeof t)throw new H("Graph.updateEachEdgeAttributes: expecting an updater function.");if(e&&!f(e))throw new H("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");for(var n,i,r,o,s=this._edges.values();!0!==(n=s.next()).done;)r=(i=n.value).source,o=i.target,i.attributes=t(i.key,i.attributes,r.key,o.key,r.attributes,o.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},r.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new H("Graph.forEachAdjacencyEntry: expecting a callback.");mt(!1,!1,!1,this,t)},r.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new H("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");mt(!1,!1,!0,this,t)},r.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new H("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");mt(!1,!0,!1,this,t)},r.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new H("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");mt(!1,!0,!0,this,t)},r.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):V(this._nodes.keys(),this._nodes.size)},r.forEachNode=function(t){if("function"!=typeof t)throw new H("Graph.forEachNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)},r.findNode=function(t){if("function"!=typeof t)throw new H("Graph.findNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return n.key},r.mapNodes=function(t){if("function"!=typeof t)throw new H("Graph.mapNode: expecting a callback.");for(var e,n,i=this._nodes.values(),r=new Array(this.order),o=0;!0!==(e=i.next()).done;)n=e.value,r[o++]=t(n.key,n.attributes);return r},r.someNode=function(t){if("function"!=typeof t)throw new H("Graph.someNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(t((n=e.value).key,n.attributes))return!0;return!1},r.everyNode=function(t){if("function"!=typeof t)throw new H("Graph.everyNode: expecting a callback.");for(var e,n,i=this._nodes.values();!0!==(e=i.next()).done;)if(!t((n=e.value).key,n.attributes))return!1;return!0},r.filterNodes=function(t){if("function"!=typeof t)throw new H("Graph.filterNodes: expecting a callback.");for(var e,n,i=this._nodes.values(),r=[];!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)&&r.push(n.key);return r},r.reduceNodes=function(t,e){if("function"!=typeof t)throw new H("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new H("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");for(var n,i,r=e,o=this._nodes.values();!0!==(n=o.next()).done;)r=t(r,(i=n.value).key,i.attributes);return r},r.nodeEntries=function(){var t=this._nodes.values();return new L((function(){var e=t.next();if(e.done)return e;var n=e.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}))},r.export=function(){var t=this,e=new Array(this._nodes.size),n=0;this._nodes.forEach((function(t,i){e[n++]=function(t,e){var n={key:t};return c(e.attributes)||(n.attributes=a({},e.attributes)),n}(i,t)}));var i=new Array(this._edges.size);return n=0,this._edges.forEach((function(e,r){i[n++]=function(t,e,n){var i={key:e,source:n.source.key,target:n.target.key};return c(n.attributes)||(i.attributes=a({},n.attributes)),"mixed"===t&&n.undirected&&(i.undirected=!0),i}(t.type,r,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}},r.import=function(t){var e,n,r,o,s,a=this,l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t instanceof i)return t.forEachNode((function(t,e){l?a.mergeNode(t,e):a.addNode(t,e)})),t.forEachEdge((function(t,e,n,i,r,o,s){l?s?a.mergeUndirectedEdgeWithKey(t,n,i,e):a.mergeDirectedEdgeWithKey(t,n,i,e):s?a.addUndirectedEdgeWithKey(t,n,i,e):a.addDirectedEdgeWithKey(t,n,i,e)})),this;if(!u(t))throw new H("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!u(t.attributes))throw new H("Graph.import: invalid attributes. Expecting a plain object.");l?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}if(t.nodes){if(r=t.nodes,!Array.isArray(r))throw new H("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=r.length;e<n;e++){gt(o=r[e]);var c=o,h=c.key,d=c.attributes;l?this.mergeNode(h,d):this.addNode(h,d)}}if(t.edges){var f=!1;if("undirected"===this.type&&(f=!0),r=t.edges,!Array.isArray(r))throw new H("Graph.import: invalid edges. Expecting an array.");for(e=0,n=r.length;e<n;e++){vt(s=r[e]);var p=s,m=p.source,g=p.target,v=p.attributes,y=p.undirected,C=void 0===y?f:y;"key"in s?(l?C?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:C?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey).call(this,s.key,m,g,v):(l?C?this.mergeUndirectedEdge:this.mergeDirectedEdge:C?this.addUndirectedEdge:this.addDirectedEdge).call(this,m,g,v)}}return this},r.nullCopy=function(t){var e=new i(a({},this._options,t));return e.replaceAttributes(a({},this.getAttributes())),e},r.emptyCopy=function(t){var e=this.nullCopy(t);return this._nodes.forEach((function(t,n){var i=a({},t.attributes);t=new e.NodeDataClass(n,i),e._nodes.set(n,t)})),e},r.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new q('Graph.copy: cannot create an incompatible copy from "'.concat(this.type,'" type to "').concat(t.type,'" because this would mean losing information about the current graph.'));if("boolean"==typeof t.multi&&t.multi!==this.multi&&!0!==t.multi)throw new q("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if("boolean"==typeof t.allowSelfLoops&&t.allowSelfLoops!==this.allowSelfLoops&&!0!==t.allowSelfLoops)throw new q("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");for(var e,n,i=this.emptyCopy(t),r=this._edges.values();!0!==(e=r.next()).done;)St(i,"copy",!1,(n=e.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return i},r.toJSON=function(){return this.export()},r.toString=function(){return"[object Graph]"},r.inspect=function(){var e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var i={},r={};this._edges.forEach((function(t,n){var o,s=t.undirected?"--":"->",a="",l=t.source.key,u=t.target.key;t.undirected&&l>u&&(o=l,l=u,u=o);var c="(".concat(l,")").concat(s,"(").concat(u,")");n.startsWith("geid_")?e.multi&&(void 0===r[c]?r[c]=0:r[c]++,a+="".concat(r[c],". ")):a+="[".concat(n,"]: "),i[a+=c]=t.attributes}));var o={};for(var s in this)this.hasOwnProperty(s)&&!bt.has(s)&&"function"!=typeof this[s]&&"symbol"!==t(s)&&(o[s]=this[s]);return o.attributes=this._attributes,o.nodes=n,o.edges=i,h(o,"constructor",this.constructor),o},i}(m.exports.EventEmitter);"undefined"!=typeof Symbol&&(_t.prototype[Symbol.for("nodejs.util.inspect.custom")]=_t.prototype.inspect),[{name:function(t){return"".concat(t,"Edge")},generateKey:!0},{name:function(t){return"".concat(t,"DirectedEdge")},generateKey:!0,type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdge")},generateKey:!0,type:"undirected"},{name:function(t){return"".concat(t,"EdgeWithKey")}},{name:function(t){return"".concat(t,"DirectedEdgeWithKey")},type:"directed"},{name:function(t){return"".concat(t,"UndirectedEdgeWithKey")},type:"undirected"}].forEach((function(t){["add","merge","update"].forEach((function(e){var n=t.name(e),i="add"===e?St:Tt;t.generateKey?_t.prototype[n]=function(r,o,s){return i(this,n,!0,"undirected"===(t.type||this.type),null,r,o,s,"update"===e)}:_t.prototype[n]=function(r,o,s,a){return i(this,n,!1,"undirected"===(t.type||this.type),r,o,s,a,"update"===e)}}))})),function(t){K.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Node"),0),i(t,n("Source"),1),i(t,n("Target"),2),i(t,n("Opposite"),3)}))}(_t),function(t){Q.forEach((function(e){var n=e.name,i=e.attacher;i(t,n("Edge"),"mixed"),i(t,n("DirectedEdge"),"directed"),i(t,n("UndirectedEdge"),"undirected")}))}(_t),function(t){tt.forEach((function(e){!function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];if(!arguments.length)return function(t,e){if(0===t.size)return[];if("mixed"===e||e===t.type)return"function"==typeof Array.from?Array.from(t._edges.keys()):V(t._edges.keys(),t._edges.size);for(var n,i,r="undirected"===e?t.undirectedSize:t.directedSize,o=new Array(r),s="undirected"===e,a=t._edges.values(),l=0;!0!==(n=a.next()).done;)(i=n.value).undirected===s&&(o[l++]=i.key);return o}(this,i);if(1===arguments.length){t=""+t;var o=this._nodes.get(t);if(void 0===o)throw new B("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n,i){var r=[];return lt(!1,t,e,n,i,(function(t){r.push(t)})),r}(this.multi,"mixed"===i?this.type:i,r,o)}if(2===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new B("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i,r){var o=[];return ut(!1,t,e,n,i,r,(function(t){o.push(t)})),o}(i,this.multi,r,s,e)}throw new H("Graph.".concat(n,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"===i||"mixed"===this.type||i===this.type){if(1===arguments.length)return at(!1,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var s=this._nodes.get(t);if(void 0===s)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return lt(!1,this.multi,"mixed"===i?this.type:i,r,s,n)}if(3===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!1,i,this.multi,r,a,e,n)}throw new H("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))}};var s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(){var t,e=Array.prototype.slice.call(arguments),n=e.pop();if(0===e.length){var r=0;"directed"!==i&&(r+=this.undirectedSize),"undirected"!==i&&(r+=this.directedSize),t=new Array(r);var s=0;e.push((function(e,i,r,o,a,l,u){t[s++]=n(e,i,r,o,a,l,u)}))}else t=[],e.push((function(e,i,r,o,s,a,l){t.push(n(e,i,r,o,s,a,l))}));return this[o].apply(this,e),t};var a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=[];return t.push((function(t,i,r,o,s,a,l){e(t,i,r,o,s,a,l)&&n.push(t)})),this[o].apply(this,t),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[l]=function(){var t,e,n=Array.prototype.slice.call(arguments);if(n.length<2||n.length>4)throw new H("Graph.".concat(l,": invalid number of arguments (expecting 2, 3 or 4 and got ").concat(n.length,")."));if("function"==typeof n[n.length-1]&&"function"!=typeof n[n.length-2])throw new H("Graph.".concat(l,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));2===n.length?(t=n[0],e=n[1],n=[]):3===n.length?(t=n[1],e=n[2],n=[n[0]]):4===n.length&&(t=n[2],e=n[3],n=[n[0],n[1]]);var i=e;return n.push((function(e,n,r,o,s,a,l){i=t(i,e,n,r,o,s,a,l)})),this[o].apply(this,n),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e,n){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return!1;if(1===arguments.length)return at(!0,this,i,n=t);if(2===arguments.length){t=""+t,n=e;var s=this._nodes.get(t);if(void 0===s)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return lt(!0,this.multi,"mixed"===i?this.type:i,r,s,n)}if(3===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ut(!0,i,this.multi,r,a,e,n)}throw new H("Graph.".concat(o,": too many arguments (expecting 1, 2 or 3 and got ").concat(arguments.length,")."))};var s="some"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[s]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,s,a){return e(t,n,i,r,o,s,a)})),!!this[o].apply(this,t)};var a="every"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[a]=function(){var t=Array.prototype.slice.call(arguments),e=t.pop();return t.push((function(t,n,i,r,o,s,a){return!e(t,n,i,r,o,s,a)})),!this[o].apply(this,t)}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t,e){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return L.empty();if(!arguments.length)return function(t,e){if(0===t.size)return L.empty();var n="mixed"!==e&&e!==t.type,i="undirected"===e,r=t._edges.values();return new L((function(){for(var t,e;;){if((t=r.next()).done)return t;if(e=t.value,!n||e.undirected===i)break}return{value:{edge:e.key,attributes:e.attributes,source:e.source.key,target:e.target.key,sourceAttributes:e.source.attributes,targetAttributes:e.target.attributes,undirected:e.undirected},done:!1}}))}(this,i);if(1===arguments.length){t=""+t;var n=this._nodes.get(t);if(!n)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){var i=L.empty();return"undirected"!==t&&("out"!==e&&void 0!==n.in&&(i=Z(i,it(n.in))),"in"!==e&&void 0!==n.out&&(i=Z(i,it(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(i=Z(i,it(n.undirected))),i}(i,r,n)}if(2===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new B("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i){var r=L.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&i in n.in&&(r=Z(r,st(n.in,i))),void 0!==n.out&&"in"!==e&&i in n.out&&(e||n.key!==i)&&(r=Z(r,st(n.out,i)))),"directed"!==t&&void 0!==n.undirected&&i in n.undirected&&(r=Z(r,st(n.undirected,i))),r}(i,r,s,e)}throw new H("Graph.".concat(o,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(_t),function(t){ct.forEach((function(e){(function(t,e){var n=e.name,i=e.type,r=e.direction;t.prototype[n]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return[];t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new B("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return Object.keys(n.undirected);if("string"==typeof e)return Object.keys(n[e])}var i=[];return ft(!1,t,e,n,(function(t){i.push(t)})),i}("mixed"===i?this.type:i,r,e)}})(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[o]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));ft(!1,"mixed"===i?this.type:i,r,n,e)}};var s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){var n=[];return this[o](t,(function(t,i){n.push(e(t,i))})),n};var a="filter"+n[0].toUpperCase()+n.slice(1);t.prototype[a]=function(t,e){var n=[];return this[o](t,(function(t,i){e(t,i)&&n.push(t)})),n};var l="reduce"+n[0].toUpperCase()+n.slice(1);t.prototype[l]=function(t,e,n){if(arguments.length<3)throw new H("Graph.".concat(l,": missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array."));var i=n;return this[o](t,(function(t,n){i=e(i,t,n)})),i}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n[0].toUpperCase()+n.slice(1,-1),s="find"+o;t.prototype[s]=function(t,e){if("mixed"===i||"mixed"===this.type||i===this.type){t=""+t;var n=this._nodes.get(t);if(void 0===n)throw new B("Graph.".concat(s,': could not find the "').concat(t,'" node in the graph.'));return ft(!0,"mixed"===i?this.type:i,r,n,e)}};var a="some"+o;t.prototype[a]=function(t,e){return!!this[s](t,e)};var l="every"+o;t.prototype[l]=function(t,e){return!this[s](t,(function(t,n){return!e(t,n)}))}}(t,e),function(t,e){var n=e.name,i=e.type,r=e.direction,o=n.slice(0,-1)+"Entries";t.prototype[o]=function(t){if("mixed"!==i&&"mixed"!==this.type&&i!==this.type)return L.empty();t=""+t;var e=this._nodes.get(t);if(void 0===e)throw new B("Graph.".concat(o,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n){if("mixed"!==t){if("undirected"===t)return pt(null,n,n.undirected);if("string"==typeof e)return pt(null,n,n[e])}var i=L.empty(),r=new ht;return"undirected"!==t&&("out"!==e&&(i=Z(i,pt(r,n,n.in))),"in"!==e&&(i=Z(i,pt(r,n,n.out)))),"directed"!==t&&(i=Z(i,pt(r,n,n.undirected))),i}("mixed"===i?this.type:i,r,e)}}(t,e)}))}(_t);var Nt=function(t){function n(e){var n=a({type:"directed"},e);if("multi"in n&&!1!==n.multi)throw new H("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("directed"!==n.type)throw new H('DirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t),Mt=function(t){function n(e){var n=a({type:"undirected"},e);if("multi"in n&&!1!==n.multi)throw new H("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if("undirected"!==n.type)throw new H('UndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t),Ot=function(t){function n(e){var n=a({multi:!0},e);if("multi"in n&&!0!==n.multi)throw new H("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");return t.call(this,n)||this}return e(n,t),n}(_t),Lt=function(t){function n(e){var n=a({type:"directed",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new H("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("directed"!==n.type)throw new H('MultiDirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t),It=function(t){function n(e){var n=a({type:"undirected",multi:!0},e);if("multi"in n&&!0!==n.multi)throw new H("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if("undirected"!==n.type)throw new H('MultiUndirectedGraph.from: inconsistent "'+n.type+'" type in given options!');return t.call(this,n)||this}return e(n,t),n}(_t);function Rt(t){t.from=function(e,n){var i=a({},e.options,n),r=new t(i);return r.import(e),r}}return Rt(_t),Rt(Nt),Rt(Mt),Rt(Ot),Rt(Lt),Rt(It),_t.Graph=_t,_t.DirectedGraph=Nt,_t.UndirectedGraph=Mt,_t.MultiGraph=Ot,_t.MultiDirectedGraph=Lt,_t.MultiUndirectedGraph=It,_t.InvalidArgumentsGraphError=H,_t.NotFoundGraphError=B,_t.UsageGraphError=q,_t}()},6572:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,i=Array.prototype.slice,r=Object.prototype.toString;function o(e,n){var i=e>n?e:n;return t.pow(10,17-~~(t.log(i>0?i:-i)*t.LOG10E))}var s=Array.isArray||function(t){return"[object Array]"===r.call(t)};function a(t){return"[object Function]"===r.call(t)}function l(t){return"number"==typeof t&&t-t==0}function u(){return new u._init(arguments)}function c(){return 0}function h(){return 1}function d(t,e){return t===e?1:0}u.fn=u.prototype,u._init=function(t){if(s(t[0]))if(s(t[0][0])){a(t[1])&&(t[0]=u.map(t[0],t[1]));for(var e=0;e<t[0].length;e++)this[e]=t[0][e];this.length=t[0].length}else this[0]=a(t[1])?u.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=u.seq.apply(null,t),this.length=1;else{if(t[0]instanceof u)return u(t[0].toArray());this[0]=[],this.length=1}return this},u._init.prototype=u.prototype,u._init.constructor=u,u.utils={calcRdx:o,isArray:s,isFunction:a,isNumber:l,toVector:function(t){return n.apply([],t)}},u._random_fn=t.random,u.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");u._random_fn=t},u.extend=function(t){var e,n;if(1===arguments.length){for(n in t)u[n]=t[n];return this}for(e=1;e<arguments.length;e++)for(n in arguments[e])t[n]=arguments[e][n];return t},u.rows=function(t){return t.length||1},u.cols=function(t){return t[0].length||1},u.dimensions=function(t){return{rows:u.rows(t),cols:u.cols(t)}},u.row=function(t,e){return s(e)?e.map((function(e){return u.row(t,e)})):t[e]},u.rowa=function(t,e){return u.row(t,e)},u.col=function(t,e){if(s(e)){var n=u.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,i){u.arange(t.length).forEach((function(r){n[r][i]=t[r][e]}))})),n}for(var i=new Array(t.length),r=0;r<t.length;r++)i[r]=[t[r][e]];return i},u.cola=function(t,e){return u.col(t,e).map((function(t){return t[0]}))},u.diag=function(t){for(var e=u.rows(t),n=new Array(e),i=0;i<e;i++)n[i]=[t[i][i]];return n},u.antidiag=function(t){for(var e=u.rows(t)-1,n=new Array(e),i=0;e>=0;e--,i++)n[i]=[t[i][e]];return n},u.transpose=function(t){var e,n,i,r,o,a=[];for(s(t[0])||(t=[t]),n=t.length,i=t[0].length,o=0;o<i;o++){for(e=new Array(n),r=0;r<n;r++)e[r]=t[r][o];a.push(e)}return 1===a.length?a[0]:a},u.map=function(t,e,n){var i,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),l=0;l<o;l++)a[i][l]=e(t[i][l],i,l);return 1===a.length?a[0]:a},u.cumreduce=function(t,e,n){var i,r,o,a,l;for(s(t[0])||(t=[t]),r=t.length,o=t[0].length,a=n?t:new Array(r),i=0;i<r;i++)for(a[i]||(a[i]=new Array(o)),o>0&&(a[i][0]=t[i][0]),l=1;l<o;l++)a[i][l]=e(a[i][l-1],t[i][l]);return 1===a.length?a[0]:a},u.alter=function(t,e){return u.map(t,e,!0)},u.create=function(t,e,n){var i,r,o=new Array(t);for(a(e)&&(n=e,e=t),i=0;i<t;i++)for(o[i]=new Array(e),r=0;r<e;r++)o[i][r]=n(i,r);return o},u.zeros=function(t,e){return l(e)||(e=t),u.create(t,e,c)},u.ones=function(t,e){return l(e)||(e=t),u.create(t,e,h)},u.rand=function(t,e){return l(e)||(e=t),u.create(t,e,u._random_fn)},u.identity=function(t,e){return l(e)||(e=t),u.create(t,e,d)},u.symmetric=function(t){var e,n,i=t.length;if(t.length!==t[0].length)return!1;for(e=0;e<i;e++)for(n=0;n<i;n++)if(t[n][e]!==t[e][n])return!1;return!0},u.clear=function(t){return u.alter(t,c)},u.seq=function(t,e,n,i){a(i)||(i=!1);var r,s=[],l=o(t,e),u=(e*l-t*l)/((n-1)*l),c=t;for(r=0;c<=e&&r<n;c=(t*l+u*l*++r)/l)s.push(i?i(c,r):c);return s},u.arange=function(t,n,i){var r,o=[];if(i=i||1,n===e&&(n=t,t=0),t===n||0===i)return[];if(t<n&&i<0)return[];if(t>n&&i>0)return[];if(i>0)for(r=t;r<n;r+=i)o.push(r);else for(r=t;r>n;r+=i)o.push(r);return o},u.slice=function(){function t(t,n,i,r){var o,s=[],a=t.length;if(n===e&&i===e&&r===e)return u.copy(t);if(r=r||1,(n=(n=n||0)>=0?n:a+n)===(i=(i=i||t.length)>=0?i:a+i)||0===r)return[];if(n<i&&r<0)return[];if(n>i&&r>0)return[];if(r>0)for(o=n;o<i;o+=r)s.push(t[o]);else for(o=n;o>i;o+=r)s.push(t[o]);return s}return function(e,n){var i,r;return l((n=n||{}).row)?l(n.col)?e[n.row][n.col]:t(u.rowa(e,n.row),(i=n.col||{}).start,i.end,i.step):l(n.col)?t(u.cola(e,n.col),(r=n.row||{}).start,r.end,r.step):(r=n.row||{},i=n.col||{},t(e,r.start,r.end,r.step).map((function(e){return t(e,i.start,i.end,i.step)})))}}(),u.sliceAssign=function(n,i,r){var o,s;if(l(i.row)){if(l(i.col))return n[i.row][i.col]=r;i.col=i.col||{},i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,o=u.arange(i.col.start,t.min(n.length,i.col.end),i.col.step);var a=i.row;return o.forEach((function(t,e){n[a][t]=r[e]})),n}if(l(i.col)){i.row=i.row||{},i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,s=u.arange(i.row.start,t.min(n[0].length,i.row.end),i.row.step);var c=i.col;return s.forEach((function(t,e){n[t][c]=r[e]})),n}return r[0].length===e&&(r=[r]),i.row.start=i.row.start||0,i.row.end=i.row.end||n.length,i.row.step=i.row.step||1,i.col.start=i.col.start||0,i.col.end=i.col.end||n[0].length,i.col.step=i.col.step||1,s=u.arange(i.row.start,t.min(n.length,i.row.end),i.row.step),o=u.arange(i.col.start,t.min(n[0].length,i.col.end),i.col.step),s.forEach((function(t,e){o.forEach((function(i,o){n[t][i]=r[e][o]}))})),n},u.diagonal=function(t){var e=u.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},u.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=u.prototype;return f.length=0,f.push=Array.prototype.push,f.sort=Array.prototype.sort,f.splice=Array.prototype.splice,f.slice=Array.prototype.slice,f.toArray=function(){return this.length>1?i.call(this):i.call(this)[0]},f.map=function(t,e){return u(u.map(this,t,e))},f.cumreduce=function(t,e){return u(u.cumreduce(this,t,e))},f.alter=function(t){return u.alter(this,t),this},function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e){var n,i=this;return e?(setTimeout((function(){e.call(i,f[t].call(i))})),this):(n=u[t](this),s(n)?u(n):n)}}(t[e])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(e,n){var i=this;return n?(setTimeout((function(){n.call(i,f[t].call(i,e))})),this):u(u[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return u(u[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),u}(Math),function(t,e){var n=t.utils.isFunction;function i(t,e){return t-e}function r(t,n,i){return e.max(n,e.min(t,i))}t.sum=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.sumsqrd=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n]*t[n];return e},t.sumsqerr=function(e){for(var n,i=t.mean(e),r=0,o=e.length;--o>=0;)r+=(n=e[o]-i)*n;return r},t.sumrow=function(t){for(var e=0,n=t.length;--n>=0;)e+=t[n];return e},t.product=function(t){for(var e=1,n=t.length;--n>=0;)e*=t[n];return e},t.min=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]<e&&(e=t[n]);return e},t.max=function(t){for(var e=t[0],n=0;++n<t.length;)t[n]>e&&(e=t[n]);return e},t.unique=function(t){for(var e={},n=[],i=0;i<t.length;i++)e[t[i]]||(e[t[i]]=!0,n.push(t[i]));return n},t.mean=function(e){return t.sum(e)/e.length},t.meansqerr=function(e){return t.sumsqerr(e)/e.length},t.geomean=function(n){var i=n.map(e.log),r=t.mean(i);return e.exp(r)},t.median=function(t){var e=t.length,n=t.slice().sort(i);return 1&e?n[e/2|0]:(n[e/2-1]+n[e/2])/2},t.cumsum=function(e){return t.cumreduce(e,(function(t,e){return t+e}))},t.cumprod=function(e){return t.cumreduce(e,(function(t,e){return t*e}))},t.diff=function(t){var e,n=[],i=t.length;for(e=1;e<i;e++)n.push(t[e]-t[e-1]);return n},t.rank=function(t){var e,n=[],r={};for(e=0;e<t.length;e++)r[l=t[e]]?r[l]++:(r[l]=1,n.push(l));var o=n.sort(i),s={},a=1;for(e=0;e<o.length;e++){var l,u=r[l=o[e]],c=(a+(a+u-1))/2;s[l]=c,a+=u}return t.map((function(t){return s[t]}))},t.mode=function(t){var e,n=t.length,r=t.slice().sort(i),o=1,s=0,a=0,l=[];for(e=0;e<n;e++)r[e]===r[e+1]?o++:(o>s?(l=[r[e]],s=o,a=0):o===s&&(l.push(r[e]),a++),o=1);return 0===a?l[0]:l},t.range=function(e){return t.max(e)-t.min(e)},t.variance=function(e,n){return t.sumsqerr(e)/(e.length-(n?1:0))},t.pooledvariance=function(e){return e.reduce((function(e,n){return e+t.sumsqerr(n)}),0)/(e.reduce((function(t,e){return t+e.length}),0)-e.length)},t.deviation=function(e){for(var n=t.mean(e),i=e.length,r=new Array(i),o=0;o<i;o++)r[o]=e[o]-n;return r},t.stdev=function(n,i){return e.sqrt(t.variance(n,i))},t.pooledstdev=function(n){return e.sqrt(t.pooledvariance(n))},t.meandev=function(n){for(var i=t.mean(n),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.mean(r)},t.meddev=function(n){for(var i=t.median(n),r=[],o=n.length-1;o>=0;o--)r.push(e.abs(n[o]-i));return t.median(r)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,r=t.slice().sort(i);return[r[e.round(n/4)-1],r[e.round(n/2)-1],r[e.round(3*n/4)-1]]},t.quantiles=function(t,n,o,s){var a,l,u,c,h,d=t.slice().sort(i),f=[n.length],p=t.length;for(void 0===o&&(o=3/8),void 0===s&&(s=3/8),a=0;a<n.length;a++)u=p*(l=n[a])+(o+l*(1-o-s)),c=e.floor(r(u,1,p-1)),h=r(u-c,0,1),f[a]=(1-h)*d[c-1]+h*d[c];return f},t.percentile=function(t,e,n){var r=t.slice().sort(i),o=e*(r.length+(n?1:-1))+(n?0:1),s=parseInt(o),a=o-s;return s+1<r.length?r[s-1]+a*(r[s]-r[s-1]):r[s-1]},t.percentileOfScore=function(t,e,n){var i,r,o=0,s=t.length,a=!1;for("strict"===n&&(a=!0),r=0;r<s;r++)i=t[r],(a&&i<e||!a&&i<=e)&&o++;return o/s},t.histogram=function(n,i){i=i||4;var r,o=t.min(n),s=(t.max(n)-o)/i,a=n.length,l=[];for(r=0;r<i;r++)l[r]=0;for(r=0;r<a;r++)l[e.min(e.floor((n[r]-o)/s),i-1)]+=1;return l},t.covariance=function(e,n){var i,r=t.mean(e),o=t.mean(n),s=e.length,a=new Array(s);for(i=0;i<s;i++)a[i]=(e[i]-r)*(n[i]-o);return t.sum(a)/(s-1)},t.corrcoeff=function(e,n){return t.covariance(e,n)/t.stdev(e,1)/t.stdev(n,1)},t.spearmancoeff=function(e,n){return e=t.rank(e),n=t.rank(n),t.corrcoeff(e,n)},t.stanMoment=function(n,i){for(var r=t.mean(n),o=t.stdev(n),s=n.length,a=0,l=0;l<s;l++)a+=e.pow((n[l]-r)/o,i);return a/n.length},t.skewness=function(e){return t.stanMoment(e,3)},t.kurtosis=function(e){return t.stanMoment(e,4)-3};var o=t.prototype;!function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[e].call(l,i))})),this;if(this.length>1){for(l=!0===i?this:this.transpose();a<l.length;a++)s[a]=t[e](l[a]);return s}return t[e](this[0],i)}}(e[i])}("cumsum cumprod".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(i,r){var s=[],a=0,l=this;if(n(i)&&(r=i,i=!1),r)return setTimeout((function(){r.call(l,o[e].call(l,i))})),this;if(this.length>1){for("sumrow"!==e&&(l=!0===i?this:this.transpose());a<l.length;a++)s[a]=t[e](l[a]);return!0===i?t[e](t.utils.toVector(s)):s}return t[e](this[0],i)}}(e[i])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(e){for(var i=0;i<e.length;i++)!function(e){o[e]=function(){var i,r=[],s=0,a=this,l=Array.prototype.slice.call(arguments);if(n(l[l.length-1])){i=l[l.length-1];var u=l.slice(0,l.length-1);return setTimeout((function(){i.call(a,o[e].apply(a,u))})),this}i=void 0;var c=function(n){return t[e].apply(a,[n].concat(l))};if(this.length>1){for(a=a.transpose();s<a.length;s++)r[s]=c(a[s]);return r}return c(this[0])}}(e[i])}("quantiles percentileOfScore".split(" "))}(e,Math),function(t,e){t.gammaln=function(t){var n,i,r,o=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(r=(i=n=t)+5.5,r-=(n+.5)*e.log(r);o<6;o++)a+=s[o]/++i;return e.log(2.5066282746310007*a/n)-r},t.loggam=function(t){var n,i,r,o,s,a,l,u=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(n=t,l=0,1==t||2==t)return 0;for(t<=7&&(n=t+(l=e.floor(7-t))),i=1/(n*n),r=2*e.PI,s=u[9],a=8;a>=0;a--)s*=i,s+=u[a];if(o=s/n+.5*e.log(r)+(n-.5)*e.log(n)-n,t<=7)for(a=1;a<=l;a++)o-=e.log(n-1),n-=1;return o},t.gammafn=function(t){var n,i,r,o,s=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],l=!1,u=0,c=0,h=0,d=t;if(t>171.6243769536076)return 1/0;if(d<=0){if(!(o=d%1+36e-17))return 1/0;l=(1&d?-1:1)*e.PI/e.sin(e.PI*o),d=1-d}for(r=d,i=d<1?d++:(d-=u=(0|d)-1)-1,n=0;n<8;++n)h=(h+s[n])*i,c=c*i+a[n];if(o=h/c+1,r<d)o/=r;else if(r>d)for(n=0;n<u;++n)o*=d,d++;return l&&(o=l/o),o},t.gammap=function(e,n){return t.lowRegGamma(e,n)*t.gammafn(e)},t.lowRegGamma=function(n,i){var r,o=t.gammaln(n),s=n,a=1/n,l=a,u=i+1-n,c=1/1e-30,h=1/u,d=h,f=1,p=-~(8.5*e.log(n>=1?n:1/n)+.4*n+17);if(i<0||n<=0)return NaN;if(i<n+1){for(;f<=p;f++)a+=l*=i/++s;return a*e.exp(-i+n*e.log(i)-o)}for(;f<=p;f++)d*=(h=1/(h=(r=-f*(f-n))*h+(u+=2)))*(c=u+r/c);return 1-d*e.exp(-i+n*e.log(i)-o)},t.factorialln=function(e){return e<0?NaN:t.gammaln(e+1)},t.factorial=function(e){return e<0?NaN:t.gammafn(e+1)},t.combination=function(n,i){return n>170||i>170?e.exp(t.combinationln(n,i)):t.factorial(n)/t.factorial(i)/t.factorial(n-i)},t.combinationln=function(e,n){return t.factorialln(e)-t.factorialln(n)-t.factorialln(e-n)},t.permutation=function(e,n){return t.factorial(e)/t.factorial(e-n)},t.betafn=function(n,i){if(!(n<=0||i<=0))return n+i>170?e.exp(t.betaln(n,i)):t.gammafn(n)*t.gammafn(i)/t.gammafn(n+i)},t.betaln=function(e,n){return t.gammaln(e)+t.gammaln(n)-t.gammaln(e+n)},t.betacf=function(t,n,i){var r,o,s,a,l=1e-30,u=1,c=n+i,h=n+1,d=n-1,f=1,p=1-c*t/h;for(e.abs(p)<l&&(p=l),a=p=1/p;u<=100&&(p=1+(o=u*(i-u)*t/((d+(r=2*u))*(n+r)))*p,e.abs(p)<l&&(p=l),f=1+o/f,e.abs(f)<l&&(f=l),a*=(p=1/p)*f,p=1+(o=-(n+u)*(c+u)*t/((n+r)*(h+r)))*p,e.abs(p)<l&&(p=l),f=1+o/f,e.abs(f)<l&&(f=l),a*=s=(p=1/p)*f,!(e.abs(s-1)<3e-7));u++);return a},t.gammapinv=function(n,i){var r,o,s,a,l,u,c=0,h=i-1,d=t.gammaln(i);if(n>=1)return e.max(100,i+100*e.sqrt(i));if(n<=0)return 0;for(i>1?(l=e.log(h),u=e.exp(h*(l-1)-d),a=n<.5?n:1-n,r=(2.30753+.27061*(o=e.sqrt(-2*e.log(a))))/(1+o*(.99229+.04481*o))-o,n<.5&&(r=-r),r=e.max(.001,i*e.pow(1-1/(9*i)-r/(3*e.sqrt(i)),3))):r=n<(o=1-i*(.253+.12*i))?e.pow(n/o,1/i):1-e.log(1-(n-o)/(1-o));c<12;c++){if(r<=0)return 0;if((r-=o=(s=(t.lowRegGamma(i,r)-n)/(o=i>1?u*e.exp(-(r-h)+h*(e.log(r)-l)):e.exp(-r+h*e.log(r)-d)))/(1-.5*e.min(1,s*((i-1)/r-1))))<=0&&(r=.5*(r+o)),e.abs(o)<1e-8*r)break}return r},t.erf=function(t){var n,i,r,o,s=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],a=s.length-1,l=!1,u=0,c=0;for(t<0&&(t=-t,l=!0),i=4*(n=2/(2+t))-2;a>0;a--)r=u,u=i*u-c+s[a],c=r;return o=n*e.exp(-t*t+.5*(s[0]+i*u)-c),l?o-1:1-o},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var i,r,o,s,a=0;if(n>=2)return-100;if(n<=0)return 100;for(s=n<1?n:2-n,i=-.70711*((2.30753+.27061*(o=e.sqrt(-2*e.log(s/2))))/(1+o*(.99229+.04481*o))-o);a<2;a++)i+=(r=t.erfc(i)-s)/(1.1283791670955126*e.exp(-i*i)-i*r);return n<1?i:-i},t.ibetainv=function(n,i,r){var o,s,a,l,u,c,h,d,f,p,m=i-1,g=r-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(i>=1&&r>=1?(a=n<.5?n:1-n,c=(2.30753+.27061*(l=e.sqrt(-2*e.log(a))))/(1+l*(.99229+.04481*l))-l,n<.5&&(c=-c),h=(c*c-3)/6,d=2/(1/(2*i-1)+1/(2*r-1)),f=c*e.sqrt(h+d)/d-(1/(2*r-1)-1/(2*i-1))*(h+5/6-2/(3*d)),c=i/(i+r*e.exp(2*f))):(o=e.log(i/(i+r)),s=e.log(r/(i+r)),c=n<(l=e.exp(i*o)/i)/(f=l+(u=e.exp(r*s)/r))?e.pow(i*f*n,1/i):1-e.pow(r*f*(1-n),1/r)),p=-t.gammaln(i)-t.gammaln(r)+t.gammaln(i+r);v<10;v++){if(0===c||1===c)return c;if((c-=l=(u=(t.ibeta(c,i,r)-n)/(l=e.exp(m*e.log(c)+g*e.log(1-c)+p)))/(1-.5*e.min(1,u*(m/c-g/(1-c)))))<=0&&(c=.5*(c+l)),c>=1&&(c=.5*(c+l+1)),e.abs(l)<1e-8*c&&v>0)break}return c},t.ibeta=function(n,i,r){var o=0===n||1===n?0:e.exp(t.gammaln(i+r)-t.gammaln(i)-t.gammaln(r)+i*e.log(n)+r*e.log(1-n));return!(n<0||n>1)&&(n<(i+1)/(i+r+2)?o*t.betacf(n,i,r)/i:1-o*t.betacf(1-n,r,i)/r)},t.randn=function(n,i){var r,o,s,a,l;if(i||(i=n),n)return t.create(n,i,(function(){return t.randn()}));do{r=t._random_fn(),o=1.7156*(t._random_fn()-.5),l=(s=r-.449871)*s+(a=e.abs(o)+.386595)*(.196*a-.25472*s)}while(l>.27597&&(l>.27846||o*o>-4*e.log(r)*r*r));return o/r},t.randg=function(n,i,r){var o,s,a,l,u,c,h=n;if(r||(r=i),n||(n=1),i)return(c=t.zeros(i,r)).alter((function(){return t.randg(n)})),c;n<1&&(n+=1),o=n-1/3,s=1/e.sqrt(9*o);do{do{l=1+s*(u=t.randn())}while(l<=0);l*=l*l,a=t._random_fn()}while(a>1-.331*e.pow(u,4)&&e.log(a)>.5*u*u+o*(1-l+e.log(l)));if(n==h)return o*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/h)*o*l},function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t.map(this,(function(n){return t[e](n)})))}}(e[n])}("gammaln gammafn factorial factorialln".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(){return t(t[e].apply(null,arguments))}}(e[n])}("randn".split(" "))}(e,Math),function(t,e){function n(t,n,i,r){for(var o,s=0,a=1,l=1,u=1,c=0,h=0;e.abs((l-h)/l)>r;)h=l,a=u+(o=-(n+c)*(n+i+c)*t/(n+2*c)/(n+2*c+1))*a,l=(s=l+o*s)+(o=(c+=1)*(i-c)*t/(n+2*c-1)/(n+2*c))*l,s/=u=a+o*u,a/=u,l/=u,u=1;return l/n}function i(n,i,r){var o=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],s=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*n;if(a>=8)return 1;var l,u=2*t.normal.cdf(a,0,1,1,0)-1;u=u>=e.exp(-50/r)?e.pow(u,r):0;for(var c=a,h=(8-a)/(l=n>3?2:3),d=c+h,f=0,p=r-1,m=1;m<=l;m++){for(var g=0,v=.5*(d+c),y=.5*(d-c),C=1;C<=12;C++){var w,b=v+y*(6<C?o[(w=12-C+1)-1]:-o[(w=C)-1]),A=b*b;if(A>60)break;var E=2*t.normal.cdf(b,0,1,1,0)*.5-2*t.normal.cdf(b,n,1,1,0)*.5;E>=e.exp(-30/p)&&(g+=E=s[w-1]*e.exp(-.5*A)*e.pow(E,p))}f+=g*=2*y*r/e.sqrt(2*e.PI),c=d,d+=h}return(u+=f)<=e.exp(-30/i)?0:(u=e.pow(u,i))>=1?1:u}!function(e){for(var n=0;n<e.length;n++)!function(e){t[e]=function t(e,n,i){return this instanceof t?(this._a=e,this._b=n,this._c=i,this):new t(e,n,i)},t.fn[e]=function(n,i,r){var o=t[e](n,i,r);return o.data=this,o},t[e].prototype.sample=function(n){var i=this._a,r=this._b,o=this._c;return n?t.alter(n,(function(){return t[e].sample(i,r,o)})):t[e].sample(i,r,o)},function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(i){var r=this._a,o=this._b,s=this._c;return i||0===i||(i=this.data),"number"!=typeof i?t.fn.map.call(i,(function(i){return t[e][n](i,r,o,s)})):t[e][n](i,r,o,s)}}(n[i])}("pdf cdf inv".split(" ")),function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(){return t[e][n](this._a,this._b,this._c)}}(n[i])}("mean median mode variance".split(" "))}(e[n])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),t.extend(t.beta,{pdf:function(n,i,r){return n>1||n<0?0:1==i&&1==r?1:i<512&&r<512?e.pow(n,i-1)*e.pow(1-n,r-1)/t.betafn(i,r):e.exp((i-1)*e.log(n)+(r-1)*e.log(1-n)-t.betaln(i,r))},cdf:function(e,n,i){return e>1||e<0?1*(e>1):t.ibeta(e,n,i)},inv:function(e,n,i){return t.ibetainv(e,n,i)},mean:function(t,e){return t/(t+e)},median:function(e,n){return t.ibetainv(.5,e,n)},mode:function(t,e){return(t-1)/(t+e-2)},sample:function(e,n){var i=t.randg(e);return i/(i+t.randg(n))},variance:function(t,n){return t*n/(e.pow(t+n,2)*(t+n+1))}}),t.extend(t.centralF,{pdf:function(n,i,r){var o;return n<0?0:i<=2?0===n&&i<2?1/0:0===n&&2===i?1:1/t.betafn(i/2,r/2)*e.pow(i/r,i/2)*e.pow(n,i/2-1)*e.pow(1+i/r*n,-(i+r)/2):(o=i*n/(r+n*i),i*(r/(r+n*i))/2*t.binomial.pdf((i-2)/2,(i+r-2)/2,o))},cdf:function(e,n,i){return e<0?0:t.ibeta(n*e/(n*e+i),n/2,i/2)},inv:function(e,n,i){return i/(n*(1/t.ibetainv(e,n/2,i/2)-1))},mean:function(t,e){return e>2?e/(e-2):void 0},mode:function(t,e){return t>2?e*(t-2)/(t*(e+2)):void 0},sample:function(e,n){return 2*t.randg(e/2)/e/(2*t.randg(n/2)/n)},variance:function(t,e){if(!(e<=4))return 2*e*e*(t+e-2)/(t*(e-2)*(e-2)*(e-4))}}),t.extend(t.cauchy,{pdf:function(t,n,i){return i<0?0:i/(e.pow(t-n,2)+e.pow(i,2))/e.PI},cdf:function(t,n,i){return e.atan((t-n)/i)/e.PI+.5},inv:function(t,n,i){return n+i*e.tan(e.PI*(t-.5))},median:function(t){return t},mode:function(t){return t},sample:function(n,i){return t.randn()*e.sqrt(1/(2*t.randg(.5)))*i+n}}),t.extend(t.chisquare,{pdf:function(n,i){return n<0?0:0===n&&2===i?.5:e.exp((i/2-1)*e.log(n)-n/2-i/2*e.log(2)-t.gammaln(i/2))},cdf:function(e,n){return e<0?0:t.lowRegGamma(n/2,e/2)},inv:function(e,n){return 2*t.gammapinv(e,.5*n)},mean:function(t){return t},median:function(t){return t*e.pow(1-2/(9*t),3)},mode:function(t){return t-2>0?t-2:0},sample:function(e){return 2*t.randg(e/2)},variance:function(t){return 2*t}}),t.extend(t.exponential,{pdf:function(t,n){return t<0?0:n*e.exp(-n*t)},cdf:function(t,n){return t<0?0:1-e.exp(-n*t)},inv:function(t,n){return-e.log(1-t)/n},mean:function(t){return 1/t},median:function(t){return 1/t*e.log(2)},mode:function(){return 0},sample:function(n){return-1/n*e.log(t._random_fn())},variance:function(t){return e.pow(t,-2)}}),t.extend(t.gamma,{pdf:function(n,i,r){return n<0?0:0===n&&1===i?1/r:e.exp((i-1)*e.log(n)-n/r-t.gammaln(i)-i*e.log(r))},cdf:function(e,n,i){return e<0?0:t.lowRegGamma(n,e/i)},inv:function(e,n,i){return t.gammapinv(e,n)*i},mean:function(t,e){return t*e},mode:function(t,e){if(t>1)return(t-1)*e},sample:function(e,n){return t.randg(e)*n},variance:function(t,e){return t*e*e}}),t.extend(t.invgamma,{pdf:function(n,i,r){return n<=0?0:e.exp(-(i+1)*e.log(n)-r/n-t.gammaln(i)+i*e.log(r))},cdf:function(e,n,i){return e<=0?0:1-t.lowRegGamma(n,i/e)},inv:function(e,n,i){return i/t.gammapinv(1-e,n)},mean:function(t,e){return t>1?e/(t-1):void 0},mode:function(t,e){return e/(t+1)},sample:function(e,n){return n/t.randg(e)},variance:function(t,e){if(!(t<=2))return e*e/((t-1)*(t-1)*(t-2))}}),t.extend(t.kumaraswamy,{pdf:function(t,n,i){return 0===t&&1===n?i:1===t&&1===i?n:e.exp(e.log(n)+e.log(i)+(n-1)*e.log(t)+(i-1)*e.log(1-e.pow(t,n)))},cdf:function(t,n,i){return t<0?0:t>1?1:1-e.pow(1-e.pow(t,n),i)},inv:function(t,n,i){return e.pow(1-e.pow(1-t,1/i),1/n)},mean:function(e,n){return n*t.gammafn(1+1/e)*t.gammafn(n)/t.gammafn(1+1/e+n)},median:function(t,n){return e.pow(1-e.pow(2,-1/n),1/t)},mode:function(t,n){if(t>=1&&n>=1&&1!==t&&1!==n)return e.pow((t-1)/(t*n-1),1/t)},variance:function(){throw new Error("variance not yet implemented")}}),t.extend(t.lognormal,{pdf:function(t,n,i){return t<=0?0:e.exp(-e.log(t)-.5*e.log(2*e.PI)-e.log(i)-e.pow(e.log(t)-n,2)/(2*i*i))},cdf:function(n,i,r){return n<0?0:.5+.5*t.erf((e.log(n)-i)/e.sqrt(2*r*r))},inv:function(n,i,r){return e.exp(-1.4142135623730951*r*t.erfcinv(2*n)+i)},mean:function(t,n){return e.exp(t+n*n/2)},median:function(t){return e.exp(t)},mode:function(t,n){return e.exp(t-n*n)},sample:function(n,i){return e.exp(t.randn()*i+n)},variance:function(t,n){return(e.exp(n*n)-1)*e.exp(2*t+n*n)}}),t.extend(t.noncentralt,{pdf:function(n,i,r){return e.abs(r)<1e-14?t.studentt.pdf(n,i):e.abs(n)<1e-14?e.exp(t.gammaln((i+1)/2)-r*r/2-.5*e.log(e.PI*i)-t.gammaln(i/2)):i/n*(t.noncentralt.cdf(n*e.sqrt(1+2/i),i+2,r)-t.noncentralt.cdf(n,i,r))},cdf:function(n,i,r){var o=1e-14;if(e.abs(r)<o)return t.studentt.cdf(n,i);var s=!1;n<0&&(s=!0,r=-r);for(var a=t.normal.cdf(-r,0,1),l=o+1,u=l,c=n*n/(n*n+i),h=0,d=e.exp(-r*r/2),f=e.exp(-r*r/2-.5*e.log(2)-t.gammaln(1.5))*r;h<200||u>o||l>o;)u=l,h>0&&(d*=r*r/(2*h),f*=r*r/(2*(h+.5))),a+=.5*(l=d*t.beta.cdf(c,h+.5,i/2)+f*t.beta.cdf(c,h+1,i/2)),h++;return s?1-a:a}}),t.extend(t.normal,{pdf:function(t,n,i){return e.exp(-.5*e.log(2*e.PI)-e.log(i)-e.pow(t-n,2)/(2*i*i))},cdf:function(n,i,r){return.5*(1+t.erf((n-i)/e.sqrt(2*r*r)))},inv:function(e,n,i){return-1.4142135623730951*i*t.erfcinv(2*e)+n},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},sample:function(e,n){return t.randn()*n+e},variance:function(t,e){return e*e}}),t.extend(t.pareto,{pdf:function(t,n,i){return t<n?0:i*e.pow(n,i)/e.pow(t,i+1)},cdf:function(t,n,i){return t<n?0:1-e.pow(n/t,i)},inv:function(t,n,i){return n/e.pow(1-t,1/i)},mean:function(t,n){if(!(n<=1))return n*e.pow(t,n)/(n-1)},median:function(t,n){return t*(n*e.SQRT2)},mode:function(t){return t},variance:function(t,n){if(!(n<=2))return t*t*n/(e.pow(n-1,2)*(n-2))}}),t.extend(t.studentt,{pdf:function(n,i){return i=i>1e100?1e100:i,1/(e.sqrt(i)*t.betafn(.5,i/2))*e.pow(1+n*n/i,-(i+1)/2)},cdf:function(n,i){var r=i/2;return t.ibeta((n+e.sqrt(n*n+i))/(2*e.sqrt(n*n+i)),r,r)},inv:function(n,i){var r=t.ibetainv(2*e.min(n,1-n),.5*i,.5);return r=e.sqrt(i*(1-r)/r),n>.5?r:-r},mean:function(t){return t>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(n){return t.randn()*e.sqrt(n/(2*t.randg(n/2)))},variance:function(t){return t>2?t/(t-2):t>1?1/0:void 0}}),t.extend(t.weibull,{pdf:function(t,n,i){return t<0||n<0||i<0?0:i/n*e.pow(t/n,i-1)*e.exp(-e.pow(t/n,i))},cdf:function(t,n,i){return t<0?0:1-e.exp(-e.pow(t/n,i))},inv:function(t,n,i){return n*e.pow(-e.log(1-t),1/i)},mean:function(e,n){return e*t.gammafn(1+1/n)},median:function(t,n){return t*e.pow(e.log(2),1/n)},mode:function(t,n){return n<=1?0:t*e.pow((n-1)/n,1/n)},sample:function(n,i){return n*e.pow(-e.log(t._random_fn()),1/i)},variance:function(n,i){return n*n*t.gammafn(1+2/i)-e.pow(t.weibull.mean(n,i),2)}}),t.extend(t.uniform,{pdf:function(t,e,n){return t<e||t>n?0:1/(n-e)},cdf:function(t,e,n){return t<e?0:t<n?(t-e)/(n-e):1},inv:function(t,e,n){return e+t*(n-e)},mean:function(t,e){return.5*(t+e)},median:function(e,n){return t.mean(e,n)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,n){return e/2+n/2+(n/2-e/2)*(2*t._random_fn()-1)},variance:function(t,n){return e.pow(n-t,2)/12}}),t.extend(t.binomial,{pdf:function(n,i,r){return 0===r||1===r?i*r===n?1:0:t.combination(i,n)*e.pow(r,n)*e.pow(1-r,i-n)},cdf:function(i,r,o){var s,a=1e-10;if(i<0)return 0;if(i>=r)return 1;if(o<0||o>1||r<=0)return NaN;var l=o,u=(i=e.floor(i))+1,c=r-i,h=u+c,d=e.exp(t.gammaln(h)-t.gammaln(c)-t.gammaln(u)+u*e.log(l)+c*e.log(1-l));return s=l<(u+1)/(h+2)?d*n(l,u,c,a):1-d*n(1-l,c,u,a),e.round(1/a*(1-s))/(1/a)}}),t.extend(t.negbin,{pdf:function(n,i,r){return n===n>>>0&&(n<0?0:t.combination(n+i-1,i-1)*e.pow(1-r,n)*e.pow(r,i))},cdf:function(e,n,i){var r=0,o=0;if(e<0)return 0;for(;o<=e;o++)r+=t.negbin.pdf(o,n,i);return r}}),t.extend(t.hypgeom,{pdf:function(n,i,r,o){if(n!=n|0)return!1;if(n<0||n<r-(i-o))return 0;if(n>o||n>r)return 0;if(2*r>i)return 2*o>i?t.hypgeom.pdf(i-r-o+n,i,i-r,i-o):t.hypgeom.pdf(o-n,i,i-r,o);if(2*o>i)return t.hypgeom.pdf(r-n,i,r,i-o);if(r<o)return t.hypgeom.pdf(n,i,o,r);for(var s=1,a=0,l=0;l<n;l++){for(;s>1&&a<o;)s*=1-r/(i-a),a++;s*=(o-l)*(r-l)/((l+1)*(i-r-o+l+1))}for(;a<o;a++)s*=1-r/(i-a);return e.min(1,e.max(0,s))},cdf:function(n,i,r,o){if(n<0||n<r-(i-o))return 0;if(n>=o||n>=r)return 1;if(2*r>i)return 2*o>i?t.hypgeom.cdf(i-r-o+n,i,i-r,i-o):1-t.hypgeom.cdf(o-n-1,i,i-r,o);if(2*o>i)return 1-t.hypgeom.cdf(r-n-1,i,r,i-o);if(r<o)return t.hypgeom.cdf(n,i,o,r);for(var s=1,a=1,l=0,u=0;u<n;u++){for(;s>1&&l<o;){var c=1-r/(i-l);a*=c,s*=c,l++}s+=a*=(o-u)*(r-u)/((u+1)*(i-r-o+u+1))}for(;l<o;l++)s*=1-r/(i-l);return e.min(1,e.max(0,s))}}),t.extend(t.poisson,{pdf:function(n,i){return i<0||n%1!=0||n<0?0:e.pow(i,n)*e.exp(-i)/t.factorial(n)},cdf:function(e,n){var i=[],r=0;if(e<0)return 0;for(;r<=e;r++)i.push(t.poisson.pdf(r,n));return t.sum(i)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(n){var i=1,r=0,o=e.exp(-n);do{r++,i*=t._random_fn()}while(i>o);return r-1},sampleLarge:function(n){var i,r,o,s,a,l,u,c,h,d,f=n;for(s=e.sqrt(f),a=e.log(f),l=.02483*(u=.931+2.53*s)-.059,c=1.1239+1.1328/(u-3.4),h=.9277-3.6224/(u-2);;){if(r=e.random()-.5,o=e.random(),d=.5-e.abs(r),i=e.floor((2*l/d+u)*r+f+.43),d>=.07&&o<=h)return i;if(!(i<0||d<.013&&o>d)&&e.log(o)+e.log(c)-e.log(l/(d*d)+u)<=i*a-f-t.loggam(i+1))return i}},sample:function(t){return t<10?this.sampleSmall(t):this.sampleLarge(t)}}),t.extend(t.triangular,{pdf:function(t,e,n,i){return n<=e||i<e||i>n?NaN:t<e||t>n?0:t<i?2*(t-e)/((n-e)*(i-e)):t===i?2/(n-e):2*(n-t)/((n-e)*(n-i))},cdf:function(t,n,i,r){return i<=n||r<n||r>i?NaN:t<=n?0:t>=i?1:t<=r?e.pow(t-n,2)/((i-n)*(r-n)):1-e.pow(i-t,2)/((i-n)*(i-r))},inv:function(t,n,i,r){return i<=n||r<n||r>i?NaN:t<=(r-n)/(i-n)?n+(i-n)*e.sqrt(t*((r-n)/(i-n))):n+(i-n)*(1-e.sqrt((1-t)*(1-(r-n)/(i-n))))},mean:function(t,e,n){return(t+e+n)/3},median:function(t,n,i){return i<=(t+n)/2?n-e.sqrt((n-t)*(n-i))/e.sqrt(2):i>(t+n)/2?t+e.sqrt((n-t)*(i-t))/e.sqrt(2):void 0},mode:function(t,e,n){return n},sample:function(n,i,r){var o=t._random_fn();return o<(r-n)/(i-n)?n+e.sqrt(o*(i-n)*(r-n)):i-e.sqrt((1-o)*(i-n)*(i-r))},variance:function(t,e,n){return(t*t+e*e+n*n-t*e-t*n-e*n)/18}}),t.extend(t.arcsine,{pdf:function(t,n,i){return i<=n?NaN:t<=n||t>=i?0:2/e.PI*e.pow(e.pow(i-n,2)-e.pow(2*t-n-i,2),-.5)},cdf:function(t,n,i){return t<n?0:t<i?2/e.PI*e.asin(e.sqrt((t-n)/(i-n))):1},inv:function(t,n,i){return n+(.5-.5*e.cos(e.PI*t))*(i-n)},mean:function(t,e){return e<=t?NaN:(t+e)/2},median:function(t,e){return e<=t?NaN:(t+e)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(n,i){return(n+i)/2+(i-n)/2*e.sin(2*e.PI*t.uniform.sample(0,1))},variance:function(t,n){return n<=t?NaN:e.pow(n-t,2)/8}}),t.extend(t.laplace,{pdf:function(t,n,i){return i<=0?0:e.exp(-e.abs(t-n)/i)/(2*i)},cdf:function(t,n,i){return i<=0?0:t<n?.5*e.exp((t-n)/i):1-.5*e.exp(-(t-n)/i)},mean:function(t){return t},median:function(t){return t},mode:function(t){return t},variance:function(t,e){return 2*e*e},sample:function(n,i){var r,o=t._random_fn()-.5;return n-i*((r=o)/e.abs(r))*e.log(1-2*e.abs(o))}}),t.extend(t.tukey,{cdf:function(n,r,o){var s=r,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],l=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(o<2||s<2)return NaN;if(!Number.isFinite(n))return 1;if(o>25e3)return i(n,1,s);var u,c=.5*o,h=c*e.log(o)-o*e.log(2)-t.gammaln(c),d=c-1,f=.25*o;u=o<=100?1:o<=800?.5:o<=5e3?.25:.125,h+=e.log(u);for(var p=0,m=1;m<=50;m++){for(var g=0,v=(2*m-1)*u,y=1;y<=16;y++){var C,w;8<y?(C=y-8-1,w=h+d*e.log(v+a[C]*u)-(a[C]*u+v)*f):(C=y-1,w=h+d*e.log(v-a[C]*u)+(a[C]*u-v)*f),w>=-30&&(g+=i(8<y?n*e.sqrt(.5*(a[C]*u+v)):n*e.sqrt(.5*(-a[C]*u+v)),1,s)*l[C]*e.exp(w))}if(m*u>=1&&g<=1e-14)break;p+=g}if(g>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(n,i,r){if(r<2||i<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var o,s=function(t,n,i){var r=.5-.5*t,o=e.sqrt(e.log(1/(r*r))),s=o+((((-453642210148e-16*o-.204231210125)*o-.342242088547)*o-1)*o+.322232421088)/((((.0038560700634*o+.10353775285)*o+.531103462366)*o+.588581570495)*o+.099348462606);i<120&&(s+=(s*s*s+s)/i/4);var a=.8832-.2368*s;return i<120&&(a+=-1.214/i+1.208*s/i),s*(a*e.log(n-1)+1.4142)}(n,i,r),a=t.tukey.cdf(s,i,r)-n;o=a>0?e.max(0,s-1):s+1;for(var l,u=t.tukey.cdf(o,i,r)-n,c=1;c<50;c++)if(l=o-u*(o-s)/(u-a),a=u,s=o,l<0&&(l=0,u=-n),u=t.tukey.cdf(l,i,r)-n,o=l,e.abs(o-s)<1e-4)return l;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,i,r=Array.prototype.push,o=t.utils.isArray;function s(e){return o(e)||e instanceof t}t.extend({add:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t+n[e][i]}))):t.map(e,(function(t){return t+n}))},subtract:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.map(e,(function(t,e,i){return t-n[e][i]||0}))):t.map(e,(function(t){return t-n}))},divide:function(e,n){return s(n)?(s(n[0])||(n=[n]),t.multiply(e,t.inv(n))):t.map(e,(function(t){return t/n}))},multiply:function(e,n){var i,r,o,a,l,u,c,h;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,u=e[0].length,c=t.zeros(l,o=s(n)?n[0].length:u),h=0,s(n)){for(;h<o;h++)for(i=0;i<l;i++){for(a=0,r=0;r<u;r++)a+=e[i][r]*n[r][h];c[i][h]=a}return 1===l&&1===h?c[0][0]:c}return t.map(e,(function(t){return t*n}))},outer:function(e,n){return t.multiply(e.map((function(t){return[t]})),[n])},dot:function(e,n){s(e[0])||(e=[e]),s(n[0])||(n=[n]);for(var i,r,o=1===e[0].length&&1!==e.length?t.transpose(e):e,a=1===n[0].length&&1!==n.length?t.transpose(n):n,l=[],u=0,c=o.length,h=o[0].length;u<c;u++){for(l[u]=[],i=0,r=0;r<h;r++)i+=o[u][r]*a[u][r];l[u]=i}return 1===l.length?l[0]:l},pow:function(n,i){return t.map(n,(function(t){return e.pow(t,i)}))},exp:function(n){return t.map(n,(function(t){return e.exp(t)}))},log:function(n){return t.map(n,(function(t){return e.log(t)}))},abs:function(n){return t.map(n,(function(t){return e.abs(t)}))},norm:function(t,n){var i=0,r=0;for(isNaN(n)&&(n=2),s(t[0])&&(t=t[0]);r<t.length;r++)i+=e.pow(e.abs(t[r]),n);return e.pow(i,1/n)},angle:function(n,i){return e.acos(t.dot(n,i)/(t.norm(n)*t.norm(i)))},aug:function(t,e){var n,i=[];for(n=0;n<t.length;n++)i.push(t[n].slice());for(n=0;n<i.length;n++)r.apply(i[n],e[n]);return i},inv:function(e){for(var n,i=e.length,r=e[0].length,o=t.identity(i,r),s=t.gauss_jordan(e,o),a=[],l=0;l<i;l++)for(a[l]=[],n=r;n<s[0].length;n++)a[l][n-r]=s[l][n];return a},det:function t(e){if(2===e.length)return e[0][0]*e[1][1]-e[0][1]*e[1][0];for(var n=0,i=0;i<e.length;i++){for(var r=[],o=1;o<e.length;o++){r[o-1]=[];for(var s=0;s<e.length;s++)s<i?r[o-1][s]=e[o][s]:s>i&&(r[o-1][s-1]=e[o][s])}var a=i%2?-1:1;n+=t(r)*e[0][i]*a}return n},gauss_elimination:function(n,i){var r,o,s,a,l=0,u=0,c=n.length,h=n[0].length,d=1,f=0,p=[];for(r=(n=t.aug(n,i))[0].length,l=0;l<c;l++){for(o=n[l][l],u=l,a=l+1;a<h;a++)o<e.abs(n[a][l])&&(o=n[a][l],u=a);if(u!=l)for(a=0;a<r;a++)s=n[l][a],n[l][a]=n[u][a],n[u][a]=s;for(u=l+1;u<c;u++)for(d=n[u][l]/n[l][l],a=l;a<r;a++)n[u][a]=n[u][a]-d*n[l][a]}for(l=c-1;l>=0;l--){for(f=0,u=l+1;u<=c-1;u++)f+=p[u]*n[l][u];p[l]=(n[l][r-1]-f)/n[l][l]}return p},gauss_jordan:function(n,i){var r,o,s,a=t.aug(n,i),l=a.length,u=a[0].length,c=0;for(o=0;o<l;o++){var h=o;for(s=o+1;s<l;s++)e.abs(a[s][o])>e.abs(a[h][o])&&(h=s);var d=a[o];for(a[o]=a[h],a[h]=d,s=o+1;s<l;s++)for(c=a[s][o]/a[o][o],r=o;r<u;r++)a[s][r]-=a[o][r]*c}for(o=l-1;o>=0;o--){for(c=a[o][o],s=0;s<o;s++)for(r=u-1;r>o-1;r--)a[s][r]-=a[o][r]*a[s][o]/c;for(a[o][o]/=c,r=l;r<u;r++)a[o][r]/=c}return a},triaUpSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r-1,-1,-1).forEach((function(s){i=t.arange(s+1,r).map((function(t){return o[t]*e[s][t]})),o[s]=(n[s]-t.sum(i))/e[s][s]})),s?o.map((function(t){return[t]})):o},triaLowSolve:function(e,n){var i,r=e[0].length,o=t.zeros(1,r)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(r).forEach((function(r){i=t.arange(r).map((function(t){return e[r][t]*o[t]})),o[r]=(n[r]-t.sum(i))/e[r][r]})),s?o.map((function(t){return[t]})):o},lu:function(e){var n,i=e.length,r=t.identity(i),o=t.zeros(e.length,e[0].length);return t.arange(i).forEach((function(t){o[0][t]=e[0][t]})),t.arange(1,i).forEach((function(s){t.arange(s).forEach((function(i){n=t.arange(i).map((function(t){return r[s][t]*o[t][i]})),r[s][i]=(e[s][i]-t.sum(n))/o[i][i]})),t.arange(s,i).forEach((function(i){n=t.arange(s).map((function(t){return r[s][t]*o[t][i]})),o[s][i]=e[n.length][i]-t.sum(n)}))})),[r,o]},cholesky:function(n){var i,r=n.length,o=t.zeros(n.length,n[0].length);return t.arange(r).forEach((function(s){i=t.arange(s).map((function(t){return e.pow(o[s][t],2)})),o[s][s]=e.sqrt(n[s][s]-t.sum(i)),t.arange(s+1,r).forEach((function(e){i=t.arange(s).map((function(t){return o[s][t]*o[e][t]})),o[e][s]=(n[s][e]-t.sum(i))/o[s][s]}))})),o},gauss_jacobi:function(n,i,r,o){for(var s,a,l,u,c=0,h=0,d=n.length,f=[],p=[],m=[];c<d;c++)for(f[c]=[],p[c]=[],m[c]=[],h=0;h<d;h++)c>h?(f[c][h]=n[c][h],p[c][h]=m[c][h]=0):c<h?(p[c][h]=n[c][h],f[c][h]=m[c][h]=0):(m[c][h]=n[c][h],f[c][h]=p[c][h]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(f,p)),-1),a=t.multiply(t.inv(m),i),s=r,u=t.add(t.multiply(l,r),a),c=2;e.abs(t.norm(t.subtract(u,s)))>o;)s=u,u=t.add(t.multiply(l,s),a),c++;return u},gauss_seidel:function(n,i,r,o){for(var s,a,l,u,c,h=0,d=n.length,f=[],p=[],m=[];h<d;h++)for(f[h]=[],p[h]=[],m[h]=[],s=0;s<d;s++)h>s?(f[h][s]=n[h][s],p[h][s]=m[h][s]=0):h<s?(p[h][s]=n[h][s],f[h][s]=m[h][s]=0):(m[h][s]=n[h][s],f[h][s]=p[h][s]=0);for(u=t.multiply(t.multiply(t.inv(t.add(m,f)),p),-1),l=t.multiply(t.inv(t.add(m,f)),i),a=r,c=t.add(t.multiply(u,r),l),h=2;e.abs(t.norm(t.subtract(c,a)))>o;)a=c,c=t.add(t.multiply(u,a),l),h+=1;return c},SOR:function(n,i,r,o,s){for(var a,l,u,c,h,d=0,f=n.length,p=[],m=[],g=[];d<f;d++)for(p[d]=[],m[d]=[],g[d]=[],a=0;a<f;a++)d>a?(p[d][a]=n[d][a],m[d][a]=g[d][a]=0):d<a?(m[d][a]=n[d][a],p[d][a]=g[d][a]=0):(g[d][a]=n[d][a],p[d][a]=m[d][a]=0);for(c=t.multiply(t.inv(t.add(g,t.multiply(p,s))),t.subtract(t.multiply(g,1-s),t.multiply(m,s))),u=t.multiply(t.multiply(t.inv(t.add(g,t.multiply(p,s))),i),s),l=r,h=t.add(t.multiply(c,r),u),d=2;e.abs(t.norm(t.subtract(h,l)))>o;)l=h,h=t.add(t.multiply(c,l),u),d++;return h},householder:function(n){for(var i,r,o,s,a=n.length,l=n[0].length,u=0,c=[],h=[];u<a-1;u++){for(i=0,s=u+1;s<l;s++)i+=n[s][u]*n[s][u];for(i=(n[u+1][u]>0?-1:1)*e.sqrt(i),r=e.sqrt((i*i-n[u+1][u]*i)/2),(c=t.zeros(a,1))[u+1][0]=(n[u+1][u]-i)/(2*r),o=u+2;o<a;o++)c[o][0]=n[o][u]/(2*r);h=t.subtract(t.identity(a,l),t.multiply(t.multiply(c,t.transpose(c)),2)),n=t.multiply(h,t.multiply(n,h))}return n},QR:(n=t.sum,i=t.arange,function(r){var o,s,a,l=r.length,u=r[0].length,c=t.zeros(u,u);for(r=t.copy(r),s=0;s<u;s++){for(c[s][s]=e.sqrt(n(i(l).map((function(t){return r[t][s]*r[t][s]})))),o=0;o<l;o++)r[o][s]=r[o][s]/c[s][s];for(a=s+1;a<u;a++)for(c[s][a]=n(i(l).map((function(t){return r[t][s]*r[t][a]}))),o=0;o<l;o++)r[o][a]=r[o][a]-r[o][s]*c[s][a]}return[r,c]}),lstsq:function(e,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var r=t.QR(e),o=r[0],s=r[1],a=e[0].length,l=t.slice(o,{col:{end:a}}),u=function(e){var n=(e=t.copy(e)).length,i=t.identity(n);return t.arange(n-1,-1,-1).forEach((function(n){t.sliceAssign(i,{row:n},t.divide(t.slice(i,{row:n}),e[n][n])),t.sliceAssign(e,{row:n},t.divide(t.slice(e,{row:n}),e[n][n])),t.arange(n).forEach((function(r){var o=t.multiply(e[r][n],-1),s=t.slice(e,{row:r}),a=t.multiply(t.slice(e,{row:n}),o);t.sliceAssign(e,{row:r},t.add(s,a));var l=t.slice(i,{row:r}),u=t.multiply(t.slice(i,{row:n}),o);t.sliceAssign(i,{row:r},t.add(l,u))}))})),i}(t.slice(s,{row:{end:a}})),c=t.transpose(l);void 0===c[0].length&&(c=[c]);var h=t.multiply(t.multiply(u,c),n);return void 0===h.length&&(h=[[h]]),i?h.map((function(t){return t[0]})):h},jacobi:function(n){for(var i,r,o,s,a,l,u,c=1,h=n.length,d=t.identity(h,h),f=[];1===c;){for(a=n[0][1],o=0,s=1,i=0;i<h;i++)for(r=0;r<h;r++)i!=r&&a<e.abs(n[i][r])&&(a=e.abs(n[i][r]),o=i,s=r);for(l=n[o][o]===n[s][s]?n[o][s]>0?e.PI/4:-e.PI/4:e.atan(2*n[o][s]/(n[o][o]-n[s][s]))/2,(u=t.identity(h,h))[o][o]=e.cos(l),u[o][s]=-e.sin(l),u[s][o]=e.sin(l),u[s][s]=e.cos(l),d=t.multiply(d,u),n=t.multiply(t.multiply(t.inv(u),n),u),c=0,i=1;i<h;i++)for(r=1;r<h;r++)i!=r&&e.abs(n[i][r])>.001&&(c=1)}for(i=0;i<h;i++)f.push(n[i][i]);return[d,f]},rungekutta:function(t,e,n,i,r,o){var s,a,l;if(2===o)for(;i<=n;)r+=((s=e*t(i,r))+(a=e*t(i+e,r+s)))/2,i+=e;if(4===o)for(;i<=n;)r+=((s=e*t(i,r))+2*(a=e*t(i+e/2,r+s/2))+2*(l=e*t(i+e/2,r+a/2))+e*t(i+e,r+l))/6,i+=e;return r},romberg:function(t,n,i,r){for(var o,s,a,l,u,c=0,h=(i-n)/2,d=[],f=[],p=[];c<r/2;){for(u=t(n),a=n,l=0;a<=i;a+=h,l++)d[l]=a;for(o=d.length,a=1;a<o-1;a++)u+=(a%2!=0?4:2)*t(d[a]);u=h/3*(u+t(i)),p[c]=u,h/=2,c++}for(s=p.length,o=1;1!==s;){for(a=0;a<s-1;a++)f[a]=(e.pow(4,o)*p[a+1]-p[a])/(e.pow(4,o)-1);s=f.length,p=f,f=[],o++}return p},richardson:function(t,n,i,r){function o(t,e){for(var n,i=0,r=t.length;i<r;i++)t[i]===e&&(n=i);return n}for(var s,a,l,u,c,h=e.abs(i-t[o(t,i)+1]),d=0,f=[],p=[];r>=h;)s=o(t,i+r),a=o(t,i),f[d]=(n[s]-2*n[a]+n[2*a-s])/(r*r),r/=2,d++;for(u=f.length,l=1;1!=u;){for(c=0;c<u-1;c++)p[c]=(e.pow(4,l)*f[c+1]-f[c])/(e.pow(4,l)-1);u=p.length,f=p,p=[],l++}return f},simpson:function(t,e,n,i){for(var r,o=(n-e)/i,s=t(e),a=[],l=e,u=0,c=1;l<=n;l+=o,u++)a[u]=l;for(r=a.length;c<r-1;c++)s+=(c%2!=0?4:2)*t(a[c]);return o/3*(s+t(n))},hermite:function(t,e,n,i){for(var r,o=t.length,s=0,a=0,l=[],u=[],c=[],h=[];a<o;a++){for(l[a]=1,r=0;r<o;r++)a!=r&&(l[a]*=(i-t[r])/(t[a]-t[r]));for(u[a]=0,r=0;r<o;r++)a!=r&&(u[a]+=1/(t[a]-t[r]));c[a]=(1-2*(i-t[a])*u[a])*(l[a]*l[a]),h[a]=(i-t[a])*(l[a]*l[a]),s+=c[a]*e[a]+h[a]*n[a]}return s},lagrange:function(t,e,n){for(var i,r,o=0,s=0,a=t.length;s<a;s++){for(r=e[s],i=0;i<a;i++)s!=i&&(r*=(n-t[i])/(t[s]-t[i]));o+=r}return o},cubic_spline:function(e,n,i){for(var r,o,s=e.length,a=0,l=[],u=[],c=[],h=[],d=[],f=[];a<s-1;a++)h[a]=e[a+1]-e[a];for(c[0]=0,a=1;a<s-1;a++)c[a]=3/h[a]*(n[a+1]-n[a])-3/h[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],u[a]=[],l[a][a-1]=h[a-1],l[a][a]=2*(h[a-1]+h[a]),l[a][a+1]=h[a],u[a][0]=c[a];for(o=t.multiply(t.inv(l),u),r=0;r<s-1;r++)d[r]=(n[r+1]-n[r])/h[r]-h[r]*(o[r+1][0]+2*o[r][0])/3,f[r]=(o[r+1][0]-o[r][0])/(3*h[r]);for(r=0;r<s&&!(e[r]>i);r++);return n[r-=1]+(i-e[r])*d[r]+t.sq(i-e[r])*o[r]+(i-e[r])*t.sq(i-e[r])*f[r]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,i,r,o,s,a=e.length,l=e[0].length,u=0,c=[],h=[],d=[],f=[],p=[],m=[],g=[];for(u=0;u<a;u++)c[u]=t.sum(e[u])/l;for(u=0;u<l;u++)for(p[u]=[],n=0;n<a;n++)p[u][n]=e[n][u]-c[n];for(p=t.transpose(p),u=0;u<a;u++)for(m[u]=[],n=0;n<a;n++)m[u][n]=t.dot([p[u]],[p[n]])/(l-1);for(s=(r=t.jacobi(m))[0],h=r[1],g=t.transpose(s),u=0;u<h.length;u++)for(n=u;n<h.length;n++)h[u]<h[n]&&(i=h[u],h[u]=h[n],h[n]=i,d=g[u],g[u]=g[n],g[n]=d);for(o=t.transpose(p),u=0;u<a;u++)for(f[u]=[],n=0;n<o.length;n++)f[u][n]=t.dot([g[u]],[o[n]]);return[e,h,g,f]}}),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(n,i){var r=this;return i?(setTimeout((function(){i.call(r,t.fn[e].call(r,n))}),15),this):"number"==typeof t[e](this,n)?t[e](this,n):t(t[e](this,n))}}(e[n])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(e,Math),function(t,e){var n=[].slice,i=t.utils.isNumber,r=t.utils.isArray;function o(t,n,i,r){if(t>1||i>1||t<=0||i<=0)throw new Error("Proportions should be greater than 0 and less than 1");var o=(t*n+i*r)/(n+r);return(t-i)/e.sqrt(o*(1-o)*(1/n+1/r))}t.extend({zscore:function(){var e=n.call(arguments);return i(e[1])?(e[0]-e[1])/e[2]:(e[0]-t.mean(e[1]))/t.stdev(e[1],e[2])},ztest:function(){var i,o=n.call(arguments);return r(o[1])?(i=t.zscore(o[0],o[1],o[3]),1===o[2]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):o.length>2?(i=t.zscore(o[0],o[1],o[2]),1===o[3]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):(i=o[0],1===o[1]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1))}}),t.extend(t.fn,{zscore:function(t,e){return(t-this.mean())/this.stdev(e)},ztest:function(n,i,r){var o=e.abs(this.zscore(n,r));return 1===i?t.normal.cdf(-o,0,1):2*t.normal.cdf(-o,0,1)}}),t.extend({tscore:function(){var i=n.call(arguments);return 4===i.length?(i[0]-i[1])/(i[2]/e.sqrt(i[3])):(i[0]-t.mean(i[1]))/(t.stdev(i[1],!0)/e.sqrt(i[1].length))},ttest:function(){var r,o=n.call(arguments);return 5===o.length?(r=e.abs(t.tscore(o[0],o[1],o[2],o[3])),1===o[4]?t.studentt.cdf(-r,o[3]-1):2*t.studentt.cdf(-r,o[3]-1)):i(o[1])?(r=e.abs(o[0]),1==o[2]?t.studentt.cdf(-r,o[1]-1):2*t.studentt.cdf(-r,o[1]-1)):(r=e.abs(t.tscore(o[0],o[1])),1==o[2]?t.studentt.cdf(-r,o[1].length-1):2*t.studentt.cdf(-r,o[1].length-1))}}),t.extend(t.fn,{tscore:function(t){return(t-this.mean())/(this.stdev(!0)/e.sqrt(this.cols()))},ttest:function(n,i){return 1===i?1-t.studentt.cdf(e.abs(this.tscore(n)),this.cols()-1):2*t.studentt.cdf(-e.abs(this.tscore(n)),this.cols()-1)}}),t.extend({anovafscore:function(){var i,r,o,s,a,l,u,c,h=n.call(arguments);if(1===h.length){for(a=new Array(h[0].length),u=0;u<h[0].length;u++)a[u]=h[0][u];h=a}for(r=new Array,u=0;u<h.length;u++)r=r.concat(h[u]);for(o=t.mean(r),i=0,u=0;u<h.length;u++)i+=h[u].length*e.pow(t.mean(h[u])-o,2);for(i/=h.length-1,l=0,u=0;u<h.length;u++)for(s=t.mean(h[u]),c=0;c<h[u].length;c++)l+=e.pow(h[u][c]-s,2);return i/(l/(r.length-h.length))},anovaftest:function(){var e,r,o,s,a=n.call(arguments);if(i(a[0]))return 1-t.centralF.cdf(a[0],a[1],a[2]);var l=t.anovafscore(a);for(e=a.length-1,o=0,s=0;s<a.length;s++)o+=a[s].length;return r=o-e-1,1-t.centralF.cdf(l,e,r)},ftest:function(e,n,i){return 1-t.centralF.cdf(e,n,i)}}),t.extend(t.fn,{anovafscore:function(){return t.anovafscore(this.toArray())},anovaftes:function(){var e,n=0;for(e=0;e<this.length;e++)n+=this[e].length;return t.ftest(this.anovafscore(),this.length-1,n-this.length)}}),t.extend({qscore:function(){var r,o,s,a,l,u=n.call(arguments);return i(u[0])?(r=u[0],o=u[1],s=u[2],a=u[3],l=u[4]):(r=t.mean(u[0]),o=t.mean(u[1]),s=u[0].length,a=u[1].length,l=u[2]),e.abs(r-o)/(l*e.sqrt((1/s+1/a)/2))},qtest:function(){var e,i=n.call(arguments);3===i.length?(e=i[0],i=i.slice(1)):7===i.length?(e=t.qscore(i[0],i[1],i[2],i[3],i[4]),i=i.slice(5)):(e=t.qscore(i[0],i[1],i[2]),i=i.slice(3));var r=i[0],o=i[1];return 1-t.tukey.cdf(e,o,r-o)},tukeyhsd:function(e){for(var n=t.pooledstdev(e),i=e.map((function(e){return t.mean(e)})),r=e.reduce((function(t,e){return t+e.length}),0),o=[],s=0;s<e.length;++s)for(var a=s+1;a<e.length;++a){var l=t.qtest(i[s],i[a],e[s].length,e[a].length,n,r,e.length);o.push([[s,a],l])}return o}}),t.extend({normalci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.normal.inv(r[1]/2,0,1)*r[2]/e.sqrt(r[3])):e.abs(t.normal.inv(r[1]/2,0,1)*t.stdev(r[2])/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},tci:function(){var i,r=n.call(arguments),o=new Array(2);return i=4===r.length?e.abs(t.studentt.inv(r[1]/2,r[3]-1)*r[2]/e.sqrt(r[3])):e.abs(t.studentt.inv(r[1]/2,r[2].length-1)*t.stdev(r[2],!0)/e.sqrt(r[2].length)),o[0]=r[0]-i,o[1]=r[0]+i,o},significant:function(t,e){return t<e}}),t.extend(t.fn,{normalci:function(e,n){return t.normalci(e,n,this.toArray())},tci:function(e,n){return t.tci(e,n,this.toArray())}}),t.extend(t.fn,{oneSidedDifferenceOfProportions:function(e,n,i,r){var s=o(e,n,i,r);return t.ztest(s,1)},twoSidedDifferenceOfProportions:function(e,n,i,r){var s=o(e,n,i,r);return t.ztest(s,2)}})}(e,Math),e.models=function(){function t(t,n){var i=t.length,r=n[0].length-1,o=i-r-1,s=e.lstsq(n,t),a=e.multiply(n,s.map((function(t){return[t]}))).map((function(t){return t[0]})),l=e.subtract(t,a),u=e.mean(t),c=e.sum(a.map((function(t){return Math.pow(t-u,2)}))),h=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),d=c+h;return{exog:n,endog:t,nobs:i,df_model:r,df_resid:o,coef:s,predict:a,resid:l,ybar:u,SST:d,SSE:c,SSR:h,R2:c/d}}function n(n){var i,r,o=(i=n.exog,r=i[0].length,e.arange(r).map((function(n){var o=e.arange(r).filter((function(t){return t!==n}));return t(e.col(i,n).map((function(t){return t[0]})),e.col(i,o))}))),s=Math.sqrt(n.SSR/n.df_resid),a=o.map((function(t){var e=t.SST,n=t.R2;return s/Math.sqrt(e*(1-n))})),l=n.coef.map((function(t,e){return(t-0)/a[e]})),u=l.map((function(t){var i=e.studentt.cdf(t,n.df_resid);return 2*(i>.5?1-i:i)})),c=e.studentt.inv(.975,n.df_resid),h=n.coef.map((function(t,e){var n=c*a[e];return[t-n,t+n]}));return{se:a,t:l,p:u,sigmaHat:s,interval95:h}}return{ols:function(i,r){var o=t(i,r),s=n(o),a=function(t){var n,i,r,o=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:o,pvalue:1-(n=o,i=t.df_model,r=t.df_resid,e.beta.cdf(n/(r/i+n),i/2,r/2))}}(o),l=1-(1-o.R2)*((o.nobs-1)/o.df_resid);return o.t=s,o.f=a,o.adjust_R2=l,o}}}(),e.extend({buildxmatrix:function(){for(var t=new Array(arguments.length),n=0;n<arguments.length;n++)t[n]=[1].concat(arguments[n]);return e(t)},builddxmatrix:function(){for(var t=new Array(arguments[0].length),n=0;n<arguments[0].length;n++)t[n]=[1].concat(arguments[0][n]);return e(t)},buildjxmatrix:function(t){for(var n=new Array(t.length),i=0;i<t.length;i++)n[i]=t[i];return e.builddxmatrix(n)},buildymatrix:function(t){return e(t).transpose()},buildjymatrix:function(t){return t.transpose()},matrixmult:function(t,n){var i,r,o,s,a;if(t.cols()==n.rows()){if(n.rows()>1){for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[o][r];s[i][r]=a}return e(s)}for(s=[],i=0;i<t.rows();i++)for(s[i]=[],r=0;r<n.cols();r++){for(a=0,o=0;o<t.cols();o++)a+=t.toArray()[i][o]*n.toArray()[r];s[i][r]=a}return e(s)}},regress:function(t,n){var i=e.xtranspxinv(t),r=t.transpose(),o=e.matrixmult(e(i),r);return e.matrixmult(o,n)},regresst:function(t,n,i){var r=e.regress(t,n),o={anova:{}},s=e.jMatYBar(t,r);o.yBar=s;var a=n.mean();o.anova.residuals=e.residuals(n,s),o.anova.ssr=e.ssr(s,a),o.anova.msr=o.anova.ssr/(t[0].length-1),o.anova.sse=e.sse(n,s),o.anova.mse=o.anova.sse/(n.length-(t[0].length-1)-1),o.anova.sst=e.sst(n,a),o.anova.mst=o.anova.sst/(n.length-1),o.anova.r2=1-o.anova.sse/o.anova.sst,o.anova.r2<0&&(o.anova.r2=0),o.anova.fratio=o.anova.msr/o.anova.mse,o.anova.pvalue=e.anovaftest(o.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),o.anova.rmse=Math.sqrt(o.anova.mse),o.anova.r2adj=1-o.anova.mse/o.anova.mst,o.anova.r2adj<0&&(o.anova.r2adj=0),o.stats=new Array(t[0].length);for(var l,u,c,h=e.xtranspxinv(t),d=0;d<r.length;d++)l=Math.sqrt(o.anova.mse*Math.abs(h[d][d])),u=Math.abs(r[d]/l),c=e.ttest(u,n.length-t[0].length-1,i),o.stats[d]=[r[d],l,u,c];return o.regress=r,o},xtranspx:function(t){return e.matrixmult(t.transpose(),t)},xtranspxinv:function(t){var n=e.matrixmult(t.transpose(),t);return e.inv(n)},jMatYBar:function(t,n){var i=e.matrixmult(t,n);return new e(i)},residuals:function(t,n){return e.matrixsubtract(t,n)},ssr:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},sse:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e[i],2);return n},sst:function(t,e){for(var n=0,i=0;i<t.length;i++)n+=Math.pow(t[i]-e,2);return n},matrixsubtract:function(t,n){for(var i=new Array(t.length),r=0;r<t.length;r++){i[r]=new Array(t[r].length);for(var o=0;o<t[r].length;o++)i[r][o]=t[r][o]-n[r][o]}return e(i)}}),e.jStat=e,e)},4788:(t,e,n)=>{"use strict";var i=n(5072),r=n.n(i),o=n(7825),s=n.n(o),a=n(7659),l=n.n(a),u=n(5056),c=n.n(u),h=n(540),d=n.n(h),f=n(1113),p=n.n(f),m=n(365),g={};g.styleTagTransform=p(),g.setAttributes=c(),g.insert=l().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=d(),r()(m.A,g),m.A&&m.A.locals&&m.A.locals},5072:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var o={},s=[],a=0;a<t.length;a++){var l=t[a],u=i.base?l[0]+i.base:l[0],c=o[u]||0,h="".concat(u," ").concat(c);o[u]=c+1;var d=n(h),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(f);else{var p=r(f,i);i.byIndex=a,e.splice(a,0,{identifier:h,updater:p,references:1})}s.push(h)}return s}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var o=i(t=t||[],r=r||{});return function(t){t=t||[];for(var s=0;s<o.length;s++){var a=n(o[s]);e[a].references--}for(var l=i(t,r),u=0;u<o.length;u++){var c=n(o[u]);0===e[c].references&&(e[c].updater(),e.splice(c,1))}o=l}}},7659:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var o=n.sourceMap;o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},9484:(t,e,n)=>{"use strict";n.d(e,{i:()=>Y,q:()=>B});var i,r=n(7389),o=n(4328),s=n(6082),a=n(2003),l=n(9135),u=n(2738),c=n(3077),h=n(826);async function d(t,e,n,r){const o=(0,c.R)(e),a=h.GO.forColumn(e).getNewColumnFromList("ref",[n]),d=h.GO.forColumn(a).getSplitted(0),f=r===i.IDENTITY?function(t,e){const n=e.columns.length,i=new Array(n),r=new Array(n),o=new Array(n);for(let s=0;s<n;++s){const n=e.columns.byIndex(s);i[s]=n.getRawData(),r[s]=n.categories.indexOf("");const a=s<t.length?t.getOriginal(s):u._S;o[s]=n.categories.indexOf(a)}const a=s.Column.float("Identity",e.rowCount),l=a.getRawData();for(let n=0;n<e.rowCount;++n){l[n]=0;for(let e=0;e<t.length;++e)(i[e]?i[e][n]:0)===o[e]&&++l[n];l[n]/=t.length}return a}(d,o):r===i.SIMILARITY?await async function(t,e){const n=e.columns.toList();return await(0,l.uL)(n,t)}(d,o):null;if(null===f)throw new Error(`In bio library: Unknown sequence scoring method: ${r}`);return f.name=t.columns.getUnusedName(f.name),t.columns.add(f),f}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(i||(i={}));var f,p=n(8774),m=n(144),g=n.n(m),v=n(7233),y=n.n(v),C=n(4139),w=n(115),b=n(8608),A=n(3541),E=n(2935),S=n(7923),T=n(7654),x=n(5480),_=n(5429),N=n(3273),M=n(3657);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(f||(f={}));var O,L,I,R,P,k,D,G=n(912);n(5540),n(4329),(L=O||(O={})).EUCLIDEAN="EUCLIDEAN",L.MANHATTAN="MANHATTAN",O.EUCLIDEAN,O.MANHATTAN,(R=I||(I={})).HAMMING="Hamming",R.EUCLIDEAN="Euclidean",R.MANHATTAN="Manhattan",R.TANIMOTO="Tanimoto",R.LEVENSTEIN="Levenshtein",R.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",R.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",R.SOKAL="Sokal",R.COSINE="Cosine",R.ASYMMETRIC="Asymmetric",R.Difference="Difference",R.OneHot="One-Hot",I.HAMMING,I.EUCLIDEAN,I.MANHATTAN,I.TANIMOTO,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.MONOMER_CHEMICAL_DISTANCE,I.SOKAL,I.COSINE,I.ASYMMETRIC,I.Difference,I.OneHot,I.HAMMING,I.EUCLIDEAN,I.MANHATTAN,I.TANIMOTO,I.SOKAL,I.COSINE,I.ASYMMETRIC,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.MONOMER_CHEMICAL_DISTANCE,I.Difference,I.OneHot,new Set([I.HAMMING,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.MONOMER_CHEMICAL_DISTANCE,I.OneHot]),new Set([I.HAMMING,I.EUCLIDEAN,I.MANHATTAN,I.MONOMER_CHEMICAL_DISTANCE,I.LEVENSTEIN,I.NEEDLEMAN_WUNSCH,I.TANIMOTO,I.COSINE,I.SOKAL,I.ASYMMETRIC,I.OneHot,I.Difference]),new Set([I.EUCLIDEAN,I.MANHATTAN,I.OneHot,I.Difference]),new Set([I.EUCLIDEAN,I.MANHATTAN,I.Difference]),new Set([I.EUCLIDEAN,I.MANHATTAN,I.Difference]),new Set([I.TANIMOTO,I.COSINE,I.SOKAL,I.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(P||(P={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(k||(k={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(D||(D={})),Object.prototype.toString,Promise.resolve(),n(934),n(8903);var U,V,F=n(1858);!function(t){t.none="none",t.bold="bold",t.dashed="dashed"}(U||(U={}));class H{get currentLineId(){return this._currentLineIdx}set currentLineId(t){t!==this._currentLineIdx&&(this._currentLineIdx=t,this.sp.render(this.ctx))}set linesToRender(t){this.updateLines(t),this.sp.render(this.ctx)}set linesVisibility(t){this.visibility=t,this.sp.render(this.ctx)}constructor(t,e,n,i,r=U.none){var o;this._currentLineIdx=-1,this.lineClicked=new F.Subject,this.lineHover=new F.Subject,this.mouseOverLineId=-1,this.arrowWidth=15,this.sp=t,this.xAxisCol=this.sp.dataFrame.columns.byName(e),this.yAxisCol=this.sp.dataFrame.columns.byName(n),this.canvas=this.sp.getInfo().canvas,this.ctx=this.canvas.getContext("2d"),this.currentLineStyle=r,this.updateLines(i),this.visibility=null!==(o=i.visibility)&&void 0!==o?o:new p.A(this.lines.from.length),i.visibility||this.visibility.setAll(!0,!1),i.arrowSize&&(this.arrowWidth=i.arrowSize),this.canvas.onmousedown=t=>{var e;(null===(e=this.lines)||void 0===e?void 0:e.skipMouseOverDetection)&&(this.mouseOverLineId=this.checkCoordsOnLine(t.offsetX,t.offsetY)),-1!==this.mouseOverLineId&&this.lineClicked.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},this.canvas.onmousemove=t=>{var e;this.mouseOverLineId=(null===(e=this.lines)||void 0===e?void 0:e.skipMouseOverDetection)?-1:this.checkCoordsOnLine(t.offsetX,t.offsetY),-1!==this.mouseOverLineId&&this.lineHover.next({x:t.clientX,y:t.clientY,id:this.mouseOverLineId,event:t})},t.onEvent("d4-before-draw-scene").subscribe((t=>{this.renderLines()}))}updateLines(t){this.lines=t,this.multipleLinesCounts=new Uint8Array(this.lines.from.length),t.skipMultiLineCalculation?this.multipleLinesCounts.fill(0):this.createMultiLinesIndices()}renderLines(){var t,e,n,i,r,o,s,a,l,u,c,h,d,f,p,m,g;const v=this.sp.getOptions().look,y=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;y||(this.ctx.lineWidth=null!==(t=this.lines.width)&&void 0!==t?t:1,this.ctx.strokeStyle=`rgba(${null!==(e=this.lines.color)&&void 0!==e?e:"0,128,0"},${null!==(n=this.lines.opacity)&&void 0!==n?n:1})`);const C=v.sizeColumnName?this.sp.dataFrame.col(v.sizeColumnName):null,w=this.sp.dataFrame.filter,b=Math.pow(null!==(i=this.lines.shortLineThreshold)&&void 0!==i?i:5,2);for(let t=0;t<this.lines.from.length;t++)if(w.get(this.lines.from[t])&&w.get(this.lines.to[t])&&this.visibility.getBit(t)){let e=0;const{sizeFrom:n,sizeTo:i}=this.getMarkersSizes(v,C,t),w=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[t]),this.yAxisCol.get(this.lines.from[t]));let A=null==w?void 0:w.x,E=null==w?void 0:w.y;const S=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[t]),this.yAxisCol.get(this.lines.to[t]));let T=null==S?void 0:S.x,x=null==S?void 0:S.y;const _=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),A&&E&&T&&x&&Math.hypot(T-A,x-E)/_>.01){if(y){const e=(null===(r=this.lines.colors)||void 0===r?void 0:r[t])?null===(o=this.lines.colors)||void 0===o?void 0:o[t]:null!==(s=this.lines.color)&&void 0!==s?s:"0,128,0",n=(null===(a=this.lines.opacities)||void 0===a?void 0:a[t])?null===(l=this.lines.opacities)||void 0===l?void 0:l[t]:null!==(u=this.lines.opacity)&&void 0!==u?u:1;this.ctx.strokeStyle=`rgba(${e},${n})`,this.ctx.lineWidth=(null===(c=this.lines.widths)||void 0===c?void 0:c[t])?null===(h=this.lines.widths)||void 0===h?void 0:h[t]:null!==(d=this.lines.width)&&void 0!==d?d:1}t===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const v=this.multipleLinesCounts[t];let C=null;if(v){e=this.getLineLength(A,E,T,x);const r=this.getPointOnDistance(A,E,T,x,i,e),o=this.getPointOnDistance(T,x,A,E,n,e);A=r.x,E=r.y,T=o.x,x=o.y,C=this.lines.from[t]>this.lines.to[t]?this.findControlPoint(v,A,E,T,x,t):this.findControlPoint(v,T,x,A,E,t),this.ctx.moveTo(A,E),this.ctx.quadraticCurveTo(C.x,C.y,T,x)}else(!this.lines.skipShortLines||Math.pow(T-A,2)+Math.pow(x-E,2)>b)&&(this.ctx.moveTo(A,E),this.ctx.lineTo(T,x));if((null!==(f=this.lines.drawArrows)&&void 0!==f?f:null===(p=this.lines.drawArrowsArr)||void 0===p?void 0:p.getBit(t))&&(e||(e=this.getLineLength(A,E,T,x)),e>this.arrowWidth)){const t=v?null:this.getPointOnDistance(A,E,T,x,i,e),n=v?C.x:A,r=v?C.y:E;this.canvasArrow(this.ctx,null!==(m=null==t?void 0:t.x)&&void 0!==m?m:A,null!==(g=null==t?void 0:t.y)&&void 0!==g?g:E,n,r)}this.ctx.stroke(),this.ctx.closePath(),t===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(t){switch(this.currentLineStyle){case U.bold:t?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case U.dashed:t?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}getMarkersSizes(t,e,n){let i=3,r=3;return e?(i=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.from[n]))/2,r=(t.markerMinSize+(t.markerMaxSize-t.markerMinSize)*e.scale(this.lines.to[n]))/2):t.markerDefaultSize&&(i=t.markerDefaultSize/2,r=t.markerDefaultSize/2),{sizeFrom:i,sizeTo:r}}fillLeftBottomRect(){const t=new Path2D;t.rect(this.sp.yAxisBox.minX,this.sp.yAxisBox.maxY,this.sp.yAxisBox.width,this.sp.xAxisBox.height),this.ctx.fillStyle="white",this.ctx.beginPath(),this.ctx.fill(t),this.ctx.closePath()}createMultiLinesIndices(){const t={};for(let e=0;e<this.lines.from.length;e++){let n=0,i=0;this.lines.from[e]<this.lines.to[e]?(n=this.lines.from[e],i=this.lines.to[e]):(n=this.lines.to[e],i=this.lines.from[e]),t[`${n}|${i}`]?(1===t[`${n}|${i}`].length&&(this.multipleLinesCounts[t[`${n}|${i}`][0]]=1,t[`${n}|${i}`].push(1)),this.multipleLinesCounts[e]=++t[`${n}|${i}`][1]):t[`${n}|${i}`]=[e]}}checkCoordsOnLine(t,e){let n=-1,i=null,r=null;const o=this.sp.getOptions().look,s=o.sizeColumnName?this.sp.dataFrame.col(o.sizeColumnName):null,a=this.sp.dataFrame.filter;for(let l=0;l<this.lines.from.length;l++)if(a.get(this.lines.from[l])&&a.get(this.lines.to[l])&&this.visibility.getBit(l)){const{sizeFrom:a,sizeTo:u}=this.getMarkersSizes(o,s,l),c=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[l]),this.yAxisCol.get(this.lines.from[l])),h=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[l]),this.yAxisCol.get(this.lines.to[l]));if(this.multipleLinesCounts[l]){const n=this.getLineLength(c.x,c.y,h.x,h.y),i=this.getPointOnDistance(c.x,c.y,h.x,h.y,u,n),o=this.getPointOnDistance(h.x,h.y,null==c?void 0:c.x,null==c?void 0:c.y,a,n),s=this.lines.from[l]>this.lines.to[l]?this.findControlPoint(this.multipleLinesCounts[l],i.x,i.y,o.x,o.y,l):this.findControlPoint(this.multipleLinesCounts[l],o.x,o.y,i.x,i.y,l);r=this.calculateDistToCurveLine(l,t,e,i,o,s)}else r=this.calculateDistToStraightLine(t,e,c,h);(!i&&null!==r&&r<5||i&&null!==r&&r<i)&&(i=r,n=l)}return n}calculateDistToStraightLine(t,e,n,i){const r=Math.min(n.x,i.x),o=Math.max(n.x,i.x),s=Math.min(n.y,i.y),a=Math.max(n.y,i.y);return t>=r-2&&t<=o+2&&e>=s-2&&e<=a+2?this.distToStraightLineSegment(t,e,n,i):null}distToStraightLineSegment(t,e,n,i){const r=(t,e,n,i)=>Math.pow(t-n,2)+Math.pow(e-i,2),o=r(n.x,n.y,i.x,i.y);if(0==o)return r(t,e,n.x,n.y);let s=((t-n.x)*(i.x-n.x)+(e-n.y)*(i.y-n.y))/o;return s=Math.max(0,Math.min(1,s)),r(t,e,n.x+s*(i.x-n.x),n.y+s*(i.y-n.y))}calculateDistToCurveLine(t,e,n,i,r,o){const s=Math.min(i.x,r.x,o.x),a=Math.max(i.x,r.x,o.x),l=Math.min(i.y,r.y,o.y),u=Math.max(i.y,r.y,o.y);if(e>=s-2&&e<=a+2&&n>=l-2&&n<=u+2){const t=a-s,c=u-l;return this.calculateDistToCurveInRect(e,n,i,o,r,t,c)}return null}calculateDistToCurveInRect(t,e,n,i,r,o,s){const a=Math.floor((o+s)/3),l=1/a,u=new Uint32Array(a),c=new Uint32Array(a),h=new Uint32Array(a);let d=null;const f=new p.A(a);for(let o=0;o<u.length;o++){const s=o*l,a=Math.pow(1-s,2)*n.x+2*s*(1-s)*i.x+Math.pow(s,2)*r.x,f=Math.pow(1-s,2)*n.y+2*s*(1-s)*i.y+Math.pow(s,2)*r.y,p=Math.abs(t-a),m=Math.abs(e-f),g=p+m;(!d||d>g)&&(d=g),h[o]=Math.max(p,m),u[o]=a,c[o]=f}for(let t=0;t<u.length;t++)h[t]<d&&f.setBit(t,!0,!1);let m=null;for(let n=-1;-1!==(n=f.findNext(n));){const i=Math.hypot(u[n]-t,c[n]-e);(!m||m>i)&&(m=i)}return m}getLineLength(t,e,n,i){return Math.sqrt(Math.pow(n-t,2)+Math.pow(i-e,2))}getPointOnDistance(t,e,n,i,r,o){const a=n-r*((n-t)/o),l=i-r*((i-e)/o);return new s.Point(a,l)}findControlPoint(t,e,n,i,r,o){const a=e+(i-e)/2,l=n+(r-n)/2;let u=a-e,c=l-n;const h=Math.sqrt(u*u+c*c);u/=h,c/=h;const d=50*Math.ceil(t/2);return t%2==0?new s.Point(a+d/2*c,l-d/2*u):new s.Point(a-d/2*c,l+d/2*u)}canvasArrow(t,e,n,i,r){const o=Math.atan2(i-e,r-n)+Math.PI;t.moveTo(e-this.arrowWidth*Math.sin(o-Math.PI/10),n-this.arrowWidth*Math.cos(o-Math.PI/10)),t.lineTo(e,n),t.lineTo(e-this.arrowWidth*Math.sin(o+Math.PI/10),n-this.arrowWidth*Math.cos(o+Math.PI/10))}}!function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(V||(V={}));var B,q=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.SEQUENCE_VARIABILITY_MAP="Sequence Variability Map",t.MOST_POTENT_RESIDUES="Most Potent Residues",t.LOGO_SUMMARY_TABLE="Logo Summary Table",t.DENDROGRAM="Dendrogram",t.CLUSTER_MAX_ACTIVITY="Active peptide selection"}(B||(B={}));class Y{constructor(t){this.isBitsetChangedInitialized=!1,this.isUserChangedSelection=!0,this._dm=null,this.isInitialized=!1,this.isRibbonSet=!1,this.webLogoSelectedMonomers={},this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._layoutEventInitialized=!1,this.subs=[],this.isHighlighting=!1,this.controlFire=!1,this.accordionSource=null,this._sequenceSpaceViewer=null,this._mclViewer=null,this._monomerPositionStats=null,this._settings=null,this._sequenceSpaceCols=[],this._mclCols=[],this._webLogoSelection=null,this.df=t}get monomerPositionStats(){var t;if(null!==this._monomerPositionStats)return this._monomerPositionStats;const e=this.getScaledActivityColumn();return null===this.positionColumns||null===e?null:(null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,M.Ej)(e,this.df.filter,this.positionColumns)),this._monomerPositionStats)}get analysisView(){return void 0===this._analysisView&&(this._analysisView=g()(o.shell.tableViews).find((({dataFrame:t})=>(null==t?void 0:t.getTag(s.TAGS.ID))===this.id)),void 0===this._analysisView&&(this._analysisView=o.shell.addTableView(this.df))),"1"===this.df.getTag(C.gp.MULTIPLE_VIEWS)||this._layoutEventInitialized||o.shell.isInDemo||(o.shell.v=this._analysisView),this._analysisView.grid.invalidate(),this._analysisView}get settings(){var t;const e=this.df.getTag(C.gp.SETTINGS);return null==e?null:(null!==(t=this._settings)&&void 0!==t||(this._settings=JSON.parse(e)),this._settings)}set settings(t){var e,n,i;const r=Object.entries(t),o=Object.assign({},null!==(n=null===(e=this.settings)||void 0===e?void 0:e.sequenceSpaceParams)&&void 0!==n?n:{}),s=new Set;for(const[t,e]of r)switch(this.settings[t]=e,t){case"activityColumnName":case"activityScaling":s.add("activity"),s.add("stats");break;case"showDendrogram":s.add("dendrogram");break;case"showClusterMaxActivity":s.add("clusterMaxActivity");break;case"showSequenceSpace":s.add("showSequenceSpace");break;case"showLogoSummaryTable":s.add("logoSummaryTable");break;case"showMonomerPosition":s.add("monomerPosition");break;case"showMostPotentResidues":s.add("mostPotentResidues");break;case"columns":s.add("columns");break;case"sequenceSpaceParams":s.add("sequenceSpaceParams");break;case"mclSettings":s.add("mclSettings")}if(this.df.setTag("settings",JSON.stringify(this._settings)),this.isInitialized){if(s.has("sequenceSpaceParams")){const t=this.settings.sequenceSpaceParams;Object.entries(t).some((([t,e])=>o[t]!==e&&"epsilon"!==t&&"minPts"!==t&&"clusterEmbeddings"!==t))||(s.delete("sequenceSpaceParams"),this.settings.sequenceSpaceParams.clusterEmbeddings&&s.add("clusterParams"))}s.has("sequenceSpaceParams")&&s.delete("clusterParams");for(const t of s)switch(t){case"activity":this.createScaledCol();break;case"stats":this.webLogoSelection=(0,b.ZR)(this.positionColumns),this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._monomerPositionStats=null;break;case"dendrogram":this.settings.showDendrogram?this.addDendrogram():this.closeViewer(B.DENDROGRAM);break;case"clusterMaxActivity":this.settings.showClusterMaxActivity?this.addClusterMaxActivityViewer():this.closeViewer(B.CLUSTER_MAX_ACTIVITY);break;case"logoSummaryTable":this.settings.showLogoSummaryTable?this.addLogoSummaryTable():this.closeViewer(B.LOGO_SUMMARY_TABLE);break;case"monomerPosition":this.settings.showMonomerPosition?this.addMonomerPosition():this.closeViewer(B.SEQUENCE_VARIABILITY_MAP);break;case"mostPotentResidues":this.settings.showMostPotentResidues?this.addMostPotentResidues():this.closeViewer(B.MOST_POTENT_RESIDUES);break;case"columns":const t=this.findViewer(B.LOGO_SUMMARY_TABLE);t._viewerGrid=null,t._logoSummaryTable=null,t.render();const e=this.findViewer(B.MOST_POTENT_RESIDUES);e._viewerGrid=null,e.render();break;case"sequenceSpaceParams":case"showSequenceSpace":this.settings.showSequenceSpace&&this.addSequenceSpace({clusterEmbeddings:null===(i=this.settings.sequenceSpaceParams)||void 0===i?void 0:i.clusterEmbeddings});break;case"clusterParams":this.clusterEmbeddings();break;case"mclSettings":this.addMCLClusters()}}}get webLogoSelection(){var t;const e=this.df.getTag(`${C.YX.WL}${C.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._webLogoSelection)&&void 0!==t||(this._webLogoSelection=null===e&&null!==this.positionColumns?(0,b.ZR)(this.positionColumns):JSON.parse(null!=e?e:"{}")),this._webLogoSelection}set webLogoSelection(t){this._webLogoSelection=t,this.df.setTag(`${C.YX.WL}${C.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.fireBitsetChanged(null),this.analysisView.grid.invalidate()}get positionColumns(){const t=g()(this.df.columns.byTags({[C.gp.POSITION_COL]:"true"})).toArray();return 0===t.length?null:t}get id(){return this.df.getTag(s.TAGS.ID)}get alphabet(){return this.df.getCol(this.settings.sequenceColumnName).getTag(a.gp.alphabet)}static getInstance(t){var e,n,i;return t.columns.contains(C.$2.ACTIVITY_SCALED)&&!t.columns.contains(C.$2.ACTIVITY)&&(t.getCol(C.$2.ACTIVITY_SCALED).name=C.$2.ACTIVITY),null!==(e=(n=t.temp)[i=Y.modelName])&&void 0!==e||(n[i]=new Y(t)),t.temp[Y.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,b.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,l,u;const c=null===(t=o.shell.t)||void 0===t?void 0:t.temp[Y.modelName];if(!c)return null;const h=r.accordion("Peptides analysis panel");h.root.style.width="100%";const d=c.getVisibleSelection(),f=c.df.filter.anyFalse?` among ${c.df.filter.trueCount} filtered`:"",p=t=>{const e=[];for(const[n,i]of Object.entries(t))for(const t of i)e.push(`${n}:${t}`);return e.join(", ")},m=c.findViewer(B.LOGO_SUMMARY_TABLE),v=[],C=(null===m?[]:m.clusterSelection[x.W.ORIGINAL].concat(m.clusterSelection[x.W.CUSTOM])).join(", ");0!==C.length&&(v.push(r.h1("Logo summary table selection")),v.push(r.divText(`Selected clusters: ${C}`)));const w=c.findViewer(B.SEQUENCE_VARIABILITY_MAP),_=p(null!==(e=null==w?void 0:w.invariantMapSelection)&&void 0!==e?e:{}),N=p(null!==(n=null==w?void 0:w.mutationCliffsSelection)&&void 0!==n?n:{});0===_.length&&0===N.length||v.push(r.h1("Sequence Variabily Map viewer selection")),0!==_.length&&v.push(r.divText(`Selected monomer-positions: ${_}`)),0!==N.length&&v.push(r.divText(`Selected mutation cliffs pairs: ${N}`));const O=c.findViewer(B.MOST_POTENT_RESIDUES),L=p(null!==(i=null==O?void 0:O.mutationCliffsSelection)&&void 0!==i?i:{});0!==L.length&&(v.push(r.h1("Most Potent Residues viewer selection")),v.push(r.divText(`Selected monomer-positions: ${L}`)));const I=p(c.webLogoSelection);0!==I.length&&(v.push(r.h1("WebLogo selection")),v.push(r.divText(`Selected monomers: ${I}`)));const R=r.div(r.divV(v));h.addTitle(r.divV([r.h1(`${d.trueCount} selected rows${f}`),R],"css-gap-small")),d.anyTrue&&h.addPane("Actions",(()=>{try{const t=r.label("New view");if(y()(t).addClass("d4-link-action"),t.onclick=()=>c.createNewView(),t.onmouseover=t=>r.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===m)return r.divV([t]);const e=r.label("New cluster");y()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===m)throw new Error("Logo summary table viewer is not found");m.clusterFromSelection()},e.onmouseover=t=>r.tooltip.show("Creates a new cluster from selection",t.clientX+5,t.clientY+5);const n=r.label("Remove cluster");return y()(n).addClass("d4-link-action"),n.onclick=()=>{const t=c.findViewer(B.LOGO_SUMMARY_TABLE);if(null===t)throw new Error("Logo summary table viewer is not found");t.removeCluster()},n.onmouseover=t=>r.tooltip.show("Removes currently selected custom cluster",t.clientX+5,t.clientY+5),n.style.visibility=0===m.clusterSelection[x.W.CUSTOM].length?"hidden":"visible",r.divV([t,e,n])}catch(t){const e=r.divText("Error in Actions");return r.tooltip.bind(e,String(t)),e}}),!0);let P=c.settings;const k=[w,O,m].filter((t=>null!==t&&(t.type!==this.accordionSource||(P=t,!1))));if(null===P)throw new Error("PeptidesError: Model is the source of accordion but is not initialized");P!==c.settings&&k.push(c.settings);const D=k.filter((t=>null!==t&&(0,b.$s)(P,t)&&(t!==c.settings||c.isInitialized)));D.push(P);const G=s.BitSet.create(c.df.rowCount);for(const t of D){const e=t===this.settings?(0,b.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof x.s?(0,b.KT)(t.clusterSelection,t.clusterStats):t instanceof A.xN?(0,b.KT)(t.mutationCliffsSelection,(0,b.qI)(null!==(l=t.mutationCliffs)&&void 0!==l?l:new Map,c.df.rowCount)):null;if(null!==e&&G.or(e),t instanceof A.J){const e=(0,b.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&G.or(e)}}const U=P;P===c.settings||U instanceof x.s||null==U.mutationCliffs||h.addPane("Mutation Cliffs pairs",(()=>(0,S.F)(c.df,{mutationCliffs:U.mutationCliffs,mutationCliffsSelection:U.mutationCliffsSelection,gridColumns:c.analysisView.grid.columns,sequenceColumnName:U.sequenceColumnName,positionColumns:U.positionColumns,activityCol:U.getScaledActivityColumn()}).root),!0);const V=P===c.settings,F=V?this.webLogoSelection:P instanceof A.J?P.invariantMapSelection:{},H=P instanceof x.s?P.clusterSelection:null!==(u=null==m?void 0:m.clusterSelection)&&void 0!==u?u:{};h.addPane("Distribution",(()=>{var t;try{return(0,T.HV)(c.df,{peptideSelection:G,columns:V?null!==(t=c.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityCol:V?c.getScaledActivityColumn():P.getScaledActivityColumn(),monomerPositionSelection:F,clusterSelection:H,clusterColName:null==m?void 0:m.clustersColumnName})}catch(t){const e=r.divText("Error in Distribution");return r.tooltip.bind(e,String(t)),e}}),!0);const q=(t,e)=>{if(null==t||null==e)return!1;for(const[n,i]of Object.entries(t))if(i!==e[n])return!1;return!0};return h.addPane("Selection",(()=>{var t;try{return function(t,e){var n,i;if(0===e.tableSelection.trueCount)return r.divText("No compounds selected");const o=s.DataFrame.create(t.rowCount);o.name="Selected compounds",o.filter.copyFrom(e.tableSelection);const a=g()(t.columns.numerical);let l=null;for(let t=1;t<e.gridColumns.length;t++){const r=e.gridColumns.byIndex(t);if(!r.visible)continue;const u=r.column;if(u.type===s.COLUMN_TYPE.BOOL)continue;null===l&&r.grid&&(null===(n=r.grid.sortByColumns)||void 0===n?void 0:n.length)>0&&(null===(i=r.grid.sortTypes)||void 0===i?void 0:i.length)===r.grid.sortByColumns.length&&(l={cols:r.grid.sortByColumns,types:r.grid.sortTypes});let c=null,h=null;try{c=u.getRawData(),h=u.categories}catch(t){}const d=c&&h?a.some((t=>t.name===u.name))?t=>c[t]:t=>h[c[t]]:t=>u.get(t),f=u.name===e.activityColumn.name?o.columns.addNewFloat(r.name).init((t=>d(t))):o.columns.addNewVirtual(r.name,(t=>d(t)),u.type);for(const[t,e]of u.tags)f.setTag(t,e)}const u=o.plot.grid();u.props.showRowHeader=!1,u.root.style.maxWidth="100%",s.debounce(r.onSizeChanged(u.root),50).subscribe((t=>{var e;const n=u.root.parentElement;(null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.classList.contains("panel-content"))&&(u.root.style.height="calc(100% - 20px)",u.root.style.width="calc(100% - 20px)",u.root.style.position="absolute",u.root.style.right="10px",u.root.style.top="10px")})),(0,b.zz)(u);const c=r.box(u.root);c.style.marginLeft="0px",setTimeout((()=>{null!==l&&u.sort(l.cols,l.types);for(let t=1;t<e.gridColumns.length;t++){const n=e.gridColumns.byIndex(t);n.visible&&u.col(n.name)&&(u.col(n.name).width=n.width)}}),500);const h=(0,M.Ej)(e.activityColumn,o.filter,e.positionColumns,{isFiltered:o.filter.anyTrue||o.filter.anyFalse}),d={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},f={x:0,y:0,monomerPosition:{},mpStats:h};return e.isAnalysis&&(0,E.FZ)(u,h,e.positionColumns,e.activityColumn,d,f),c}(c.df,{positionColumns:V?c.positionColumns:P.positionColumns,columns:V?null!==(t=c.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityColumn:V?c.getScaledActivityColumn():P.getScaledActivityColumn(),gridColumns:c.analysisView.grid.columns,colorPalette:(0,a.SM)(c.df.getCol(V?c.settings.sequenceColumnName:P.sequenceColumnName)),tableSelection:c.getCombinedSelection(),isAnalysis:null!==c.settings&&(V||q(c.settings.columns,P.getAggregationColumns()))})}catch(t){const e=r.divText("Error in Selection");return r.tooltip.bind(e,String(t)),e}}),!0),h}getScaledActivityColumn(t=!1){const e=this.df.col(C.$2.ACTIVITY);return t&&null!==e?s.DataFrame.fromColumns([e]).clone(this.df.filter).getCol(e.name):e}updateGrid(){this.joinDataFrames(),this.createScaledCol(),this.webLogoBounds={};const t={selectionCallback:(t,e)=>this.modifyWebLogoSelection(t,e),unhighlightCallback:()=>this.unhighlight(),colorPalette:()=>(0,a.SM)(this.df.getCol(this.settings.sequenceColumnName)),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>(0,b.dl)(t,e,n),isSelectionTable:!1,headerSelectedMonomers:()=>this.webLogoSelectedMonomers};if(null===this.monomerPositionStats||null===this.positionColumns)throw new Error("PeptidesError: Could not updage grid: monomerPositionStats or positionColumns are null");E.FZ(this.analysisView.grid,this.monomerPositionStats,this.positionColumns,this.getScaledActivityColumn(),t),this._layoutEventInitialized||(o.events.onViewLayoutApplied.subscribe((t=>{t.view.id===this.analysisView.id&&this.updateGrid()})),this._layoutEventInitialized=!0),this.setTooltips(),this.setBitsetCallback(),this.setGridProperties()}joinDataFrames(){const t=this.df.name,e=this.df.columns,n=(0,c.R)(this.df.getCol(this.settings.sequenceColumnName)),i=n.columns.names();for(const t of i){let i=this.df.col(t);const r=n.getCol(t);null!==i&&e.remove(t);const o=r.categories,s=r.getRawData();i=e.addNew(r.name,r.type).init((t=>o[s[t]])),i.setTag(C.gp.ANALYSIS_COL,"true"),i.setTag(C.gp.POSITION_COL,"true"),E.rI(i,this.alphabet)}this.df.name=t}createScaledCol(){const t=this.analysisView.grid,e=(0,b.Y1)(this.df.getCol(this.settings.activityColumnName),this.settings.activityScaling);this.df.columns.replace(C.$2.ACTIVITY,e),t.columns.setOrder([e.name])}unhighlight(){this.isHighlighting&&(this.df.rows.highlight(null),this.isHighlighting=!1)}setTooltips(){this.analysisView.grid.onCellTooltip(((t,e,n)=>{var i,r;return!(!t.isColHeader||(null===(i=t.tableColumn)||void 0===i?void 0:i.semType)!==C.uF.MONOMER)||!(!t.isTableCell||(null===(r=t.tableColumn)||void 0===r?void 0:r.semType)!==C.uF.MONOMER)&&((0,G.cr)(t.cell.value,e,n),!0)}))}getCombinedSelection(){var t,e,n,i,r,o,a,l;const u=new p.A(this.df.rowCount,!1),c=(t,e)=>{for(const[n,i]of Object.entries(t))for(const t of i){const i=null==e?void 0:e[n];if(void 0===i)continue;const r=i[t];void 0!==r&&u.or(r.mask)}};c(this.webLogoSelection,this.monomerPositionStats);const h=this.findViewer(B.SEQUENCE_VARIABILITY_MAP);c(null!==(t=null==h?void 0:h.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==h?void 0:h.monomerPositionStats)&&void 0!==e?e:null);const d=(t,e)=>{var n,i;for(const[r,o]of Object.entries(t))for(const t of o){const o=null!==(i=null===(n=null==e?void 0:e.get(t))||void 0===n?void 0:n.get(r))&&void 0!==i?i:null;if(null!==o)for(const[t,e]of o.entries()){u.setTrue(t);for(const t of e)u.setTrue(t)}}};d(null!==(n=null==h?void 0:h.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==h?void 0:h.mutationCliffs)&&void 0!==i?i:null);const f=this.findViewer(B.MOST_POTENT_RESIDUES);d(null!==(r=null==f?void 0:f.mutationCliffsSelection)&&void 0!==r?r:{},null!==(o=null==f?void 0:f.mutationCliffs)&&void 0!==o?o:null);const m=this.findViewer(B.LOGO_SUMMARY_TABLE);for(const t of Object.keys(null!==(a=null==m?void 0:m.clusterSelection)&&void 0!==a?a:{}))for(const e of null!==(l=m.clusterSelection[t])&&void 0!==l?l:[]){const n=m.clusterStats[t][e];u.or(n.mask)}return s.BitSet.fromBytes(u.buffer.buffer,u.length)}setBitsetCallback(){if(this.isBitsetChangedInitialized)return;const t=this.df.selection,e=this.df.filter,n=()=>{try{const t=this.createAccordion();if(null===t)return;o.shell.o=t.root}catch(t){console.error(t)}};t.onChanged.subscribe((()=>{if(this.controlFire)this.controlFire=!1;else try{this.isUserChangedSelection||t.copyFrom(this.getCombinedSelection(),!1)}catch(t){N._package.logger.debug("Peptides: Error on selection changed"),N._package.logger.debug(t)}finally{n()}})),e.onChanged.subscribe((()=>{var t,e;try{if(this.controlFire)return void(this.controlFire=!1);const n=this.findViewer(B.LOGO_SUMMARY_TABLE);null!==n&&void 0!==n.model&&(n._logoSummaryTable=null!==(t=n.createLogoSummaryTable())&&void 0!==t?t:n._logoSummaryTable,n._viewerGrid=null!==(e=n.createLogoSummaryTableGrid())&&void 0!==e?e:n._viewerGrid,n.render())}catch(t){N._package.logger.debug("Peptides: Error on filter changed"),N._package.logger.debug(t)}finally{n()}})),this.isBitsetChangedInitialized=!0}fireBitsetChanged(t,e=!1){this.accordionSource=t,this.isBitsetChangedInitialized||this.setBitsetCallback(),this.isUserChangedSelection=!1,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.controlFire=!0,this.df.selection.fireChanged(),e&&this.df.filter.fireChanged(),this.isUserChangedSelection=!0,this.webLogoSelectedMonomers=(0,b.qx)(this.df)}setGridProperties(t){var e,n,i,r;const o=this.analysisView.grid,s=o.props;s.allowColSelection=null!==(e=null==t?void 0:t.allowColSelection)&&void 0!==e&&e,s.allowEdit=null!==(n=null==t?void 0:t.allowEdit)&&void 0!==n&&n,s.showReadOnlyNotifications=null!==(i=null==t?void 0:t.showReadOnlyNotifications)&&void 0!==i&&i,s.showCurrentRowIndicator=null!==(r=null==t?void 0:t.showCurrentRowIndicator)&&void 0!==r&&r;const l=this.positionColumns;if(null===l)throw new Error("PeptidesError: Could not set grid properties: positionColumns are null");let u=10;const c=o.canvas.getContext("2d");if(null===c)throw new Error("PeptidesError: Could not set grid properties: canvas context is null");for(const t of l){const e=(0,a.zS)(t.categories.reduce(((t,e)=>t.length>e.length?t:e)),6),n=Math.ceil(c.measureText(e).width);u=Math.max(u,n)}const h=l.map((t=>t.name));for(let t=1;t<this.analysisView.grid.columns.length;++t){const e=this.analysisView.grid.columns.byIndex(t);if(null===e)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' is null`);if(null===e.column)throw new Error(`PeptidesError: Could not get analysis view: grid column with index '${t}' has null column`);e.visible=h.includes(e.column.name)||e.column.name===C.$2.ACTIVITY}setTimeout((()=>{for(const t of l){const e=o.col(t.name);if(null===e)throw new Error(`PeptidesError: Could not set column width: grid column '${t.name}' is null`);e.width=u+15}}),100)}closeViewer(t){const e=this.findViewer(t);null==e||e.detach(),null==e||e.close()}findViewerNode(t){for(const e of this.analysisView.dockManager.rootNode.children)if(e.container.containerElement.innerHTML.includes(t))return e;return null}addDendrogram(){return q(this,void 0,void 0,(function*(){const t=s.TaskBarProgressIndicator.create("Calculating distance matrix...");try{const t=s.Func.find({package:"Dendrogram",name:"hierarchicalClustering"})[0];if(!t||4!==t.inputs.length)throw new Error("Correct dendrogram function is not found");yield t.apply({df:this.df,colNameList:[this.settings.sequenceColumnName],distance:"euclidean",linkage:"complete"})}catch(t){N._package.logger.error(t)}finally{t.close()}}))}init(t){if(!this.isInitialized){if(this.settings=t,this.isInitialized=!0,!this.isRibbonSet&&"1"!==this.df.getTag(C.gp.MULTIPLE_VIEWS)){const t=r.iconFA("wrench",(()=>(0,_.OH)(this)),"Peptides analysis settings");this.analysisView.setRibbonPanels([[t]],!1),this.isRibbonSet=!0,this.updateGrid()}this.subs.push(o.events.onAccordionConstructed.subscribe((t=>{if(!(o.shell.o instanceof s.SemanticValue||o.shell.o instanceof s.Column&&this.df.columns.toList().includes(o.shell.o)))return;const e=t.getPane("Actions"),n=y()(e.root).find(".d4-flex-col"),a=r.label("Calculate identity");a.classList.add("d4-link-action"),r.tooltip.bind(a,"Adds a column with fractions of matching monomers against sequence in the current row"),a.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);d(this.df,t,t.get(this.df.currentRowIdx),i.IDENTITY).then((e=>e.setTag(C.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>N._package.logger.debug(t)))},n.append(r.span([a],"d4-markdown-row"));const l=r.label("Calculate similarity");l.classList.add("d4-link-action"),r.tooltip.bind(l,"Adds a column with sequence similarity scores against sequence in the current row"),l.onclick=()=>{const t=this.df.getCol(this.settings.sequenceColumnName);d(this.df,t,t.get(this.df.currentRowIdx),i.SIMILARITY).then((e=>e.setTag(C.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>N._package.logger.debug(t)))},n.append(r.span([l],"d4-markdown-row"))}))),this.subs.push(o.events.onViewRemoved.subscribe((t=>{t.id===this.analysisView.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: view ${t.name} removed`)}))),this.subs.push(o.events.onTableRemoved.subscribe((t=>{t.id===this.df.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: table ${t.name} removed`)}))),this.subs.push(o.events.onProjectClosed.subscribe((t=>{t.id===o.shell.project.id&&this.subs.forEach((t=>t.unsubscribe())),o.log.debug(`Peptides: project ${t.name} closed`)}))),this.fireBitsetChanged(null,!0),this.analysisView.grid.invalidate()}}findViewer(t){return g()(this.analysisView.viewers).find((e=>e.type===t))||null}addLogoSummaryTable(t){return q(this,void 0,void 0,(function*(){null!=t||(t={sequenceColumnName:this.settings.sequenceColumnName,clustersColumnName:g()(this.df.columns.categorical).next().value,activityColumnName:this.settings.activityColumnName,activityScaling:this.settings.activityScaling});const e=yield this.df.plot.fromType(B.LOGO_SUMMARY_TABLE,t);this.analysisView.dockManager.dock(e,s.DOCK_TYPE.RIGHT,null,B.LOGO_SUMMARY_TABLE),e.viewerGrid.invalidate()}))}addClusterMaxActivityViewer(t){return q(this,void 0,void 0,(function*(){var e,n,i,r,o,a,l;const u=null!==(r=null!==(n=null===(e=this._mclCols)||void 0===e?void 0:e.find((t=>t.toLowerCase().startsWith("cluster (mcl)"))))&&void 0!==n?n:null===(i=this.findViewer(B.LOGO_SUMMARY_TABLE))||void 0===i?void 0:i.clustersColumnName)&&void 0!==r?r:null===(o=this._sequenceSpaceCols)||void 0===o?void 0:o.find((t=>t.toLowerCase().startsWith("cluster")));null!=t||(t={activityColumnName:this.settings.activityColumnName,clusterColumnName:null!=u?u:null===(a=g()(this.df.columns.categorical).next().value)||void 0===a?void 0:a.name,activityTarget:C.wf.HIGH,connectivityColumnName:this._mclCols.find((t=>t.toLowerCase().startsWith("connectivity"))),clusterSizeThreshold:20,activityThreshold:1e3});const c=yield this.df.plot.fromType(B.CLUSTER_MAX_ACTIVITY,t),h=null!==(l=this.findViewerNode(B.LOGO_SUMMARY_TABLE))&&void 0!==l?l:null;this.analysisView.dockManager.dock(c,h?s.DOCK_TYPE.DOWN:s.DOCK_TYPE.RIGHT,h,B.CLUSTER_MAX_ACTIVITY)}))}addMonomerPosition(t){return q(this,void 0,void 0,(function*(){null!=t||(t={maxMutations:1,activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,activityTarget:C.wf.HIGH});const e=yield this.df.plot.fromType(B.SEQUENCE_VARIABILITY_MAP,t),n=this.findViewer(B.MOST_POTENT_RESIDUES),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.LEFT,this.findViewerNode(B.MOST_POTENT_RESIDUES),.7];i.dock(e,r,o,B.SEQUENCE_VARIABILITY_MAP,a)}))}addMostPotentResidues(t){return q(this,void 0,void 0,(function*(){null!=t||(t={activityScaling:this.settings.activityScaling,activityColumnName:this.settings.activityColumnName,sequenceColumnName:this.settings.sequenceColumnName,minActivityDelta:0,maxMutations:1,activityTarget:C.wf.HIGH});const e=yield this.df.plot.fromType(B.MOST_POTENT_RESIDUES,t),n=this.findViewer(B.SEQUENCE_VARIABILITY_MAP),i=this.analysisView.dockManager,[r,o,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.RIGHT,this.findViewerNode(B.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,r,o,B.MOST_POTENT_RESIDUES,a)}))}createNewView(){const t=this.getVisibleSelection(),e=this.df.clone(t);for(const[t,n]of e.tags)e.setTag(t,t===C.gp.SETTINGS?n:"");e.name="Peptides Multiple Views",e.setTag(C.gp.MULTIPLE_VIEWS,"1");const n=o.shell.addTableView(e),i=this.findViewer(B.LOGO_SUMMARY_TABLE);return null!=i&&n.addViewer(B.LOGO_SUMMARY_TABLE,{[`sequence${C.To}`]:i.sequenceColumnName,[`activity${C.To}`]:i.activityColumnName,activityScaling:i.activityScaling,webLogoMode:i.webLogoMode,membersRatioThreshold:i.membersRatioThreshold,[`clusters${C.To}`]:i.clustersColumnName}),e.getTag(s.TAGS.ID)}clusterEmbeddings(){return q(this,void 0,void 0,(function*(){var t,e;if(!this._sequenceSpaceCols||0===this._sequenceSpaceCols.length)return void o.shell.warning("Embeddings columns are not initialized");const i=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("embed_")));if(2!==i.length)return void o.shell.warning(`Found ${i.length} embeddings columns, expected 2`);const r=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("cluster")));r.length>0&&this.df.columns.remove(r[0]);const s=this.df.getCol(i[0]).getRawData(),a=this.df.getCol(i[1]).getRawData(),l=null!==(t=this.settings.sequenceSpaceParams.epsilon)&&void 0!==t?t:.01,u=null!==(e=this.settings.sequenceSpaceParams.minPts)&&void 0!==e?e:4,c=yield function(t,e,i,r){return o=this,s=void 0,l=function*(){return new Promise((function(o,s){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:r,epsilon:i}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?s(t):o(e)}}))},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{r(l.next(t))}catch(t){e(t)}}function i(t){try{r(l.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof a?r:new a((function(t){t(r)}))).then(n,i)}r((l=l.apply(o,s||[])).next())}));var o,s,a,l}(s,a,l,u),h=this.df.columns.getUnusedName("Cluster (DBSCAN)"),d=this.df.columns.addNewString(h);d.init((t=>c[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=d.name),this._sequenceSpaceCols=[i[0],i[1],d.name];const f=this.analysisView.grid.col(d.name);f&&(f.visible=!1)}))}addMCLClusters(){return q(this,void 0,void 0,(function*(){var t,e,i,a,l;if(null!==this._mclViewer)try{null===(t=this._mclViewer)||void 0===t||t.detach(),null===(e=this._mclViewer)||void 0===e||e.close()}catch(t){}0!==this._mclCols.length&&this._mclCols.forEach((t=>this.df.columns.remove(t))),this._mclCols=[];const u=this.df.getCol(this.settings.sequenceColumnName);null!==(i=(l=this.settings).mclSettings)&&void 0!==i||(l.mclSettings=new w.av);const c=this.settings.mclSettings;let h=0;const d=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if((e.name.toLowerCase().startsWith("embed")||e.name.toLowerCase().startsWith("cluster")||e.name.toLowerCase().startsWith("connectivity"))&&e.name.toLowerCase().includes("mcl")){const t=this.analysisView.grid.col(e.name);if(null==t||this._mclCols.includes(e.name))continue;t.visible=!1,this._mclCols.push(e.name),h++}5===h&&d.unsubscribe()})),f=o.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===s.VIEWER.SCATTER_PLOT){if(this._sequenceSpaceViewer&&this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root)){const t=this.analysisView.dockManager.findNode(this._sequenceSpaceViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,s.DOCK_TYPE.FILL,t)}))}f.unsubscribe()}}catch(t){console.error(t)}})),p=s.Func.find({package:"Bio",name:"macromoleculePreprocessingFunction"})[0],m=yield async function(t,e,i,a,l,u,c,h=80,d=10,f=!1,p=2,m=5,g){const v=o.shell.tableView(t.name)??o.shell.addTableView(t),y=g??v.scatterPlot({showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1,title:"MCL"});r.setUpdateIndicator(y.root,!0);const C=[],w=[];for(let t=0;t<u.length;++t){const n=u[t];if(n){const r=n.inputs[0].name,o=n.inputs[1].name,{entries:s,options:a}=await n.apply({[r]:e[t],[o]:i[t],...c[t]??{}});w.push({entries:s,options:a}),C.push(a??{})}else{const n=e[t].toList(),i={};w.push({entries:n,options:i}),C.push(i)}}const b=function(t,e,i,r,o,s,a=10,l=!1,u=2){const c=new Worker(new URL(n.p+n.u(51),n.b));let h;return c.postMessage({data:t,threshold:e,weights:i,aggregationMethod:r,distanceFns:o,distanceFnArgs:s,maxIterations:a,useWebGPU:l,inflate:u}),{promise:new Promise(((t,e)=>{h=t,c.onmessage=e=>{setTimeout((()=>c.terminate()),100),t(e.data.res)},c.onerror=t=>{setTimeout((()=>c.terminate()),100),e(t)}})),terminate:()=>{try{h(null),c.terminate()}catch(t){console.error(t)}}}}(w.map((t=>t.entries)),h,a,l,i,C,d,f,p),A=o.events.onViewerClosed.subscribe((t=>{t.args.viewer?.props?.title===y.props.title&&y.type===t.args?.viewer?.type&&(A.unsubscribe(),b.terminate())})),E=await b.promise;if(!E)return;const S=t.columns.getUnusedName("Cluster (MCL)"),T=t.columns.getUnusedName("EmbedX (MCL)"),x=t.columns.getUnusedName("EmbedY (MCL)"),_={};E.clusters.forEach((t=>{_[t]||(_[t]=0),_[t]++}));const N=new Uint32Array(E.embedX.length);for(let t=0;t<E.is.length;t++)N[E.is[t]]++,N[E.js[t]]++;const M=t.columns.getUnusedName("Cluster size (MCL)"),O=t.columns.getUnusedName("Connectivity (MCL)"),L=t.columns.addNewFloat(T);L.init((t=>E.embedX[t]));const I=t.columns.addNewFloat(x);I.init((t=>E.embedY[t]));const R=t.columns.addNewString(S);R.init((t=>_[E.clusters[t]]>=m?E.clusters[t].toString():"-1"));const P={"-1":s.Color.setAlpha(s.Color.lightBlue,100)};R.setTag(s.TAGS.COLOR_CODING_CATEGORICAL,JSON.stringify(P)),R.temp[s.TAGS.COLOR_CODING_CATEGORICAL]=P;const k=t.columns.addNewInt(M);k.init((t=>_[E.clusters[t]]));const D=t.columns.addNewInt(O);D.init((t=>N[t])),y.props.xColumnName=T,y.props.yColumnName=x,y.props.colorColumnName=S,y.props.markerDefaultSize=6,A.unsubscribe();const G=[],V=[],F=new Map;for(let t=0;t<E.is.length;t++){let e=E.clusters[E.is[t]],n=E.clusters[E.js[t]];if(e===n){G.push(E.is[t]),V.push(E.js[t]);continue}if(e>n){const t=e;e=n,n=t}let i=F.get(e);i||(i=new Map,F.set(e,i));let r=i.get(n);r||(r=0),r>=20||(r++,i.set(n,r),G.push(E.is[t]),V.push(E.js[t]))}return new H(y,T,x,{from:new Uint32Array(G),to:new Uint32Array(V),drawArrows:!1,opacity:.3,skipMultiLineCalculation:!0,skipShortLines:!0,skipMouseOverDetection:!0,shortLineThreshold:6,width:.75,color:"128,128,128"},U.none),r.setUpdateIndicator(y.root,!1),{sc:y,embedXCol:L,embedYCol:I,clusterCol:R,clusterCounterCol:k,connectivityCol:D}}(this.df,[u],[c.distanceF],[1],V.MANHATTAN,[p],[{gapOpen:c.gapOpen,gapExtend:c.gapExtend,fingerprintType:c.fingerprintType}],c.threshold,c.maxIterations,c.useWebGPU,c.inflation,c.minClusterSize);f.unsubscribe();const g=this.findViewer(B.LOGO_SUMMARY_TABLE);if(g&&(g._clusterStats=null,g._clusterSelection=null,g._viewerGrid=null,g._logoSummaryTable=null,g.render()),null==m?void 0:m.sc){const t=JSON.stringify({cols:[u].map((t=>t.name)),metrics:[c.distanceF],weights:[1],aggregationMethod:V.MANHATTAN,preprocessingFuncs:[p].map((t=>{var e;return null!==(e=null==t?void 0:t.name)&&void 0!==e?e:null})),preprocessingFuncArgs:[{gapOpen:c.gapOpen,gapExtend:c.gapExtend,fingerprintType:c.fingerprintType}],threshold:c.threshold,maxIterations:c.maxIterations,useWebGPU:c.useWebGPU,inflate:c.inflation,minClusterSize:c.minClusterSize});this.df.setTag("MCL_OPTIONS",t),m.sc.props.initializationFunction="EDA:MCLInitializationFunction",this._mclViewer=null!==(a=null==m?void 0:m.sc)&&void 0!==a?a:null}}))}addSequenceSpace(){return q(this,arguments,void 0,(function*(t={}){var e,n,i,r;if(null!==this._sequenceSpaceViewer)try{null===(e=this._sequenceSpaceViewer)||void 0===e||e.detach(),null===(n=this._sequenceSpaceViewer)||void 0===n||n.close()}catch(t){}0!==this._sequenceSpaceCols.length&&this._sequenceSpaceCols.forEach((t=>this.df.columns.remove(t))),this._sequenceSpaceCols=[];let l=this.df.getCol(this.settings.sequenceColumnName);const u=h.GO.forColumn(l);if(u.isHelm())try{o.shell.warning("Column is in HELM notation. Sequences space will linearize sequences from position 0 prior to analysis");const t=u.convert(a.Hi.SEPARATOR,"/"),e=this.df.columns.getUnusedName(`Separator(${l.name})`);t.name=e,this.df.columns.add(t,!0),this.analysisView.grid.col(e).visible=!1,l=t}catch(t){return o.shell.error("Error on converting HELM notation to linear notation"),void o.shell.error(t)}const c=!t.clusterCol&&!!t.clusterEmbeddings,d=null!==(r=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==r?r:new w.GI(c);d.clusterEmbeddings=c;const p={table:this.df,molecules:l,methodName:f.UMAP,similarityMetric:d.distanceF,plotEmbeddings:!0,options:{bypassLargeDataWarning:!0,dbScanEpsilon:d.epsilon,dbScanMinPts:d.minPts,randomSeed:"1",preprocessingFuncArgs:{gapOpen:d.gapOpen,gapExtend:d.gapExtend,fingerprintType:d.fingerprintType}},clusterEmbeddings:d.clusterEmbeddings};let m=0;const g=d.clusterEmbeddings?3:2,v=this.df.onColumnsAdded.subscribe((t=>{for(const e of t.columns)if(e.name.toLowerCase().startsWith("embed_")||d.clusterEmbeddings&&e.name.toLowerCase().startsWith("cluster")){const t=this.analysisView.grid.col(e.name);if(null==t||this._sequenceSpaceCols.includes(e.name))continue;t.visible=!1,this._sequenceSpaceCols.push(e.name),m++}m===g&&v.unsubscribe()})),y=o.events.onViewerAdded.subscribe((t=>{try{const e=t.args.viewer;if(e.type===s.VIEWER.SCATTER_PLOT){if(this._mclViewer&&this.analysisView.dockManager.findNode(this._mclViewer.root)){const t=this.analysisView.dockManager.findNode(this._mclViewer.root);setTimeout((()=>{this.analysisView.dockManager.dock(e,s.DOCK_TYPE.FILL,t)}))}y.unsubscribe()}}catch(t){console.error(t)}})),C=yield o.functions.call("Bio:sequenceSpaceTopMenu",p);y.unsubscribe(),C instanceof s.ScatterPlotViewer&&(d.clusterEmbeddings||t.clusterCol||(C.props.colorColumnName=this.getScaledActivityColumn().name),C.props.showXSelector=!1,C.props.showYSelector=!1,t.clusterCol&&(C.props.colorColumnName=t.clusterCol.name),this._sequenceSpaceViewer=C,C.onContextMenu.subscribe((t=>{try{t.item("Modify Sequence space parameters",(()=>{(0,_.OH)(this)}))}catch(t){}})))}))}}Y.modelName="peptidesModel"},3273:(t,e,n)=>{"use strict";n.d(e,{_package:()=>R,getMonomerWorksInstance:()=>P,getTreeHelperInstance:()=>k});var i,r,o=n(4328),s=n(7389),a=n(6082),l=(n(5082),n(7233)),u=n.n(l),c=(n(4788),n(9484));n(826),n(3541),n(5480),(r=i||(i={})).BASE="HELM_BASE",r.SUGAR="HELM_SUGAR",r.LINKER="HELM_LINKER",r.AA="HELM_AA",r.CHEM="HELM_CHEM",r.BLOB="HELM_BLOB",r.NUCLEOTIDE="HELM_NUCLETIDE";var h=n(4139);n(8608),n(2003),n(8070);var d=n(5072),f=n.n(d),p=n(7825),m=n.n(p),g=n(7659),v=n.n(g),y=n(5056),C=n.n(y),w=n(540),b=n.n(w),A=n(1113),E=n.n(A),S=n(6677),T={};T.styleTagTransform=E(),T.setAttributes=C(),T.insert=v().bind(null,"head"),T.domAPI=m(),T.insertStyleElement=b(),f()(S.A,T),S.A&&S.A.locals&&S.A.locals;var x;!function(t){let e,n;!function(t){t.vert=function(t){return s.divV(t.map((t=>s.render(t))),{classes:"u2-panel"})},t.horz=function(t){return s.divH(t.map((t=>s.render(t))),{classes:"u2-panel"})}}(e=t.panels||(t.panels={})),t.appHeader=function(t){const n=s.iconImage("",t.iconPath);return u()(n).addClass("ui-app-header-icon").css("margin-right","20px"),e.horz([n,e.vert([s.markdown(t.description),t.learnMoreUrl?s.link("Learn more",t.learnMoreUrl):null])])},function(t){t.runAsync=function(t,e){return n=this,i=void 0,a=function*(){s.setUpdateIndicator(t,!0);try{return yield e()}catch(t){o.log.error(t)}finally{s.setUpdateIndicator(t,!1)}},new((r=void 0)||(r=Promise))((function(t,e){function o(t){try{l(a.next(t))}catch(t){e(t)}}function s(t){try{l(a.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(o,s)}l((a=a.apply(n,i||[])).next())}));var n,i,r,a}}(n=t.tools||(t.tools={}))}(x||(x={}));var _=n(144),N=n.n(_);const M=rxjs.operators;class O extends a.JsViewer{get scViewer(){return this._scViewer||(this._scViewer=this.createSCViewer()),this._scViewer}constructor(){super(),this._titleHost=s.divText(c.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=s.div(),this.activityTarget=h.wf.HIGH,this.viewerError="",this.renderTimeout=null,this.renderDebounceTime=500,this.scFilterQuery=`\${${O.maxActivityInClusterColName}} == 1`,this.selectionSubscription=null,this.linesDrawSubscription=null,this.clusterColumnName=this.column("cluster",{nullable:!1}),this.activityColumnName=this.column("activity",{nullable:!1}),this.colorColumnName=this.column("color",{nullable:!0,defaultValue:null}),this.activityTarget=this.string("activityTarget",h.wf.HIGH,{choices:[h.wf.HIGH,h.wf.LOW]}),this.clusterSizeThreshold=this.int("clusterSizeThreshold",20),this.activityThreshold=this.int("activityThreshold",1e3),this.connectivityColumnName=this.column("connectivity",{nullable:!0})}get model(){return c.i.getInstance(this.dataFrame)}createSCViewer(){var t;const e={showXAxis:!0,showYAxis:!0,showXSelector:!1,showYSelector:!1,showColorSelector:!1,xAxisType:a.AxisType.logarithmic,yAxisType:a.AxisType.logarithmic,invertYAxis:this.activityTarget===h.wf.LOW,xColumnName:O.clusterSizeColName,markerType:"circle",markerDefaultSize:10,showSizeSelector:!1};if(null==this.clusterColumnName||null==this.activityColumnName||!this.dataFrame.columns.contains(this.clusterColumnName)||!this.dataFrame.columns.contains(this.activityColumnName))return this.viewerError="Please set valid cluster and activity columns",null;const n=this.dataFrame.columns.byName(this.activityColumnName),i=this.dataFrame.columns.byName(this.clusterColumnName),r=null!=this.connectivityColumnName?this.dataFrame.columns.byName(this.connectivityColumnName):null;if(![a.COLUMN_TYPE.FLOAT,a.COLUMN_TYPE.INT,a.COLUMN_TYPE.BIG_INT,a.COLUMN_TYPE.QNUM].includes(n.type))return this.viewerError="Activity column should be numeric",null;const o=this.dataFrame.columns.getOrCreate(O.clusterSizeColName,a.TYPE.INT,this.dataFrame.rowCount),l={};for(let e=0;e<this.dataFrame.rowCount;e++){const n=i.get(e);null!=n&&"-1"!=n&&(l[n]=(null!==(t=l[n])&&void 0!==t?t:0)+1)}o.init((t=>{var e;return i.isNone(t)?null:null!==(e=l[i.get(t)])&&void 0!==e?e:null})),n.stats.min<=0&&(e.yAxisType=a.AxisType.linear);const u={},c={};for(let t=0;t<this.dataFrame.rowCount;t++){const e=i.get(t);if(null==e||i.isNone(t)||n.isNone(t))continue;const o=n.get(t),s=u[e];if((null==s||null==s||o>n.get(s)&&this.activityTarget===h.wf.HIGH||o<n.get(s)&&this.activityTarget===h.wf.LOW)&&(u[e]=t),r){const n=r.get(t),i=c[e];(null==i||null==i||n>r.get(i))&&(c[e]=t)}}const d=this.dataFrame.columns.getOrCreate(O.maxActivityInClusterColName,a.COLUMN_TYPE.INT,this.dataFrame.rowCount);d.init((t=>i.isNone(t)?0:t===u[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(O.maxConnectivityInClusterColName,a.COLUMN_TYPE.INT,this.dataFrame.rowCount).init((t=>i.isNone(t)?0:t===c[i.get(t)]?1:0)),this.dataFrame.columns.getOrCreate(O.synSelectionColName,a.TYPE.STRING,this.dataFrame.rowCount).init((t=>{if(i.isNone(t))return null;let e=null;return t===u[i.get(t)]&&(e=O.maxActivityLabel),r&&t===c[i.get(t)]&&(e=e?`${e}, ${O.maxConnectivityLabel}`:O.maxConnectivityLabel),e})),e.xColumnName=O.clusterSizeColName,e.yColumnName=this.activityColumnName,e.filter=this.scFilterQuery,this.viewerError="";const f=a.Viewer.scatterPlot(this.dataFrame,e);this.selectionSubscription&&this.selectionSubscription.unsubscribe(),this.selectionSubscription=f.onDataEvent.pipe((0,M.filter)((t=>"d4-select"==t.type))).subscribe((t=>{var e,n;const r=null!==(n=null===(e=t.bitset)||void 0===e?void 0:e.getSelectedIndexes())&&void 0!==n?n:[],o=this.dataFrame.selection,s=a.BitSet.create(this.dataFrame.rowCount,(t=>1==d.get(t)));s.and(o);for(let t=0;t<r.length;t++){const e=r[t],n=i.get(e);i.isNone(e)||(s.set(e,!0),null!=c[n]&&s.set(c[n],!0))}s.fireChanged();const l=s.getSelectedIndexes();for(const t of l){const e=i.get(t);null!=e&&null!=c[e]&&s.set(c[e],!0)}setTimeout((()=>{this.dataFrame.selection.copyFrom(s,!0),setTimeout((()=>{this.model&&this.model.createAccordion()}),200)}),200)}));const p=()=>{const t=a.BitSet.create(this.dataFrame.rowCount);Object.entries(u).forEach((([e,i])=>{var r;if(null==e||null==i)return;const o=parseInt(e),s=n.get(i),a=null!==(r=l[o])&&void 0!==r?r:l[e];s<this.activityThreshold&&a<this.clusterSizeThreshold||(t.set(i,!0,!1),null!=c[o]&&t.set(c[o],!0,!1))})),t.fireChanged(),this.dataFrame.selection.copyFrom(t,!0)};return this._selsectIcon=s.iconSvg("select-all",(()=>{p()}),"Select 3 Active quadrants"),this._selsectIcon.style.cursor="pointer",this._selsectIcon.style.marginRight="5px",p(),this.linesDrawSubscription&&this.linesDrawSubscription.unsubscribe(),this.linesDrawSubscription=f.onBeforeDrawScene.subscribe((()=>{const t=f.getInfo().canvas.getContext("2d"),e=f.viewport,n=f.worldToScreen(e.x,this.activityThreshold),i=f.worldToScreen(this.clusterSizeThreshold,e.y),r=f.worldToScreen(e.x+e.width,this.activityThreshold),o=f.worldToScreen(this.clusterSizeThreshold,e.y+e.height);t.beginPath(),t.strokeStyle="rgb(0,0,0)",t.lineWidth=1,t.moveTo(n.x,n.y),t.lineTo(r.x,r.y),t.moveTo(i.x,i.y),t.lineTo(o.x,o.y),t.stroke(),t.closePath()})),f}onTableAttached(){var t,e,n,i,r,o,s,a,l,u,c,d;super.onTableAttached();const f=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(h.$2.ACTIVITY))&&void 0!==e?e:null===(i=N()(null===(n=this.dataFrame)||void 0===n?void 0:n.columns.numerical).next())||void 0===i?void 0:i.value;null!=f&&(null===(r=this.getProperty(`activity${h.To}`))||void 0===r||r.set(this,f.name));const p=null===(s=N()(null===(o=this.dataFrame)||void 0===o?void 0:o.columns.categorical).next())||void 0===s?void 0:s.value;null!=p&&(null===(a=this.getProperty(`cluster${h.To}`))||void 0===a||a.set(this,p.name));const m=null===(u=N()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===u?void 0:u.value;null!=m&&(null===(c=this.getProperty(`connectivity${h.To}`))||void 0===c||c.set(this,m.name)),this.render(),null===(d=this.dataFrame)||void 0===d||d.onDataChanged.subscribe((()=>{this.render()}))}render(){this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout((()=>{var t,e;if(!this.dataFrame)return;u()(this.root).empty();const n=this.scViewer;if(null==n)return void this.root.appendChild(s.divText(null!==(t=this.viewerError)&&void 0!==t?t:"Error creating scatter plot"));const i=s.div("Cluster Size",{style:{alignSelf:"center",color:"var(--grey-6)",marginBottom:"5px"}}),r=s.div(this.activityTarget===h.wf.HIGH?"Maximum Activity":"Minimum Activity",{style:{color:"var(--grey-6)",alignSelf:"center",textOrientation:"mixed",writingMode:"tb",transform:"rotate(180deg)",marginLeft:"5px"}});n.props.colorColumnName=null!==(e=this.colorColumnName)&&void 0!==e?e:null,this.root.appendChild(s.divH([r,s.divV([s.divH([this._titleHost,this._selsectIcon],{style:{alignSelf:"center",lineHeight:"normal",width:"100%"}}),n.root,i],{style:{flexGrow:"1"}})])),n.root.style.width="100%",setTimeout((()=>{n.props.filter=this.scFilterQuery,n.invalidateCanvas()}),100)}),this.renderDebounceTime)}onPropertyChanged(t){super.onPropertyChanged(t),(null==t?void 0:t.name)!==`color${h.To}`&&(this._scViewer=null),this.render()}}O.clusterSizeColName="~cluster.size",O.maxActivityInClusterColName="~max.activity.for.cluster",O.maxConnectivityInClusterColName="~max.connectivity.for.cluster",O.synSelectionColName="Syn Selection",O.maxActivityLabel="Max Activity",O.maxConnectivityLabel="Max Connectivity",n(2935);let L,I=null;const R=new a.Package;function P(){return I}function k(){return L}},3657:(t,e,n)=>{"use strict";n.d(e,{Lw:()=>h,eW:()=>p,Ej:()=>d,uz:()=>c});var i=n(6082),r=n(4139);class o{constructor(){const t=navigator.hardwareConcurrency;this._workerCount=Math.max(t-2,1),this._workers=new Array(this._workerCount).fill(null).map((()=>new Worker(new URL(n.p+n.u(216),n.b))))}calc(t,e){return n=this,i=arguments,o=function*(t,e,n={}){var i,r,o;const s=new Map;try{const a=null!==(r=null===(i=n.targetCol)||void 0===i?void 0:i.cat.indexOf(n.currentTarget))&&void 0!==r?r:-1,l=t.length,u=new Array(this._workerCount),c=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,c);const h=c/this._workerCount;e.forEach((t=>{var e;t.cat=null===(e=t.cat)||void 0===e?void 0:e.slice()})),(null===(o=n.targetCol)||void 0===o?void 0:o.cat)&&(n.targetCol.cat=n.targetCol.cat.slice());for(let i=0;i<this._workerCount;i++)u[i]=new Promise(((r,o)=>{const s=Math.floor(i*h),l=i===this._workerCount-1?c:Math.floor((i+1)*h);this._workers[i].postMessage({startIdx:s,endIdx:l,activityArray:t,monomerInfoArray:e,settings:n,currentTargetIdx:a}),this._workers[i].onmessage=({data:{pos:t,seq1Idxs:e,seq2Idxs:n,error:s}})=>{var a;s?(null===(a=this._workers[i])||void 0===a||a.terminate(),o(s)):(this._workers[i].terminate(),r({pos:t,seq1Idxs:e,seq2Idxs:n}))}}));const d=yield Promise.all(u),f=new Map;e.forEach(((t,e)=>{f.set(t.name,e)})),d.filter(Boolean).forEach((t=>{for(let n=0;n<t.pos.length;n++){const i=f.get(t.pos[n]),r=e[i].rawData[t.seq1Idxs[n]],o=e[i].cat[r],a=e[i].rawData[t.seq2Idxs[n]],l=e[i].cat[a];s.has(o)||s.set(o,new Map),s.has(l)||s.set(l,new Map);const u=s.get(o),c=s.get(l);u.has(t.pos[n])||u.set(t.pos[n],new Map),c.has(t.pos[n])||c.set(t.pos[n],new Map);const h=u.get(t.pos[n]),d=c.get(t.pos[n]);h.has(t.seq1Idxs[n])||h.set(t.seq1Idxs[n],[]),d.has(t.seq2Idxs[n])||d.set(t.seq2Idxs[n],[]);const p=h.get(t.seq1Idxs[n]),m=d.get(t.seq2Idxs[n]);p.push(t.seq2Idxs[n]),m.push(t.seq1Idxs[n])}}))}catch(t){this.terminate(),console.error(t)}return s},new((r=void 0)||(r=Promise))((function(t,e){function s(t){try{l(o.next(t))}catch(t){e(t)}}function a(t){try{l(o.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}l((o=o.apply(n,i||[])).next())}));var n,i,r,o}terminate(){var t;null===(t=this._workers)||void 0===t||t.forEach((t=>{try{null==t||t.terminate()}catch(t){console.error(t)}}))}}var s=n(5480),a=n(8774),l=n(5070),u=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function c(t,e){return u(this,arguments,void 0,(function*(t,e,n={}){var i,s;if(0===e.length)throw new Error(`PepAlgorithmError: Couldn't find any column of semType '${r.uF.MONOMER}'`);null!==(i=n.minActivityDelta)&&void 0!==i||(n.minActivityDelta=0),null!==(s=n.maxMutations)&&void 0!==s||(n.maxMutations=1);const a=new o,l=yield a.calc(t,e,n);return a.terminate(),l}))}function h(t,e){const n=new Map;let i=999999,r=-999999,o=2,s=2;for(const u of t.keys()){const c=new Map;n.set(u,c);const h=t.get(u);for(const t of h.keys()){const n=h.get(t),u=new a.A(e.length,!1);if(0===n.size)continue;for(const t of n.keys())u.setFast(t,!0),n.get(t).forEach((t=>u.setFast(t,!0)));const d=(0,l.GT)(e,u);i=Math.min(i,d.meanDifference),r=Math.max(r,d.meanDifference),o=Math.min(o,d.count),s=Math.max(s,d.count),c.set(t,d)}}return{stats:n,minDiff:i,maxDiff:r,minCount:o,maxCount:s}}function d(t,e,n,r={}){var o,s,u,c,h,d;null!==(o=r.isFiltered)&&void 0!==o||(r.isFiltered=!1);const p={general:{}};let m=t.getRawData(),g=t.length;if(r.isFiltered){g=e.trueCount;const t=new Float64Array(g),o=e.getSelectedIndexes();for(let e=0;e<g;++e)t[e]=m[o[e]];m=t,n=i.DataFrame.fromColumns(n).clone(e).columns.toList(),r.target&&(r.target.col=r.target.col.clone(e)),r.aggValue&&(r.aggValue.col=r.aggValue.col.clone(e))}null!==(s=r.columns)&&void 0!==s||(r.columns=n.map((t=>t.name)));const v=null===(c=null===(u=r.target)||void 0===u?void 0:u.col)||void 0===c?void 0:c.getRawData(),y=null===(h=r.target)||void 0===h?void 0:h.col.categories,C=(null===(d=r.target)||void 0===d?void 0:d.cat)?null==y?void 0:y.indexOf(r.target.cat):-1;for(const t of n){if(!r.columns.includes(t.name))continue;const e=t.getRawData(),n=t.categories,i={general:{}};for(let t=0;t<n.length;++t){const o=n[t];if(""===o)continue;const s=new Array(g).fill(!1);for(let n=0;n<g;++n)e[n]!==t||v&&-1!==C&&v[n]!==C||(s[n]=!0);const u=a.A.fromValues(s);if(u.allFalse)continue;const c=(0,l.GT)(m,u,r.aggValue);i[o]=c,f(i.general,c)}p[t.name]=i,f(p.general,null,i.general)}return p}function f(t,e=null,n=null){var i,r,o,s,a,l,u,c,h,d,f,p,m,g,v,y,C;if(null===e&&null===n)throw new Error("MonomerPositionStatsError: either stats or summaryStats must be present");const w=null!==(i=null==e?void 0:e.count)&&void 0!==i?i:n.maxCount;null!==(r=t.maxCount)&&void 0!==r||(t.maxCount=w),t.maxCount<w&&(t.maxCount=w);const b=null!==(o=null==e?void 0:e.count)&&void 0!==o?o:n.minCount;null!==(s=t.minCount)&&void 0!==s||(t.minCount=b),t.minCount>b&&(t.minCount=b);const A=null!==(a=null==e?void 0:e.meanDifference)&&void 0!==a?a:n.maxMeanDifference;null!==(l=t.maxMeanDifference)&&void 0!==l||(t.maxMeanDifference=A),t.maxMeanDifference<A&&(t.maxMeanDifference=A);const E=null!==(u=null==e?void 0:e.meanDifference)&&void 0!==u?u:n.minMeanDifference;if(null!==(c=t.minMeanDifference)&&void 0!==c||(t.minMeanDifference=E),t.minMeanDifference>E&&(t.minMeanDifference=E),!isNaN(null!==(h=null==e?void 0:e.pValue)&&void 0!==h?h:NaN)){const i=null!==(d=null==e?void 0:e.pValue)&&void 0!==d?d:n.maxPValue;null!==(f=t.maxPValue)&&void 0!==f||(t.maxPValue=i),t.maxPValue<i&&(t.maxPValue=i);const r=null!==(p=null==e?void 0:e.pValue)&&void 0!==p?p:n.minPValue;null!==(m=t.minPValue)&&void 0!==m||(t.minPValue=r),t.minPValue>r&&(t.minPValue=r)}const S=null!==(g=null==e?void 0:e.ratio)&&void 0!==g?g:n.maxRatio;null!==(v=t.maxRatio)&&void 0!==v||(t.maxRatio=S),t.maxRatio<S&&(t.maxRatio=S);const T=null!==(y=null==e?void 0:e.ratio)&&void 0!==y?y:n.minRatio;null!==(C=t.minRatio)&&void 0!==C||(t.minRatio=T),t.minRatio>T&&(t.minRatio=T)}function p(t,e,n,i){const r=t.rowCount,o=t.getCol(e),u=o.getRawData(),c=o.categories,h=Array.from({length:c.length},(()=>new a.A(r,!1)));for(let t=0;t<r;++t)h[u[t]].setTrue(t);const d=n.map((t=>a.A.fromUint32Array(r,t.getRawData()))),f=n.map((t=>t.name)),p=i.getRawData(),m={},g={};for(const t of Object.values(s.W)){const e=t===s.W.ORIGINAL?h:d,n=t===s.W.ORIGINAL?c:f,r=t===s.W.ORIGINAL?m:g;for(let t=0;t<e.length;++t){const o=e[t];r[n[t]]=o.allTrue||o.allFalse?{count:o.length,meanDifference:0,ratio:1,pValue:null,mask:o,mean:i.stats.avg}:(0,l.GT)(p,o)}}const v={};return v[s.W.ORIGINAL]=m,v[s.W.CUSTOM]=g,v}},2935:(t,e,n)=>{"use strict";n.d(e,{X5:()=>m,rW:()=>y,k8:()=>C,Yd:()=>v,rI:()=>g,FZ:()=>w});var i,r,o,s=n(7389),a=n(6082),l=n(4139),u=n(2003),c=n(3657),h=n(1858),d=n(912),f=n(5480),p=n(3541);function m(t,e){t.strokeStyle=a.Color.toHtml(a.Color.selectedRows),t.lineWidth=3,t.strokeRect(e.x+1,e.y+1,e.width-1,e.height-1)}function g(t,e,n){t.semType=l.uF.MONOMER,t.setTag(a.TAGS.CELL_RENDERER,l.uF.MONOMER),t.setTag(l.gp.ALPHABET,e),n&&t.setTag(r.applyToBackground,"true")}function v(t,e,n,i,r){var o,s,l,u,c,h,d;const f=r.width/2,g=Math.ceil(r.x+1+f),v=Math.ceil(r.y+1+r.height/2),y=.9*f/2;if(i instanceof p.UJ){const r=i.monomerPositionStats[n],o=r[e].pValue,s=r[e].meanDifference,l=1-r.general.maxPValue,u=1-r.general.minPValue,c=Math.min(l,u),h=l-c,d=u-c,p=Math.max(h,d),m=null===o?0:1-o-c,C=s>=0?m:-m,w=a.Color.toHtml(null===o?a.Color.lightLightGray:a.Color.scaleColor(C,-p,p,255)),b=Math.max(Math.abs(i.monomerPositionStats.general.minMeanDifference),i.monomerPositionStats.general.maxMeanDifference),A=Math.abs(s)/b,E=Math.floor(y*A);t.beginPath(),t.fillStyle=w,t.arc(g-f/2,v,E<3||null===o?3:E,0,2*Math.PI,!0),t.closePath(),t.fill()}else if(i instanceof p.J&&i.mutationCliffs&&i.cliffStats){const r=i.cliffStats.maxCount,u=i.cliffStats.minDiff,c=i.cliffStats.maxDiff,h=null===(l=null===(s=null===(o=i.cliffStats)||void 0===o?void 0:o.stats)||void 0===s?void 0:s.get(e))||void 0===l?void 0:l.get(n);if(h){const e=h.count,n=h.meanDifference,i=Math.floor(Math.abs(e/Math.max(r,2))*y),o=Math.max(Math.abs(u),Math.abs(c)),s=a.Color.toHtml(null===n?a.Color.lightLightGray:a.Color.scaleColor(n,-o,o,255));t.beginPath(),t.fillStyle=s,t.arc(g-f/2,v,i<3||0==e?3:i,0,2*Math.PI,!0),t.closePath(),t.fill()}}t.textBaseline="middle",t.textAlign="end",t.fillStyle="#606060",t.font="13px Roboto, Roboto Local, sans-serif",t.shadowBlur=5,t.shadowColor=a.Color.toHtml(a.Color.white);const C=new Set,w=null!==(d=null===(h=null===(c=null===(u=i.mutationCliffs)||void 0===u?void 0:u.get(e))||void 0===c?void 0:c.get(n))||void 0===h?void 0:h.entries())&&void 0!==d?d:null;if(null!==w)for(const[t,e]of w){C.add(t);for(const t of e)C.add(t)}0!==C.size&&t.fillText(C.size.toString(),g+f-5,v,f-5);const b=i.mutationCliffsSelection[n];b&&b.includes(e)&&m(t,r)}function y(t,e,n,i,r,o,s){s=a.Color.fromHtml(a.Color.toHtml(function(t,e){return(16777215&t|255<<24)>>>0}(s)));let l=r.toFixed(2);l.endsWith(".00")&&(l=r.toFixed(0)),l.endsWith("0")&&l.includes(".")&&(l=r.toFixed(1));const u=Math.min(13,Math.floor(o.width/40/l.length*6*13));t.fillStyle=a.Color.toHtml(s),t.fillRect(o.x,o.y,o.width,o.height),t.font=`${u}px Roboto, Roboto Local, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=a.Color.toHtml(a.Color.getContrastColor(s)),t.fillText(l,o.x+o.width/2,o.y+o.height/2,o.width);const c=i[n];c&&c.includes(e)&&m(t,o)}function C(t,e,n,i){t.font="13px Roboto, Roboto Local, sans-serif",t.textAlign="center",t.textBaseline="middle",t.fillStyle="#000",t.fillText(e.toString(),i.x+i.width/2,i.y+i.height/2,i.width),(n[f.W.CUSTOM].includes(e)||n[f.W.ORIGINAL].includes(e))&&m(t,i)}function w(t,e,n,i,r,o={x:0,y:0,mpStats:{},monomerPosition:{}}){var f;if(null!==(f=r.isSelectionTable)&&void 0!==f||(r.isSelectionTable=!1),0==Object.keys(o.mpStats).length&&(o.mpStats=e),r.isSelectionTable&&(!r.webLogoBounds||!r.cachedWebLogoTooltip))throw new Error("Peptides: Cannot set WebLogo renderer for selection table without `headerSelectedMonomers`, `webLogoBounds` and `cachedWebLogoTooltip` options.");const p=t.dataFrame;t.setOptions({colHeaderHeight:130});t.onCellRender.subscribe((t=>(t=>{var o;const s=t.g,h=t.bounds,d=t.cell.tableColumn;s.save();try{if(s.beginPath(),s.rect(h.x,h.y,h.width,h.height),s.clip(),t.cell.isColHeader&&(null==d?void 0:d.semType)===l.uF.MONOMER){let f;if(p.filter.anyFalse){const t=null!==(o=p.temp[l.gp.M_P_STATS_CACHE])&&void 0!==o?o:{},e=null==t?void 0:t[d.name],r=p.filter.getBuffer();if(t&&e&&e.filter.length===r.length&&e.filter.every(((t,e)=>t===r[e])))f=e.stats[d.name];else{const e=(0,c.Ej)(i,p.filter,n,{isFiltered:!0,columns:[d.name]});f=e[d.name],t[d.name]={filter:p.filter.getBuffer(),stats:e,selection:p.selection.getBuffer()}}p.temp[l.gp.M_P_STATS_CACHE]=t}else f=r.isSelectionTable?(0,c.Ej)(i,p.filter,n,{isFiltered:!0,columns:[d.name]})[d.name]:e[d.name];if(!f)return;const m=Object.keys(f).sort(((t,e)=>""===t||"-"===t?1:""===e||"-"===e?-1:0)).filter((t=>"general"!==t));r.webLogoBounds()[d.name]=function(t,e,n,i,r,o,s,l={},c={}){var h,d,f,p,m,g,v,y,C,w;const b=window.devicePixelRatio;null!==(h=c.symbolStyle)&&void 0!==h||(c.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(d=c.upperLetterHeight)&&void 0!==d||(c.upperLetterHeight=12.2),null!==(f=c.upperLetterAscent)&&void 0!==f||(c.upperLetterAscent=.25),null!==(p=c.marginVertical)&&void 0!==p||(c.marginVertical=1),null!==(m=c.marginHorizontal)&&void 0!==m||(c.marginHorizontal=1),null!==(g=c.selectionWidth)&&void 0!==g||(c.selectionWidth=2),null!==(v=c.textHeight)&&void 0!==v||(c.textHeight=13),null!==(y=c.headerStyle)&&void 0!==y||(c.headerStyle=`bold ${c.textHeight*b}px Roboto, Roboto Local, sans-serif`);const A=(r.length-1)*c.upperLetterAscent;let E=(e.y+c.marginVertical)*b;const S=(e.height-2*c.marginVertical-A-1.25*c.textHeight)*b,T=(e.x+c.marginHorizontal)*b,x=Math.max(c.selectionWidth*b,.05*e.width*b),_=2*c.marginHorizontal+c.selectionWidth,N=(e.width-(_+c.marginHorizontal))*b,M=(e.x+_)*b,O={};for(const e of r){const i=S*(n[e].count/o),r=S*((null!==(C=l[e])&&void 0!==C?C:0)/o);if(O[e]=new a.Rect(M/b,E/b,N/b,i/b),t.resetTransform(),"-"!==e&&""!==e){const n=(0,u.zS)(e,5),o=t.measureText(n);r>0&&(t.lineWidth=x,t.line(T,E,T,E+r,a.Color.rowSelection)),t.fillStyle=null!==(w=s.get(e))&&void 0!==w?w:s.get("other"),t.textAlign="left",t.textBaseline="top",t.font=c.symbolStyle;const l=N/o.width,h=i/c.upperLetterHeight;t.setTransform(l,0,0,h,M,E),t.fillText(n,0,0,o.width)}E+=i+c.upperLetterAscent*b}return t.resetTransform(),t.fillStyle=a.Color.toHtml(a.Color.black),t.textAlign="center",t.textBaseline="top",t.font=c.headerStyle,t.fillText(i,(e.x+e.width/2)*b,(e.y+e.height-c.textHeight)*b),O}(s,h,f,d.name,m,p.filter.trueCount,r.colorPalette(),r.headerSelectedMonomers?r.headerSelectedMonomers()[d.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${d.name}\`. See original error below.`),console.warn(t)}finally{s.restore()}})(t)));const m=n=>{var a;const u=t.hitTest(n.offsetX,n.offsetY);if((null==u?void 0:u.isColHeader)&&(null===(a=u.tableColumn)||void 0===a?void 0:a.semType)===l.uF.MONOMER){const t=function(t,e,n){const i=n[t.tableColumn.name];if(!i)return null;for(const[n,r]of Object.entries(i)){const i=e.offsetX>=r.x&&e.offsetX<=r.x+r.width,o=e.offsetY>=r.y&&e.offsetY<=r.y+r.height;if(i&&o)return{monomerOrCluster:n,positionOrClusterType:t.tableColumn.name}}return null}(u,n,r.webLogoBounds());if(null===t)return void(r.isSelectionTable||null==r.unhighlightCallback||r.unhighlightCallback());o.monomerPosition=t,function(t,e,n,i,r,o){if("click"!==t.type||r.isSelectionTable||null==r.selectionCallback){const a=`${e.positionOrClusterType} = ${e.monomerOrCluster}`;r.cachedWebLogoTooltip().bar===a?s.tooltip.show(r.cachedWebLogoTooltip().tooltip,t.clientX,t.clientY):(r.cachedWebLogoTooltip().bar=a,o.x=t.clientX,o.y=t.clientY,o.monomerPosition=e,r.cachedWebLogoTooltip().tooltip=(0,d.YE)(n,i,[],o))}else r.selectionCallback(e,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey})}(n,t,p,i,r,o),r.isSelectionTable||null==r.highlightCallback||r.highlightCallback(t,p,e)}};h.fromEvent(t.overlay,"mousemove").subscribe((t=>m(t))),h.fromEvent(t.overlay,"click").subscribe((t=>m(t)))}n(9634),function(t){t.maxMonomerLength=".mm.cellRenderer.maxMonomerLength"}(i||(i={})),function(t){t.applyToBackground=".m.cellRenderer.applyToBackground"}(r||(r={})),function(t){t.MSA="MSA",t.classic="classic"}(o||(o={})),new class{constructor(){this.color="rgb(100,100,100)",this.pivot=0,this.left=!1,this.transparencyRate=1,this.separator="",this.last=!1,this.drawStyle=o.classic,this.maxWord=[],this.wordIdx=0,this.gridCell=null,this.referenceSequence=null,this.maxLengthOfMonomer=null,this.monomerTextSizeMap={},this.logger=void 0}},a.GridCellRenderer},4139:(t,e,n)=>{"use strict";n.d(e,{$2:()=>i,To:()=>l,V5:()=>d,YX:()=>h,gp:()=>o,i6:()=>r,rg:()=>u,uF:()=>s,wf:()=>c,zW:()=>f});var i,r,o,s,a=n(6082);!function(t){t.SPLIT_COL="~split",t.ACTIVITY="Activity",t.ACTIVITY_SCALED="Scaled activity",t.MONOMER="AAR",t.POSITION="Pos",t.P_VALUE="pValue",t.MEAN_DIFFERENCE="Mean difference",t.COUNT="Count",t.RATIO="Ratio",t.MEAN="Mean"}(i||(i={})),function(t){t.MEMBERS="Members",t.WEB_LOGO="WebLogo",t.DISTRIBUTION="Distribution",t.MEAN_DIFFERENCE="Mean difference",t.P_VALUE="P-Value",t.RATIO="Ratio",t.CLUSTER="Cluster"}(r||(r={})),function(t){t.MONOMER="monomer",t.POSITION="pos",t.SEPARATOR="separator",t.SELECTION="selection",t.MUTATION_CLIFFS_SELECTION="mutationCliffsSelection",t.ALPHABET="alphabet",t.FILTER="filter",t.INVARIANT_MAP_SELECTION="invariantMapSelection",t.SAR_MODE="sarMode",t.CLUSTER_SELECTION="clusterSelection",t.VISIBLE="visible",t.SETTINGS="settings",t.CUSTOM_CLUSTER="customCluster",t.MONOMER_POSITION_MODE="monomerPositionMode",t.MULTIPLE_VIEWS="isMultipleViews",t.IDENTITY_TEMPLATE="Identity template",t.SIMILARITY_TEMPLATE="Similarity template",t.ANALYSIS_COL="isAnalysisCol",t.POSITION_COL="isPositionCol",t.M_P_STATS_CACHE=".MPStatsCache",t.INVARIANT_MAP_COLOR_CACHE=".InvariantMapColorCache",t.INVARIANT_MAP_COLOR_MAX_CACHE=".InvariantMapColorMaxCache",t.INVARIANT_MAP_COLOR_MIN_CACHE=".InvariantMapColorMinCache"}(o||(o={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference"}(s||(s={}));const l="ColumnName";var u,c,h;!function(t){t.NONE="none",t.LG="lg",t.MINUS_LG="-lg"}(u||(u={})),function(t){t.HIGH="High",t.LOW="Low"}(c||(c={})),function(t){t.LST="lst-",t.MP="mp-",t.MPR="mpr-",t.WL="wl-"}(h||(h={}));const d=Object.values(a.AGG).filter((t=>![a.AGG.FIRST,a.AGG.KEY,a.AGG.PIVOT,a.AGG.SELECTED_ROWS_COUNT].includes(t))),f={[a.AGG.TOTAL_COUNT]:"totalCount",[a.AGG.VALUE_COUNT]:"valueCount",[a.AGG.UNIQUE_COUNT]:"uniqueCount",[a.AGG.MISSING_VALUE_COUNT]:"missingValueCount",[a.AGG.MIN]:"min",[a.AGG.MAX]:"max",[a.AGG.SUM]:"sum",[a.AGG.MED]:"med",[a.AGG.AVG]:"avg",[a.AGG.STDEV]:"stdev",[a.AGG.VARIANCE]:"variance",[a.AGG.SKEW]:"skew",[a.AGG.KURT]:"kurt",[a.AGG.Q1]:"q1",[a.AGG.Q2]:"q2",[a.AGG.Q3]:"q3"}},8608:(t,e,n)=>{"use strict";n.d(e,{$s:()=>T,AN:()=>i,AY:()=>h,B2:()=>N,BE:()=>y,CD:()=>w,F2:()=>m,FZ:()=>g,KT:()=>S,Y1:()=>d,ZR:()=>E,dl:()=>A,eY:()=>p,qI:()=>x,qx:()=>f,sg:()=>M,vW:()=>b,vY:()=>C,zm:()=>_,zz:()=>v});var i,r=n(7389),o=n(6082),s=n(4139),a=n(8774),l=n(144),u=n.n(l),c=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};function h(t){var e;return null!==(e=t.getTag(s.gp.SEPARATOR))&&void 0!==e?e:""}function d(t,e=s.rg.NONE){let n=t=>t;switch(e){case s.rg.NONE:break;case s.rg.LG:n=t=>Math.log10(t);break;case s.rg.MINUS_LG:n=t=>-Math.log10(t);break;default:throw new Error(`ScalingError: method \`${e}\` is not available.`)}const i=t.getRawData(),r=o.Column.float(s.$2.ACTIVITY,t.length).init((t=>{const e=i[t];return e===o.FLOAT_NULL||e===o.INT_NULL?e:n(e)}));return r.setTag(s.gp.ANALYSIS_COL,"true"),r.setTag(o.TAGS.FORMULA,e),r}function f(t){var e,n,i,r;const o=t.columns.bySemTypeAll(s.uF.MONOMER),a={},l=t.filter.clone().and(t.selection).getSelectedIndexes();for(const t of l)for(const s of o){const o=s.get(t);o&&(null!==(e=a[i=s.name])&&void 0!==e||(a[i]={}),null!==(n=(r=a[s.name])[o])&&void 0!==n||(r[o]=0),a[s.name][o]+=1)}return a}function p(t){return{name:t.name,cat:t.categories,rawData:t.getRawData()}}function m(t,e,n={}){var a;const l=t.dataFrame.getCol(s.$2.SPLIT_COL),u=[],c=l.categories,h=l.getRawData();for(let t=0;t<c.length;++t){if(!Object.values(i).includes(c[t]))continue;const e=o.Color.toHtml(l.meta.colors.getColor(h.indexOf(t))),s=r.label(null!==(a=n[c[t]])&&void 0!==a?a:c[t],{style:{color:e}});u.push(s)}const d=r.divV([r.divV(u),t.root,r.tableFromMap(e)]);return t.root.style.maxHeight="75px",d}function g(t,e,n){var r,a;const l=null!==(r=null==n?void 0:n.clone().xor(e).anyTrue)&&void 0!==r&&r,u=t.length,c=t.getRawData(),h=new Float32Array(u+e.trueCount+(l&&null!==(a=null==n?void 0:n.trueCount)&&void 0!==a?a:0)),d=new Array(h.length);for(let t=0,r=0,o=0;t<u;++t){const s=e.get(t);h[t]=c[t],d[t]=s?i.SELECTION:i.ALL,s&&(h[u+r]=c[t],d[u+r]=i.ALL,++r),l&&(null==n?void 0:n.get(t))&&(h[u+e.trueCount+o]=c[t],d[u+e.trueCount+o]=i.PEPTIDES_SELECTION,++o)}const f=o.Column.fromStrings(s.$2.SPLIT_COL,d),p=[i.ALL,i.SELECTION];return l&&p.push(i.PEPTIDES_SELECTION),f.setCategoryOrder(p),f.meta.colors.setCategorical(),o.DataFrame.fromColumns([o.Column.fromFloat32Array(s.$2.ACTIVITY,h),f])}function v(t){const e=r.iconFA("expand-alt",(()=>{const e=t.dataFrame.plot.grid();C(e,!1),e.root.style.height="100%";const n=r.dialog(t.dataFrame.name);n.add(e.root),n.showModal(!0),e.invalidate()}));t.root.appendChild(e),e.style.position="absolute",e.style.right="0px",e.style.top="0px",e.style.visibility="hidden",t.root.addEventListener("mouseenter",(t=>{e.style.visibility="visible"})),t.root.addEventListener("mouseleave",(t=>{e.style.visibility="hidden"}))}function y(t,e,n,i){const o=r.iconFA("expand-alt",(()=>{const e=i(),n=r.dialog(t);n.add(e),n.showModal(!0)}),"Expand to full screen");o.style.marginLeft="auto",o.style.marginRight="15px",n.addEventListener("mouseenter",(()=>{o.style.visibility="visible"})),n.addEventListener("mouseleave",(()=>{o.style.visibility="hidden"})),e.appendChild(o)}function C(t,e=!0){t.props.allowEdit=!1,t.props.showReadOnlyNotifications=!1,t.props.allowRowSelection=!1,t.props.allowBlockSelection=!1,t.props.allowColSelection=!1,t.props.showRowHeader=!1,t.props.showCurrentRowIndicator=!1,t.root.style.width="100%",t.root.style.maxWidth="100%",e&&t.autoSize(1e3,175,0,0,!0)}function w(t){for(const e of Object.values(t))if(0!==e.length)return!1;return!0}function b(t,e,n){const i=t[e.positionOrClusterType],r=i.indexOf(e.monomerOrCluster);if(n.shiftPressed&&n.ctrlPressed)-1!==r&&i.splice(r,1);else if(n.ctrlPressed)-1===r?i.push(e.monomerOrCluster):i.splice(r,1);else if(n.shiftPressed)-1===r&&i.push(e.monomerOrCluster);else{const n=Object.keys(t);t={};for(const i of n)t[i]=[],i===e.positionOrClusterType&&t[i].push(e.monomerOrCluster)}return t}function A(t,e,n){if(!e)return;const i=new a.A(e.rowCount);if(t.positionOrClusterType===s.$2.MONOMER){const e=Object.values(n);for(const n of e){const e=n[t.monomerOrCluster];void 0!==e&&i.or(e.mask)}}else{const e=n[t.positionOrClusterType];if(void 0!==e){const n=e[t.monomerOrCluster];void 0!==n&&i.or(n.mask)}}e.rows.highlight((t=>i.getBit(t)))}function E(t){const e={};for(const n of t)e[n.name]=[];return e}function S(t,e){let n=null;const i=Object.entries(t);for(const[t,r]of i){const i=e[t];for(const t of r){const e=i[t];e&&(null!=n||(n=new a.A(e.mask.length,!1)),n.or(e.mask))}}return null!=n?o.BitSet.fromBytes(n.buffer.buffer,n.length):null}function T(t,e){return t.sequenceColumnName===e.sequenceColumnName&&t.activityColumnName===e.activityColumnName&&t.activityScaling===e.activityScaling}function x(t,e){var n;const i={};for(const[r,o]of t)for(const[t,s]of o){null!==(n=i[t])&&void 0!==n||(i[t]={});const o=new a.A(e,!1);for(const[t,e]of s){o.setTrue(t);for(const t of e)o.setTrue(t)}i[t][r]={mask:o}}return i}function _(t,e,n,i){const r=Object.entries(n),o=i?Object.entries(i).filter((t=>!e.includes(t[0])||n[t[0]]!==t[1])):[];return r.concat(o).filter((e=>t.columns.contains(e[0])&&t.col(e[0]).matches("numerical")))}function N(t,e=2){return t.columns.bySemTypeAll(o.SEMTYPE.MACROMOLECULE).length>0&&u()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function M(t,e=500){let n;return(...i)=>c(this,void 0,void 0,(function*(){return new Promise((r=>{clearTimeout(n),n=setTimeout((()=>r(t(...i))),e)}))}))}!function(t){t.SELECTION="Selection",t.ALL="All",t.PEPTIDES_SELECTION="Peptides selection"}(i||(i={}))},5070:(t,e,n)=>{"use strict";n.d(e,{hX:()=>s,I_:()=>u,m2:()=>c,lh:()=>l,GT:()=>a,J1:()=>h});var i=n(6082),r=n(6572),o=n(4139);const s=(t,e)=>`${t}(${e})`;function a(t,e,n){var o;if(t.length!==e.length&&t.some(((t,n)=>n>=e.length&&0!==t)))throw new Error("PeptidesError: Data and bit array have different lengths");const s=new Float32Array(e.trueCount()),a=new Float32Array(e.falseCount());let l;if(n)try{l=null===(o=i.DataFrame.fromColumns([n.col]).clone(i.BitSet.fromBytes(e.buffer.buffer,e.length)).col(n.col.name))||void 0===o?void 0:o.aggregate(n.type)}catch(t){console.error(t)}let u=0,c=0;for(let n=0;n<e.length;++n)e.getBit(n)?s[u++]=t[n]:a[c++]=t[n];const h=s.reduce(((t,e)=>t+e),0)/Math.max(s.length,1);if(s.length<2||a.length<2){const t=a.reduce(((t,e)=>t+e),0)/Math.max(a.length,1);return{count:s.length,pValue:null,mean:h,meanDifference:h-t,ratio:s.length/e.length,mask:e,aggValue:l}}const d=function(t,e,n=!1,i=!1){if(t.length<=1||e.length<=1)throw new Error(`StatisticsError: Wrong sample size; expected at least 2, got ${Math.min(t.length,e.length)})`);const o=r.mean(t),s=r.mean(e),a=r.variance(t),l=r.variance(e),u=t.length,c=e.length;let h,d,f;if(n){const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e);d=r.normal.pdf(n,0,1),h=1-d,f=2*(d<h?d:h)}else if(i){const t=u+c-2,e=(a*(u-1)+l*(c-1))/t,n=Math.sqrt(u*c/(u+c))*(o-s)/e;h=1-r.studentt.cdf(n,t),d=r.studentt.cdf(n,t),f=2*(d<h?d:h)}else{const t=a/u,e=l/c,n=(o-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(u-1)+Math.pow(e,2)/(c-1));d=r.studentt.cdf(n,i),h=1-d,f=2*(d<h?d:h)}return{"p-value":f,"Mean difference":o-s,"p-value more":h,"p-value less":d}}(s,a),f=d["Mean difference"];return{count:s.length,pValue:d[f>=0?"p-value more":"p-value less"],mean:h,meanDifference:f,ratio:s.length/e.length,mask:e,aggValue:l}}function l(t,e,n){const r=o.zW[e],s=i.Stats.fromColumn(t,n);if(!(r in s))throw new Error(`Aggregation type ${r} is not supported`);return s[r]}function u(t,e,n={}){var i,r;null!==(i=n.filterDf)&&void 0!==i||(n.filterDf=!1),null!==(r=n.fractionDigits)&&void 0!==r||(n.fractionDigits=3);const o=n.filterDf&&t.filter.anyFalse?t.clone(t.filter):t,a={};for(const[t,i]of e){const e=s(i,t),r=l(o.getCol(t),i,n.mask);a[e]=r.toFixed(n.fractionDigits)}return a}function c(t,e,n,i){var r;null!==(r=i.fractionDigits)&&void 0!==r||(i.fractionDigits=3);const o={};for(const[r,a]of n){const n=s(a,r),l=t.get(n,e);o[n]=l.toFixed(i.fractionDigits)}return o}function h(t,e,n){var r;const o=t.col(e.substring(5,e.length-1));if(!o||!o.matches("categorical"))return"{}";null!=n||(n=i.BitSet.create(t.rowCount,(()=>!0)));const s=o.getRawData(),a=new Map;for(let t=-1;-1!==(t=n.findNext(t,!0));)a.set(s[t],(null!==(r=a.get(s[t]))&&void 0!==r?r:0)+1);const l={};for(const[t,e]of a)l[o.categories[t]]=e;return JSON.stringify(l)}},912:(t,e,n)=>{"use strict";n.d(e,{DK:()=>d,YE:()=>f,cr:()=>h});var i=n(7389),r=n(4328),o=n(6082),s=n(4139),a=n(7654),l=n(8608),u=n(3273),c=n(5070);function h(t,e,n){const o=[],s=t.toLowerCase(),a=(0,u.getMonomerWorksInstance)(),l=null==a?void 0:a.getCappedRotatedMonomer("PEPTIDE",t);if(l){o.push(i.div(s));const t={autoCrop:!0,autoCropMargin:0,suppressChiralText:!0};o.push(r.chem.svgMol(l,void 0,void 0,t))}else{if(""===t)return!0;o.push(i.div(t))}return i.tooltip.show(i.divV(o),e,n),!0}function d(t,e,n,i){var r,o,a;return null!==(r=i.fromViewer)&&void 0!==r||(i.fromViewer=!1),null!==(o=i.isMutationCliffs)&&void 0!==o||(i.isMutationCliffs=!1),null!==(a=i.isMostPotentResidues)&&void 0!==a||(i.isMostPotentResidues=!1),i.monomerPosition.positionOrClusterType===s.$2.MONOMER?h(i.monomerPosition.monomerOrCluster,i.x,i.y):f(t,e,n,i),!0}function f(t,e,n,r){var s,u,h,d,f,p,m;if(null!==(s=r.fromViewer)&&void 0!==s||(r.fromViewer=!1),null!==(u=r.isMutationCliffs)&&void 0!==u||(r.isMutationCliffs=!1),null!==(h=r.isMostPotentResidues)&&void 0!==h||(r.isMostPotentResidues=!1),r.cliffStats&&r.isMutationCliffs){const s=null===(p=null===(f=r.cliffStats)||void 0===f?void 0:f.get(r.monomerPosition.monomerOrCluster))||void 0===p?void 0:p.get(r.monomerPosition.positionOrClusterType);if(!s)return null;const u=o.BitSet.fromBytes(s.mask.buffer.buffer,e.length),h=(0,a.M1)((0,l.FZ)(e,u),!0),d=(0,a.QD)(s);r.fromViewer&&(d["Mean difference"]=`${d["Mean difference"]} (Color)`,d.Count&&(d.Count=`${d.Count} (Size)`));const g=null!==(m=r.aggrColValues)&&void 0!==m?m:(0,c.I_)(t,n,{mask:u}),v=Object.assign(Object.assign({},d),g),y=(0,l.F2)(h,v);return i.tooltip.show(y,r.x,r.y),y}{const s=r.mpStats[r.monomerPosition.positionOrClusterType][r.monomerPosition.monomerOrCluster];if(!(null==s?void 0:s.count))return null;const u=o.BitSet.fromBytes(s.mask.buffer.buffer,e.length),h=(0,a.M1)((0,l.FZ)(e,u),!0),f=(0,a.QD)(s);r.fromViewer&&(f["Mean difference"]=`${f["Mean difference"]}${r.isMostPotentResidues?" (size)":""}`,f["p-value"]&&(f["p-value"]=`${f["p-value"]}${r.isMostPotentResidues?" (color)":""}`));const p=null!==(d=r.aggrColValues)&&void 0!==d?d:(0,c.I_)(t,n,{mask:u}),m=Object.assign(Object.assign({},f),p),g=(0,l.F2)(h,m);return i.tooltip.show(g,r.x,r.y),g}}},115:(t,e,n)=>{"use strict";n.d(e,{GI:()=>a,Ku:()=>o,av:()=>s});var i=n(4572),r=n(4329);const o="WebGPU is not supported on this device";class s{constructor(){this.maxIterations=16,this.inflation=1.4,this.threshold=70,this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.fingerprintType="Morgan",this.useWebGPU=!1,this.minClusterSize=5,this.webGPUDescription=o,this.webGPUDescriptionPromise=(0,r._)().then((t=>{t&&(this.webGPUDescription=t)}))}}class a{constructor(t){this.distanceF=i.Z.NEEDLEMANN_WUNSCH,this.gapOpen=1.5,this.gapExtend=.2,this.clusterEmbeddings=!0,this.epsilon=.01,this.minPts=4,this.fingerprintType="Morgan",this.clusterEmbeddings=!!t}}},5480:(t,e,n)=>{"use strict";n.d(e,{W:()=>A,s:()=>S});var i=n(7389),r=n(4328),o=n(6082),s=n(7233),a=n.n(s),l=n(9484),u=n(4139),c=n(2935),h=n(4326),d=n(5070),f=n(144),p=n.n(f),m=n(7654),g=n(8608),v=n(8774),y=n(3273),C=n(3657),w=n(3077);const b=(t,e)=>`${t}(${e})`;var A,E;!function(t){t.ORIGINAL="original",t.CUSTOM="custom"}(A||(A={})),function(t){t.GENERAL="General",t.STYLE="WebLogo",t.AGGREGATION="Aggregation"}(E||(E={}));class S extends o.JsViewer{constructor(){super(),this._titleHost=i.divText(l.q.LOGO_SUMMARY_TABLE,{id:"pep-viewer-title"}),this.bitsets=[],this.keyPress=!1,this.currentRowIndex=null,this._scaledActivityColumn=null,this._viewerGrid=null,this._clusterStats=null,this._clusterSelection=null,this._logoSummaryTable=null,this._positionColumns=null,this.sequenceColumnName=this.column("sequence",{category:E.GENERAL,nullable:!1}),this.clustersColumnName=this.column("clusters",{category:E.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:E.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",u.rg.NONE,{category:E.GENERAL,choices:Object.values(u.rg)}),this.webLogoMode=this.string("webLogoMode",h.fH.Entropy,{choices:[h.fH.full,h.fH.Entropy],category:E.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:E.STYLE}),this.columns=this.columnList("columns",[],{category:E.AGGREGATION}),this.aggregation=this.string("aggregation",o.AGG.AVG,{category:E.AGGREGATION,choices:u.V5})}get model(){return l.i.getInstance(this.dataFrame)}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createLogoSummaryTableGrid()),this._viewerGrid}get clusterStats(){var t;return null!==(t=this._clusterStats)&&void 0!==t||(this._clusterStats=(0,C.eW)(this.dataFrame,this.clustersColumnName,this.customClusters.toArray(),this.getScaledActivityColumn())),this._clusterStats}get clusterSelection(){var t;const e=this.dataFrame.getTag(u.gp.CLUSTER_SELECTION);return null!==(t=this._clusterSelection)&&void 0!==t||(this._clusterSelection=null===e?this.initClusterSelection({notify:!1}):JSON.parse(e)),this._clusterSelection}set clusterSelection(t){this._clusterSelection=t,this.dataFrame.setTag(u.gp.CLUSTER_SELECTION,JSON.stringify(t)),this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),this.model.analysisView.grid.invalidate()}get logoSummaryTable(){var t;return null!==(t=this._logoSummaryTable)&&void 0!==t||(this._logoSummaryTable=this.createLogoSummaryTable()),this._logoSummaryTable}set logoSummaryTable(t){this._logoSummaryTable=t}get positionColumns(){var t,e,n,i;if(null!=this._positionColumns)return this._positionColumns;const r=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)&&(this._positionColumns=this.model.positionColumns),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(i=null!==(n=r(l.q.SEQUENCE_VARIABILITY_MAP))&&void 0!==n?n:r(l.q.MOST_POTENT_RESIDUES))&&void 0!==i?i:(0,w.R)(this.dataFrame.getCol(this.sequenceColumnName)).columns.toList()),this._positionColumns}get isClusterSelectionEmpty(){return 0===this.clusterSelection[A.ORIGINAL].length+this.clusterSelection[A.CUSTOM].length}get customClusters(){const t={};return t[u.gp.CUSTOM_CLUSTER]="1",p()(this.dataFrame.columns.byTags(t))}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,g.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?o.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.filter).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}onTableAttached(){var t,e,n;if(super.onTableAttached(),(0,g.B2)(this.dataFrame))null===(t=this.getProperty(`sequence${u.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(o.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${u.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`clusters${u.To}`))||void 0===n||n.set(this,p()(this.dataFrame.columns.categorical).next().value.name);else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";r.log.error(t),r.shell.warning(t)}this.render()}detach(){this.subs.forEach((t=>t.unsubscribe()))}render(){if(a()(this.root).empty(),null==this.clustersColumnName||null==this.sequenceColumnName||null==this.activityColumnName)return void this.root.appendChild(i.divText("Please, select a sequence, cluster and activity columns in the viewer properties"));if(!this.logoSummaryTable.filter.anyTrue){const t=i.divText("No clusters to satisfy the threshold. Please, lower the threshold in viewer proeperties to include clusters");return void this.root.appendChild(i.divV([this._titleHost,t]))}const t=i.iconFA("expand-alt",(()=>{const t=i.dialog("Logo Summary Table");t.add(this.viewerGrid.root),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Logo Summary Table in full screen");a()(t).addClass("pep-help-icon"),this.viewerGrid.root.style.width="auto",this.root.appendChild(i.divV([i.divH([this._titleHost,t],{style:{alignSelf:"center",lineHeight:"normal"}}),this.viewerGrid.root])),this.viewerGrid.invalidate()}onPropertyChanged(t){super.onPropertyChanged(t);let e=!1;switch(t.name){case"membersRatioThreshold":this.logoSummaryTable.filter.anyTrue||(e=!0),this.updateFilter();break;case`sequence${u.To}`:this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`clusters${u.To}`:this._clusterStats=null,this._clusterSelection=null,this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`activity${u.To}`:case"activityScaling":this._scaledActivityColumn=null,this._viewerGrid=null,this._clusterStats=null,this._logoSummaryTable=null,e=!0;break;case"columns":case"aggregation":this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case"webLogoMode":this.viewerGrid.invalidate()}e&&this.render()}initClusterSelection(t={}){var e;null!==(e=t.notify)&&void 0!==e||(t.notify=!0);const n={};return n[A.ORIGINAL]=[],n[A.CUSTOM]=[],t.notify?this.clusterSelection=n:this._clusterSelection=n,this.clusterSelection}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,g.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}getStringAggregatedColumns(){return this.columns.filter((t=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("categorical"))).map((t=>`dist(${t})`))}createLogoSummaryTable(){var t,e,n;const i=this.clustersColumnName,r=this.dataFrame.filter.anyFalse,s=r?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,a=s.columns,l=s.rowCount,c=this.getScaledActivityColumn(r).getRawData(),h=s.getCol(i),f=h.getRawData(),m=h.categories,g={};g[u.gp.CUSTOM_CLUSTER]="1";const y=p()(a.byTags(g)).filter((t=>t.max>0)).toArray(),C=o.DataFrame.create(y.length),w=C.columns,E=w.addNewString(u.i6.CLUSTER),S=w.addNewInt(u.i6.MEMBERS).getRawData(),T=w.addNewString(u.i6.WEB_LOGO),x=w.addNewString(u.i6.DISTRIBUTION),_=w.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),N=w.addNewFloat(u.i6.P_VALUE).getRawData(),M=w.addNewFloat(u.i6.RATIO).getRawData();let O=s.groupBy([i]);const L=this.getTotalViewerAggColumns(),I=this.getStringAggregatedColumns(),R=I.map((t=>w.addNewString(t))),P=L.map((([t,e])=>b(e,t))),k=new Array(P.length+I.length),D=L.map((([t,e])=>[s.getCol(t),e]));for(let t=0;t<L.length;++t){const[e,n]=L[t];O=O.add(n,e,P[t]);const i=w.addNewFloat(P[t]);k[t]=i.getRawData()}const G=new Array(y.length);for(let e=0;e<y.length;++e){const n=y[e];E.set(e,n.name);const i=v.A.fromUint32Array(l,n.getRawData());if(i.allFalse)continue;const a=o.BitSet.fromBytes(i.buffer.buffer,l),u=r?(0,d.GT)(c,i):this.clusterStats[A.CUSTOM][n.name];S[e]=u.count,G[e]=a,_[e]=u.meanDifference,N[e]=null!==(t=u.pValue)&&void 0!==t?t:o.FLOAT_NULL,M[e]=u.ratio;for(let t=0;t<P.length;++t){const[n,i]=D[t];k[t][e]=(0,d.lh)(n,i,a)}for(let t=P.length;t<k.length;++t){const n=I[t-P.length];R[t-P.length].set(e,(0,d.J1)(s,n,a))}}T.setTag(o.TAGS.CELL_RENDERER,"html"),x.setTag(o.TAGS.CELL_RENDERER,"html");const U=O.aggregate(),V=U.rowCount,F=U.columns;let H=U.getCol(i);H.name=u.i6.CLUSTER,H.type!==o.COLUMN_TYPE.STRING&&(U.columns.replace(H,H.convertTo(o.COLUMN_TYPE.STRING)),H=U.getCol(H.name));const B=H.categories,q=F.addNewInt(u.i6.MEMBERS).getRawData(),Y=F.addNewString(u.i6.WEB_LOGO),$=F.addNewString(u.i6.DISTRIBUTION),j=F.addNewFloat(u.i6.MEAN_DIFFERENCE).getRawData(),W=F.addNewFloat(u.i6.P_VALUE).getRawData(),z=F.addNewFloat(u.i6.RATIO).getRawData(),K=I.map((t=>F.addNewString(t))),Q=new Array(V),X=Array.from({length:V},(()=>new v.A(l,!1)));for(let t=0;t<l;++t){const n=m[f[t]];null===(e=X[B.indexOf(n)])||void 0===e||e.setTrue(t)}for(let t=0;t<V;++t){const e=X[t];if(e.allFalse)continue;const i=o.BitSet.fromBytes(e.buffer.buffer,l),a=r?(0,d.GT)(c,e):this.clusterStats[A.ORIGINAL][B[t]];for(let e=0;e<I.length;++e){const n=I[e];K[e].set(t,(0,d.J1)(s,n,i))}q[t]=a.count,Q[t]=i,j[t]=a.meanDifference,W[t]=null!==(n=a.pValue)&&void 0!==n?n:o.FLOAT_NULL,z[t]=a.ratio}Y.setTag(o.TAGS.CELL_RENDERER,"html"),$.setTag(o.TAGS.CELL_RENDERER,"html");const J=U.append(C);return this.bitsets=Q.concat(G),I.forEach((t=>J.col(t).semType="lst-pie-chart")),J}createLogoSummaryTableGrid(){const t=this.dataFrame.filter.anyFalse,e=t?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,n=this.getTotalViewerAggColumns().map((([t,e])=>b(e,t))),s=this.logoSummaryTable.plot.grid();s.sort([u.i6.MEMBERS],[!1]),this.updateFilter(),s.col(u.i6.CLUSTER).visible=!0,s.columns.setOrder([u.i6.CLUSTER,u.i6.MEMBERS,u.i6.WEB_LOGO,...this.getStringAggregatedColumns(),u.i6.DISTRIBUTION,u.i6.MEAN_DIFFERENCE,u.i6.P_VALUE,u.i6.RATIO,...n]),s.columns.rowHeader.visible=!1,s.props.rowHeight=55;const d=new o.LruCache,f=new o.LruCache,p=this.positionColumns.length,m=s.columns.byName(u.i6.WEB_LOGO);m.cellType="html",m.width=350;const v=this.getScaledActivityColumn(t),C=e.getCol(this.sequenceColumnName);s.onCellRender.subscribe((t=>{return e=this,n=void 0,r=function*(){var e,n,i;const r=t.cell,s=r.tableRowIndex;if(!r.isTableCell||null==s||-1===s)return;const l=t.g,m=t.bounds;l.save(),l.beginPath(),l.rect(m.x,m.y,m.width,m.height),l.clip();try{const y=Math.max(r.bounds.height-2,0),w=this.bitsets[s];if((null===(e=r.tableColumn)||void 0===e?void 0:e.name)===u.i6.CLUSTER)c.k8(l,r.cell.value,this.clusterSelection,m),t.preventDefault();else if((null===(n=r.tableColumn)||void 0===n?void 0:n.name)===u.i6.WEB_LOGO){const e=Math.floor((r.bounds.width-2-4*(p-1))/p);let n=d.get(s);if(void 0!==n){const t=n.getProperties();for(const i of t)"positionHeight"===i.name&&i.get(n)!==this.webLogoMode?i.set(n,this.webLogoMode):"positionWidth"===i.name&&i.get(n)!==e?i.set(n,e):"minHeight"===i.name&&i.get(n)!==y&&i.set(n,y);a()(n.root).css("height",`${y}px`).children().first().css("overflow-y","hidden !important")}else{const t=this.createWebLogoDf(C,w);n=yield t.plot.fromType("WebLogo",{positionHeight:this.webLogoMode,horizontalAlignment:h.P4.LEFT,maxHeight:1e3,minHeight:y,positionWidth:e,showPositionLabels:!1}),d.set(s,n)}n.root.style.height=`${y}px`,r.element=n.root,t.preventDefault()}else if((null===(i=r.tableColumn)||void 0===i?void 0:i.name)===u.i6.DISTRIBUTION){let e=f.get(s);void 0===e&&(e=(0,g.FZ)(v,w).plot.histogram({filteringEnabled:!1,valueColumnName:v.name,splitColumnName:u.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!1,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:o.Color.toHtml(o.Color.white),xAxisHeight:1,showSplitSelector:!1}),e.root.style.width="auto",f.set(s,e)),e.root.style.height=`${y}px`,r.element=e.root,t.preventDefault()}}finally{l.restore()}},new((i=void 0)||(i=Promise))((function(t,o){function s(t){try{l(r.next(t))}catch(t){o(t)}}function a(t){try{l(r.throw(t))}catch(t){o(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(s,a)}l((r=r.apply(e,n||[])).next())}));var e,n,i,r})),s.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),o.debounce(s.onCurrentCellChanged,500).subscribe((t=>{var e;if(t.isTableCell)try{if(!this.keyPress||(null===(e=t.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;null!==this.currentRowIndex&&-1!==this.currentRowIndex&&this.modifyClusterSelection(this.getCluster(s.cell(u.i6.CLUSTER,this.currentRowIndex)),{shiftPressed:!0,ctrlPressed:!0},!1),this.modifyClusterSelection(this.getCluster(t),{shiftPressed:!0,ctrlPressed:!1}),s.invalidate()}finally{this.keyPress=!1,this.currentRowIndex=t.gridRow}})),s.root.addEventListener("keydown",(t=>{if(this.keyPress=t.key.startsWith("Arrow"),!this.keyPress){if("Escape"===t.key||"KeyA"===t.code&&t.shiftKey&&t.ctrlKey)this.initClusterSelection({notify:!1});else if("KeyA"===t.code&&t.ctrlKey)for(let t=0;t<this.logoSummaryTable.rowCount;++t)this.modifyClusterSelection(this.getCluster(s.cell(u.i6.CLUSTER,t)),{shiftPressed:!0,ctrlPressed:!1},!1);this.model.fireBitsetChanged(l.q.LOGO_SUMMARY_TABLE),s.invalidate()}})),s.root.addEventListener("click",(t=>{var e;const n=s.hitTest(t.offsetX,t.offsetY);if(!n||!n.isTableCell||(null===(e=n.tableColumn)||void 0===e?void 0:e.name)!==u.i6.CLUSTER)return;const o=this.getCluster(n);this.modifyClusterSelection(o,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),s.invalidate(),y._package.files.readAsText("help/logo-summary-table.md").then((t=>{r.shell.windows.help.showHelp(i.markdown(t))})).catch((t=>r.log.error(t)))})),s.onCellTooltip(((t,e,n)=>{var i;if(!t.isTableCell)return this.model.unhighlight(),!0;const r=this.getCluster(t);return this.highlightCluster(r),(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===u.i6.CLUSTER&&this.showTooltip(r,e,n),!0}));const w=s.props;return w.allowEdit=!1,w.allowRowSelection=!1,w.allowBlockSelection=!1,w.allowColSelection=!1,w.showCurrentRowIndicator=!1,w.showReadOnlyNotifications=!1,s}highlightCluster(t){const e=this.clusterStats[t.positionOrClusterType][t.monomerOrCluster].mask;this.dataFrame.rows.highlight((t=>e.getBit(t))),this.model.isHighlighting=!0}getCluster(t){const e=this.logoSummaryTable.get(u.i6.CLUSTER,t.tableRowIndex);return{positionOrClusterType:this.dataFrame.getCol(this.clustersColumnName).categories.includes(e)?A.ORIGINAL:A.CUSTOM,monomerOrCluster:e}}updateFilter(){const t=this.logoSummaryTable.getCol(u.i6.MEMBERS),e=this.logoSummaryTable.getCol(u.i6.CLUSTER),n=e.getRawData(),i=e.categories,r=i.indexOf("-1"),o=t.getRawData();let s=0;o.forEach(((t,e)=>{"-1"!==i[n[e]]&&(s=Math.max(s,o[e]))}));const a=Math.ceil(s*this.membersRatioThreshold);this.logoSummaryTable.filter.init((t=>o[t]>a&&(-1===r||"-1"!==i[n[t]])))}clusterFromSelection(){const t=this.model.getVisibleSelection(),e=this.logoSummaryTable.columns,n=e.length,i=new Array(e.length),r=this.getScaledActivityColumn(),o=v.A.fromString(t.toBinaryString()),s=(0,d.GT)(r.getRawData(),o);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},c={},h=this.getTotalViewerAggColumns(),f=this.getStringAggregatedColumns();for(const[e,n]of h){const i=b(n,e),r=this.dataFrame.getCol(e);l[i]=(0,d.lh)(r,n,t)}for(const e of f)c[e]=(0,d.J1)(this.dataFrame,e,t);for(let r=0;r<n;++r){const n=e.byIndex(r);i[r]=n.name===u.i6.CLUSTER?a:n.name===u.i6.MEMBERS?t.trueCount:n.name===u.i6.WEB_LOGO||n.name===u.i6.DISTRIBUTION?null:n.name===u.i6.MEAN_DIFFERENCE?s.meanDifference:n.name===u.i6.P_VALUE?s.pValue:n.name===u.i6.RATIO?s.ratio:n.name in l?l[n.name]:n.name in c?c[n.name]:void 0,void 0===i[r]&&y._package.logger.warning(`PeptidesLSTWarn: value for column ${n.name} is undefined`)}this.logoSummaryTable.rows.addNew(i),this.clusterStats[A.CUSTOM][a]=s,this.addNewCluster(a)}removeCluster(){const t=this.clusterSelection[A.CUSTOM];if(0===t.length)return void r.shell.warning("No custom clusters selected to be removed");const e=this.logoSummaryTable.rows,n=this.logoSummaryTable.getCol(u.i6.CLUSTER),i=n.categories,o=this.dataFrame.columns;for(const n of t){t.splice(t.indexOf(n),1),o.remove(n),delete this.clusterStats[A.CUSTOM][n];const r=i.indexOf(n);e.removeAt(r),this.bitsets.splice(r,1)}n.compact(),this.clusterSelection[A.CUSTOM]=t,this.render()}addNewCluster(t){const e=o.Column.fromBitSet(t,this.model.getVisibleSelection());e.setTag(u.gp.CUSTOM_CLUSTER,"1"),e.setTag(u.gp.ANALYSIS_COL,"true"),this.dataFrame.columns.add(e),this.model.analysisView.grid.col(e.name).visible=!1}modifyClusterSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.clusterSelection=(0,g.vW)(this.clusterSelection,t,e):this._clusterSelection=(0,g.vW)(this.clusterSelection,t,e)}showTooltip(t,e,n){const r=this.dataFrame.filter,s=r.anyFalse?this.dataFrame.clone(r):this.dataFrame,a=s.rowCount,l=new v.A(a,!1),u=this.getScaledActivityColumn(r.anyFalse),c=u.getRawData();if(t.positionOrClusterType===A.ORIGINAL){const e=s.getCol(this.clustersColumnName),n=e.getRawData(),i=e.categories.indexOf(t.monomerOrCluster);for(let t=0;t<a;++t)n[t]===i&&l.setTrue(t);l.incrementVersion()}else{const e=s.getCol(t.monomerOrCluster);l.buffer=e.getRawData()}const h=r.anyFalse?(0,d.GT)(c,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!h.count)return null;const f=o.BitSet.fromBytes(l.buffer.buffer,a),p=(0,g.FZ)(u,f),y=(0,m.M1)(p,!0),C=(0,m.QD)(h),w=(0,d.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:f}),b=Object.assign(Object.assign({},C),w),E=(0,g.F2)(y,b);return i.tooltip.show(E,e,n),E}createWebLogoDf(t,e){const n=o.DataFrame.fromColumns([t]);return n.filter.copyFrom(e),n}}},3541:(t,e,n)=>{"use strict";n.d(e,{J:()=>N,UJ:()=>M,ds:()=>i,xN:()=>_});var i,r,o,s,a=n(4328),l=n(7389),u=n(6082),c=n(7233),h=n.n(c),d=n(4139),f=n(2935),p=n(9484),m=n(144),g=n.n(m),v=n(5070),y=n(3273),C=n(912),w=n(3657),b=n(8608),A=n(3077),E=n(439),S=n(2003),T=n(9135),x=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};!function(t){t.MUTATION_CLIFFS="Mutation Cliffs",t.INVARIANT_MAP="Invariant Map"}(i||(i={})),function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.ACTIVITY_SCALING="activityScaling",t.TARGET="target",t.TARGET_CATEGORY="targetCategory",t.MIN_ACTIVITY_DELTA="minActivityDelta",t.MAX_MUTATIONS="maxMutations",t.COLUMNS="columns",t.AGGREGATION="aggregation",t.ACTIVITY_TARGET="activityTarget",t.VALUE_INVARIANT_MAP="value",t.AGGREGATION_INVARIANT_MAP_VALUE="valueAggregation"}(r||(r={})),function(t){t.COLOR="color",t.COLOR_AGGREGATION="colorAggregation",t.CUSTOM_COLOR_RANGE="customColorRange",t.MIN_COLOR_VALUE="minColorValue",t.MAX_COLOR_VALUE="maxColorValue",t.LOWER_BOUND_COLOR="lowerBoundColor",t.MIDDLE_COLOR="middleColor",t.UPPER_BOUND_COLOR="upperBoundColor",t.LOG_SCALE_COLOR="logScaleColor"}(o||(o={})),function(t){t.GENERAL="General",t.INVARIANT_MAP="Invariant Map",t.MUTATION_CLIFFS="Mutation Cliffs",t.AGGREGATION="Aggregation"}(s||(s={}));class _ extends u.JsViewer{constructor(){super(),this.keyPressed=!1,this._scaledActivityColumn=null,this.doRender=!0,this._viewerGrid=null,this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._invariantMapSelection=null,this._mutationCliffsSelection=null,this._monomerMetaColumns=new Set,this.sequenceColumnName=this.column(r.SEQUENCE,{category:s.GENERAL,semType:u.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(r.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(r.ACTIVITY_SCALING,d.rg.NONE,{category:s.GENERAL,choices:Object.values(d.rg),nullable:!1}),this.activityTarget=this.string(r.ACTIVITY_TARGET,d.wf.HIGH,{category:s.GENERAL,choices:Object.values(d.wf),nullable:!1}),this.targetColumnName=this.column(r.TARGET,{category:s.GENERAL,nullable:!0,columnTypeFilter:"categorical",userEditable:!0}),this.minActivityDelta=this.float(r.MIN_ACTIVITY_DELTA,0,{category:s.MUTATION_CLIFFS,min:0,max:100}),this.maxMutations=this.int(r.MAX_MUTATIONS,1,{category:s.MUTATION_CLIFFS,min:1,max:20}),this.columns=this.columnList(r.COLUMNS,[],{category:s.AGGREGATION}),this.aggregation=this.string(r.AGGREGATION,u.AGG.AVG,{category:s.AGGREGATION,choices:d.V5}),this.valueColumnName=this.column(r.VALUE_INVARIANT_MAP,{category:s.INVARIANT_MAP,userEditable:!0,nullable:!1,columnTypeFilter:"numerical"}),this.valueAggregation=this.string(r.AGGREGATION_INVARIANT_MAP_VALUE,u.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:d.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,b.sg)(((t,e,n)=>x(this,void 0,void 0,(function*(){return yield(0,w.uz)(t,e,n)})))),this.targetCategoryInput=l.input.choice("Category",{value:null,items:[],nullable:!0,onValueChanged:()=>{var t;this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._invariantMapSelection=null,this.doRender=!1,this._monomerPositionStats=null,null===(t=this.positionColumns)||void 0===t||t.forEach((t=>{t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),this.viewerGrid.invalidate()}}),this.targetCategoryInput.root.style.display="none",this.targetCategoryInput.root.style.width="50%",this.targetCategoryInput.root.style.marginLeft="8px"}get viewerGrid(){var t;return null!==(t=this._viewerGrid)&&void 0!==t||(this._viewerGrid=this.createViewerGrid()),this._viewerGrid}render(){}get alphabet(){var t;return null!==(t=this.dataFrame.getCol(this.sequenceColumnName).getTag(E.gp.alphabet))&&void 0!==t?t:S.YI.UN}get model(){return p.i.getInstance(this.dataFrame)}get positionColumns(){var t,e,n;if(null!=this._positionColumns)return this._positionColumns;const i=t=>{const e=this.model.findViewer(t);return this.sequenceColumnName===(null==e?void 0:e.sequenceColumnName)?e._positionColumns:null};return null!=this.model.positionColumns&&this.sequenceColumnName===(null===(t=this.model.settings)||void 0===t?void 0:t.sequenceColumnName)?this._positionColumns=this.model.positionColumns:this instanceof N?this._positionColumns=i(p.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._positionColumns=i(p.q.SEQUENCE_VARIABILITY_MAP)),null!==(e=this._positionColumns)&&void 0!==e||(this._positionColumns=null!==(n=i(p.q.LOGO_SUMMARY_TABLE))&&void 0!==n?n:(0,A.R)(this.dataFrame.getCol(this.sequenceColumnName)).columns.toList()),this._positionColumns}get monomerPositionStats(){var t;if(null!=this._monomerPositionStats)return this._monomerPositionStats;const e=t=>{var e,n,i;return!(this.sequenceColumnName!==(null==t?void 0:t.sequenceColumnName)||this.activityColumnName!==(null==t?void 0:t.activityColumnName)||this.activityScaling!==(null==t?void 0:t.activityScaling)||!(t instanceof _&&this.targetColumnName==(null==t?void 0:t.targetColumnName)&&(null===(e=this.targetCategoryInput)||void 0===e?void 0:e.value)===(null===(n=null==t?void 0:t.targetCategoryInput)||void 0===n?void 0:n.value))&&(t instanceof _||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof _&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof _||this.valueColumnName&&this.valueAggregation&&this.valueAggregation!=u.AGG.VALUE_COUNT&&this.valueAggregation!=u.AGG.TOTAL_COUNT))},n=t=>{const n=this.model.findViewer(t);return e(n)?n._monomerPositionStats:null};null!==this.model.monomerPositionStats&&e(this.model.settings)?this._monomerPositionStats=this.model.monomerPositionStats:this instanceof N?this._monomerPositionStats=n(p.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._monomerPositionStats=n(p.q.SEQUENCE_VARIABILITY_MAP));const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,r=this.targetCategoryInput.value,o=this.dataFrame.col(this.valueColumnName),s=this.valueAggregation;return null!==(t=this._monomerPositionStats)&&void 0!==t||(this._monomerPositionStats=(0,w.Ej)(this.getScaledActivityColumn(),this.dataFrame.filter,this.positionColumns,{target:i&&r?{col:i,cat:r}:void 0,aggValue:s&&o?{col:o,type:s}:void 0})),this._monomerPositionStats}get mutationCliffs(){if(null!=this._mutationCliffs)return this._mutationCliffs;const t=t=>{const e=this.model.findViewer(t);return i=e,(n=this).sequenceColumnName===(null==i?void 0:i.sequenceColumnName)&&n.activityColumnName===i.activityColumnName&&n.activityScaling===i.activityScaling&&n.targetColumnName===(null==i?void 0:i.targetColumnName)&&(null===(r=n.targetCategoryInput)||void 0===r?void 0:r.value)===(null===(o=null==i?void 0:i.targetCategoryInput)||void 0===o?void 0:o.value)&&n.minActivityDelta===(null==i?void 0:i.minActivityDelta)&&n.maxMutations===(null==i?void 0:i.maxMutations)?e._mutationCliffs:null;var n,i,r,o};return this instanceof N?this._mutationCliffs=t(p.q.MOST_POTENT_RESIDUES):this instanceof M&&(this._mutationCliffs=t(p.q.SEQUENCE_VARIABILITY_MAP)),this._mutationCliffs}set mutationCliffs(t){this._mutationCliffs=t,this.viewerGrid.invalidate()}get cliffStats(){if(!this._mutationCliffStats&&this.mutationCliffs&&this.activityColumnName&&this.sequenceColumnName&&this.dataFrame.col(this.activityColumnName)){const t=this.dataFrame.col(this.activityColumnName).getRawData();this._mutationCliffStats=(0,w.Lw)(this.mutationCliffs,t)}return this._mutationCliffStats}set cliffStats(t){this._mutationCliffStats=t,this.viewerGrid.invalidate}get mutationCliffsSelection(){var t;const e=this instanceof N?d.YX.MP:d.YX.MPR,n=this.dataFrame.getTag(`${e}${d.gp.MUTATION_CLIFFS_SELECTION}`);return null!==(t=this._mutationCliffsSelection)&&void 0!==t||(this._mutationCliffsSelection=null===n?(0,b.ZR)(this.positionColumns):JSON.parse(n)),this._mutationCliffsSelection}set mutationCliffsSelection(t){this._mutationCliffsSelection=t;const e=this instanceof N?d.YX.MP:d.YX.MPR;this.dataFrame.setTag(`${e}${d.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof N?p.q.SEQUENCE_VARIABILITY_MAP:p.q.MOST_POTENT_RESIDUES);const n=this.model.findViewer(p.q.SEQUENCE_VARIABILITY_MAP);null==n||n.viewerGrid.invalidate();const i=this.model.findViewer(p.q.MOST_POTENT_RESIDUES);null==i||i.viewerGrid.invalidate(),this.model.analysisView.grid.invalidate()}getScaledActivityColumn(t=!1){var e,n,i;return(null===(e=this.model.settings)||void 0===e?void 0:e.activityColumnName)===this.activityColumnName&&(null===(n=this.model.settings)||void 0===n?void 0:n.activityScaling)===this.activityScaling&&(this._scaledActivityColumn=this.model.getScaledActivityColumn(t)),null!==(i=this._scaledActivityColumn)&&void 0!==i||(this._scaledActivityColumn=(0,b.Y1)(this.dataFrame.getCol(this.activityColumnName),this.activityScaling)),t?u.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.filter).getCol(this._scaledActivityColumn.name):this._scaledActivityColumn}modifyMutationCliffsSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.mutationCliffsSelection=(0,b.vW)(this.mutationCliffsSelection,t,e):this._mutationCliffsSelection=(0,b.vW)(this.mutationCliffsSelection,t,e)}resetTargetCategoryValue(){var t;const e=this.targetColumnName,n=this.dataFrame.col(e);this.targetCategoryInput.items=null!==(t=null==n?void 0:n.categories)&&void 0!==t?t:[],this.targetCategoryInput.value=null,this.targetCategoryInput.root.style.display=e?"flex":"none"}onPropertyChanged(t){switch(super.onPropertyChanged(t),this.doRender=!0,t.name){case`${r.SEQUENCE}${d.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${r.ACTIVITY}${d.To}`:case r.ACTIVITY_SCALING:this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null,this._scaledActivityColumn=null;break;case`${r.VALUE_INVARIANT_MAP}${d.To}`:case r.AGGREGATION_INVARIANT_MAP_VALUE:this._monomerPositionStats=null,this._viewerGrid=null,this._invariantMapSelection=null;break;case r.MIN_ACTIVITY_DELTA:case r.MAX_MUTATIONS:this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this.doRender=!1;break;case r.COLUMNS:case r.AGGREGATION:this instanceof M&&(this._viewerGrid=null);break;case r.ACTIVITY_TARGET:(this instanceof M||this instanceof N)&&(this._viewerGrid=null)}null===this._mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),t.name===`${r.TARGET}${d.To}`&&this.targetColumnInput&&(this.targetColumnInput.value=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,this.resetTargetCategoryValue())}getAggregationColumns(){return Object.fromEntries(this.columns.map((t=>[t,this.aggregation])).filter((([t,e])=>this.model.df.columns.contains(t)&&this.model.df.col(t).matches("numerical"))))}getTotalViewerAggColumns(){var t,e;const n=this.getAggregationColumns();return(0,b.zm)(this.model.df,this.columns,n,null===(e=null===(t=this.model)||void 0===t?void 0:t.settings)||void 0===e?void 0:e.columns)}createViewerGrid(){throw new Error("Not implemented")}detach(){this.subs.forEach((t=>t.unsubscribe()))}onTableAttached(){var t,e,n;if(super.onTableAttached(),this.helpUrl="https://datagrok.ai/help/datagrok/solutions/domains/bio/peptides-sar",(0,b.B2)(this.dataFrame))null===(t=this.getProperty(`${r.SEQUENCE}${d.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(u.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${r.ACTIVITY}${d.To}`))||void 0===e||e.set(this,g()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${r.VALUE_INVARIANT_MAP}${d.To}`))||void 0===n||n.set(this,g()(this.dataFrame.columns.numerical).next().value.name),null===this.mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),this.subs.push(a.events.onContextMenu.subscribe((t=>{if(!(t&&t.causedBy&&t.args&&t.args.menu&&t.causedBy.target&&t.causedBy.target instanceof HTMLElement&&this.root.contains(t.causedBy.target)))return;const e=t.args.menu;(0,T.pj)().then((t=>{const n=t.getMonomerLib(),i=n.getMonomerSymbolsByType("PEPTIDE").map((t=>n.getMonomer("PEPTIDE",t))).filter(Boolean).map((t=>{var e;return null!==(e=t.meta)&&void 0!==e?e:{}})),r=new Set;i.forEach((t=>Object.keys(t).forEach((t=>r.add(t))))),r.delete("colors"),e.group("Monomer Meta").items(Array.from(r),(t=>{this._monomerMetaColumns.has(t)?this._monomerMetaColumns.delete(t):this._monomerMetaColumns.add(t),this._viewerGrid=null,this.render()}),{isChecked:t=>this._monomerMetaColumns.has(t)})}))})));else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}}calculateMutationCliffs(){return x(this,void 0,void 0,(function*(){const t=this.dataFrame.getCol(this.activityColumnName),e=this.positionColumns.map(b.eY),n=this.targetColumnName?(0,b.eY)(this.dataFrame.getCol(this.targetColumnName)):null,i={maxMutations:this.maxMutations,minActivityDelta:this.minActivityDelta,targetCol:n,currentTarget:this.targetCategoryInput.value},r=t.getRawData(),o=yield this.mutationCliffsDebouncer(r,e,i);return{cliffs:o,cliffStats:(0,w.Lw)(o,r)}}))}}class N extends _{constructor(){super(),this.currentGridCell=null,this.customColorRange=!1,this.minColorValue=0,this.maxColorValue=0,this.logScaleColor=!1,this.colorColumnName=this.column(o.COLOR,{category:s.INVARIANT_MAP,nullable:!1,columnTypeFilter:"numerical"}),this.colorAggregation=this.string(o.COLOR_AGGREGATION,u.AGG.AVG,{category:s.INVARIANT_MAP,choices:d.V5}),this.lowerBoundColor=this.int(o.LOWER_BOUND_COLOR,4278190335,{category:s.INVARIANT_MAP,editor:"color"}),this.middleColor=this.int(o.MIDDLE_COLOR,4294967295,{category:s.INVARIANT_MAP,editor:"color"}),this.upperBoundColor=this.int(o.UPPER_BOUND_COLOR,4294901760,{category:s.INVARIANT_MAP,editor:"color"}),this.logScaleColor=this.bool(o.LOG_SCALE_COLOR,!1,{category:s.INVARIANT_MAP}),this.customColorRange=this.bool(o.CUSTOM_COLOR_RANGE,!1,{category:s.INVARIANT_MAP}),this.minColorValue=this.float(o.MIN_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.maxColorValue=this.float(o.MAX_COLOR_VALUE,0,{category:s.INVARIANT_MAP})}get name(){return p.q.SEQUENCE_VARIABILITY_MAP}get mode(){var t;return null!==(t=this.dataFrame.getTag(d.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(d.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${d.YX.MP}${d.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._invariantMapSelection)&&void 0!==t||(this._invariantMapSelection=null===e?(0,b.ZR)(this.positionColumns):JSON.parse(e)),this._invariantMapSelection}set invariantMapSelection(t){this._invariantMapSelection=t,this.dataFrame.setTag(`${d.YX.MP}${d.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(p.q.SEQUENCE_VARIABILITY_MAP),this.model.analysisView.grid.invalidate()}onTableAttached(){var t;if(super.onTableAttached(),(0,b.B2)(this.dataFrame))null===(t=this.getProperty(`${o.COLOR}${d.To}`))||void 0===t||t.set(this,this.activityColumnName),this.targetColumnInput=l.input.column("Target",{value:void 0,nullable:!0,table:this.dataFrame,onValueChanged:t=>{var e;const n=this.getProperty(`${r.TARGET}${d.To}`);n&&n.get(this)!==t.name&&(null==n||n.set(this,null!==(e=t.name)&&void 0!==e?e:null))}});else{const t="PeptidesError: dataframe is missing Macromolecule or numeric columns";a.log.error(t),a.shell.warning(t)}this.render()}modifyInvariantMapSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e):this._invariantMapSelection=(0,b.vW)(this.invariantMapSelection,t,e)}onPropertyChanged(t){var e;super.onPropertyChanged(t),t.name===r.SEQUENCE&&(this._invariantMapSelection=null),null===(e=this.positionColumns)||void 0===e||e.forEach((t=>{t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=null})),this.doRender?this.render():this.viewerGrid.invalidate()}createMonomerPositionDf(){const t=new Set,e=this.positionColumns;for(const n of e){const e=n.categories;for(const n of e)""!==n&&t.add(n)}const n=Array.from(t),i=u.Column.fromStrings(d.$2.MONOMER,n),r=u.DataFrame.fromColumns([i]),o=(0,T.pj)().then((t=>{const e=t.getMonomerLib();return e?n.map((t=>{var n,i;return null!==(i=null===(n=e.getMonomer("PEPTIDE",t))||void 0===n?void 0:n.meta)&&void 0!==i?i:{}})):n.map((t=>({})))}));this._monomerMetaColumns.forEach((t=>{const e=r.columns.addNewString(t);o.then((n=>{e.init((e=>{var i,r;return null!==(r=null===(i=n[e][t])||void 0===i?void 0:i.toString())&&void 0!==r?r:""}))}))})),r.name="SAR";for(const t of e)r.columns.addNewBool(t.name);return r}cacheInvariantMapColors(){if(this.colorColumnName&&this.dataFrame.col(this.colorColumnName)){const t=this.dataFrame.getCol(this.colorColumnName).getRawData();let e=9999999,n=-9999999;const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,r=null==i?void 0:i.getRawData(),o=this.targetCategoryInput.value,s=null==o?null:null==i?void 0:i.categories.indexOf(o);for(const i of this.positionColumns){i.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]={};const o=i.temp[d.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),c=i.categories;if(!this.monomerPositionStats[a])continue;const h=this.monomerPositionStats[a];for(const a of Object.keys(h)){if("general"===a)continue;const h=[];for(let t=0;t<i.length;++t){const e=c[l[t]]===a,n=!r||null==s||-1==s||r[t]===s;e&&n&&h.push(t)}const d=u.Column.float("color",h.length).init((e=>t[h[e]])).aggregate(this.colorAggregation);o[a]=d,e=Math.min(e,d),n=Math.max(n,d)}i.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=o}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,c=a?this.maxColorValue:n;const h=this.logScaleColor&&l>1e-30&&c>1e-30&&e>1e-30&&n>1e-30;h&&(l=Math.log(l),c=Math.log(c));for(const t of this.positionColumns){const i=t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===d.wf.LOW&&(i[t]=c-i[t]+l),i[t]=u.Color.scaleColor(h?Math.log(i[t]):i[t],l,c,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[d.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[d.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[d.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([d.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([d.$2.MONOMER,...this._monomerMetaColumns,...n]);const r=t.getCol(d.$2.MONOMER);f.rI(r,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>O(t,this,this.mode===i.INVARIANT_MAP,this.dataFrame.getCol(this.colorColumnName),this.colorAggregation))),e.onCellTooltip(((t,e,n)=>{var r,o,s;if(!t.isTableCell||!(null===(r=null==t?void 0:t.cell.column)||void 0===r?void 0:r.name)||this._monomerMetaColumns.has(t.cell.column.name))return this.model.unhighlight(),!0;const a=this.getMonomerPosition(t);(0,b.dl)(a,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0;const l=this.getTotalViewerAggColumns();return this.mode===i.INVARIANT_MAP&&(this.colorColumnName&&this.colorAggregation&&l.unshift([this.colorColumnName,this.colorAggregation]),this.valueColumnName&&this.valueAggregation&&this.valueAggregation!==u.AGG.VALUE_COUNT&&this.valueAggregation!==u.AGG.TOTAL_COUNT&&l.unshift([this.valueColumnName,this.valueAggregation])),(0,C.DK)(this.model.df,this.getScaledActivityColumn(),l,{fromViewer:!0,isMutationCliffs:this.mode===i.MUTATION_CLIFFS,monomerPosition:a,x:e,y:n,mpStats:this.monomerPositionStats,cliffStats:null!==(s=null===(o=this.cliffStats)||void 0===o?void 0:o.stats)&&void 0!==s?s:void 0})})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),u.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,r,o,s,a,l,u,c;try{if(!t||!t.dart||!(null===(r=null===(n=null==t?void 0:t.cell)||void 0===n?void 0:n.column)||void 0===r?void 0:r.name)||this._monomerMetaColumns.has(t.cell.column.name))return;if(!this.keyPressed)return;if(null!==this.currentGridCell){const t=this.getMonomerPosition(this.currentGridCell);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1):(null===(a=null===(s=null===(o=this.mutationCliffs)||void 0===o?void 0:o.get(t.monomerOrCluster))||void 0===s?void 0:s.get(t.positionOrClusterType))||void 0===a?void 0:a.size)&&this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}const h=this.getMonomerPosition(t);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(h,{shiftPressed:!0,ctrlPressed:!1},!0):(null===(c=null===(u=null===(l=this.mutationCliffs)||void 0===l?void 0:l.get(h.monomerOrCluster))||void 0===u?void 0:u.get(h.positionOrClusterType))||void 0===c?void 0:c.size)&&this.modifyMutationCliffsSelection(h,{shiftPressed:!0,ctrlPressed:!1},!0),e.invalidate(),setTimeout((()=>null==e?void 0:e.invalidate()),300)}finally{this.keyPressed=!1,this.currentGridCell=t}})),e.root.addEventListener("keydown",(t=>{if(this.keyPressed=t.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===t.key||"KeyA"===t.code&&t.ctrlKey&&t.shiftKey)this.mode===i.INVARIANT_MAP?this._invariantMapSelection=(0,b.ZR)(this.positionColumns):this._mutationCliffsSelection=(0,b.ZR)(this.positionColumns);else{if("KeyA"!==t.code||!t.ctrlKey)return;{const t=Object.keys(this.monomerPositionStats).filter((t=>"general"!==t));for(const e of t){const t=Object.keys(this.monomerPositionStats[e]).filter((t=>"general"!==t));for(const n of t){const t={monomerOrCluster:n,positionOrClusterType:e};this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1):this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}}}this.model.fireBitsetChanged(p.q.SEQUENCE_VARIABILITY_MAP),e.invalidate()}})),e.root.addEventListener("click",(n=>{var r,o,s,a,l;const u=e.hitTest(n.offsetX,n.offsetY);if(!(null==u?void 0:u.isTableCell)||(null===(r=null==u?void 0:u.tableColumn)||void 0===r?void 0:r.name)===d.$2.MONOMER||(null===(o=null==u?void 0:u.tableColumn)||void 0===o?void 0:o.name)&&this._monomerMetaColumns.has(u.tableColumn.name))return;const c=this.getMonomerPosition(u);this.mode===i.INVARIANT_MAP?(this.modifyInvariantMapSelection(c,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),(0,b.CD)(this.invariantMapSelection)&&(t.currentRowIdx=-1)):(null===(l=null===(a=null===(s=this.mutationCliffs)||void 0===s?void 0:s.get(c.monomerOrCluster))||void 0===a?void 0:a.get(c.positionOrClusterType))||void 0===l?void 0:l.size)&&this.modifyMutationCliffsSelection(c,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),e.invalidate(),this.showHelp()})),L(e);const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(d.$2.MONOMER);if(40!==t.width){t.width=40;for(const t of n)e.col(t).width=40}else o.unsubscribe()}));return e}showHelp(){y._package.files.readAsText("help/monomer-position.md").then((t=>{a.shell.windows.help.showHelp(l.markdown(t))})).catch((t=>a.log.error(t)))}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(d.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(h()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const r=this.getProperty(o.COLOR);r&&(r.choices=g()(a.shell.t.columns.numerical).toArray().map((t=>t.name)),r.get(this)===d.$2.ACTIVITY_SCALED&&r.set(this,d.$2.ACTIVITY)),h()(this.root).empty();let s=l.divText(p.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"});if(this.name===p.q.SEQUENCE_VARIABILITY_MAP){const t=l.input.bool(i.MUTATION_CLIFFS,{value:this.mode===i.MUTATION_CLIFFS});t.root.addEventListener("click",(()=>{e.value=!1,t.value=!0,this.mode=i.MUTATION_CLIFFS,this.showHelp()})),t.setTooltip("Statistically significant changes in activity");const e=l.input.bool(i.INVARIANT_MAP,{value:this.mode===i.INVARIANT_MAP});e.root.addEventListener("click",(()=>{t.value=!1,e.value=!0,this.mode=i.INVARIANT_MAP,this.showHelp()})),e.setTooltip("Number of sequences having monomer-position");const n=t=>{h()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),h()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),h()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),h()(s).css("width","auto").css("align-self","center")}const u=this.viewerGrid.root;u.style.width="auto";const c=l.iconFA("expand-alt",(()=>{const t=l.dialog();t.add(l.divV([s,u],{style:{height:"100%"}})),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Sequence Variability Map Table in full screen");h()(c).addClass("pep-help-icon"),this.targetColumnInput&&(this.targetColumnInput.root.style.width="50%");const f=l.divH([null!==(e=null===(t=this.targetColumnInput)||void 0===t?void 0:t.root)&&void 0!==e?e:l.div(),this.targetCategoryInput.root],{style:{alignSelf:"center",justifyContent:"center"}}),m=l.divH([c,s,f],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column"}});this.root.appendChild(l.divV([m,u])),null===(n=this.viewerGrid)||void 0===n||n.invalidate()}}class M extends _{constructor(){super(),this.currentGridRowIdx=null}get name(){return p.q.MOST_POTENT_RESIDUES}onTableAttached(){super.onTableAttached(),this.helpUrl="https://datagrok.ai/help/datagrok/solutions/domains/bio/peptides-sar",this.render()}onPropertyChanged(t){super.onPropertyChanged(t),this.doRender&&this.render()}createMostPotentResiduesDf(){var t;const e=Object.entries(this.monomerPositionStats),n=new Array(e.length-1),i=new Array(n.length),r=new Array(n.length),o=new Array(n.length),s=new Array(n.length),a=new Array(n.length),l=new Array(n.length),c=this.getTotalViewerAggColumns(),h=c.map((([t,e])=>(0,v.hX)(e,t))),f=new Array(h.length);h.forEach(((t,e)=>f[e]=new Array(n.length)));let p=0;for(const[m,g]of e){const e=g.general;if(!e)continue;if(1===Object.entries(g).length)continue;const y=[];for(const[n,i]of Object.entries(g))"general"!==n&&(i.count>1&&(null==i.pValue||(null!==(t=i.pValue)&&void 0!==t?t:1)<=.05)&&y.push([n,i]),i.pValue===e.minPValue&&y.push([n,i]));if(0===y.length)continue;let C=null;for(const[t,e]of y)(null===C||this.activityTarget===d.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===d.wf.LOW&&C[1].meanDifference>e.meanDifference)&&(C=[t,e]);if(null===C)continue;n[p]=parseInt(m),i[p]=C[0],r[p]=C[1].meanDifference,o[p]=C[1].pValue,s[p]=C[1].count,a[p]=C[1].ratio,l[p]=C[1].mean;const w=this.monomerPositionStats[m][C[0]],b=u.BitSet.fromBytes(w.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<h.length;t++){const[e,n]=c[t];f[t][p]=(0,v.lh)(this.model.df.getCol(e),n,b)}++p}n.length=p,i.length=p,r.length=p,o.length=p,s.length=p,a.length=p,l.length=p;const m=u.DataFrame.create(p),g=m.columns;return g.add(u.Column.fromList(u.TYPE.INT,d.$2.POSITION,n)),g.add(u.Column.fromList(u.TYPE.STRING,d.$2.MONOMER,i)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.MEAN_DIFFERENCE,r)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.MEAN,l)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.P_VALUE,o)),g.add(u.Column.fromList(u.TYPE.INT,d.$2.COUNT,s)),g.add(u.Column.fromList(u.TYPE.FLOAT,d.$2.RATIO,a)),h.forEach(((t,e)=>g.add(u.Column.fromList(u.TYPE.FLOAT,t,f[e])))),m}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([d.$2.POSITION]);const n=e.col(d.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(d.$2.MONOMER);f.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>O(t,this,!1))),e.onCellTooltip(((t,e,n)=>{var i,r;if(!t.isTableCell)return this.model.unhighlight(),!0;const o=this.getMonomerPosition(t);if((0,b.dl)(o,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0,(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===d.$2.MONOMER)o.positionOrClusterType=d.$2.MONOMER;else if((null===(r=t.tableColumn)||void 0===r?void 0:r.name)!==d.$2.MEAN_DIFFERENCE)return!1;const s=this.getTotalViewerAggColumns(),a=null==t.tableRowIndex?void 0:(0,v.m2)(t.grid.dataFrame,t.tableRowIndex,s,{});return(0,C.DK)(this.model.df,this.getScaledActivityColumn(),s,{fromViewer:!0,isMostPotentResidues:!0,monomerPosition:o,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),u.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,r,o;try{if(this.keyPressed&&t.currentCol.name!==d.$2.MEAN_DIFFERENCE||!this.keyPressed)return;const s=this.getMonomerPosition(n);if(null!==this.currentGridRowIdx){const t=this.getMonomerPosition(e.cell("Diff",this.currentGridRowIdx));this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!0},!1)}(null===(o=null===(r=null===(i=this.mutationCliffs)||void 0===i?void 0:i.get(s.monomerOrCluster))||void 0===r?void 0:r.get(s.positionOrClusterType))||void 0===o?void 0:o.size)&&this.modifyMutationCliffsSelection(s,{shiftPressed:!0,ctrlPressed:!1}),e.invalidate()}finally{this.keyPressed=!1,this.currentGridRowIdx=n.gridRow}})),e.root.addEventListener("keydown",(n=>{if(this.keyPressed=n.key.startsWith("Arrow"),!this.keyPressed){if("Escape"===n.key||"KeyA"===n.code&&n.ctrlKey&&n.shiftKey)this._mutationCliffsSelection=(0,b.ZR)(this.positionColumns);else{if("KeyA"!==n.code||!n.ctrlKey)return;for(let n=0;n<t.rowCount;++n){const t=this.getMonomerPosition(e.cell("Diff",n));this.modifyMutationCliffsSelection(t,{shiftPressed:!0,ctrlPressed:!1},!1)}}this.model.fireBitsetChanged(p.q.MOST_POTENT_RESIDUES),e.invalidate()}})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),e.root.addEventListener("click",(t=>{var n,i,r;const o=e.hitTest(t.offsetX,t.offsetY);if(!(null==o?void 0:o.isTableCell)||o.tableColumn.name!==d.$2.MEAN_DIFFERENCE)return;const s=this.getMonomerPosition(o);(null===(r=null===(i=null===(n=this.mutationCliffs)||void 0===n?void 0:n.get(s.monomerOrCluster))||void 0===i?void 0:i.get(s.positionOrClusterType))||void 0===r?void 0:r.size)&&(this.modifyMutationCliffsSelection(s,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),e.invalidate(),y._package.files.readAsText("help/most-potent-residues.md").then((t=>{a.shell.windows.help.showHelp(l.markdown(t))})).catch((t=>a.log.error(t))))})),L(e);const r=e.col(d.$2.MEAN_DIFFERENCE);r.name="Diff";const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(d.$2.MONOMER);40!==t.width?(t.width=40,r.width=40):o.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(d.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(d.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(h()(this.root).empty(),!this.activityColumnName||!this.sequenceColumnName)return void this.root.appendChild(l.divText("Please, select a sequence and activity columns in the viewer properties"));const e=l.divText(p.q.MOST_POTENT_RESIDUES,{id:"pep-viewer-title"}),n=this.viewerGrid.root;n.style.width="auto";const i=l.divH([e],{style:{alignSelf:"center",lineHeight:"normal"}});this.root.appendChild(l.divV([i,n])),null===(t=this.viewerGrid)||void 0===t||t.invalidate()}}function O(t,e,n,i,r){var o,s,a,l,c;const h=[...e.positionColumns.map((t=>t.name)),d.$2.MEAN_DIFFERENCE],p=t.g,m=t.bounds;p.save(),p.beginPath(),p.rect(m.x,m.y,m.width,m.height),p.clip();const g=t.cell;if(g.isRowHeader&&g.gridColumn.visible)return g.gridColumn.visible=!1,t.preventDefault(),void p.restore();const v=null===(o=g.tableColumn)||void 0===o?void 0:o.name,y=g.tableRowIndex;if(!g.isTableCell||-1===h.indexOf(v))return void p.restore();const C=g.grid.table,w=C.get(d.$2.MONOMER,y),b=v!==d.$2.MEAN_DIFFERENCE?v:C.get(d.$2.POSITION,y).toFixed(),A=e.monomerPositionStats[b];if(!A[w])return t.preventDefault(),void p.restore();if(n){const t=null!==(s=A[w].aggValue)&&void 0!==s?s:A[w].count,n=e.positionColumns.find((t=>t.name===b)),i=null!==(a=n.temp[d.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let r=u.Color.white;null!=i[w]?r=i[w]:e instanceof N&&(e.cacheInvariantMapColors(),r=null!==(c=(null!==(l=n.temp[d.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[w])&&void 0!==c?c:u.Color.white),f.rW(p,w,b,e.invariantMapSelection,t,m,r)}else f.Yd(p,w,b,e,m);t.preventDefault(),p.restore()}function L(t){const e=t.props;e.allowEdit=!1,e.allowRowSelection=!1,e.allowBlockSelection=!1,e.allowColSelection=!1,e.showRowHeader=!1,e.showCurrentRowIndicator=!1,e.showReadOnlyNotifications=!1,e.rowHeight=20}},7654:(t,e,n)=>{"use strict";n.d(e,{HV:()=>m,M1:()=>g,QD:()=>v});var i,r=n(7389),o=n(6082),s=n(7233),a=n.n(s),l=n(4139),u=n(5070),c=n(8608),h=n(5480),d=n(8774);!function(t){t.SEPARATE_MONOMERS="separateMonomers",t.SEPARATE_POSITIONS="separatePositions",t.SEPARATE_CLUSTERS="separateClusters"}(i||(i={}));const f="general",p=t=>t===f?"General":t.substring(8);function m(t,e){if(!t.selection.anyTrue)return r.divText("No distribution");const n=()=>{const n=[C(f,t,e)];for(const r of Object.values(i))"true"!==t.getTag(r)||r===i.SEPARATE_CLUSTERS&&!e.clusterColName||n.push(C(r,t,e));return 1===n.length?n[0]:r.div(n)},o=r.div(n()),s=Object.values(i),l=new Array(s.length);for(let u=0;u<s.length;u++){const c=s[u].substring(8);l[u]=r.input.bool(c,{value:"true"===t.getTag(s[u]),onValueChanged:e=>{t.setTag(s[u],`${e}`),a()(o).empty(),o.append(n())}}),a()(l[u].captionLabel).addClass("ui-label-right").css("text-align","left"),a()(l[u].root).find(".ui-input-editor").css("margin","0px"),a()(l[u].root).find(".ui-input-description").css("margin","0px"),l[u].setTooltip(`Show distribution for each ${c}`),c===i.SEPARATE_CLUSTERS?l[u].enabled=!(!e.clusterColName||!e.clusterSelection[h.W.ORIGINAL]):c!==i.SEPARATE_MONOMERS&&c!==i.SEPARATE_POSITIONS||(l[u].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const u=r.form(l);return r.divV([u,o])}function g(t,e=!1){const n=t.plot.histogram({filteringEnabled:!1,valueColumnName:l.$2.ACTIVITY,splitColumnName:l.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!0,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:e?"#fdffe5":"#fffff"});return n.root.style.width="auto",n}function v(t,e={}){var n;null!==(n=e.fractionDigits)&&void 0!==n||(e.fractionDigits=3);const i={Count:`${t.count} (${(100*t.ratio).toFixed(e.fractionDigits)}%)`,"Mean difference":t.meanDifference.toFixed(e.fractionDigits),"Mean activity":t.mean.toFixed(e.fractionDigits)};return null!=t.pValue&&(i["p-value"]=t.pValue<.01?"<0.01":t.pValue.toFixed(e.fractionDigits)),i}function y(t,e,n,i={}){const r=g((0,c.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,u.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:o.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),h=Object.assign(Object.assign({},l),s),d=(0,c.F2)(r,h,i);return a()(d).addClass("d4-flex-col"),d}function C(t,e,n){let o=r.divText("No distribution");switch(t){case f:const t=d.A.fromSeq(e.selection.length,(t=>e.selection.get(t))),s=e.selection.anyTrue&&e.selection.anyFalse?(0,u.GT)(n.activityCol.getRawData(),t):{count:n.activityCol.length,pValue:null,meanDifference:0,ratio:1,mask:t,mean:n.activityCol.stats.avg};o=y(e,s,n);break;case i.SEPARATE_CLUSTERS:o=function(t,e,n){const i=t.rowCount,o=[],s=e.activityCol.getRawData(),a=t.getCol(e.clusterColName),l=a.categories,f=a.getRawData(),p=n[h.W.ORIGINAL].map((t=>l.indexOf(t))),m=new Array(p.length).fill(new d.A(i));for(let t=0;t<i;t++){const e=f[t],n=p.indexOf(e);-1!==n&&m[n].setTrue(t)}for(let n=0;n<p.length;n++){const i=p[n],r=(0,u.GT)(s,m[n]);o.push(y(t,r,e,{[c.AN.SELECTION]:l[i]}))}const g=n[h.W.CUSTOM];for(const n of g){const r=t.getCol(n),a=d.A.fromUint32Array(i,r.getRawData()),l=(0,u.GT)(s,a);o.push(y(t,l,e,{[c.AN.SELECTION]:n}))}return r.div(o,"d4-flex-wrap")}(e,n,n.clusterSelection);break;case i.SEPARATE_MONOMERS:const a=function(t){const e={},n=Object.keys(t);for(const i of n)for(const n of t[i])e.hasOwnProperty(n)?e[n].includes(i)||e[n].push(i):e[n]=[i];return e}(n.monomerPositionSelection);o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,h=[],f=[],p=[],m=[],g=e.activityCol.getRawData();for(const r of a){const a=n[r],v=new d.A(l);for(let e=0;e<a.length;e++){const n=a[e];null!==(i=f[e])&&void 0!==i||(f[e]=t.getCol(n)),null!==(o=p[e])&&void 0!==o||(p[e]=f[e].categories),null!==(s=m[e])&&void 0!==s||(m[e]=f[e].getRawData());const u=p[e].indexOf(r);for(let t=0;t<l;t++)m[e][t]===u&&v.setTrue(t)}const C=(0,u.GT)(g,v);h.push(y(t,C,e,{[c.AN.SELECTION]:r}))}return r.div(h,"d4-flex-wrap")}(e,n,a);break;case i.SEPARATE_POSITIONS:o=function(t,e,n){var i,o,s;const a=Object.keys(n),l=t.rowCount,h=[],f=e.activityCol.getRawData(),p=[],m=[],g=[];for(let r=0;r<a.length;r++){const v=a[r],C=n[v];if(0===C.length)continue;null!==(i=p[r])&&void 0!==i||(p[r]=t.getCol(v)),null!==(o=m[r])&&void 0!==o||(m[r]=p[r].categories),null!==(s=g[r])&&void 0!==s||(g[r]=p[r].getRawData());const w=new d.A(t.rowCount);for(let t=0;t<C.length;t++){const e=C[t],n=m[r].indexOf(e);for(let t=0;t<l;t++)g[r][t]===n&&w.setTrue(t)}const b=(0,u.GT)(f,w);h.push(y(t,b,e,{[c.AN.SELECTION]:v}))}return r.div(h,"d4-flex-wrap")}(e,n,n.monomerPositionSelection)}return r.divV([r.h1(p(t)),o])}},7923:(t,e,n)=>{"use strict";n.d(e,{F:()=>l});var i=n(7389),r=n(6082),o=n(4139),s=n(8608),a=n(2935);function l(t,e,n=!0){const o=u(t,e);if(!o)return new r.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:c}=o,h=[a,l],d=i.divV([c.root,...h.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",c.root,d,(()=>{const n=u(t,e);return i.divV([n.aminoToInput.root,n.pairsGrid.root,n.uniqueSequencesGrid.root],{style:{width:"100%",height:"100%"}})})),new r.Widget(d)}function u(t,e){var n,l;const u=t.filter.getSelectedIndexes(),c=Object.keys(e.mutationCliffsSelection);if(!c.length||null===e.mutationCliffs)return null;const h=[],d=[],f=[],p=[],m=[],g=t.getCol(e.sequenceColumnName),v=g.categories,y=g.getRawData(),C=e.activityCol.getRawData(),w=new Map,b=r.BitSet.create(t.rowCount),A=Object.fromEntries(e.positionColumns.map((t=>[t.name,t])));for(const t of c){const i=A[t],r=i.categories,o=i.getRawData();for(const i of e.mutationCliffsSelection[t]){const s=null===(n=e.mutationCliffs.get(i))||void 0===n?void 0:n.get(t);if(void 0!==s)for(const[t,e]of s.entries()){if(!u.includes(t))continue;const n=null!==(l=w.get(t))&&void 0!==l?l:[],i=v[y[t]],s=C[t];for(const a of e){if(n.includes(a)||!u.includes(a))continue;w.has(a)||w.set(a,[]);const e=v[y[a]];w.get(a).push(t),h.push(`${i}#${e}`),d.push(s-C[a]),f.push(r[o[a]]),p.push(t),m.push(a),b.set(t,!0),b.set(a,!0)}}}}if(0===h.length)return null;const E=r.Column.fromStrings("Mutation",h),S=r.Column.fromList("double","Delta",d),T=r.Column.fromStrings("~to",f),x=r.Column.fromList(r.COLUMN_TYPE.INT,"~toIdx",m),_=r.Column.fromList(r.COLUMN_TYPE.INT,"~fromIdx",p),N=r.DataFrame.fromColumns([E,S,T,x,_]);N.name="Mutation Cliff pairs";const M=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?N.filter.init((t=>T.get(t)===e)):N.filter.setAll(!0)}});M.setTooltip("Filter the rows by the monomer that the mutation was substituted to");const O=N.plot.grid();(0,s.vY)(O,!0),E.semType=o.uF.MACROMOLECULE_DIFFERENCE,E.tags[o.gp.SEPARATOR]=(0,s.AY)(g),E.tags[r.TAGS.UNITS]=g.tags[r.TAGS.UNITS],E.tags[r.TAGS.CELL_RENDERER]="MacromoleculeDifference";let L=!1,I=null;const R=[];O.onCurrentCellChanged.subscribe((t=>{try{if(!t||!t.dart)return R.length=0,void H();const e=t.tableRowIndex;if(!L)return;if(null===e)return R.length=0,void H();null!==I&&R.splice(R.indexOf(I),1),R.includes(e)||(R.push(e),O.invalidate()),H()}finally{L=!1,I=t&&t.dart?t.tableRowIndex:null}})),O.root.addEventListener("keydown",(t=>{L=t.key.startsWith("Arrow")})),O.root.addEventListener("click",(t=>{const e=O.hitTest(t.offsetX,t.offsetY);if(!e||null===e.tableRowIndex)return;const n=e.tableRowIndex;if(t.shiftKey){const t=R.indexOf(n);-1===t?R.push(n):R.splice(t,1)}else R.length=0,R.push(n);H(),O.invalidate(),F.invalidate()})),O.onCellRender.subscribe((t=>{var e;(null===(e=t.cell.tableColumn)||void 0===e?void 0:e.name)===E.name&&R.includes(t.cell.tableRowIndex)&&(0,a.X5)(t.g,t.bounds)}));const P=e.gridColumns.length,k=[];for(let t=1;t<P;t++){const n=e.gridColumns.byIndex(t);((null==n?void 0:n.name)===e.sequenceColumnName||!0===(null==n?void 0:n.visible)&&!Object.hasOwn(A,n.name))&&k.push(n.name)}const D=t.clone(b,k);D.name="Unique sequences that form Mutation Cliffs pairs";const G=D.columns.addNewInt("~seqIdx"),U=G.getRawData(),V=b.getSelectedIndexes();G.init((t=>V[t]));const F=D.plot.grid();function H(){const t=[];for(const e of R)t.push(_.get(e)),t.push(x.get(e));D.filter.init((e=>0===R.length||t.includes(U[e])),!0),O.invalidate(),F.invalidate()}return(0,s.vY)(F,!0),F.props.rowHeight=20,O.root.style.width="100% !important",F.root.style.width="100% !important",setTimeout((()=>{O.root.style.removeProperty("width"),O.root.style.setProperty("width","100%"),F.root.style.removeProperty("width"),F.root.style.setProperty("width","100%"),O.root.style.minHeight="250px",F.root.style.minHeight="250px"}),200),{pairsGrid:O,uniqueSequencesGrid:F,aminoToInput:M}}},5082:(t,e,n)=>{"use strict";n.d(e,{n:()=>u});var i=n(4328),r=(n(7389),n(6082)),o=(n(4788),n(4139)),s=n(115),a=n(9484),l=(n(7233),n(8608),n(2003),n(4572),n(5429),function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))});function u(t,e,n,u,c,h){return l(this,arguments,void 0,(function*(t,e,n,l,u,c,h={}){var d,f,p,m,g;let v=null;if(t.type!==r.COLUMN_TYPE.FLOAT&&t.type!==r.COLUMN_TYPE.INT&&t.type!==r.COLUMN_TYPE.QNUM)return i.shell.error("The activity column must be of numeric type!"),v;const y=r.TaskBarProgressIndicator.create("Loading SAR..."),C=r.DataFrame.create(l.rowCount);C.name="Peptides analysis";const w=C.columns;w.add(u);for(const t of l.columns)"true"!==t.getTag(o.gp.ANALYSIS_COL)&&(t.name.toLowerCase()===u.name.toLowerCase()&&(t.name=l.columns.getUnusedName(t.name)),w.add(t));const b={sequenceColumnName:e.name,activityColumnName:t.name,activityScaling:c,columns:{},showDendrogram:!1,showSequenceSpace:!1,sequenceSpaceParams:new s.GI(!!h.useEmbeddingsClusters&&!n),mclSettings:null!==(d=h.mclSettings)&&void 0!==d?d:new s.av};if(n){const t=C.getCol(n.name);t.type!==r.COLUMN_TYPE.STRING&&w.replace(t,t.convertTo(r.COLUMN_TYPE.STRING))}C.setTag(o.gp.SETTINGS,JSON.stringify(b));const A=r.BitSet.create(l.rowCount,(n=>!t.isNone(n)&&!e.isNone(n)&&l.filter.get(n)));if(v=a.i.getInstance(C.clone(A)),v.init(b),n){const i={clustersColumnName:n.name,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i)}if(yield v.addMonomerPosition(),yield v.addMostPotentResidues(),null!==(f=h.addSequenceSpace)&&void 0!==f&&f){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:h.useEmbeddingsClusters}),!n&&null!==(p=h.useEmbeddingsClusters)&&void 0!==p&&p){const n=v._sequenceSpaceCols.find((t=>{var e;return v.df.col(t)&&(null===(e=v.df.col(t))||void 0===e?void 0:e.type)===r.COLUMN_TYPE.STRING}));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}}else if(null!==(m=h.addMCL)&&void 0!==m&&m&&(yield v.addMCLClusters(),!n&&null!==(g=h.useEmbeddingsClusters)&&void 0!==g&&g)){const n=v._mclCols.find((t=>(null==v?void 0:v.df.col(t))&&t.toLowerCase().startsWith("cluster")&&!t.toLowerCase().includes("size")));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:c,activityColumnName:t.name};yield v.addLogoSummaryTable(i),setTimeout((()=>{var t,e;v&&(null===(t=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===t?void 0:t.render)&&(null===(e=null==v?void 0:v.findViewer(a.q.LOGO_SUMMARY_TABLE))||void 0===e||e.render())}),100)}}return y.close(),v}))}},5429:(t,e,n)=>{"use strict";n.d(e,{Av:()=>b,OH:()=>A,OO:()=>i});var i,r,o,s,a,l,u=n(7389),c=n(4328),h=n(6082),d=n(115),f=n(4139),p=n(9484),m=n(7233),g=n.n(m),v=n(144),y=n.n(v),C=n(3273),w=n(4572);!function(t){t.GENERAL="General",t.VIEWERS="Viewers",t.COLUMNS="Columns",t.SEQUENCE_SPACE="Sequence space",t.MCL="MCL"}(i||(i={})),function(t){t.ACTIVITY="Activity",t.ACTIVITY_SCALING="Activity scaling"}(r||(r={})),function(t){t.DENDROGRAM="Dendrogram"}(o||(o={})),function(t){t.IS_INCLUDED="",t.AGGREGATION="Aggregation"}(s||(s={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.CLUSTER_EMBEDDINGS="Cluster Embeddings",t.EPSILON="Epsilon",t.MIN_PTS="Minimum Points",t.FINGERPRINT_TYPE="Fingerprint Type"}(a||(a={})),function(t){t.DISTANCE_FUNCTION="Distance Function",t.GAP_OPEN="Gap Open Penalty",t.GAP_EXTEND="Gap Extend Penalty",t.FINGERPRINT_TYPE="Fingerprint Type",t.THRESHOLD="Similarity Threshold",t.INFLATION="Inflation Factor",t.MAX_ITERATIONS="Max Iterations",t.USE_WEBGPU="Use WebGPU",t.MIN_CLUSTER_SIZE="Min Cluster Size"}(l||(l={}));const b={[i.GENERAL]:r,[i.VIEWERS]:o,[i.COLUMNS]:s,[i.SEQUENCE_SPACE]:a,[i.MCL]:l};function A(t){var e,n,o,m,v,b,A,E,S,T;null==t.settings&&c.log.error("PeptidesError: Settings are not initialized");const x=u.accordion(),_=t.settings,N=null!==(e=null==_?void 0:_.activityScaling)&&void 0!==e?e:f.rg.NONE,M=null!==(n=null==_?void 0:_.columns)&&void 0!==n?n:{},O={},L={},I=null!==(o=null==_?void 0:_.sequenceSpaceParams)&&void 0!==o?o:new d.GI,R=null!==(m=null==_?void 0:_.mclSettings)&&void 0!==m?m:new d.av,P=u.input.column(r.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{O.activityColumnName=t.name},filter:t=>(t.type===h.TYPE.FLOAT||t.type===h.TYPE.INT)&&t.name!==f.$2.ACTIVITY&&0===t.stats.missingValueCount});P.setTooltip("Numeric activity column");const k=u.input.choice(r.ACTIVITY_SCALING,{value:N,items:Object.values(f.rg),onValueChanged:t=>O.activityScaling=t});k.setTooltip("Activity column transformation method"),x.addPane(i.GENERAL,(()=>u.inputs([P,k])),!0),L[i.GENERAL]=[P,k];const D=y()(t.analysisView.viewers).some((t=>t.type===p.q.DENDROGRAM)),G=u.input.bool(p.q.DENDROGRAM,{value:null!=D&&D,onValueChanged:t=>O.showDendrogram=t}),U=u.input.bool(p.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==_?void 0:_.showClusterMaxActivity),onValueChanged:t=>{O.showClusterMaxActivity=null!=t?t:void 0}}),V=u.input.bool("Sequence space",{value:!!(null==_?void 0:_.showSequenceSpace),onValueChanged:t=>{O.showSequenceSpace=null!=t?t:void 0,t?(ft.root.style.display="flex",(null==_?void 0:_.showSequenceSpace)||(O.sequenceSpaceParams=I)):(ft.root.style.display="none",delete O.sequenceSpaceParams),O.showSequenceSpace===(null==_?void 0:_.showSequenceSpace)&&delete O.showSequenceSpace}});U.setTooltip("Show cluster max activity viewer"),G.setTooltip("Show dendrogram viewer"),G.enabled=null!==(0,C.getTreeHelperInstance)(),x.addPane(i.VIEWERS,(()=>u.inputs([G,V,U])),!0),L[i.VIEWERS]=[G,V,U];const F=[],H=[];for(const e of t.df.columns.numerical){const t=e.name;if(t===_.activityColumnName||t===f.$2.ACTIVITY)continue;const n=u.input.bool(s.IS_INCLUDED,{value:void 0!==M[t],onValueChanged:e=>{var n;null!==(n=O.columns)&&void 0!==n||(O.columns={}),e?O.columns[t]=i.value:(delete O.columns[t],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});n.setTooltip("Include aggregated column value in tooltips, Logo Summary Table and Distribution panel");const i=u.input.choice(s.AGGREGATION,{value:null!==(v=M[t])&&void 0!==v?v:h.AGG.AVG,items:Object.values(h.STATS),onValueChanged:i=>{var r;null!==(r=O.columns)&&void 0!==r||(O.columns={}),n.value?O.columns[t]=i:(delete O.columns[e.name],Object.keys(O.columns).length===Object.keys(M).length&&delete O.columns)}});i.setTooltip("Aggregation method"),g()(i.root).find("label").css("width","auto");const r=u.inputsRow(e.name,[n,i]);H.push(n,i),g()(r).find("div.ui-div").css("display","inline-flex"),F.push(r)}0!==F.length&&(x.addPane(i.COLUMNS,(()=>u.divV(F)),!1),L[i.COLUMNS]=H);const B={};function q(t,e){if(J(),null==e||""===e)return;B[t]=e;let n=!0;for(const[t,e]of Object.entries(B))if(e!==I[t]){n=!1;break}n?delete O.sequenceSpaceParams:O.sequenceSpaceParams=Object.assign(Object.assign({},I),B)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const $=u.input.choice(a.DISTANCE_FUNCTION,{value:I.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.HAMMING,w.Z.LEVENSHTEIN,w.Z.MONOMER_CHEMICAL_DISTANCE],onValueChanged:t=>q("distanceF",t)});$.setTooltip("Distance function for sequences");const j=u.input.float(a.GAP_OPEN,{value:I.gapOpen,onValueChanged:t=>q("gapOpen",t)}),W=u.input.float(a.GAP_EXTEND,{value:I.gapExtend,onValueChanged:t=>q("gapExtend",t)}),z=u.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(b=I.clusterEmbeddings)&&void 0!==b&&b,onValueChanged:t=>q("clusterEmbeddings",t)});z.setTooltip("Cluster embeddings using DBSCAN algorithm");const K=u.input.float(a.EPSILON,{value:I.epsilon,onValueChanged:t=>q("epsilon",t)});K.setTooltip("Epsilon parameter for DBSCAN. Minimum distance between two points to be considered as a cluster");const Q=u.input.int(a.MIN_PTS,{value:I.minPts,onValueChanged:t=>q("minPts",t)});Q.setTooltip("Minimum number of points in a cluster");const X=u.input.choice(a.FINGERPRINT_TYPE,{value:I.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>q("fingerprintType",t)});function J(){Y([j,W],$.value===w.Z.NEEDLEMANN_WUNSCH),Y([K,Q],!0===z.value),Y([X],$.value===w.Z.MONOMER_CHEMICAL_DISTANCE||$.value===w.Z.NEEDLEMANN_WUNSCH)}J();const Z={};function tt(t,e){if(et(),null==e||""===e)return;Z[t]=e;let n=!0;for(const[t,e]of Object.entries(Z))if(e!==R[t]){n=!1;break}n?delete O.mclSettings:O.mclSettings=Object.assign(Object.assign({},R),Z)}function et(){Y([it,rt],nt.value===w.Z.NEEDLEMANN_WUNSCH),Y([ot],nt.value===w.Z.MONOMER_CHEMICAL_DISTANCE||nt.value===w.Z.NEEDLEMANN_WUNSCH)}const nt=u.input.choice(l.DISTANCE_FUNCTION,{value:R.distanceF,items:[w.Z.NEEDLEMANN_WUNSCH,w.Z.MONOMER_CHEMICAL_DISTANCE,w.Z.HAMMING,w.Z.LEVENSHTEIN],onValueChanged:t=>tt("distanceF",t)}),it=u.input.float(l.GAP_OPEN,{value:R.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),rt=u.input.float(l.GAP_EXTEND,{value:R.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),ot=u.input.choice(l.FINGERPRINT_TYPE,{value:R.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=u.input.int(l.THRESHOLD,{value:null!==(A=R.threshold)&&void 0!==A?A:80,onValueChanged:t=>tt("threshold",t)}),at=u.input.int(l.MAX_ITERATIONS,{value:null!==(E=R.maxIterations)&&void 0!==E?E:5,onValueChanged:t=>tt("maxIterations",t)}),lt=u.input.float(l.INFLATION,{value:null!==(S=R.inflation)&&void 0!==S?S:1.4,onValueChanged:t=>{tt("inflation",t)}}),ut=u.input.bool(l.USE_WEBGPU,{value:R.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ut.enabled=!1,R.webGPUDescriptionPromise.then((()=>{R.webGPUDescription!==d.Ku?(ut.setTooltip(`Use WebGPU for MCL algorithm (${R.webGPUDescription})`),ut.enabled=!0):(ut.setTooltip(d.Ku),ut.enabled=!1,ut.value=!1)}));const ct=u.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(T=R.minClusterSize)&&void 0!==T?T:5,onValueChanged:t=>tt("minClusterSize",t)});et();const ht=[st,nt,ot,it,rt,lt,at,ct,ut];x.addPane(i.MCL,(()=>u.inputs(ht)),!0),L[i.MCL]=ht;const dt=[$,X,j,W,z,K,Q],ft=x.addPane(i.SEQUENCE_SPACE,(()=>u.inputs(dt)),!0);L[i.SEQUENCE_SPACE]=dt,V.fireChanged();const pt=u.dialog("Peptides settings").add(x);return pt.root.style.width="400px",pt.onOK((()=>{t.settings=O})),pt.show(),{dialog:pt,accordion:x,inputs:L}}},144:function(t){var e;e=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={exports:{},id:i,loaded:!1};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var i=n(1).default,r=n(39).default,o=n(52).default,s=n(40).default,a=n(54).default,l=n(80).default,u=n(84).default,c=n(65).default,h=t.exports=function(t){if(!p(t))throw new Error("wu: `"+t+"` is not iterable!");return new d(t)};function d(t){var e=m(t);this.next=e.next.bind(e)}h.prototype=d.prototype,h.prototype[o]=function(){return this};var f={},p=function(t){return t&&"function"==typeof t[o]},m=function(t){if(p(t))return s(t);throw new TypeError("Not iterable: "+t)},g=function(t,e){e.prototype=d.prototype,h[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=d.prototype,d.prototype[t]=e,n+=1,void(h[t]=h.curryable((function(){for(var e,n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=i.pop();return(e=h(o))[t].apply(e,i)}),n))},y=function(t){return function(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return h(t.call.apply(t,[this].concat(n)))}},C=function(t,e){return g(t,y(e))},w=function(t,e,n){return v(t,y(e),n)};g("curryable",(function(t){var e=arguments.length<=1||void 0===arguments[1]?t.length:arguments[1];return function n(){for(var r=arguments.length,o=Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e?t.apply(this,o):function(t,e){return function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.call.apply(t,[this].concat(i(e),r))}}(n,o)}})),C("entries",a.mark((function t(e){var n,i,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.next()).done){t.next=12;break}return c=u.value,t.next=9,[c,e[c]];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),C("keys",a.mark((function t(e){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(l(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("values",a.mark((function t(e){var n,i,r,o,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(l(e));case 5:if(n=(u=o.next()).done){t.next=12;break}return c=u.value,t.next=9,e[c];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("cycle",a.mark((function t(){var e,n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.next()).done){t.next=14;break}return u=l.value,t.next=10,u;case 10:e.push(u);case 11:n=!0,t.next=6;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(4),i=!0,r=t.t0;case 20:t.prev=20,t.prev=21,!n&&o.return&&o.return();case 23:if(t.prev=23,!i){t.next=26;break}throw r;case 26:return t.finish(23);case 27:return t.finish(20);case 28:if(!e){t.next=32;break}return t.delegateYield(e,"t1",30);case 30:t.next=28;break;case 32:case"end":return t.stop()}}),t,this,[[4,16,20,28],[21,,23,27]])}))),C("count",a.mark((function t(){var e,n=arguments.length<=0||void 0===arguments[0]?0:arguments[0],i=arguments.length<=1||void 0===arguments[1]?1:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=n;case 1:return t.next=4,e;case 4:e+=i,t.next=1;break;case 7:case"end":return t.stop()}}),t,this)}))),C("repeat",a.mark((function t(e){var n,i=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i!==1/0){t.next=8;break}case 1:return t.next=4,e;case 4:t.next=1;break;case 6:t.next=15;break;case 8:n=0;case 9:if(!(n<i)){t.next=15;break}return t.next=12,e;case 12:n++,t.next=9;break;case 15:case"end":return t.stop()}}),t,this)}))),C("chain",a.mark((function t(){var e,n,i,r,o,l,u,c,h,d=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=!0,n=!1,i=void 0,t.prev=3,r=d.length,o=Array(r),l=0;l<r;l++)o[l]=d[l];u=s(o);case 6:if(e=(c=u.next()).done){t.next=12;break}return h=c.value,t.delegateYield(h,"t0",9);case 9:e=!0,t.next=6;break;case 12:t.next=18;break;case 14:t.prev=14,t.t1=t.catch(3),n=!0,i=t.t1;case 18:t.prev=18,t.prev=19,!e&&u.return&&u.return();case 21:if(t.prev=21,!n){t.next=24;break}throw i;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("chunk",a.mark((function t(){var e,n,i,r,o,l,u,c,h=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=0,i=!0,r=!1,o=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=18;break}if(c=u.value,e[n++]=c,n!==h){t.next=15;break}return t.next=13,e;case 13:e=[],n=0;case 15:i=!0,t.next=7;break;case 18:t.next=24;break;case 20:t.prev=20,t.t0=t.catch(5),r=!0,o=t.t0;case 24:t.prev=24,t.prev=25,!i&&l.return&&l.return();case 27:if(t.prev=27,!r){t.next=30;break}throw o;case 30:return t.finish(27);case 31:return t.finish(24);case 32:if(!n){t.next=35;break}return t.next=35,e;case 35:case"end":return t.stop()}}),t,this,[[5,20,24,32],[25,,27,31]])})),1),w("concatMap",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.next()).done){t.next=11;break}return u=l.value,t.delegateYield(e(u),"t0",8);case 8:n=!0,t.next=5;break;case 11:t.next=17;break;case 13:t.prev=13,t.t1=t.catch(3),i=!0,r=t.t1;case 17:t.prev=17,t.prev=18,!n&&o.return&&o.return();case 20:if(t.prev=20,!i){t.next=23;break}throw r;case 23:return t.finish(20);case 24:return t.finish(17);case 25:case"end":return t.stop()}}),t,this,[[3,13,17,25],[18,,20,24]])}))),w("drop",a.mark((function t(e){var n,i,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,i=!0,r=!1,o=void 0,t.prev=4,l=s(this);case 6:if(i=(u=l.next()).done){t.next=16;break}if(c=u.value,!(n++<e)){t.next=10;break}return t.abrupt("continue",13);case 10:return t.next=12,c;case 12:return t.abrupt("break",16);case 13:i=!0,t.next=6;break;case 16:t.next=22;break;case 18:t.prev=18,t.t0=t.catch(4),r=!0,o=t.t0;case 22:t.prev=22,t.prev=23,!i&&l.return&&l.return();case 25:if(t.prev=25,!r){t.next=28;break}throw o;case 28:return t.finish(25);case 29:return t.finish(22);case 30:return t.delegateYield(this,"t1",31);case 31:case"end":return t.stop()}}),t,this,[[4,18,22,30],[23,,25,29]])}))),w("dropWhile",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=15;break}if(l=o.value,!u(l)){t.next=9;break}return t.abrupt("continue",12);case 9:return t.next=11,l;case 11:return t.abrupt("break",15);case 12:e=!0,t.next=5;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(3),n=!0,i=t.t0;case 21:t.prev=21,t.prev=22,!e&&r.return&&r.return();case 24:if(t.prev=24,!n){t.next=27;break}throw i;case 27:return t.finish(24);case 28:return t.finish(21);case 29:return t.delegateYield(this,"t1",30);case 30:case"end":return t.stop()}}),t,this,[[3,17,21,29],[22,,24,28]])})),1),w("enumerate",a.mark((function t(){return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b([this,h.count()]),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),w("filter",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.value,!u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&r.return&&r.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("flatten",a.mark((function t(){var e,n,i,r,o,l,u=!(arguments.length<=0||void 0===arguments[0])&&arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=16;break}if("string"==typeof(l=o.value)||!p(l)){t.next=11;break}return t.delegateYield(u?l:h(l).flatten(),"t0",9);case 9:t.next=13;break;case 11:return t.next=13,l;case 13:e=!0,t.next=5;break;case 16:t.next=22;break;case 18:t.prev=18,t.t1=t.catch(3),n=!0,i=t.t1;case 22:t.prev=22,t.prev=23,!e&&r.return&&r.return();case 25:if(t.prev=25,!n){t.next=28;break}throw i;case 28:return t.finish(25);case 29:return t.finish(22);case 30:case"end":return t.stop()}}),t,this,[[3,18,22,30],[23,,25,29]])})),1),w("invoke",a.mark((function t(e){var n,i,r,o,l,u,c,h,d,f=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=!0,i=!1,r=void 0,t.prev=3,o=f.length,l=Array(o>1?o-1:0),u=1;u<o;u++)l[u-1]=f[u];c=s(this);case 6:if(n=(h=c.next()).done){t.next=13;break}return d=h.value,t.next=10,d[e].apply(d,l);case 10:n=!0,t.next=6;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),i=!0,r=t.t0;case 19:t.prev=19,t.prev=20,!n&&c.return&&c.return();case 22:if(t.prev=22,!i){t.next=25;break}throw r;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])}))),w("map",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.next()).done){t.next=12;break}return u=l.value,t.next=9,e(u);case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("pluck",a.mark((function t(e){var n,i,r,o,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,r=void 0,t.prev=3,o=s(this);case 5:if(n=(l=o.next()).done){t.next=12;break}return u=l.value,t.next=9,u[e];case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),i=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&o.return&&o.return();case 21:if(t.prev=21,!i){t.next=24;break}throw r;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("reductions",a.mark((function t(e){var n,i,r,o,l,u,c,h,d,f,p,m,g=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=g)){t.next=28;break}i=!0,r=!1,o=void 0,t.prev=5,l=s(this);case 7:if(i=(u=l.next()).done){t.next=14;break}return c=u.value,n=c,t.abrupt("break",14);case 11:i=!0,t.next=7;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(5),r=!0,o=t.t0;case 20:t.prev=20,t.prev=21,!i&&l.return&&l.return();case 23:if(t.prev=23,!r){t.next=26;break}throw o;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return t.next=30,n;case 30:h=!0,d=!1,f=void 0,t.prev=33,p=s(this);case 35:if(h=(m=p.next()).done){t.next=42;break}return c=m.value,t.next=39,n=e(n,c);case 39:h=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),d=!0,f=t.t1;case 48:t.prev=48,t.prev=49,!h&&p.return&&p.return();case 51:if(t.prev=51,!d){t.next=54;break}throw f;case 54:return t.finish(51);case 55:return t.finish(48);case 56:return t.abrupt("return",n);case 57:case"end":return t.stop()}}),t,this,[[5,16,20,28],[21,,23,27],[33,44,48,56],[49,,51,55]])})),2),w("reject",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}if(l=o.value,u(l)){t.next=10;break}return t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&r.return&&r.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("slice",a.mark((function t(){var e,n,i,o,l,u,c,h,d=arguments.length<=0||void 0===arguments[0]?0:arguments[0],f=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(f<d)){t.next=2;break}throw new RangeError("parameter `stop` (= "+f+") must be >= `start` (= "+d+")");case 2:e=!0,n=!1,i=void 0,t.prev=5,o=s(this.enumerate());case 7:if(e=(l=o.next()).done){t.next=20;break}if(u=r(l.value,2),c=u[0],!((h=u[1])<d)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(h>=f)){t.next=15;break}return t.abrupt("break",20);case 15:return t.next=17,c;case 17:e=!0,t.next=7;break;case 20:t.next=26;break;case 22:t.prev=22,t.t0=t.catch(5),n=!0,i=t.t0;case 26:t.prev=26,t.prev=27,!e&&o.return&&o.return();case 29:if(t.prev=29,!n){t.next=32;break}throw i;case 32:return t.finish(29);case 33:return t.finish(26);case 34:case"end":return t.stop()}}),t,this,[[5,22,26,34],[27,,29,33]])})),2),w("spreadMap",a.mark((function t(e){var n,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,r=!1,o=void 0,t.prev=3,l=s(this);case 5:if(n=(u=l.next()).done){t.next=12;break}return c=u.value,t.next=9,e.apply(void 0,i(c));case 9:n=!0,t.next=5;break;case 12:t.next=18;break;case 14:t.prev=14,t.t0=t.catch(3),r=!0,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&l.return&&l.return();case 21:if(t.prev=21,!r){t.next=24;break}throw o;case 24:return t.finish(21);case 25:return t.finish(18);case 26:case"end":return t.stop()}}),t,this,[[3,14,18,26],[19,,21,25]])}))),w("take",a.mark((function t(e){var n,i,r,o,l,u,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e<1)){t.next=2;break}return t.abrupt("return");case 2:n=0,i=!0,r=!1,o=void 0,t.prev=6,l=s(this);case 8:if(i=(u=l.next()).done){t.next=17;break}return c=u.value,t.next=12,c;case 12:if(!(++n>=e)){t.next=14;break}return t.abrupt("break",17);case 14:i=!0,t.next=8;break;case 17:t.next=23;break;case 19:t.prev=19,t.t0=t.catch(6),r=!0,o=t.t0;case 23:t.prev=23,t.prev=24,!i&&l.return&&l.return();case 26:if(t.prev=26,!r){t.next=29;break}throw o;case 29:return t.finish(26);case 30:return t.finish(23);case 31:case"end":return t.stop()}}),t,this,[[6,19,23,31],[24,,26,30]])}))),w("takeWhile",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=14;break}if(l=o.value,u(l)){t.next=9;break}return t.abrupt("break",14);case 9:return t.next=11,l;case 11:e=!0,t.next=5;break;case 14:t.next=20;break;case 16:t.prev=16,t.t0=t.catch(3),n=!0,i=t.t0;case 20:t.prev=20,t.prev=21,!e&&r.return&&r.return();case 23:if(t.prev=23,!n){t.next=26;break}throw i;case 26:return t.finish(23);case 27:return t.finish(20);case 28:case"end":return t.stop()}}),t,this,[[3,16,20,28],[21,,23,27]])})),1),w("tap",a.mark((function t(){var e,n,i,r,o,l,u=arguments.length<=0||void 0===arguments[0]?console.log.bind(console):arguments[0];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=!0,n=!1,i=void 0,t.prev=3,r=s(this);case 5:if(e=(o=r.next()).done){t.next=13;break}return l=o.value,u(l),t.next=10,l;case 10:e=!0,t.next=5;break;case 13:t.next=19;break;case 15:t.prev=15,t.t0=t.catch(3),n=!0,i=t.t0;case 19:t.prev=19,t.prev=20,!e&&r.return&&r.return();case 22:if(t.prev=22,!n){t.next=25;break}throw i;case 25:return t.finish(22);case 26:return t.finish(19);case 27:case"end":return t.stop()}}),t,this,[[3,15,19,27],[20,,22,26]])})),1),w("unique",a.mark((function t(){var e,n,i,r,o,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new u,n=!0,i=!1,r=void 0,t.prev=4,o=s(this);case 6:if(n=(l=o.next()).done){t.next=15;break}if(c=l.value,e.has(c)){t.next=12;break}return t.next=11,c;case 11:e.add(c);case 12:n=!0,t.next=6;break;case 15:t.next=21;break;case 17:t.prev=17,t.t0=t.catch(4),i=!0,r=t.t0;case 21:t.prev=21,t.prev=22,!n&&o.return&&o.return();case 24:if(t.prev=24,!i){t.next=27;break}throw r;case 27:return t.finish(24);case 28:return t.finish(21);case 29:e.clear();case 30:case"end":return t.stop()}}),t,this,[[4,17,21,29],[22,,24,28]])})));var b=y(a.mark((function t(e){var n,i,r,o,l,u,c,h,d,f,p,g,v,y=!(arguments.length<=1||void 0===arguments[1])&&arguments[1];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.length){t.next=2;break}return t.abrupt("return");case 2:n=e.map(m),i=e.length,r=0,o=!1;case 6:if(o){t.next=44;break}l=[],u=!0,c=!1,h=void 0,t.prev=11,d=s(n);case 13:if(u=(f=d.next()).done){t.next=26;break}if(p=f.value,g=p.next(),v=g.value,!g.done){t.next=22;break}if(y){t.next=21;break}return t.abrupt("return");case 21:++r==i&&(o=!0);case 22:void 0===v?l.length++:l.push(v);case 23:u=!0,t.next=13;break;case 26:t.next=32;break;case 28:t.prev=28,t.t0=t.catch(11),c=!0,h=t.t0;case 32:t.prev=32,t.prev=33,!u&&d.return&&d.return();case 35:if(t.prev=35,!c){t.next=38;break}throw h;case 38:return t.finish(35);case 39:return t.finish(32);case 40:return t.next=42,l;case 42:t.next=6;break;case 44:case"end":return t.stop()}}),t,this,[[11,28,32,40],[33,,35,39]])})));C("zip",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(n),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipLongest",a.mark((function t(){for(var e=arguments.length,n=Array(e),i=0;i<e;i++)n[i]=arguments[i];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(n,!0),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),C("zipWith",a.mark((function t(e){for(var n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(b(i).spreadMap(e),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),h.MAX_BLOCK=15,h.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?h.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?h.TIMEOUT:arguments[2],i=m(this);return new c((function(r,o){!function a(){var l=Date.now(),u=!0,c=!1,h=void 0;try{for(var d,f=s(i);!(u=(d=f.next()).done);u=!0){var p=d.value;try{t(p)}catch(t){return void o(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){c=!0,h=t}finally{try{!u&&f.return&&f.return()}finally{if(c)throw h}}r()}()}))}),3),v("every",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)if(!t(r.value))return!1}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}return!0}),1),v("find",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0){var a=r.value;if(t(a))return a}}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}})),v("forEach",(function(t){var e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)t(r.value)}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}})),v("has",(function(t){return this.some((function(e){return e===t}))})),v("reduce",(function(t){var e=arguments.length<=1||void 0===arguments[1]?void 0:arguments[1];if(void 0===e){var n=!0,i=!1,r=void 0;try{for(var o,a=s(this);!(n=(o=a.next()).done);n=!0){e=o.value;break}}catch(t){i=!0,r=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw r}}}var l=!0,u=!1,c=void 0;try{for(var h,d=s(this);!(l=(h=d.next()).done);l=!0)e=t(e,h.value)}catch(t){u=!0,c=t}finally{try{!l&&d.return&&d.return()}finally{if(u)throw c}}return e}),2),v("some",(function(){var t=arguments.length<=0||void 0===arguments[0]?Boolean:arguments[0],e=!0,n=!1,i=void 0;try{for(var r,o=s(this);!(e=(r=o.next()).done);e=!0)if(t(r.value))return!0}catch(t){n=!0,i=t}finally{try{!e&&o.return&&o.return()}finally{if(n)throw i}}return!1}),1),v("toArray",(function(){return[].concat(i(this))}));var A=y(a.mark((function t(e,n){var i,r,o,s,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n.items,r=0;case 2:if(r!==i.length){t.next=14;break}if(o=e.next(),s=o.done,l=o.value,!s){t.next=10;break}return n.returned===f&&(n.returned=l),t.abrupt("break",25);case 10:return t.next=12,i[r++]=l;case 12:t.next=23;break;case 14:if(r!==n.tail){t.next=21;break}return l=i[r],500===r?(i=n.items=i.slice(r),r=0,n.tail=0):(i[r]=void 0,n.tail=++r),t.next=19,l;case 19:t.next=23;break;case 21:return t.next=23,i[r++];case 23:t.next=2;break;case 25:return n.tail===r&&(i.length=0),t.abrupt("return",n.returned);case 27:case"end":return t.stop()}}),t,this)})));A.prototype=d.prototype,v("tee",(function(){for(var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0],e=new Array(t),n={tail:0,items:[],returned:f};t--;)e[t]=A(this,n);return e}),1),v("unzip",(function(){var t=arguments.length<=0||void 0===arguments[0]?2:arguments[0];return this.tee(t).map((function(t,e){return t.pluck(e)}))}),1),h.tang={clan:36}},function(t,e,n){"use strict";var i=n(2).default;e.default=function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return i(t)},e.__esModule=!0},function(t,e,n){t.exports={default:n(3),__esModule:!0}},function(t,e,n){n(4),n(26),t.exports=n(12).Array.from},function(t,e,n){"use strict";var i=n(5)(!0);n(8)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=i(e,n),this._i+=t.length,{value:t,done:!1})}))},function(t,e,n){var i=n(6),r=n(7);t.exports=function(t){return function(e,n){var o,s,a=String(r(e)),l=i(n),u=a.length;return l<0||l>=u?t?"":void 0:(o=a.charCodeAt(l))<55296||o>56319||l+1===u||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):o:t?a.slice(l,l+2):s-56320+(o-55296<<10)+65536}}},function(t,e){var n=Math.ceil,i=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?i:n)(t)}},function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";var i=n(9),r=n(10),o=n(13),s=n(14),a=n(19),l=n(20)("iterator"),u=n(23),c=!([].keys&&"next"in[].keys()),h="@@iterator",d="keys",f="values",p=function(){return this};t.exports=function(t,e,m,g,v,y,C){n(24)(m,e,g);var w,b,A=function(t){switch(t){case d:case f:return function(){return new m(this,t)}}return function(){return new m(this,t)}},E=e+" Iterator",S=t.prototype,T=S[l]||S[h]||v&&S[v],x=T||A(v);if(T){var _=n(15).getProto(x.call(new t));n(25)(_,E,!0),!i&&a(S,h)&&s(_,l,p)}if(i&&!C||s(S,l,x),u[e]=x,u[E]=p,v)if(w={keys:y?x:A(d),values:v==f?x:A(f),entries:v!=f?x:A("entries")},C)for(b in w)b in S||o(S,b,w[b]);else r(r.P+r.F*c,e,w)}},function(t,e){t.exports=!0},function(t,e,n){var i=n(11),r=n(12),o="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e,n){var l,u,c,h,d=t&a.G,f=t&a.P,p=d?i:t&a.S?i[e]:(i[e]||{})[o],m=d?r:r[e]||(r[e]={});for(l in d&&(n=e),n)(u=!(t&a.F)&&p&&l in p)&&l in m||(c=u?p[l]:n[l],d&&"function"!=typeof p[l]?h=n[l]:t&a.B&&u?h=s(c,i):t&a.W&&p[l]==c?function(t){(h=function(e){return this instanceof t?new t(e):t(e)})[o]=t[o]}(c):h=f&&"function"==typeof c?s(Function.call,c):c,m[l]=h,f&&((m[o]||(m[o]={}))[l]=c))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,t.exports=a},function(t,e){var n="undefined",i=t.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){var n=t.exports={version:"1.2.0"};"number"==typeof __e&&(__e=n)},function(t,e,n){t.exports=n(14)},function(t,e,n){var i=n(15),r=n(16);t.exports=n(17)?function(t,e,n){return i.setDesc(t,e,r(1,n))}:function(t,e,n){return t[e]=n,t}},function(t,e){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){t.exports=!n(18)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){var i=n(21)("wks"),r=n(11).Symbol;t.exports=function(t){return i[t]||(i[t]=r&&r[t]||(r||n(22))("Symbol."+t))}},function(t,e,n){var i=n(11),r="__core-js_shared__",o=i[r]||(i[r]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e){var n=0,i=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+i).toString(36))}},function(t,e){t.exports={}},function(t,e,n){"use strict";var i=n(15),r={};n(14)(r,n(20)("iterator"),(function(){return this})),t.exports=function(t,e,o){t.prototype=i.create(r,{next:n(16)(1,o)}),n(25)(t,e+" Iterator")}},function(t,e,n){var i=n(19),r=n(14),o=n(20)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,o)&&r(t,o,e)}},function(t,e,n){"use strict";var i=n(27),r=n(10),o=n(29),s=n(30),a=n(33),l=n(34),u=n(35);r(r.S+r.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,r,c,h=o(t),d="function"==typeof this?this:Array,f=arguments[1],p=void 0!==f,m=0,g=u(h);if(p&&(f=i(f,arguments[2],2)),null==g||d==Array&&a(g))for(n=new d(e=l(h.length));e>m;m++)n[m]=p?f(h[m],m):h[m];else for(c=g.call(h),n=new d;!(r=c.next()).done;m++)n[m]=p?s(c,f,[r.value,m],!0):r.value;return n.length=m,n}})},function(t,e,n){var i=n(28);t.exports=function(t,e,n){if(i(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,i){return t.call(e,n,i)};case 3:return function(n,i,r){return t.call(e,n,i,r)}}return function(){return t.apply(e,arguments)}}},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var i=n(7);t.exports=function(t){return Object(i(t))}},function(t,e,n){var i=n(31);t.exports=function(t,e,n,r){try{return r?e(i(n)[0],n[1]):e(n)}catch(e){var o=t.return;throw void 0!==o&&i(o.call(t)),e}}},function(t,e,n){var i=n(32);t.exports=function(t){if(!i(t))throw TypeError(t+" is not an object!");return t}},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var i=n(23),r=n(20)("iterator");t.exports=function(t){return(i.Array||Array.prototype[r])===t}},function(t,e,n){var i=n(6),r=Math.min;t.exports=function(t){return t>0?r(i(t),9007199254740991):0}},function(t,e,n){var i=n(36),r=n(20)("iterator"),o=n(23);t.exports=n(12).getIteratorMethod=function(t){if(null!=t)return t[r]||t["@@iterator"]||o[i(t)]}},function(t,e,n){var i=n(37),r=n(20)("toStringTag"),o="Arguments"==i(function(){return arguments}());t.exports=function(t){var e,n,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=(e=Object(t))[r])?n:o?i(e):"Object"==(s=i(e))&&"function"==typeof e.callee?"Arguments":s}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var i=n(20)("iterator"),r=!1;try{var o=[7][i]();o.return=function(){r=!0},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t){if(!r)return!1;var e=!1;try{var n=[7],o=n[i]();o.next=function(){e=!0},n[i]=function(){return o},t(n)}catch(t){}return e}},function(t,e,n){"use strict";var i=n(40).default,r=n(49).default;e.default=function(t,e){if(Array.isArray(t))return t;if(r(Object(t)))return function(t,e){var n=[],r=!0,o=!1,s=void 0;try{for(var a,l=i(t);!(r=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,s=t}finally{try{!r&&l.return&&l.return()}finally{if(o)throw s}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},e.__esModule=!0},function(t,e,n){t.exports={default:n(41),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(48)},function(t,e,n){n(43);var i=n(23);i.NodeList=i.HTMLCollection=i.Array},function(t,e,n){"use strict";var i=n(44),r=n(45),o=n(23),s=n(46);n(8)(Array,"Array",(function(t,e){this._t=s(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,r(1)):r(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),o.Arguments=o.Array,i("keys"),i("values"),i("entries")},function(t,e){t.exports=function(){}},function(t,e){t.exports=function(t,e){return{value:e,done:!!t}}},function(t,e,n){var i=n(47),r=n(7);t.exports=function(t){return i(r(t))}},function(t,e,n){var i=n(37);t.exports=0 in Object("z")?Object:function(t){return"String"==i(t)?t.split(""):Object(t)}},function(t,e,n){var i=n(31),r=n(35);t.exports=n(12).getIterator=function(t){var e=r(t);if("function"!=typeof e)throw TypeError(t+" is not iterable!");return i(e.call(t))}},function(t,e,n){t.exports={default:n(50),__esModule:!0}},function(t,e,n){n(42),n(4),t.exports=n(51)},function(t,e,n){var i=n(36),r=n(20)("iterator"),o=n(23);t.exports=n(12).isIterable=function(t){var e=Object(t);return r in e||"@@iterator"in e||o.hasOwnProperty(i(e))}},function(t,e,n){t.exports={default:n(53),__esModule:!0}},function(t,e,n){n(4),n(42),t.exports=n(20)("iterator")},function(t,e,n){(function(e){var i="object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:this,r=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,o=r&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n(55),r)i.regeneratorRuntime=o;else try{delete i.regeneratorRuntime}catch(t){i.regeneratorRuntime=void 0}t.exports={default:t.exports,__esModule:!0}}).call(e,function(){return this}())},function(t,e,n){(function(e,i){"use strict";var r=n(57).default,o=n(52).default,s=n(63).default,a=n(65).default;!function(e){var n,l=Object.prototype.hasOwnProperty,u="function"==typeof r&&o||"@@iterator",c="object"==typeof t,h=e.regeneratorRuntime;if(h)c&&(t.exports=h);else{(h=e.regeneratorRuntime=c?t.exports:{}).wrap=y;var d="suspendedStart",f="suspendedYield",p="executing",m="completed",g={},v=A.prototype=w.prototype;b.prototype=v.constructor=A,A.constructor=b,b.displayName="GeneratorFunction",h.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},h.mark=function(t){return t.__proto__=A,t.prototype=s(v),t},h.awrap=function(t){return new S(t)},E(T.prototype),h.async=function(t,e,n,i){var r=new T(y(t,e,n,i));return h.isGeneratorFunction(e)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},E(v),v[u]=function(){return this},v.toString=function(){return"[object Generator]"},h.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var i=e.pop();if(i in t)return n.value=i,n.done=!1,n}return n.done=!0,n}},h.values=M,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=n,this.done=!1,this.delegate=null,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&l.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return o.type="throw",o.arg=t,e.next=n,!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var r=this.tryEntries[i],o=r.completion;if("root"===r.tryLoc)return n("end");if(r.tryLoc<=this.prev){var s=l.call(r,"catchLoc"),a=l.call(r,"finallyLoc");if(s&&a){if(this.prev<r.catchLoc)return n(r.catchLoc,!0);if(this.prev<r.finallyLoc)return n(r.finallyLoc)}else if(s){if(this.prev<r.catchLoc)return n(r.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<r.finallyLoc)return n(r.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&l.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var r=i;break}}r&&("break"===t||"continue"===t)&&r.tryLoc<=e&&e<=r.finallyLoc&&(r=null);var o=r?r.completion:{};return o.type=t,o.arg=e,r?this.next=r.finallyLoc:this.complete(o),g},complete:function(t,e){if("throw"===t.type)throw t.arg;"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=t.arg,this.next="end"):"normal"===t.type&&e&&(this.next=e)},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),_(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var i=n.completion;if("throw"===i.type){var r=i.arg;_(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:M(t),resultName:e,nextLoc:n},g}}}function y(t,e,i,r){var o=s((e||w).prototype);return o._invoke=function(t,e,i){var r=d;return function(o,s){if(r===p)throw new Error("Generator is already running");if(r===m){if("throw"===o)throw s;return O()}for(;;){var a=i.delegate;if(a){if("return"===o||"throw"===o&&a.iterator[o]===n){i.delegate=null;var l=a.iterator.return;if(l&&"throw"===(u=C(l,a.iterator,s)).type){o="throw",s=u.arg;continue}if("return"===o)continue}var u;if("throw"===(u=C(a.iterator[o],a.iterator,s)).type){i.delegate=null,o="throw",s=u.arg;continue}if(o="next",s=n,!(c=u.arg).done)return r=f,c;i[a.resultName]=c.value,i.next=a.nextLoc,i.delegate=null}if("next"===o)i.sent=r===f?s:n;else if("throw"===o){if(r===d)throw r=m,s;i.dispatchException(s)&&(o="next",s=n)}else"return"===o&&i.abrupt("return",s);if(r=p,"normal"===(u=C(t,e,i)).type){r=i.done?m:f;var c={value:u.arg,done:i.done};if(u.arg!==g)return c;i.delegate&&"next"===o&&(s=n)}else"throw"===u.type&&(r=m,o="throw",s=u.arg)}}}(t,i||null,new N(r||[])),o}function C(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function w(){}function b(){}function A(){}function E(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function S(t){this.arg=t}function T(t){function e(e,n){var i=t[e](n),s=i.value;return s instanceof S?a.resolve(s.arg).then(r,o):a.resolve(s).then((function(t){return i.value=t,i}))}"object"==typeof i&&i.domain&&(e=i.domain.bind(e));var n,r=e.bind(t,"next"),o=e.bind(t,"throw");e.bind(t,"return"),this._invoke=function(t,i){var r=n?n.then((function(){return e(t,i)})):new a((function(n){n(e(t,i))}));return n=r.catch((function(t){})),r}}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function M(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,r=function e(){for(;++i<t.length;)if(l.call(t,i))return e.value=t[i],e.done=!1,e;return e.value=n,e.done=!0,e};return r.next=r}}return{next:O}}function O(){return{value:n,done:!0}}}("object"==typeof e?e:"object"==typeof window?window:"object"==typeof self?self:void 0)}).call(e,function(){return this}(),n(56))},function(t,e){var n,i=t.exports={},r=[],o=!1,s=-1;function a(){o=!1,n.length?r=n.concat(r):s=-1,r.length&&l()}function l(){if(!o){var t=setTimeout(a);o=!0;for(var e=r.length;e;){for(n=r,r=[];++s<e;)n&&n[s].run();s=-1,e=r.length}n=null,o=!1,clearTimeout(t)}}function u(t,e){this.fun=t,this.array=e}function c(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];r.push(new u(t,e)),1!==r.length||o||setTimeout(l,0)},u.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=c,i.addListener=c,i.once=c,i.off=c,i.removeListener=c,i.removeAllListeners=c,i.emit=c,i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){t.exports={default:n(58),__esModule:!0}},function(t,e,n){n(59),t.exports=n(12).Symbol},function(t,e,n){"use strict";var i=n(15),r=n(11),o=n(19),s=n(17),a=n(10),l=n(13),u=n(18),c=n(21),h=n(25),d=n(22),f=n(20),p=n(60),m=n(61),g=n(62),v=n(32),y=n(31),C=n(46),w=n(16),b=i.getDesc,A=i.setDesc,E=i.create,S=m.get,T=r.Symbol,x=!1,_=f("_hidden"),N=i.isEnum,M=c("symbol-registry"),O=c("symbols"),L="function"==typeof T,I=Object.prototype,R=s&&u((function(){return 7!=E(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a}))?function(t,e,n){var i=b(I,e);i&&delete I[e],A(t,e,n),i&&t!==I&&A(I,e,i)}:A,P=function(t){var e=O[t]=E(T.prototype);return e._k=t,s&&x&&R(I,t,{configurable:!0,set:function(e){o(this,_)&&o(this[_],t)&&(this[_][t]=!1),R(this,t,w(1,e))}}),e},k=function(t,e,n){return n&&o(O,e)?(n.enumerable?(o(t,_)&&t[_][e]&&(t[_][e]=!1),n=E(n,{enumerable:w(0,!1)})):(o(t,_)||A(t,_,w(1,{})),t[_][e]=!0),R(t,e,n)):A(t,e,n)},D=function(t,e){y(t);for(var n,i=g(e=C(e)),r=0,o=i.length;o>r;)k(t,n=i[r++],e[n]);return t},G=function(t,e){return void 0===e?E(t):D(E(t),e)},U=function(t){var e=N.call(this,t);return!(e||!o(this,t)||!o(O,t)||o(this,_)&&this[_][t])||e},V=function(t,e){var n=b(t=C(t),e);return!n||!o(O,e)||o(t,_)&&t[_][e]||(n.enumerable=!0),n},F=function(t){for(var e,n=S(C(t)),i=[],r=0;n.length>r;)o(O,e=n[r++])||e==_||i.push(e);return i},H=function(t){for(var e,n=S(C(t)),i=[],r=0;n.length>r;)o(O,e=n[r++])&&i.push(O[e]);return i};L||(T=function(){if(this instanceof T)throw TypeError("Symbol is not a constructor");return P(d(arguments[0]))},l(T.prototype,"toString",(function(){return this._k})),i.create=G,i.isEnum=U,i.getDesc=V,i.setDesc=k,i.setDescs=D,i.getNames=m.get=F,i.getSymbols=H,s&&!n(9)&&l(I,"propertyIsEnumerable",U,!0)),L&&!u((function(){return"[null]"!=JSON.stringify([T()])}))||l(T.prototype,"toJSON",(function(){if(L&&v(this))return this}));var B={for:function(t){return o(M,t+="")?M[t]:M[t]=T(t)},keyFor:function(t){return p(M,t)},useSetter:function(){x=!0},useSimple:function(){x=!1}};i.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),(function(t){var e=f(t);B[t]=L?e:P(e)})),x=!0,a(a.G+a.W,{Symbol:T}),a(a.S,"Symbol",B),a(a.S+a.F*!L,"Object",{create:G,defineProperty:k,defineProperties:D,getOwnPropertyDescriptor:V,getOwnPropertyNames:F,getOwnPropertySymbols:H}),h(T,"Symbol"),h(Math,"Math",!0),h(r.JSON,"JSON",!0)},function(t,e,n){var i=n(15),r=n(46);t.exports=function(t,e){for(var n,o=r(t),s=i.getKeys(o),a=s.length,l=0;a>l;)if(o[n=s[l++]]===e)return n}},function(t,e,n){var i={}.toString,r=n(46),o=n(15).getNames,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.get=function(t){return s&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return s.slice()}}(t):o(r(t))}},function(t,e,n){var i=n(15);t.exports=function(t){var e=i.getKeys(t),n=i.getSymbols;if(n)for(var r,o=n(t),s=i.isEnum,a=0;o.length>a;)s.call(t,r=o[a++])&&e.push(r);return e}},function(t,e,n){t.exports={default:n(64),__esModule:!0}},function(t,e,n){var i=n(15);t.exports=function(t,e){return i.create(t,e)}},function(t,e,n){t.exports={default:n(66),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(68),t.exports=n(12).Promise},function(t,e){},function(t,e,n){"use strict";var i,r=n(15),o=n(9),s=n(11),a=n(27),l=n(36),u=n(10),c=n(32),h=n(31),d=n(28),f=n(69),p=n(70),m=n(71).set,g=n(72),v=n(73),y=n(20)("species"),C=n(22)("record"),w=n(74),b="Promise",A=s.process,E="process"==l(A),S=s[b],T=function(t){var e=new S((function(){}));return t&&(e.constructor=Object),S.resolve(e)===e},x=function(){var t=!1;function e(t){var n=new S(t);return m(n,e.prototype),n}try{if(t=S&&S.resolve&&T(),m(e,S),e.prototype=r.create(S.prototype,{constructor:{value:e}}),e.resolve(5).then((function(){}))instanceof e||(t=!1),t&&n(17)){var i=!1;S.resolve(r.setDesc({},"then",{get:function(){i=!0}})),t=i}}catch(e){t=!1}return t}(),_=function(t){var e=h(t)[y];return null!=e?e:t},N=function(t){var e;return!(!c(t)||"function"!=typeof(e=t.then))&&e},M=function(t,e){if(!t.n){t.n=!0;var n=t.c;w((function(){for(var i=t.v,r=1==t.s,o=0,a=function(e){var n,o,s=r?e.ok:e.fail;try{s?(r||(t.h=!0),(n=!0===s?i:s(i))===e.P?e.rej(TypeError("Promise-chain cycle")):(o=N(n))?o.call(n,e.res,e.rej):e.res(n)):e.rej(i)}catch(t){e.rej(t)}};n.length>o;)a(n[o++]);n.length=0,t.n=!1,e&&setTimeout((function(){var e,n,r=t.p;O(r)&&(E?A.emit("unhandledRejection",i,r):(e=s.onunhandledrejection)?e({promise:r,reason:i}):(n=s.console)&&n.error&&n.error("Unhandled promise rejection",i)),t.a=void 0}),1)}))}},O=function(t){var e,n=t[C],i=n.a||n.c,r=0;if(n.h)return!1;for(;i.length>r;)if((e=i[r++]).fail||!O(e.P))return!1;return!0},L=function(t){var e=this;e.d||(e.d=!0,(e=e.r||e).v=t,e.s=2,e.a=e.c.slice(),M(e,!0))},I=function(t){var e,n=this;if(!n.d){n.d=!0,n=n.r||n;try{(e=N(t))?w((function(){var i={r:n,d:!1};try{e.call(t,a(I,i,1),a(L,i,1))}catch(t){L.call(i,t)}})):(n.v=t,n.s=1,M(n,!1))}catch(t){L.call({r:n,d:!1},t)}}};x||(S=function(t){d(t);var e={p:f(this,S,b),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};this[C]=e;try{t(a(I,e,1),a(L,e,1))}catch(t){L.call(e,t)}},n(79)(S.prototype,{then:function(t,e){var n=h(h(this).constructor)[y],i={ok:"function"!=typeof t||t,fail:"function"==typeof e&&e},r=i.P=new(null!=n?n:S)((function(t,e){i.res=t,i.rej=e}));d(i.res),d(i.rej);var o=this[C];return o.c.push(i),o.a&&o.a.push(i),o.s&&M(o,!1),r},catch:function(t){return this.then(void 0,t)}})),u(u.G+u.W+u.F*!x,{Promise:S}),n(25)(S,b),v(S),v(i=n(12)[b]),u(u.S+u.F*!x,b,{reject:function(t){return new this((function(e,n){n(t)}))}}),u(u.S+u.F*(!x||T(!0)),b,{resolve:function(t){return c(n=t)&&(x?"Promise"==l(n):C in n)&&(e=t.constructor,o&&e===S&&this===i||g(e,this))?t:new this((function(e){e(t)}));var e,n}}),u(u.S+u.F*!(x&&n(38)((function(t){S.all(t).catch((function(){}))}))),b,{all:function(t){var e=_(this),n=[];return new e((function(i,o){p(t,!1,n.push,n);var s=n.length,a=Array(s);s?r.each.call(n,(function(t,n){e.resolve(t).then((function(t){a[n]=t,--s||i(a)}),o)})):i(a)}))},race:function(t){var e=_(this);return new e((function(n,i){p(t,!1,(function(t){e.resolve(t).then(n,i)}))}))}})},function(t,e){t.exports=function(t,e,n){if(!(t instanceof e))throw TypeError(n+": use the 'new' operator!");return t}},function(t,e,n){var i=n(27),r=n(30),o=n(33),s=n(31),a=n(34),l=n(35);t.exports=function(t,e,n,u){var c,h,d,f=l(t),p=i(n,u,e?2:1),m=0;if("function"!=typeof f)throw TypeError(t+" is not iterable!");if(o(f))for(c=a(t.length);c>m;m++)e?p(s(h=t[m])[0],h[1]):p(t[m]);else for(d=f.call(t);!(h=d.next()).done;)r(d,p,h.value,e)}},function(t,e,n){var i=n(15).getDesc,r=n(32),o=n(31),s=function(t,e){if(o(t),!r(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,r){try{(r=n(27)(Function.call,i(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,n){return s(t,n),e?t.__proto__=n:r(t,n),t}}({},!1):void 0),check:s}},function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},function(t,e,n){"use strict";var i=n(15),r=n(20)("species");t.exports=function(t){n(17)&&!(r in t)&&i.setDesc(t,r,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i,r,o,s=n(11),a=n(75).set,l=s.MutationObserver||s.WebKitMutationObserver,u=s.process,c="process"==n(37)(u),h=function(){var t,e;for(c&&(t=u.domain)&&(u.domain=null,t.exit());i;)(e=i.domain)&&e.enter(),i.fn.call(),e&&e.exit(),i=i.next;r=void 0,t&&t.enter()};if(c)o=function(){u.nextTick(h)};else if(l){var d=1,f=document.createTextNode("");new l(h).observe(f,{characterData:!0}),o=function(){f.data=d=-d}}else o=function(){a.call(s,h)};t.exports=function(t){var e={fn:t,next:void 0,domain:c&&u.domain};r&&(r.next=e),i||(i=e,o()),r=e}},function(t,e,n){"use strict";var i,r,o,s=n(27),a=n(76),l=n(77),u=n(78),c=n(11),h=c.process,d=c.setImmediate,f=c.clearImmediate,p=c.MessageChannel,m=0,g={},v="onreadystatechange",y=function(){var t=+this;if(g.hasOwnProperty(t)){var e=g[t];delete g[t],e()}},C=function(t){y.call(t.data)};d&&f||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return g[++m]=function(){a("function"==typeof t?t:Function(t),e)},i(m),m},f=function(t){delete g[t]},"process"==n(37)(h)?i=function(t){h.nextTick(s(y,t,1))}:p?(o=(r=new p).port2,r.port1.onmessage=C,i=s(o.postMessage,o,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScript?(i=function(t){c.postMessage(t+"","*")},c.addEventListener("message",C,!1)):i=v in u("script")?function(t){l.appendChild(u("script"))[v]=function(){l.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:d,clear:f}},function(t,e){t.exports=function(t,e,n){var i=void 0===n;switch(e.length){case 0:return i?t():t.call(n);case 1:return i?t(e[0]):t.call(n,e[0]);case 2:return i?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return i?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return i?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},function(t,e,n){t.exports=n(11).document&&document.documentElement},function(t,e,n){var i=n(32),r=n(11).document,o=i(r)&&i(r.createElement);t.exports=function(t){return o?r.createElement(t):{}}},function(t,e,n){var i=n(13);t.exports=function(t,e){for(var n in e)i(t,n,e[n]);return t}},function(t,e,n){t.exports={default:n(81),__esModule:!0}},function(t,e,n){n(82),t.exports=n(12).Object.keys},function(t,e,n){var i=n(29);n(83)("keys",(function(t){return function(e){return t(i(e))}}))},function(t,e,n){t.exports=function(t,e){var i=n(10),r=(n(12).Object||{})[t]||Object[t],o={};o[t]=e(r),i(i.S+i.F*n(18)((function(){r(1)})),"Object",o)}},function(t,e,n){t.exports={default:n(85),__esModule:!0}},function(t,e,n){n(67),n(4),n(42),n(86),n(89),t.exports=n(12).Set},function(t,e,n){"use strict";var i=n(87);n(88)("Set",(function(t){return function(){return t(this,arguments[0])}}),{add:function(t){return i.def(this,t=0===t?0:t,t)}},i)},function(t,e,n){"use strict";var i=n(15),r=n(14),o=n(27),s=n(73),a=n(69),l=n(7),u=n(70),c=n(45),h=n(22)("id"),d=n(19),f=n(32),p=Object.isExtensible||f,m=n(17),g=m?"_s":"size",v=0,y=function(t,e){if(!f(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!d(t,h)){if(!p(t))return"F";if(!e)return"E";r(t,h,++v)}return"O"+t[h]},C=function(t,e){var n,i=y(e);if("F"!==i)return t._i[i];for(n=t._f;n;n=n.n)if(n.k==e)return n};t.exports={getConstructor:function(t,e,r,s){var c=t((function(t,n){a(t,c,e),t._i=i.create(null),t._f=void 0,t._l=void 0,t[g]=0,null!=n&&u(n,r,t[s],t)}));return n(79)(c.prototype,{clear:function(){for(var t=this,e=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete e[n.i];t._f=t._l=void 0,t[g]=0},delete:function(t){var e=this,n=C(e,t);if(n){var i=n.n,r=n.p;delete e._i[n.i],n.r=!0,r&&(r.n=i),i&&(i.p=r),e._f==n&&(e._f=i),e._l==n&&(e._l=r),e[g]--}return!!n},forEach:function(t){for(var e,n=o(t,arguments[1],3);e=e?e.n:this._f;)for(n(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!C(this,t)}}),m&&i.setDesc(c.prototype,"size",{get:function(){return l(this[g])}}),c},def:function(t,e,n){var i,r,o=C(t,e);return o?o.v=n:(t._l=o={i:r=y(e,!0),k:e,v:n,p:i=t._l,n:void 0,r:!1},t._f||(t._f=o),i&&(i.n=o),t[g]++,"F"!==r&&(t._i[r]=o)),t},getEntry:C,setStrong:function(t,e,i){n(8)(t,e,(function(t,e){this._t=t,this._k=e,this._l=void 0}),(function(){for(var t=this,e=t._k,n=t._l;n&&n.r;)n=n.p;return t._t&&(t._l=n=n?n.n:t._t._f)?c(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,c(1))}),i?"entries":"values",!i,!0),s(t),s(n(12)[e])}}},function(t,e,n){"use strict";var i=n(15),r=n(10),o=n(14),s=n(70),a=n(69);t.exports=function(t,e,l,u,c,h){var d=n(11)[t],f=d,p=c?"set":"add",m=f&&f.prototype,g={};return n(17)&&"function"==typeof f&&(h||m.forEach&&!n(18)((function(){(new f).entries().next()})))?(f=e((function(e,n){a(e,f,t),e._c=new d,null!=n&&s(n,c,e[p],e)})),i.each.call("add,clear,delete,forEach,get,has,set,keys,values,entries".split(","),(function(t){var e="add"==t||"set"==t;!(t in m)||h&&"clear"==t||o(f.prototype,t,(function(n,i){var r=this._c[t](0===n?0:n,i);return e?this:r}))})),"size"in m&&i.setDesc(f.prototype,"size",{get:function(){return this._c.size}})):(f=u.getConstructor(e,t,c,p),n(79)(f.prototype,l)),n(25)(f,t),g[t]=f,r(r.G+r.W+r.F,g),h||u.setStrong(f,t,c),f}},function(t,e,n){var i=n(10);i(i.P,"Set",{toJSON:n(90)("Set")})},function(t,e,n){var i=n(70),r=n(36);t.exports=function(t){return function(){if(r(this)!=t)throw TypeError(t+"#toJSON isn't generic");var e=[];return i(this,!1,e.push,e),e}}}])},t.exports=e()},6082:t=>{"use strict";t.exports=DG},4328:t=>{"use strict";t.exports=grok},1858:t=>{"use strict";t.exports=rxjs},7389:t=>{"use strict";t.exports=ui}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.m=t,n.amdO={},n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.u=t=>t+".js",n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.hmd=t=>((t=Object.create(t)).children||(t.children=[]),Object.defineProperty(t,"exports",{enumerable:!0,set:()=>{throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+t.id)}}),t),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var r=i.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=i[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};(()=>{"use strict";n.r(i),n.d(i,{_package:()=>I,initAutoTests:()=>P,test:()=>R,tests:()=>e.CN});var t=n(6082),e=n(8070),r=n(4328),o=n(5082),s=n(9484),a=n(4139),l=n(8608),u=n(2003),c=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Core",(()=>{const n="AlignedSequence";let i=null;(0,e.t6)("Start analysis: simple",(()=>c(void 0,void 0,void 0,(function*(){const r=t.DataFrame.fromCsv(yield I.files.readAsText("aligned.csv")),c=r.getCol("IC50"),h=r.getCol(n);h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(a.gp.ALPHABET,u.YI.PT),h.setTag(t.TAGS.UNITS,u.Hi.FASTA),h.setTag(u.gp.aligned,"SEQ.MSA");const d=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,o.n)(c,h,null,r,d,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={11:["D"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Start analysis: сomplex",(()=>c(void 0,void 0,void 0,(function*(){const n=t.DataFrame.fromCsv(yield I.files.readAsText("aligned_2.csv")),r=n.getCol("Activity"),c=n.getCol("MSA");c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(a.gp.ALPHABET,u.YI.UN),c.setTag(t.TAGS.UNITS,u.Hi.SEPARATOR),c.setTag(u.gp.aligned,"SEQ.MSA"),c.setTag(a.gp.SEPARATOR,"/");const h=(0,l.Y1)(r,a.rg.MINUS_LG);i=yield(0,o.n)(r,c,null,n,h,a.rg.MINUS_LG),(0,e.E3)(i instanceof s.i,!0,"Model is null"),i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP).mutationCliffsSelection={13:["-"]},yield(0,e.cb)(3e3)})))),(0,e.t6)("Save and load project",(()=>c(void 0,void 0,void 0,(function*(){const s=t.DataFrame.fromCsv(yield I.files.readAsText("aligned.csv")),c=s.getCol("IC50"),h=s.getCol(n);h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(a.gp.ALPHABET,u.YI.PT),h.setTag(t.TAGS.UNITS,u.Hi.FASTA),h.setTag(u.gp.aligned,"SEQ.MSA");const d=(0,l.Y1)(c,a.rg.MINUS_LG);i=yield(0,o.n)(c,h,null,s,d,a.rg.MINUS_LG);let f=r.shell.getTableView("Peptides analysis");const p=f.dataFrame,m=f.saveLayout(),g=p.getTableInfo(),v=t.Project.create();v.name="Peptides project unique test",v.addChild(g),v.addChild(m);const y=yield r.dapi.layouts.save(m);yield r.dapi.tables.uploadDataFrame(p);const C=yield r.dapi.tables.save(g),w=yield r.dapi.projects.save(v);f.close(),yield(0,e.bk)((()=>void 0===r.shell.tableView("Peptides analysis")),"Table never closed",3e3),yield w.open(),f=r.shell.getTableView("Peptides analysis"),yield r.dapi.layouts.delete(y),yield r.dapi.tables.delete(C),yield r.dapi.projects.delete(w)}))),{skipReason:"ViewLayout should become ViewInfo in 1.18."})}),{clear:!0});var h=n(3657),d=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const f=[5,50,100,200];function p(e){return d(this,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const n=(yield I.files.readBinaryDataFrames(`tests/${e}k.d42`))[0],i=n.getCol("activity").getRawData(),r=[];let o=1;for(;null!==n.col(o.toString());){const t=n.getCol(o.toString());r.push({name:t.name,rawData:t.getRawData(),cat:t.categories}),++o}yield t.timeAsync("Mutation Cliffs",(()=>d(this,void 0,void 0,(function*(){return yield(0,h.uz)(i,r)}))))}))}(0,e.L1)("Benchmarks: Mutation Cliffs",(()=>{for(const t of f)(0,e.t6)(`${t}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){return yield p(t)}))),{timeout:3e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Cluster stats",(()=>{for(const n of f)(0,e.t6)(`${n}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield I.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(i.name.toLowerCase())&&e.columns.remove(i.name),e.columns.add(i),t.time(`Cluster stats benchmark - ${n}k`,(()=>(0,h.eW)(e,"cluster",[],i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Monomer-Position stats",(()=>{for(const n of f)(0,e.t6)(`${n}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield I.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=[];let r=1;for(;null!==e.col(r.toString());)i.push(e.getCol(r.toString())),++r;const o=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(o.name.toLowerCase())&&e.columns.remove(o.name),e.columns.add(o),t.time(`Monomer-Position stats benchmark - ${n}k`,(()=>(0,h.Ej)(o,t.BitSet.create(0),i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Analysis start",(()=>{for(const n of f)(0,e.t6)(`${n}k sequences`,(()=>d(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const e=(yield I.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=e.getCol("activity"),s=(0,l.Y1)(i,a.rg.NONE),c=e.getCol("cluster"),h=e.getCol("sequence");h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(t.TAGS.UNITS,n===f[0]?u.Hi.HELM:u.Hi.FASTA),yield t.timeAsync("Analysis start",(()=>d(void 0,void 0,void 0,(function*(){const t=yield(0,o.n)(i,h,c,e,s,a.rg.NONE);t&&r.shell.closeTable(t.df)}))))}))),{timeout:1e5})}),{benchmarks:!0});var m,g=n(3541),v=n(5480),y=n(4326);!function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.CLUSTER="cluster"}(m||(m={}));var C=n(912),w=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Viewers: Basic",(()=>{let n;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),yield(0,e.cb)(500)}))));const i=t.Func.find({package:"Peptides",tags:["viewer"]}).map((t=>t.friendlyName));for(const t of i)(0,e.t6)(t,(()=>w(void 0,void 0,void 0,(function*(){yield(0,e.Bl)(t,n.clone(),{detectSemanticTypes:!0,arbitraryDfTest:!1,readOnly:!0}),yield(0,e.cb)(1e3)}))))})),(0,e.L1)("Viewers: Monomer-Position",(()=>{let n,i,r,c,h,d,f;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const p=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===p)throw new Error("Model is null");i=p,f=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>w(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>w(void 0,void 0,void 0,(function*(){const t=f.viewerGrid.cell("9",6),n=f.getMonomerPosition(t);(0,e.E3)((0,C.DK)(i.df,r,Object.entries(i.settings.columns),{monomerPosition:n,x:0,y:0,mpStats:i.monomerPositionStats}),!0,"Tooltip is not shown for grid cell at column '9', row 6")})))),(0,e.t6)("Modes",(()=>w(void 0,void 0,void 0,(function*(){if(null===f)throw new Error("Monomer-Position viewer doesn't exist");(0,e.E3)(f.mode,g.ds.MUTATION_CLIFFS,`Default Monomer-Position mode is not ${g.ds.MUTATION_CLIFFS}`),f.mode=g.ds.INVARIANT_MAP,(0,e.E3)(f.mode,g.ds.INVARIANT_MAP,`Monomer-Position mode is not ${g.ds.INVARIANT_MAP} after switching`),f.mode=g.ds.MUTATION_CLIFFS,(0,e.E3)(f.mode,g.ds.MUTATION_CLIFFS,`Monomer-Position mode is not ${g.ds.MUTATION_CLIFFS} after switching`)}))))}),{clear:!1}),(0,e.L1)("Viewers: Most Potent Residues",(()=>{let n,i,r,c,h,d,f;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const p=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===p)throw new Error("Model is null");i=p,f=i.findViewer(s.q.MOST_POTENT_RESIDUES),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>w(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>w(void 0,void 0,void 0,(function*(){const t="Diff",n=f.viewerGrid.cell(t,6),o=f.getMonomerPosition(n);(0,e.E3)((0,C.DK)(i.df,r,Object.entries(i.settings.columns),{monomerPosition:o,x:0,y:0,mpStats:i.monomerPositionStats}),!0,`Tooltip is not shown for grid cell at column '${t}', row 6`)}))))})),(0,e.L1)("Viewers: Logo Summary Table",(()=>{let n,i,r,c,h,d,f;(0,e.gM)((()=>w(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const p=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===p)throw new Error("Model is null");i=p,f=i.findViewer(s.q.LOGO_SUMMARY_TABLE),yield(0,e.cb)(500)})))),(0,e.Pl)((()=>w(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Properties",(()=>w(void 0,void 0,void 0,(function*(){f.getProperty("webLogoMode").set(f,y.fH.full),(0,e.E3)(f.webLogoMode,y.fH.full,`Web Logo Mode property is not changed to ${y.fH.full}, got ${f.webLogoMode} instead`),f.getProperty("membersRatioThreshold").set(f,0),(0,e.E3)(f.membersRatioThreshold,0,`Members Ratio Threshold property is not changed to 0, got ${f.membersRatioThreshold} instead`),(0,e.E3)(f.viewerGrid.table.filter.anyTrue,!0,`Expected to filter out all rows, but ${f.viewerGrid.table.filter.trueCount} rows are left unfiltered`)})))),(0,e.t6)("Tooltip",(()=>w(void 0,void 0,void 0,(function*(){const t=f.showTooltip({monomerOrCluster:"0",positionOrClusterType:v.W.ORIGINAL},0,0);(0,e.E3)(null!==t,!0,"Tooltip is not shown for cluster '0'")}))))}),{clear:!1});var b=n(5429),A=n(7654),E=n(7923),S=n(144),T=n.n(S),x=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Widgets: Settings",(()=>{let n,i,r,s,c,h;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),s=n.getCol(m.SEQUENCE),s.semType=t.SEMTYPE.MACROMOLECULE,s.setTag(t.TAGS.UNITS,u.Hi.HELM),h=(0,l.Y1)(r,a.rg.NONE),c=n.getCol(m.CLUSTER);const d=yield(0,o.n)(r,s,c,n,h,a.rg.NONE);if(null===d)throw new Error("Model is null");i=d,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>x(void 0,void 0,void 0,(function*(){const t=(0,b.OH)(i),n=t.accordion.panes.map((t=>t.name));(0,e.E3)(n.length,5,`Expected 5 panes, got ${t.accordion.panes.length}`);for(const t of Object.values(b.OO))(0,e.E3)(n.includes(t),!0,`Pane ${t} is missing`);for(const n of Object.values(b.OO)){const i=t.inputs[n].map((t=>t.caption));for(const t of Object.values(b.Av[n]))(0,e.E3)(i.includes(t),!0,`Input ${t} is missing from ${n}`)}}))))})),(0,e.L1)("Widgets: Distribution panel",(()=>{let n,i,r,c,h,d;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>x(void 0,void 0,void 0,(function*(){i.df.selection.set(0,!0),yield(0,e.cb)(1e3);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,A.HV)(i.df,{peptideSelection:t.BitSet.create(i.df.rowCount),columns:i.settings.columns,activityCol:d,clusterSelection:n.clusterSelection,clusterColName:h.name,monomerPositionSelection:i.webLogoSelection})}))))})),(0,e.L1)("Widgets: Mutation cliffs",(()=>{let n,i,r,c,h,d;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>x(void 0,void 0,void 0,(function*(){var t;const n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);n.keyPressed=!0,n._viewerGrid.dataFrame.currentCell=null===(t=n._viewerGrid)||void 0===t?void 0:t.dataFrame.cell(0,"1"),yield(0,e.cb)(1e3),(0,E.F)(i.df,{mutationCliffs:n.mutationCliffs,mutationCliffsSelection:n.mutationCliffsSelection,gridColumns:i.analysisView.grid.columns,sequenceColumnName:n.sequenceColumnName,positionColumns:n.positionColumns,activityCol:d})}))))})),(0,e.L1)("Widgets: Actions",(()=>{let n,i,c,h,d,f;(0,e.gM)((()=>x(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),yield n.meta.detectSemanticTypes(),c=n.getCol(m.ACTIVITY),h=n.getCol(m.SEQUENCE),h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(t.TAGS.UNITS,u.Hi.HELM),f=(0,l.Y1)(c,a.rg.NONE),d=n.getCol(m.CLUSTER);const r=yield(0,o.n)(c,h,d,n,f,a.rg.NONE);if(null===r)throw new Error("Model is null");i=r,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>x(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("New view",(()=>x(void 0,void 0,void 0,(function*(){const n=i.df.filter;n.setAll(!1,!1),n.set(0,!0,!1),n.set(1,!0,!1);const o=i.df.selection;o.set(0,!0,!1),o.set(1,!0,!1);const l=i.createNewView(),u=r.shell.t;(0,e.E3)(u.getTag(a.gp.MULTIPLE_VIEWS),"1","Current table is expected to have multiple views tag"),(0,e.E3)(u.getTag(t.TAGS.ID),l,"Current table is expected to have the same UUID as new view"),(0,e.E3)(u.rowCount,2,"Current table is expected to have 2 rows"),yield(0,e.cb)(500);const c=u.temp[s.i.modelName].findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==c,!0,"New view is expected to have Logo Summary Table viewer attached")})))),(0,e.t6)("Custom clusters",(()=>x(void 0,void 0,void 0,(function*(){const t=i.df.filter;t.setAll(!1,!1),t.set(0,!0,!1),t.set(1,!0,!1),i.df.selection.set(0,!0,!1);const n=i.findViewer(s.q.LOGO_SUMMARY_TABLE);if(null===n)throw new Error("Logo summary table viewer is not found");(0,e.E3)(T()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters before creating one"),n.clusterFromSelection();const r=T()(n.customClusters).toArray();(0,e.E3)(r.length,1,"Expected to have 1 custom cluster");const o=r[0].name;(0,e.E3)(null!==i.df.col(o),!0,"Expected to have custom cluster column in the table"),(0,e.E3)(-1!==n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(o),!0,"Expected to have custom cluster in the Logo Summary Table"),n.modifyClusterSelection({monomerOrCluster:o,positionOrClusterType:v.W.CUSTOM}),n.removeCluster(),(0,e.E3)(T()(n.customClusters).toArray().length,0,"Expected to have 0 custom clusters after removing one"),(0,e.E3)(null===i.df.col(o),!0,"Expected to have no custom cluster column in the table"),(0,e.E3)(-1===n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(o),!0,"Expected to have no custom cluster in the Logo Summary Table")}))))}),{clear:!1});var _=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Table view",(()=>{let n,i,r,c,h,d;const f="none",p={monomerOrCluster:"Aze",positionOrClusterType:"10",mcCount:3,imCount:1},g={monomerOrCluster:"meI",positionOrClusterType:"1",mcCount:2,imCount:10},y={monomerOrCluster:"0",positionOrClusterType:v.W.ORIGINAL,count:3},w={monomerOrCluster:"1",positionOrClusterType:v.W.ORIGINAL,count:3};(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,f),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,f);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>_(void 0,void 0,void 0,(function*(){(0,e.E3)((0,C.cr)(p.monomerOrCluster,0,0),!0,`Couldn't structure for monomer ${p.monomerOrCluster}`)}))),{skipReason:"Need to find a way to replace _package variable to call for Bio function with tests"}),(0,e.t6)("Visible columns",(()=>_(void 0,void 0,void 0,(function*(){const t=i.analysisView.grid.columns,n=i.positionColumns.map((t=>t.name));for(let i=1;i<t.length;i++){const r=t.byIndex(i),o=r.column.name,s=n.includes(o)||o===a.$2.ACTIVITY;(0,e.E3)(r.visible,s,`Column ${o} is visible === ${r.visible} but should be ${s}`)}})))),(0,e.t6)("Mutation Cliffs selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection,n=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);yield(0,e.bk)((()=>null!==n.mutationCliffs),"mutation cliffs haven't been generated",2e3);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after initialization`);n.modifyMutationCliffsSelection(p),(0,e.E3)(n.mutationCliffsSelection[p.positionOrClusterType].includes(p.monomerOrCluster),!0,`Monomer ${p.monomerOrCluster} is not selected at position ${p.positionOrClusterType}`),(0,e.E3)(t.trueCount,p.mcCount,`Selection count is not equal to ${p.mcCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType}`),n.modifyMutationCliffsSelection(g,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(n.mutationCliffsSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not selected at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.mcCount+p.mcCount,`Selection count is not equal to ${g.mcCount+p.mcCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),n.modifyMutationCliffsSelection(g,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(n.mutationCliffsSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!1,`Monomer ${g.monomerOrCluster} is still selected at position ${g.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,p.mcCount,`Selection count is not equal to ${p.mcCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType}`),n.mutationCliffsSelection=(0,l.ZR)(n.positionColumns);for(const[t,i]of Object.entries(n.mutationCliffsSelection))(0,e.E3)(i.length,0,`Selection is not empty for position ${t} after clearing monomer-position selection`);(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing monomer-position selection");const r=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==r,!0,"Couldn't find Logo Summary Table viewer"),r.modifyClusterSelection(y),(0,e.E3)(r.clusterSelection[y.positionOrClusterType].includes(y.monomerOrCluster),!0,`Cluster ${y.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,y.count,`Selection count is not equal to ${y.count} for cluster ${y.monomerOrCluster}`),r.modifyClusterSelection(w,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(r.clusterSelection[w.positionOrClusterType].includes(w.monomerOrCluster),!0,`Cluster ${w.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,y.count+w.count,`Selection count is not equal to ${y.count+w.count} for cluster ${y.monomerOrCluster} and cluster \n ${w.monomerOrCluster}`),r.modifyClusterSelection(y,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(r.clusterSelection[y.positionOrClusterType].includes(y.monomerOrCluster),!1,`Cluster ${y.monomerOrCluster} is still selected after deselection`),(0,e.E3)(t.trueCount,w.count,`Selection count is not equal to ${w.count} for cluster ${w.monomerOrCluster} after deselection of cluster ${y.monomerOrCluster}`),r.initClusterSelection(),(0,e.E3)(r.isClusterSelectionEmpty,!0,"Selection is not empty after clearing cluster selection"),(0,e.E3)(t.trueCount,0,"Selection count is not equal to 0 after clearing cluster selection")})))),(0,e.t6)("Invariant Map selection",(()=>_(void 0,void 0,void 0,(function*(){const t=i.df.selection;for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after initialization`);i.modifyWebLogoSelection(g),(0,e.E3)(i.webLogoSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!0,`Monomer ${g.monomerOrCluster} is not filtered at position ${g.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.imCount,`Filter count is not equal to ${g.imCount} for monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),i.modifyWebLogoSelection(p,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(i.webLogoSelection[p.positionOrClusterType].includes(p.monomerOrCluster),!0,`Monomer ${p.monomerOrCluster} is not filtered at position ${p.positionOrClusterType}`),(0,e.E3)(t.trueCount,g.imCount,`Filter count is not equal to ${g.imCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType}`),i.modifyWebLogoSelection(g,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(i.webLogoSelection[g.positionOrClusterType].includes(g.monomerOrCluster),!1,`Monomer ${g.monomerOrCluster} is still filtered at position \n ${g.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,p.imCount,`Filter count is not equal to ${p.imCount} for monomer ${p.monomerOrCluster} at position ${p.positionOrClusterType} after deselection of monomer ${g.monomerOrCluster} at position ${g.positionOrClusterType}`),(0,e.E3)(null!==i.positionColumns,!0,"Position columns are not initialized"),i.webLogoSelection=(0,l.ZR)(i.positionColumns),(0,e.E3)(t.trueCount,0,"Filter count is not equal to 0 after clearing monomer-position filter");for(const[t,n]of Object.entries(i.webLogoSelection))(0,e.E3)(n.length,0,`Filter is not empty for position ${t} after clearing monomer-position filter`)}))))}),{clear:!1});var N=n(5070),M=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Model: Settings",(()=>{let n,i,r,c,h,d;(0,e.gM)((()=>M(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield I.files.readAsText("tests/HELM_small.csv")),r=n.getCol(m.ACTIVITY),c=n.getCol(m.SEQUENCE),c.semType=t.SEMTYPE.MACROMOLECULE,c.setTag(t.TAGS.UNITS,u.Hi.HELM),d=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(m.CLUSTER);const s=yield(0,o.n)(r,c,h,n,d,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>M(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Activity scaling",(()=>M(void 0,void 0,void 0,(function*(){var t;const n=(t,e)=>`Activity mismatch at row ${t} for scaling method '${e}'`,o=1e-4,s=i.df.getCol(null===(t=i.settings)||void 0===t?void 0:t.activityColumnName).getRawData(),u=i.df.getCol(a.$2.ACTIVITY),c=i.df.rowCount;let h=u.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],s[t],o,n(t,a.rg.NONE));h=(0,l.Y1)(r,a.rg.LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],Math.log10(s[t]),o,n(t,a.rg.LG));h=(0,l.Y1)(r,a.rg.MINUS_LG).getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],-Math.log10(s[t]),o,n(t,a.rg.MINUS_LG));h=d.getRawData();for(let t=0;t<c;t++)(0,e.Wj)(h[t],s[t],o,n(t,a.rg.NONE))})))),(0,e.t6)("Mutation Cliffs",(()=>M(void 0,void 0,void 0,(function*(){const t=i.findViewer(s.q.SEQUENCE_VARIABILITY_MAP);(0,e.E3)(t.maxMutations,1,`Max mutations mismatch: expected 1, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,0,`Min activity delta mismatch: expected 0, actual ${t.minActivityDelta}`),t.maxMutations=2,t.minActivityDelta=.5,(0,e.E3)(t.maxMutations,2,`Max mutations mismatch: expected 2, actual ${t.maxMutations}`),(0,e.E3)(t.minActivityDelta,.5,`Min activity delta mismatch: expected 0.5, actual ${t.minActivityDelta}`)})))),(0,e.t6)("Include columns",(()=>M(void 0,void 0,void 0,(function*(){var n,r;const o="rank",a={[o]:t.AGG.AVG};i.settings={columns:a};const l=i.findViewer(s.q.LOGO_SUMMARY_TABLE),u=(0,N.hX)(t.AGG.AVG,o);(0,e.E3)(null!==l.viewerGrid.col(u),!0,`Expected to include column '${o}' in ${s.q.LOGO_SUMMARY_TABLE} but it is absent`),i.settings={columns:{}},(0,e.E3)(Object.keys(null===(n=i.settings)||void 0===n?void 0:n.columns).length,0,`Expected to remove all column aggregations but columns {${Object.keys(null===(r=i.settings)||void 0===r?void 0:r.columns).join(" & ")}} are still included`),(0,e.E3)(null===l.viewerGrid.col(u),!0,`Expected to remove column '${o}' from ${s.q.LOGO_SUMMARY_TABLE} but it is still present`)})))),(0,e.t6)("Dendrogram",(()=>M(void 0,void 0,void 0,(function*(){var t,n;i.settings={showDendrogram:!0},(0,e.E3)(null===(t=i.settings)||void 0===t?void 0:t.showDendrogram,!0,"Dendrogram is disabled after enabling"),yield(0,e.bk)((()=>null!==i.findViewer(s.q.DENDROGRAM)),"Dendrogram is not present in the view after 5s delay",5e3),i.settings={showDendrogram:!1},(0,e.E3)(null===(n=i.settings)||void 0===n?void 0:n.showDendrogram,!1,"Dendrogram is enabled after disabling"),(0,e.E3)(null===i.findViewer(s.q.DENDROGRAM),!0,"Dendrogram is present in the view after disabling")}))),{skipReason:"Need to find a way to replace _package variable to call for Bio function with tests"})}),{clear:!1});var O=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};(0,e.L1)("Algorithms",(()=>{let n,i,r,o;(0,e.gM)((()=>O(void 0,void 0,void 0,(function*(){n=t.Column.fromList("int","test",[1,2,5]).getRawData(),i=[t.Column.fromList("string","1","AAA".split("")),t.Column.fromList("string","2","BCC".split("")),t.Column.fromList("string","3","CCD".split(""))].map((t=>({name:t.name,rawData:t.getRawData(),cat:t.categories}))),o=(0,l.eY)(t.Column.fromList("string","target",["1","2","2"])),r={maxMutations:1,minActivityDelta:2}})))),(0,e.t6)("MutationCliffs",(()=>O(void 0,void 0,void 0,(function*(){let t=yield(0,h.uz)(n,i,r);(0,e.E3)(t.has("C"),!0,"MutationCliffsInfo should have key 'C'"),(0,e.E3)(t.has("D"),!0,"MutationCliffsInfo should have key 'D'"),(0,e.E3)(t.has("A"),!1,"MutationCliffsInfo should not have key 'A'");const s=t.get("C"),a=t.get("D");(0,e.E3)(s.has("3"),!0,"MutationCliffsInfo['C'] should have key '3'"),(0,e.E3)(a.has("3"),!0,"MutationCliffsInfo['D'] should have key '3'");const l=s.get("3"),u=a.get("3");(0,e.E3)(l.has(1),!0,"MutationCliffsInfo['C']['3'] should have key 1"),(0,e.E3)(u.has(2),!0,"MutationCliffsInfo['D']['3'] should have key 2");const c=l.get(1),d=u.get(2);(0,e.E3)(c[0],2,"MutationCliffsInfo['C']['3'][1] should have value 2"),(0,e.E3)(d[0],1,"MutationCliffsInfo['D']['3'][2] should have value 1"),r.targetCol=o,r.currentTarget="1",t=yield(0,h.uz)(n,i,r),(0,e.E3)(t.size,0,"MutationCliffsInfo should be empty for target '1'")}))))}));var L=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))};const I=new t.Package;function R(n,i,r){return L(this,void 0,void 0,(function*(){r.catchUnhandled=!1;const o=yield(0,e.N$)({category:n,test:i,testContext:r});return t.DataFrame.fromObjects(o)}))}function P(){return L(this,void 0,void 0,(function*(){yield(0,e.Xb)(I,I.getModule("package-test.js"))}))}})(),peptides_test=i})();
|
|
2
2
|
//# sourceMappingURL=package-test.js.map
|