@datagrok/peptides 1.19.0 → 1.19.1
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.map +1 -1
- package/package.json +5 -5
- package/test-console-output-1.log +960 -0
- package/test-record-1.mp4 +0 -0
- package/src/global.d.ts +0 -13
package/dist/package-test.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var peptides_test;(()=>{var t={8223:(t,e,n)=>{"use strict";n.d(e,{pj:()=>m,uL:()=>g});var i,r,o,s,a,l,c,u=n(6082),d=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"}(c||(c={}));var h=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,h.Z.HAMMING,h.Z.LEVENSHTEIN,h.Z.MONOMER_CHEMICAL_DISTANCE,h.Z.NEEDLEMANN_WUNSCH,new RegExp("[rd]\\((\\w)\\)p?","g");var f=n(3077),p=n(439);async function m(){const t=u.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,n){t instanceof u.Column&&(t=(0,f.R)(t,n).columns.toList());const i=(await m()).getMonomerLib(),r=new Array(t.length),o=t[0].length,s=new Float32Array(o);for(let n=0;n<t.length;++n){const a=n<e.length?e.getCanonical(n):p._S,l=i.getMonomer("PEPTIDE",a)?.smiles??"",c=t[n],h=c.getRawData(),f=c.categories,m=f.indexOf("");if(r[n]={categories:f,data:h,emptyIndex:m},void 0===a)continue;const g=u.Column.fromStrings("smiles",f.map((t=>i.getMonomer("PEPTIDE",t)?.smiles??""))),v=(u.DataFrame.fromColumns([g]),await d.chem.getSimilarities(g,l)),y=v?v.getRawData():null;for(let t=0;t<o;++t){const e=h[t];a!==p._S&&e!==m?s[t]+=y[e]:a===p._S&&e===m&&(s[t]+=1)}}for(let n=0;n<s.length;++n){let i=s[n]/e.length;for(let o=0;o<t.length;++o){const t=r[o];if(o>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&o<e.length){i=u.FLOAT_NULL;break}}s[n]=i}return u.Column.fromFloat32Array("Similarity",s)}},439:(t,e,n)=>{"use strict";n.d(e,{B5:()=>a,Hi:()=>i,YI:()=>r,_S:()=>u,b9:()=>d,gp:()=>o,q7:()=>c});var i,r,o,s=n(2738);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm",t.CUSTOM="custom"}(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=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,l=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.a(r.PT,l.fasta.peptide,.5),new s.a(r.DNA,l.fasta.dna,.55),new s.a(r.RNA,l.fasta.rna,.55)],u="",d={[i.FASTA]:"-",[i.SEPARATOR]:"",[i.HELM]:"*"}},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,SM:()=>r.SM,YI:()=>i.YI,gp:()=>i.gp,zS:()=>r.zS});var i=n(439),r=n(9634)},2738:(t,e,n)=>{"use strict";n.d(e,{X:()=>r,a:()=>i});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class r extends i{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,{zS:()=>x,SM:()=>T});var i=n(6082),r=n(144),o=n.n(r);class s extends Float32Array{}function a(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}var l=n(2738),c=n(439);class u{static makePalette(t,e=!1,n=u){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]}}u.undefinedColor="rgb(100,100,100)",u.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 u{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 h{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]}}h.SemType="Aminoacids",h.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",h.undefinedColor="rgb(100,100,100)",h.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"},h.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"},h.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(*)*"},h.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 f extends u{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new f({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class p{}p.SemType="Nucleotides",p.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",p.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};var m=n(8223);function g(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 v{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 y{}class C extends y{get(t,e){return"#666666"}}class w extends y{static get palette(){return w._pallete||(w._pallete=w.buildPalette()),w._pallete}static buildPalette(){return(0,m.pj)().then((t=>{t.awaitLoaded(1/0).then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{w.customMonomerColors={},w.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]=g(n.meta.colors.default.background))}}}))}))})),[].concat(...Object.values(u.colourPalette))}get(t,e){const n=w.palette.length,i=w.customMonomerColors[t],r=e??"PEPTIDE";if(i&&i[r])return i[r];const o=v.hashCode(t)%n;return g(w.palette[o])}}w._pallete=null,w.customMonomerColors={},w.polymerTypes=[];class b extends u{static get Gray(){return void 0===this.gray&&(this.gray=new C),this.gray}static get Color(){return void 0===this.color&&(this.color=new w),this.color}}class A{get length(){return this.mList.length}isGap(t){return this.getOriginal(t)===this.gapOriginalMonomer}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");const e=this.mList[t];return e!==this.gapOriginalMonomer?e:c._S}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}}const E=t=>{const e=o()(t.toString().matchAll(c.B5)).map((t=>t[2]??t[1])).toArray();return new A(e,c.b9[c.Hi.FASTA])},S=/([^\W_]+)/g;function x(t,e){if(t.length<=e)return t;const n=t.match(S),i=t.length>e||(n?.length??0)>1,r=n?.[0]??" ";return i?r.substring(0,e-1)+"…":r}function T(t,e,n=5){let r;if(t.semType==i.SEMTYPE.MACROMOLECULE)r=e.getSeqHandler(t).alphabet;else{const e=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(let t=0;t<o.length;++t){const e=o.getCanonical(t);e in n||(n[e]=0),n[e]+=1}return{freq:n,sameLength:i}}(o().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,n,E);r=function(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 l=new s(r),c=new s(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}(l,c)/(a(l)*a(c))}(t,e.alphabet,n);return new l.X(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:c.YI.UN,r}(e.freq,c.q7)}return function(t){switch(t){case c.YI.PT:return d.GrokGroups;case c.YI.DNA:case c.YI.RNA:return f.Chromatogram;default:return b.Color}}(r)}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>r});var i=n(6082);function r(t,e){const n=t=>{const e=s.columns.addNewString((t+1).toString());return r.push(e),e},r=[],o=t.length,s=i.DataFrame.create(o),a=e.getSeqHandler(t);for(let t=0;t<o;++t){const e=a.getSplitted(t);for(let i=0;i<e.length;++i){const o=e.getCanonical(i);((r[i]??null)||n(i)).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,c=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=c.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,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),i&&(c=i),c=0!==c.indexOf("blob:")?c.substr(0,c.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 u,d,h=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&&(u=r.wasmBinary),r.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var f,p,m,g=!1;function v(){var t=d.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),h(t="Aborted("+t+")"),g=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var x,T;function _(t){return t.startsWith("data:application/octet-stream;base64,")}function N(t){try{if(t==x&&u)return new Uint8Array(u);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 u||!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){h("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=d.buffer;try{return d.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function R(t){return r["_"+t]}_(x="wasmDbscan.wasm")||(T=x,x=r.locateFile?r.locateFile(T,c):c+T);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 c=0;c<i.length;c++){var u=o[n[c]];u?(0===l&&(l=U()),a[c]=u(i[c])):a[c]=i[c]}var d=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 c=s-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}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)}(d)}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,d=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){h("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=u,e=x,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 h("wasm streaming compile failed: "+t),h("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 q(){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||q(),G||(E=t)},r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);r.preInit.length>0;)r.preInit.pop()();return q(),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(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!r&&(r=yield navigator.gpu.requestAdapter(),null==r))return null;let t=null;return"info"in r?t=r.info:"requestAdapterInfo"in r&&"function"==typeof r.requestAdapterInfo&&(t=yield r.requestAdapterInfo()),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,{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,{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={})),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 c=0,u=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 d=1;d<i.length+1;d++){a[u][0]=-r-(d-1)*r;for(let h=1;h<t.length+1;h++){const f=a[c][h-1]+o[e[t.charCodeAt(h-1)]][e[i.charCodeAt(d-1)]],p=a[c][h]-(s[h]||1===d||d===i.length?r:n),m=a[u][h-1]-(l[h-1]||1===h||h===t.length?r:n);a[u][h]=Math.max(f,m,p),a[u][h]===f?(s[h]=!1,l[h]=!1):a[u][h]===m?(s[h]=!1,l[h]=!0):(s[h]=!0,l[h]=!1)}c=u,u=(u+1)%2}const d=Math.min(t.length,i.length);return(d-a[c][t.length])/d}}},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:()=>Y,gM:()=>k,L1:()=>P,cb:()=>B,E3:()=>I,Wj:()=>R,Xb:()=>U,N$:()=>V,t6:()=>L,PE:()=>M,rd:()=>O,Bl:()=>W,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,c,u=!0){return s(this,void 0,void 0,(function*(){let d=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!=c?c:{};e.tv=t,e.viewer=n,d=yield o(e,u)}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"),d)return d}))}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 c(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 u(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 d(t,e=!0){return s(this,void 0,void 0,(function*(){I(JSON.stringify(t.viewer.getOptions().look),JSON.stringify(t.savedProps))}))}var h=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 x;var T;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(T||(T={}));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=()=>h(this,void 0,void 0,(function*(){return new Promise(((t,e)=>h(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 h(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 h(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[x]&&(C[x]={}),null==C[x].tests&&(C[x].tests=[]),C[x].tests.push(new N(x,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;x=t,e(),C[x]&&(C[x].clear=null===(i=null==n?void 0:n.clear)||void 0===i||i,C[x].timeout=null==n?void 0:n.timeout,C[x].benchmarks=null==n?void 0:n.benchmarks,C[x].stressTests=null==n?void 0:n.stressTests)}function k(t){null==C[x]&&(C[x]={}),C[x].before=t}function G(t){null==C[x]&&(C[x]={}),C[x].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,c,u;return h(this,void 0,void 0,(function*(){const d=t.id;if(S[d])return;const m=e?e.tests:C;if(void 0!==m[w]||void 0!==m[b]||Object.keys(m).find((t=>t.startsWith(w)||t.startsWith(E))))return void(S[d]=!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===m[r]&&(m[r]={tests:[],clear:!0}),m[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 g=[],v=[],y=[],x=yield i.dapi.functions.filter(`package.id = "${d}"`).list(),T=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of x){const n=e.options.test,s=e.options.demoPath;if(n&&Array.isArray(n)&&n.length)for(let t=0;t<n.length;t++){const o=n[t].matchAll(T),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===n.length?e.name:`${e.name} ${t+1}`,(()=>h(this,void 0,void 0,(function*(){const r=yield i.functions.eval(D(n[t],e));if(s.wait&&(yield B(s.wait)),"boolean"==typeof r&&!r)throw`Failed: ${n[t]}, expected true, got ${r}`}))),{skipReason:s.skip,timeout:r.Test.isInBenchmark?null!==(c=s.benchmarkTimeout)&&void 0!==c?c:p:null!==(u=s.timeout)&&void 0!==u?u:f});if(s.cat){const t=w+": "+s.cat;a.category=t,void 0===m[t]&&(m[t]={tests:[],clear:!0}),m[t].tests.push(a)}else g.push(a)}if(s){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,n=new N(b,e.friendlyName,(()=>h(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 e.apply(),yield B(t||2e3);const n=yield i.shell.lastError;if(n)throw new Error(n);i.shell.isInDemo=!1}))),{skipReason:e.options.demoSkip});v.push(n)}if(e.hasTag("semTypeDetector")){let n=o;e.options.testData&&(n=yield i.data.files.openTable(`System:AppData/${t.nqName}/${e.options.testData}`));const r=new N(A,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){const i=[];console.log(`System:AppData/${t.nqName}/${e.options.testData}`);for(const t of n.clone().columns){const n=yield e.apply([t]);i.push(n||t.semType)}const r=i.filter((t=>t));I(r.length,1),e.options.testDataColumnName&&I(r[0],e.options.testDataColumnName)}))),{skipReason:e.options.skipTest});y.push(r)}}S[d]=!0,g.length>0&&(m[w]={tests:g,clear:!0}),v.length>0&&(m[b]={tests:v,clear:!0}),y.length>0&&(m[A]={tests:y,clear:!1})}))}function V(t){var e,n,o,s;return h(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 c=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}();yield function(t,e){var n,o,s,d,C,w,b,A,E,S,x,T,_,N,M,O;return h(this,void 0,void 0,(function*(){try{for(const[h,g]of Object.entries(t)){if((null==e?void 0:e.category)&&!h.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(n=e.exclude)||void 0===n?void 0:n.some((t=>h.startsWith(t)))))continue;m(`Started ${h} 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 u(g.before,null!==(s=e.category)&&void 0!==s?s:""));let v=null!==(d=g.tests)&&void 0!==d?d:[];e.stressTest&&(v=v.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest})),v=q(v)),(null!==(w=null===(C=e.tags)||void 0===C?void 0:C.length)&&void 0!==w?w:0)>0&&(v=v.filter((t=>{var n,i;return null===(i=null===(n=t.options)||void 0===n?void 0:n.tags)||void 0===i?void 0:i.some((t=>{var n;return(null!==(n=null==e?void 0:e.tags)&&void 0!==n?n:[]).includes(t)}))})));const y=[];if(g.clear)for(let t=0;t<v.length;t++){v[t].options&&void 0===(null===(b=v[t].options)||void 0===b?void 0:b.benchmark)&&(v[t].options||(v[t].options={}),v[t].options.benchmark=null!==(A=g.benchmarks)&&void 0!==A&&A);let n=yield H(v[t],null==e?void 0:e.test,c,r.Test.isInBenchmark?null!==(S=null===(E=v[t].options)||void 0===E?void 0:E.benchmarkTimeout)&&void 0!==S?S:p:null!==(T=null===(x=v[t].options)||void 0===x?void 0:x.timeout)&&void 0!==T?T:f,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,c,r.Test.isInBenchmark?null!==(N=null===(_=v[t].options)||void 0===_?void 0:_.benchmarkTimeout)&&void 0!==N?N:p:null===(M=v[t].options)||void 0===M?void 0:M.timeout,a.name,e.verbose);n&&y.push(n)}const L=y.filter((t=>"skipped"!=t.result));t||(g.afterStatus=yield u(g.after,null!==(O=e.category)&&void 0!==O?O:"")),g.afterStatus&&L.push({date:(new Date).toISOString(),logs:"",category:h,name:"after",result:g.afterStatus,success:!1,ms:0,skipped:!1}),g.beforeStatus&&L.push({date:(new Date).toISOString(),logs:"",category:h,name:"before",result:g.beforeStatus,success:!1,ms:0,skipped:!1}),l.push(...L)}}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 u(t,e){return h(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==t&&(yield $((()=>h(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 h(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,c,u,d,p,g;return h(this,void 0,void 0,(function*(){let h;n.length=0;let v="package";const C=null!=e&&t.name.toLowerCase()!==e.toLowerCase();let w=(null===(l=t.options)||void 0===l?void 0:l.skipReason)||C,b=C?"skipped":null===(c=t.options)||void 0===c?void 0:c.skipReason;if(r.Test.isInBenchmark&&!(null===(u=t.options)||void 0===u?void 0:u.benchmark))return void m(`SKIPPED: ${t.category} ${t.name} doesnt available in benchmark mode`);w||m(`Started ${t.category} ${t.name}`);const A=Date.now();try{if(w)h={date:(new Date).toISOString(),success:!0,result:b,ms:0,skipped:!0};else{let e=null!=o?o:f;h={date:(new Date).toISOString(),success:!0,result:null!==(d=yield $(t.test,e))&&void 0!==d?d:"OK",ms:0,skipped:!1}}}catch(t){y(t),h={date:(new Date).toISOString(),success:!1,result:yield F(t),ms:0,skipped:!1}}if((null===(p=t.options)||void 0===p?void 0:p.isAggregated)&&h.result.constructor===r.DataFrame){const t=h.result.col("success");if(t&&(h.success=t.stats.sum===t.length),!a){const t=h.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),h.result=t}h.result=h.result.toCsv()}if(h.logs=n.join("\n"),h.ms=Date.now()-A,w||m(`Finished ${t.category} ${t.name} for ${h.ms} ms`),h.category=t.category,h.name=t.name,!C){let e={success:h.success,result:h.result,ms:h.ms,skipped:h.skipped,package:s,category:t.category,name:t.name,logs:h.logs};if(h.result.constructor==Object){const t=Object.keys(h.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:h.result[e]})),{});e=Object.assign(Object.assign({},e),t)}e.result instanceof r.DataFrame&&(e.result=JSON.stringify(null===(g=e.result)||void 0===g?void 0:g.toJson())||""),null!=i.shell.reportTest?yield i.shell.reportTest(v,e):yield fetch(`${i.dapi.root}/log/tests/${v}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}return h}))}function q(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}function B(t){return h(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function Y(t,e="Timeout exceeded",n=500,i=50){return h(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 $(t,e,n="EXECUTION TIMEOUT"){return h(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 j=r.DataFrame.fromColumns([r.Column.fromStrings("col",["val1","val2","val3"])]);function W(t,e,n){var r;return h(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,u),(null==n?void 0:n.awaitViewer)&&(e=yield a(s,t,o,i.events.onViewerAdded,u,n.awaitViewer)),yield a(s,t,o,i.events.onViewLayoutApplied,d,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,d,n.awaitViewer,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(s.dataFrame=j,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,c),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,o,i.events.onViewerAdded,c,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"),c=Array.isArray,u=Array.prototype,d=u.concat,h=u.filter,f=u.indexOf,p=u.map,m=u.push,g=u.slice,v=u.some,y=u.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)?Z(t):_(o)?o.find(t):I(o)?T(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}(),x=S.prototype,T=x.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,T,i);for(var o=0;o<r;o++){var s=t[o];for(var a in s)n&&(c(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}T.fn=T.prototype=x,x.length=0,x.splice=y,"function"==typeof Symbol&&(x[Symbol.iterator]=u[Symbol.iterator]),T.isWindow=N,T.isFunction=L,T.isArray=c,T.isNumeric=k,T.isPlainObject=G,T.each=D,x.each=function(t){return D(this,t)},x.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},T.extend=U,x.extend=function(t){return U(x,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 q(t,e){return parseInt(H(t,e),10)||0}function B(t,e){return q(t,"border".concat(e?"Left":"Top","Width"))+q(t,"padding".concat(e?"Left":"Top"))+q(t,"padding".concat(e?"Right":"Bottom"))+q(t,"border".concat(e?"Right":"Bottom","Width"))}x.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)}))}))},x.addClass=function(t){return this.toggleClass(t,!0)},x.removeAttr=function(t){var e=F(t);return this.each((function(t,n){O(n)&&D(e,(function(t,e){n.removeAttribute(e)}))}))},x.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}},x.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},x.hasClass=function(t){return!!t&&v.call(this,(function(e){return O(e)&&e.classList.contains(t)}))},x.get=function(t){return R(t)?g.call(this):this[(t=Number(t))<0?t+this.length:t]},x.eq=function(t){return T(this.get(t))},x.first=function(){return this.eq(0)},x.last=function(){return this.eq(-1)},x.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}x.filter=function(t){var e=W(t);return T(h.call(this,(function(t,n){return e.call(t,n,t)})))},x.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 Z(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,T(n.childNodes).detach().get()}function J(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 c=e(t[a]);c.length&&m.apply(r,c)}else for(var u=t[a][e];!(null==u||i&&s(-1,u));)r.push(u),u=n?u[e]:null;return r}function tt(t){return t.multiple&&t.options?J(h.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?h.call(t,(function(t,e,n){return f.call(n,t)===e})):t}T.parseHTML=Z,x.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)},x.not=function(t){var e=W(t);return this.filter((function(n,i){return(!I(t)||O(i))&&!e.call(i,n,i)}))},x.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=c(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])},x.is=function(t){var e=W(t);return v.call(this,(function(t,n){return e.call(t,n,t)}))},T.guid=1,T.unique=et,x.add=function(t,e){return T(et(this.get().concat(T(t,e).get())))},x.children=function(t){return z(T(et(J(this,(function(t){return t.children})))),t)},x.parent=function(t){return z(T(et(J(this,"parentNode"))),t)},x.index=function(t){var e=t?T(t)[0]:this[0],n=t?this:T(e).parent().children();return f.call(n,e)},x.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},x.siblings=function(t){return z(T(et(J(this,(function(t){return T(t).parent().children().not(t)})))),t)},x.find=function(t){return T(et(J(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,c){return D(t,(function(t,a){D(T(a),(function(t,a){D(T(e),(function(e,l){var c=n?l:a,u=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=T(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,u?c.cloneNode(!0):c,o,s,!u)}),c)}),l)}),a),e}x.after=function(){return ot(arguments,this,!1,!1,!1,!0,!0)},x.append=function(){return ot(arguments,this,!1,!1,!0)},x.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?T(i).empty().append(t):i.innerHTML=t)}))},x.appendTo=function(t){return ot(arguments,this,!0,!1,!0)},x.wrapInner=function(t){return this.each((function(e,n){var i=T(n),r=i.contents();r.length?r.wrapAll(t):i.append(t)}))},x.before=function(){return ot(arguments,this,!1,!0)},x.wrapAll=function(t){for(var e=T(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},x.wrap=function(t){return this.each((function(e,n){var i=T(t)[0];T(n).wrapAll(e?i.cloneNode(!0):i)}))},x.insertAfter=function(t){return ot(arguments,this,!0,!1,!1,!1,!1,!0)},x.insertBefore=function(t){return ot(arguments,this,!0,!0)},x.prepend=function(){return ot(arguments,this,!1,!0,!0,!0,!0)},x.prependTo=function(t){return ot(arguments,this,!0,!0,!0,!1,!1,!0)},x.contents=function(){return T(et(J(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},x.next=function(t,e,n){return z(T(et(J(this,"nextElementSibling",e,n))),t)},x.nextAll=function(t){return this.next(t,!0)},x.nextUntil=function(t,e){return this.next(e,!0,t)},x.parents=function(t,e){return z(T(et(J(this,"parentElement",!0,e))),t)},x.parentsUntil=function(t,e){return this.parents(e,t)},x.prev=function(t,e,n){return z(T(et(J(this,"previousElementSibling",e,n))),t)},x.prevAll=function(t){return this.prev(t,!0)},x.prevUntil=function(t,e){return this.prev(e,!0,t)},x.map=function(t){return T(d.apply([],p.call(this,(function(e,n){return t.call(e,n,e)}))))},x.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},x.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===H(n,"position");)n=n.offsetParent;return n||i}))},x.slice=function(t,e){return T(g.call(this,t,e))};var st=/-([a-z])/g;function at(t){return t.replace(st,(function(t,e){return e.toUpperCase()}))}x.ready=function(t){var n=function(){return setTimeout(t,0,T)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},x.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=T(e);n.replaceWith(n.children())}})),this},x.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},x.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=T(r).offset();n.top-=o.top+q(r,"borderTopWidth"),n.left-=o.left+q(r,"borderLeftWidth")}}return{top:n.top-q(t,"marginTop"),left:n.left-q(t,"marginLeft")}}};var lt={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};x.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}},x.removeProp=function(t){return this.each((function(e,n){delete n[lt[t]||t]}))};var ct=/^--/;function ut(t){return ct.test(t)}var dt={},ht=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=ut(t)),n||pt[t]||!k(e)?e:"".concat(e,"px")}function gt(t,e){try{return t(e)}catch(t){return e}}x.css=function(t,e){if(I(t)){var n=ut(t);return t=function(t,e){if(void 0===e&&(e=ut(t)),e)return t;if(!dt[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 ht)return dt[t]=n,!1}))}return dt[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)])}x.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);x[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?q(this[0],"margin".concat(t?"Top":"Left"))+q(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),D(["Width","Height"],(function(t,e){var n=e.toLowerCase();x[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]-B(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?B(i,!t):0))}}))}}));var wt="___cd";x.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")}}))},x.hide=function(){return this.toggle(!1)},x.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 xt(t){return Et[t]||At[t]||t}function Tt(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)}x.trigger=function(t,n){if(I(t)){var i=Tt(t),r=i[0],o=i[1],s=xt(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)}))},x.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=Tt(r),s=o[0],a=o[1],l=xt(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},x.remove=function(t){return z(this,t).detach().off(),this},x.replaceWith=function(t){return this.before(t).remove()},x.replaceAll=function(t){return T(t).replaceWith(this),this},x.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=Tt(s),l=a[0],c=a[1],u=xt(l),d=l in Et,h=l in At;u&&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(c,t.namespace.split(".")))&&(e||!(h&&(t.target!==o||t.___ot===u)||d&&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,u,c,e,s),!1===f&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||T.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,u,c,e,s)}}))})),this):this},x.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;x.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(c(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=T}()},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 c=0;c<t.length;c++){var u=[].concat(t[c]);i&&s[u[0]]||(void 0!==o&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=o),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),r&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=r):u[4]="".concat(r)),e.push(u))}},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,c,u,d,h,f,p,m,g,v,y;o>=64;){for(s=n[0],a=n[1],l=n[2],c=n[3],u=n[4],d=n[5],h=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=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&d^~u&h)|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=h,h=d,d=u,u=c+v|0,c=l,l=a,a=s,s=v+y|0;n[0]+=s,n[1]+=a,n[2]+=l,n[3]+=c,n[4]+=u,n[5]+=d,n[6]+=h,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]),c=s(e,t),u=new r(c),d=new Uint8Array(u.digestLength),h=d.length,f=new Uint8Array(i),p=0;p<i;p++)h===d.length&&(a(d,u,n,o),h=0),f[p]=d[h++];return u.clean(),d.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),c=new Uint8Array(s),u=new Uint8Array(i),d=0;d*s<i;d++){var h=d+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,o.reset(),o.update(e),o.update(a),o.finish(c);for(var f=0;f<s;f++)l[f]=c[f];for(f=2;f<=n;f++){o.reset(),o.update(c).finish(c);for(var p=0;p<s;p++)l[p]^=c[p]}for(f=0;f<s&&d*s+f<i;f++)u[d*s+f]=l[f]}for(d=0;d<s;d++)l[d]=c[d]=0;for(d=0;d<4;d++)a[d]=0;return o.clean(),u}}(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,c=n;for(;c--;)i[t.charCodeAt(c)]|=1<<c;for(c=0;c<r;c++){let t=i[e.charCodeAt(c)];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(c=n;c--;)i[t.charCodeAt(c)]=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 c=0;for(;c<l-1;c++){let a=0,l=-1;const u=32*c,d=Math.min(32,r)+u;for(let e=u;e<d;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,c=o[t/32|0]>>>t&1,u=n|a,d=((n|c)&l)+l^l|n|c;let h=a|~(d|l),f=l&d;h>>>31^r&&(s[t/32|0]^=1<<t),f>>>31^c&&(o[t/32|0]^=1<<t),h=h<<1|r,f=f<<1|c,l=f|~(u|h),a=h&u}for(let e=u;e<d;e++)i[t.charCodeAt(e)]=0}let u=0,d=-1;const h=32*c,f=Math.min(32,r-h)+h;for(let e=h;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,c=n|u,h=((n|l)&d)+d^d|n|l;let f=u|~(h|d),m=d&h;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,d=m|~(c|f),u=f&c}for(let e=h;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,c,u,d){var h=o[r],f=o[l],p=e(t,i,r,l,c,u,d);s[h+6]+=p,s[f+6]+=p,a[n]=h,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 c=r("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,d=s.assign({},a,n.settings),h=s.validateSettings(d);if(h)throw new Error("graphology-layout-forceatlas2: "+h.message);var f,p=s.graphToByteArrays(e,c);for(f=0;f<l;f++)o(d,p.nodes,p.edges);if(!t)return s.collectLayoutChanges(e,p.nodes);s.assignLayoutChanges(e,p.nodes,u)}var c=l.bind(null,!1);c.assign=l.bind(null,!0),c.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=c},2561:t=>{var e=10;t.exports=function(t,n,i){var r,o,s,a,l,c,u,d,h,f,p,m,g,v,y,C,w,b,A,E,S,x,T,_=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,d=L[o+3]/2,L[(h=L[o+5])+0]=-1,L[h+1]=L[o+1]-d,L[h+2]=L[o+2]-d,L[h+3]=d,L[h+4]=h+9,L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+8]=0,L[(h+=9)+0]=-1,L[h+1]=L[o+1]-d,L[h+2]=L[o+2]+d,L[h+3]=d,L[h+4]=h+9,L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+8]=0,L[(h+=9)+0]=-1,L[h+1]=L[o+1]+d,L[h+2]=L[o+2]-d,L[h+3]=d,L[h+4]=h+9,L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+8]=0,L[(h+=9)+0]=-1,L[h+1]=L[o+1]+d,L[h+2]=L[o+2]+d,L[h+3]=d,L[h+4]=L[o+4],L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+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((c=L[o+0])>=0&&c!==s&&(C=(g=n[s+0]-n[c+0])*g+(v=n[s+1]-n[c+1])*v,!0===M?C>0?(w=m*n[s+6]*n[c+6]/C,n[s+2]+=g*w,n[s+3]+=v*w):C<0&&(w=-m*n[s+6]*n[c+6]/Math.sqrt(C),n[s+2]+=g*w,n[s+3]+=v*w):C>0&&(w=m*n[s+6]*n[c+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(h=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]*h):C>0&&(w=m*n[s+6]*h/C),n[s+2]-=g*w,n[s+3]-=v*w;for(m=1*(t.outboundAttractionDistribution?p:1),u=0;u<N;u+=3)a=i[u+0],l=i[u+1],d=i[u+2],y=Math.pow(d,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)),x=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=x,T=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=T);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)))),x=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=x,T=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=T);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 c(e){return"object"===t(e)&&null!==e}function u(t){var e;for(e in t)return!1;return!0}function d(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function h(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!(!c(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 x(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 T(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,c=N(a,l);for(n=0;n<l;++n)v(c[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,x(this,t,e)),this},C.prototype.prependOnceListener=function(t,e){return b(e),this.prependListener(t,x(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 T(this,t,!0)},C.prototype.rawListeners=function(t){return T(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),q=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),B=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,c,u;if(i=""+i,0===n){if(!(a=t._nodes.get(i)))throw new q("Graph.".concat(e,': could not find the "').concat(i,'" node in the graph.'));c=r,u=o}else if(3===n){if(r=""+r,!(l=t._edges.get(r)))throw new q("Graph.".concat(e,': could not find the "').concat(r,'" edge in the graph.'));var d=l.source.key,h=l.target.key;if(i===d)a=l.target;else{if(i!==h)throw new q("Graph.".concat(e,': the "').concat(i,'" node is not attached to the "').concat(r,'" edge (').concat(d,", ").concat(h,")."));a=l.source}c=o,u=s}else{if(!(l=t._edges.get(i)))throw new q("Graph.".concat(e,': could not find the "').concat(i,'" edge in the graph.'));a=1===n?l.source:l.target,c=r,u=o}return[a,c,u]}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],c=s[2];return a.attributes[l]=c,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],c=s[2];if("function"!=typeof c)throw new H("Graph.".concat(e,": updater should be a function."));var u=a.attributes,d=c(u[l]);return u[l]=d,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(!c(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(!c(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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(o,'").'))}else{if("mixed"!==n)throw new B("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 q("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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("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 q("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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("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 q("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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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 q("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("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,Z=D,J=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=Z(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,c=e._edges.values();!0!==(r=c.next()).done;)if(o=r.value,!s||o.undirected===a){var u=o,d=u.key,h=u.attributes,f=u.source,p=u.target;if(l=i(d,h,f.key,p.key,f.attributes,p.attributes,o.undirected),t&&l)return d}}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 ct(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 ut=[{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 dt(){this.A=null,this.B=null}function ht(t,e,n,i,r){for(var o in i){var s=i[o],a=s.source,l=s.target,c=a===n?l:a;if(!e||!e.has(c.key)){var u=r(c.key,c.attributes);if(t&&u)return c.key}}}function ft(t,e,n,i,r){if("mixed"!==e){if("undirected"===e)return ht(t,null,i,i.undirected,r);if("string"==typeof n)return ht(t,null,i,i[n],r)}var o,s=new dt;if("undirected"!==e){if("out"!==n){if(o=ht(t,null,i,i.in,r),t&&o)return o;s.wrap(i.in)}if("in"!==n){if(o=ht(t,s,i,i.out,r),t&&o)return o;s.wrap(i.out)}}if("directed"!==e&&(o=ht(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,c=a.target;s=l===e?c: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,c,u,d,h=i._nodes.values(),f=i.type;!0!==(o=h.next()).done;){var p=!1;if(s=o.value,"undirected"!==f)for(a in l=s.out){c=l[a];do{if(u=c.target,p=!0,d=r(s.key,u.key,s.attributes,u.attributes,c.key,c.attributes,c.undirected),t&&d)return c;c=c.next}while(c)}if("directed"!==f)for(a in l=s.undirected)if(!(e&&s.key>a)){c=l[a];do{if((u=c.target).key!==a&&(u=c.source),p=!0,d=r(s.key,u.key,s.attributes,u.attributes,c.key,c.attributes,c.undirected),t&&d)return c;c=c.next}while(c)}if(n&&!p&&(d=r(s.key,null,s.attributes,null,null,null,null),t&&d))return null}}function gt(t){if(!c(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&&(!c(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(!c(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&&(!c(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.")}dt.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},dt.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 B("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 B("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!c(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 B("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),u=t._nodes.get(s);if(!l)throw new q("Graph.".concat(e,': source node "').concat(o,'" not found.'));if(!u)throw new q("Graph.".concat(e,': target node "').concat(s,'" not found.'));var d={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 B("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 B("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 h=new W(i,r,l,u,a);t._edges.set(r,h);var f=o===s;return i?(l.undirectedDegree++,u.undirectedDegree++,f&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,u.inDegree++,f&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?h.attachMulti():h.attach(),i?t._undirectedSize++:t._directedSize++,d.key=r,t.emit("edgeAdded",d),r}function xt(t,e,n,i,r,o,s,l,u){if(!i&&"undirected"===t.type)throw new B("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 B("Graph.".concat(e,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(l)if(u){if("function"!=typeof l)throw new H("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(l,'"'))}else if(!c(l))throw new H("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(l,'"'));var d;if(o=""+o,s=""+s,u&&(d=l,l=void 0),!t.allowSelfLoops&&o===s)throw new B("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 h,f,p=t._nodes.get(o),m=t._nodes.get(s);if(!n&&(h=t._edges.get(r))){if(!(h.source.key===o&&h.target.key===s||i&&h.source.key===s&&h.target.key===o))throw new B("Graph.".concat(e,': inconsistency detected when attempting to merge the "').concat(r,'" edge with "').concat(o,'" source & "').concat(s,'" target vs. ("').concat(h.source.key,'", "').concat(h.target.key,'").'));f=h}if(f||t.multi||!p||(f=i?p.undirected[s]:p.out[s]),f){var g=[f.key,!1,!1,!1];if(u?!d:!l)return g;if(u){var v=f.attributes;f.attributes=d(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||{},u&&d&&(l=d(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 B("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),h=new W(i,r,p,m,l),t._edges.set(r,h);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?h.attachMulti():h.attach(),i?t._undirectedSize++:t._directedSize++,y.key=r,t.emit("edgeAdded",y),[r,!0,C,w]}function Tt(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;d(s(e),"NodeDataClass",i);var r="geid_"+Ct()+"_",o=0;return d(s(e),"_attributes",{}),d(s(e),"_nodes",new Map),d(s(e),"_edges",new Map),d(s(e),"_directedSize",0),d(s(e),"_undirectedSize",0),d(s(e),"_directedSelfLoopCount",0),d(s(e),"_undirectedSelfLoopCount",0),d(s(e),"_edgeKeyGenerator",(function(){var t;do{t=r+o++}while(e._edges.has(t));return t})),d(s(e),"_options",t),bt.forEach((function(t){return d(s(e),t,e[t])})),h(s(e),"order",(function(){return e._nodes.size})),h(s(e),"size",(function(){return e._edges.size})),h(s(e),"directedSize",(function(){return e._directedSize})),h(s(e),"undirectedSize",(function(){return e._undirectedSize})),h(s(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),h(s(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),h(s(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),h(s(e),"multi",e._options.multi),h(s(e),"type",e._options.type),h(s(e),"allowSelfLoops",e._options.allowSelfLoops),h(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 B("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 q('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q('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 B("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 q('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q('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 B("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 q('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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 q('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&&!c(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 B('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&&!c(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 q('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{Tt(this,e),e=e.next}while(e)}for(var r in n.in){e=n.in[r];do{Tt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var o in n.undirected){e=n.undirected[o];do{Tt(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 q('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 q('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return Tt(this,e),this},r.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new B("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 B("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 q('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Tt(this,n),this},r.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new B("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 B("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 q('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Tt(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(!c(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(!c(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 u(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 u(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(!c(t))throw new H("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!c(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 u=o,d=u.key,h=u.attributes;l?this.mergeNode(d,h):this.addNode(d,h)}}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 B('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 B("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 B("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,c=t.target.key;t.undirected&&l>c&&(o=l,l=c,c=o);var u="(".concat(l,")").concat(s,"(").concat(c,")");n.startsWith("geid_")?e.multi&&(void 0===r[u]?r[u]=0:r[u]++,a+="".concat(r[u],". ")):a+="[".concat(n,"]: "),i[a+=u]=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,d(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:xt;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 q("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 q("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i,r){var o=[];return ct(!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 q("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 q("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ct(!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,c){t[s++]=n(e,i,r,o,a,l,c)}))}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 q("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 q("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("Graph.".concat(o,': could not find the "').concat(e,'" target node in the graph.'));return ct(!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 q("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=J(i,it(n.in))),"in"!==e&&void 0!==n.out&&(i=J(i,it(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(i=J(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 q("Graph.".concat(o,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("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=J(r,st(n.in,i))),void 0!==n.out&&"in"!==e&&i in n.out&&(e||n.key!==i)&&(r=J(r,st(n.out,i)))),"directed"!==t&&void 0!==n.undirected&&i in n.undirected&&(r=J(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){ut.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 q("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 q("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 q("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 q("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 dt;return"undirected"!==t&&("out"!==e&&(i=J(i,pt(r,n,n.in))),"in"!==e&&(i=J(i,pt(r,n,n.out)))),"directed"!==t&&(i=J(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=q,_t.UsageGraphError=B,_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 c(){return new c._init(arguments)}function u(){return 0}function d(){return 1}function h(t,e){return t===e?1:0}c.fn=c.prototype,c._init=function(t){if(s(t[0]))if(s(t[0][0])){a(t[1])&&(t[0]=c.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])?c.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=c.seq.apply(null,t),this.length=1;else{if(t[0]instanceof c)return c(t[0].toArray());this[0]=[],this.length=1}return this},c._init.prototype=c.prototype,c._init.constructor=c,c.utils={calcRdx:o,isArray:s,isFunction:a,isNumber:l,toVector:function(t){return n.apply([],t)}},c._random_fn=t.random,c.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");c._random_fn=t},c.extend=function(t){var e,n;if(1===arguments.length){for(n in t)c[n]=t[n];return this}for(e=1;e<arguments.length;e++)for(n in arguments[e])t[n]=arguments[e][n];return t},c.rows=function(t){return t.length||1},c.cols=function(t){return t[0].length||1},c.dimensions=function(t){return{rows:c.rows(t),cols:c.cols(t)}},c.row=function(t,e){return s(e)?e.map((function(e){return c.row(t,e)})):t[e]},c.rowa=function(t,e){return c.row(t,e)},c.col=function(t,e){if(s(e)){var n=c.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,i){c.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},c.cola=function(t,e){return c.col(t,e).map((function(t){return t[0]}))},c.diag=function(t){for(var e=c.rows(t),n=new Array(e),i=0;i<e;i++)n[i]=[t[i][i]];return n},c.antidiag=function(t){for(var e=c.rows(t)-1,n=new Array(e),i=0;e>=0;e--,i++)n[i]=[t[i][e]];return n},c.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},c.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},c.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},c.alter=function(t,e){return c.map(t,e,!0)},c.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},c.zeros=function(t,e){return l(e)||(e=t),c.create(t,e,u)},c.ones=function(t,e){return l(e)||(e=t),c.create(t,e,d)},c.rand=function(t,e){return l(e)||(e=t),c.create(t,e,c._random_fn)},c.identity=function(t,e){return l(e)||(e=t),c.create(t,e,h)},c.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},c.clear=function(t){return c.alter(t,u)},c.seq=function(t,e,n,i){a(i)||(i=!1);var r,s=[],l=o(t,e),c=(e*l-t*l)/((n-1)*l),u=t;for(r=0;u<=e&&r<n;u=(t*l+c*l*++r)/l)s.push(i?i(u,r):u);return s},c.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},c.slice=function(){function t(t,n,i,r){var o,s=[],a=t.length;if(n===e&&i===e&&r===e)return c.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(c.rowa(e,n.row),(i=n.col||{}).start,i.end,i.step):l(n.col)?t(c.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)})))}}(),c.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=c.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=c.arange(i.row.start,t.min(n[0].length,i.row.end),i.row.step);var u=i.col;return s.forEach((function(t,e){n[t][u]=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=c.arange(i.row.start,t.min(n.length,i.row.end),i.row.step),o=c.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},c.diagonal=function(t){var e=c.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},c.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=c.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 c(c.map(this,t,e))},f.cumreduce=function(t,e){return c(c.cumreduce(this,t,e))},f.alter=function(t){return c.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=c[t](this),s(n)?c(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):c(c[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return c(c[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),c}(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,c=r[l=o[e]],u=(a+(a+c-1))/2;s[l]=u,a+=c}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,c,u,d,h=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++)c=p*(l=n[a])+(o+l*(1-o-s)),u=e.floor(r(c,1,p-1)),d=r(c-u,0,1),f[a]=(1-d)*h[u-1]+d*h[u];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 c=l.slice(0,l.length-1);return setTimeout((function(){i.call(a,o[e].apply(a,c))})),this}i=void 0;var u=function(n){return t[e].apply(a,[n].concat(l))};if(this.length>1){for(a=a.transpose();s<a.length;s++)r[s]=u(a[s]);return r}return u(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,c=[.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=c[9],a=8;a>=0;a--)s*=i,s+=c[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,c=0,u=0,d=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(o=h%1+36e-17))return 1/0;l=(1&h?-1:1)*e.PI/e.sin(e.PI*o),h=1-h}for(r=h,i=h<1?h++:(h-=c=(0|h)-1)-1,n=0;n<8;++n)d=(d+s[n])*i,u=u*i+a[n];if(o=d/u+1,r<h)o/=r;else if(r>h)for(n=0;n<c;++n)o*=h,h++;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,c=i+1-n,u=1/1e-30,d=1/c,h=d,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++)h*=(d=1/(d=(r=-f*(f-n))*d+(c+=2)))*(u=c+r/u);return 1-h*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,c=1,u=n+i,d=n+1,h=n-1,f=1,p=1-u*t/d;for(e.abs(p)<l&&(p=l),a=p=1/p;c<=100&&(p=1+(o=c*(i-c)*t/((h+(r=2*c))*(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+c)*(u+c)*t/((n+r)*(d+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));c++);return a},t.gammapinv=function(n,i){var r,o,s,a,l,c,u=0,d=i-1,h=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(d),c=e.exp(d*(l-1)-h),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));u<12;u++){if(r<=0)return 0;if((r-=o=(s=(t.lowRegGamma(i,r)-n)/(o=i>1?c*e.exp(-(r-d)+d*(e.log(r)-l)):e.exp(-r+d*e.log(r)-h)))/(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,c=0,u=0;for(t<0&&(t=-t,l=!0),i=4*(n=2/(2+t))-2;a>0;a--)r=c,c=i*c-u+s[a],u=r;return o=n*e.exp(-t*t+.5*(s[0]+i*c)-u),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,c,u,d,h,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,u=(2.30753+.27061*(l=e.sqrt(-2*e.log(a))))/(1+l*(.99229+.04481*l))-l,n<.5&&(u=-u),d=(u*u-3)/6,h=2/(1/(2*i-1)+1/(2*r-1)),f=u*e.sqrt(d+h)/h-(1/(2*r-1)-1/(2*i-1))*(d+5/6-2/(3*h)),u=i/(i+r*e.exp(2*f))):(o=e.log(i/(i+r)),s=e.log(r/(i+r)),u=n<(l=e.exp(i*o)/i)/(f=l+(c=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===u||1===u)return u;if((u-=l=(c=(t.ibeta(u,i,r)-n)/(l=e.exp(m*e.log(u)+g*e.log(1-u)+p)))/(1-.5*e.min(1,c*(m/u-g/(1-u)))))<=0&&(u=.5*(u+l)),u>=1&&(u=.5*(u+l+1)),e.abs(l)<1e-8*u&&v>0)break}return u},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,c,u,d=n;if(r||(r=i),n||(n=1),i)return(u=t.zeros(i,r)).alter((function(){return t.randg(n)})),u;n<1&&(n+=1),o=n-1/3,s=1/e.sqrt(9*o);do{do{l=1+s*(c=t.randn())}while(l<=0);l*=l*l,a=t._random_fn()}while(a>1-.331*e.pow(c,4)&&e.log(a)>.5*c*c+o*(1-l+e.log(l)));if(n==d)return o*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/d)*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,c=1,u=0,d=0;e.abs((l-d)/l)>r;)d=l,a=c+(o=-(n+u)*(n+i+u)*t/(n+2*u)/(n+2*u+1))*a,l=(s=l+o*s)+(o=(u+=1)*(i-u)*t/(n+2*u-1)/(n+2*u))*l,s/=c=a+o*c,a/=c,l/=c,c=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,c=2*t.normal.cdf(a,0,1,1,0)-1;c=c>=e.exp(-50/r)?e.pow(c,r):0;for(var u=a,d=(8-a)/(l=n>3?2:3),h=u+d,f=0,p=r-1,m=1;m<=l;m++){for(var g=0,v=.5*(h+u),y=.5*(h-u),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),u=h,h+=d}return(c+=f)<=e.exp(-30/i)?0:(c=e.pow(c,i))>=1?1:c}!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,c=l,u=n*n/(n*n+i),d=0,h=e.exp(-r*r/2),f=e.exp(-r*r/2-.5*e.log(2)-t.gammaln(1.5))*r;d<200||c>o||l>o;)c=l,d>0&&(h*=r*r/(2*d),f*=r*r/(2*(d+.5))),a+=.5*(l=h*t.beta.cdf(u,d+.5,i/2)+f*t.beta.cdf(u,d+1,i/2)),d++;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,c=(i=e.floor(i))+1,u=r-i,d=c+u,h=e.exp(t.gammaln(d)-t.gammaln(u)-t.gammaln(c)+c*e.log(l)+u*e.log(1-l));return s=l<(c+1)/(d+2)?h*n(l,c,u,a):1-h*n(1-l,u,c,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,c=0;c<n;c++){for(;s>1&&l<o;){var u=1-r/(i-l);a*=u,s*=u,l++}s+=a*=(o-c)*(r-c)/((c+1)*(i-r-o+c+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,c,u,d,h,f=n;for(s=e.sqrt(f),a=e.log(f),l=.02483*(c=.931+2.53*s)-.059,u=1.1239+1.1328/(c-3.4),d=.9277-3.6224/(c-2);;){if(r=e.random()-.5,o=e.random(),h=.5-e.abs(r),i=e.floor((2*l/h+c)*r+f+.43),h>=.07&&o<=d)return i;if(!(i<0||h<.013&&o>h)&&e.log(o)+e.log(u)-e.log(l/(h*h)+c)<=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 c,u=.5*o,d=u*e.log(o)-o*e.log(2)-t.gammaln(u),h=u-1,f=.25*o;c=o<=100?1:o<=800?.5:o<=5e3?.25:.125,d+=e.log(c);for(var p=0,m=1;m<=50;m++){for(var g=0,v=(2*m-1)*c,y=1;y<=16;y++){var C,w;8<y?(C=y-8-1,w=d+h*e.log(v+a[C]*c)-(a[C]*c+v)*f):(C=y-1,w=d+h*e.log(v-a[C]*c)+(a[C]*c-v)*f),w>=-30&&(g+=i(8<y?n*e.sqrt(.5*(a[C]*c+v)):n*e.sqrt(.5*(-a[C]*c+v)),1,s)*l[C]*e.exp(w))}if(m*c>=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,c=t.tukey.cdf(o,i,r)-n,u=1;u<50;u++)if(l=o-c*(o-s)/(c-a),a=c,s=o,l<0&&(l=0,c=-n),c=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,c,u,d;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,c=e[0].length,u=t.zeros(l,o=s(n)?n[0].length:c),d=0,s(n)){for(;d<o;d++)for(i=0;i<l;i++){for(a=0,r=0;r<c;r++)a+=e[i][r]*n[r][d];u[i][d]=a}return 1===l&&1===d?u[0][0]:u}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=[],c=0,u=o.length,d=o[0].length;c<u;c++){for(l[c]=[],i=0,r=0;r<d;r++)i+=o[c][r]*a[c][r];l[c]=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,c=0,u=n.length,d=n[0].length,h=1,f=0,p=[];for(r=(n=t.aug(n,i))[0].length,l=0;l<u;l++){for(o=n[l][l],c=l,a=l+1;a<d;a++)o<e.abs(n[a][l])&&(o=n[a][l],c=a);if(c!=l)for(a=0;a<r;a++)s=n[l][a],n[l][a]=n[c][a],n[c][a]=s;for(c=l+1;c<u;c++)for(h=n[c][l]/n[l][l],a=l;a<r;a++)n[c][a]=n[c][a]-h*n[l][a]}for(l=u-1;l>=0;l--){for(f=0,c=l+1;c<=u-1;c++)f+=p[c]*n[l][c];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,c=a[0].length,u=0;for(o=0;o<l;o++){var d=o;for(s=o+1;s<l;s++)e.abs(a[s][o])>e.abs(a[d][o])&&(d=s);var h=a[o];for(a[o]=a[d],a[d]=h,s=o+1;s<l;s++)for(u=a[s][o]/a[o][o],r=o;r<c;r++)a[s][r]-=a[o][r]*u}for(o=l-1;o>=0;o--){for(u=a[o][o],s=0;s<o;s++)for(r=c-1;r>o-1;r--)a[s][r]-=a[o][r]*a[s][o]/u;for(a[o][o]/=u,r=l;r<c;r++)a[o][r]/=u}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,c,u=0,d=0,h=n.length,f=[],p=[],m=[];u<h;u++)for(f[u]=[],p[u]=[],m[u]=[],d=0;d<h;d++)u>d?(f[u][d]=n[u][d],p[u][d]=m[u][d]=0):u<d?(p[u][d]=n[u][d],f[u][d]=m[u][d]=0):(m[u][d]=n[u][d],f[u][d]=p[u][d]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(f,p)),-1),a=t.multiply(t.inv(m),i),s=r,c=t.add(t.multiply(l,r),a),u=2;e.abs(t.norm(t.subtract(c,s)))>o;)s=c,c=t.add(t.multiply(l,s),a),u++;return c},gauss_seidel:function(n,i,r,o){for(var s,a,l,c,u,d=0,h=n.length,f=[],p=[],m=[];d<h;d++)for(f[d]=[],p[d]=[],m[d]=[],s=0;s<h;s++)d>s?(f[d][s]=n[d][s],p[d][s]=m[d][s]=0):d<s?(p[d][s]=n[d][s],f[d][s]=m[d][s]=0):(m[d][s]=n[d][s],f[d][s]=p[d][s]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,f)),p),-1),l=t.multiply(t.inv(t.add(m,f)),i),a=r,u=t.add(t.multiply(c,r),l),d=2;e.abs(t.norm(t.subtract(u,a)))>o;)a=u,u=t.add(t.multiply(c,a),l),d+=1;return u},SOR:function(n,i,r,o,s){for(var a,l,c,u,d,h=0,f=n.length,p=[],m=[],g=[];h<f;h++)for(p[h]=[],m[h]=[],g[h]=[],a=0;a<f;a++)h>a?(p[h][a]=n[h][a],m[h][a]=g[h][a]=0):h<a?(m[h][a]=n[h][a],p[h][a]=g[h][a]=0):(g[h][a]=n[h][a],p[h][a]=m[h][a]=0);for(u=t.multiply(t.inv(t.add(g,t.multiply(p,s))),t.subtract(t.multiply(g,1-s),t.multiply(m,s))),c=t.multiply(t.multiply(t.inv(t.add(g,t.multiply(p,s))),i),s),l=r,d=t.add(t.multiply(u,r),c),h=2;e.abs(t.norm(t.subtract(d,l)))>o;)l=d,d=t.add(t.multiply(u,l),c),h++;return d},householder:function(n){for(var i,r,o,s,a=n.length,l=n[0].length,c=0,u=[],d=[];c<a-1;c++){for(i=0,s=c+1;s<l;s++)i+=n[s][c]*n[s][c];for(i=(n[c+1][c]>0?-1:1)*e.sqrt(i),r=e.sqrt((i*i-n[c+1][c]*i)/2),(u=t.zeros(a,1))[c+1][0]=(n[c+1][c]-i)/(2*r),o=c+2;o<a;o++)u[o][0]=n[o][c]/(2*r);d=t.subtract(t.identity(a,l),t.multiply(t.multiply(u,t.transpose(u)),2)),n=t.multiply(d,t.multiply(n,d))}return n},QR:(n=t.sum,i=t.arange,function(r){var o,s,a,l=r.length,c=r[0].length,u=t.zeros(c,c);for(r=t.copy(r),s=0;s<c;s++){for(u[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]/u[s][s];for(a=s+1;a<c;a++)for(u[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]*u[s][a]}return[r,u]}),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}}),c=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}),c=t.multiply(t.slice(i,{row:n}),o);t.sliceAssign(i,{row:r},t.add(l,c))}))})),i}(t.slice(s,{row:{end:a}})),u=t.transpose(l);void 0===u[0].length&&(u=[u]);var d=t.multiply(t.multiply(c,u),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d},jacobi:function(n){for(var i,r,o,s,a,l,c,u=1,d=n.length,h=t.identity(d,d),f=[];1===u;){for(a=n[0][1],o=0,s=1,i=0;i<d;i++)for(r=0;r<d;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,(c=t.identity(d,d))[o][o]=e.cos(l),c[o][s]=-e.sin(l),c[s][o]=e.sin(l),c[s][s]=e.cos(l),h=t.multiply(h,c),n=t.multiply(t.multiply(t.inv(c),n),c),u=0,i=1;i<d;i++)for(r=1;r<d;r++)i!=r&&e.abs(n[i][r])>.001&&(u=1)}for(i=0;i<d;i++)f.push(n[i][i]);return[h,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,c,u=0,d=(i-n)/2,h=[],f=[],p=[];u<r/2;){for(c=t(n),a=n,l=0;a<=i;a+=d,l++)h[l]=a;for(o=h.length,a=1;a<o-1;a++)c+=(a%2!=0?4:2)*t(h[a]);c=d/3*(c+t(i)),p[u]=c,d/=2,u++}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,c,u,d=e.abs(i-t[o(t,i)+1]),h=0,f=[],p=[];r>=d;)s=o(t,i+r),a=o(t,i),f[h]=(n[s]-2*n[a]+n[2*a-s])/(r*r),r/=2,h++;for(c=f.length,l=1;1!=c;){for(u=0;u<c-1;u++)p[u]=(e.pow(4,l)*f[u+1]-f[u])/(e.pow(4,l)-1);c=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,c=0,u=1;l<=n;l+=o,c++)a[c]=l;for(r=a.length;u<r-1;u++)s+=(u%2!=0?4:2)*t(a[u]);return o/3*(s+t(n))},hermite:function(t,e,n,i){for(var r,o=t.length,s=0,a=0,l=[],c=[],u=[],d=[];a<o;a++){for(l[a]=1,r=0;r<o;r++)a!=r&&(l[a]*=(i-t[r])/(t[a]-t[r]));for(c[a]=0,r=0;r<o;r++)a!=r&&(c[a]+=1/(t[a]-t[r]));u[a]=(1-2*(i-t[a])*c[a])*(l[a]*l[a]),d[a]=(i-t[a])*(l[a]*l[a]),s+=u[a]*e[a]+d[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=[],c=[],u=[],d=[],h=[],f=[];a<s-1;a++)d[a]=e[a+1]-e[a];for(u[0]=0,a=1;a<s-1;a++)u[a]=3/d[a]*(n[a+1]-n[a])-3/d[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],c[a]=[],l[a][a-1]=d[a-1],l[a][a]=2*(d[a-1]+d[a]),l[a][a+1]=d[a],c[a][0]=u[a];for(o=t.multiply(t.inv(l),c),r=0;r<s-1;r++)h[r]=(n[r+1]-n[r])/d[r]-d[r]*(o[r+1][0]+2*o[r][0])/3,f[r]=(o[r+1][0]-o[r][0])/(3*d[r]);for(r=0;r<s&&!(e[r]>i);r++);return n[r-=1]+(i-e[r])*h[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,c=0,u=[],d=[],h=[],f=[],p=[],m=[],g=[];for(c=0;c<a;c++)u[c]=t.sum(e[c])/l;for(c=0;c<l;c++)for(p[c]=[],n=0;n<a;n++)p[c][n]=e[n][c]-u[n];for(p=t.transpose(p),c=0;c<a;c++)for(m[c]=[],n=0;n<a;n++)m[c][n]=t.dot([p[c]],[p[n]])/(l-1);for(s=(r=t.jacobi(m))[0],d=r[1],g=t.transpose(s),c=0;c<d.length;c++)for(n=c;n<d.length;n++)d[c]<d[n]&&(i=d[c],d[c]=d[n],d[n]=i,h=g[c],g[c]=g[n],g[n]=h);for(o=t.transpose(p),c=0;c<a;c++)for(f[c]=[],n=0;n<o.length;n++)f[c][n]=t.dot([g[c]],[o[n]]);return[e,d,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,c,u,d=n.call(arguments);if(1===d.length){for(a=new Array(d[0].length),c=0;c<d[0].length;c++)a[c]=d[0][c];d=a}for(r=new Array,c=0;c<d.length;c++)r=r.concat(d[c]);for(o=t.mean(r),i=0,c=0;c<d.length;c++)i+=d[c].length*e.pow(t.mean(d[c])-o,2);for(i/=d.length-1,l=0,c=0;c<d.length;c++)for(s=t.mean(d[c]),u=0;u<d[c].length;u++)l+=e.pow(d[c][u]-s,2);return i/(l/(r.length-d.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,c=n.call(arguments);return i(c[0])?(r=c[0],o=c[1],s=c[2],a=c[3],l=c[4]):(r=t.mean(c[0]),o=t.mean(c[1]),s=c[0].length,a=c[1].length,l=c[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),c=e.mean(t),u=e.sum(a.map((function(t){return Math.pow(t-c,2)}))),d=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),h=u+d;return{exog:n,endog:t,nobs:i,df_model:r,df_resid:o,coef:s,predict:a,resid:l,ybar:c,SST:h,SSE:u,SSR:d,R2:u/h}}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]})),c=l.map((function(t){var i=e.studentt.cdf(t,n.df_resid);return 2*(i>.5?1-i:i)})),u=e.studentt.inv(.975,n.df_resid),d=n.coef.map((function(t,e){var n=u*a[e];return[t-n,t+n]}));return{se:a,t:l,p:c,sigmaHat:s,interval95:d}}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,c,u,d=e.xtranspxinv(t),h=0;h<r.length;h++)l=Math.sqrt(o.anova.mse*Math.abs(d[h][h])),c=Math.abs(r[h]/l),u=e.ttest(c,n.length-t[0].length-1,i),o.stats[h]=[r[h],l,c,u];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),c=n(5056),u=n.n(c),d=n(540),h=n.n(d),f=n(1113),p=n.n(f),m=n(365),g={};g.styleTagTransform=p(),g.setAttributes=u(),g.insert=l().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=h(),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],c=i.base?l[0]+i.base:l[0],u=o[c]||0,d="".concat(c," ").concat(u);o[c]=u+1;var h=n(d),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)e[h].references++,e[h].updater(f);else{var p=r(f,i);i.byIndex=a,e.splice(a,0,{identifier:d,updater:p,references:1})}s.push(d)}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),c=0;c<o.length;c++){var u=n(o[c]);0===e[u].references&&(e[u].updater(),e.splice(u,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:()=>B,q:()=>F});var i,r=n(7389),o=n(4328),s=n(6082),a=n(2003),l=n(8223),c=n(3077),u=n(439);async function d(t,e,n,r,o){const a=(0,c.R)(e,o),d=o.getSeqHandler(e).getNewColumnFromList("ref",[n]),h=o.getSeqHandler(d).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}(h,a):r===i.SIMILARITY?await async function(t,e,n){const i=e.columns.toList();return await(0,l.uL)(i,t,n)}(h,a,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 h,f=n(8774),p=n(144),m=n.n(p),g=n(7233),v=n.n(g),y=n(4139),C=n(115),w=n(8608),b=n(3541),A=n(2935),E=n(7923),S=n(7654),x=n(5480),T=n(5429),_=n(3273),N=n(3657);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(h||(h={}));var M,O,L,I,R,P,k;n(5540),n(4329),(O=M||(M={})).EUCLIDEAN="EUCLIDEAN",O.MANHATTAN="MANHATTAN",M.EUCLIDEAN,M.MANHATTAN,(I=L||(L={})).HAMMING="Hamming",I.EUCLIDEAN="Euclidean",I.MANHATTAN="Manhattan",I.TANIMOTO="Tanimoto",I.LEVENSTEIN="Levenshtein",I.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",I.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",I.SOKAL="Sokal",I.COSINE="Cosine",I.ASYMMETRIC="Asymmetric",I.Difference="Difference",I.OneHot="One-Hot",L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.TANIMOTO,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.SOKAL,L.COSINE,L.ASYMMETRIC,L.Difference,L.OneHot,L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.TANIMOTO,L.SOKAL,L.COSINE,L.ASYMMETRIC,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.Difference,L.OneHot,new Set([L.HAMMING,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.OneHot]),new Set([L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.MONOMER_CHEMICAL_DISTANCE,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.TANIMOTO,L.COSINE,L.SOKAL,L.ASYMMETRIC,L.OneHot,L.Difference]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.OneHot,L.Difference]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.Difference]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.Difference]),new Set([L.TANIMOTO,L.COSINE,L.SOKAL,L.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(R||(R={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(P||(P={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(k||(k={})),Object.prototype.toString,Promise.resolve(),n(934),n(8903);var G,D,U=n(1858);!function(t){t.none="none",t.bold="bold",t.dashed="dashed"}(G||(G={}));class V{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=G.none){var o;this._currentLineIdx=-1,this.lineClicked=new U.Subject,this.lineHover=new U.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 f.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,c,u,d,h,f,p,m,g;const v=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;v||(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 y=this.sp.dataFrame.filter,C=Math.pow(null!==(i=this.lines.shortLineThreshold)&&void 0!==i?i:5,2);for(let t=0;t<this.lines.from.length;t++)if(y.get(this.lines.from[t])&&y.get(this.lines.to[t])&&this.visibility.getBit(t)){let e=0;const n=this.sp.getMarkerSize(this.lines.from[t])/2,i=this.sp.getMarkerSize(this.lines.to[t])/2,y=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[t]),this.yAxisCol.get(this.lines.from[t]));let w=null==y?void 0:y.x,b=null==y?void 0:y.y;const A=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[t]),this.yAxisCol.get(this.lines.to[t]));let E=null==A?void 0:A.x,S=null==A?void 0:A.y;const x=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),w&&b&&E&&S&&Math.hypot(E-w,S-b)/x>.01){if(v){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!==(c=this.lines.opacity)&&void 0!==c?c:1;this.ctx.strokeStyle=`rgba(${e},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[t])?null===(d=this.lines.widths)||void 0===d?void 0:d[t]:null!==(h=this.lines.width)&&void 0!==h?h:1}t===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const y=this.multipleLinesCounts[t];let A=null;if(y){e=this.getLineLength(w,b,E,S);const r=this.getPointOnDistance(w,b,E,S,i,e),o=this.getPointOnDistance(E,S,w,b,n,e);w=r.x,b=r.y,E=o.x,S=o.y,A=this.lines.from[t]>this.lines.to[t]?this.findControlPoint(y,w,b,E,S,t):this.findControlPoint(y,E,S,w,b,t),this.ctx.moveTo(w,b),this.ctx.quadraticCurveTo(A.x,A.y,E,S)}else(!this.lines.skipShortLines||Math.pow(E-w,2)+Math.pow(S-b,2)>C)&&(this.ctx.moveTo(w,b),this.ctx.lineTo(E,S));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(w,b,E,S)),e>this.arrowWidth)){const t=y?null:this.getPointOnDistance(w,b,E,S,i,e),n=y?A.x:w,r=y?A.y:b;this.canvasArrow(this.ctx,null!==(m=null==t?void 0:t.x)&&void 0!==m?m:w,null!==(g=null==t?void 0:t.y)&&void 0!==g?g:b,n,r)}this.ctx.stroke(),this.ctx.closePath(),t===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(t){switch(this.currentLineStyle){case G.bold:t?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case G.dashed:t?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}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.dataFrame.filter;for(let s=0;s<this.lines.from.length;s++)if(o.get(this.lines.from[s])&&o.get(this.lines.to[s])&&this.visibility.getBit(s)){const o=this.sp.getMarkerSize(this.lines.from[s])/2,a=this.sp.getMarkerSize(this.lines.to[s])/2,l=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[s]),this.yAxisCol.get(this.lines.from[s])),c=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[s]),this.yAxisCol.get(this.lines.to[s]));if(this.multipleLinesCounts[s]){const n=this.getLineLength(l.x,l.y,c.x,c.y),i=this.getPointOnDistance(l.x,l.y,c.x,c.y,a,n),u=this.getPointOnDistance(c.x,c.y,null==l?void 0:l.x,null==l?void 0:l.y,o,n),d=this.lines.from[s]>this.lines.to[s]?this.findControlPoint(this.multipleLinesCounts[s],i.x,i.y,u.x,u.y,s):this.findControlPoint(this.multipleLinesCounts[s],u.x,u.y,i.x,i.y,s);r=this.calculateDistToCurveLine(s,t,e,i,u,d)}else r=this.calculateDistToStraightLine(t,e,l,c);(!i&&null!==r&&r<5||i&&null!==r&&r<i)&&(i=r,n=s)}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),c=Math.max(i.y,r.y,o.y);if(e>=s-2&&e<=a+2&&n>=l-2&&n<=c+2){const t=a-s,u=c-l;return this.calculateDistToCurveInRect(e,n,i,o,r,t,u)}return null}calculateDistToCurveInRect(t,e,n,i,r,o,s){const a=Math.floor((o+s)/3),l=1/a,c=new Uint32Array(a),u=new Uint32Array(a),d=new Uint32Array(a);let h=null;const p=new f.A(a);for(let o=0;o<c.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;(!h||h>g)&&(h=g),d[o]=Math.max(p,m),c[o]=a,u[o]=f}for(let t=0;t<c.length;t++)d[t]<h&&p.setBit(t,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const i=Math.hypot(c[n]-t,u[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 c=a-e,u=l-n;const d=Math.sqrt(c*c+u*u);c/=d,u/=d;const h=50*Math.ceil(t/2);return t%2==0?new s.Point(a+h/2*u,l-h/2*c):new s.Point(a-h/2*u,l+h/2*c)}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"}(D||(D={}));var F,H=n(726),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"}(F||(F={}));class B{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,N.Ej)(e,this.df.filter,this.positionColumns)),this._monomerPositionStats)}get analysisView(){return void 0===this._analysisView&&(this._analysisView=m()(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(y.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(y.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,w.ZR)(this.positionColumns),this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._monomerPositionStats=null;break;case"dendrogram":this.settings.showDendrogram?this.addDendrogram():this.closeViewer(F.DENDROGRAM);break;case"clusterMaxActivity":this.settings.showClusterMaxActivity?this.addClusterMaxActivityViewer():this.closeViewer(F.CLUSTER_MAX_ACTIVITY);break;case"logoSummaryTable":this.settings.showLogoSummaryTable?this.addLogoSummaryTable():this.closeViewer(F.LOGO_SUMMARY_TABLE);break;case"monomerPosition":this.settings.showMonomerPosition?this.addMonomerPosition():this.closeViewer(F.SEQUENCE_VARIABILITY_MAP);break;case"mostPotentResidues":this.settings.showMostPotentResidues?this.addMostPotentResidues():this.closeViewer(F.MOST_POTENT_RESIDUES);break;case"columns":const t=this.findViewer(F.LOGO_SUMMARY_TABLE);t._viewerGrid=null,t._logoSummaryTable=null,t.render();const e=this.findViewer(F.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(`${y.YX.WL}${y.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._webLogoSelection)&&void 0!==t||(this._webLogoSelection=null===e&&null!==this.positionColumns?(0,w.ZR)(this.positionColumns):JSON.parse(null!=e?e:"{}")),this._webLogoSelection}set webLogoSelection(t){this._webLogoSelection=t,this.df.setTag(`${y.YX.WL}${y.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.fireBitsetChanged(null),this.analysisView.grid.invalidate()}get positionColumns(){const t=m()(this.df.columns.byTags({[y.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(y.$2.ACTIVITY_SCALED)&&!t.columns.contains(y.$2.ACTIVITY)&&(t.getCol(y.$2.ACTIVITY_SCALED).name=y.$2.ACTIVITY),null!==(e=(n=t.temp)[i=B.modelName])&&void 0!==e||(n[i]=new B(t)),t.temp[B.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,w.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,w.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,l,c;const u=null===(t=o.shell.t)||void 0===t?void 0:t.temp[B.modelName];if(!u)return null;const d=r.accordion("Peptides analysis panel");d.root.style.width="100%";const h=u.getVisibleSelection(),f=u.df.filter.anyFalse?` among ${u.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(", ")},g=u.findViewer(F.LOGO_SUMMARY_TABLE),y=[],C=(null===g?[]:g.clusterSelection[x.W.ORIGINAL].concat(g.clusterSelection[x.W.CUSTOM])).join(", ");0!==C.length&&(y.push(r.h1("Logo summary table selection")),y.push(r.divText(`Selected clusters: ${C}`)));const T=u.findViewer(F.SEQUENCE_VARIABILITY_MAP),_=p(null!==(e=null==T?void 0:T.invariantMapSelection)&&void 0!==e?e:{}),M=p(null!==(n=null==T?void 0:T.mutationCliffsSelection)&&void 0!==n?n:{});0===_.length&&0===M.length||y.push(r.h1("Sequence Variabily Map viewer selection")),0!==_.length&&y.push(r.divText(`Selected monomer-positions: ${_}`)),0!==M.length&&y.push(r.divText(`Selected mutation cliffs pairs: ${M}`));const O=u.findViewer(F.MOST_POTENT_RESIDUES),L=p(null!==(i=null==O?void 0:O.mutationCliffsSelection)&&void 0!==i?i:{});0!==L.length&&(y.push(r.h1("Most Potent Residues viewer selection")),y.push(r.divText(`Selected monomer-positions: ${L}`)));const I=p(u.webLogoSelection);0!==I.length&&(y.push(r.h1("WebLogo selection")),y.push(r.divText(`Selected monomers: ${I}`)));const R=r.div(r.divV(y));d.addTitle(r.divV([r.h1(`${h.trueCount} selected rows${f}`),R],"css-gap-small")),h.anyTrue&&d.addPane("Actions",(()=>{try{const t=r.label("New view");if(v()(t).addClass("d4-link-action"),t.onclick=()=>u.createNewView(),t.onmouseover=t=>r.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===g)return r.divV([t]);const e=r.label("New cluster");v()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===g)throw new Error("Logo summary table viewer is not found");g.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 v()(n).addClass("d4-link-action"),n.onclick=()=>{const t=u.findViewer(F.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===g.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=u.settings;const k=[T,O,g].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!==u.settings&&k.push(u.settings);const G=k.filter((t=>null!==t&&(0,w.$s)(P,t)&&(t!==u.settings||u.isInitialized)));G.push(P);const D=s.BitSet.create(u.df.rowCount);for(const t of G){const e=t===this.settings?(0,w.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof x.s?(0,w.KT)(t.clusterSelection,t.clusterStats):t instanceof b.xN?(0,w.KT)(t.mutationCliffsSelection,(0,w.qI)(null!==(l=t.mutationCliffs)&&void 0!==l?l:new Map,u.df.rowCount)):null;if(null!==e&&D.or(e),t instanceof b.J){const e=(0,w.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&D.or(e)}}const U=P;P===u.settings||U instanceof x.s||null==U.mutationCliffs||d.addPane("Mutation Cliffs pairs",(()=>(0,E.F)(u.df,{mutationCliffs:U.mutationCliffs,mutationCliffsSelection:U.mutationCliffsSelection,gridColumns:u.analysisView.grid.columns,sequenceColumnName:U.sequenceColumnName,positionColumns:U.positionColumns,activityCol:U.getScaledActivityColumn()}).root),!0);const V=P===u.settings,q=V?this.webLogoSelection:P instanceof b.J?P.invariantMapSelection:{},Y=P instanceof x.s?P.clusterSelection:null!==(c=null==g?void 0:g.clusterSelection)&&void 0!==c?c:{};d.addPane("Distribution",(()=>{var t;try{return(0,S.HV)(u.df,{peptideSelection:D,columns:V?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityCol:V?u.getScaledActivityColumn():P.getScaledActivityColumn(),monomerPositionSelection:q,clusterSelection:Y,clusterColName:null==g?void 0:g.clustersColumnName})}catch(t){const e=r.divText("Error in Distribution");return r.tooltip.bind(e,String(t)),e}}),!0);const $=(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 d.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=m()(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 c=r.column;if(c.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 u=null,d=null;try{u=c.getRawData(),d=c.categories}catch(t){}const h=u&&d?a.some((t=>t.name===c.name))?t=>u[t]:t=>d[u[t]]:t=>c.get(t),f=c.name===e.activityColumn.name?o.columns.addNewFloat(r.name).init((t=>h(t))):o.columns.addNewVirtual(r.name,(t=>h(t)),c.type);for(const[t,e]of c.tags)f.setTag(t,e)}const c=o.plot.grid();c.props.showRowHeader=!1,c.root.style.maxWidth="100%",s.debounce(r.onSizeChanged(c.root),50).subscribe((t=>{var e;const n=c.root.parentElement;(null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.classList.contains("panel-content"))&&(c.root.style.height="calc(100% - 20px)",c.root.style.width="calc(100% - 20px)",c.root.style.position="absolute",c.root.style.right="10px",c.root.style.top="10px")})),(0,w.zz)(c);const u=r.box(c.root);u.style.marginLeft="0px",setTimeout((()=>{null!==l&&c.sort(l.cols,l.types);for(let t=1;t<e.gridColumns.length;t++){const n=e.gridColumns.byIndex(t);n.visible&&c.col(n.name)&&(c.col(n.name).width=n.width)}}),500);const d=(0,N.Ej)(e.activityColumn,o.filter,e.positionColumns,{isFiltered:o.filter.anyTrue||o.filter.anyFalse}),h={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},f={x:0,y:0,monomerPosition:{},mpStats:d};return e.isAnalysis&&(0,A.FZ)(c,d,e.positionColumns,e.activityColumn,h,f),u}(u.df,{positionColumns:V?u.positionColumns:P.positionColumns,columns:V?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityColumn:V?u.getScaledActivityColumn():P.getScaledActivityColumn(),gridColumns:u.analysisView.grid.columns,colorPalette:(0,a.SM)(u.df.getCol(V?u.settings.sequenceColumnName:P.sequenceColumnName),H.Z.getSeqHelper()),tableSelection:u.getCombinedSelection(),isAnalysis:null!==u.settings&&(V||$(u.settings.columns,P.getAggregationColumns()))})}catch(t){const e=r.divText("Error in Selection");return r.tooltip.bind(e,String(t)),e}}),!0),d}getScaledActivityColumn(t=!1){const e=this.df.col(y.$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),H.Z.getSeqHelper()),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>(0,w.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");A.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),H.Z.getSeqHelper()),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(y.gp.ANALYSIS_COL,"true"),i.setTag(y.gp.POSITION_COL,"true"),A.rI(i,this.alphabet)}this.df.name=t}createScaledCol(){const t=this.analysisView.grid,e=(0,w.Y1)(this.df.getCol(this.settings.activityColumnName),this.settings.activityScaling);this.df.columns.replace(y.$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)!==y.uF.MONOMER)||!(!t.isTableCell||(null===(r=t.tableColumn)||void 0===r?void 0:r.semType)!==y.uF.MONOMER)}))}getCombinedSelection(){var t,e,n,i,r,o,a,l;const c=new f.A(this.df.rowCount,!1),u=(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&&c.or(r.mask)}};u(this.webLogoSelection,this.monomerPositionStats);const d=this.findViewer(F.SEQUENCE_VARIABILITY_MAP);u(null!==(t=null==d?void 0:d.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==d?void 0:d.monomerPositionStats)&&void 0!==e?e:null);const h=(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()){c.setTrue(t);for(const t of e)c.setTrue(t)}}};h(null!==(n=null==d?void 0:d.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==d?void 0:d.mutationCliffs)&&void 0!==i?i:null);const p=this.findViewer(F.MOST_POTENT_RESIDUES);h(null!==(r=null==p?void 0:p.mutationCliffsSelection)&&void 0!==r?r:{},null!==(o=null==p?void 0:p.mutationCliffs)&&void 0!==o?o:null);const m=this.findViewer(F.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];c.or(n.mask)}return s.BitSet.fromBytes(c.buffer.buffer,c.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){_._package.logger.debug("Peptides: Error on selection changed"),_._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(F.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){_._package.logger.debug("Peptides: Error on filter changed"),_._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,w.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 c=10;const u=o.canvas.getContext("2d");if(null===u)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(u.measureText(e).width);c=Math.max(c,n)}const d=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=d.includes(e.column.name)||e.column.name===y.$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=c+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){_._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(y.gp.MULTIPLE_VIEWS)){const t=r.iconFA("wrench",(()=>(0,T.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=v()(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,H.Z.getSeqHelper()).then((e=>e.setTag(y.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._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,H.Z.getSeqHelper()).then((e=>e.setTag(y.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._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 m()(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:m()(this.df.columns.categorical).next().value,activityColumnName:this.settings.activityColumnName,activityScaling:this.settings.activityScaling});const e=yield this.df.plot.fromType(F.LOGO_SUMMARY_TABLE,t);this.analysisView.dockManager.dock(e,s.DOCK_TYPE.RIGHT,null,F.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 c=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(F.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!=c?c:null===(a=m()(this.df.columns.categorical).next().value)||void 0===a?void 0:a.name,activityTarget:y.wf.HIGH,connectivityColumnName:this._mclCols.find((t=>t.toLowerCase().startsWith("connectivity"))),clusterSizeThreshold:20,activityThreshold:1e3});const u=yield this.df.plot.fromType(F.CLUSTER_MAX_ACTIVITY,t),d=null!==(l=this.findViewerNode(F.LOGO_SUMMARY_TABLE))&&void 0!==l?l:null;this.analysisView.dockManager.dock(u,d?s.DOCK_TYPE.DOWN:s.DOCK_TYPE.RIGHT,d,F.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:y.wf.HIGH});const e=yield this.df.plot.fromType(F.SEQUENCE_VARIABILITY_MAP,t),n=this.findViewer(F.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(F.MOST_POTENT_RESIDUES),.7];i.dock(e,r,o,F.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:y.wf.HIGH});const e=yield this.df.plot.fromType(F.MOST_POTENT_RESIDUES,t),n=this.findViewer(F.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(F.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,r,o,F.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===y.gp.SETTINGS?n:"");e.name="Peptides Multiple Views",e.setTag(y.gp.MULTIPLE_VIEWS,"1");const n=o.shell.addTableView(e),i=this.findViewer(F.LOGO_SUMMARY_TABLE);return null!=i&&n.addViewer(F.LOGO_SUMMARY_TABLE,{[`sequence${y.To}`]:i.sequenceColumnName,[`activity${y.To}`]:i.activityColumnName,activityScaling:i.activityScaling,webLogoMode:i.webLogoMode,membersRatioThreshold:i.membersRatioThreshold,[`clusters${y.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,c=null!==(e=this.settings.sequenceSpaceParams.minPts)&&void 0!==e?e:4,u=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,c),d=this.df.columns.getUnusedName("Cluster (DBSCAN)"),h=this.df.columns.addNewString(d);h.init((t=>u[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=h.name),this._sequenceSpaceCols=[i[0],i[1],h.name];const f=this.analysisView.grid.col(h.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 c=this.df.getCol(this.settings.sequenceColumnName);null!==(i=(l=this.settings).mclSettings)&&void 0!==i||(l.mclSettings=new C.av);const u=this.settings.mclSettings;let d=0;const h=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),d++}5===d&&h.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,c,u,d=80,h=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<c.length;++t){const n=c[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],...u[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,c=2){const u=new Worker(new URL(n.p+n.u(51),n.b));let d;return u.postMessage({data:t,threshold:e,weights:i,aggregationMethod:r,distanceFns:o,distanceFnArgs:s,maxIterations:a,useWebGPU:l,inflate:c}),{promise:new Promise(((t,e)=>{d=t,u.onmessage=e=>{setTimeout((()=>u.terminate()),100),t(e.data.res)},u.onerror=t=>{setTimeout((()=>u.terminate()),100),e(t)}})),terminate:()=>{try{d(null),u.terminate()}catch(t){console.error(t)}}}}(w.map((t=>t.entries)),d,a,l,i,C,h,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)"),x=t.columns.getUnusedName("EmbedX (MCL)"),T=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(x);L.init((t=>E.embedX[t]));const I=t.columns.addNewFloat(T);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=x,y.props.yColumnName=T,y.props.colorColumnName=S,y.props.markerDefaultSize=6,A.unsubscribe();const U=[],F=[],H=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){U.push(E.is[t]),F.push(E.js[t]);continue}if(e>n){const t=e;e=n,n=t}let i=H.get(e);i||(i=new Map,H.set(e,i));let r=i.get(n);r||(r=0),r>=20||(r++,i.set(n,r),U.push(E.is[t]),F.push(E.js[t]))}return new V(y,x,T,{from:new Uint32Array(U),to:new Uint32Array(F),drawArrows:!1,opacity:.3,skipMultiLineCalculation:!0,skipShortLines:!0,skipMouseOverDetection:!0,shortLineThreshold:6,width:.75,color:"128,128,128"},G.none),r.setUpdateIndicator(y.root,!1),{sc:y,embedXCol:L,embedYCol:I,clusterCol:R,clusterCounterCol:k,connectivityCol:D}}(this.df,[c],[u.distanceF],[1],D.MANHATTAN,[p],[{gapOpen:u.gapOpen,gapExtend:u.gapExtend,fingerprintType:u.fingerprintType}],u.threshold,u.maxIterations,u.useWebGPU,u.inflation,u.minClusterSize);f.unsubscribe();const g=this.findViewer(F.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:[c].map((t=>t.name)),metrics:[u.distanceF],weights:[1],aggregationMethod:D.MANHATTAN,preprocessingFuncs:[p].map((t=>{var e;return null!==(e=null==t?void 0:t.name)&&void 0!==e?e:null})),preprocessingFuncArgs:[{gapOpen:u.gapOpen,gapExtend:u.gapExtend,fingerprintType:u.fingerprintType}],threshold:u.threshold,maxIterations:u.maxIterations,useWebGPU:u.useWebGPU,inflate:u.inflation,minClusterSize:u.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 c=H.Z.getSeqHelper().getSeqHandler(l);if(c.isHelm())try{o.shell.warning("Column is in HELM notation. Sequences space will linearize sequences from position 0 prior to analysis");const t=c.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 u=!t.clusterCol&&!!t.clusterEmbeddings,d=null!==(r=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==r?r:new C.GI(u);d.clusterEmbeddings=u;const f={table:this.df,molecules:l,methodName:h.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 p=0;const m=d.clusterEmbeddings?3:2,g=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),p++}p===m&&g.unsubscribe()})),v=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)}))}v.unsubscribe()}}catch(t){console.error(t)}})),y=yield o.functions.call("Bio:sequenceSpaceTopMenu",f);v.unsubscribe(),y instanceof s.ScatterPlotViewer&&(d.clusterEmbeddings||t.clusterCol||(y.props.colorColumnName=this.getScaledActivityColumn().name),y.props.showXSelector=!1,y.props.showYSelector=!1,t.clusterCol&&(y.props.colorColumnName=t.clusterCol.name),this._sequenceSpaceViewer=y,y.onContextMenu.subscribe((t=>{try{t.item("Modify Sequence space parameters",(()=>{(0,T.OH)(this)}))}catch(t){}})))}))}}B.modelName="peptidesModel"},3273:(t,e,n)=>{"use strict";n.d(e,{_package:()=>I,getTreeHelperInstance:()=>R});var i,r,o=n(4328),s=n(7389),a=n(6082),l=(n(5082),n(7233)),c=n.n(l),u=(n(4788),n(9484));n(726),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 d=n(4139);n(8608),n(2003),n(8070);var h=n(5072),f=n.n(h),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),x={};x.styleTagTransform=E(),x.setAttributes=C(),x.insert=v().bind(null,"head"),x.domAPI=m(),x.insertStyleElement=b(),f()(S.A,x),S.A&&S.A.locals&&S.A.locals;var T;!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 c()(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={}))}(T||(T={}));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(u.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=s.div(),this.activityTarget=d.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",d.wf.HIGH,{choices:[d.wf.HIGH,d.wf.LOW]}),this.clusterSizeThreshold=this.int("clusterSizeThreshold",20),this.activityThreshold=this.int("activityThreshold",1e3),this.connectivityColumnName=this.column("connectivity",{nullable:!0})}get model(){return u.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===d.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 c={},u={};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=c[e];if((null==s||null==s||o>n.get(s)&&this.activityTarget===d.wf.HIGH||o<n.get(s)&&this.activityTarget===d.wf.LOW)&&(c[e]=t),r){const n=r.get(t),i=u[e];(null==i||null==i||n>r.get(i))&&(u[e]=t)}}const h=this.dataFrame.columns.getOrCreate(O.maxActivityInClusterColName,a.COLUMN_TYPE.INT,this.dataFrame.rowCount);h.init((t=>i.isNone(t)?0:t===c[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===u[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===c[i.get(t)]&&(e=O.maxActivityLabel),r&&t===u[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==h.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!=u[n]&&s.set(u[n],!0))}s.fireChanged();const l=s.getSelectedIndexes();for(const t of l){const e=i.get(t);null!=e&&null!=u[e]&&s.set(u[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(c).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!=u[o]&&t.set(u[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,c,u,h;super.onTableAttached();const f=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(d.$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${d.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${d.To}`))||void 0===a||a.set(this,p.name));const m=null===(c=N()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===c?void 0:c.value;null!=m&&(null===(u=this.getProperty(`connectivity${d.To}`))||void 0===u||u.set(this,m.name)),this.render(),null===(h=this.dataFrame)||void 0===h||h.onDataChanged.subscribe((()=>{this.render()}))}render(){this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout((()=>{var t,e;if(!this.dataFrame)return;c()(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===d.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${d.To}`&&(this._scViewer=null),this.render()}}let L;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);const I=new a.Package;function R(){return L}},726:(t,e,n)=>{"use strict";n.d(e,{Z:()=>r});var i=n(6082);class r{static getSeqHelper(){if(!this._secHelper)throw new Error("SeqHelper is not initialized");return this._secHelper}static loadSeqHelper(){return t=this,e=void 0,r=function*(){var t;null!==(t=this._secHelper)&&void 0!==t||(this._secHelper=yield async function(){const t=i.Func.find({package:"Bio",name:"getSeqHelper"});if(0===t.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await t[0].prepare().call()).getOutputParamValue()}())},new((n=void 0)||(n=Promise))((function(i,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(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((r=r.apply(t,e||[])).next())}));var t,e,n,r}}},3657:(t,e,n)=>{"use strict";n.d(e,{Lw:()=>d,eW:()=>p,Ej:()=>h,uz:()=>u});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,c=new Array(this._workerCount),u=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,u);const d=u/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++)c[i]=new Promise(((r,o)=>{const s=Math.floor(i*d),l=i===this._workerCount-1?u:Math.floor((i+1)*d);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 h=yield Promise.all(c),f=new Map;e.forEach(((t,e)=>{f.set(t.name,e)})),h.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 c=s.get(o),u=s.get(l);c.has(t.pos[n])||c.set(t.pos[n],new Map),u.has(t.pos[n])||u.set(t.pos[n],new Map);const d=c.get(t.pos[n]),h=u.get(t.pos[n]);d.has(t.seq1Idxs[n])||d.set(t.seq1Idxs[n],[]),h.has(t.seq2Idxs[n])||h.set(t.seq2Idxs[n],[]);const p=d.get(t.seq1Idxs[n]),m=h.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),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 u(t,e){return c(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 d(t,e){const n=new Map;let i=999999,r=-999999,o=2,s=2;for(const c of t.keys()){const u=new Map;n.set(c,u);const d=t.get(c);for(const t of d.keys()){const n=d.get(t),c=new a.A(e.length,!1);if(0===n.size)continue;for(const t of n.keys())c.setFast(t,!0),n.get(t).forEach((t=>c.setFast(t,!0)));const h=(0,l.GT)(e,c);i=Math.min(i,h.meanDifference),r=Math.max(r,h.meanDifference),o=Math.min(o,h.count),s=Math.max(s,h.count),u.set(t,h)}}return{stats:n,minDiff:i,maxDiff:r,minCount:o,maxCount:s}}function h(t,e,n,r={}){var o,s,c,u,d,h;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===(u=null===(c=r.target)||void 0===c?void 0:c.col)||void 0===u?void 0:u.getRawData(),y=null===(d=r.target)||void 0===d?void 0:d.col.categories,C=(null===(h=r.target)||void 0===h?void 0:h.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 c=a.A.fromValues(s);if(c.allFalse)continue;const u=(0,l.GT)(m,c,r.aggValue);i[o]=u,f(i.general,u)}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,c,u,d,h,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!==(c=null==e?void 0:e.meanDifference)&&void 0!==c?c:n.minMeanDifference;if(null!==(u=t.minMeanDifference)&&void 0!==u||(t.minMeanDifference=E),t.minMeanDifference>E&&(t.minMeanDifference=E),!isNaN(null!==(d=null==e?void 0:e.pValue)&&void 0!==d?d:NaN)){const i=null!==(h=null==e?void 0:e.pValue)&&void 0!==h?h: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 x=null!==(y=null==e?void 0:e.ratio)&&void 0!==y?y:n.minRatio;null!==(C=t.minRatio)&&void 0!==C||(t.minRatio=x),t.minRatio>x&&(t.minRatio=x)}function p(t,e,n,i){const r=t.rowCount,o=t.getCol(e),c=o.getRawData(),u=o.categories,d=Array.from({length:u.length},(()=>new a.A(r,!1)));for(let t=0;t<r;++t)d[c[t]].setTrue(t);const h=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?d:h,n=t===s.W.ORIGINAL?u: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),c=n(2003),u=n(3657),d=n(1858),h=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,c,u,d,h;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,c=1-r.general.minPValue,u=Math.min(l,c),d=l-u,h=c-u,p=Math.max(d,h),m=null===o?0:1-o-u,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,c=i.cliffStats.minDiff,u=i.cliffStats.maxDiff,d=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(d){const e=d.count,n=d.meanDifference,i=Math.floor(Math.abs(e/Math.max(r,2))*y),o=Math.max(Math.abs(c),Math.abs(u)),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!==(h=null===(d=null===(u=null===(c=i.mutationCliffs)||void 0===c?void 0:c.get(e))||void 0===u?void 0:u.get(n))||void 0===d?void 0:d.entries())&&void 0!==h?h: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 c=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=`${c}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 u=i[n];u&&u.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,d=t.bounds,h=t.cell.tableColumn;s.save();try{if(s.beginPath(),s.rect(d.x,d.y,d.width,d.height),s.clip(),t.cell.isColHeader&&(null==h?void 0:h.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[h.name],r=p.filter.getBuffer();if(t&&e&&e.filter.length===r.length&&e.filter.every(((t,e)=>t===r[e])))f=e.stats[h.name];else{const e=(0,u.Ej)(i,p.filter,n,{isFiltered:!0,columns:[h.name]});f=e[h.name],t[h.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,u.Ej)(i,p.filter,n,{isFiltered:!0,columns:[h.name]})[h.name]:e[h.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()[h.name]=function(t,e,n,i,r,o,s,l={},u={}){var d,h,f,p,m,g,v,y,C,w;const b=window.devicePixelRatio;null!==(d=u.symbolStyle)&&void 0!==d||(u.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(h=u.upperLetterHeight)&&void 0!==h||(u.upperLetterHeight=12.2),null!==(f=u.upperLetterAscent)&&void 0!==f||(u.upperLetterAscent=.25),null!==(p=u.marginVertical)&&void 0!==p||(u.marginVertical=1),null!==(m=u.marginHorizontal)&&void 0!==m||(u.marginHorizontal=1),null!==(g=u.selectionWidth)&&void 0!==g||(u.selectionWidth=2),null!==(v=u.textHeight)&&void 0!==v||(u.textHeight=13),null!==(y=u.headerStyle)&&void 0!==y||(u.headerStyle=`bold ${u.textHeight*b}px Roboto, Roboto Local, sans-serif`);const A=(r.length-1)*u.upperLetterAscent;let E=(e.y+u.marginVertical)*b;const S=(e.height-2*u.marginVertical-A-1.25*u.textHeight)*b,x=(e.x+u.marginHorizontal)*b,T=Math.max(u.selectionWidth*b,.05*e.width*b),_=2*u.marginHorizontal+u.selectionWidth,N=(e.width-(_+u.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,c.zS)(e,5),o=t.measureText(n);r>0&&(t.lineWidth=T,t.line(x,E,x,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=u.symbolStyle;const l=N/o.width,d=i/u.upperLetterHeight;t.setTransform(l,0,0,d,M,E),t.fillText(n,0,0,o.width)}E+=i+u.upperLetterAscent*b}return t.resetTransform(),t.fillStyle=a.Color.toHtml(a.Color.black),t.textAlign="center",t.textBaseline="top",t.font=u.headerStyle,t.fillText(i,(e.x+e.width/2)*b,(e.y+e.height-u.textHeight)*b),O}(s,d,f,h.name,m,p.filter.trueCount,r.colorPalette(),r.headerSelectedMonomers?r.headerSelectedMonomers()[h.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${h.name}\`. See original error below.`),console.warn(t)}finally{s.restore()}})(t)));const m=n=>{var a;const c=t.hitTest(n.offsetX,n.offsetY);if((null==c?void 0:c.isColHeader)&&(null===(a=c.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}(c,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,h.Y)(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)}};d.fromEvent(t.overlay,"mousemove").subscribe((t=>m(t))),d.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:()=>h,YX:()=>d,gp:()=>o,i6:()=>r,rg:()=>c,uF:()=>s,wf:()=>u,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 c,u,d;!function(t){t.NONE="none",t.LG="lg",t.MINUS_LG="-lg"}(c||(c={})),function(t){t.HIGH="High",t.LOW="Low"}(u||(u={})),function(t){t.LST="lst-",t.MP="mp-",t.MPR="mpr-",t.WL="wl-"}(d||(d={}));const h=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:()=>x,AN:()=>i,AY:()=>d,B2:()=>N,BE:()=>y,CD:()=>w,F2:()=>m,FZ:()=>g,KT:()=>S,Y1:()=>h,ZR:()=>E,dl:()=>A,eY:()=>p,qI:()=>T,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),c=n.n(l),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 d(t){var e;return null!==(e=t.getTag(s.gp.SEPARATOR))&&void 0!==e?e:""}function h(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),c=[],u=l.categories,d=l.getRawData();for(let t=0;t<u.length;++t){if(!Object.values(i).includes(u[t]))continue;const e=o.Color.toHtml(l.meta.colors.getColor(d.indexOf(t))),s=r.label(null!==(a=n[u[t]])&&void 0!==a?a:u[t],{style:{color:e}});c.push(s)}const h=r.divV([r.divV(c),t.root,r.tableFromMap(e)]);return t.root.style.maxHeight="75px",h}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,c=t.length,u=t.getRawData(),d=new Float32Array(c+e.trueCount+(l&&null!==(a=null==n?void 0:n.trueCount)&&void 0!==a?a:0)),h=new Array(d.length);for(let t=0,r=0,o=0;t<c;++t){const s=e.get(t);d[t]=u[t],h[t]=s?i.SELECTION:i.ALL,s&&(d[c+r]=u[t],h[c+r]=i.ALL,++r),l&&(null==n?void 0:n.get(t))&&(d[c+e.trueCount+o]=u[t],h[c+e.trueCount+o]=i.PEPTIDES_SELECTION,++o)}const f=o.Column.fromStrings(s.$2.SPLIT_COL,h),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,d),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 x(t,e){return t.sequenceColumnName===e.sequenceColumnName&&t.activityColumnName===e.activityColumnName&&t.activityScaling===e.activityScaling}function T(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&&c()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function M(t,e=500){let n;return(...i)=>u(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_:()=>c,m2:()=>u,lh:()=>l,GT:()=>a,J1:()=>d});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 c=0,u=0;for(let n=0;n<e.length;++n)e.getBit(n)?s[c++]=t[n]:a[u++]=t[n];const d=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:d,meanDifference:d-t,ratio:s.length/e.length,mask:e,aggValue:l}}const h=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),c=t.length,u=e.length;let d,h,f;if(n){const t=a/c,e=l/u,n=(o-s)/Math.sqrt(t+e);h=r.normal.pdf(n,0,1),d=1-h,f=2*(h<d?h:d)}else if(i){const t=c+u-2,e=(a*(c-1)+l*(u-1))/t,n=Math.sqrt(c*u/(c+u))*(o-s)/e;d=1-r.studentt.cdf(n,t),h=r.studentt.cdf(n,t),f=2*(h<d?h:d)}else{const t=a/c,e=l/u,n=(o-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(c-1)+Math.pow(e,2)/(u-1));h=r.studentt.cdf(n,i),d=1-h,f=2*(h<d?h:d)}return{"p-value":f,"Mean difference":o-s,"p-value more":d,"p-value less":h}}(s,a),f=h["Mean difference"];return{count:s.length,pValue:h[f>=0?"p-value more":"p-value less"],mean:d,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 c(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 u(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 d(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,{D:()=>c,Y:()=>u});var i=n(7389),r=n(6082),o=n(4139),s=n(7654),a=n(8608),l=n(5070);function c(t,e,n,i){var r,s,a;return null!==(r=i.fromViewer)&&void 0!==r||(i.fromViewer=!1),null!==(s=i.isMutationCliffs)&&void 0!==s||(i.isMutationCliffs=!1),null!==(a=i.isMostPotentResidues)&&void 0!==a||(i.isMostPotentResidues=!1),i.monomerPosition.positionOrClusterType!==o.$2.MONOMER&&u(t,e,n,i),!0}function u(t,e,n,o){var c,u,d,h,f,p,m;if(null!==(c=o.fromViewer)&&void 0!==c||(o.fromViewer=!1),null!==(u=o.isMutationCliffs)&&void 0!==u||(o.isMutationCliffs=!1),null!==(d=o.isMostPotentResidues)&&void 0!==d||(o.isMostPotentResidues=!1),o.cliffStats&&o.isMutationCliffs){const c=null===(p=null===(f=o.cliffStats)||void 0===f?void 0:f.get(o.monomerPosition.monomerOrCluster))||void 0===p?void 0:p.get(o.monomerPosition.positionOrClusterType);if(!c)return null;const u=r.BitSet.fromBytes(c.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,u),!0),h=(0,s.QD)(c);o.fromViewer&&(h["Mean difference"]=`${h["Mean difference"]} (Color)`,h.Count&&(h.Count=`${h.Count} (Size)`));const g=null!==(m=o.aggrColValues)&&void 0!==m?m:(0,l.I_)(t,n,{mask:u}),v=Object.assign(Object.assign({},h),g),y=(0,a.F2)(d,v);return i.tooltip.show(y,o.x,o.y),y}{const c=o.mpStats[o.monomerPosition.positionOrClusterType][o.monomerPosition.monomerOrCluster];if(!(null==c?void 0:c.count))return null;const u=r.BitSet.fromBytes(c.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,u),!0),f=(0,s.QD)(c);o.fromViewer&&(f["Mean difference"]=`${f["Mean difference"]}${o.isMostPotentResidues?" (size)":""}`,f["p-value"]&&(f["p-value"]=`${f["p-value"]}${o.isMostPotentResidues?" (color)":""}`));const p=null!==(h=o.aggrColValues)&&void 0!==h?h:(0,l.I_)(t,n,{mask:u}),m=Object.assign(Object.assign({},f),p),g=(0,a.F2)(d,m);return i.tooltip.show(g,o.x,o.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:()=>E,s:()=>x});var i=n(7389),r=n(4328),o=n(6082),s=n(7233),a=n.n(s),l=n(9484),c=n(4139),u=n(2935),d=n(4326),h=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),b=n(726);const A=(t,e)=>`${t}(${e})`;var E,S;!function(t){t.ORIGINAL="original",t.CUSTOM="custom"}(E||(E={})),function(t){t.GENERAL="General",t.STYLE="WebLogo",t.AGGREGATION="Aggregation"}(S||(S={}));class x 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:S.GENERAL,nullable:!1}),this.clustersColumnName=this.column("clusters",{category:S.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:S.GENERAL,nullable:!1,columnTypeFilter:o.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",c.rg.NONE,{category:S.GENERAL,choices:Object.values(c.rg)}),this.webLogoMode=this.string("webLogoMode",d.fH.Entropy,{choices:[d.fH.full,d.fH.Entropy],category:S.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:S.STYLE}),this.columns=this.columnList("columns",[],{category:S.AGGREGATION}),this.aggregation=this.string("aggregation",o.AGG.AVG,{category:S.AGGREGATION,choices:c.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(c.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(c.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),b.Z.getSeqHelper()).columns.toList()),this._positionColumns}get isClusterSelectionEmpty(){return 0===this.clusterSelection[E.ORIGINAL].length+this.clusterSelection[E.CUSTOM].length}get customClusters(){const t={};return t[c.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.rowCount===this._scaledActivityColumn.length?this.dataFrame.filter:null).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${c.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(o.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${c.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`clusters${c.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${c.To}`:this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`clusters${c.To}`:this._clusterStats=null,this._clusterSelection=null,this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`activity${c.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[E.ORIGINAL]=[],n[E.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,u=this.getScaledActivityColumn(r).getRawData(),d=s.getCol(i),f=d.getRawData(),m=d.categories,g={};g[c.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,b=w.addNewString(c.i6.CLUSTER),S=w.addNewInt(c.i6.MEMBERS).getRawData(),x=w.addNewString(c.i6.WEB_LOGO),T=w.addNewString(c.i6.DISTRIBUTION),_=w.addNewFloat(c.i6.MEAN_DIFFERENCE).getRawData(),N=w.addNewFloat(c.i6.P_VALUE).getRawData(),M=w.addNewFloat(c.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])=>A(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];b.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),c=r?(0,h.GT)(u,i):this.clusterStats[E.CUSTOM][n.name];S[e]=c.count,D[e]=a,_[e]=c.meanDifference,N[e]=null!==(t=c.pValue)&&void 0!==t?t:o.FLOAT_NULL,M[e]=c.ratio;for(let t=0;t<P.length;++t){const[n,i]=G[t];k[t][e]=(0,h.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,h.J1)(s,n,a))}}x.setTag(o.TAGS.CELL_RENDERER,"html"),T.setTag(o.TAGS.CELL_RENDERER,"html");const U=O.aggregate(),V=U.rowCount,F=U.columns;let H=U.getCol(i);H.name=c.i6.CLUSTER,H.type!==o.COLUMN_TYPE.STRING&&(U.columns.replace(H,H.convertTo(o.COLUMN_TYPE.STRING)),H=U.getCol(H.name));const q=H.categories,B=F.addNewInt(c.i6.MEMBERS).getRawData(),Y=F.addNewString(c.i6.WEB_LOGO),$=F.addNewString(c.i6.DISTRIBUTION),j=F.addNewFloat(c.i6.MEAN_DIFFERENCE).getRawData(),W=F.addNewFloat(c.i6.P_VALUE).getRawData(),z=F.addNewFloat(c.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[q.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,h.GT)(u,e):this.clusterStats[E.ORIGINAL][q[t]];for(let e=0;e<I.length;++e){const n=I[e];K[e].set(t,(0,h.J1)(s,n,i))}B[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 Z=U.append(C);return this.bitsets=Q.concat(D),I.forEach((t=>Z.col(t).semType="lst-pie-chart")),Z}createLogoSummaryTableGrid(){const t=this.dataFrame.filter.anyFalse,e=t?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,n=this.getTotalViewerAggColumns().map((([t,e])=>A(e,t))),s=this.logoSummaryTable.plot.grid();s.sort([c.i6.MEMBERS],[!1]),this.updateFilter(),s.col(c.i6.CLUSTER).visible=!0,s.columns.setOrder([c.i6.CLUSTER,c.i6.MEMBERS,c.i6.WEB_LOGO,...this.getStringAggregatedColumns(),c.i6.DISTRIBUTION,c.i6.MEAN_DIFFERENCE,c.i6.P_VALUE,c.i6.RATIO,...n]),s.columns.rowHeader.visible=!1,s.props.rowHeight=55;const h=new o.LruCache,f=new o.LruCache,p=this.positionColumns.length,m=s.columns.byName(c.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)===c.i6.CLUSTER)u.k8(l,r.cell.value,this.clusterSelection,m),t.preventDefault();else if((null===(n=r.tableColumn)||void 0===n?void 0:n.name)===c.i6.WEB_LOGO){const e=Math.floor((r.bounds.width-2-4*(p-1))/p);let n=h.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:d.P4.LEFT,maxHeight:1e3,minHeight:y,positionWidth:e,showPositionLabels:!1}),h.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)===c.i6.DISTRIBUTION){let e=f.get(s);void 0===e&&(e=(0,g.FZ)(v,w).plot.histogram({filteringEnabled:!1,valueColumnName:v.name,splitColumnName:c.$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)!==c.i6.CLUSTER)return;null!==this.currentRowIndex&&-1!==this.currentRowIndex&&this.modifyClusterSelection(this.getCluster(s.cell(c.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(c.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)!==c.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)===c.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(c.i6.CLUSTER,t.tableRowIndex);return{positionOrClusterType:this.dataFrame.getCol(this.clustersColumnName).categories.includes(e)?E.ORIGINAL:E.CUSTOM,monomerOrCluster:e}}updateFilter(){const t=this.logoSummaryTable.getCol(c.i6.MEMBERS),e=this.logoSummaryTable.getCol(c.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,h.GT)(r.getRawData(),o);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},u={},d=this.getTotalViewerAggColumns(),f=this.getStringAggregatedColumns();for(const[e,n]of d){const i=A(n,e),r=this.dataFrame.getCol(e);l[i]=(0,h.lh)(r,n,t)}for(const e of f)u[e]=(0,h.J1)(this.dataFrame,e,t);for(let r=0;r<n;++r){const n=e.byIndex(r);i[r]=n.name===c.i6.CLUSTER?a:n.name===c.i6.MEMBERS?t.trueCount:n.name===c.i6.WEB_LOGO||n.name===c.i6.DISTRIBUTION?null:n.name===c.i6.MEAN_DIFFERENCE?s.meanDifference:n.name===c.i6.P_VALUE?s.pValue:n.name===c.i6.RATIO?s.ratio:n.name in l?l[n.name]:n.name in u?u[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[E.CUSTOM][a]=s,this.addNewCluster(a)}removeCluster(){const t=this.clusterSelection[E.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(c.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[E.CUSTOM][n];const r=i.indexOf(n);e.removeAt(r),this.bitsets.splice(r,1)}n.compact(),this.clusterSelection[E.CUSTOM]=t,this.render()}addNewCluster(t){const e=o.Column.fromBitSet(t,this.model.getVisibleSelection());e.setTag(c.gp.CUSTOM_CLUSTER,"1"),e.setTag(c.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),c=this.getScaledActivityColumn(r.anyFalse),u=c.getRawData();if(t.positionOrClusterType===E.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 d=r.anyFalse?(0,h.GT)(u,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!d.count)return null;const f=o.BitSet.fromBytes(l.buffer.buffer,a),p=(0,g.FZ)(c,f),y=(0,m.M1)(p,!0),C=(0,m.QD)(d),w=(0,h.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:f}),b=Object.assign(Object.assign({},C),w),A=(0,g.F2)(y,b);return i.tooltip.show(A,e,n),A}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:()=>M,UJ:()=>O,ds:()=>i,xN:()=>N});var i,r,o,s,a=n(4328),l=n(7389),c=n(6082),u=n(7233),d=n.n(u),h=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),x=n(8223),T=n(726),_=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 N extends c.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:c.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(r.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(r.ACTIVITY_SCALING,h.rg.NONE,{category:s.GENERAL,choices:Object.values(h.rg),nullable:!1}),this.activityTarget=this.string(r.ACTIVITY_TARGET,h.wf.HIGH,{category:s.GENERAL,choices:Object.values(h.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,c.AGG.AVG,{category:s.AGGREGATION,choices:h.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,c.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:h.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,b.sg)(((t,e,n)=>_(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[h.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 M?this._positionColumns=i(p.q.MOST_POTENT_RESIDUES):this instanceof O&&(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),T.Z.getSeqHelper()).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 N&&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 N||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof N&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof N||this.valueColumnName&&this.valueAggregation&&this.valueAggregation!=c.AGG.VALUE_COUNT&&this.valueAggregation!=c.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 M?this._monomerPositionStats=n(p.q.MOST_POTENT_RESIDUES):this instanceof O&&(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 M?this._mutationCliffs=t(p.q.MOST_POTENT_RESIDUES):this instanceof O&&(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 M?h.YX.MP:h.YX.MPR,n=this.dataFrame.getTag(`${e}${h.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 M?h.YX.MP:h.YX.MPR;this.dataFrame.setTag(`${e}${h.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof M?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?c.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}${h.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${r.ACTIVITY}${h.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}${h.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 O&&(this._viewerGrid=null);break;case r.ACTIVITY_TARGET:(this instanceof O||this instanceof M)&&(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}${h.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}${h.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(c.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${r.ACTIVITY}${h.To}`))||void 0===e||e.set(this,g()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${r.VALUE_INVARIANT_MAP}${h.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,x.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 _(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 M extends N{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,c.AGG.AVG,{category:s.INVARIANT_MAP,choices:h.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(h.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(h.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${h.YX.MP}${h.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(`${h.YX.MP}${h.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}${h.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}${h.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[h.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=c.Column.fromStrings(h.$2.MONOMER,n),r=c.DataFrame.fromColumns([i]),o=(0,x.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[h.gp.INVARIANT_MAP_COLOR_CACHE]={};const o=i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),u=i.categories;if(!this.monomerPositionStats[a])continue;const d=this.monomerPositionStats[a];for(const a of Object.keys(d)){if("general"===a)continue;const d=[];for(let t=0;t<i.length;++t){const e=u[l[t]]===a,n=!r||null==s||-1==s||r[t]===s;e&&n&&d.push(t)}const h=c.Column.float("color",d.length).init((e=>t[d[e]])).aggregate(this.colorAggregation);o[a]=h,e=Math.min(e,h),n=Math.max(n,h)}i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=o}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,u=a?this.maxColorValue:n;const d=this.logScaleColor&&l>1e-30&&u>1e-30&&e>1e-30&&n>1e-30;d&&(l=Math.log(l),u=Math.log(u));for(const t of this.positionColumns){const i=t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===h.wf.LOW&&(i[t]=u-i[t]+l),i[t]=c.Color.scaleColor(d?Math.log(i[t]):i[t],l,u,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[h.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[h.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([h.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([h.$2.MONOMER,...this._monomerMetaColumns,...n]);const r=t.getCol(h.$2.MONOMER);f.rI(r,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>L(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!==c.AGG.VALUE_COUNT&&this.valueAggregation!==c.AGG.TOTAL_COUNT&&l.unshift([this.valueColumnName,this.valueAggregation])),(0,C.D)(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())),c.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,r,o,s,a,l,c,u;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 d=this.getMonomerPosition(t);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(d,{shiftPressed:!0,ctrlPressed:!1},!0):(null===(u=null===(c=null===(l=this.mutationCliffs)||void 0===l?void 0:l.get(d.monomerOrCluster))||void 0===c?void 0:c.get(d.positionOrClusterType))||void 0===u?void 0:u.size)&&this.modifyMutationCliffsSelection(d,{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 c=e.hitTest(n.offsetX,n.offsetY);if(!(null==c?void 0:c.isTableCell)||(null===(r=null==c?void 0:c.tableColumn)||void 0===r?void 0:r.name)===h.$2.MONOMER||(null===(o=null==c?void 0:c.tableColumn)||void 0===o?void 0:o.name)&&this._monomerMetaColumns.has(c.tableColumn.name))return;const u=this.getMonomerPosition(c);this.mode===i.INVARIANT_MAP?(this.modifyInvariantMapSelection(u,{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(u.monomerOrCluster))||void 0===a?void 0:a.get(u.positionOrClusterType))||void 0===l?void 0:l.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),e.invalidate(),this.showHelp()})),I(e);const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$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(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(d()(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)===h.$2.ACTIVITY_SCALED&&r.set(this,h.$2.ACTIVITY)),d()(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=>{d()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),d()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),d()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),d()(s).css("width","auto").css("align-self","center")}const c=this.viewerGrid.root;c.style.width="auto";const u=l.iconFA("expand-alt",(()=>{const t=l.dialog();t.add(l.divV([s,c],{style:{height:"100%"}})),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Sequence Variability Map Table in full screen");d()(u).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([u,s,f],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column"}});this.root.appendChild(l.divV([m,c])),null===(n=this.viewerGrid)||void 0===n||n.invalidate()}}class O extends N{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),u=this.getTotalViewerAggColumns(),d=u.map((([t,e])=>(0,v.hX)(e,t))),f=new Array(d.length);d.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===h.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===h.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=c.BitSet.fromBytes(w.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<d.length;t++){const[e,n]=u[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=c.DataFrame.create(p),g=m.columns;return g.add(c.Column.fromList(c.TYPE.INT,h.$2.POSITION,n)),g.add(c.Column.fromList(c.TYPE.STRING,h.$2.MONOMER,i)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.MEAN_DIFFERENCE,r)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.MEAN,l)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.P_VALUE,o)),g.add(c.Column.fromList(c.TYPE.INT,h.$2.COUNT,s)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.RATIO,a)),d.forEach(((t,e)=>g.add(c.Column.fromList(c.TYPE.FLOAT,t,f[e])))),m}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([h.$2.POSITION]);const n=e.col(h.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(h.$2.MONOMER);f.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>L(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)===h.$2.MONOMER)o.positionOrClusterType=h.$2.MONOMER;else if((null===(r=t.tableColumn)||void 0===r?void 0:r.name)!==h.$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.D)(this.model.df,this.getScaledActivityColumn(),s,{fromViewer:!0,isMostPotentResidues:!0,monomerPosition:o,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),c.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,r,o;try{if(this.keyPressed&&t.currentCol.name!==h.$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!==h.$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))))})),I(e);const r=e.col(h.$2.MEAN_DIFFERENCE);r.name="Diff";const o=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$2.MONOMER);40!==t.width?(t.width=40,r.width=40):o.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(h.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(d()(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 L(t,e,n,i,r){var o,s,a,l,u;const d=[...e.positionColumns.map((t=>t.name)),h.$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===d.indexOf(v))return void p.restore();const C=g.grid.table,w=C.get(h.$2.MONOMER,y),b=v!==h.$2.MEAN_DIFFERENCE?v:C.get(h.$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[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let r=c.Color.white;null!=i[w]?r=i[w]:e instanceof M&&(e.cacheInvariantMapColors(),r=null!==(u=(null!==(l=n.temp[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[w])&&void 0!==u?u:c.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 I(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),c=n(5070),u=n(8608),d=n(5480),h=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 c=0;c<s.length;c++){const u=s[c].substring(8);l[c]=r.input.bool(u,{value:"true"===t.getTag(s[c]),onValueChanged:e=>{t.setTag(s[c],`${e}`),a()(o).empty(),o.append(n())}}),a()(l[c].captionLabel).addClass("ui-label-right").css("text-align","left"),a()(l[c].root).find(".ui-input-editor").css("margin","0px"),a()(l[c].root).find(".ui-input-description").css("margin","0px"),l[c].setTooltip(`Show distribution for each ${u}`),u===i.SEPARATE_CLUSTERS?l[c].enabled=!(!e.clusterColName||!e.clusterSelection[d.W.ORIGINAL]):u!==i.SEPARATE_MONOMERS&&u!==i.SEPARATE_POSITIONS||(l[c].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const c=r.form(l);return r.divV([c,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,u.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,c.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:o.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),d=Object.assign(Object.assign({},l),s),h=(0,u.F2)(r,d,i);return a()(h).addClass("d4-flex-col"),h}function C(t,e,n){let o=r.divText("No distribution");switch(t){case f:const t=h.A.fromSeq(e.selection.length,(t=>e.selection.get(t))),s=e.selection.anyTrue&&e.selection.anyFalse?(0,c.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[d.W.ORIGINAL].map((t=>l.indexOf(t))),m=new Array(p.length).fill(new h.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,c.GT)(s,m[n]);o.push(y(t,r,e,{[u.AN.SELECTION]:l[i]}))}const g=n[d.W.CUSTOM];for(const n of g){const r=t.getCol(n),a=h.A.fromUint32Array(i,r.getRawData()),l=(0,c.GT)(s,a);o.push(y(t,l,e,{[u.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,d=[],f=[],p=[],m=[],g=e.activityCol.getRawData();for(const r of a){const a=n[r],v=new h.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 c=p[e].indexOf(r);for(let t=0;t<l;t++)m[e][t]===c&&v.setTrue(t)}const C=(0,c.GT)(g,v);d.push(y(t,C,e,{[u.AN.SELECTION]:r}))}return r.div(d,"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,d=[],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 h.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,c.GT)(f,w);d.push(y(t,b,e,{[u.AN.SELECTION]:v}))}return r.div(d,"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=c(t,e);if(!o)return new r.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:u}=o,d=[a,l],h=i.divV([u.root,...d.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",u.root,h,(()=>{const n=c(t,e);return i.divV([n.aminoToInput.root,n.pairsGrid.root,n.uniqueSequencesGrid.root],{style:{width:"100%",height:"100%"}})})),new r.Widget(h)}function c(t,e){var n,l;const c=t.filter.getSelectedIndexes(),u=Object.keys(e.mutationCliffsSelection);if(!u.length||null===e.mutationCliffs)return null;const d=[],h=[],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 u){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(!c.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)||!c.includes(a))continue;w.has(a)||w.set(a,[]);const e=v[y[a]];w.get(a).push(t),d.push(`${i}#${e}`),h.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===d.length)return null;const E=r.Column.fromStrings("Mutation",d),S=r.Column.fromList("double","Delta",h),x=r.Column.fromStrings("~to",f),T=r.Column.fromList(r.COLUMN_TYPE.INT,"~toIdx",m),_=r.Column.fromList(r.COLUMN_TYPE.INT,"~fromIdx",p),N=r.DataFrame.fromColumns([E,S,x,T,_]);N.name="Mutation Cliff pairs";const M=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?N.filter.init((t=>x.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(T.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:()=>c});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 c(t,e,n,c,u,d){return l(this,arguments,void 0,(function*(t,e,n,l,c,u,d={}){var h,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(c);for(const t of l.columns)"true"!==t.getTag(o.gp.ANALYSIS_COL)&&(t.name.toLowerCase()===c.name.toLowerCase()&&(t.name=l.columns.getUnusedName(t.name)),w.add(t));const b={sequenceColumnName:e.name,activityColumnName:t.name,activityScaling:u,columns:{},showDendrogram:!1,showSequenceSpace:!1,sequenceSpaceParams:new s.GI(!!d.useEmbeddingsClusters&&!n),mclSettings:null!==(h=d.mclSettings)&&void 0!==h?h: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:u,activityColumnName:t.name};yield v.addLogoSummaryTable(i)}if(yield v.addMonomerPosition(),yield v.addMostPotentResidues(),null!==(f=d.addSequenceSpace)&&void 0!==f&&f){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:d.useEmbeddingsClusters}),!n&&null!==(p=d.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:u,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=d.addMCL)&&void 0!==m&&m&&(yield v.addMCLClusters(),!n&&null!==(g=d.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:u,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,c=n(7389),u=n(4328),d=n(6082),h=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,x;null==t.settings&&u.log.error("PeptidesError: Settings are not initialized");const T=c.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 h.GI,R=null!==(m=null==_?void 0:_.mclSettings)&&void 0!==m?m:new h.av,P=c.input.column(r.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{O.activityColumnName=t.name},filter:t=>(t.type===d.TYPE.FLOAT||t.type===d.TYPE.INT)&&t.name!==f.$2.ACTIVITY&&0===t.stats.missingValueCount});P.setTooltip("Numeric activity column");const k=c.input.choice(r.ACTIVITY_SCALING,{value:N,items:Object.values(f.rg),onValueChanged:t=>O.activityScaling=t});k.setTooltip("Activity column transformation method"),T.addPane(i.GENERAL,(()=>c.inputs([P,k])),!0),L[i.GENERAL]=[P,k];const G=y()(t.analysisView.viewers).some((t=>t.type===p.q.DENDROGRAM)),D=c.input.bool(p.q.DENDROGRAM,{value:null!=G&&G,onValueChanged:t=>O.showDendrogram=t}),U=c.input.bool(p.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==_?void 0:_.showClusterMaxActivity),onValueChanged:t=>{O.showClusterMaxActivity=null!=t?t:void 0}}),V=c.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)(),T.addPane(i.VIEWERS,(()=>c.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=c.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=c.input.choice(s.AGGREGATION,{value:null!==(v=M[t])&&void 0!==v?v:d.AGG.AVG,items:Object.values(d.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=c.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&&(T.addPane(i.COLUMNS,(()=>c.divV(F)),!1),L[i.COLUMNS]=H);const q={};function B(t,e){if(Z(),null==e||""===e)return;q[t]=e;let n=!0;for(const[t,e]of Object.entries(q))if(e!==I[t]){n=!1;break}n?delete O.sequenceSpaceParams:O.sequenceSpaceParams=Object.assign(Object.assign({},I),q)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const $=c.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=>B("distanceF",t)});$.setTooltip("Distance function for sequences");const j=c.input.float(a.GAP_OPEN,{value:I.gapOpen,onValueChanged:t=>B("gapOpen",t)}),W=c.input.float(a.GAP_EXTEND,{value:I.gapExtend,onValueChanged:t=>B("gapExtend",t)}),z=c.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(b=I.clusterEmbeddings)&&void 0!==b&&b,onValueChanged:t=>B("clusterEmbeddings",t)});z.setTooltip("Cluster embeddings using DBSCAN algorithm");const K=c.input.float(a.EPSILON,{value:I.epsilon,onValueChanged:t=>B("epsilon",t)});K.setTooltip("Epsilon parameter for DBSCAN. Minimum distance between two points to be considered as a cluster");const Q=c.input.int(a.MIN_PTS,{value:I.minPts,onValueChanged:t=>B("minPts",t)});Q.setTooltip("Minimum number of points in a cluster");const X=c.input.choice(a.FINGERPRINT_TYPE,{value:I.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>B("fingerprintType",t)});function Z(){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)}Z();const J={};function tt(t,e){if(et(),null==e||""===e)return;J[t]=e;let n=!0;for(const[t,e]of Object.entries(J))if(e!==R[t]){n=!1;break}n?delete O.mclSettings:O.mclSettings=Object.assign(Object.assign({},R),J)}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=c.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=c.input.float(l.GAP_OPEN,{value:R.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),rt=c.input.float(l.GAP_EXTEND,{value:R.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),ot=c.input.choice(l.FINGERPRINT_TYPE,{value:R.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=c.input.int(l.THRESHOLD,{value:null!==(A=R.threshold)&&void 0!==A?A:80,onValueChanged:t=>tt("threshold",t)}),at=c.input.int(l.MAX_ITERATIONS,{value:null!==(E=R.maxIterations)&&void 0!==E?E:5,onValueChanged:t=>tt("maxIterations",t)}),lt=c.input.float(l.INFLATION,{value:null!==(S=R.inflation)&&void 0!==S?S:1.4,onValueChanged:t=>{tt("inflation",t)}}),ct=c.input.bool(l.USE_WEBGPU,{value:R.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ct.enabled=!1,R.webGPUDescriptionPromise.then((()=>{R.webGPUDescription!==h.Ku?(ct.setTooltip(`Use WebGPU for MCL algorithm (${R.webGPUDescription})`),ct.enabled=!0):(ct.setTooltip(h.Ku),ct.enabled=!1,ct.value=!1)}));const ut=c.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(x=R.minClusterSize)&&void 0!==x?x:5,onValueChanged:t=>tt("minClusterSize",t)});et();const dt=[st,nt,ot,it,rt,lt,at,ut,ct];T.addPane(i.MCL,(()=>c.inputs(dt)),!0),L[i.MCL]=dt;const ht=[$,X,j,W,z,K,Q],ft=T.addPane(i.SEQUENCE_SPACE,(()=>c.inputs(ht)),!0);L[i.SEQUENCE_SPACE]=ht,V.fireChanged();const pt=c.dialog("Peptides settings").add(T);return pt.root.style.width="400px",pt.onOK((()=>{t.settings=O})),pt.show(),{dialog:pt,accordion:T,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,c=n(84).default,u=n(65).default,d=t.exports=function(t){if(!p(t))throw new Error("wu: `"+t+"` is not iterable!");return new h(t)};function h(t){var e=m(t);this.next=e.next.bind(e)}d.prototype=h.prototype,d.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=h.prototype,d[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=h.prototype,h.prototype[t]=e,n+=1,void(d[t]=d.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=d(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 d(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,c,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(l(e));case 5:if(n=(c=o.next()).done){t.next=12;break}return u=c.value,t.next=9,[u,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]])}))),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,c,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(l(e));case 5:if(n=(c=o.next()).done){t.next=12;break}return u=c.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("cycle",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=[],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 c=l.value,t.next=10,c;case 10:e.push(c);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,c,u,d,h=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=h.length,o=Array(r),l=0;l<r;l++)o[l]=h[l];c=s(o);case 6:if(e=(u=c.next()).done){t.next=12;break}return d=u.value,t.delegateYield(d,"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&&c.return&&c.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,c,u,d=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=(c=l.next()).done){t.next=18;break}if(u=c.value,e[n++]=u,n!==d){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,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(this);case 5:if(n=(l=o.next()).done){t.next=11;break}return c=l.value,t.delegateYield(e(c),"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,c,u;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=(c=l.next()).done){t.next=16;break}if(u=c.value,!(n++<e)){t.next=10;break}return t.abrupt("continue",13);case 10:return t.next=12,u;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,c=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,!c(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,d.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,c=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,!c(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,c=!(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(c?l:d(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,c,u,d,h,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),c=1;c<o;c++)l[c-1]=f[c];u=s(this);case 6:if(n=(d=u.next()).done){t.next=13;break}return h=d.value,t.next=10,h[e].apply(h,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&&u.return&&u.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,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(this);case 5:if(n=(l=o.next()).done){t.next=12;break}return c=l.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("pluck",a.mark((function t(e){var n,i,r,o,l,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(this);case 5:if(n=(l=o.next()).done){t.next=12;break}return c=l.value,t.next=9,c[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,c,u,d,h,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=(c=l.next()).done){t.next=14;break}return u=c.value,n=u,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:d=!0,h=!1,f=void 0,t.prev=33,p=s(this);case 35:if(d=(m=p.next()).done){t.next=42;break}return u=m.value,t.next=39,n=e(n,u);case 39:d=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),h=!0,f=t.t1;case 48:t.prev=48,t.prev=49,!d&&p.return&&p.return();case 51:if(t.prev=51,!h){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,c=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,c(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,c,u,d,h=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<h)){t.next=2;break}throw new RangeError("parameter `stop` (= "+f+") must be >= `start` (= "+h+")");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(c=r(l.value,2),u=c[0],!((d=c[1])<h)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(d>=f)){t.next=15;break}return t.abrupt("break",20);case 15:return t.next=17,u;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,c,u;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=(c=l.next()).done){t.next=12;break}return u=c.value,t.next=9,e.apply(void 0,i(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),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,c,u;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=(c=l.next()).done){t.next=17;break}return u=c.value,t.next=12,u;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,c=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,c(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,c=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,c(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,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new c,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(u=l.value,e.has(u)){t.next=12;break}return t.next=11,u;case 11:e.add(u);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,c,u,d,h,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=[],c=!0,u=!1,d=void 0,t.prev=11,h=s(n);case 13:if(c=(f=h.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:c=!0,t.next=13;break;case 26:t.next=32;break;case 28:t.prev=28,t.t0=t.catch(11),u=!0,d=t.t0;case 32:t.prev=32,t.prev=33,!c&&h.return&&h.return();case 35:if(t.prev=35,!u){t.next=38;break}throw d;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)}))),d.MAX_BLOCK=15,d.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?d.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?d.TIMEOUT:arguments[2],i=m(this);return new u((function(r,o){!function a(){var l=Date.now(),c=!0,u=!1,d=void 0;try{for(var h,f=s(i);!(c=(h=f.next()).done);c=!0){var p=h.value;try{t(p)}catch(t){return void o(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){u=!0,d=t}finally{try{!c&&f.return&&f.return()}finally{if(u)throw d}}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,c=!1,u=void 0;try{for(var d,h=s(this);!(l=(d=h.next()).done);l=!0)e=t(e,d.value)}catch(t){c=!0,u=t}finally{try{!l&&h.return&&h.return()}finally{if(c)throw u}}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=h.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),d.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),c=a.length;return l<0||l>=c?t?"":void 0:(o=a.charCodeAt(l))<55296||o>56319||l+1===c||(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"),c=n(23),u=!([].keys&&"next"in[].keys()),d="@@iterator",h="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 h:case f:return function(){return new m(this,t)}}return function(){return new m(this,t)}},E=e+" Iterator",S=t.prototype,x=S[l]||S[d]||v&&S[v],T=x||A(v);if(x){var _=n(15).getProto(T.call(new t));n(25)(_,E,!0),!i&&a(S,d)&&s(_,l,p)}if(i&&!C||s(S,l,T),c[e]=T,c[E]=p,v)if(w={keys:y?T:A(h),values:v==f?T:A(f),entries:v!=f?T:A("entries")},C)for(b in w)b in S||o(S,b,w[b]);else r(r.P+r.F*u,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,c,u,d,h=t&a.G,f=t&a.P,p=h?i:t&a.S?i[e]:(i[e]||{})[o],m=h?r:r[e]||(r[e]={});for(l in h&&(n=e),n)(c=!(t&a.F)&&p&&l in p)&&l in m||(u=c?p[l]:n[l],h&&"function"!=typeof p[l]?d=n[l]:t&a.B&&c?d=s(u,i):t&a.W&&p[l]==u?function(t){(d=function(e){return this instanceof t?new t(e):t(e)})[o]=t[o]}(u):d=f&&"function"==typeof u?s(Function.call,u):u,m[l]=d,f&&((m[o]||(m[o]={}))[l]=u))};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),c=n(35);r(r.S+r.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,r,u,d=o(t),h="function"==typeof this?this:Array,f=arguments[1],p=void 0!==f,m=0,g=c(d);if(p&&(f=i(f,arguments[2],2)),null==g||h==Array&&a(g))for(n=new h(e=l(d.length));e>m;m++)n[m]=p?f(d[m],m):d[m];else for(u=g.call(d),n=new h;!(r=u.next()).done;m++)n[m]=p?s(u,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,c="function"==typeof r&&o||"@@iterator",u="object"==typeof t,d=e.regeneratorRuntime;if(d)u&&(t.exports=d);else{(d=e.regeneratorRuntime=u?t.exports:{}).wrap=y;var h="suspendedStart",f="suspendedYield",p="executing",m="completed",g={},v=A.prototype=w.prototype;b.prototype=v.constructor=A,A.constructor=b,b.displayName="GeneratorFunction",d.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},d.mark=function(t){return t.__proto__=A,t.prototype=s(v),t},d.awrap=function(t){return new S(t)},E(x.prototype),d.async=function(t,e,n,i){var r=new x(y(t,e,n,i));return d.isGeneratorFunction(e)?r:r.next().then((function(t){return t.done?t.value:r.next()}))},E(v),v[c]=function(){return this},v.toString=function(){return"[object Generator]"},d.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}},d.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=h;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"===(c=C(l,a.iterator,s)).type){o="throw",s=c.arg;continue}if("return"===o)continue}var c;if("throw"===(c=C(a.iterator[o],a.iterator,s)).type){i.delegate=null,o="throw",s=c.arg;continue}if(o="next",s=n,!(u=c.arg).done)return r=f,u;i[a.resultName]=u.value,i.next=a.nextLoc,i.delegate=null}if("next"===o)i.sent=r===f?s:n;else if("throw"===o){if(r===h)throw r=m,s;i.dispatchException(s)&&(o="next",s=n)}else"return"===o&&i.abrupt("return",s);if(r=p,"normal"===(c=C(t,e,i)).type){r=i.done?m:f;var u={value:c.arg,done:i.done};if(c.arg!==g)return u;i.delegate&&"next"===o&&(s=n)}else"throw"===c.type&&(r=m,o="throw",s=c.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 x(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 T(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(T,this),this.reset(!0)}function M(t){if(t){var e=t[c];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 c(t,e){this.fun=t,this.array=e}function u(){}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 c(t,e)),1!==r.length||o||setTimeout(l,0)},c.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=u,i.addListener=u,i.once=u,i.off=u,i.removeListener=u,i.removeAllListeners=u,i.emit=u,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),c=n(18),u=n(21),d=n(25),h=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,x=r.Symbol,T=!1,_=f("_hidden"),N=i.isEnum,M=u("symbol-registry"),O=u("symbols"),L="function"==typeof x,I=Object.prototype,R=s&&c((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(x.prototype);return e._k=t,s&&T&&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||(x=function(){if(this instanceof x)throw TypeError("Symbol is not a constructor");return P(h(arguments[0]))},l(x.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&&!c((function(){return"[null]"!=JSON.stringify([x()])}))||l(x.prototype,"toJSON",(function(){if(L&&v(this))return this}));var q={for:function(t){return o(M,t+="")?M[t]:M[t]=x(t)},keyFor:function(t){return p(M,t)},useSetter:function(){T=!0},useSimple:function(){T=!1}};i.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),(function(t){var e=f(t);q[t]=L?e:P(e)})),T=!0,a(a.G+a.W,{Symbol:x}),a(a.S,"Symbol",q),a(a.S+a.F*!L,"Object",{create:D,defineProperty:k,defineProperties:G,getOwnPropertyDescriptor:V,getOwnPropertyNames:F,getOwnPropertySymbols:H}),d(x,"Symbol"),d(Math,"Math",!0),d(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),c=n(10),u=n(32),d=n(31),h=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],x=function(t){var e=new S((function(){}));return t&&(e.constructor=Object),S.resolve(e)===e},T=function(){var t=!1;function e(t){var n=new S(t);return m(n,e.prototype),n}try{if(t=S&&S.resolve&&x(),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=d(t)[y];return null!=e?e:t},N=function(t){var e;return!(!u(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)}}};T||(S=function(t){h(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=d(d(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}));h(i.res),h(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)}})),c(c.G+c.W+c.F*!T,{Promise:S}),n(25)(S,b),v(S),v(i=n(12)[b]),c(c.S+c.F*!T,b,{reject:function(t){return new this((function(e,n){n(t)}))}}),c(c.S+c.F*(!T||x(!0)),b,{resolve:function(t){return u(n=t)&&(T?"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}}),c(c.S+c.F*!(T&&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,c){var u,d,h,f=l(t),p=i(n,c,e?2:1),m=0;if("function"!=typeof f)throw TypeError(t+" is not iterable!");if(o(f))for(u=a(t.length);u>m;m++)e?p(s(d=t[m])[0],d[1]):p(t[m]);else for(h=f.call(t);!(d=h.next()).done;)r(h,p,d.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,c=s.process,u="process"==n(37)(c),d=function(){var t,e;for(u&&(t=c.domain)&&(c.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(u)o=function(){c.nextTick(d)};else if(l){var h=1,f=document.createTextNode("");new l(d).observe(f,{characterData:!0}),o=function(){f.data=h=-h}}else o=function(){a.call(s,d)};t.exports=function(t){var e={fn:t,next:void 0,domain:u&&c.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),c=n(78),u=n(11),d=u.process,h=u.setImmediate,f=u.clearImmediate,p=u.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)};h&&f||(h=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)(d)?i=function(t){d.nextTick(s(y,t,1))}:p?(o=(r=new p).port2,r.port1.onmessage=C,i=s(o.postMessage,o,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScript?(i=function(t){u.postMessage(t+"","*")},u.addEventListener("message",C,!1)):i=v in c("script")?function(t){l.appendChild(c("script"))[v]=function(){l.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:h,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),c=n(70),u=n(45),d=n(22)("id"),h=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(!h(t,d)){if(!p(t))return"F";if(!e)return"E";r(t,d,++v)}return"O"+t[d]},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 u=t((function(t,n){a(t,u,e),t._i=i.create(null),t._f=void 0,t._l=void 0,t[g]=0,null!=n&&c(n,r,t[s],t)}));return n(79)(u.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(u.prototype,"size",{get:function(){return l(this[g])}}),u},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)?u(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,u(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,c,u,d){var h=n(11)[t],f=h,p=u?"set":"add",m=f&&f.prototype,g={};return n(17)&&"function"==typeof f&&(d||m.forEach&&!n(18)((function(){(new f).entries().next()})))?(f=e((function(e,n){a(e,f,t),e._c=new h,null!=n&&s(n,u,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)||d&&"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=c.getConstructor(e,t,u,p),n(79)(f.prototype,l)),n(25)(f,t),g[t]=f,r(r.G+r.W+r.F,g),d||c.setStrong(f,t,u),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&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(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:()=>R,initAutoTests:()=>k,test:()=>P,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),c=n(2003),u=n(726),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())}))};(0,e.L1)("Core",(()=>{const n="AlignedSequence";(0,e.gM)((()=>d(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));let i=null;(0,e.t6)("Start analysis: simple",(()=>d(void 0,void 0,void 0,(function*(){const r=t.DataFrame.fromCsv(yield R.files.readAsText("aligned.csv")),u=r.getCol("IC50"),d=r.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,c.YI.PT),d.setTag(t.TAGS.UNITS,c.Hi.FASTA),d.setTag(c.gp.aligned,"SEQ.MSA");const h=(0,l.Y1)(u,a.rg.MINUS_LG);i=yield(0,o.n)(u,d,null,r,h,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",(()=>d(void 0,void 0,void 0,(function*(){const n=t.DataFrame.fromCsv(yield R.files.readAsText("aligned_2.csv")),r=n.getCol("Activity"),u=n.getCol("MSA");u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(a.gp.ALPHABET,c.YI.UN),u.setTag(t.TAGS.UNITS,c.Hi.SEPARATOR),u.setTag(c.gp.aligned,"SEQ.MSA"),u.setTag(a.gp.SEPARATOR,"/");const d=(0,l.Y1)(r,a.rg.MINUS_LG);i=yield(0,o.n)(r,u,null,n,d,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",(()=>d(void 0,void 0,void 0,(function*(){const s=t.DataFrame.fromCsv(yield R.files.readAsText("aligned.csv")),u=s.getCol("IC50"),d=s.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,c.YI.PT),d.setTag(t.TAGS.UNITS,c.Hi.FASTA),d.setTag(c.gp.aligned,"SEQ.MSA");const h=(0,l.Y1)(u,a.rg.MINUS_LG);i=yield(0,o.n)(u,d,null,s,h,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),f=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 p=[5,50,100,200];function m(e){return f(this,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const n=(yield R.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",(()=>f(this,void 0,void 0,(function*(){return yield(0,h.uz)(i,r)}))))}))}(0,e.L1)("Benchmarks: Mutation Cliffs",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const t of p)(0,e.t6)(`${t}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){return yield m(t)}))),{timeout:3e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Cluster stats",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const n of p)(0,e.t6)(`${n}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield R.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",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const n of p)(0,e.t6)(`${n}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield R.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",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const n of p)(0,e.t6)(`${n}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const e=(yield R.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=e.getCol("activity"),s=(0,l.Y1)(i,a.rg.NONE),u=e.getCol("cluster"),d=e.getCol("sequence");d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,n===p[0]?c.Hi.HELM:c.Hi.FASTA),yield t.timeAsync("Analysis start",(()=>f(void 0,void 0,void 0,(function*(){const t=yield(0,o.n)(i,d,u,e,s,a.rg.NONE);t&&r.shell.closeTable(t.df)}))))}))),{timeout:1e5})}),{benchmarks:!0});var g,v=n(3541),y=n(5480),C=n(4326);!function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.CLUSTER="cluster"}(g||(g={}));var w=n(912),b=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)((()=>b(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.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,(()=>b(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,u,d,h,f;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),u=n.getCol(g.SEQUENCE),u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(r,a.rg.NONE),d=n.getCol(g.CLUSTER);const p=yield(0,o.n)(r,u,d,n,h,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)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>b(void 0,void 0,void 0,(function*(){const t=f.viewerGrid.cell("9",6),n=f.getMonomerPosition(t);(0,e.E3)((0,w.D)(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",(()=>b(void 0,void 0,void 0,(function*(){if(null===f)throw new Error("Monomer-Position viewer doesn't exist");(0,e.E3)(f.mode,v.ds.MUTATION_CLIFFS,`Default Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS}`),f.mode=v.ds.INVARIANT_MAP,(0,e.E3)(f.mode,v.ds.INVARIANT_MAP,`Monomer-Position mode is not ${v.ds.INVARIANT_MAP} after switching`),f.mode=v.ds.MUTATION_CLIFFS,(0,e.E3)(f.mode,v.ds.MUTATION_CLIFFS,`Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS} after switching`)}))))}),{clear:!1}),(0,e.L1)("Viewers: Most Potent Residues",(()=>{let n,i,r,u,d,h,f;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),u=n.getCol(g.SEQUENCE),u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(r,a.rg.NONE),d=n.getCol(g.CLUSTER);const p=yield(0,o.n)(r,u,d,n,h,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)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>b(void 0,void 0,void 0,(function*(){const t="Diff",n=f.viewerGrid.cell(t,6),o=f.getMonomerPosition(n);(0,e.E3)((0,w.D)(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,u,d,h,f;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),u=n.getCol(g.SEQUENCE),u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(r,a.rg.NONE),d=n.getCol(g.CLUSTER);const p=yield(0,o.n)(r,u,d,n,h,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)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Properties",(()=>b(void 0,void 0,void 0,(function*(){f.getProperty("webLogoMode").set(f,C.fH.full),(0,e.E3)(f.webLogoMode,C.fH.full,`Web Logo Mode property is not changed to ${C.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",(()=>b(void 0,void 0,void 0,(function*(){const t=f.showTooltip({monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL},0,0);(0,e.E3)(null!==t,!0,"Tooltip is not shown for cluster '0'")}))))}),{clear:!1});var A=n(5429),E=n(7654),S=n(7923),x=n(144),T=n.n(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,d,h;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),s=n.getCol(g.SEQUENCE),s.semType=t.SEMTYPE.MACROMOLECULE,s.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(r,a.rg.NONE),d=n.getCol(g.CLUSTER);const f=yield(0,o.n)(r,s,d,n,h,a.rg.NONE);if(null===f)throw new Error("Model is null");i=f,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>_(void 0,void 0,void 0,(function*(){const t=(0,A.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(A.OO))(0,e.E3)(n.includes(t),!0,`Pane ${t} is missing`);for(const n of Object.values(A.OO)){const i=t.inputs[n].map((t=>t.caption));for(const t of Object.values(A.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,d,h,f;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(g.CLUSTER);const s=yield(0,o.n)(r,d,h,n,f,a.rg.NONE);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)("UI",(()=>_(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,E.HV)(i.df,{peptideSelection:t.BitSet.create(i.df.rowCount),columns:i.settings.columns,activityCol:f,clusterSelection:n.clusterSelection,clusterColName:h.name,monomerPositionSelection:i.webLogoSelection})}))))})),(0,e.L1)("Widgets: Mutation cliffs",(()=>{let n,i,r,d,h,f;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(g.CLUSTER);const s=yield(0,o.n)(r,d,h,n,f,a.rg.NONE);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)("UI",(()=>_(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,S.F)(i.df,{mutationCliffs:n.mutationCliffs,mutationCliffsSelection:n.mutationCliffsSelection,gridColumns:i.analysisView.grid.columns,sequenceColumnName:n.sequenceColumnName,positionColumns:n.positionColumns,activityCol:f})}))))})),(0,e.L1)("Widgets: Actions",(()=>{let n,i,d,h,f,p;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),yield n.meta.detectSemanticTypes(),d=n.getCol(g.ACTIVITY),h=n.getCol(g.SEQUENCE),h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(t.TAGS.UNITS,c.Hi.HELM),p=(0,l.Y1)(d,a.rg.NONE),f=n.getCol(g.CLUSTER);const r=yield(0,o.n)(d,h,f,n,p,a.rg.NONE);if(null===r)throw new Error("Model is null");i=r,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("New view",(()=>_(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(),c=r.shell.t;(0,e.E3)(c.getTag(a.gp.MULTIPLE_VIEWS),"1","Current table is expected to have multiple views tag"),(0,e.E3)(c.getTag(t.TAGS.ID),l,"Current table is expected to have the same UUID as new view"),(0,e.E3)(c.rowCount,2,"Current table is expected to have 2 rows"),yield(0,e.cb)(500);const u=c.temp[s.i.modelName].findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==u,!0,"New view is expected to have Logo Summary Table viewer attached")})))),(0,e.t6)("Custom clusters",(()=>_(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:y.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 N=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,d,h,f;const p="none",m={monomerOrCluster:"Aze",positionOrClusterType:"10",mcCount:3,imCount:1},v={monomerOrCluster:"meI",positionOrClusterType:"1",mcCount:2,imCount:10},C={monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL,count:3},w={monomerOrCluster:"1",positionOrClusterType:y.W.ORIGINAL,count:3};(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(r,p),h=n.getCol(g.CLUSTER);const s=yield(0,o.n)(r,d,h,n,f,p);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Visible columns",(()=>N(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",(()=>N(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(m),(0,e.E3)(n.mutationCliffsSelection[m.positionOrClusterType].includes(m.monomerOrCluster),!0,`Monomer ${m.monomerOrCluster} is not selected at position ${m.positionOrClusterType}`),(0,e.E3)(t.trueCount,m.mcCount,`Selection count is not equal to ${m.mcCount} for monomer ${m.monomerOrCluster} at position ${m.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not selected at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.mcCount+m.mcCount,`Selection count is not equal to ${v.mcCount+m.mcCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still selected at position ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,m.mcCount,`Selection count is not equal to ${m.mcCount} for monomer ${m.monomerOrCluster} at position ${m.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(C),(0,e.E3)(r.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!0,`Cluster ${C.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,C.count,`Selection count is not equal to ${C.count} for cluster ${C.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,C.count+w.count,`Selection count is not equal to ${C.count+w.count} for cluster ${C.monomerOrCluster} and cluster \n ${w.monomerOrCluster}`),r.modifyClusterSelection(C,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(r.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!1,`Cluster ${C.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 ${C.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",(()=>N(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(v),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not filtered at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),i.modifyWebLogoSelection(m,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(i.webLogoSelection[m.positionOrClusterType].includes(m.monomerOrCluster),!0,`Monomer ${m.monomerOrCluster} is not filtered at position ${m.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${m.monomerOrCluster} at position ${m.positionOrClusterType}`),i.modifyWebLogoSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still filtered at position \n ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,m.imCount,`Filter count is not equal to ${m.imCount} for monomer ${m.monomerOrCluster} at position ${m.positionOrClusterType} after deselection of monomer ${v.monomerOrCluster} at position ${v.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 M=n(5070),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)("Model: Settings",(()=>{let n,i,r,d,h,f;(0,e.gM)((()=>O(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),r=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(r,a.rg.NONE),h=n.getCol(g.CLUSTER);const s=yield(0,o.n)(r,d,h,n,f,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>O(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Activity scaling",(()=>O(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(),c=i.df.getCol(a.$2.ACTIVITY),u=i.df.rowCount;let d=c.getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],s[t],o,n(t,a.rg.NONE));d=(0,l.Y1)(r,a.rg.LG).getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],Math.log10(s[t]),o,n(t,a.rg.LG));d=(0,l.Y1)(r,a.rg.MINUS_LG).getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],-Math.log10(s[t]),o,n(t,a.rg.MINUS_LG));d=f.getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],s[t],o,n(t,a.rg.NONE))})))),(0,e.t6)("Mutation Cliffs",(()=>O(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",(()=>O(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),c=(0,M.hX)(t.AGG.AVG,o);(0,e.E3)(null!==l.viewerGrid.col(c),!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(c),!0,`Expected to remove column '${o}' from ${s.q.LOGO_SUMMARY_TABLE} but it is still present`)})))),(0,e.t6)("Dendrogram",(()=>O(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 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())}))};(0,e.L1)("Algorithms",(()=>{let n,i,r,o;(0,e.gM)((()=>L(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),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",(()=>L(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"),c=a.get("3");(0,e.E3)(l.has(1),!0,"MutationCliffsInfo['C']['3'] should have key 1"),(0,e.E3)(c.has(2),!0,"MutationCliffsInfo['D']['3'] should have key 2");const u=l.get(1),d=c.get(2);(0,e.E3)(u[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 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())}))};const R=new t.Package;function P(n,i,r){return I(this,void 0,void 0,(function*(){(null==r?void 0:r.catchUnhandled)&&(r.catchUnhandled=!1);const o=yield(0,e.N$)({category:n,test:i,testContext:r});return t.DataFrame.fromObjects(o)}))}function k(){return I(this,void 0,void 0,(function*(){yield(0,e.Xb)(R,R.getModule("package-test.js"))}))}})(),peptides_test=i})();
|
|
1
|
+
var peptides_test;(()=>{var t={8223:(t,e,n)=>{"use strict";n.d(e,{pj:()=>m,uL:()=>g});var i,o,r,s,a,l,c,u=n(6082),d=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"}(o||(o={})),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"}(r||(r={})),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"}(c||(c={}));var h=n(4572);r.Tanimoto,r.Dice,r.Asymmetric,r.BraunBlanquet,r.Cosine,r.Kulczynski,r.McConnaughey,r.RogotGoldberg,r.Russel,r.Sokal,r.Hamming,r.Euclidean,r.Tanimoto,r.Dice,r.Asymmetric,r.BraunBlanquet,r.Cosine,r.Kulczynski,r.McConnaughey,r.RogotGoldberg,r.Russel,r.Sokal,r.Hamming,r.Euclidean,r.Tanimoto,r.Dice,r.Cosine,r.Tanimoto,r.Asymmetric,r.Cosine,r.Sokal,h.Z.HAMMING,h.Z.LEVENSHTEIN,h.Z.MONOMER_CHEMICAL_DISTANCE,h.Z.NEEDLEMANN_WUNSCH,new RegExp("[rd]\\((\\w)\\)p?","g");var f=n(3077),p=n(439);async function m(){const t=u.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,n){t instanceof u.Column&&(t=(0,f.R)(t,n).columns.toList());const i=(await m()).getMonomerLib(),o=new Array(t.length),r=t[0].length,s=new Float32Array(r);for(let n=0;n<t.length;++n){const a=n<e.length?e.getCanonical(n):p._S,l=i.getMonomer("PEPTIDE",a)?.smiles??"",c=t[n],h=c.getRawData(),f=c.categories,m=f.indexOf("");if(o[n]={categories:f,data:h,emptyIndex:m},void 0===a)continue;const g=u.Column.fromStrings("smiles",f.map((t=>i.getMonomer("PEPTIDE",t)?.smiles??""))),v=(u.DataFrame.fromColumns([g]),await d.chem.getSimilarities(g,l)),y=v?v.getRawData():null;for(let t=0;t<r;++t){const e=h[t];a!==p._S&&e!==m?s[t]+=y[e]:a===p._S&&e===m&&(s[t]+=1)}}for(let n=0;n<s.length;++n){let i=s[n]/e.length;for(let r=0;r<t.length;++r){const t=o[r];if(r>=e.length&&t.data[n]!==t.emptyIndex||t.data[n]===t.emptyIndex&&r<e.length){i=u.FLOAT_NULL;break}}s[n]=i}return u.Column.fromFloat32Array("Similarity",s)}},439:(t,e,n)=>{"use strict";n.d(e,{B5:()=>a,Hi:()=>i,YI:()=>o,_S:()=>u,b9:()=>d,gp:()=>r,q7:()=>c});var i,o,r,s=n(2738);!function(t){t.FASTA="fasta",t.SEPARATOR="separator",t.HELM="helm",t.CUSTOM="custom"}(i||(i={})),function(t){t.DNA="DNA",t.RNA="RNA",t.PT="PT",t.UN="UN"}(o||(o={})),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"}(r||(r={}));const a=/(?:\[([A-Za-z0-9_\-,()]+)\])|([A-Za-z\-])/g,l=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.a(o.PT,l.fasta.peptide,.5),new s.a(o.DNA,l.fasta.dna,.55),new s.a(o.RNA,l.fasta.rna,.55)],u="",d={[i.FASTA]:"-",[i.SEPARATOR]:"",[i.HELM]:"*"}},2003:(t,e,n)=>{"use strict";n.d(e,{Hi:()=>i.Hi,SM:()=>o.SM,YI:()=>i.YI,gp:()=>i.gp,zS:()=>o.zS});var i=n(439),o=n(9634)},2738:(t,e,n)=>{"use strict";n.d(e,{X:()=>o,a:()=>i});class i{constructor(t,e,n){this.name=t,this.alphabet=e,this.cutoff=n}}class o extends i{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,{zS:()=>x,SM:()=>T});var i=n(6082),o=n(144),r=n.n(o);class s extends Float32Array{}function a(t){let e=0;for(let n=0;n<t.length;n++)e+=t[n]*t[n];return Math.sqrt(e)}var l=n(2738),c=n(439);class u{static makePalette(t,e=!1,n=u){const i={};return t.forEach((t=>{const n=t[0],o=t[1];n.forEach(((t,n)=>{i[t]=this.colourPalette[o][e?0:n]}))})),new n(i)}constructor(t){this._palette=t}get(t,e){return this._palette[t]}}u.undefinedColor="rgb(100,100,100)",u.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 u{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 h{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 o of t)"("==o?e++:")"==o?e--:e?n+=o:i+=o;return isNaN(parseInt(n))?[i,n]:[i,""]}static getColorAAPivot(t="",e="grok"){const n=this.getPalette(e);let[i,o]=this.getInnerOuter(t);if(i=i.length>6?`${i.slice(0,3)}...`:i,o=o.length>6?`${o.slice(0,3)}...`:o,1==t.length||"("==t[1]){const e=t[0]?.toUpperCase();return e in n?[n.get(e),e,o,1]:[this.undefinedColor,i,o,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,o,2]:[this.undefinedColor,i,o,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,o,3]:[this.undefinedColor,i,o,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,o,4]:[this.undefinedColor,i,o,4]}return[this.undefinedColor,i,o,0]}}h.SemType="Aminoacids",h.SemTypeMultipleAlignment="AminoacidsMultipleAlignment",h.undefinedColor="rgb(100,100,100)",h.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"},h.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"},h.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(*)*"},h.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 f extends u{static get Chromatogram(){return void 0===this.chromatogram&&(this.chromatogram=new f({A:"green",C:"blue",G:"black",T:"red",U:"red",others:"gray"})),this.chromatogram}}class p{}p.SemType="Nucleotides",p.SemTypeMultipleAlignment="NucleotidesMultipleAlignment",p.Names={A:"Adenine",C:"Cytosine",G:"Guanine",T:"Thymine",U:"Uracil"};var m=n(8223);function g(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),o=i.Color.b(n),r=Math.sqrt(Math.pow(0-e,2)+Math.pow(0-t,2)+Math.pow(0-o,2));if(r>210)return`rgb(${e/r*210},${t/r*210},${o/r*210})`}return i.Color.toRgb(n)}class v{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 y{}class C extends y{get(t,e){return"#666666"}}class w extends y{static get palette(){return w._pallete||(w._pallete=w.buildPalette()),w._pallete}static buildPalette(){return(0,m.pj)().then((t=>{t.awaitLoaded(1/0).then((()=>{const e=t.getMonomerLib();e.onChanged.subscribe((()=>{w.customMonomerColors={},w.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]=g(n.meta.colors.default.background))}}}))}))})),[].concat(...Object.values(u.colourPalette))}get(t,e){const n=w.palette.length,i=w.customMonomerColors[t],o=e??"PEPTIDE";if(i&&i[o])return i[o];const r=v.hashCode(t)%n;return g(w.palette[r])}}w._pallete=null,w.customMonomerColors={},w.polymerTypes=[];class b extends u{static get Gray(){return void 0===this.gray&&(this.gray=new C),this.gray}static get Color(){return void 0===this.color&&(this.color=new w),this.color}}class A{get length(){return this.mList.length}isGap(t){return this.getOriginal(t)===this.gapOriginalMonomer}getCanonical(t){if(this.length<=t)throw new Error("Index out of bounds");const e=this.mList[t];return e!==this.gapOriginalMonomer?e:c._S}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}}const E=t=>{const e=r()(t.toString().matchAll(c.B5)).map((t=>t[2]??t[1])).toArray();return new A(e,c.b9[c.Hi.FASTA])},S=/([^\W_]+)/g;function x(t,e){if(t.length<=e)return t;const n=t.match(S),i=t.length>e||(n?.length??0)>1,o=n?.[0]??" ";return i?o.substring(0,e-1)+"…":o}function T(t,e,n=5){let o;if(t.semType==i.SEMTYPE.MACROMOLECULE)o=e.getSeqHandler(t).alphabet;else{const e=function(t,e,n){const i=t.categories;return function(t,e){const n={};let i=!0,o=null;for(const r of t)if(null==o?o=r.length:r.length!==o&&(i=!1),r.length>=e)for(let t=0;t<r.length;++t){const e=r.getCanonical(t);e in n||(n[e]=0),n[e]+=1}return{freq:n,sameLength:i}}(r().enumerate(t.getRawData()).map((([t,e])=>n(i[t]))),e)}(t,n,E);o=function(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 o=[],r=[];for(const n of i)o.push(n in t?t[n]:0),r.push(e.has(n)?1:0);const l=new s(o),c=new s(r);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}(l,c)/(a(l)*a(c))}(t,e.alphabet,n);return new l.X(e,t,i)}));let o;const r=Math.max(...i.map((t=>t.similarity>t.cutoff?t.similarity:-1)));return o=r>0?i.find((t=>t.similarity===r)).name:c.YI.UN,o}(e.freq,c.q7)}return function(t){switch(t){case c.YI.PT:return d.GrokGroups;case c.YI.DNA:case c.YI.RNA:return f.Chromatogram;default:return b.Color}}(o)}},3077:(t,e,n)=>{"use strict";n.d(e,{R:()=>o});var i=n(6082);function o(t,e){const n=t=>{const e=s.columns.addNewString((t+1).toString());return o.push(e),e},o=[],r=t.length,s=i.DataFrame.create(r),a=e.getSeqHandler(t);for(let t=0;t<r;++t){const e=a.getSplitted(t);for(let i=0;i<e.length;++i){const r=e.getCanonical(i);((o[i]??null)||n(i)).set(t,r,!1)}}return s}},4326:(t,e,n)=>{"use strict";n.d(e,{P4:()=>s,fH:()=>o});var i,o,r,s,a,l,c=n(6082);!function(t){t.tooltipWebLogo=".tooltipWebLogo"}(i||(i={})),function(t){t.Entropy="Entropy",t.full="100%"}(o||(o={})),function(t){t.TOP="top",t.MIDDLE="middle",t.BOTTOM="bottom"}(r||(r={})),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=c.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=o.Entropy,this.positionWidth=16,this.verticalAlignment=r.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,o=(i="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t={}){var e,n,o=void 0!==t?t:{};o.ready=new Promise((function(t,i){e=t,n=i}));var r,s=Object.assign({},o),a="object"==typeof window,l="function"==typeof importScripts,c=("object"==typeof process&&"object"==typeof process.versions&&process.versions.node,"");(a||l)&&(l?c=self.location.href:"undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),i&&(c=i),c=0!==c.indexOf("blob:")?c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1):"",l&&(r=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)})),o.print||console.log.bind(console);var u,d,h=o.printErr||console.warn.bind(console);Object.assign(o,s),s=null,o.arguments&&o.arguments,o.thisProgram&&o.thisProgram,o.quit&&o.quit,o.wasmBinary&&(u=o.wasmBinary),o.noExitRuntime,"object"!=typeof WebAssembly&&S("no native wasm support detected");var f,p,m,g=!1;function v(){var t=d.buffer;o.HEAP8=f=new Int8Array(t),o.HEAP16=new Int16Array(t),o.HEAP32=new Int32Array(t),o.HEAPU8=p=new Uint8Array(t),o.HEAPU16=new Uint16Array(t),o.HEAPU32=m=new Uint32Array(t),o.HEAPF32=new Float32Array(t),o.HEAPF64=new Float64Array(t)}var y=[],C=[],w=[],b=0,A=null,E=null;function S(t){o.onAbort&&o.onAbort(t),h(t="Aborted("+t+")"),g=!0,t+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(t);throw n(e),e}var x,T;function _(t){return t.startsWith("data:application/octet-stream;base64,")}function N(t){try{if(t==x&&u)return new Uint8Array(u);if(r)return r(t);throw"both async and sync fetching of the wasm failed"}catch(t){S(t)}}function M(t,e,n){return function(t){return u||!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){h("failed to asynchronously prepare wasm: "+t),S(t)}))}function O(t){for(;t.length>0;)t.shift()(o)}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=d.buffer;try{return d.grow(t-e.byteLength+65535>>>16),v(),1}catch(t){}}function R(t){return o["_"+t]}_(x="wasmDbscan.wasm")||(T=x,x=o.locateFile?o.locateFile(T,c):c+T);var P="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function k(t,e,n,i,o){var r={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 o=n+i-1,r=0;r<t.length;++r){var s=t.charCodeAt(r);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&t.charCodeAt(++r)),s<=127){if(n>=o)break;e[n++]=s}else if(s<=2047){if(n+1>=o)break;e[n++]=192|s>>6,e[n++]=128|63&s}else if(s<=65535){if(n+2>=o)break;e[n++]=224|s>>12,e[n++]=128|s>>6&63,e[n++]=128|63&s}else{if(n+3>=o)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 c=0;c<i.length;c++){var u=r[n[c]];u?(0===l&&(l=U()),a[c]=u(i[c])):a[c]=i[c]}var d=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,o=e;t[o]&&!(o>=i);)++o;if(o-e>16&&t.buffer&&P)return P.decode(t.subarray(e,o));for(var r="";e<o;){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)r+=String.fromCharCode(s);else{var c=s-65536;r+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else r+=String.fromCharCode((31&s)<<6|a)}else r+=String.fromCharCode(s)}return r}(p,n,i):"":"boolean"===e?Boolean(t):t;var n,i}(t)}(d)}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 o=1;o<=4;o*=2){var r=n*(1+.2/o);if(r=Math.min(r,t+100663296),I(Math.min(i,(e=Math.max(t,r))+(65536-e%65536)%65536)))return!0}return!1}},U=(function(){var t,e,i,r,s={env:D,wasi_snapshot_preview1:D};function a(t,e){var n,i=t.exports;return o.asm=i,d=o.asm.memory,v(),o.asm.__indirect_function_table,n=o.asm.__wasm_call_ctors,C.unshift(n),function(t){if(b--,o.monitorRunDependencies&&o.monitorRunDependencies(b),0==b&&(null!==A&&(clearInterval(A),A=null),E)){var e=E;E=null,e()}}(),i}if(b++,o.monitorRunDependencies&&o.monitorRunDependencies(b),o.instantiateWasm)try{return o.instantiateWasm(s,a)}catch(t){h("Module.instantiateWasm callback failed with error: "+t),n(t)}(t=u,e=x,i=s,r=function(t){a(t.instance)},t||"function"!=typeof WebAssembly.instantiateStreaming||_(e)||"function"!=typeof fetch?M(e,i,r):fetch(e,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,i).then(r,(function(t){return h("wasm streaming compile failed: "+t),h("falling back to ArrayBuffer instantiation"),M(e,i,r)}))}))).catch(n)}(),o._dbscan=function(){return(o._dbscan=o.asm.dbscan).apply(null,arguments)},o._malloc=function(){return(o._malloc=o.asm.malloc).apply(null,arguments)},o._free=function(){return(o._free=o.asm.free).apply(null,arguments)},function(){return(U=o.asm.stackSave).apply(null,arguments)}),V=function(){return(V=o.asm.stackRestore).apply(null,arguments)},F=function(){return(F=o.asm.stackAlloc).apply(null,arguments)},H=function(){return(H=o.asm.__cxa_is_pointer_type).apply(null,arguments)};function q(){function t(){G||(G=!0,o.calledRun=!0,g||(O(C),e(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),function(){if(o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)t=o.postRun.shift(),w.unshift(t);var t;O(w)}()))}b>0||(function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)t=o.preRun.shift(),y.unshift(t);var t;O(y)}(),b>0||(o.setStatus?(o.setStatus("Running..."),setTimeout((function(){setTimeout((function(){o.setStatus("")}),1),t()}),1)):t()))}if(o.ccall=k,o.cwrap=function(t,e,n,i){var o=!n||n.every((t=>"number"===t||"boolean"===t));return"string"!==e&&o&&!i?R(t):function(){return k(t,e,n,arguments)}},E=function t(){G||q(),G||(E=t)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return q(),t.ready});"object"==typeof exports?t.exports=o:"function"==typeof define&&n.amdO?define([],(function(){return o})):"object"==typeof exports&&(exports.exportCppDbscanLib=o)},4329:(t,e,n)=>{"use strict";n.d(e,{_:()=>r});var i=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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 o=null;function r(){return i(this,void 0,void 0,(function*(){if(!navigator.gpu)return console.error("WebGPU is not supported in this browser"),null;if(!o&&(o=yield navigator.gpu.requestAdapter(),null==o))return null;let t=null;return"info"in o?t=o.info:"requestAdapterInfo"in o&&"function"==typeof o.requestAdapterInfo&&(t=yield o.requestAdapterInfo()),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,o=new Float32Array((n.length+i)*(n.length+i));return Object.entries(e).forEach((([t,i])=>{const r=n[i];Object.entries(e).forEach((([e,i])=>{o[t.charCodeAt(0)*n.length+e.charCodeAt(0)]=r[i]}))})),(t,e)=>1-o[t.charCodeAt(0)*n.length+e.charCodeAt(0)]}(),n=t?.threshold??0;return(t,i)=>{let o=0;const r=t.length,s=i.length,a=Math.ceil(Math.max(r,s)*(1-n));r!==s&&(o=Math.abs(r-s));let l=0;for(let n=0;n<Math.min(r,s);n++)if(t[n]!==i[n]&&(l+=e(t[n],i[n]),l>a))return 1;return l+=o,l/=Math.max(r,s),l}}n.d(e,{k:()=>i})},4572:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i.Z});var i=n(2362)},3359:(t,e,n)=>{"use strict";n.d(e,{Q:()=>o});var i=n(2787);function o(){return(t,e)=>(0,i.I)(t,e)/Math.max(t.length,e.length)}},2362:(t,e,n)=>{"use strict";n.d(e,{Z:()=>i});var i,o=n(5395),r=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={})),i.HAMMING,o.k,i.LEVENSHTEIN,r.Q,i.NEEDLEMANN_WUNSCH,s.i,i.MONOMER_CHEMICAL_DISTANCE,o.k},250:(t,e,n)=>{"use strict";n.d(e,{i:()=>o});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 o(t){const e=new Uint16Array(65536),{gapOpen:n,gapExtend:o,scoringMatrix:r,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 c=0,u=1;for(let e=1;e<t.length+1;e++)a[0][e]=-o-(e-1)*o,a[1][e]=0;a[0][0]=0;for(let d=1;d<i.length+1;d++){a[u][0]=-o-(d-1)*o;for(let h=1;h<t.length+1;h++){const f=a[c][h-1]+r[e[t.charCodeAt(h-1)]][e[i.charCodeAt(d-1)]],p=a[c][h]-(s[h]||1===d||d===i.length?o:n),m=a[u][h-1]-(l[h-1]||1===h||h===t.length?o:n);a[u][h]=Math.max(f,m,p),a[u][h]===f?(s[h]=!1,l[h]=!1):a[u][h]===m?(s[h]=!1,l[h]=!0):(s[h]=!0,l[h]=!1)}c=u,u=(u+1)%2}const d=Math.min(t.length,i.length);return(d-a[c][t.length])/d}}},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,o=i._createBuffer(n);if(e)for(let t=0;t<o.length;t++)o[t]=-1;this._data=o,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 o=t.lengthInInts;for(let i=0;i<o;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 o=0,r=0;for(;e-r>=4;)n._data[o++]=255&t[r]|(255&t[r+1])<<8|(255&t[r+2])<<16|(255&t[r+3])<<24,r+=4;return e-r==3&&(n._data[o]=(255&t[r+2])<<16),e-r==2&&(n._data[o]|=(255&t[r+1])<<8),e-r==1&&(n._data[o]|=255&t[r]),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,o=!0){if(n&&o&&this.setAll(!e,!1),o)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 o=Math.min(t,e),r=Math.max(t,e);if(n)for(let t=o;t<=r;t++)this.setTrue(t);else for(let t=o;t<=r;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 o=31&this._length;for(0!=o&&(n&=~(4294967295<<o));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 o=this.lengthInInts;let r=0;for(;r<o-1;r++)for(let e=this._data[r]&t._data[r];0!=e;e>>>=8)n+=i._onBitCount[255&e];let s=this._data[r]&t._data[r];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 o=this.lengthInInts;for(let r=Math.floor(t/32);r<o;r++){let o=e?this._data[r]:~this._data[r];if(0!=n)o&=4294967295<<n&4294967295,n=0;else if(!e&&-4294967296==o)continue;for(let e=0;0!=o;e+=8,o>>>=8){const n=i._firstOnBit[255&o];if(n>=0)return(t=n+32*r+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 o=Math.floor(t/32);o>=0;o--){let t=e?this._data[o]:~this._data[o];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*o+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:()=>Y,gM:()=>k,L1:()=>P,cb:()=>B,E3:()=>I,Wj:()=>R,Xb:()=>U,N$:()=>V,t6:()=>L,PE:()=>M,rd:()=>O,Bl:()=>W,CN:()=>C});var i=n(4328),o=n(6082);n(9982);const r=o.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,,,,,,,,,,,,,,,,,,,,,');r.columns.add(o.Column.fromList(o.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var s=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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,o,r,a,l,c,u=!0){return s(this,void 0,void 0,(function*(){let d=null;if(yield O(o,(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)),r){const e=null!=c?c:{};e.tv=t,e.viewer=n,d=yield r(e,u)}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"),d)return d}))}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 o=n.rowCount<20?Math.floor(n.rowCount/2):10;n.rows.select((t=>t.idx>=0&&t.idx<o)),e&&(yield B(50));for(let t=o;t<2*o;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 c(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 u(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 d(t,e=!0){return s(this,void 0,void 0,(function*(){I(JSON.stringify(t.viewer.getOptions().look),JSON.stringify(t.savedProps))}))}var h=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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 x;var T;!function(t){t.notNull=function(t,e){if(null==t)throw new Error(`${null==e?"Value":e} not defined`)}}(T||(T={}));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 o;this.category=t,this.name=e,null!=i||(i={}),null!==(o=i.timeout)&&void 0!==o||(i.timeout=f),this.options=i,this.test=()=>h(this,void 0,void 0,(function*(){return new Promise(((t,e)=>h(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,o="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((r,s)=>{const a=t.subscribe((t=>{try{e(t),r("OK")}catch(t){s(t)}finally{a.unsubscribe(),clearTimeout(l)}})),l=setTimeout((()=>{a.unsubscribe(),s(o)}),i);n()}))}))}function O(t,e,n,i=0,o="timeout"){return h(this,void 0,void 0,(function*(){return new Promise(((r,s)=>{const a=t.subscribe((t=>{e(t).then((()=>{r("OK")})).catch((t=>{s(t)})).finally((()=>{a.unsubscribe(),clearTimeout(l)}))})),l=setTimeout((()=>{a.unsubscribe(),s(o)}),i);n()}))}))}function L(t,e,n){null==C[x]&&(C[x]={}),null==C[x].tests&&(C[x].tests=[]),C[x].tests.push(new N(x,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 o=Math.abs(t-e)<n;if(I(o,!0,`${null!=i?i:""} (tolerance = ${n})`),!o)throw new Error(`Expected ${e}, got ${t} (tolerance = ${n})`)}function P(t,e,n){var i;x=t,e(),C[x]&&(C[x].clear=null===(i=null==n?void 0:n.clear)||void 0===i||i,C[x].timeout=null==n?void 0:n.timeout,C[x].benchmarks=null==n?void 0:n.benchmarks,C[x].stressTests=null==n?void 0:n.stressTests,C[x].owner=null==n?void 0:n.owner)}function k(t){null==C[x]&&(C[x]={}),C[x].before=t}function G(t){null==C[x]&&(C[x]={}),C[x].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,c,u,d;return h(this,void 0,void 0,(function*(){const m=t.id;if(S[m])return;const g=e?e.tests:C;if(void 0!==g[w]||void 0!==g[b]||Object.keys(g).find((t=>t.startsWith(w)||t.startsWith(E))))return void(S[m]=!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,o=e.length?E+": "+e.join(": "):E,r=i.split(" | ");i=r[r.length-1],r.unshift(o),r.pop(),o=r.join(": "),void 0===g[o]&&(g[o]={tests:[],clear:!0}),g[o].tests.push(new N(o,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,owner:null===(c=t.options)||void 0===c?void 0:c.owner}))}const v=[],y=[],x=[],T=yield i.dapi.functions.filter(`package.id = "${m}"`).list(),_=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of T){const n=e.options.test,s=e.options.demoPath;if(n&&Array.isArray(n)&&n.length)for(let t=0;t<n.length;t++){const r=n[t].matchAll(_),s={};Array.from(r).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===n.length?e.name:`${e.name} ${t+1}`,(()=>h(this,void 0,void 0,(function*(){const o=yield i.functions.eval(D(n[t],e));if(s.wait&&(yield B(s.wait)),"boolean"==typeof o&&!o)throw`Failed: ${n[t]}, expected true, got ${o}`}))),{skipReason:s.skip,timeout:o.Test.isInBenchmark?null!==(u=s.benchmarkTimeout)&&void 0!==u?u:p:null!==(d=s.timeout)&&void 0!==d?d:f});if(s.cat){const t=w+": "+s.cat;a.category=t,void 0===g[t]&&(g[t]={tests:[],clear:!0}),g[t].tests.push(a)}else v.push(a)}if(s){const t=e.options.demoWait?parseInt(e.options.demoWait):void 0,n=new N(b,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){i.shell.isInDemo=!0,void 0===i.shell.view(o.View.BROWSE)&&(i.shell.v=o.View.createByType(o.View.BROWSE)),yield B(300),i.shell.clearLastError(),yield e.apply(),yield B(t||2e3);const n=yield i.shell.lastError;if(n)throw new Error(n);i.shell.isInDemo=!1}))),{skipReason:e.options.demoSkip});y.push(n)}if(e.hasTag("semTypeDetector")){let n=r;e.options.testData&&(n=yield i.data.files.openTable(`System:AppData/${t.nqName}/${e.options.testData}`));const o=new N(A,e.friendlyName,(()=>h(this,void 0,void 0,(function*(){const i=[];console.log(`System:AppData/${t.nqName}/${e.options.testData}`);for(const t of n.clone().columns){const n=yield e.apply([t]);i.push(n||t.semType)}const o=i.filter((t=>t));I(o.length,1),e.options.testDataColumnName&&I(o[0],e.options.testDataColumnName)}))),{skipReason:e.options.skipTest});x.push(o)}}S[m]=!0,v.length>0&&(g[w]={tests:v,clear:!0}),y.length>0&&(g[b]={tests:y,clear:!0}),x.length>0&&(g[A]={tests:x,clear:!1})}))}function V(t){var e,n,r,s;return h(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!==(r=(s=t).testContext)&&void 0!==r||(s.testContext=new _),i.shell.clearLastError();const c=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}();yield function(t,e){var n,r,s,d,C,w,b,A,E,S,x,T,_,N,M,O,L,I,R,P;return h(this,void 0,void 0,(function*(){try{for(const[h,g]of Object.entries(t)){if((null==e?void 0:e.category)&&!h.toLowerCase().startsWith(null==e?void 0:e.category.toLowerCase())||(null===(n=e.exclude)||void 0===n?void 0:n.some((t=>h.startsWith(t)))))continue;m(`Started ${h} category`);const t=null===(r=g.tests)||void 0===r?void 0:r.every((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.skipReason}));t||(g.beforeStatus=yield u(g.before,null!==(s=e.category)&&void 0!==s?s:""));let v=null!==(d=g.tests)&&void 0!==d?d:[];e.stressTest&&(v=v.filter((t=>{var e;return null===(e=t.options)||void 0===e?void 0:e.stressTest})),v=q(v)),(null!==(w=null===(C=e.tags)||void 0===C?void 0:C.length)&&void 0!==w?w:0)>0&&(v=v.filter((t=>{var n,i;return null===(i=null===(n=t.options)||void 0===n?void 0:n.tags)||void 0===i?void 0:i.some((t=>{var n;return(null!==(n=null==e?void 0:e.tags)&&void 0!==n?n:[]).includes(t)}))})));const y=[];if(g.clear)for(let t=0;t<v.length;t++){v[t].options&&void 0===(null===(b=v[t].options)||void 0===b?void 0:b.benchmark)&&(v[t].options||(v[t].options={}),v[t].options.benchmark=null!==(A=g.benchmarks)&&void 0!==A&&A);let n=v[t];(null==n?void 0:n.options)&&(n.options.owner=null!==(S=null===(E=v[t].options)||void 0===E?void 0:E.owner)&&void 0!==S?S:null==g?void 0:g.owner);let r=yield H(n,null==e?void 0:e.test,c,o.Test.isInBenchmark?null!==(T=null===(x=v[t].options)||void 0===x?void 0:x.benchmarkTimeout)&&void 0!==T?T:p:null!==(N=null===(_=v[t].options)||void 0===_?void 0:_.timeout)&&void 0!==N?N:f,a.name,e.verbose);r&&y.push(r),i.shell.closeAll(),o.Balloon.closeAll()}else for(let t=0;t<v.length;t++){let n=v[t];(null==n?void 0:n.options)&&(n.options.owner=null!==(O=null===(M=v[t].options)||void 0===M?void 0:M.owner)&&void 0!==O?O:null==g?void 0:g.owner);let i=yield H(n,null==e?void 0:e.test,c,o.Test.isInBenchmark?null!==(I=null===(L=v[t].options)||void 0===L?void 0:L.benchmarkTimeout)&&void 0!==I?I:p:null===(R=v[t].options)||void 0===R?void 0:R.timeout,a.name,e.verbose);i&&y.push(i)}const k=y.filter((t=>"skipped"!=t.result));t||(g.afterStatus=yield u(g.after,null!==(P=e.category)&&void 0!==P?P:"")),g.afterStatus&&k.push({date:(new Date).toISOString(),logs:"",category:h,name:"after",result:g.afterStatus,success:!1,ms:0,skipped:!1}),g.beforeStatus&&k.push({date:(new Date).toISOString(),logs:"",category:h,name:"before",result:g.beforeStatus,success:!1,ms:0,skipped:!1}),l.push(...k)}}finally{console.log=m,console.info=g,console.warn=v,console.error=y}if(e.testContext.catchUnhandled&&!o.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 u(t,e){return h(this,void 0,void 0,(function*(){var n=void 0;try{void 0!==t&&(yield $((()=>h(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 h(this,void 0,void 0,(function*(){return`${t.toString()}\n${t.stack?yield o.Logger.translateStackTrace(t.stack):""}`}))}function H(t,e,n,r,s,a){var l,c,u,d,p,g,v,C;return h(this,void 0,void 0,(function*(){let h;n.length=0;let w="package";const b=null!=e&&t.name.toLowerCase()!==e.toLowerCase();let A=(null===(l=t.options)||void 0===l?void 0:l.skipReason)||b,E=b?"skipped":null===(c=t.options)||void 0===c?void 0:c.skipReason;if(o.Test.isInBenchmark&&!(null===(u=t.options)||void 0===u?void 0:u.benchmark))return void m(`SKIPPED: ${t.category} ${t.name} doesnt available in benchmark mode`);A||m(`Started ${t.category} ${t.name}`);const S=Date.now();try{if(A)h={date:(new Date).toISOString(),success:!0,result:E,ms:0,skipped:!0};else{let e=null!=r?r:f;h={date:(new Date).toISOString(),success:!0,result:null!==(d=yield $(t.test,e))&&void 0!==d?d:"OK",ms:0,skipped:!1}}}catch(t){y(t),h={date:(new Date).toISOString(),success:!1,result:yield F(t),ms:0,skipped:!1}}if((null===(p=t.options)||void 0===p?void 0:p.isAggregated)&&h.result.constructor===o.DataFrame){const t=h.result.col("success");if(t&&(h.success=t.stats.sum===t.length),!a){const t=h.result;t.columns.remove("stack"),t.rows.removeWhere((t=>t.get("success"))),h.result=t}h.result=h.result.toCsv()}if(h.logs=n.join("\n"),h.ms=Date.now()-S,A||m(`Finished ${t.category} ${t.name} for ${h.ms} ms`),h.category=t.category,h.name=t.name,h.owner=null!==(v=null===(g=t.options)||void 0===g?void 0:g.owner)&&void 0!==v?v:"",!b){let e={success:h.success,result:h.result,ms:h.ms,skipped:h.skipped,package:s,category:t.category,name:t.name,logs:h.logs,owner:h.owner};if(h.result.constructor==Object){const t=Object.keys(h.result).reduce(((t,e)=>Object.assign(Object.assign({},t),{["result."+e]:h.result[e]})),{});e=Object.assign(Object.assign({},e),t)}e.result instanceof o.DataFrame&&(e.result=JSON.stringify(null===(C=e.result)||void 0===C?void 0:C.toJson())||""),null!=i.shell.reportTest?yield i.shell.reportTest(w,e):yield fetch(`${i.dapi.root}/log/tests/${w}`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify(e)})}return h}))}function q(t){const e=t.slice();return e.sort((()=>Math.random()-.5)),e}function B(t){return h(this,void 0,void 0,(function*(){yield new Promise((e=>setTimeout(e,t)))}))}function Y(t,e="Timeout exceeded",n=500,i=50){return h(this,void 0,void 0,(function*(){return new Promise(((o,r)=>{setTimeout((()=>{clearInterval(s),r(new Error(e))}),n);const s=setInterval((()=>{t()&&(clearInterval(s),o())}),i)}))}))}function $(t,e,n="EXECUTION TIMEOUT"){return h(this,void 0,void 0,(function*(){let i=null;const o=new Promise(((t,o)=>{i=setTimeout((()=>{o(n)}),e)}));try{return yield Promise.race([t(),o])}finally{i&&clearTimeout(i)}}))}const j=o.DataFrame.fromColumns([o.Column.fromStrings("col",["val1","val2","val3"])]);function W(t,e,n){var o;return h(this,void 0,void 0,(function*(){const r=null!==(o=null==n?void 0:n.packageName)&&void 0!==o?o:"";(null==n?void 0:n.detectSemanticTypes)&&(yield i.data.detectSemanticTypes(e));const s=i.shell.addTableView(e);try{yield a(s,t,r,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,void 0,n.awaitViewer)),(null==n?void 0:n.readOnly)||(yield a(s,t,r,i.events.onViewerAdded,l),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,l,n.awaitViewer)));let e=null;e=yield a(s,t,r,i.events.onViewerAdded,u),(null==n?void 0:n.awaitViewer)&&(e=yield a(s,t,r,i.events.onViewerAdded,u,n.awaitViewer)),yield a(s,t,r,i.events.onViewLayoutApplied,d,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,r,i.events.onViewLayoutApplied,d,n.awaitViewer,null==e?void 0:e.layout,{savedProps:null==e?void 0:e.savedProps})),!1!==(null==n?void 0:n.arbitraryDfTest)&&(s.dataFrame=j,yield B(50),yield a(s,t,r,i.events.onViewerAdded),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,void 0,n.awaitViewer))),yield a(s,t,r,i.events.onViewerAdded,c),(null==n?void 0:n.awaitViewer)&&(yield a(s,t,r,i.events.onViewerAdded,c,n.awaitViewer))}finally{}}))}},7233:t=>{!function(){"use strict";var e=document,n=window,i=e.documentElement,o=e.createElement.bind(e),r=o("div"),s=o("table"),a=o("tbody"),l=o("tr"),c=Array.isArray,u=Array.prototype,d=u.concat,h=u.filter,f=u.indexOf,p=u.map,m=u.push,g=u.slice,v=u.some,y=u.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 o=t;if(I(t)){var r=i||e;if(!(o=C.test(t)&&M(r)?r.getElementById(t.slice(1).replace(/\\/g,"")):b.test(t)?Z(t):_(r)?r.find(t):I(r)?T(r).find(t):E(t,r)))return}else if(L(t))return this.ready(t);(o.nodeType||o===n)&&(o=[o]),this.length=o.length;for(var s=0,a=this.length;s<a;s++)this[s]=o[s]}}return t.prototype.init=function(e,n){return new t(e,n)},t}(),x=S.prototype,T=x.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 o=Object.keys(t),r=(i=0,o.length);i<r;i++){var s=o[i];if(!1===e.call(t[s],s,t[s]))return t}else for(i=0,r=t.length;i<r;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(),o=t.length;if(!i)return{};if(!o)return U(n,T,i);for(var r=0;r<o;r++){var s=t[r];for(var a in s)n&&(c(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}T.fn=T.prototype=x,x.length=0,x.splice=y,"function"==typeof Symbol&&(x[Symbol.iterator]=u[Symbol.iterator]),T.isWindow=N,T.isFunction=L,T.isArray=c,T.isNumeric=k,T.isPlainObject=G,T.each=D,x.each=function(t){return D(this,t)},x.empty=function(){return this.each((function(t,e){for(;e.firstChild;)e.removeChild(e.firstChild)}))},T.extend=U,x.extend=function(t){return U(x,t)};var V=/\S+/g;function F(t){return I(t)&&t.match(V)||[]}function H(t,e,i){if(O(t)){var o=n.getComputedStyle(t,null);return i?o.getPropertyValue(e)||void 0:o[e]||t.style[e]}}function q(t,e){return parseInt(H(t,e),10)||0}function B(t,e){return q(t,"border".concat(e?"Left":"Top","Width"))+q(t,"padding".concat(e?"Left":"Top"))+q(t,"padding".concat(e?"Right":"Bottom"))+q(t,"border".concat(e?"Right":"Bottom","Width"))}x.toggleClass=function(t,e){var n=F(t),i=!R(e);return this.each((function(t,o){O(o)&&D(n,(function(t,n){i?e?o.classList.add(n):o.classList.remove(n):o.classList.toggle(n)}))}))},x.addClass=function(t){return this.toggleClass(t,!0)},x.removeAttr=function(t){var e=F(t);return this.each((function(t,n){O(n)&&D(e,(function(t,e){n.removeAttribute(e)}))}))},x.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}},x.removeClass=function(t){return arguments.length?this.toggleClass(t,!1):this.attr("class","")},x.hasClass=function(t){return!!t&&v.call(this,(function(e){return O(e)&&e.classList.contains(t)}))},x.get=function(t){return R(t)?g.call(this):this[(t=Number(t))<0?t+this.length:t]},x.eq=function(t){return T(this.get(t))},x.first=function(){return this.eq(0)},x.last=function(){return this.eq(-1)},x.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}x.filter=function(t){var e=W(t);return T(h.call(this,(function(t,n){return e.call(t,n,t)})))},x.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={"*":r,tr:a,td:l,th:l,thead:s,tbody:s,tfoot:s};function Z(t){if(!I(t))return[];if(Q.test(t))return[o(RegExp.$1)];var e=K.test(t)&&RegExp.$1,n=X[e]||X["*"];return n.innerHTML=t,T(n.childNodes).detach().get()}function J(t,e,n,i){for(var o=[],r=L(e),s=i&&W(i),a=0,l=t.length;a<l;a++)if(r){var c=e(t[a]);c.length&&m.apply(o,c)}else for(var u=t[a][e];!(null==u||i&&s(-1,u));)o.push(u),u=n?u[e]:null;return o}function tt(t){return t.multiple&&t.options?J(h.call(t.options,(function(t){return t.selected&&!t.disabled&&!t.parentNode.disabled})),"value"):t.value||""}function et(t){return t.length>1?h.call(t,(function(t,e,n){return f.call(n,t)===e})):t}T.parseHTML=Z,x.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)},x.not=function(t){var e=W(t);return this.filter((function(n,i){return(!I(t)||O(i))&&!e.call(i,n,i)}))},x.val=function(t){return arguments.length?this.each((function(e,n){var i=n.multiple&&n.options;if(i||It.test(n.type)){var o=c(t)?p.call(t,String):P(t)?[]:[String(t)];i?D(n.options,(function(t,e){e.selected=o.indexOf(e.value)>=0}),!0):n.checked=o.indexOf(n.value)>=0}else n.value=R(t)||P(t)?"":t})):this[0]&&tt(this[0])},x.is=function(t){var e=W(t);return v.call(this,(function(t,n){return e.call(t,n,t)}))},T.guid=1,T.unique=et,x.add=function(t,e){return T(et(this.get().concat(T(t,e).get())))},x.children=function(t){return z(T(et(J(this,(function(t){return t.children})))),t)},x.parent=function(t){return z(T(et(J(this,"parentNode"))),t)},x.index=function(t){var e=t?T(t)[0]:this[0],n=t?this:T(e).parent().children();return f.call(n,e)},x.closest=function(t){var e=this.filter(t);if(e.length)return e;var n=this.parent();return n.length?n.closest(t):e},x.siblings=function(t){return z(T(et(J(this,(function(t){return T(t).parent().children().not(t)})))),t)},x.find=function(t){return T(et(J(this,(function(e){return E(t,e)}))))};var nt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,it=/^$|^module$|\/(java|ecma)script/i,ot=["type","src","nonce","noModule"];function rt(t,e,n,r,s,a,l,c){return D(t,(function(t,a){D(T(a),(function(t,a){D(T(e),(function(e,l){var c=n?l:a,u=n?t:e;!function(t,e,n,r,s){r?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=T(t);n.filter("script").add(n.find("script")).each((function(t,n){if(it.test(n.type)&&i.contains(n)){var r=o("script");r.text=n.textContent.replace(nt,""),D(ot,(function(t,e){n[e]&&(r[e]=n[e])})),e.head.insertBefore(r,null),e.head.removeChild(r)}}))}(e,t.ownerDocument)}(n?a:l,u?c.cloneNode(!0):c,r,s,!u)}),c)}),l)}),a),e}x.after=function(){return rt(arguments,this,!1,!1,!1,!0,!0)},x.append=function(){return rt(arguments,this,!1,!1,!0)},x.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?T(i).empty().append(t):i.innerHTML=t)}))},x.appendTo=function(t){return rt(arguments,this,!0,!1,!0)},x.wrapInner=function(t){return this.each((function(e,n){var i=T(n),o=i.contents();o.length?o.wrapAll(t):i.append(t)}))},x.before=function(){return rt(arguments,this,!1,!0)},x.wrapAll=function(t){for(var e=T(t),n=e[0];n.children.length;)n=n.firstElementChild;return this.first().before(e),this.appendTo(n)},x.wrap=function(t){return this.each((function(e,n){var i=T(t)[0];T(n).wrapAll(e?i.cloneNode(!0):i)}))},x.insertAfter=function(t){return rt(arguments,this,!0,!1,!1,!1,!1,!0)},x.insertBefore=function(t){return rt(arguments,this,!0,!0)},x.prepend=function(){return rt(arguments,this,!1,!0,!0,!0,!0)},x.prependTo=function(t){return rt(arguments,this,!0,!0,!0,!1,!1,!0)},x.contents=function(){return T(et(J(this,(function(t){return"IFRAME"===t.tagName?[t.contentDocument]:"TEMPLATE"===t.tagName?t.content.childNodes:t.childNodes}))))},x.next=function(t,e,n){return z(T(et(J(this,"nextElementSibling",e,n))),t)},x.nextAll=function(t){return this.next(t,!0)},x.nextUntil=function(t,e){return this.next(e,!0,t)},x.parents=function(t,e){return z(T(et(J(this,"parentElement",!0,e))),t)},x.parentsUntil=function(t,e){return this.parents(e,t)},x.prev=function(t,e,n){return z(T(et(J(this,"previousElementSibling",e,n))),t)},x.prevAll=function(t){return this.prev(t,!0)},x.prevUntil=function(t,e){return this.prev(e,!0,t)},x.map=function(t){return T(d.apply([],p.call(this,(function(e,n){return t.call(e,n,e)}))))},x.clone=function(){return this.map((function(t,e){return e.cloneNode(!0)}))},x.offsetParent=function(){return this.map((function(t,e){for(var n=e.offsetParent;n&&"static"===H(n,"position");)n=n.offsetParent;return n||i}))},x.slice=function(t,e){return T(g.call(this,t,e))};var st=/-([a-z])/g;function at(t){return t.replace(st,(function(t,e){return e.toUpperCase()}))}x.ready=function(t){var n=function(){return setTimeout(t,0,T)};return"loading"!==e.readyState?n():e.addEventListener("DOMContentLoaded",n),this},x.unwrap=function(){return this.parent().each((function(t,e){if("BODY"!==e.tagName){var n=T(e);n.replaceWith(n.children())}})),this},x.offset=function(){var t=this[0];if(t){var e=t.getBoundingClientRect();return{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}}},x.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,o=t.offsetParent||i.documentElement;(o===i.body||o===i.documentElement)&&"static"===H(o,"position");)o=o.parentNode;if(o!==t&&O(o)){var r=T(o).offset();n.top-=r.top+q(o,"borderTopWidth"),n.left-=r.left+q(o,"borderLeftWidth")}}return{top:n.top-q(t,"marginTop"),left:n.left-q(t,"marginLeft")}}};var lt={class:"className",contenteditable:"contentEditable",for:"htmlFor",readonly:"readOnly",maxlength:"maxLength",tabindex:"tabIndex",colspan:"colSpan",rowspan:"rowSpan",usemap:"useMap"};x.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}},x.removeProp=function(t){return this.each((function(e,n){delete n[lt[t]||t]}))};var ct=/^--/;function ut(t){return ct.test(t)}var dt={},ht=r.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=ut(t)),n||pt[t]||!k(e)?e:"".concat(e,"px")}function gt(t,e){try{return t(e)}catch(t){return e}}x.css=function(t,e){if(I(t)){var n=ut(t);return t=function(t,e){if(void 0===e&&(e=ut(t)),e)return t;if(!dt[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 ht)return dt[t]=n,!1}))}return dt[t]}(t,n),arguments.length<2?this[0]&&H(this[0],t,n):t?(e=mt(t,e,n),this.each((function(i,o){O(o)&&(n?o.style.setProperty(t,e):o.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)])}x.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);x[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?q(this[0],"margin".concat(t?"Top":"Left"))+q(this[0],"margin".concat(t?"Bottom":"Right")):0)}}))})),D(["Width","Height"],(function(t,e){var n=e.toLowerCase();x[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]-B(this[0],!t);var o=parseInt(i,10);return this.each((function(e,i){if(O(i)){var r=H(i,"boxSizing");i.style[n]=mt(n,o+("border-box"===r?B(i,!t):0))}}))}}));var wt="___cd";x.toggle=function(t){return this.each((function(n,i){if(O(i)){var r=$(i);(R(t)?r:t)?(i.style.display=i[wt]||"",$(i)&&(i.style.display=function(t){if(Y[t])return Y[t];var n=o(t);e.body.insertBefore(n,null);var i=H(n,"display");return e.body.removeChild(n),Y[t]="none"!==i?i:"block"}(i.tagName))):r||(i[wt]=H(i,"display"),i.style.display="none")}}))},x.hide=function(){return this.toggle(!1)},x.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 xt(t){return Et[t]||At[t]||t}function Tt(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,o){var r=_t(t);if(e)r[e]&&(r[e]=r[e].filter((function(r){var s=r[0],a=r[1],l=r[2];if(o&&l.guid!==o.guid||!Nt(s,n)||i&&i!==a)return!0;t.removeEventListener(e,l)})));else for(e in r)Mt(t,e,n,i,o)}x.trigger=function(t,n){if(I(t)){var i=Tt(t),o=i[0],r=i[1],s=xt(o);if(!s)return this;var a=St.test(s)?"MouseEvents":"HTMLEvents";(t=e.createEvent(a)).initEvent(s,!0,!0),t.namespace=r.join("."),t.___ot=o}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)}))},x.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,o){var r=Tt(o),s=r[0],a=r[1],l=xt(s);i.each((function(t,i){(O(i)||M(i)||N(i))&&Mt(i,l,a,e,n)}))}));else for(var o in t)this.off(o,t[o]);return this},x.remove=function(t){return z(this,t).detach().off(),this},x.replaceWith=function(t){return this.before(t).remove()},x.replaceAll=function(t){return T(t).replaceWith(this),this},x.on=function(t,e,n,i,o){var r=this;if(!I(t)){for(var s in t)this.on(s,e,n,t[s],o);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=Tt(s),l=a[0],c=a[1],u=xt(l),d=l in Et,h=l in At;u&&r.each((function(t,r){if(O(r)||M(r)||N(r)){var s=function(t){if(t.target["___i".concat(t.type)])return t.stopImmediatePropagation();if((!t.namespace||Nt(c,t.namespace.split(".")))&&(e||!(h&&(t.target!==r||t.___ot===u)||d&&t.relatedTarget&&r.contains(t.relatedTarget)))){var a=r;if(e){for(var l=t.target;!j(l,e);){if(l===r)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 r}}),Object.defineProperty(t,"data",{configurable:!0,get:function(){return n}});var f=i.call(a,t,t.___td);o&&Mt(r,u,c,e,s),!1===f&&(t.preventDefault(),t.stopPropagation())}};s.guid=i.guid=i.guid||T.guid++,function(t,e,n,i,o){var r=_t(t);r[e]=r[e]||[],r[e].push([n,i,o]),t.addEventListener(e,o)}(r,u,c,e,s)}}))})),this):this},x.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;x.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(c(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=T}()},6677:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(1354),o=n.n(i),r=n(6314),s=n.n(r)()(o());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),o=n.n(i),r=n(6314),s=n.n(r)()(o());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,o,r){"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 c=0;c<t.length;c++){var u=[].concat(t[c]);i&&s[u[0]]||(void 0!==r&&(void 0===u[5]||(u[1]="@layer".concat(u[5].length>0?" ".concat(u[5]):""," {").concat(u[1],"}")),u[5]=r),n&&(u[2]?(u[1]="@media ".concat(u[2]," {").concat(u[1],"}"),u[2]=n):u[2]=n),o&&(u[4]?(u[1]="@supports (".concat(u[4],") {").concat(u[1],"}"),u[4]=o):u[4]="".concat(o)),e.push(u))}},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)))),o="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),r="/*# ".concat(o," */");return[e].concat([r]).join("\n")}return[e].join("\n")}},9982:function(t,e,n){var i;!function(e,o){var r={};!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,o,r){for(var s,a,l,c,u,d,h,f,p,m,g,v,y;r>=64;){for(s=n[0],a=n[1],l=n[2],c=n[3],u=n[4],d=n[5],h=n[6],f=n[7],m=0;m<16;m++)g=o+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=(((u>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+(u&d^~u&h)|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=h,h=d,d=u,u=c+v|0,c=l,l=a,a=s,s=v+y|0;n[0]+=s,n[1]+=a,n[2]+=l,n[3]+=c,n[4]+=u,n[5]+=d,n[6]+=h,n[7]+=f,o+=64,r-=64}return o}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,o=e/536870912|0,r=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]=o>>>24&255,this.buffer[s-7]=o>>>16&255,this.buffer[s-6]=o>>>8&255,this.buffer[s-5]=o>>>0&255,this.buffer[s-4]=r>>>24&255,this.buffer[s-3]=r>>>16&255,this.buffer[s-2]=r>>>8&255,this.buffer[s-1]=r>>>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 o=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 r(t){var e=(new i).update(t),n=e.digest();return e.clean(),n}function s(t,e){var n=new o(t).update(e),i=n.digest();return n.clean(),i}function a(t,e,n,i){var o=i[0];if(0===o)throw new Error("hkdf: cannot expand more");e.reset(),o>1&&e.update(t),n&&e.update(n),e.update(i),e.finish(t),i[0]++}t.HMAC=o,t.hash=r,t.default=r,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 r=new Uint8Array([1]),c=s(e,t),u=new o(c),d=new Uint8Array(u.digestLength),h=d.length,f=new Uint8Array(i),p=0;p<i;p++)h===d.length&&(a(d,u,n,r),h=0),f[p]=d[h++];return u.clean(),d.fill(0),r.fill(0),f},t.pbkdf2=function(t,e,n,i){for(var r=new o(t),s=r.digestLength,a=new Uint8Array(4),l=new Uint8Array(s),c=new Uint8Array(s),u=new Uint8Array(i),d=0;d*s<i;d++){var h=d+1;a[0]=h>>>24&255,a[1]=h>>>16&255,a[2]=h>>>8&255,a[3]=h>>>0&255,r.reset(),r.update(e),r.update(a),r.finish(c);for(var f=0;f<s;f++)l[f]=c[f];for(f=2;f<=n;f++){r.reset(),r.update(c).finish(c);for(var p=0;p<s;p++)l[p]^=c[p]}for(f=0;f<s&&d*s+f<i;f++)u[d*s+f]=l[f]}for(d=0;d<s;d++)l[d]=c[d]=0;for(d=0;d<4;d++)a[d]=0;return r.clean(),u}}(r);var s=r.default;for(var a in r)s[a]=r[a];"object"==typeof t.exports?t.exports=s:void 0===(i=function(){return s}.call(r,n,r,t))||(t.exports=i)}()},2787:(t,e,n)=>{"use strict";n.d(e,{I:()=>o});const i=new Uint32Array(65536),o=(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,o=e.length,r=1<<n-1;let s=-1,a=0,l=n,c=n;for(;c--;)i[t.charCodeAt(c)]|=1<<c;for(c=0;c<o;c++){let t=i[e.charCodeAt(c)];const n=t|a;t|=(t&s)+s^s,a|=~(t|s),s&=t,a&r&&l++,s&r&&l--,a=a<<1|1,s=s<<1|~(n|a),a&=n}for(c=n;c--;)i[t.charCodeAt(c)]=0;return l})(t,e):((t,e)=>{const n=e.length,o=t.length,r=[],s=[],a=Math.ceil(n/32),l=Math.ceil(o/32);for(let t=0;t<a;t++)s[t]=-1,r[t]=0;let c=0;for(;c<l-1;c++){let a=0,l=-1;const u=32*c,d=Math.min(32,o)+u;for(let e=u;e<d;e++)i[t.charCodeAt(e)]|=1<<e;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],o=s[t/32|0]>>>t&1,c=r[t/32|0]>>>t&1,u=n|a,d=((n|c)&l)+l^l|n|c;let h=a|~(d|l),f=l&d;h>>>31^o&&(s[t/32|0]^=1<<t),f>>>31^c&&(r[t/32|0]^=1<<t),h=h<<1|o,f=f<<1|c,l=f|~(u|h),a=h&u}for(let e=u;e<d;e++)i[t.charCodeAt(e)]=0}let u=0,d=-1;const h=32*c,f=Math.min(32,o-h)+h;for(let e=h;e<f;e++)i[t.charCodeAt(e)]|=1<<e;let p=o;for(let t=0;t<n;t++){const n=i[e.charCodeAt(t)],a=s[t/32|0]>>>t&1,l=r[t/32|0]>>>t&1,c=n|u,h=((n|l)&d)+d^d|n|l;let f=u|~(h|d),m=d&h;p+=f>>>o-1&1,p-=m>>>o-1&1,f>>>31^a&&(s[t/32|0]^=1<<t),m>>>31^l&&(r[t/32|0]^=1<<t),f=f<<1|a,m=m<<1|l,d=m|~(c|f),u=f&c}for(let e=h;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,o=Array.prototype.slice.call(arguments).slice(1);for(e=0,i=o.length;e<i;e++)if(o[e])for(n in o[e])t[n]=o[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,o=t.size,r={},s=new Float32Array(10*i),a=new Float32Array(3*o);return n=0,t.forEachNode((function(t,e){r[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,o,l,c,u,d){var h=r[o],f=r[l],p=e(t,i,o,l,c,u,d);s[h+6]+=p,s[f+6]+=p,a[n]=h,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,o){return o.x=e[i],o.y=e[i+1],i+=10,n?n(t,o):o}))},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(),o={},r=0,s=0,a=e.length;r<a;r+=10){if(n){var l=Object.assign({},t.getNodeAttributes(i[s]));l.x=e[r],l.y=e[r+1],l=n(i[s],l),o[i[s]]={x:l.x,y:l.y}}else o[i[s]]={x:e[r],y:e[r+1]};s++}return o},e.createWorker=function(t){var e=window.URL||window.webkitURL,n=t.toString(),i=e.createObjectURL(new Blob(["("+n+").call(this);"],{type:"text/javascript"})),o=new Worker(i);return e.revokeObjectURL(i),o}},8903:(t,e,n)=>{var i=n(1736),o=n(8153).Fd,r=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 c=o("getEdgeWeight"in n?n.getEdgeWeight:"weight").fromEntry,u="function"==typeof n.outputReducer?n.outputReducer:null,d=s.assign({},a,n.settings),h=s.validateSettings(d);if(h)throw new Error("graphology-layout-forceatlas2: "+h.message);var f,p=s.graphToByteArrays(e,c);for(f=0;f<l;f++)r(d,p.nodes,p.edges);if(!t)return s.collectLayoutChanges(e,p.nodes);s.assignLayoutChanges(e,p.nodes,u)}var c=l.bind(null,!1);c.assign=l.bind(null,!0),c.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=c},2561:t=>{var e=10;t.exports=function(t,n,i){var o,r,s,a,l,c,u,d,h,f,p,m,g,v,y,C,w,b,A,E,S,x,T,_=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,o=1,s=0;s<_;s+=e)for(r=0,P=3;;){if(!(L[r+5]>=0)){if(L[r+0]<0){L[r+0]=s;break}if(L[r+5]=9*o,d=L[r+3]/2,L[(h=L[r+5])+0]=-1,L[h+1]=L[r+1]-d,L[h+2]=L[r+2]-d,L[h+3]=d,L[h+4]=h+9,L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+8]=0,L[(h+=9)+0]=-1,L[h+1]=L[r+1]-d,L[h+2]=L[r+2]+d,L[h+3]=d,L[h+4]=h+9,L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+8]=0,L[(h+=9)+0]=-1,L[h+1]=L[r+1]+d,L[h+2]=L[r+2]-d,L[h+3]=d,L[h+4]=h+9,L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+8]=0,L[(h+=9)+0]=-1,L[h+1]=L[r+1]+d,L[h+2]=L[r+2]+d,L[h+3]=d,L[h+4]=L[r+4],L[h+5]=-1,L[h+6]=0,L[h+7]=0,L[h+8]=0,o+=4,I=n[L[r+0]+0]<L[r+1]?n[L[r+0]+1]<L[r+2]?L[r+5]:L[r+5]+9:n[L[r+0]+1]<L[r+2]?L[r+5]+18:L[r+5]+27,L[r+6]=n[L[r+0]+6],L[r+7]=n[L[r+0]+0],L[r+8]=n[L[r+0]+1],L[I+0]=L[r+0],L[r+0]=-1,I===(R=n[s+0]<L[r+1]?n[s+1]<L[r+2]?L[r+5]:L[r+5]+9:n[s+1]<L[r+2]?L[r+5]+18:L[r+5]+27)){if(P--){r=I;continue}P=3;break}L[R+0]=s;break}I=n[s+0]<L[r+1]?n[s+1]<L[r+2]?L[r+5]:L[r+5]+9:n[s+1]<L[r+2]?L[r+5]+18:L[r+5]+27,L[r+7]=(L[r+7]*L[r+6]+n[s+0]*n[s+6])/(L[r+6]+n[s+6]),L[r+8]=(L[r+8]*L[r+6]+n[s+1]*n[s+6])/(L[r+6]+n[s+6]),L[r+6]+=n[s+6],r=I}}if(t.barnesHutOptimize){for(m=t.scalingRatio,s=0;s<_;s+=e)for(r=0;;)if(L[r+5]>=0){if(C=Math.pow(n[s+0]-L[r+7],2)+Math.pow(n[s+1]-L[r+8],2),4*(f=L[r+3])*f/C<O){if(g=n[s+0]-L[r+7],v=n[s+1]-L[r+8],!0===M?C>0?(w=m*n[s+6]*L[r+6]/C,n[s+2]+=g*w,n[s+3]+=v*w):C<0&&(w=-m*n[s+6]*L[r+6]/Math.sqrt(C),n[s+2]+=g*w,n[s+3]+=v*w):C>0&&(w=m*n[s+6]*L[r+6]/C,n[s+2]+=g*w,n[s+3]+=v*w),(r=L[r+4])<0)break;continue}r=L[r+5]}else if((c=L[r+0])>=0&&c!==s&&(C=(g=n[s+0]-n[c+0])*g+(v=n[s+1]-n[c+1])*v,!0===M?C>0?(w=m*n[s+6]*n[c+6]/C,n[s+2]+=g*w,n[s+3]+=v*w):C<0&&(w=-m*n[s+6]*n[c+6]/Math.sqrt(C),n[s+2]+=g*w,n[s+3]+=v*w):C>0&&(w=m*n[s+6]*n[c+6]/C,n[s+2]+=g*w,n[s+3]+=v*w)),(r=L[r+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(h=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]*h):C>0&&(w=m*n[s+6]*h/C),n[s+2]-=g*w,n[s+3]-=v*w;for(m=1*(t.outboundAttractionDistribution?p:1),u=0;u<N;u+=3)a=i[u+0],l=i[u+1],d=i[u+2],y=Math.pow(d,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)),x=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=x,T=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=T);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)))),x=n[s+0]+n[s+2]*(S/t.slowDown),n[s+0]=x,T=n[s+1]+n[s+3]*(S/t.slowDown),n[s+1]=T);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 o=function(e){return i(e[t])},r=function(){return i(void 0)};return"string"==typeof t?(n.fromAttributes=o,n.fromGraph=function(t,e){return o(t.getEdgeAttributes(e))},n.fromEntry=function(t,e){return o(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 o=e.extremities(n);return i(t(n,e.getEdgeAttributes(n),o[0],o[1],e.getNodeAttributes(o[0]),e.getNodeAttributes(o[1]),e.isUndirected(n)))},n.fromEntry=function(e,n,o,r,s,a,l){return i(t(e,n,o,r,s,a,l))},n.fromPartialEntry=function(e,n,o,r){return i(t(e,n,o,r))},n.fromMinimalEntry=function(e,n){return i(t(e,n))}):(n.fromAttributes=r,n.fromGraph=r,n.fromEntry=r,n.fromMinimalEntry=r),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 o(t,e,n){return o=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 o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&i(r,n.prototype),r},o.apply(null,arguments)}function r(t){var e="function"==typeof Map?new Map:void 0;return r=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;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 o(t,arguments,n(this).constructor)}return s.prototype=Object.create(t.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),i(s,t)},r(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 o=t._nodes.get(e),r=null;return o?r="mixed"===i?o.out&&o.out[n]||o.undirected&&o.undirected[n]:"directed"===i?o.out&&o.out[n]:o.undirected&&o.undirected[n]:r}function c(e){return"object"===t(e)&&null!==e}function u(t){var e;for(e in t)return!1;return!0}function d(t,e,n){Object.defineProperty(t,e,{enumerable:!1,configurable:!1,writable:!0,value:n})}function h(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!(!c(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 o(n){t.removeListener(e,r),i(n)}function r(){"function"==typeof t.removeListener&&t.removeListener("error",o),n([].slice.call(arguments))}M(t,e,r,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&M(t,"error",e,{once:!0})}(t,o)}))},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 o,r,s,a;if(b(n),void 0===(r=t._events)?(r=t._events=Object.create(null),t._eventsCount=0):(void 0!==r.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),r=t._events),s=r[e]),void 0===s)s=r[e]=n,++t._eventsCount;else if("function"==typeof s?s=r[e]=i?[n,s]:[s,n]:i?s.unshift(n):s.push(n),(o=A(t))>0&&s.length>o&&!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 x(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},o=S.bind(i);return o.listener=n,i.wrapFn=o,o}function T(t,e,n){var i=t._events;if(void 0===i)return[];var o=i[e];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]: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}(o):N(o,o.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 o(r){i.once&&t.removeEventListener(e,o),n(r)}))}}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,o=this._events;if(void 0!==o)i=i&&void 0===o.error;else if(!i)return!1;if(i){var r;if(e.length>0&&(r=e[0]),r instanceof Error)throw r;var s=new Error("Unhandled error."+(r?" ("+r.message+")":""));throw s.context=r,s}var a=o[t];if(void 0===a)return!1;if("function"==typeof a)v(a,this,e);else{var l=a.length,c=N(a,l);for(n=0;n<l;++n)v(c[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,x(this,t,e)),this},C.prototype.prependOnceListener=function(t,e){return b(e),this.prependListener(t,x(this,t,e)),this},C.prototype.removeListener=function(t,e){var n,i,o,r,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(o=-1,r=n.length-1;r>=0;r--)if(n[r]===e||n[r].listener===e){s=n[r].listener,o=r;break}if(o<0)return this;0===o?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,o),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 o,r=Object.keys(n);for(i=0;i<r.length;++i)"removeListener"!==(o=r[i])&&this.removeAllListeners(o);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 T(this,t,!0)},C.prototype.rawListeners=function(t){return T(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,o=i!==1/0?new Array(i):[],r=0,s=U(t);;){if(r===i)return o;if((n=s.next()).done)return r!==e&&(o.length=r),o;o[r++]=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}(r(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),q=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),B=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,o){this.key=e,this.attributes=o,this.undirected=t,this.source=n,this.target=i}function z(t,e,n,i,o,r,s){var a,l,c,u;if(i=""+i,0===n){if(!(a=t._nodes.get(i)))throw new q("Graph.".concat(e,': could not find the "').concat(i,'" node in the graph.'));c=o,u=r}else if(3===n){if(o=""+o,!(l=t._edges.get(o)))throw new q("Graph.".concat(e,': could not find the "').concat(o,'" edge in the graph.'));var d=l.source.key,h=l.target.key;if(i===d)a=l.target;else{if(i!==h)throw new q("Graph.".concat(e,': the "').concat(i,'" node is not attached to the "').concat(o,'" edge (').concat(d,", ").concat(h,")."));a=l.source}c=r,u=s}else{if(!(l=t._edges.get(i)))throw new q("Graph.".concat(e,': could not find the "').concat(i,'" edge in the graph.'));a=1===n?l.source:l.target,c=o,u=r}return[a,c,u]}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 o=this.source[t],r=o[i];if(void 0===r)return o[i]=this,void(this.undirected&&n===i||(this.target[e][n]=this));r.previous=this,this.next=r,o[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,o){var r=z(this,e,n,t,i,o),s=r[0],a=r[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,o){var r=z(this,e,n,t,i,o),s=r[0],a=r[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,o,r){var s=z(this,e,n,t,i,o,r),a=s[0],l=s[1],c=s[2];return a.attributes[l]=c,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,o,r){var s=z(this,e,n,t,i,o,r),a=s[0],l=s[1],c=s[2];if("function"!=typeof c)throw new H("Graph.".concat(e,": updater should be a function."));var u=a.attributes,d=c(u[l]);return u[l]=d,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,o){var r=z(this,e,n,t,i,o),s=r[0],a=r[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,o){var r=z(this,e,n,t,i,o),s=r[0],a=r[1];if(!c(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,o){var r=z(this,e,n,t,i,o),s=r[0],l=r[1];if(!c(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,o){var r=z(this,e,n,t,i,o),s=r[0],a=r[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 o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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,s=""+i;if(i=arguments[2],!(o=l(this,r,s,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return o.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 B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>1){if(this.multi)throw new B("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,r=""+arguments[1];if(!(i=l(this,o,r,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(o,'" - "').concat(r,'").'))}else{if("mixed"!==n)throw new B("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 q("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 o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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,s=""+i;if(i=arguments[2],!(o=l(this,r,s,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return o.attributes.hasOwnProperty(i)}}},{name:function(t){return"set".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,o){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("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],o=arguments[3],!(r=l(this,s,a,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return r.attributes[i]=o,this.emit("edgeAttributesUpdated",{key:r.key,type:"set",attributes:r.attributes,name:i}),this}}},{name:function(t){return"update".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i,o){var r;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>3){if(this.multi)throw new B("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],o=arguments[3],!(r=l(this,s,a,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(s,'" - "').concat(a,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if("function"!=typeof o)throw new H("Graph.".concat(e,": updater should be a function."));return r.attributes[i]=o(r.attributes[i]),this.emit("edgeAttributesUpdated",{key:r.key,type:"set",attributes:r.attributes,name:i}),this}}},{name:function(t){return"remove".concat(t,"Attribute")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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,s=""+i;if(i=arguments[2],!(o=l(this,r,s,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}return delete o.attributes[i],this.emit("edgeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:i}),this}}},{name:function(t){return"replace".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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,s=""+i;if(i=arguments[2],!(o=l(this,r,s,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(i))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return o.attributes=i,this.emit("edgeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}},{name:function(t){return"merge".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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,s=""+i;if(i=arguments[2],!(o=l(this,r,s,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("Graph.".concat(e,': could not find the "').concat(t,'" edge in the graph.'))}if(!c(i))throw new H("Graph.".concat(e,": provided attributes are not a plain object."));return a(o.attributes,i),this.emit("edgeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:i}),this}}},{name:function(t){return"update".concat(t,"Attributes")},attacher:function(t,e,n){t.prototype[e]=function(t,i){var o;if("mixed"!==this.type&&"mixed"!==n&&n!==this.type)throw new B("Graph.".concat(e,": cannot find this type of edges in your ").concat(this.type," graph."));if(arguments.length>2){if(this.multi)throw new B("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,s=""+i;if(i=arguments[2],!(o=l(this,r,s,n)))throw new q("Graph.".concat(e,': could not find an edge for the given path ("').concat(r,'" - "').concat(s,'").'))}else{if("mixed"!==n)throw new B("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 q("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 o.attributes=i(o.attributes),this.emit("edgeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}}],X=L,Z=D,J=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=Z(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 o=!1;for(var r in e)if(r!==i){var s=e[r];if(o=n(s.key,s.attributes,s.source.key,s.target.key,s.source.attributes,s.target.attributes,s.undirected),t&&o)return s.key}}function nt(t,e,n,i){var o,r,s,a=!1;for(var l in e)if(l!==i){o=e[l];do{if(r=o.source,s=o.target,a=n(o.key,o.attributes,r.key,s.key,r.attributes,s.attributes,o.undirected),t&&a)return o.key;o=o.next}while(void 0!==o)}}function it(t,e){var n,i=Object.keys(t),o=i.length,r=0;return new L((function(){do{if(n)n=n.next;else{if(r>=o)return{done:!0};var s=i[r++];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 ot(t,e,n,i){var o=e[n];if(o){var r=o.source,s=o.target;return i(o.key,o.attributes,r.key,s.key,r.attributes,s.attributes,o.undirected)&&t?o.key:void 0}}function rt(t,e,n,i){var o=e[n];if(o){var r=!1;do{if(r=i(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),t&&r)return o.key;o=o.next}while(void 0!==o)}}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 o,r,s="mixed"!==n&&n!==e.type,a="undirected"===n,l=!1,c=e._edges.values();!0!==(o=c.next()).done;)if(r=o.value,!s||r.undirected===a){var u=r,d=u.key,h=u.attributes,f=u.source,p=u.target;if(l=i(d,h,f.key,p.key,f.attributes,p.attributes,r.undirected),t&&l)return d}}function lt(t,e,n,i,o,r){var s,a=e?nt:et;if("undirected"!==n){if("out"!==i&&(s=a(t,o.in,r),t&&s))return s;if("in"!==i&&(s=a(t,o.out,r,i?void 0:o.key),t&&s))return s}if("directed"!==n&&(s=a(t,o.undirected,r),t&&s))return s}function ct(t,e,n,i,o,r,s){var a,l=n?rt:ot;if("undirected"!==e){if(void 0!==o.in&&"out"!==i&&(a=l(t,o.in,r,s),t&&a))return a;if(void 0!==o.out&&"in"!==i&&(i||o.key!==r)&&(a=l(t,o.out,r,s),t&&a))return a}if("directed"!==e&&void 0!==o.undirected&&(a=l(t,o.undirected,r,s),t&&a))return a}var ut=[{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 dt(){this.A=null,this.B=null}function ht(t,e,n,i,o){for(var r in i){var s=i[r],a=s.source,l=s.target,c=a===n?l:a;if(!e||!e.has(c.key)){var u=o(c.key,c.attributes);if(t&&u)return c.key}}}function ft(t,e,n,i,o){if("mixed"!==e){if("undirected"===e)return ht(t,null,i,i.undirected,o);if("string"==typeof n)return ht(t,null,i,i[n],o)}var r,s=new dt;if("undirected"!==e){if("out"!==n){if(r=ht(t,null,i,i.in,o),t&&r)return r;s.wrap(i.in)}if("in"!==n){if(r=ht(t,s,i,i.out,o),t&&r)return r;s.wrap(i.out)}}if("directed"!==e&&(r=ht(t,s,i,i.undirected,o),t&&r))return r}function pt(t,e,n){var i=Object.keys(n),o=i.length,r=0;return new L((function(){var s=null;do{if(r>=o)return t&&t.wrap(n),{done:!0};var a=n[i[r++]],l=a.source,c=a.target;s=l===e?c: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,o){for(var r,s,a,l,c,u,d,h=i._nodes.values(),f=i.type;!0!==(r=h.next()).done;){var p=!1;if(s=r.value,"undirected"!==f)for(a in l=s.out){c=l[a];do{if(u=c.target,p=!0,d=o(s.key,u.key,s.attributes,u.attributes,c.key,c.attributes,c.undirected),t&&d)return c;c=c.next}while(c)}if("directed"!==f)for(a in l=s.undirected)if(!(e&&s.key>a)){c=l[a];do{if((u=c.target).key!==a&&(u=c.source),p=!0,d=o(s.key,u.key,s.attributes,u.attributes,c.key,c.attributes,c.undirected),t&&d)return c;c=c.next}while(c)}if(n&&!p&&(d=o(s.key,null,s.attributes,null,null,null,null),t&&d))return null}}function gt(t){if(!c(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&&(!c(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(!c(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&&(!c(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.")}dt.prototype.wrap=function(t){null===this.A?this.A=t:null===this.B&&(this.B=t)},dt.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,o,r,s,a){if(!i&&"undirected"===t.type)throw new B("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 B("Graph.".concat(e,": you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead."));if(a&&!c(a))throw new H("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(a,'"'));if(r=""+r,s=""+s,a=a||{},!t.allowSelfLoops&&r===s)throw new B("Graph.".concat(e,': source & target are the same ("').concat(r,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var l=t._nodes.get(r),u=t._nodes.get(s);if(!l)throw new q("Graph.".concat(e,': source node "').concat(r,'" not found.'));if(!u)throw new q("Graph.".concat(e,': target node "').concat(s,'" not found.'));var d={key:null,undirected:i,source:r,target:s,attributes:a};if(n)o=t._edgeKeyGenerator();else if(o=""+o,t._edges.has(o))throw new B("Graph.".concat(e,': the "').concat(o,'" edge already exists in the graph.'));if(!t.multi&&(i?void 0!==l.undirected[s]:void 0!==l.out[s]))throw new B("Graph.".concat(e,': an edge linking "').concat(r,'" 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 h=new W(i,o,l,u,a);t._edges.set(o,h);var f=r===s;return i?(l.undirectedDegree++,u.undirectedDegree++,f&&(l.undirectedLoops++,t._undirectedSelfLoopCount++)):(l.outDegree++,u.inDegree++,f&&(l.directedLoops++,t._directedSelfLoopCount++)),t.multi?h.attachMulti():h.attach(),i?t._undirectedSize++:t._directedSize++,d.key=o,t.emit("edgeAdded",d),o}function xt(t,e,n,i,o,r,s,l,u){if(!i&&"undirected"===t.type)throw new B("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 B("Graph.".concat(e,": you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead."));if(l)if(u){if("function"!=typeof l)throw new H("Graph.".concat(e,': invalid updater function. Expecting a function but got "').concat(l,'"'))}else if(!c(l))throw new H("Graph.".concat(e,': invalid attributes. Expecting an object but got "').concat(l,'"'));var d;if(r=""+r,s=""+s,u&&(d=l,l=void 0),!t.allowSelfLoops&&r===s)throw new B("Graph.".concat(e,': source & target are the same ("').concat(r,"\"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false."));var h,f,p=t._nodes.get(r),m=t._nodes.get(s);if(!n&&(h=t._edges.get(o))){if(!(h.source.key===r&&h.target.key===s||i&&h.source.key===s&&h.target.key===r))throw new B("Graph.".concat(e,': inconsistency detected when attempting to merge the "').concat(o,'" edge with "').concat(r,'" source & "').concat(s,'" target vs. ("').concat(h.source.key,'", "').concat(h.target.key,'").'));f=h}if(f||t.multi||!p||(f=i?p.undirected[s]:p.out[s]),f){var g=[f.key,!1,!1,!1];if(u?!d:!l)return g;if(u){var v=f.attributes;f.attributes=d(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||{},u&&d&&(l=d(l));var y={key:null,undirected:i,source:r,target:s,attributes:l};if(n)o=t._edgeKeyGenerator();else if(o=""+o,t._edges.has(o))throw new B("Graph.".concat(e,': the "').concat(o,'" edge already exists in the graph.'));var C=!1,w=!1;p||(p=Et(t,r,{}),C=!0,r===s&&(m=p,w=!0)),m||(m=Et(t,s,{}),w=!0),h=new W(i,o,p,m,l),t._edges.set(o,h);var b=r===s;return i?(p.undirectedDegree++,m.undirectedDegree++,b&&(p.undirectedLoops++,t._undirectedSelfLoopCount++)):(p.outDegree++,m.inDegree++,b&&(p.directedLoops++,t._directedSelfLoopCount++)),t.multi?h.attachMulti():h.attach(),i?t._undirectedSize++:t._directedSize++,y.key=o,t.emit("edgeAdded",y),[o,!0,C,w]}function Tt(t,e){t._edges.delete(e.key);var n=e.source,i=e.target,o=e.attributes,r=e.undirected,s=n===i;r?(n.undirectedDegree--,i.undirectedDegree--,s&&(n.undirectedLoops--,t._undirectedSelfLoopCount--)):(n.outDegree--,i.inDegree--,s&&(n.directedLoops--,t._directedSelfLoopCount--)),t.multi?e.detachMulti():e.detach(),r?t._undirectedSize--:t._directedSize--,t.emit("edgeDropped",{key:e.key,attributes:o,source:n.key,target:i.key,undirected:r})}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;d(s(e),"NodeDataClass",i);var o="geid_"+Ct()+"_",r=0;return d(s(e),"_attributes",{}),d(s(e),"_nodes",new Map),d(s(e),"_edges",new Map),d(s(e),"_directedSize",0),d(s(e),"_undirectedSize",0),d(s(e),"_directedSelfLoopCount",0),d(s(e),"_undirectedSelfLoopCount",0),d(s(e),"_edgeKeyGenerator",(function(){var t;do{t=o+r++}while(e._edges.has(t));return t})),d(s(e),"_options",t),bt.forEach((function(t){return d(s(e),t,e[t])})),h(s(e),"order",(function(){return e._nodes.size})),h(s(e),"size",(function(){return e._edges.size})),h(s(e),"directedSize",(function(){return e._directedSize})),h(s(e),"undirectedSize",(function(){return e._undirectedSize})),h(s(e),"selfLoopCount",(function(){return e._directedSelfLoopCount+e._undirectedSelfLoopCount})),h(s(e),"directedSelfLoopCount",(function(){return e._directedSelfLoopCount})),h(s(e),"undirectedSelfLoopCount",(function(){return e._undirectedSelfLoopCount})),h(s(e),"multi",e._options.multi),h(s(e),"type",e._options.type),h(s(e),"allowSelfLoops",e._options.allowSelfLoops),h(s(e),"implementation",(function(){return"graphology"})),e}e(i,n);var o=i.prototype;return o._resetInstanceCounters=function(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0},o.hasNode=function(t){return this._nodes.has(""+t)},o.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 o=this._nodes.get(t);return!!o&&o.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."))},o.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 o=this._nodes.get(t);return!!o&&o.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."))},o.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."))},o.directedEdge=function(t,e){if("undirected"!==this.type){if(t=""+t,e=""+e,this.multi)throw new B("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 q('Graph.directedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q('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}},o.undirectedEdge=function(t,e){if("directed"!==this.type){if(t=""+t,e=""+e,this.multi)throw new B("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 q('Graph.undirectedEdge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q('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}},o.edge=function(t,e){if(this.multi)throw new B("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 q('Graph.edge: could not find the "'.concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q('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},o.areDirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new q('Graph.areDirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&(e in n.in||e in n.out)},o.areOutNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new q('Graph.areOutNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.out},o.areInNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new q('Graph.areInNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"undirected"!==this.type&&e in n.in},o.areUndirectedNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new q('Graph.areUndirectedNeighbors: could not find the "'.concat(t,'" node in the graph.'));return"directed"!==this.type&&e in n.undirected},o.areNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new q('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},o.areInboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new q('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},o.areOutboundNeighbors=function(t,e){t=""+t,e=""+e;var n=this._nodes.get(t);if(!n)throw new q('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},o.inDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.inDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree},o.outDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.outDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree},o.directedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.directedDegree: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree},o.undirectedDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.undirectedDegree: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree},o.inboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('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},o.outboundDegree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('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},o.degree=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('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},o.inDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.inDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree-e.directedLoops},o.outDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.outDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.outDegree-e.directedLoops},o.directedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.directedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"undirected"===this.type?0:e.inDegree+e.outDegree-2*e.directedLoops},o.undirectedDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('Graph.undirectedDegreeWithoutSelfLoops: could not find the "'.concat(t,'" node in the graph.'));return"directed"===this.type?0:e.undirectedDegree-2*e.undirectedLoops},o.inboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('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},o.outboundDegreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('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},o.degreeWithoutSelfLoops=function(t){t=""+t;var e=this._nodes.get(t);if(!e)throw new q('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},o.source=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new q('Graph.source: could not find the "'.concat(t,'" edge in the graph.'));return e.source.key},o.target=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new q('Graph.target: could not find the "'.concat(t,'" edge in the graph.'));return e.target.key},o.extremities=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new q('Graph.extremities: could not find the "'.concat(t,'" edge in the graph.'));return[e.source.key,e.target.key]},o.opposite=function(t,e){t=""+t,e=""+e;var n=this._edges.get(e);if(!n)throw new q('Graph.opposite: could not find the "'.concat(e,'" edge in the graph.'));var i=n.source.key,o=n.target.key;if(t===i)return o;if(t===o)return i;throw new q('Graph.opposite: the "'.concat(t,'" node is not attached to the "').concat(e,'" edge (').concat(i,", ").concat(o,")."))},o.hasExtremity=function(t,e){t=""+t,e=""+e;var n=this._edges.get(t);if(!n)throw new q('Graph.hasExtremity: could not find the "'.concat(t,'" edge in the graph.'));return n.source.key===e||n.target.key===e},o.isUndirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new q('Graph.isUndirected: could not find the "'.concat(t,'" edge in the graph.'));return e.undirected},o.isDirected=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new q('Graph.isDirected: could not find the "'.concat(t,'" edge in the graph.'));return!e.undirected},o.isSelfLoop=function(t){t=""+t;var e=this._edges.get(t);if(!e)throw new q('Graph.isSelfLoop: could not find the "'.concat(t,'" edge in the graph.'));return e.source===e.target},o.addNode=function(t,e){var n=function(t,e,n){if(n&&!c(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 B('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},o.mergeNode=function(t,e){if(e&&!c(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])},o.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 o=e?e({}):{};return n=new this.NodeDataClass(t,o),this._nodes.set(t,n),this.emit("nodeAdded",{key:t,attributes:o}),[t,!0]},o.dropNode=function(t){t=""+t;var e,n=this._nodes.get(t);if(!n)throw new q('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{Tt(this,e),e=e.next}while(e)}for(var o in n.in){e=n.in[o];do{Tt(this,e),e=e.next}while(e)}}if("directed"!==this.type)for(var r in n.undirected){e=n.undirected[r];do{Tt(this,e),e=e.next}while(e)}this._nodes.delete(t),this.emit("nodeDropped",{key:t,attributes:n.attributes})},o.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 q('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 q('Graph.dropEdge: could not find the "'.concat(t,'" edge in the graph.'));return Tt(this,e),this},o.dropDirectedEdge=function(t,e){if(arguments.length<2)throw new B("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 B("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 q('Graph.dropDirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Tt(this,n),this},o.dropUndirectedEdge=function(t,e){if(arguments.length<2)throw new B("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 B("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 q('Graph.dropUndirectedEdge: could not find a "'.concat(t,'" -> "').concat(e,'" edge in the graph.'));return Tt(this,n),this},o.clear=function(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")},o.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")},o.getAttribute=function(t){return this._attributes[t]},o.getAttributes=function(){return this._attributes},o.hasAttribute=function(t){return this._attributes.hasOwnProperty(t)},o.setAttribute=function(t,e){return this._attributes[t]=e,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:t}),this},o.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},o.removeAttribute=function(t){return delete this._attributes[t],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:t}),this},o.replaceAttributes=function(t){if(!c(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},o.mergeAttributes=function(t){if(!c(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},o.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},o.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,o=this._nodes.values();!0!==(n=o.next()).done;)(i=n.value).attributes=t(i.key,i.attributes);this.emit("eachNodeAttributesUpdated",{hints:e||null})},o.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,o,r,s=this._edges.values();!0!==(n=s.next()).done;)o=(i=n.value).source,r=i.target,i.attributes=t(i.key,i.attributes,o.key,r.key,o.attributes,r.attributes,i.undirected);this.emit("eachEdgeAttributesUpdated",{hints:e||null})},o.forEachAdjacencyEntry=function(t){if("function"!=typeof t)throw new H("Graph.forEachAdjacencyEntry: expecting a callback.");mt(!1,!1,!1,this,t)},o.forEachAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new H("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");mt(!1,!1,!0,this,t)},o.forEachAssymetricAdjacencyEntry=function(t){if("function"!=typeof t)throw new H("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");mt(!1,!0,!1,this,t)},o.forEachAssymetricAdjacencyEntryWithOrphans=function(t){if("function"!=typeof t)throw new H("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");mt(!1,!0,!0,this,t)},o.nodes=function(){return"function"==typeof Array.from?Array.from(this._nodes.keys()):V(this._nodes.keys(),this._nodes.size)},o.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)},o.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},o.mapNodes=function(t){if("function"!=typeof t)throw new H("Graph.mapNode: expecting a callback.");for(var e,n,i=this._nodes.values(),o=new Array(this.order),r=0;!0!==(e=i.next()).done;)n=e.value,o[r++]=t(n.key,n.attributes);return o},o.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},o.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},o.filterNodes=function(t){if("function"!=typeof t)throw new H("Graph.filterNodes: expecting a callback.");for(var e,n,i=this._nodes.values(),o=[];!0!==(e=i.next()).done;)t((n=e.value).key,n.attributes)&&o.push(n.key);return o},o.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,o=e,r=this._nodes.values();!0!==(n=r.next()).done;)o=t(o,(i=n.value).key,i.attributes);return o},o.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}}))},o.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 u(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,o){i[n++]=function(t,e,n){var i={key:e,source:n.source.key,target:n.target.key};return u(n.attributes)||(i.attributes=a({},n.attributes)),"mixed"===t&&n.undirected&&(i.undirected=!0),i}(t.type,o,e)})),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}},o.import=function(t){var e,n,o,r,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,o,r,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(!c(t))throw new H("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(t.attributes){if(!c(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(o=t.nodes,!Array.isArray(o))throw new H("Graph.import: invalid nodes. Expecting an array.");for(e=0,n=o.length;e<n;e++){gt(r=o[e]);var u=r,d=u.key,h=u.attributes;l?this.mergeNode(d,h):this.addNode(d,h)}}if(t.edges){var f=!1;if("undirected"===this.type&&(f=!0),o=t.edges,!Array.isArray(o))throw new H("Graph.import: invalid edges. Expecting an array.");for(e=0,n=o.length;e<n;e++){vt(s=o[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},o.nullCopy=function(t){var e=new i(a({},this._options,t));return e.replaceAttributes(a({},this.getAttributes())),e},o.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},o.copy=function(t){if("string"==typeof(t=t||{}).type&&t.type!==this.type&&"mixed"!==t.type)throw new B('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 B("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 B("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),o=this._edges.values();!0!==(e=o.next()).done;)St(i,"copy",!1,(n=e.value).undirected,n.key,n.source.key,n.target.key,a({},n.attributes));return i},o.toJSON=function(){return this.export()},o.toString=function(){return"[object Graph]"},o.inspect=function(){var e=this,n={};this._nodes.forEach((function(t,e){n[e]=t.attributes}));var i={},o={};this._edges.forEach((function(t,n){var r,s=t.undirected?"--":"->",a="",l=t.source.key,c=t.target.key;t.undirected&&l>c&&(r=l,l=c,c=r);var u="(".concat(l,")").concat(s,"(").concat(c,")");n.startsWith("geid_")?e.multi&&(void 0===o[u]?o[u]=0:o[u]++,a+="".concat(o[u],". ")):a+="[".concat(n,"]: "),i[a+=u]=t.attributes}));var r={};for(var s in this)this.hasOwnProperty(s)&&!bt.has(s)&&"function"!=typeof this[s]&&"symbol"!==t(s)&&(r[s]=this[s]);return r.attributes=this._attributes,r.nodes=n,r.edges=i,d(r,"constructor",this.constructor),r},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:xt;t.generateKey?_t.prototype[n]=function(o,r,s){return i(this,n,!0,"undirected"===(t.type||this.type),null,o,r,s,"update"===e)}:_t.prototype[n]=function(o,r,s,a){return i(this,n,!1,"undirected"===(t.type||this.type),o,r,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,o=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,o="undirected"===e?t.undirectedSize:t.directedSize,r=new Array(o),s="undirected"===e,a=t._edges.values(),l=0;!0!==(n=a.next()).done;)(i=n.value).undirected===s&&(r[l++]=i.key);return r}(this,i);if(1===arguments.length){t=""+t;var r=this._nodes.get(t);if(void 0===r)throw new q("Graph.".concat(n,': could not find the "').concat(t,'" node in the graph.'));return function(t,e,n,i){var o=[];return lt(!1,t,e,n,i,(function(t){o.push(t)})),o}(this.multi,"mixed"===i?this.type:i,o,r)}if(2===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new q("Graph.".concat(n,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("Graph.".concat(n,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i,o){var r=[];return ct(!1,t,e,n,i,o,(function(t){r.push(t)})),r}(i,this.multi,o,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,o=e.direction,r="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[r]=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 q("Graph.".concat(r,': could not find the "').concat(t,'" node in the graph.'));return lt(!1,this.multi,"mixed"===i?this.type:i,o,s,n)}if(3===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new q("Graph.".concat(r,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("Graph.".concat(r,': could not find the "').concat(e,'" target node in the graph.'));return ct(!1,i,this.multi,o,a,e,n)}throw new H("Graph.".concat(r,": 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 o=0;"directed"!==i&&(o+=this.undirectedSize),"undirected"!==i&&(o+=this.directedSize),t=new Array(o);var s=0;e.push((function(e,i,o,r,a,l,c){t[s++]=n(e,i,o,r,a,l,c)}))}else t=[],e.push((function(e,i,o,r,s,a,l){t.push(n(e,i,o,r,s,a,l))}));return this[r].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,o,r,s,a,l){e(t,i,o,r,s,a,l)&&n.push(t)})),this[r].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,o,r,s,a,l){i=t(i,e,n,o,r,s,a,l)})),this[r].apply(this,n),i}}(t,e),function(t,e){var n=e.name,i=e.type,o=e.direction,r="find"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[r]=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 q("Graph.".concat(r,': could not find the "').concat(t,'" node in the graph.'));return lt(!0,this.multi,"mixed"===i?this.type:i,o,s,n)}if(3===arguments.length){t=""+t,e=""+e;var a=this._nodes.get(t);if(!a)throw new q("Graph.".concat(r,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("Graph.".concat(r,': could not find the "').concat(e,'" target node in the graph.'));return ct(!0,i,this.multi,o,a,e,n)}throw new H("Graph.".concat(r,": 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,o,r,s,a){return e(t,n,i,o,r,s,a)})),!!this[r].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,o,r,s,a){return!e(t,n,i,o,r,s,a)})),!this[r].apply(this,t)}}(t,e),function(t,e){var n=e.name,i=e.type,o=e.direction,r=n.slice(0,-1)+"Entries";t.prototype[r]=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,o=t._edges.values();return new L((function(){for(var t,e;;){if((t=o.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 q("Graph.".concat(r,': 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=J(i,it(n.in))),"in"!==e&&void 0!==n.out&&(i=J(i,it(n.out,e?void 0:n.key)))),"directed"!==t&&void 0!==n.undirected&&(i=J(i,it(n.undirected))),i}(i,o,n)}if(2===arguments.length){t=""+t,e=""+e;var s=this._nodes.get(t);if(!s)throw new q("Graph.".concat(r,': could not find the "').concat(t,'" source node in the graph.'));if(!this._nodes.has(e))throw new q("Graph.".concat(r,': could not find the "').concat(e,'" target node in the graph.'));return function(t,e,n,i){var o=L.empty();return"undirected"!==t&&(void 0!==n.in&&"out"!==e&&i in n.in&&(o=J(o,st(n.in,i))),void 0!==n.out&&"in"!==e&&i in n.out&&(e||n.key!==i)&&(o=J(o,st(n.out,i)))),"directed"!==t&&void 0!==n.undirected&&i in n.undirected&&(o=J(o,st(n.undirected,i))),o}(i,o,s,e)}throw new H("Graph.".concat(r,": too many arguments (expecting 0, 1 or 2 and got ").concat(arguments.length,")."))}}(t,e)}))}(_t),function(t){ut.forEach((function(e){(function(t,e){var n=e.name,i=e.type,o=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 q("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,o,e)}})(t,e),function(t,e){var n=e.name,i=e.type,o=e.direction,r="forEach"+n[0].toUpperCase()+n.slice(1,-1);t.prototype[r]=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 q("Graph.".concat(r,': could not find the "').concat(t,'" node in the graph.'));ft(!1,"mixed"===i?this.type:i,o,n,e)}};var s="map"+n[0].toUpperCase()+n.slice(1);t.prototype[s]=function(t,e){var n=[];return this[r](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[r](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[r](t,(function(t,n){i=e(i,t,n)})),i}}(t,e),function(t,e){var n=e.name,i=e.type,o=e.direction,r=n[0].toUpperCase()+n.slice(1,-1),s="find"+r;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 q("Graph.".concat(s,': could not find the "').concat(t,'" node in the graph.'));return ft(!0,"mixed"===i?this.type:i,o,n,e)}};var a="some"+r;t.prototype[a]=function(t,e){return!!this[s](t,e)};var l="every"+r;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,o=e.direction,r=n.slice(0,-1)+"Entries";t.prototype[r]=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 q("Graph.".concat(r,': 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(),o=new dt;return"undirected"!==t&&("out"!==e&&(i=J(i,pt(o,n,n.in))),"in"!==e&&(i=J(i,pt(o,n,n.out)))),"directed"!==t&&(i=J(i,pt(o,n,n.undirected))),i}("mixed"===i?this.type:i,o,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),o=new t(i);return o.import(e),o}}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=q,_t.UsageGraphError=B,_t}()},6572:function(t){var e;t.exports=(e=function(t,e){var n=Array.prototype.concat,i=Array.prototype.slice,o=Object.prototype.toString;function r(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]"===o.call(t)};function a(t){return"[object Function]"===o.call(t)}function l(t){return"number"==typeof t&&t-t==0}function c(){return new c._init(arguments)}function u(){return 0}function d(){return 1}function h(t,e){return t===e?1:0}c.fn=c.prototype,c._init=function(t){if(s(t[0]))if(s(t[0][0])){a(t[1])&&(t[0]=c.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])?c.map(t[0],t[1]):t[0],this.length=1;else if(l(t[0]))this[0]=c.seq.apply(null,t),this.length=1;else{if(t[0]instanceof c)return c(t[0].toArray());this[0]=[],this.length=1}return this},c._init.prototype=c.prototype,c._init.constructor=c,c.utils={calcRdx:r,isArray:s,isFunction:a,isNumber:l,toVector:function(t){return n.apply([],t)}},c._random_fn=t.random,c.setRandom=function(t){if("function"!=typeof t)throw new TypeError("fn is not a function");c._random_fn=t},c.extend=function(t){var e,n;if(1===arguments.length){for(n in t)c[n]=t[n];return this}for(e=1;e<arguments.length;e++)for(n in arguments[e])t[n]=arguments[e][n];return t},c.rows=function(t){return t.length||1},c.cols=function(t){return t[0].length||1},c.dimensions=function(t){return{rows:c.rows(t),cols:c.cols(t)}},c.row=function(t,e){return s(e)?e.map((function(e){return c.row(t,e)})):t[e]},c.rowa=function(t,e){return c.row(t,e)},c.col=function(t,e){if(s(e)){var n=c.arange(t.length).map((function(){return new Array(e.length)}));return e.forEach((function(e,i){c.arange(t.length).forEach((function(o){n[o][i]=t[o][e]}))})),n}for(var i=new Array(t.length),o=0;o<t.length;o++)i[o]=[t[o][e]];return i},c.cola=function(t,e){return c.col(t,e).map((function(t){return t[0]}))},c.diag=function(t){for(var e=c.rows(t),n=new Array(e),i=0;i<e;i++)n[i]=[t[i][i]];return n},c.antidiag=function(t){for(var e=c.rows(t)-1,n=new Array(e),i=0;e>=0;e--,i++)n[i]=[t[i][e]];return n},c.transpose=function(t){var e,n,i,o,r,a=[];for(s(t[0])||(t=[t]),n=t.length,i=t[0].length,r=0;r<i;r++){for(e=new Array(n),o=0;o<n;o++)e[o]=t[o][r];a.push(e)}return 1===a.length?a[0]:a},c.map=function(t,e,n){var i,o,r,a,l;for(s(t[0])||(t=[t]),o=t.length,r=t[0].length,a=n?t:new Array(o),i=0;i<o;i++)for(a[i]||(a[i]=new Array(r)),l=0;l<r;l++)a[i][l]=e(t[i][l],i,l);return 1===a.length?a[0]:a},c.cumreduce=function(t,e,n){var i,o,r,a,l;for(s(t[0])||(t=[t]),o=t.length,r=t[0].length,a=n?t:new Array(o),i=0;i<o;i++)for(a[i]||(a[i]=new Array(r)),r>0&&(a[i][0]=t[i][0]),l=1;l<r;l++)a[i][l]=e(a[i][l-1],t[i][l]);return 1===a.length?a[0]:a},c.alter=function(t,e){return c.map(t,e,!0)},c.create=function(t,e,n){var i,o,r=new Array(t);for(a(e)&&(n=e,e=t),i=0;i<t;i++)for(r[i]=new Array(e),o=0;o<e;o++)r[i][o]=n(i,o);return r},c.zeros=function(t,e){return l(e)||(e=t),c.create(t,e,u)},c.ones=function(t,e){return l(e)||(e=t),c.create(t,e,d)},c.rand=function(t,e){return l(e)||(e=t),c.create(t,e,c._random_fn)},c.identity=function(t,e){return l(e)||(e=t),c.create(t,e,h)},c.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},c.clear=function(t){return c.alter(t,u)},c.seq=function(t,e,n,i){a(i)||(i=!1);var o,s=[],l=r(t,e),c=(e*l-t*l)/((n-1)*l),u=t;for(o=0;u<=e&&o<n;u=(t*l+c*l*++o)/l)s.push(i?i(u,o):u);return s},c.arange=function(t,n,i){var o,r=[];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(o=t;o<n;o+=i)r.push(o);else for(o=t;o>n;o+=i)r.push(o);return r},c.slice=function(){function t(t,n,i,o){var r,s=[],a=t.length;if(n===e&&i===e&&o===e)return c.copy(t);if(o=o||1,(n=(n=n||0)>=0?n:a+n)===(i=(i=i||t.length)>=0?i:a+i)||0===o)return[];if(n<i&&o<0)return[];if(n>i&&o>0)return[];if(o>0)for(r=n;r<i;r+=o)s.push(t[r]);else for(r=n;r>i;r+=o)s.push(t[r]);return s}return function(e,n){var i,o;return l((n=n||{}).row)?l(n.col)?e[n.row][n.col]:t(c.rowa(e,n.row),(i=n.col||{}).start,i.end,i.step):l(n.col)?t(c.cola(e,n.col),(o=n.row||{}).start,o.end,o.step):(o=n.row||{},i=n.col||{},t(e,o.start,o.end,o.step).map((function(e){return t(e,i.start,i.end,i.step)})))}}(),c.sliceAssign=function(n,i,o){var r,s;if(l(i.row)){if(l(i.col))return n[i.row][i.col]=o;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,r=c.arange(i.col.start,t.min(n.length,i.col.end),i.col.step);var a=i.row;return r.forEach((function(t,e){n[a][t]=o[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=c.arange(i.row.start,t.min(n[0].length,i.row.end),i.row.step);var u=i.col;return s.forEach((function(t,e){n[t][u]=o[e]})),n}return o[0].length===e&&(o=[o]),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=c.arange(i.row.start,t.min(n.length,i.row.end),i.row.step),r=c.arange(i.col.start,t.min(n[0].length,i.col.end),i.col.step),s.forEach((function(t,e){r.forEach((function(i,r){n[t][i]=o[e][r]}))})),n},c.diagonal=function(t){var e=c.zeros(t.length,t.length);return t.forEach((function(t,n){e[n][n]=t})),e},c.copy=function(t){return t.map((function(t){return l(t)?t:t.map((function(t){return t}))}))};var f=c.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 c(c.map(this,t,e))},f.cumreduce=function(t,e){return c(c.cumreduce(this,t,e))},f.alter=function(t){return c.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=c[t](this),s(n)?c(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):c(c[t](this,e))}}(t[e])}("row col".split(" ")),function(t){for(var e=0;e<t.length;e++)!function(t){f[t]=function(){return c(c[t].apply(null,arguments))}}(t[e])}("create zeros ones rand identity".split(" ")),c}(Math),function(t,e){var n=t.utils.isFunction;function i(t,e){return t-e}function o(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),o=0,r=e.length;--r>=0;)o+=(n=e[r]-i)*n;return o},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),o=t.mean(i);return e.exp(o)},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=[],o={};for(e=0;e<t.length;e++)o[l=t[e]]?o[l]++:(o[l]=1,n.push(l));var r=n.sort(i),s={},a=1;for(e=0;e<r.length;e++){var l,c=o[l=r[e]],u=(a+(a+c-1))/2;s[l]=u,a+=c}return t.map((function(t){return s[t]}))},t.mode=function(t){var e,n=t.length,o=t.slice().sort(i),r=1,s=0,a=0,l=[];for(e=0;e<n;e++)o[e]===o[e+1]?r++:(r>s?(l=[o[e]],s=r,a=0):r===s&&(l.push(o[e]),a++),r=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,o=new Array(i),r=0;r<i;r++)o[r]=e[r]-n;return o},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),o=[],r=n.length-1;r>=0;r--)o.push(e.abs(n[r]-i));return t.mean(o)},t.meddev=function(n){for(var i=t.median(n),o=[],r=n.length-1;r>=0;r--)o.push(e.abs(n[r]-i));return t.median(o)},t.coeffvar=function(e){return t.stdev(e)/t.mean(e)},t.quartiles=function(t){var n=t.length,o=t.slice().sort(i);return[o[e.round(n/4)-1],o[e.round(n/2)-1],o[e.round(3*n/4)-1]]},t.quantiles=function(t,n,r,s){var a,l,c,u,d,h=t.slice().sort(i),f=[n.length],p=t.length;for(void 0===r&&(r=3/8),void 0===s&&(s=3/8),a=0;a<n.length;a++)c=p*(l=n[a])+(r+l*(1-r-s)),u=e.floor(o(c,1,p-1)),d=o(c-u,0,1),f[a]=(1-d)*h[u-1]+d*h[u];return f},t.percentile=function(t,e,n){var o=t.slice().sort(i),r=e*(o.length+(n?1:-1))+(n?0:1),s=parseInt(r),a=r-s;return s+1<o.length?o[s-1]+a*(o[s]-o[s-1]):o[s-1]},t.percentileOfScore=function(t,e,n){var i,o,r=0,s=t.length,a=!1;for("strict"===n&&(a=!0),o=0;o<s;o++)i=t[o],(a&&i<e||!a&&i<=e)&&r++;return r/s},t.histogram=function(n,i){i=i||4;var o,r=t.min(n),s=(t.max(n)-r)/i,a=n.length,l=[];for(o=0;o<i;o++)l[o]=0;for(o=0;o<a;o++)l[e.min(e.floor((n[o]-r)/s),i-1)]+=1;return l},t.covariance=function(e,n){var i,o=t.mean(e),r=t.mean(n),s=e.length,a=new Array(s);for(i=0;i<s;i++)a[i]=(e[i]-o)*(n[i]-r);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 o=t.mean(n),r=t.stdev(n),s=n.length,a=0,l=0;l<s;l++)a+=e.pow((n[l]-o)/r,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 r=t.prototype;!function(e){for(var i=0;i<e.length;i++)!function(e){r[e]=function(i,o){var s=[],a=0,l=this;if(n(i)&&(o=i,i=!1),o)return setTimeout((function(){o.call(l,r[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){r[e]=function(i,o){var s=[],a=0,l=this;if(n(i)&&(o=i,i=!1),o)return setTimeout((function(){o.call(l,r[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){r[e]=function(){var i,o=[],s=0,a=this,l=Array.prototype.slice.call(arguments);if(n(l[l.length-1])){i=l[l.length-1];var c=l.slice(0,l.length-1);return setTimeout((function(){i.call(a,r[e].apply(a,c))})),this}i=void 0;var u=function(n){return t[e].apply(a,[n].concat(l))};if(this.length>1){for(a=a.transpose();s<a.length;s++)o[s]=u(a[s]);return o}return u(this[0])}}(e[i])}("quantiles percentileOfScore".split(" "))}(e,Math),function(t,e){t.gammaln=function(t){var n,i,o,r=0,s=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(o=(i=n=t)+5.5,o-=(n+.5)*e.log(o);r<6;r++)a+=s[r]/++i;return e.log(2.5066282746310007*a/n)-o},t.loggam=function(t){var n,i,o,r,s,a,l,c=[.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),o=2*e.PI,s=c[9],a=8;a>=0;a--)s*=i,s+=c[a];if(r=s/n+.5*e.log(o)+(n-.5)*e.log(n)-n,t<=7)for(a=1;a<=l;a++)r-=e.log(n-1),n-=1;return r},t.gammafn=function(t){var n,i,o,r,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,c=0,u=0,d=0,h=t;if(t>171.6243769536076)return 1/0;if(h<=0){if(!(r=h%1+36e-17))return 1/0;l=(1&h?-1:1)*e.PI/e.sin(e.PI*r),h=1-h}for(o=h,i=h<1?h++:(h-=c=(0|h)-1)-1,n=0;n<8;++n)d=(d+s[n])*i,u=u*i+a[n];if(r=d/u+1,o<h)r/=o;else if(o>h)for(n=0;n<c;++n)r*=h,h++;return l&&(r=l/r),r},t.gammap=function(e,n){return t.lowRegGamma(e,n)*t.gammafn(e)},t.lowRegGamma=function(n,i){var o,r=t.gammaln(n),s=n,a=1/n,l=a,c=i+1-n,u=1/1e-30,d=1/c,h=d,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)-r)}for(;f<=p;f++)h*=(d=1/(d=(o=-f*(f-n))*d+(c+=2)))*(u=c+o/u);return 1-h*e.exp(-i+n*e.log(i)-r)},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 o,r,s,a,l=1e-30,c=1,u=n+i,d=n+1,h=n-1,f=1,p=1-u*t/d;for(e.abs(p)<l&&(p=l),a=p=1/p;c<=100&&(p=1+(r=c*(i-c)*t/((h+(o=2*c))*(n+o)))*p,e.abs(p)<l&&(p=l),f=1+r/f,e.abs(f)<l&&(f=l),a*=(p=1/p)*f,p=1+(r=-(n+c)*(u+c)*t/((n+o)*(d+o)))*p,e.abs(p)<l&&(p=l),f=1+r/f,e.abs(f)<l&&(f=l),a*=s=(p=1/p)*f,!(e.abs(s-1)<3e-7));c++);return a},t.gammapinv=function(n,i){var o,r,s,a,l,c,u=0,d=i-1,h=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(d),c=e.exp(d*(l-1)-h),a=n<.5?n:1-n,o=(2.30753+.27061*(r=e.sqrt(-2*e.log(a))))/(1+r*(.99229+.04481*r))-r,n<.5&&(o=-o),o=e.max(.001,i*e.pow(1-1/(9*i)-o/(3*e.sqrt(i)),3))):o=n<(r=1-i*(.253+.12*i))?e.pow(n/r,1/i):1-e.log(1-(n-r)/(1-r));u<12;u++){if(o<=0)return 0;if((o-=r=(s=(t.lowRegGamma(i,o)-n)/(r=i>1?c*e.exp(-(o-d)+d*(e.log(o)-l)):e.exp(-o+d*e.log(o)-h)))/(1-.5*e.min(1,s*((i-1)/o-1))))<=0&&(o=.5*(o+r)),e.abs(r)<1e-8*o)break}return o},t.erf=function(t){var n,i,o,r,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,c=0,u=0;for(t<0&&(t=-t,l=!0),i=4*(n=2/(2+t))-2;a>0;a--)o=c,c=i*c-u+s[a],u=o;return r=n*e.exp(-t*t+.5*(s[0]+i*c)-u),l?r-1:1-r},t.erfc=function(e){return 1-t.erf(e)},t.erfcinv=function(n){var i,o,r,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*(r=e.sqrt(-2*e.log(s/2))))/(1+r*(.99229+.04481*r))-r);a<2;a++)i+=(o=t.erfc(i)-s)/(1.1283791670955126*e.exp(-i*i)-i*o);return n<1?i:-i},t.ibetainv=function(n,i,o){var r,s,a,l,c,u,d,h,f,p,m=i-1,g=o-1,v=0;if(n<=0)return 0;if(n>=1)return 1;for(i>=1&&o>=1?(a=n<.5?n:1-n,u=(2.30753+.27061*(l=e.sqrt(-2*e.log(a))))/(1+l*(.99229+.04481*l))-l,n<.5&&(u=-u),d=(u*u-3)/6,h=2/(1/(2*i-1)+1/(2*o-1)),f=u*e.sqrt(d+h)/h-(1/(2*o-1)-1/(2*i-1))*(d+5/6-2/(3*h)),u=i/(i+o*e.exp(2*f))):(r=e.log(i/(i+o)),s=e.log(o/(i+o)),u=n<(l=e.exp(i*r)/i)/(f=l+(c=e.exp(o*s)/o))?e.pow(i*f*n,1/i):1-e.pow(o*f*(1-n),1/o)),p=-t.gammaln(i)-t.gammaln(o)+t.gammaln(i+o);v<10;v++){if(0===u||1===u)return u;if((u-=l=(c=(t.ibeta(u,i,o)-n)/(l=e.exp(m*e.log(u)+g*e.log(1-u)+p)))/(1-.5*e.min(1,c*(m/u-g/(1-u)))))<=0&&(u=.5*(u+l)),u>=1&&(u=.5*(u+l+1)),e.abs(l)<1e-8*u&&v>0)break}return u},t.ibeta=function(n,i,o){var r=0===n||1===n?0:e.exp(t.gammaln(i+o)-t.gammaln(i)-t.gammaln(o)+i*e.log(n)+o*e.log(1-n));return!(n<0||n>1)&&(n<(i+1)/(i+o+2)?r*t.betacf(n,i,o)/i:1-r*t.betacf(1-n,o,i)/o)},t.randn=function(n,i){var o,r,s,a,l;if(i||(i=n),n)return t.create(n,i,(function(){return t.randn()}));do{o=t._random_fn(),r=1.7156*(t._random_fn()-.5),l=(s=o-.449871)*s+(a=e.abs(r)+.386595)*(.196*a-.25472*s)}while(l>.27597&&(l>.27846||r*r>-4*e.log(o)*o*o));return r/o},t.randg=function(n,i,o){var r,s,a,l,c,u,d=n;if(o||(o=i),n||(n=1),i)return(u=t.zeros(i,o)).alter((function(){return t.randg(n)})),u;n<1&&(n+=1),r=n-1/3,s=1/e.sqrt(9*r);do{do{l=1+s*(c=t.randn())}while(l<=0);l*=l*l,a=t._random_fn()}while(a>1-.331*e.pow(c,4)&&e.log(a)>.5*c*c+r*(1-l+e.log(l)));if(n==d)return r*l;do{a=t._random_fn()}while(0===a);return e.pow(a,1/d)*r*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,o){for(var r,s=0,a=1,l=1,c=1,u=0,d=0;e.abs((l-d)/l)>o;)d=l,a=c+(r=-(n+u)*(n+i+u)*t/(n+2*u)/(n+2*u+1))*a,l=(s=l+r*s)+(r=(u+=1)*(i-u)*t/(n+2*u-1)/(n+2*u))*l,s/=c=a+r*c,a/=c,l/=c,c=1;return l/n}function i(n,i,o){var r=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],s=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*n;if(a>=8)return 1;var l,c=2*t.normal.cdf(a,0,1,1,0)-1;c=c>=e.exp(-50/o)?e.pow(c,o):0;for(var u=a,d=(8-a)/(l=n>3?2:3),h=u+d,f=0,p=o-1,m=1;m<=l;m++){for(var g=0,v=.5*(h+u),y=.5*(h-u),C=1;C<=12;C++){var w,b=v+y*(6<C?r[(w=12-C+1)-1]:-r[(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*o/e.sqrt(2*e.PI),u=h,h+=d}return(c+=f)<=e.exp(-30/i)?0:(c=e.pow(c,i))>=1?1:c}!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,o){var r=t[e](n,i,o);return r.data=this,r},t[e].prototype.sample=function(n){var i=this._a,o=this._b,r=this._c;return n?t.alter(n,(function(){return t[e].sample(i,o,r)})):t[e].sample(i,o,r)},function(n){for(var i=0;i<n.length;i++)!function(n){t[e].prototype[n]=function(i){var o=this._a,r=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,o,r,s)})):t[e][n](i,o,r,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,o){return n>1||n<0?0:1==i&&1==o?1:i<512&&o<512?e.pow(n,i-1)*e.pow(1-n,o-1)/t.betafn(i,o):e.exp((i-1)*e.log(n)+(o-1)*e.log(1-n)-t.betaln(i,o))},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,o){var r;return n<0?0:i<=2?0===n&&i<2?1/0:0===n&&2===i?1:1/t.betafn(i/2,o/2)*e.pow(i/o,i/2)*e.pow(n,i/2-1)*e.pow(1+i/o*n,-(i+o)/2):(r=i*n/(o+n*i),i*(o/(o+n*i))/2*t.binomial.pdf((i-2)/2,(i+o-2)/2,r))},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,o){return n<0?0:0===n&&1===i?1/o:e.exp((i-1)*e.log(n)-n/o-t.gammaln(i)-i*e.log(o))},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,o){return n<=0?0:e.exp(-(i+1)*e.log(n)-o/n-t.gammaln(i)+i*e.log(o))},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,o){return n<0?0:.5+.5*t.erf((e.log(n)-i)/e.sqrt(2*o*o))},inv:function(n,i,o){return e.exp(-1.4142135623730951*o*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,o){return e.abs(o)<1e-14?t.studentt.pdf(n,i):e.abs(n)<1e-14?e.exp(t.gammaln((i+1)/2)-o*o/2-.5*e.log(e.PI*i)-t.gammaln(i/2)):i/n*(t.noncentralt.cdf(n*e.sqrt(1+2/i),i+2,o)-t.noncentralt.cdf(n,i,o))},cdf:function(n,i,o){var r=1e-14;if(e.abs(o)<r)return t.studentt.cdf(n,i);var s=!1;n<0&&(s=!0,o=-o);for(var a=t.normal.cdf(-o,0,1),l=r+1,c=l,u=n*n/(n*n+i),d=0,h=e.exp(-o*o/2),f=e.exp(-o*o/2-.5*e.log(2)-t.gammaln(1.5))*o;d<200||c>r||l>r;)c=l,d>0&&(h*=o*o/(2*d),f*=o*o/(2*(d+.5))),a+=.5*(l=h*t.beta.cdf(u,d+.5,i/2)+f*t.beta.cdf(u,d+1,i/2)),d++;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,o){return.5*(1+t.erf((n-i)/e.sqrt(2*o*o)))},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 o=i/2;return t.ibeta((n+e.sqrt(n*n+i))/(2*e.sqrt(n*n+i)),o,o)},inv:function(n,i){var o=t.ibetainv(2*e.min(n,1-n),.5*i,.5);return o=e.sqrt(i*(1-o)/o),n>.5?o:-o},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,o){return 0===o||1===o?i*o===n?1:0:t.combination(i,n)*e.pow(o,n)*e.pow(1-o,i-n)},cdf:function(i,o,r){var s,a=1e-10;if(i<0)return 0;if(i>=o)return 1;if(r<0||r>1||o<=0)return NaN;var l=r,c=(i=e.floor(i))+1,u=o-i,d=c+u,h=e.exp(t.gammaln(d)-t.gammaln(u)-t.gammaln(c)+c*e.log(l)+u*e.log(1-l));return s=l<(c+1)/(d+2)?h*n(l,c,u,a):1-h*n(1-l,u,c,a),e.round(1/a*(1-s))/(1/a)}}),t.extend(t.negbin,{pdf:function(n,i,o){return n===n>>>0&&(n<0?0:t.combination(n+i-1,i-1)*e.pow(1-o,n)*e.pow(o,i))},cdf:function(e,n,i){var o=0,r=0;if(e<0)return 0;for(;r<=e;r++)o+=t.negbin.pdf(r,n,i);return o}}),t.extend(t.hypgeom,{pdf:function(n,i,o,r){if(n!=n|0)return!1;if(n<0||n<o-(i-r))return 0;if(n>r||n>o)return 0;if(2*o>i)return 2*r>i?t.hypgeom.pdf(i-o-r+n,i,i-o,i-r):t.hypgeom.pdf(r-n,i,i-o,r);if(2*r>i)return t.hypgeom.pdf(o-n,i,o,i-r);if(o<r)return t.hypgeom.pdf(n,i,r,o);for(var s=1,a=0,l=0;l<n;l++){for(;s>1&&a<r;)s*=1-o/(i-a),a++;s*=(r-l)*(o-l)/((l+1)*(i-o-r+l+1))}for(;a<r;a++)s*=1-o/(i-a);return e.min(1,e.max(0,s))},cdf:function(n,i,o,r){if(n<0||n<o-(i-r))return 0;if(n>=r||n>=o)return 1;if(2*o>i)return 2*r>i?t.hypgeom.cdf(i-o-r+n,i,i-o,i-r):1-t.hypgeom.cdf(r-n-1,i,i-o,r);if(2*r>i)return 1-t.hypgeom.cdf(o-n-1,i,o,i-r);if(o<r)return t.hypgeom.cdf(n,i,r,o);for(var s=1,a=1,l=0,c=0;c<n;c++){for(;s>1&&l<r;){var u=1-o/(i-l);a*=u,s*=u,l++}s+=a*=(r-c)*(o-c)/((c+1)*(i-o-r+c+1))}for(;l<r;l++)s*=1-o/(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=[],o=0;if(e<0)return 0;for(;o<=e;o++)i.push(t.poisson.pdf(o,n));return t.sum(i)},mean:function(t){return t},variance:function(t){return t},sampleSmall:function(n){var i=1,o=0,r=e.exp(-n);do{o++,i*=t._random_fn()}while(i>r);return o-1},sampleLarge:function(n){var i,o,r,s,a,l,c,u,d,h,f=n;for(s=e.sqrt(f),a=e.log(f),l=.02483*(c=.931+2.53*s)-.059,u=1.1239+1.1328/(c-3.4),d=.9277-3.6224/(c-2);;){if(o=e.random()-.5,r=e.random(),h=.5-e.abs(o),i=e.floor((2*l/h+c)*o+f+.43),h>=.07&&r<=d)return i;if(!(i<0||h<.013&&r>h)&&e.log(r)+e.log(u)-e.log(l/(h*h)+c)<=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,o){return i<=n||o<n||o>i?NaN:t<=n?0:t>=i?1:t<=o?e.pow(t-n,2)/((i-n)*(o-n)):1-e.pow(i-t,2)/((i-n)*(i-o))},inv:function(t,n,i,o){return i<=n||o<n||o>i?NaN:t<=(o-n)/(i-n)?n+(i-n)*e.sqrt(t*((o-n)/(i-n))):n+(i-n)*(1-e.sqrt((1-t)*(1-(o-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,o){var r=t._random_fn();return r<(o-n)/(i-n)?n+e.sqrt(r*(i-n)*(o-n)):i-e.sqrt((1-r)*(i-n)*(i-o))},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 o,r=t._random_fn()-.5;return n-i*((o=r)/e.abs(o))*e.log(1-2*e.abs(r))}}),t.extend(t.tukey,{cdf:function(n,o,r){var s=o,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],l=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(n<=0)return 0;if(r<2||s<2)return NaN;if(!Number.isFinite(n))return 1;if(r>25e3)return i(n,1,s);var c,u=.5*r,d=u*e.log(r)-r*e.log(2)-t.gammaln(u),h=u-1,f=.25*r;c=r<=100?1:r<=800?.5:r<=5e3?.25:.125,d+=e.log(c);for(var p=0,m=1;m<=50;m++){for(var g=0,v=(2*m-1)*c,y=1;y<=16;y++){var C,w;8<y?(C=y-8-1,w=d+h*e.log(v+a[C]*c)-(a[C]*c+v)*f):(C=y-1,w=d+h*e.log(v-a[C]*c)+(a[C]*c-v)*f),w>=-30&&(g+=i(8<y?n*e.sqrt(.5*(a[C]*c+v)):n*e.sqrt(.5*(-a[C]*c+v)),1,s)*l[C]*e.exp(w))}if(m*c>=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,o){if(o<2||i<2)return NaN;if(n<0||n>1)return NaN;if(0===n)return 0;if(1===n)return 1/0;var r,s=function(t,n,i){var o=.5-.5*t,r=e.sqrt(e.log(1/(o*o))),s=r+((((-453642210148e-16*r-.204231210125)*r-.342242088547)*r-1)*r+.322232421088)/((((.0038560700634*r+.10353775285)*r+.531103462366)*r+.588581570495)*r+.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,o),a=t.tukey.cdf(s,i,o)-n;r=a>0?e.max(0,s-1):s+1;for(var l,c=t.tukey.cdf(r,i,o)-n,u=1;u<50;u++)if(l=r-c*(r-s)/(c-a),a=c,s=r,l<0&&(l=0,c=-n),c=t.tukey.cdf(l,i,o)-n,r=l,e.abs(r-s)<1e-4)return l;throw new Error("tukey.inv failed to converge")}})}(e,Math),function(t,e){var n,i,o=Array.prototype.push,r=t.utils.isArray;function s(e){return r(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,o,r,a,l,c,u,d;if(void 0===e.length&&void 0===n.length)return e*n;if(l=e.length,c=e[0].length,u=t.zeros(l,r=s(n)?n[0].length:c),d=0,s(n)){for(;d<r;d++)for(i=0;i<l;i++){for(a=0,o=0;o<c;o++)a+=e[i][o]*n[o][d];u[i][d]=a}return 1===l&&1===d?u[0][0]:u}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,o,r=1===e[0].length&&1!==e.length?t.transpose(e):e,a=1===n[0].length&&1!==n.length?t.transpose(n):n,l=[],c=0,u=r.length,d=r[0].length;c<u;c++){for(l[c]=[],i=0,o=0;o<d;o++)i+=r[c][o]*a[c][o];l[c]=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,o=0;for(isNaN(n)&&(n=2),s(t[0])&&(t=t[0]);o<t.length;o++)i+=e.pow(e.abs(t[o]),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++)o.apply(i[n],e[n]);return i},inv:function(e){for(var n,i=e.length,o=e[0].length,r=t.identity(i,o),s=t.gauss_jordan(e,r),a=[],l=0;l<i;l++)for(a[l]=[],n=o;n<s[0].length;n++)a[l][n-o]=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 o=[],r=1;r<e.length;r++){o[r-1]=[];for(var s=0;s<e.length;s++)s<i?o[r-1][s]=e[r][s]:s>i&&(o[r-1][s-1]=e[r][s])}var a=i%2?-1:1;n+=t(o)*e[0][i]*a}return n},gauss_elimination:function(n,i){var o,r,s,a,l=0,c=0,u=n.length,d=n[0].length,h=1,f=0,p=[];for(o=(n=t.aug(n,i))[0].length,l=0;l<u;l++){for(r=n[l][l],c=l,a=l+1;a<d;a++)r<e.abs(n[a][l])&&(r=n[a][l],c=a);if(c!=l)for(a=0;a<o;a++)s=n[l][a],n[l][a]=n[c][a],n[c][a]=s;for(c=l+1;c<u;c++)for(h=n[c][l]/n[l][l],a=l;a<o;a++)n[c][a]=n[c][a]-h*n[l][a]}for(l=u-1;l>=0;l--){for(f=0,c=l+1;c<=u-1;c++)f+=p[c]*n[l][c];p[l]=(n[l][o-1]-f)/n[l][l]}return p},gauss_jordan:function(n,i){var o,r,s,a=t.aug(n,i),l=a.length,c=a[0].length,u=0;for(r=0;r<l;r++){var d=r;for(s=r+1;s<l;s++)e.abs(a[s][r])>e.abs(a[d][r])&&(d=s);var h=a[r];for(a[r]=a[d],a[d]=h,s=r+1;s<l;s++)for(u=a[s][r]/a[r][r],o=r;o<c;o++)a[s][o]-=a[r][o]*u}for(r=l-1;r>=0;r--){for(u=a[r][r],s=0;s<r;s++)for(o=c-1;o>r-1;o--)a[s][o]-=a[r][o]*a[s][r]/u;for(a[r][r]/=u,o=l;o<c;o++)a[r][o]/=u}return a},triaUpSolve:function(e,n){var i,o=e[0].length,r=t.zeros(1,o)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(o-1,-1,-1).forEach((function(s){i=t.arange(s+1,o).map((function(t){return r[t]*e[s][t]})),r[s]=(n[s]-t.sum(i))/e[s][s]})),s?r.map((function(t){return[t]})):r},triaLowSolve:function(e,n){var i,o=e[0].length,r=t.zeros(1,o)[0],s=!1;return null!=n[0].length&&(n=n.map((function(t){return t[0]})),s=!0),t.arange(o).forEach((function(o){i=t.arange(o).map((function(t){return e[o][t]*r[t]})),r[o]=(n[o]-t.sum(i))/e[o][o]})),s?r.map((function(t){return[t]})):r},lu:function(e){var n,i=e.length,o=t.identity(i),r=t.zeros(e.length,e[0].length);return t.arange(i).forEach((function(t){r[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 o[s][t]*r[t][i]})),o[s][i]=(e[s][i]-t.sum(n))/r[i][i]})),t.arange(s,i).forEach((function(i){n=t.arange(s).map((function(t){return o[s][t]*r[t][i]})),r[s][i]=e[n.length][i]-t.sum(n)}))})),[o,r]},cholesky:function(n){var i,o=n.length,r=t.zeros(n.length,n[0].length);return t.arange(o).forEach((function(s){i=t.arange(s).map((function(t){return e.pow(r[s][t],2)})),r[s][s]=e.sqrt(n[s][s]-t.sum(i)),t.arange(s+1,o).forEach((function(e){i=t.arange(s).map((function(t){return r[s][t]*r[e][t]})),r[e][s]=(n[s][e]-t.sum(i))/r[s][s]}))})),r},gauss_jacobi:function(n,i,o,r){for(var s,a,l,c,u=0,d=0,h=n.length,f=[],p=[],m=[];u<h;u++)for(f[u]=[],p[u]=[],m[u]=[],d=0;d<h;d++)u>d?(f[u][d]=n[u][d],p[u][d]=m[u][d]=0):u<d?(p[u][d]=n[u][d],f[u][d]=m[u][d]=0):(m[u][d]=n[u][d],f[u][d]=p[u][d]=0);for(l=t.multiply(t.multiply(t.inv(m),t.add(f,p)),-1),a=t.multiply(t.inv(m),i),s=o,c=t.add(t.multiply(l,o),a),u=2;e.abs(t.norm(t.subtract(c,s)))>r;)s=c,c=t.add(t.multiply(l,s),a),u++;return c},gauss_seidel:function(n,i,o,r){for(var s,a,l,c,u,d=0,h=n.length,f=[],p=[],m=[];d<h;d++)for(f[d]=[],p[d]=[],m[d]=[],s=0;s<h;s++)d>s?(f[d][s]=n[d][s],p[d][s]=m[d][s]=0):d<s?(p[d][s]=n[d][s],f[d][s]=m[d][s]=0):(m[d][s]=n[d][s],f[d][s]=p[d][s]=0);for(c=t.multiply(t.multiply(t.inv(t.add(m,f)),p),-1),l=t.multiply(t.inv(t.add(m,f)),i),a=o,u=t.add(t.multiply(c,o),l),d=2;e.abs(t.norm(t.subtract(u,a)))>r;)a=u,u=t.add(t.multiply(c,a),l),d+=1;return u},SOR:function(n,i,o,r,s){for(var a,l,c,u,d,h=0,f=n.length,p=[],m=[],g=[];h<f;h++)for(p[h]=[],m[h]=[],g[h]=[],a=0;a<f;a++)h>a?(p[h][a]=n[h][a],m[h][a]=g[h][a]=0):h<a?(m[h][a]=n[h][a],p[h][a]=g[h][a]=0):(g[h][a]=n[h][a],p[h][a]=m[h][a]=0);for(u=t.multiply(t.inv(t.add(g,t.multiply(p,s))),t.subtract(t.multiply(g,1-s),t.multiply(m,s))),c=t.multiply(t.multiply(t.inv(t.add(g,t.multiply(p,s))),i),s),l=o,d=t.add(t.multiply(u,o),c),h=2;e.abs(t.norm(t.subtract(d,l)))>r;)l=d,d=t.add(t.multiply(u,l),c),h++;return d},householder:function(n){for(var i,o,r,s,a=n.length,l=n[0].length,c=0,u=[],d=[];c<a-1;c++){for(i=0,s=c+1;s<l;s++)i+=n[s][c]*n[s][c];for(i=(n[c+1][c]>0?-1:1)*e.sqrt(i),o=e.sqrt((i*i-n[c+1][c]*i)/2),(u=t.zeros(a,1))[c+1][0]=(n[c+1][c]-i)/(2*o),r=c+2;r<a;r++)u[r][0]=n[r][c]/(2*o);d=t.subtract(t.identity(a,l),t.multiply(t.multiply(u,t.transpose(u)),2)),n=t.multiply(d,t.multiply(n,d))}return n},QR:(n=t.sum,i=t.arange,function(o){var r,s,a,l=o.length,c=o[0].length,u=t.zeros(c,c);for(o=t.copy(o),s=0;s<c;s++){for(u[s][s]=e.sqrt(n(i(l).map((function(t){return o[t][s]*o[t][s]})))),r=0;r<l;r++)o[r][s]=o[r][s]/u[s][s];for(a=s+1;a<c;a++)for(u[s][a]=n(i(l).map((function(t){return o[t][s]*o[t][a]}))),r=0;r<l;r++)o[r][a]=o[r][a]-o[r][s]*u[s][a]}return[o,u]}),lstsq:function(e,n){var i=!1;void 0===n[0].length&&(n=n.map((function(t){return[t]})),i=!0);var o=t.QR(e),r=o[0],s=o[1],a=e[0].length,l=t.slice(r,{col:{end:a}}),c=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(o){var r=t.multiply(e[o][n],-1),s=t.slice(e,{row:o}),a=t.multiply(t.slice(e,{row:n}),r);t.sliceAssign(e,{row:o},t.add(s,a));var l=t.slice(i,{row:o}),c=t.multiply(t.slice(i,{row:n}),r);t.sliceAssign(i,{row:o},t.add(l,c))}))})),i}(t.slice(s,{row:{end:a}})),u=t.transpose(l);void 0===u[0].length&&(u=[u]);var d=t.multiply(t.multiply(c,u),n);return void 0===d.length&&(d=[[d]]),i?d.map((function(t){return t[0]})):d},jacobi:function(n){for(var i,o,r,s,a,l,c,u=1,d=n.length,h=t.identity(d,d),f=[];1===u;){for(a=n[0][1],r=0,s=1,i=0;i<d;i++)for(o=0;o<d;o++)i!=o&&a<e.abs(n[i][o])&&(a=e.abs(n[i][o]),r=i,s=o);for(l=n[r][r]===n[s][s]?n[r][s]>0?e.PI/4:-e.PI/4:e.atan(2*n[r][s]/(n[r][r]-n[s][s]))/2,(c=t.identity(d,d))[r][r]=e.cos(l),c[r][s]=-e.sin(l),c[s][r]=e.sin(l),c[s][s]=e.cos(l),h=t.multiply(h,c),n=t.multiply(t.multiply(t.inv(c),n),c),u=0,i=1;i<d;i++)for(o=1;o<d;o++)i!=o&&e.abs(n[i][o])>.001&&(u=1)}for(i=0;i<d;i++)f.push(n[i][i]);return[h,f]},rungekutta:function(t,e,n,i,o,r){var s,a,l;if(2===r)for(;i<=n;)o+=((s=e*t(i,o))+(a=e*t(i+e,o+s)))/2,i+=e;if(4===r)for(;i<=n;)o+=((s=e*t(i,o))+2*(a=e*t(i+e/2,o+s/2))+2*(l=e*t(i+e/2,o+a/2))+e*t(i+e,o+l))/6,i+=e;return o},romberg:function(t,n,i,o){for(var r,s,a,l,c,u=0,d=(i-n)/2,h=[],f=[],p=[];u<o/2;){for(c=t(n),a=n,l=0;a<=i;a+=d,l++)h[l]=a;for(r=h.length,a=1;a<r-1;a++)c+=(a%2!=0?4:2)*t(h[a]);c=d/3*(c+t(i)),p[u]=c,d/=2,u++}for(s=p.length,r=1;1!==s;){for(a=0;a<s-1;a++)f[a]=(e.pow(4,r)*p[a+1]-p[a])/(e.pow(4,r)-1);s=f.length,p=f,f=[],r++}return p},richardson:function(t,n,i,o){function r(t,e){for(var n,i=0,o=t.length;i<o;i++)t[i]===e&&(n=i);return n}for(var s,a,l,c,u,d=e.abs(i-t[r(t,i)+1]),h=0,f=[],p=[];o>=d;)s=r(t,i+o),a=r(t,i),f[h]=(n[s]-2*n[a]+n[2*a-s])/(o*o),o/=2,h++;for(c=f.length,l=1;1!=c;){for(u=0;u<c-1;u++)p[u]=(e.pow(4,l)*f[u+1]-f[u])/(e.pow(4,l)-1);c=p.length,f=p,p=[],l++}return f},simpson:function(t,e,n,i){for(var o,r=(n-e)/i,s=t(e),a=[],l=e,c=0,u=1;l<=n;l+=r,c++)a[c]=l;for(o=a.length;u<o-1;u++)s+=(u%2!=0?4:2)*t(a[u]);return r/3*(s+t(n))},hermite:function(t,e,n,i){for(var o,r=t.length,s=0,a=0,l=[],c=[],u=[],d=[];a<r;a++){for(l[a]=1,o=0;o<r;o++)a!=o&&(l[a]*=(i-t[o])/(t[a]-t[o]));for(c[a]=0,o=0;o<r;o++)a!=o&&(c[a]+=1/(t[a]-t[o]));u[a]=(1-2*(i-t[a])*c[a])*(l[a]*l[a]),d[a]=(i-t[a])*(l[a]*l[a]),s+=u[a]*e[a]+d[a]*n[a]}return s},lagrange:function(t,e,n){for(var i,o,r=0,s=0,a=t.length;s<a;s++){for(o=e[s],i=0;i<a;i++)s!=i&&(o*=(n-t[i])/(t[s]-t[i]));r+=o}return r},cubic_spline:function(e,n,i){for(var o,r,s=e.length,a=0,l=[],c=[],u=[],d=[],h=[],f=[];a<s-1;a++)d[a]=e[a+1]-e[a];for(u[0]=0,a=1;a<s-1;a++)u[a]=3/d[a]*(n[a+1]-n[a])-3/d[a-1]*(n[a]-n[a-1]);for(a=1;a<s-1;a++)l[a]=[],c[a]=[],l[a][a-1]=d[a-1],l[a][a]=2*(d[a-1]+d[a]),l[a][a+1]=d[a],c[a][0]=u[a];for(r=t.multiply(t.inv(l),c),o=0;o<s-1;o++)h[o]=(n[o+1]-n[o])/d[o]-d[o]*(r[o+1][0]+2*r[o][0])/3,f[o]=(r[o+1][0]-r[o][0])/(3*d[o]);for(o=0;o<s&&!(e[o]>i);o++);return n[o-=1]+(i-e[o])*h[o]+t.sq(i-e[o])*r[o]+(i-e[o])*t.sq(i-e[o])*f[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(e){var n,i,o,r,s,a=e.length,l=e[0].length,c=0,u=[],d=[],h=[],f=[],p=[],m=[],g=[];for(c=0;c<a;c++)u[c]=t.sum(e[c])/l;for(c=0;c<l;c++)for(p[c]=[],n=0;n<a;n++)p[c][n]=e[n][c]-u[n];for(p=t.transpose(p),c=0;c<a;c++)for(m[c]=[],n=0;n<a;n++)m[c][n]=t.dot([p[c]],[p[n]])/(l-1);for(s=(o=t.jacobi(m))[0],d=o[1],g=t.transpose(s),c=0;c<d.length;c++)for(n=c;n<d.length;n++)d[c]<d[n]&&(i=d[c],d[c]=d[n],d[n]=i,h=g[c],g[c]=g[n],g[n]=h);for(r=t.transpose(p),c=0;c<a;c++)for(f[c]=[],n=0;n<r.length;n++)f[c][n]=t.dot([g[c]],[r[n]]);return[e,d,g,f]}}),function(e){for(var n=0;n<e.length;n++)!function(e){t.fn[e]=function(n,i){var o=this;return i?(setTimeout((function(){i.call(o,t.fn[e].call(o,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,o=t.utils.isArray;function r(t,n,i,o){if(t>1||i>1||t<=0||i<=0)throw new Error("Proportions should be greater than 0 and less than 1");var r=(t*n+i*o)/(n+o);return(t-i)/e.sqrt(r*(1-r)*(1/n+1/o))}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,r=n.call(arguments);return o(r[1])?(i=t.zscore(r[0],r[1],r[3]),1===r[2]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):r.length>2?(i=t.zscore(r[0],r[1],r[2]),1===r[3]?t.normal.cdf(-e.abs(i),0,1):2*t.normal.cdf(-e.abs(i),0,1)):(i=r[0],1===r[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,o){var r=e.abs(this.zscore(n,o));return 1===i?t.normal.cdf(-r,0,1):2*t.normal.cdf(-r,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 o,r=n.call(arguments);return 5===r.length?(o=e.abs(t.tscore(r[0],r[1],r[2],r[3])),1===r[4]?t.studentt.cdf(-o,r[3]-1):2*t.studentt.cdf(-o,r[3]-1)):i(r[1])?(o=e.abs(r[0]),1==r[2]?t.studentt.cdf(-o,r[1]-1):2*t.studentt.cdf(-o,r[1]-1)):(o=e.abs(t.tscore(r[0],r[1])),1==r[2]?t.studentt.cdf(-o,r[1].length-1):2*t.studentt.cdf(-o,r[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,o,r,s,a,l,c,u,d=n.call(arguments);if(1===d.length){for(a=new Array(d[0].length),c=0;c<d[0].length;c++)a[c]=d[0][c];d=a}for(o=new Array,c=0;c<d.length;c++)o=o.concat(d[c]);for(r=t.mean(o),i=0,c=0;c<d.length;c++)i+=d[c].length*e.pow(t.mean(d[c])-r,2);for(i/=d.length-1,l=0,c=0;c<d.length;c++)for(s=t.mean(d[c]),u=0;u<d[c].length;u++)l+=e.pow(d[c][u]-s,2);return i/(l/(o.length-d.length))},anovaftest:function(){var e,o,r,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,r=0,s=0;s<a.length;s++)r+=a[s].length;return o=r-e-1,1-t.centralF.cdf(l,e,o)},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 o,r,s,a,l,c=n.call(arguments);return i(c[0])?(o=c[0],r=c[1],s=c[2],a=c[3],l=c[4]):(o=t.mean(c[0]),r=t.mean(c[1]),s=c[0].length,a=c[1].length,l=c[2]),e.abs(o-r)/(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 o=i[0],r=i[1];return 1-t.tukey.cdf(e,r,o-r)},tukeyhsd:function(e){for(var n=t.pooledstdev(e),i=e.map((function(e){return t.mean(e)})),o=e.reduce((function(t,e){return t+e.length}),0),r=[],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,o,e.length);r.push([[s,a],l])}return r}}),t.extend({normalci:function(){var i,o=n.call(arguments),r=new Array(2);return i=4===o.length?e.abs(t.normal.inv(o[1]/2,0,1)*o[2]/e.sqrt(o[3])):e.abs(t.normal.inv(o[1]/2,0,1)*t.stdev(o[2])/e.sqrt(o[2].length)),r[0]=o[0]-i,r[1]=o[0]+i,r},tci:function(){var i,o=n.call(arguments),r=new Array(2);return i=4===o.length?e.abs(t.studentt.inv(o[1]/2,o[3]-1)*o[2]/e.sqrt(o[3])):e.abs(t.studentt.inv(o[1]/2,o[2].length-1)*t.stdev(o[2],!0)/e.sqrt(o[2].length)),r[0]=o[0]-i,r[1]=o[0]+i,r},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,o){var s=r(e,n,i,o);return t.ztest(s,1)},twoSidedDifferenceOfProportions:function(e,n,i,o){var s=r(e,n,i,o);return t.ztest(s,2)}})}(e,Math),e.models=function(){function t(t,n){var i=t.length,o=n[0].length-1,r=i-o-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),c=e.mean(t),u=e.sum(a.map((function(t){return Math.pow(t-c,2)}))),d=e.sum(t.map((function(t,e){return Math.pow(t-a[e],2)}))),h=u+d;return{exog:n,endog:t,nobs:i,df_model:o,df_resid:r,coef:s,predict:a,resid:l,ybar:c,SST:h,SSE:u,SSR:d,R2:u/h}}function n(n){var i,o,r=(i=n.exog,o=i[0].length,e.arange(o).map((function(n){var r=e.arange(o).filter((function(t){return t!==n}));return t(e.col(i,n).map((function(t){return t[0]})),e.col(i,r))}))),s=Math.sqrt(n.SSR/n.df_resid),a=r.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]})),c=l.map((function(t){var i=e.studentt.cdf(t,n.df_resid);return 2*(i>.5?1-i:i)})),u=e.studentt.inv(.975,n.df_resid),d=n.coef.map((function(t,e){var n=u*a[e];return[t-n,t+n]}));return{se:a,t:l,p:c,sigmaHat:s,interval95:d}}return{ols:function(i,o){var r=t(i,o),s=n(r),a=function(t){var n,i,o,r=t.R2/t.df_model/((1-t.R2)/t.df_resid);return{F_statistic:r,pvalue:1-(n=r,i=t.df_model,o=t.df_resid,e.beta.cdf(n/(o/i+n),i/2,o/2))}}(r),l=1-(1-r.R2)*((r.nobs-1)/r.df_resid);return r.t=s,r.f=a,r.adjust_R2=l,r}}}(),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,o,r,s,a;if(t.cols()==n.rows()){if(n.rows()>1){for(s=[],i=0;i<t.rows();i++)for(s[i]=[],o=0;o<n.cols();o++){for(a=0,r=0;r<t.cols();r++)a+=t.toArray()[i][r]*n.toArray()[r][o];s[i][o]=a}return e(s)}for(s=[],i=0;i<t.rows();i++)for(s[i]=[],o=0;o<n.cols();o++){for(a=0,r=0;r<t.cols();r++)a+=t.toArray()[i][r]*n.toArray()[o];s[i][o]=a}return e(s)}},regress:function(t,n){var i=e.xtranspxinv(t),o=t.transpose(),r=e.matrixmult(e(i),o);return e.matrixmult(r,n)},regresst:function(t,n,i){var o=e.regress(t,n),r={anova:{}},s=e.jMatYBar(t,o);r.yBar=s;var a=n.mean();r.anova.residuals=e.residuals(n,s),r.anova.ssr=e.ssr(s,a),r.anova.msr=r.anova.ssr/(t[0].length-1),r.anova.sse=e.sse(n,s),r.anova.mse=r.anova.sse/(n.length-(t[0].length-1)-1),r.anova.sst=e.sst(n,a),r.anova.mst=r.anova.sst/(n.length-1),r.anova.r2=1-r.anova.sse/r.anova.sst,r.anova.r2<0&&(r.anova.r2=0),r.anova.fratio=r.anova.msr/r.anova.mse,r.anova.pvalue=e.anovaftest(r.anova.fratio,t[0].length-1,n.length-(t[0].length-1)-1),r.anova.rmse=Math.sqrt(r.anova.mse),r.anova.r2adj=1-r.anova.mse/r.anova.mst,r.anova.r2adj<0&&(r.anova.r2adj=0),r.stats=new Array(t[0].length);for(var l,c,u,d=e.xtranspxinv(t),h=0;h<o.length;h++)l=Math.sqrt(r.anova.mse*Math.abs(d[h][h])),c=Math.abs(o[h]/l),u=e.ttest(c,n.length-t[0].length-1,i),r.stats[h]=[o[h],l,c,u];return r.regress=o,r},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),o=0;o<t.length;o++){i[o]=new Array(t[o].length);for(var r=0;r<t[o].length;r++)i[o][r]=t[o][r]-n[o][r]}return e(i)}}),e.jStat=e,e)},4788:(t,e,n)=>{"use strict";var i=n(5072),o=n.n(i),r=n(7825),s=n.n(r),a=n(7659),l=n.n(a),c=n(5056),u=n.n(c),d=n(540),h=n.n(d),f=n(1113),p=n.n(f),m=n(365),g={};g.styleTagTransform=p(),g.setAttributes=u(),g.insert=l().bind(null,"head"),g.domAPI=s(),g.insertStyleElement=h(),o()(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 r={},s=[],a=0;a<t.length;a++){var l=t[a],c=i.base?l[0]+i.base:l[0],u=r[c]||0,d="".concat(c," ").concat(u);r[c]=u+1;var h=n(d),f={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)e[h].references++,e[h].updater(f);else{var p=o(f,i);i.byIndex=a,e.splice(a,0,{identifier:d,updater:p,references:1})}s.push(d)}return s}function o(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,o){var r=i(t=t||[],o=o||{});return function(t){t=t||[];for(var s=0;s<r.length;s++){var a=n(r[s]);e[a].references--}for(var l=i(t,o),c=0;c<r.length;c++){var u=n(r[c]);0===e[u].references&&(e[u].updater(),e.splice(u,1))}r=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 o=void 0!==n.layer;o&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,o&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var r=n.sourceMap;r&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),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:()=>B,q:()=>F});var i,o=n(7389),r=n(4328),s=n(6082),a=n(2003),l=n(8223),c=n(3077),u=n(439);async function d(t,e,n,o,r){const a=(0,c.R)(e,r),d=r.getSeqHandler(e).getNewColumnFromList("ref",[n]),h=r.getSeqHandler(d).getSplitted(0),f=o===i.IDENTITY?function(t,e){const n=e.columns.length,i=new Array(n),o=new Array(n),r=new Array(n);for(let s=0;s<n;++s){const n=e.columns.byIndex(s);i[s]=n.getRawData(),o[s]=n.categories.indexOf("");const a=s<t.length?t.getOriginal(s):u._S;r[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)===r[e]&&++l[n];l[n]/=t.length}return a}(h,a):o===i.SIMILARITY?await async function(t,e,n){const i=e.columns.toList();return await(0,l.uL)(i,t,n)}(h,a,r):null;if(null===f)throw new Error(`In bio library: Unknown sequence scoring method: ${o}`);return f.name=t.columns.getUnusedName(f.name),t.columns.add(f),f}!function(t){t.IDENTITY="identity",t.SIMILARITY="similarity"}(i||(i={}));var h,f=n(8774),p=n(144),m=n.n(p),g=n(7233),v=n.n(g),y=n(4139),C=n(115),w=n(8608),b=n(3541),A=n(2935),E=n(7923),S=n(7654),x=n(5480),T=n(5429),_=n(3273),N=n(3657);!function(t){t.UMAP="UMAP",t.T_SNE="t-SNE"}(h||(h={}));var M,O,L,I,R,P,k;n(5540),n(4329),(O=M||(M={})).EUCLIDEAN="EUCLIDEAN",O.MANHATTAN="MANHATTAN",M.EUCLIDEAN,M.MANHATTAN,(I=L||(L={})).HAMMING="Hamming",I.EUCLIDEAN="Euclidean",I.MANHATTAN="Manhattan",I.TANIMOTO="Tanimoto",I.LEVENSTEIN="Levenshtein",I.NEEDLEMAN_WUNSCH="Needlemann-Wunsch",I.MONOMER_CHEMICAL_DISTANCE="Monomer chemical distance",I.SOKAL="Sokal",I.COSINE="Cosine",I.ASYMMETRIC="Asymmetric",I.Difference="Difference",I.OneHot="One-Hot",L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.TANIMOTO,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.SOKAL,L.COSINE,L.ASYMMETRIC,L.Difference,L.OneHot,L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.TANIMOTO,L.SOKAL,L.COSINE,L.ASYMMETRIC,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.Difference,L.OneHot,new Set([L.HAMMING,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.MONOMER_CHEMICAL_DISTANCE,L.OneHot]),new Set([L.HAMMING,L.EUCLIDEAN,L.MANHATTAN,L.MONOMER_CHEMICAL_DISTANCE,L.LEVENSTEIN,L.NEEDLEMAN_WUNSCH,L.TANIMOTO,L.COSINE,L.SOKAL,L.ASYMMETRIC,L.OneHot,L.Difference]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.OneHot,L.Difference]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.Difference]),new Set([L.EUCLIDEAN,L.MANHATTAN,L.Difference]),new Set([L.TANIMOTO,L.COSINE,L.SOKAL,L.ASYMMETRIC]),function(t){t.ADD="ADD",t.SUB="SUB",t.MULT="MULT"}(R||(R={})),function(t){t.SQUARE="SQUARE",t.INVERSE="INVERSE",t.TRANSPOSE="TRANSPOSE",t.NORM="NORM",t.COLUMN_NORM="COLUMN_NORM"}(P||(P={})),function(t){t.SCALARMULT="SCALARMULT",t.SCALARADD="SCALARADD",t.SCALARPOW="SCALARPOW"}(k||(k={})),Object.prototype.toString,Promise.resolve(),n(934),n(8903);var G,D,U=n(1858);!function(t){t.none="none",t.bold="bold",t.dashed="dashed"}(G||(G={}));class V{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,o=G.none){var r;this._currentLineIdx=-1,this.lineClicked=new U.Subject,this.lineHover=new U.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=o,this.updateLines(i),this.visibility=null!==(r=i.visibility)&&void 0!==r?r:new f.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,o,r,s,a,l,c,u,d,h,f,p,m,g;const v=this.lines.colors||this.lines.widths||this.lines.opacities||this.lines.drawArrowsArr;v||(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 y=this.sp.dataFrame.filter,C=Math.pow(null!==(i=this.lines.shortLineThreshold)&&void 0!==i?i:5,2);for(let t=0;t<this.lines.from.length;t++)if(y.get(this.lines.from[t])&&y.get(this.lines.to[t])&&this.visibility.getBit(t)){let e=0;const n=this.sp.getMarkerSize(this.lines.from[t])/2,i=this.sp.getMarkerSize(this.lines.to[t])/2,y=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[t]),this.yAxisCol.get(this.lines.from[t]));let w=null==y?void 0:y.x,b=null==y?void 0:y.y;const A=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[t]),this.yAxisCol.get(this.lines.to[t]));let E=null==A?void 0:A.x,S=null==A?void 0:A.y;const x=Math.min(this.sp.viewBox.width,this.sp.viewBox.height);if(this.ctx.beginPath(),w&&b&&E&&S&&Math.hypot(E-w,S-b)/x>.01){if(v){const e=(null===(o=this.lines.colors)||void 0===o?void 0:o[t])?null===(r=this.lines.colors)||void 0===r?void 0:r[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!==(c=this.lines.opacity)&&void 0!==c?c:1;this.ctx.strokeStyle=`rgba(${e},${n})`,this.ctx.lineWidth=(null===(u=this.lines.widths)||void 0===u?void 0:u[t])?null===(d=this.lines.widths)||void 0===d?void 0:d[t]:null!==(h=this.lines.width)&&void 0!==h?h:1}t===this._currentLineIdx&&this.toggleCurrentLineStyle(!0);const y=this.multipleLinesCounts[t];let A=null;if(y){e=this.getLineLength(w,b,E,S);const o=this.getPointOnDistance(w,b,E,S,i,e),r=this.getPointOnDistance(E,S,w,b,n,e);w=o.x,b=o.y,E=r.x,S=r.y,A=this.lines.from[t]>this.lines.to[t]?this.findControlPoint(y,w,b,E,S,t):this.findControlPoint(y,E,S,w,b,t),this.ctx.moveTo(w,b),this.ctx.quadraticCurveTo(A.x,A.y,E,S)}else(!this.lines.skipShortLines||Math.pow(E-w,2)+Math.pow(S-b,2)>C)&&(this.ctx.moveTo(w,b),this.ctx.lineTo(E,S));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(w,b,E,S)),e>this.arrowWidth)){const t=y?null:this.getPointOnDistance(w,b,E,S,i,e),n=y?A.x:w,o=y?A.y:b;this.canvasArrow(this.ctx,null!==(m=null==t?void 0:t.x)&&void 0!==m?m:w,null!==(g=null==t?void 0:t.y)&&void 0!==g?g:b,n,o)}this.ctx.stroke(),this.ctx.closePath(),t===this._currentLineIdx&&this.toggleCurrentLineStyle(!1)}}this.fillLeftBottomRect()}toggleCurrentLineStyle(t){switch(this.currentLineStyle){case G.bold:t?this.ctx.lineWidth+=2:this.ctx.lineWidth-=2;break;case G.dashed:t?this.ctx.setLineDash([5,5]):this.ctx.setLineDash([]);break;default:return}}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,o=null;const r=this.sp.dataFrame.filter;for(let s=0;s<this.lines.from.length;s++)if(r.get(this.lines.from[s])&&r.get(this.lines.to[s])&&this.visibility.getBit(s)){const r=this.sp.getMarkerSize(this.lines.from[s])/2,a=this.sp.getMarkerSize(this.lines.to[s])/2,l=this.sp.worldToScreen(this.xAxisCol.get(this.lines.from[s]),this.yAxisCol.get(this.lines.from[s])),c=this.sp.worldToScreen(this.xAxisCol.get(this.lines.to[s]),this.yAxisCol.get(this.lines.to[s]));if(this.multipleLinesCounts[s]){const n=this.getLineLength(l.x,l.y,c.x,c.y),i=this.getPointOnDistance(l.x,l.y,c.x,c.y,a,n),u=this.getPointOnDistance(c.x,c.y,null==l?void 0:l.x,null==l?void 0:l.y,r,n),d=this.lines.from[s]>this.lines.to[s]?this.findControlPoint(this.multipleLinesCounts[s],i.x,i.y,u.x,u.y,s):this.findControlPoint(this.multipleLinesCounts[s],u.x,u.y,i.x,i.y,s);o=this.calculateDistToCurveLine(s,t,e,i,u,d)}else o=this.calculateDistToStraightLine(t,e,l,c);(!i&&null!==o&&o<5||i&&null!==o&&o<i)&&(i=o,n=s)}return n}calculateDistToStraightLine(t,e,n,i){const o=Math.min(n.x,i.x),r=Math.max(n.x,i.x),s=Math.min(n.y,i.y),a=Math.max(n.y,i.y);return t>=o-2&&t<=r+2&&e>=s-2&&e<=a+2?this.distToStraightLineSegment(t,e,n,i):null}distToStraightLineSegment(t,e,n,i){const o=(t,e,n,i)=>Math.pow(t-n,2)+Math.pow(e-i,2),r=o(n.x,n.y,i.x,i.y);if(0==r)return o(t,e,n.x,n.y);let s=((t-n.x)*(i.x-n.x)+(e-n.y)*(i.y-n.y))/r;return s=Math.max(0,Math.min(1,s)),o(t,e,n.x+s*(i.x-n.x),n.y+s*(i.y-n.y))}calculateDistToCurveLine(t,e,n,i,o,r){const s=Math.min(i.x,o.x,r.x),a=Math.max(i.x,o.x,r.x),l=Math.min(i.y,o.y,r.y),c=Math.max(i.y,o.y,r.y);if(e>=s-2&&e<=a+2&&n>=l-2&&n<=c+2){const t=a-s,u=c-l;return this.calculateDistToCurveInRect(e,n,i,r,o,t,u)}return null}calculateDistToCurveInRect(t,e,n,i,o,r,s){const a=Math.floor((r+s)/3),l=1/a,c=new Uint32Array(a),u=new Uint32Array(a),d=new Uint32Array(a);let h=null;const p=new f.A(a);for(let r=0;r<c.length;r++){const s=r*l,a=Math.pow(1-s,2)*n.x+2*s*(1-s)*i.x+Math.pow(s,2)*o.x,f=Math.pow(1-s,2)*n.y+2*s*(1-s)*i.y+Math.pow(s,2)*o.y,p=Math.abs(t-a),m=Math.abs(e-f),g=p+m;(!h||h>g)&&(h=g),d[r]=Math.max(p,m),c[r]=a,u[r]=f}for(let t=0;t<c.length;t++)d[t]<h&&p.setBit(t,!0,!1);let m=null;for(let n=-1;-1!==(n=p.findNext(n));){const i=Math.hypot(c[n]-t,u[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,o,r){const a=n-o*((n-t)/r),l=i-o*((i-e)/r);return new s.Point(a,l)}findControlPoint(t,e,n,i,o,r){const a=e+(i-e)/2,l=n+(o-n)/2;let c=a-e,u=l-n;const d=Math.sqrt(c*c+u*u);c/=d,u/=d;const h=50*Math.ceil(t/2);return t%2==0?new s.Point(a+h/2*u,l-h/2*c):new s.Point(a-h/2*u,l+h/2*c)}canvasArrow(t,e,n,i,o){const r=Math.atan2(i-e,o-n)+Math.PI;t.moveTo(e-this.arrowWidth*Math.sin(r-Math.PI/10),n-this.arrowWidth*Math.cos(r-Math.PI/10)),t.lineTo(e,n),t.lineTo(e-this.arrowWidth*Math.sin(r+Math.PI/10),n-this.arrowWidth*Math.cos(r+Math.PI/10))}}!function(t){t.EUCLIDEAN="EUCLIDEAN",t.MANHATTAN="MANHATTAN"}(D||(D={}));var F,H=n(726),q=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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"}(F||(F={}));class B{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,N.Ej)(e,this.df.filter,this.positionColumns)),this._monomerPositionStats)}get analysisView(){return void 0===this._analysisView&&(this._analysisView=m()(r.shell.tableViews).find((({dataFrame:t})=>(null==t?void 0:t.getTag(s.TAGS.ID))===this.id)),void 0===this._analysisView&&(this._analysisView=r.shell.addTableView(this.df))),"1"===this.df.getTag(y.gp.MULTIPLE_VIEWS)||this._layoutEventInitialized||r.shell.isInDemo||(r.shell.v=this._analysisView),this._analysisView.grid.invalidate(),this._analysisView}get settings(){var t;const e=this.df.getTag(y.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 o=Object.entries(t),r=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 o)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])=>r[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,w.ZR)(this.positionColumns),this.webLogoBounds={},this.cachedWebLogoTooltip={bar:"",tooltip:null},this._monomerPositionStats=null;break;case"dendrogram":this.settings.showDendrogram?this.addDendrogram():this.closeViewer(F.DENDROGRAM);break;case"clusterMaxActivity":this.settings.showClusterMaxActivity?this.addClusterMaxActivityViewer():this.closeViewer(F.CLUSTER_MAX_ACTIVITY);break;case"logoSummaryTable":this.settings.showLogoSummaryTable?this.addLogoSummaryTable():this.closeViewer(F.LOGO_SUMMARY_TABLE);break;case"monomerPosition":this.settings.showMonomerPosition?this.addMonomerPosition():this.closeViewer(F.SEQUENCE_VARIABILITY_MAP);break;case"mostPotentResidues":this.settings.showMostPotentResidues?this.addMostPotentResidues():this.closeViewer(F.MOST_POTENT_RESIDUES);break;case"columns":const t=this.findViewer(F.LOGO_SUMMARY_TABLE);t._viewerGrid=null,t._logoSummaryTable=null,t.render();const e=this.findViewer(F.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(`${y.YX.WL}${y.gp.INVARIANT_MAP_SELECTION}`);return null!==(t=this._webLogoSelection)&&void 0!==t||(this._webLogoSelection=null===e&&null!==this.positionColumns?(0,w.ZR)(this.positionColumns):JSON.parse(null!=e?e:"{}")),this._webLogoSelection}set webLogoSelection(t){this._webLogoSelection=t,this.df.setTag(`${y.YX.WL}${y.gp.INVARIANT_MAP_SELECTION}`,JSON.stringify(t)),this.fireBitsetChanged(null),this.analysisView.grid.invalidate()}get positionColumns(){const t=m()(this.df.columns.byTags({[y.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(y.$2.ACTIVITY_SCALED)&&!t.columns.contains(y.$2.ACTIVITY)&&(t.getCol(y.$2.ACTIVITY_SCALED).name=y.$2.ACTIVITY),null!==(e=(n=t.temp)[i=B.modelName])&&void 0!==e||(n[i]=new B(t)),t.temp[B.modelName]}modifyWebLogoSelection(t,e={shiftPressed:!1,ctrlPressed:!1},n=!0){n?this.webLogoSelection=(0,w.vW)(this.webLogoSelection,t,e):this._webLogoSelection=(0,w.vW)(this.webLogoSelection,t,e)}getVisibleSelection(){return this.df.selection.clone().and(this.df.filter)}createAccordion(){var t,e,n,i,l,c;const u=null===(t=r.shell.t)||void 0===t?void 0:t.temp[B.modelName];if(!u)return null;const d=o.accordion("Peptides analysis panel");d.root.style.width="100%";const h=u.getVisibleSelection(),f=u.df.filter.anyFalse?` among ${u.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(", ")},g=u.findViewer(F.LOGO_SUMMARY_TABLE),y=[],C=(null===g?[]:g.clusterSelection[x.W.ORIGINAL].concat(g.clusterSelection[x.W.CUSTOM])).join(", ");0!==C.length&&(y.push(o.h1("Logo summary table selection")),y.push(o.divText(`Selected clusters: ${C}`)));const T=u.findViewer(F.SEQUENCE_VARIABILITY_MAP),_=p(null!==(e=null==T?void 0:T.invariantMapSelection)&&void 0!==e?e:{}),M=p(null!==(n=null==T?void 0:T.mutationCliffsSelection)&&void 0!==n?n:{});0===_.length&&0===M.length||y.push(o.h1("Sequence Variabily Map viewer selection")),0!==_.length&&y.push(o.divText(`Selected monomer-positions: ${_}`)),0!==M.length&&y.push(o.divText(`Selected mutation cliffs pairs: ${M}`));const O=u.findViewer(F.MOST_POTENT_RESIDUES),L=p(null!==(i=null==O?void 0:O.mutationCliffsSelection)&&void 0!==i?i:{});0!==L.length&&(y.push(o.h1("Most Potent Residues viewer selection")),y.push(o.divText(`Selected monomer-positions: ${L}`)));const I=p(u.webLogoSelection);0!==I.length&&(y.push(o.h1("WebLogo selection")),y.push(o.divText(`Selected monomers: ${I}`)));const R=o.div(o.divV(y));d.addTitle(o.divV([o.h1(`${h.trueCount} selected rows${f}`),R],"css-gap-small")),h.anyTrue&&d.addPane("Actions",(()=>{try{const t=o.label("New view");if(v()(t).addClass("d4-link-action"),t.onclick=()=>u.createNewView(),t.onmouseover=t=>o.tooltip.show("Creates a new view from current selection",t.clientX+5,t.clientY+5),null===g)return o.divV([t]);const e=o.label("New cluster");v()(e).addClass("d4-link-action"),e.onclick=()=>{if(null===g)throw new Error("Logo summary table viewer is not found");g.clusterFromSelection()},e.onmouseover=t=>o.tooltip.show("Creates a new cluster from selection",t.clientX+5,t.clientY+5);const n=o.label("Remove cluster");return v()(n).addClass("d4-link-action"),n.onclick=()=>{const t=u.findViewer(F.LOGO_SUMMARY_TABLE);if(null===t)throw new Error("Logo summary table viewer is not found");t.removeCluster()},n.onmouseover=t=>o.tooltip.show("Removes currently selected custom cluster",t.clientX+5,t.clientY+5),n.style.visibility=0===g.clusterSelection[x.W.CUSTOM].length?"hidden":"visible",o.divV([t,e,n])}catch(t){const e=o.divText("Error in Actions");return o.tooltip.bind(e,String(t)),e}}),!0);let P=u.settings;const k=[T,O,g].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!==u.settings&&k.push(u.settings);const G=k.filter((t=>null!==t&&(0,w.$s)(P,t)&&(t!==u.settings||u.isInitialized)));G.push(P);const D=s.BitSet.create(u.df.rowCount);for(const t of G){const e=t===this.settings?(0,w.KT)(this.webLogoSelection,this.monomerPositionStats):t instanceof x.s?(0,w.KT)(t.clusterSelection,t.clusterStats):t instanceof b.xN?(0,w.KT)(t.mutationCliffsSelection,(0,w.qI)(null!==(l=t.mutationCliffs)&&void 0!==l?l:new Map,u.df.rowCount)):null;if(null!==e&&D.or(e),t instanceof b.J){const e=(0,w.KT)(t.invariantMapSelection,t.monomerPositionStats);null!==e&&D.or(e)}}const U=P;P===u.settings||U instanceof x.s||null==U.mutationCliffs||d.addPane("Mutation Cliffs pairs",(()=>(0,E.F)(u.df,{mutationCliffs:U.mutationCliffs,mutationCliffsSelection:U.mutationCliffsSelection,gridColumns:u.analysisView.grid.columns,sequenceColumnName:U.sequenceColumnName,positionColumns:U.positionColumns,activityCol:U.getScaledActivityColumn()}).root),!0);const V=P===u.settings,q=V?this.webLogoSelection:P instanceof b.J?P.invariantMapSelection:{},Y=P instanceof x.s?P.clusterSelection:null!==(c=null==g?void 0:g.clusterSelection)&&void 0!==c?c:{};d.addPane("Distribution",(()=>{var t;try{return(0,S.HV)(u.df,{peptideSelection:D,columns:V?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityCol:V?u.getScaledActivityColumn():P.getScaledActivityColumn(),monomerPositionSelection:q,clusterSelection:Y,clusterColName:null==g?void 0:g.clustersColumnName})}catch(t){const e=o.divText("Error in Distribution");return o.tooltip.bind(e,String(t)),e}}),!0);const $=(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 d.addPane("Selection",(()=>{var t;try{return function(t,e){var n,i;if(0===e.tableSelection.trueCount)return o.divText("No compounds selected");const r=s.DataFrame.create(t.rowCount);r.name="Selected compounds",r.filter.copyFrom(e.tableSelection);const a=m()(t.columns.numerical);let l=null;for(let t=1;t<e.gridColumns.length;t++){const o=e.gridColumns.byIndex(t);if(!o.visible)continue;const c=o.column;if(c.type===s.COLUMN_TYPE.BOOL)continue;null===l&&o.grid&&(null===(n=o.grid.sortByColumns)||void 0===n?void 0:n.length)>0&&(null===(i=o.grid.sortTypes)||void 0===i?void 0:i.length)===o.grid.sortByColumns.length&&(l={cols:o.grid.sortByColumns,types:o.grid.sortTypes});let u=null,d=null;try{u=c.getRawData(),d=c.categories}catch(t){}const h=u&&d?a.some((t=>t.name===c.name))?t=>u[t]:t=>d[u[t]]:t=>c.get(t),f=c.name===e.activityColumn.name?r.columns.addNewFloat(o.name).init((t=>h(t))):r.columns.addNewVirtual(o.name,(t=>h(t)),c.type);for(const[t,e]of c.tags)f.setTag(t,e)}const c=r.plot.grid();c.props.showRowHeader=!1,c.root.style.maxWidth="100%",s.debounce(o.onSizeChanged(c.root),50).subscribe((t=>{var e;const n=c.root.parentElement;(null===(e=null==n?void 0:n.parentElement)||void 0===e?void 0:e.classList.contains("panel-content"))&&(c.root.style.height="calc(100% - 20px)",c.root.style.width="calc(100% - 20px)",c.root.style.position="absolute",c.root.style.right="10px",c.root.style.top="10px")})),(0,w.zz)(c);const u=o.box(c.root);u.style.marginLeft="0px",setTimeout((()=>{null!==l&&c.sort(l.cols,l.types);for(let t=1;t<e.gridColumns.length;t++){const n=e.gridColumns.byIndex(t);n.visible&&c.col(n.name)&&(c.col(n.name).width=n.width)}}),500);const d=(0,N.Ej)(e.activityColumn,r.filter,e.positionColumns,{isFiltered:r.filter.anyTrue||r.filter.anyFalse}),h={isSelectionTable:!0,cachedWebLogoTooltip:()=>({bar:"",tooltip:null}),webLogoBounds:()=>({}),colorPalette:()=>e.colorPalette},f={x:0,y:0,monomerPosition:{},mpStats:d};return e.isAnalysis&&(0,A.FZ)(c,d,e.positionColumns,e.activityColumn,h,f),u}(u.df,{positionColumns:V?u.positionColumns:P.positionColumns,columns:V?null!==(t=u.settings.columns)&&void 0!==t?t:{}:P.getAggregationColumns(),activityColumn:V?u.getScaledActivityColumn():P.getScaledActivityColumn(),gridColumns:u.analysisView.grid.columns,colorPalette:(0,a.SM)(u.df.getCol(V?u.settings.sequenceColumnName:P.sequenceColumnName),H.Z.getSeqHelper()),tableSelection:u.getCombinedSelection(),isAnalysis:null!==u.settings&&(V||$(u.settings.columns,P.getAggregationColumns()))})}catch(t){const e=o.divText("Error in Selection");return o.tooltip.bind(e,String(t)),e}}),!0),d}getScaledActivityColumn(t=!1){const e=this.df.col(y.$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),H.Z.getSeqHelper()),webLogoBounds:()=>this.webLogoBounds,cachedWebLogoTooltip:()=>this.cachedWebLogoTooltip,highlightCallback:(t,e,n)=>(0,w.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");A.FZ(this.analysisView.grid,this.monomerPositionStats,this.positionColumns,this.getScaledActivityColumn(),t),this._layoutEventInitialized||(r.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),H.Z.getSeqHelper()),i=n.columns.names();for(const t of i){let i=this.df.col(t);const o=n.getCol(t);null!==i&&e.remove(t);const r=o.categories,s=o.getRawData();i=e.addNew(o.name,o.type).init((t=>r[s[t]])),i.setTag(y.gp.ANALYSIS_COL,"true"),i.setTag(y.gp.POSITION_COL,"true"),A.rI(i,this.alphabet)}this.df.name=t}createScaledCol(){const t=this.analysisView.grid,e=(0,w.Y1)(this.df.getCol(this.settings.activityColumnName),this.settings.activityScaling);this.df.columns.replace(y.$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,o;return!(!t.isColHeader||(null===(i=t.tableColumn)||void 0===i?void 0:i.semType)!==y.uF.MONOMER)||!(!t.isTableCell||(null===(o=t.tableColumn)||void 0===o?void 0:o.semType)!==y.uF.MONOMER)}))}getCombinedSelection(){var t,e,n,i,o,r,a,l;const c=new f.A(this.df.rowCount,!1),u=(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 o=i[t];void 0!==o&&c.or(o.mask)}};u(this.webLogoSelection,this.monomerPositionStats);const d=this.findViewer(F.SEQUENCE_VARIABILITY_MAP);u(null!==(t=null==d?void 0:d.invariantMapSelection)&&void 0!==t?t:{},null!==(e=null==d?void 0:d.monomerPositionStats)&&void 0!==e?e:null);const h=(t,e)=>{var n,i;for(const[o,r]of Object.entries(t))for(const t of r){const r=null!==(i=null===(n=null==e?void 0:e.get(t))||void 0===n?void 0:n.get(o))&&void 0!==i?i:null;if(null!==r)for(const[t,e]of r.entries()){c.setTrue(t);for(const t of e)c.setTrue(t)}}};h(null!==(n=null==d?void 0:d.mutationCliffsSelection)&&void 0!==n?n:{},null!==(i=null==d?void 0:d.mutationCliffs)&&void 0!==i?i:null);const p=this.findViewer(F.MOST_POTENT_RESIDUES);h(null!==(o=null==p?void 0:p.mutationCliffsSelection)&&void 0!==o?o:{},null!==(r=null==p?void 0:p.mutationCliffs)&&void 0!==r?r:null);const m=this.findViewer(F.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];c.or(n.mask)}return s.BitSet.fromBytes(c.buffer.buffer,c.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;r.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){_._package.logger.debug("Peptides: Error on selection changed"),_._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(F.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){_._package.logger.debug("Peptides: Error on filter changed"),_._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,w.qx)(this.df)}setGridProperties(t){var e,n,i,o;const r=this.analysisView.grid,s=r.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!==(o=null==t?void 0:t.showCurrentRowIndicator)&&void 0!==o&&o;const l=this.positionColumns;if(null===l)throw new Error("PeptidesError: Could not set grid properties: positionColumns are null");let c=10;const u=r.canvas.getContext("2d");if(null===u)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(u.measureText(e).width);c=Math.max(c,n)}const d=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=d.includes(e.column.name)||e.column.name===y.$2.ACTIVITY}setTimeout((()=>{for(const t of l){const e=r.col(t.name);if(null===e)throw new Error(`PeptidesError: Could not set column width: grid column '${t.name}' is null`);e.width=c+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){_._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(y.gp.MULTIPLE_VIEWS)){const t=o.iconFA("wrench",(()=>(0,T.OH)(this)),"Peptides analysis settings");this.analysisView.setRibbonPanels([[t]],!1),this.isRibbonSet=!0,this.updateGrid()}this.subs.push(r.events.onAccordionConstructed.subscribe((t=>{if(!(r.shell.o instanceof s.SemanticValue||r.shell.o instanceof s.Column&&this.df.columns.toList().includes(r.shell.o)))return;const e=t.getPane("Actions"),n=v()(e.root).find(".d4-flex-col"),a=o.label("Calculate identity");a.classList.add("d4-link-action"),o.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,H.Z.getSeqHelper()).then((e=>e.setTag(y.gp.IDENTITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._package.logger.debug(t)))},n.append(o.span([a],"d4-markdown-row"));const l=o.label("Calculate similarity");l.classList.add("d4-link-action"),o.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,H.Z.getSeqHelper()).then((e=>e.setTag(y.gp.SIMILARITY_TEMPLATE,t.get(this.df.currentRowIdx)))).catch((t=>_._package.logger.debug(t)))},n.append(o.span([l],"d4-markdown-row"))}))),this.subs.push(r.events.onViewRemoved.subscribe((t=>{t.id===this.analysisView.id&&this.subs.forEach((t=>t.unsubscribe())),r.log.debug(`Peptides: view ${t.name} removed`)}))),this.subs.push(r.events.onTableRemoved.subscribe((t=>{t.id===this.df.id&&this.subs.forEach((t=>t.unsubscribe())),r.log.debug(`Peptides: table ${t.name} removed`)}))),this.subs.push(r.events.onProjectClosed.subscribe((t=>{t.id===r.shell.project.id&&this.subs.forEach((t=>t.unsubscribe())),r.log.debug(`Peptides: project ${t.name} closed`)}))),this.fireBitsetChanged(null,!0),this.analysisView.grid.invalidate()}}findViewer(t){return m()(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:m()(this.df.columns.categorical).next().value,activityColumnName:this.settings.activityColumnName,activityScaling:this.settings.activityScaling});const e=yield this.df.plot.fromType(F.LOGO_SUMMARY_TABLE,t);this.analysisView.dockManager.dock(e,s.DOCK_TYPE.RIGHT,null,F.LOGO_SUMMARY_TABLE),e.viewerGrid.invalidate()}))}addClusterMaxActivityViewer(t){return q(this,void 0,void 0,(function*(){var e,n,i,o,r,a,l;const c=null!==(o=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(F.LOGO_SUMMARY_TABLE))||void 0===i?void 0:i.clustersColumnName)&&void 0!==o?o:null===(r=this._sequenceSpaceCols)||void 0===r?void 0:r.find((t=>t.toLowerCase().startsWith("cluster")));null!=t||(t={activityColumnName:this.settings.activityColumnName,clusterColumnName:null!=c?c:null===(a=m()(this.df.columns.categorical).next().value)||void 0===a?void 0:a.name,activityTarget:y.wf.HIGH,connectivityColumnName:this._mclCols.find((t=>t.toLowerCase().startsWith("connectivity"))),clusterSizeThreshold:20,activityThreshold:1e3});const u=yield this.df.plot.fromType(F.CLUSTER_MAX_ACTIVITY,t),d=null!==(l=this.findViewerNode(F.LOGO_SUMMARY_TABLE))&&void 0!==l?l:null;this.analysisView.dockManager.dock(u,d?s.DOCK_TYPE.DOWN:s.DOCK_TYPE.RIGHT,d,F.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:y.wf.HIGH});const e=yield this.df.plot.fromType(F.SEQUENCE_VARIABILITY_MAP,t),n=this.findViewer(F.MOST_POTENT_RESIDUES),i=this.analysisView.dockManager,[o,r,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.LEFT,this.findViewerNode(F.MOST_POTENT_RESIDUES),.7];i.dock(e,o,r,F.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:y.wf.HIGH});const e=yield this.df.plot.fromType(F.MOST_POTENT_RESIDUES,t),n=this.findViewer(F.SEQUENCE_VARIABILITY_MAP),i=this.analysisView.dockManager,[o,r,a]=null===n?[s.DOCK_TYPE.DOWN,null,void 0]:[s.DOCK_TYPE.RIGHT,this.findViewerNode(F.SEQUENCE_VARIABILITY_MAP),.3];i.dock(e,o,r,F.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===y.gp.SETTINGS?n:"");e.name="Peptides Multiple Views",e.setTag(y.gp.MULTIPLE_VIEWS,"1");const n=r.shell.addTableView(e),i=this.findViewer(F.LOGO_SUMMARY_TABLE);return null!=i&&n.addViewer(F.LOGO_SUMMARY_TABLE,{[`sequence${y.To}`]:i.sequenceColumnName,[`activity${y.To}`]:i.activityColumnName,activityScaling:i.activityScaling,webLogoMode:i.webLogoMode,membersRatioThreshold:i.membersRatioThreshold,[`clusters${y.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 r.shell.warning("Embeddings columns are not initialized");const i=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("embed_")));if(2!==i.length)return void r.shell.warning(`Found ${i.length} embeddings columns, expected 2`);const o=this._sequenceSpaceCols.filter((t=>t.toLowerCase().startsWith("cluster")));o.length>0&&this.df.columns.remove(o[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,c=null!==(e=this.settings.sequenceSpaceParams.minPts)&&void 0!==e?e:4,u=yield function(t,e,i,o){return r=this,s=void 0,l=function*(){return new Promise((function(r,s){const a=new Worker(new URL(n.p+n.u(682),n.b));a.postMessage({embedX:t,embedY:e,minPts:o,epsilon:i}),a.onmessage=({data:{error:t,clusters:e}})=>{a.terminate(),t?s(t):r(e)}}))},new((a=void 0)||(a=Promise))((function(t,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function i(t){try{o(l.throw(t))}catch(t){e(t)}}function o(e){var o;e.done?t(e.value):(o=e.value,o instanceof a?o:new a((function(t){t(o)}))).then(n,i)}o((l=l.apply(r,s||[])).next())}));var r,s,a,l}(s,a,l,c),d=this.df.columns.getUnusedName("Cluster (DBSCAN)"),h=this.df.columns.addNewString(d);h.init((t=>u[t].toString())),null!==this._sequenceSpaceViewer&&(this._sequenceSpaceViewer.props.colorColumnName=h.name),this._sequenceSpaceCols=[i[0],i[1],h.name];const f=this.analysisView.grid.col(h.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 c=this.df.getCol(this.settings.sequenceColumnName);null!==(i=(l=this.settings).mclSettings)&&void 0!==i||(l.mclSettings=new C.av);const u=this.settings.mclSettings;let d=0;const h=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),d++}5===d&&h.unsubscribe()})),f=r.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,c,u,d=80,h=10,f=!1,p=2,m=5,g){const v=r.shell.tableView(t.name)??r.shell.addTableView(t),y=g??v.scatterPlot({showXAxis:!1,showYAxis:!1,showXSelector:!1,showYSelector:!1,title:"MCL"});o.setUpdateIndicator(y.root,!0);const C=[],w=[];for(let t=0;t<c.length;++t){const n=c[t];if(n){const o=n.inputs[0].name,r=n.inputs[1].name,{entries:s,options:a}=await n.apply({[o]:e[t],[r]:i[t],...u[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,o,r,s,a=10,l=!1,c=2){const u=new Worker(new URL(n.p+n.u(51),n.b));let d;return u.postMessage({data:t,threshold:e,weights:i,aggregationMethod:o,distanceFns:r,distanceFnArgs:s,maxIterations:a,useWebGPU:l,inflate:c}),{promise:new Promise(((t,e)=>{d=t,u.onmessage=e=>{setTimeout((()=>u.terminate()),100),t(e.data.res)},u.onerror=t=>{setTimeout((()=>u.terminate()),100),e(t)}})),terminate:()=>{try{d(null),u.terminate()}catch(t){console.error(t)}}}}(w.map((t=>t.entries)),d,a,l,i,C,h,f,p),A=r.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)"),x=t.columns.getUnusedName("EmbedX (MCL)"),T=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(x);L.init((t=>E.embedX[t]));const I=t.columns.addNewFloat(T);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=x,y.props.yColumnName=T,y.props.colorColumnName=S,y.props.markerDefaultSize=6,A.unsubscribe();const U=[],F=[],H=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){U.push(E.is[t]),F.push(E.js[t]);continue}if(e>n){const t=e;e=n,n=t}let i=H.get(e);i||(i=new Map,H.set(e,i));let o=i.get(n);o||(o=0),o>=20||(o++,i.set(n,o),U.push(E.is[t]),F.push(E.js[t]))}return new V(y,x,T,{from:new Uint32Array(U),to:new Uint32Array(F),drawArrows:!1,opacity:.3,skipMultiLineCalculation:!0,skipShortLines:!0,skipMouseOverDetection:!0,shortLineThreshold:6,width:.75,color:"128,128,128"},G.none),o.setUpdateIndicator(y.root,!1),{sc:y,embedXCol:L,embedYCol:I,clusterCol:R,clusterCounterCol:k,connectivityCol:D}}(this.df,[c],[u.distanceF],[1],D.MANHATTAN,[p],[{gapOpen:u.gapOpen,gapExtend:u.gapExtend,fingerprintType:u.fingerprintType}],u.threshold,u.maxIterations,u.useWebGPU,u.inflation,u.minClusterSize);f.unsubscribe();const g=this.findViewer(F.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:[c].map((t=>t.name)),metrics:[u.distanceF],weights:[1],aggregationMethod:D.MANHATTAN,preprocessingFuncs:[p].map((t=>{var e;return null!==(e=null==t?void 0:t.name)&&void 0!==e?e:null})),preprocessingFuncArgs:[{gapOpen:u.gapOpen,gapExtend:u.gapExtend,fingerprintType:u.fingerprintType}],threshold:u.threshold,maxIterations:u.maxIterations,useWebGPU:u.useWebGPU,inflate:u.inflation,minClusterSize:u.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,o;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 c=H.Z.getSeqHelper().getSeqHandler(l);if(c.isHelm())try{r.shell.warning("Column is in HELM notation. Sequences space will linearize sequences from position 0 prior to analysis");const t=c.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 r.shell.error("Error on converting HELM notation to linear notation"),void r.shell.error(t)}const u=!t.clusterCol&&!!t.clusterEmbeddings,d=null!==(o=null===(i=this.settings)||void 0===i?void 0:i.sequenceSpaceParams)&&void 0!==o?o:new C.GI(u);d.clusterEmbeddings=u;const f={table:this.df,molecules:l,methodName:h.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 p=0;const m=d.clusterEmbeddings?3:2,g=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),p++}p===m&&g.unsubscribe()})),v=r.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)}))}v.unsubscribe()}}catch(t){console.error(t)}})),y=yield r.functions.call("Bio:sequenceSpaceTopMenu",f);v.unsubscribe(),y instanceof s.ScatterPlotViewer&&(d.clusterEmbeddings||t.clusterCol||(y.props.colorColumnName=this.getScaledActivityColumn().name),y.props.showXSelector=!1,y.props.showYSelector=!1,t.clusterCol&&(y.props.colorColumnName=t.clusterCol.name),this._sequenceSpaceViewer=y,y.onContextMenu.subscribe((t=>{try{t.item("Modify Sequence space parameters",(()=>{(0,T.OH)(this)}))}catch(t){}})))}))}}B.modelName="peptidesModel"},3273:(t,e,n)=>{"use strict";n.d(e,{_package:()=>I,getTreeHelperInstance:()=>R});var i,o,r=n(4328),s=n(7389),a=n(6082),l=(n(5082),n(7233)),c=n.n(l),u=(n(4788),n(9484));n(726),n(3541),n(5480),(o=i||(i={})).BASE="HELM_BASE",o.SUGAR="HELM_SUGAR",o.LINKER="HELM_LINKER",o.AA="HELM_AA",o.CHEM="HELM_CHEM",o.BLOB="HELM_BLOB",o.NUCLEOTIDE="HELM_NUCLETIDE";var d=n(4139);n(8608),n(2003),n(8070);var h=n(5072),f=n.n(h),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),x={};x.styleTagTransform=E(),x.setAttributes=C(),x.insert=v().bind(null,"head"),x.domAPI=m(),x.insertStyleElement=b(),f()(S.A,x),S.A&&S.A.locals&&S.A.locals;var T;!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 c()(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){r.log.error(t)}finally{s.setUpdateIndicator(t,!1)}},new((o=void 0)||(o=Promise))((function(t,e){function r(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 o?n:new o((function(t){t(n)}))).then(r,s)}l((a=a.apply(n,i||[])).next())}));var n,i,o,a}}(n=t.tools||(t.tools={}))}(T||(T={}));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(u.q.CLUSTER_MAX_ACTIVITY,{id:"pep-viewer-title",style:{marginRight:"auto"}}),this._selsectIcon=s.div(),this.activityTarget=d.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",d.wf.HIGH,{choices:[d.wf.HIGH,d.wf.LOW]}),this.clusterSizeThreshold=this.int("clusterSizeThreshold",20),this.activityThreshold=this.int("activityThreshold",1e3),this.connectivityColumnName=this.column("connectivity",{nullable:!0})}get model(){return u.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===d.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),o=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 r=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)}r.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 c={},u={};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 r=n.get(t),s=c[e];if((null==s||null==s||r>n.get(s)&&this.activityTarget===d.wf.HIGH||r<n.get(s)&&this.activityTarget===d.wf.LOW)&&(c[e]=t),o){const n=o.get(t),i=u[e];(null==i||null==i||n>o.get(i))&&(u[e]=t)}}const h=this.dataFrame.columns.getOrCreate(O.maxActivityInClusterColName,a.COLUMN_TYPE.INT,this.dataFrame.rowCount);h.init((t=>i.isNone(t)?0:t===c[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===u[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===c[i.get(t)]&&(e=O.maxActivityLabel),o&&t===u[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 o=null!==(n=null===(e=t.bitset)||void 0===e?void 0:e.getSelectedIndexes())&&void 0!==n?n:[],r=this.dataFrame.selection,s=a.BitSet.create(this.dataFrame.rowCount,(t=>1==h.get(t)));s.and(r);for(let t=0;t<o.length;t++){const e=o[t],n=i.get(e);i.isNone(e)||(s.set(e,!0),null!=u[n]&&s.set(u[n],!0))}s.fireChanged();const l=s.getSelectedIndexes();for(const t of l){const e=i.get(t);null!=e&&null!=u[e]&&s.set(u[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(c).forEach((([e,i])=>{var o;if(null==e||null==i)return;const r=parseInt(e),s=n.get(i),a=null!==(o=l[r])&&void 0!==o?o:l[e];s<this.activityThreshold&&a<this.clusterSizeThreshold||(t.set(i,!0,!1),null!=u[r]&&t.set(u[r],!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),o=f.worldToScreen(e.x+e.width,this.activityThreshold),r=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(o.x,o.y),t.moveTo(i.x,i.y),t.lineTo(r.x,r.y),t.stroke(),t.closePath()})),f}onTableAttached(){var t,e,n,i,o,r,s,a,l,c,u,h;super.onTableAttached();const f=null!==(e=null===(t=this.dataFrame)||void 0===t?void 0:t.col(d.$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===(o=this.getProperty(`activity${d.To}`))||void 0===o||o.set(this,f.name));const p=null===(s=N()(null===(r=this.dataFrame)||void 0===r?void 0:r.columns.categorical).next())||void 0===s?void 0:s.value;null!=p&&(null===(a=this.getProperty(`cluster${d.To}`))||void 0===a||a.set(this,p.name));const m=null===(c=N()(null===(l=this.dataFrame)||void 0===l?void 0:l.columns.numerical).next())||void 0===c?void 0:c.value;null!=m&&(null===(u=this.getProperty(`connectivity${d.To}`))||void 0===u||u.set(this,m.name)),this.render(),null===(h=this.dataFrame)||void 0===h||h.onDataChanged.subscribe((()=>{this.render()}))}render(){this.renderTimeout&&clearTimeout(this.renderTimeout),this.renderTimeout=setTimeout((()=>{var t,e;if(!this.dataFrame)return;c()(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"}}),o=s.div(this.activityTarget===d.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([o,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${d.To}`&&(this._scViewer=null),this.render()}}let L;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);const I=new a.Package;function R(){return L}},726:(t,e,n)=>{"use strict";n.d(e,{Z:()=>o});var i=n(6082);class o{static getSeqHelper(){if(!this._secHelper)throw new Error("SeqHelper is not initialized");return this._secHelper}static loadSeqHelper(){return t=this,e=void 0,o=function*(){var t;null!==(t=this._secHelper)&&void 0!==t||(this._secHelper=yield async function(){const t=i.Func.find({package:"Bio",name:"getSeqHelper"});if(0===t.length)throw new Error("Package 'Bio' must be installed for SeqHelper.");return(await t[0].prepare().call()).getOutputParamValue()}())},new((n=void 0)||(n=Promise))((function(i,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((o=o.apply(t,e||[])).next())}));var t,e,n,o}}},3657:(t,e,n)=>{"use strict";n.d(e,{Lw:()=>d,eW:()=>p,Ej:()=>h,uz:()=>u});var i=n(6082),o=n(4139);class r{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,r=function*(t,e,n={}){var i,o,r;const s=new Map;try{const a=null!==(o=null===(i=n.targetCol)||void 0===i?void 0:i.cat.indexOf(n.currentTarget))&&void 0!==o?o:-1,l=t.length,c=new Array(this._workerCount),u=l*(l-1)/2;this._workerCount=Math.min(this._workerCount,u);const d=u/this._workerCount;e.forEach((t=>{var e;t.cat=null===(e=t.cat)||void 0===e?void 0:e.slice()})),(null===(r=n.targetCol)||void 0===r?void 0:r.cat)&&(n.targetCol.cat=n.targetCol.cat.slice());for(let i=0;i<this._workerCount;i++)c[i]=new Promise(((o,r)=>{const s=Math.floor(i*d),l=i===this._workerCount-1?u:Math.floor((i+1)*d);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(),r(s)):(this._workers[i].terminate(),o({pos:t,seq1Idxs:e,seq2Idxs:n}))}}));const h=yield Promise.all(c),f=new Map;e.forEach(((t,e)=>{f.set(t.name,e)})),h.filter(Boolean).forEach((t=>{for(let n=0;n<t.pos.length;n++){const i=f.get(t.pos[n]),o=e[i].rawData[t.seq1Idxs[n]],r=e[i].cat[o],a=e[i].rawData[t.seq2Idxs[n]],l=e[i].cat[a];s.has(r)||s.set(r,new Map),s.has(l)||s.set(l,new Map);const c=s.get(r),u=s.get(l);c.has(t.pos[n])||c.set(t.pos[n],new Map),u.has(t.pos[n])||u.set(t.pos[n],new Map);const d=c.get(t.pos[n]),h=u.get(t.pos[n]);d.has(t.seq1Idxs[n])||d.set(t.seq1Idxs[n],[]),h.has(t.seq2Idxs[n])||h.set(t.seq2Idxs[n],[]);const p=d.get(t.seq1Idxs[n]),m=h.get(t.seq2Idxs[n]);p.push(t.seq2Idxs[n]),m.push(t.seq1Idxs[n])}}))}catch(t){this.terminate(),console.error(t)}return s},new((o=void 0)||(o=Promise))((function(t,e){function s(t){try{l(r.next(t))}catch(t){e(t)}}function a(t){try{l(r.throw(t))}catch(t){e(t)}}function l(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(s,a)}l((r=r.apply(n,i||[])).next())}));var n,i,o,r}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),c=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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){return c(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 '${o.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 r,l=yield a.calc(t,e,n);return a.terminate(),l}))}function d(t,e){const n=new Map;let i=999999,o=-999999,r=2,s=2;for(const c of t.keys()){const u=new Map;n.set(c,u);const d=t.get(c);for(const t of d.keys()){const n=d.get(t),c=new a.A(e.length,!1);if(0===n.size)continue;for(const t of n.keys())c.setFast(t,!0),n.get(t).forEach((t=>c.setFast(t,!0)));const h=(0,l.GT)(e,c);i=Math.min(i,h.meanDifference),o=Math.max(o,h.meanDifference),r=Math.min(r,h.count),s=Math.max(s,h.count),u.set(t,h)}}return{stats:n,minDiff:i,maxDiff:o,minCount:r,maxCount:s}}function h(t,e,n,o={}){var r,s,c,u,d,h;null!==(r=o.isFiltered)&&void 0!==r||(o.isFiltered=!1);const p={general:{}};let m=t.getRawData(),g=t.length;if(o.isFiltered){g=e.trueCount;const t=new Float64Array(g),r=e.getSelectedIndexes();for(let e=0;e<g;++e)t[e]=m[r[e]];m=t,n=i.DataFrame.fromColumns(n).clone(e).columns.toList(),o.target&&(o.target.col=o.target.col.clone(e)),o.aggValue&&(o.aggValue.col=o.aggValue.col.clone(e))}null!==(s=o.columns)&&void 0!==s||(o.columns=n.map((t=>t.name)));const v=null===(u=null===(c=o.target)||void 0===c?void 0:c.col)||void 0===u?void 0:u.getRawData(),y=null===(d=o.target)||void 0===d?void 0:d.col.categories,C=(null===(h=o.target)||void 0===h?void 0:h.cat)?null==y?void 0:y.indexOf(o.target.cat):-1;for(const t of n){if(!o.columns.includes(t.name))continue;const e=t.getRawData(),n=t.categories,i={general:{}};for(let t=0;t<n.length;++t){const r=n[t];if(""===r)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 c=a.A.fromValues(s);if(c.allFalse)continue;const u=(0,l.GT)(m,c,o.aggValue);i[r]=u,f(i.general,u)}p[t.name]=i,f(p.general,null,i.general)}return p}function f(t,e=null,n=null){var i,o,r,s,a,l,c,u,d,h,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!==(o=t.maxCount)&&void 0!==o||(t.maxCount=w),t.maxCount<w&&(t.maxCount=w);const b=null!==(r=null==e?void 0:e.count)&&void 0!==r?r: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!==(c=null==e?void 0:e.meanDifference)&&void 0!==c?c:n.minMeanDifference;if(null!==(u=t.minMeanDifference)&&void 0!==u||(t.minMeanDifference=E),t.minMeanDifference>E&&(t.minMeanDifference=E),!isNaN(null!==(d=null==e?void 0:e.pValue)&&void 0!==d?d:NaN)){const i=null!==(h=null==e?void 0:e.pValue)&&void 0!==h?h:n.maxPValue;null!==(f=t.maxPValue)&&void 0!==f||(t.maxPValue=i),t.maxPValue<i&&(t.maxPValue=i);const o=null!==(p=null==e?void 0:e.pValue)&&void 0!==p?p:n.minPValue;null!==(m=t.minPValue)&&void 0!==m||(t.minPValue=o),t.minPValue>o&&(t.minPValue=o)}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 x=null!==(y=null==e?void 0:e.ratio)&&void 0!==y?y:n.minRatio;null!==(C=t.minRatio)&&void 0!==C||(t.minRatio=x),t.minRatio>x&&(t.minRatio=x)}function p(t,e,n,i){const o=t.rowCount,r=t.getCol(e),c=r.getRawData(),u=r.categories,d=Array.from({length:u.length},(()=>new a.A(o,!1)));for(let t=0;t<o;++t)d[c[t]].setTrue(t);const h=n.map((t=>a.A.fromUint32Array(o,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?d:h,n=t===s.W.ORIGINAL?u:f,o=t===s.W.ORIGINAL?m:g;for(let t=0;t<e.length;++t){const r=e[t];o[n[t]]=r.allTrue||r.allFalse?{count:r.length,meanDifference:0,ratio:1,pValue:null,mask:r,mean:i.stats.avg}:(0,l.GT)(p,r)}}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,o,r,s=n(7389),a=n(6082),l=n(4139),c=n(2003),u=n(3657),d=n(1858),h=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(o.applyToBackground,"true")}function v(t,e,n,i,o){var r,s,l,c,u,d,h;const f=o.width/2,g=Math.ceil(o.x+1+f),v=Math.ceil(o.y+1+o.height/2),y=.9*f/2;if(i instanceof p.UJ){const o=i.monomerPositionStats[n],r=o[e].pValue,s=o[e].meanDifference,l=1-o.general.maxPValue,c=1-o.general.minPValue,u=Math.min(l,c),d=l-u,h=c-u,p=Math.max(d,h),m=null===r?0:1-r-u,C=s>=0?m:-m,w=a.Color.toHtml(null===r?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===r?3:E,0,2*Math.PI,!0),t.closePath(),t.fill()}else if(i instanceof p.J&&i.mutationCliffs&&i.cliffStats){const o=i.cliffStats.maxCount,c=i.cliffStats.minDiff,u=i.cliffStats.maxDiff,d=null===(l=null===(s=null===(r=i.cliffStats)||void 0===r?void 0:r.stats)||void 0===s?void 0:s.get(e))||void 0===l?void 0:l.get(n);if(d){const e=d.count,n=d.meanDifference,i=Math.floor(Math.abs(e/Math.max(o,2))*y),r=Math.max(Math.abs(c),Math.abs(u)),s=a.Color.toHtml(null===n?a.Color.lightLightGray:a.Color.scaleColor(n,-r,r,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!==(h=null===(d=null===(u=null===(c=i.mutationCliffs)||void 0===c?void 0:c.get(e))||void 0===u?void 0:u.get(n))||void 0===d?void 0:d.entries())&&void 0!==h?h: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,o)}function y(t,e,n,i,o,r,s){s=a.Color.fromHtml(a.Color.toHtml(function(t,e){return(16777215&t|255<<24)>>>0}(s)));let l=o.toFixed(2);l.endsWith(".00")&&(l=o.toFixed(0)),l.endsWith("0")&&l.includes(".")&&(l=o.toFixed(1));const c=Math.min(13,Math.floor(r.width/40/l.length*6*13));t.fillStyle=a.Color.toHtml(s),t.fillRect(r.x,r.y,r.width,r.height),t.font=`${c}px Roboto, Roboto Local, sans-serif`,t.textAlign="center",t.textBaseline="middle",t.fillStyle=a.Color.toHtml(a.Color.getContrastColor(s)),t.fillText(l,r.x+r.width/2,r.y+r.height/2,r.width);const u=i[n];u&&u.includes(e)&&m(t,r)}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,o,r={x:0,y:0,mpStats:{},monomerPosition:{}}){var f;if(null!==(f=o.isSelectionTable)&&void 0!==f||(o.isSelectionTable=!1),0==Object.keys(r.mpStats).length&&(r.mpStats=e),o.isSelectionTable&&(!o.webLogoBounds||!o.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 r;const s=t.g,d=t.bounds,h=t.cell.tableColumn;s.save();try{if(s.beginPath(),s.rect(d.x,d.y,d.width,d.height),s.clip(),t.cell.isColHeader&&(null==h?void 0:h.semType)===l.uF.MONOMER){let f;if(p.filter.anyFalse){const t=null!==(r=p.temp[l.gp.M_P_STATS_CACHE])&&void 0!==r?r:{},e=null==t?void 0:t[h.name],o=p.filter.getBuffer();if(t&&e&&e.filter.length===o.length&&e.filter.every(((t,e)=>t===o[e])))f=e.stats[h.name];else{const e=(0,u.Ej)(i,p.filter,n,{isFiltered:!0,columns:[h.name]});f=e[h.name],t[h.name]={filter:p.filter.getBuffer(),stats:e,selection:p.selection.getBuffer()}}p.temp[l.gp.M_P_STATS_CACHE]=t}else f=o.isSelectionTable?(0,u.Ej)(i,p.filter,n,{isFiltered:!0,columns:[h.name]})[h.name]:e[h.name];if(!f)return;const m=Object.keys(f).sort(((t,e)=>""===t||"-"===t?1:""===e||"-"===e?-1:0)).filter((t=>"general"!==t));o.webLogoBounds()[h.name]=function(t,e,n,i,o,r,s,l={},u={}){var d,h,f,p,m,g,v,y,C,w;const b=window.devicePixelRatio;null!==(d=u.symbolStyle)&&void 0!==d||(u.symbolStyle="16px Roboto, Roboto Local, sans-serif"),null!==(h=u.upperLetterHeight)&&void 0!==h||(u.upperLetterHeight=12.2),null!==(f=u.upperLetterAscent)&&void 0!==f||(u.upperLetterAscent=.25),null!==(p=u.marginVertical)&&void 0!==p||(u.marginVertical=1),null!==(m=u.marginHorizontal)&&void 0!==m||(u.marginHorizontal=1),null!==(g=u.selectionWidth)&&void 0!==g||(u.selectionWidth=2),null!==(v=u.textHeight)&&void 0!==v||(u.textHeight=13),null!==(y=u.headerStyle)&&void 0!==y||(u.headerStyle=`bold ${u.textHeight*b}px Roboto, Roboto Local, sans-serif`);const A=(o.length-1)*u.upperLetterAscent;let E=(e.y+u.marginVertical)*b;const S=(e.height-2*u.marginVertical-A-1.25*u.textHeight)*b,x=(e.x+u.marginHorizontal)*b,T=Math.max(u.selectionWidth*b,.05*e.width*b),_=2*u.marginHorizontal+u.selectionWidth,N=(e.width-(_+u.marginHorizontal))*b,M=(e.x+_)*b,O={};for(const e of o){const i=S*(n[e].count/r),o=S*((null!==(C=l[e])&&void 0!==C?C:0)/r);if(O[e]=new a.Rect(M/b,E/b,N/b,i/b),t.resetTransform(),"-"!==e&&""!==e){const n=(0,c.zS)(e,5),r=t.measureText(n);o>0&&(t.lineWidth=T,t.line(x,E,x,E+o,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=u.symbolStyle;const l=N/r.width,d=i/u.upperLetterHeight;t.setTransform(l,0,0,d,M,E),t.fillText(n,0,0,r.width)}E+=i+u.upperLetterAscent*b}return t.resetTransform(),t.fillStyle=a.Color.toHtml(a.Color.black),t.textAlign="center",t.textBaseline="top",t.font=u.headerStyle,t.fillText(i,(e.x+e.width/2)*b,(e.y+e.height-u.textHeight)*b),O}(s,d,f,h.name,m,p.filter.trueCount,o.colorPalette(),o.headerSelectedMonomers?o.headerSelectedMonomers()[h.name]:{}),t.preventDefault()}}catch(t){console.warn(`PeptidesHeaderLogoError: couldn't render WebLogo for column \`${h.name}\`. See original error below.`),console.warn(t)}finally{s.restore()}})(t)));const m=n=>{var a;const c=t.hitTest(n.offsetX,n.offsetY);if((null==c?void 0:c.isColHeader)&&(null===(a=c.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,o]of Object.entries(i)){const i=e.offsetX>=o.x&&e.offsetX<=o.x+o.width,r=e.offsetY>=o.y&&e.offsetY<=o.y+o.height;if(i&&r)return{monomerOrCluster:n,positionOrClusterType:t.tableColumn.name}}return null}(c,n,o.webLogoBounds());if(null===t)return void(o.isSelectionTable||null==o.unhighlightCallback||o.unhighlightCallback());r.monomerPosition=t,function(t,e,n,i,o,r){if("click"!==t.type||o.isSelectionTable||null==o.selectionCallback){const a=`${e.positionOrClusterType} = ${e.monomerOrCluster}`;o.cachedWebLogoTooltip().bar===a?s.tooltip.show(o.cachedWebLogoTooltip().tooltip,t.clientX,t.clientY):(o.cachedWebLogoTooltip().bar=a,r.x=t.clientX,r.y=t.clientY,r.monomerPosition=e,o.cachedWebLogoTooltip().tooltip=(0,h.Y)(n,i,[],r))}else o.selectionCallback(e,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey})}(n,t,p,i,o,r),o.isSelectionTable||null==o.highlightCallback||o.highlightCallback(t,p,e)}};d.fromEvent(t.overlay,"mousemove").subscribe((t=>m(t))),d.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"}(o||(o={})),function(t){t.MSA="MSA",t.classic="classic"}(r||(r={})),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=r.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:()=>h,YX:()=>d,gp:()=>r,i6:()=>o,rg:()=>c,uF:()=>s,wf:()=>u,zW:()=>f});var i,o,r,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"}(o||(o={})),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"}(r||(r={})),function(t){t.MONOMER="Monomer",t.MACROMOLECULE_DIFFERENCE="MacromoleculeDifference"}(s||(s={}));const l="ColumnName";var c,u,d;!function(t){t.NONE="none",t.LG="lg",t.MINUS_LG="-lg"}(c||(c={})),function(t){t.HIGH="High",t.LOW="Low"}(u||(u={})),function(t){t.LST="lst-",t.MP="mp-",t.MPR="mpr-",t.WL="wl-"}(d||(d={}));const h=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:()=>x,AN:()=>i,AY:()=>d,B2:()=>N,BE:()=>y,CD:()=>w,F2:()=>m,FZ:()=>g,KT:()=>S,Y1:()=>h,ZR:()=>E,dl:()=>A,eY:()=>p,qI:()=>T,qx:()=>f,sg:()=>M,vW:()=>b,vY:()=>C,zm:()=>_,zz:()=>v});var i,o=n(7389),r=n(6082),s=n(4139),a=n(8774),l=n(144),c=n.n(l),u=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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 d(t){var e;return null!==(e=t.getTag(s.gp.SEPARATOR))&&void 0!==e?e:""}function h(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(),o=r.Column.float(s.$2.ACTIVITY,t.length).init((t=>{const e=i[t];return e===r.FLOAT_NULL||e===r.INT_NULL?e:n(e)}));return o.setTag(s.gp.ANALYSIS_COL,"true"),o.setTag(r.TAGS.FORMULA,e),o}function f(t){var e,n,i,o;const r=t.columns.bySemTypeAll(s.uF.MONOMER),a={},l=t.filter.clone().and(t.selection).getSelectedIndexes();for(const t of l)for(const s of r){const r=s.get(t);r&&(null!==(e=a[i=s.name])&&void 0!==e||(a[i]={}),null!==(n=(o=a[s.name])[r])&&void 0!==n||(o[r]=0),a[s.name][r]+=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),c=[],u=l.categories,d=l.getRawData();for(let t=0;t<u.length;++t){if(!Object.values(i).includes(u[t]))continue;const e=r.Color.toHtml(l.meta.colors.getColor(d.indexOf(t))),s=o.label(null!==(a=n[u[t]])&&void 0!==a?a:u[t],{style:{color:e}});c.push(s)}const h=o.divV([o.divV(c),t.root,o.tableFromMap(e)]);return t.root.style.maxHeight="75px",h}function g(t,e,n){var o,a;const l=null!==(o=null==n?void 0:n.clone().xor(e).anyTrue)&&void 0!==o&&o,c=t.length,u=t.getRawData(),d=new Float32Array(c+e.trueCount+(l&&null!==(a=null==n?void 0:n.trueCount)&&void 0!==a?a:0)),h=new Array(d.length);for(let t=0,o=0,r=0;t<c;++t){const s=e.get(t);d[t]=u[t],h[t]=s?i.SELECTION:i.ALL,s&&(d[c+o]=u[t],h[c+o]=i.ALL,++o),l&&(null==n?void 0:n.get(t))&&(d[c+e.trueCount+r]=u[t],h[c+e.trueCount+r]=i.PEPTIDES_SELECTION,++r)}const f=r.Column.fromStrings(s.$2.SPLIT_COL,h),p=[i.ALL,i.SELECTION];return l&&p.push(i.PEPTIDES_SELECTION),f.setCategoryOrder(p),f.meta.colors.setCategorical(),r.DataFrame.fromColumns([r.Column.fromFloat32Array(s.$2.ACTIVITY,d),f])}function v(t){const e=o.iconFA("expand-alt",(()=>{const e=t.dataFrame.plot.grid();C(e,!1),e.root.style.height="100%";const n=o.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 r=o.iconFA("expand-alt",(()=>{const e=i(),n=o.dialog(t);n.add(e),n.showModal(!0)}),"Expand to full screen");r.style.marginLeft="auto",r.style.marginRight="15px",n.addEventListener("mouseenter",(()=>{r.style.visibility="visible"})),n.addEventListener("mouseleave",(()=>{r.style.visibility="hidden"})),e.appendChild(r)}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],o=i.indexOf(e.monomerOrCluster);if(n.shiftPressed&&n.ctrlPressed)-1!==o&&i.splice(o,1);else if(n.ctrlPressed)-1===o?i.push(e.monomerOrCluster):i.splice(o,1);else if(n.shiftPressed)-1===o&&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,o]of i){const i=e[t];for(const t of o){const e=i[t];e&&(null!=n||(n=new a.A(e.mask.length,!1)),n.or(e.mask))}}return null!=n?r.BitSet.fromBytes(n.buffer.buffer,n.length):null}function x(t,e){return t.sequenceColumnName===e.sequenceColumnName&&t.activityColumnName===e.activityColumnName&&t.activityScaling===e.activityScaling}function T(t,e){var n;const i={};for(const[o,r]of t)for(const[t,s]of r){null!==(n=i[t])&&void 0!==n||(i[t]={});const r=new a.A(e,!1);for(const[t,e]of s){r.setTrue(t);for(const t of e)r.setTrue(t)}i[t][o]={mask:r}}return i}function _(t,e,n,i){const o=Object.entries(n),r=i?Object.entries(i).filter((t=>!e.includes(t[0])||n[t[0]]!==t[1])):[];return o.concat(r).filter((e=>t.columns.contains(e[0])&&t.col(e[0]).matches("numerical")))}function N(t,e=2){return t.columns.bySemTypeAll(r.SEMTYPE.MACROMOLECULE).length>0&&c()(t.columns.numerical).toArray().length>0&&t.rowCount>=e}function M(t,e=500){let n;return(...i)=>u(this,void 0,void 0,(function*(){return new Promise((o=>{clearTimeout(n),n=setTimeout((()=>o(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_:()=>c,m2:()=>u,lh:()=>l,GT:()=>a,J1:()=>d});var i=n(6082),o=n(6572),r=n(4139);const s=(t,e)=>`${t}(${e})`;function a(t,e,n){var r;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===(r=i.DataFrame.fromColumns([n.col]).clone(i.BitSet.fromBytes(e.buffer.buffer,e.length)).col(n.col.name))||void 0===r?void 0:r.aggregate(n.type)}catch(t){console.error(t)}let c=0,u=0;for(let n=0;n<e.length;++n)e.getBit(n)?s[c++]=t[n]:a[u++]=t[n];const d=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:d,meanDifference:d-t,ratio:s.length/e.length,mask:e,aggValue:l}}const h=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 r=o.mean(t),s=o.mean(e),a=o.variance(t),l=o.variance(e),c=t.length,u=e.length;let d,h,f;if(n){const t=a/c,e=l/u,n=(r-s)/Math.sqrt(t+e);h=o.normal.pdf(n,0,1),d=1-h,f=2*(h<d?h:d)}else if(i){const t=c+u-2,e=(a*(c-1)+l*(u-1))/t,n=Math.sqrt(c*u/(c+u))*(r-s)/e;d=1-o.studentt.cdf(n,t),h=o.studentt.cdf(n,t),f=2*(h<d?h:d)}else{const t=a/c,e=l/u,n=(r-s)/Math.sqrt(t+e),i=Math.pow(t+e,2)/(Math.pow(t,2)/(c-1)+Math.pow(e,2)/(u-1));h=o.studentt.cdf(n,i),d=1-h,f=2*(h<d?h:d)}return{"p-value":f,"Mean difference":r-s,"p-value more":d,"p-value less":h}}(s,a),f=h["Mean difference"];return{count:s.length,pValue:h[f>=0?"p-value more":"p-value less"],mean:d,meanDifference:f,ratio:s.length/e.length,mask:e,aggValue:l}}function l(t,e,n){const o=r.zW[e],s=i.Stats.fromColumn(t,n);if(!(o in s))throw new Error(`Aggregation type ${o} is not supported`);return s[o]}function c(t,e,n={}){var i,o;null!==(i=n.filterDf)&&void 0!==i||(n.filterDf=!1),null!==(o=n.fractionDigits)&&void 0!==o||(n.fractionDigits=3);const r=n.filterDf&&t.filter.anyFalse?t.clone(t.filter):t,a={};for(const[t,i]of e){const e=s(i,t),o=l(r.getCol(t),i,n.mask);a[e]=o.toFixed(n.fractionDigits)}return a}function u(t,e,n,i){var o;null!==(o=i.fractionDigits)&&void 0!==o||(i.fractionDigits=3);const r={};for(const[o,a]of n){const n=s(a,o),l=t.get(n,e);r[n]=l.toFixed(i.fractionDigits)}return r}function d(t,e,n){var o;const r=t.col(e.substring(5,e.length-1));if(!r||!r.matches("categorical"))return"{}";null!=n||(n=i.BitSet.create(t.rowCount,(()=>!0)));const s=r.getRawData(),a=new Map;for(let t=-1;-1!==(t=n.findNext(t,!0));)a.set(s[t],(null!==(o=a.get(s[t]))&&void 0!==o?o:0)+1);const l={};for(const[t,e]of a)l[r.categories[t]]=e;return JSON.stringify(l)}},912:(t,e,n)=>{"use strict";n.d(e,{D:()=>c,Y:()=>u});var i=n(7389),o=n(6082),r=n(4139),s=n(7654),a=n(8608),l=n(5070);function c(t,e,n,i){var o,s,a;return null!==(o=i.fromViewer)&&void 0!==o||(i.fromViewer=!1),null!==(s=i.isMutationCliffs)&&void 0!==s||(i.isMutationCliffs=!1),null!==(a=i.isMostPotentResidues)&&void 0!==a||(i.isMostPotentResidues=!1),i.monomerPosition.positionOrClusterType!==r.$2.MONOMER&&u(t,e,n,i),!0}function u(t,e,n,r){var c,u,d,h,f,p,m;if(null!==(c=r.fromViewer)&&void 0!==c||(r.fromViewer=!1),null!==(u=r.isMutationCliffs)&&void 0!==u||(r.isMutationCliffs=!1),null!==(d=r.isMostPotentResidues)&&void 0!==d||(r.isMostPotentResidues=!1),r.cliffStats&&r.isMutationCliffs){const c=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(!c)return null;const u=o.BitSet.fromBytes(c.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,u),!0),h=(0,s.QD)(c);r.fromViewer&&(h["Mean difference"]=`${h["Mean difference"]} (Color)`,h.Count&&(h.Count=`${h.Count} (Size)`));const g=null!==(m=r.aggrColValues)&&void 0!==m?m:(0,l.I_)(t,n,{mask:u}),v=Object.assign(Object.assign({},h),g),y=(0,a.F2)(d,v);return i.tooltip.show(y,r.x,r.y),y}{const c=r.mpStats[r.monomerPosition.positionOrClusterType][r.monomerPosition.monomerOrCluster];if(!(null==c?void 0:c.count))return null;const u=o.BitSet.fromBytes(c.mask.buffer.buffer,e.length),d=(0,s.M1)((0,a.FZ)(e,u),!0),f=(0,s.QD)(c);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!==(h=r.aggrColValues)&&void 0!==h?h:(0,l.I_)(t,n,{mask:u}),m=Object.assign(Object.assign({},f),p),g=(0,a.F2)(d,m);return i.tooltip.show(g,r.x,r.y),g}}},115:(t,e,n)=>{"use strict";n.d(e,{GI:()=>a,Ku:()=>r,av:()=>s});var i=n(4572),o=n(4329);const r="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=r,this.webGPUDescriptionPromise=(0,o._)().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:()=>E,s:()=>x});var i=n(7389),o=n(4328),r=n(6082),s=n(7233),a=n.n(s),l=n(9484),c=n(4139),u=n(2935),d=n(4326),h=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),b=n(726);const A=(t,e)=>`${t}(${e})`;var E,S;!function(t){t.ORIGINAL="original",t.CUSTOM="custom"}(E||(E={})),function(t){t.GENERAL="General",t.STYLE="WebLogo",t.AGGREGATION="Aggregation"}(S||(S={}));class x extends r.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:S.GENERAL,nullable:!1}),this.clustersColumnName=this.column("clusters",{category:S.GENERAL,nullable:!1,columnTypeFilter:r.TYPE.CATEGORICAL}),this.activityColumnName=this.column("activity",{category:S.GENERAL,nullable:!1,columnTypeFilter:r.TYPE.NUMERICAL}),this.activityScaling=this.string("activityScaling",c.rg.NONE,{category:S.GENERAL,choices:Object.values(c.rg)}),this.webLogoMode=this.string("webLogoMode",d.fH.Entropy,{choices:[d.fH.full,d.fH.Entropy],category:S.STYLE}),this.membersRatioThreshold=this.float("membersRatioThreshold",.1,{min:0,max:1,category:S.STYLE}),this.columns=this.columnList("columns",[],{category:S.AGGREGATION}),this.aggregation=this.string("aggregation",r.AGG.AVG,{category:S.AGGREGATION,choices:c.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(c.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(c.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 o=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=o(l.q.SEQUENCE_VARIABILITY_MAP))&&void 0!==n?n:o(l.q.MOST_POTENT_RESIDUES))&&void 0!==i?i:(0,w.R)(this.dataFrame.getCol(this.sequenceColumnName),b.Z.getSeqHelper()).columns.toList()),this._positionColumns}get isClusterSelectionEmpty(){return 0===this.clusterSelection[E.ORIGINAL].length+this.clusterSelection[E.CUSTOM].length}get customClusters(){const t={};return t[c.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?r.DataFrame.fromColumns([this._scaledActivityColumn]).clone(this.dataFrame.rowCount===this._scaledActivityColumn.length?this.dataFrame.filter:null).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${c.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(r.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`activity${c.To}`))||void 0===e||e.set(this,p()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`clusters${c.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";o.log.error(t),o.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${c.To}`:this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`clusters${c.To}`:this._clusterStats=null,this._clusterSelection=null,this._viewerGrid=null,this._logoSummaryTable=null,e=!0;break;case`activity${c.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[E.ORIGINAL]=[],n[E.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,o=this.dataFrame.filter.anyFalse,s=o?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,a=s.columns,l=s.rowCount,u=this.getScaledActivityColumn(o).getRawData(),d=s.getCol(i),f=d.getRawData(),m=d.categories,g={};g[c.gp.CUSTOM_CLUSTER]="1";const y=p()(a.byTags(g)).filter((t=>t.max>0)).toArray(),C=r.DataFrame.create(y.length),w=C.columns,b=w.addNewString(c.i6.CLUSTER),S=w.addNewInt(c.i6.MEMBERS).getRawData(),x=w.addNewString(c.i6.WEB_LOGO),T=w.addNewString(c.i6.DISTRIBUTION),_=w.addNewFloat(c.i6.MEAN_DIFFERENCE).getRawData(),N=w.addNewFloat(c.i6.P_VALUE).getRawData(),M=w.addNewFloat(c.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])=>A(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];b.set(e,n.name);const i=v.A.fromUint32Array(l,n.getRawData());if(i.allFalse)continue;const a=r.BitSet.fromBytes(i.buffer.buffer,l),c=o?(0,h.GT)(u,i):this.clusterStats[E.CUSTOM][n.name];S[e]=c.count,D[e]=a,_[e]=c.meanDifference,N[e]=null!==(t=c.pValue)&&void 0!==t?t:r.FLOAT_NULL,M[e]=c.ratio;for(let t=0;t<P.length;++t){const[n,i]=G[t];k[t][e]=(0,h.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,h.J1)(s,n,a))}}x.setTag(r.TAGS.CELL_RENDERER,"html"),T.setTag(r.TAGS.CELL_RENDERER,"html");const U=O.aggregate(),V=U.rowCount,F=U.columns;let H=U.getCol(i);H.name=c.i6.CLUSTER,H.type!==r.COLUMN_TYPE.STRING&&(U.columns.replace(H,H.convertTo(r.COLUMN_TYPE.STRING)),H=U.getCol(H.name));const q=H.categories,B=F.addNewInt(c.i6.MEMBERS).getRawData(),Y=F.addNewString(c.i6.WEB_LOGO),$=F.addNewString(c.i6.DISTRIBUTION),j=F.addNewFloat(c.i6.MEAN_DIFFERENCE).getRawData(),W=F.addNewFloat(c.i6.P_VALUE).getRawData(),z=F.addNewFloat(c.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[q.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=r.BitSet.fromBytes(e.buffer.buffer,l),a=o?(0,h.GT)(u,e):this.clusterStats[E.ORIGINAL][q[t]];for(let e=0;e<I.length;++e){const n=I[e];K[e].set(t,(0,h.J1)(s,n,i))}B[t]=a.count,Q[t]=i,j[t]=a.meanDifference,W[t]=null!==(n=a.pValue)&&void 0!==n?n:r.FLOAT_NULL,z[t]=a.ratio}Y.setTag(r.TAGS.CELL_RENDERER,"html"),$.setTag(r.TAGS.CELL_RENDERER,"html");const Z=U.append(C);return this.bitsets=Q.concat(D),I.forEach((t=>Z.col(t).semType="lst-pie-chart")),Z}createLogoSummaryTableGrid(){const t=this.dataFrame.filter.anyFalse,e=t?this.dataFrame.clone(this.dataFrame.filter):this.dataFrame,n=this.getTotalViewerAggColumns().map((([t,e])=>A(e,t))),s=this.logoSummaryTable.plot.grid();s.sort([c.i6.MEMBERS],[!1]),this.updateFilter(),s.col(c.i6.CLUSTER).visible=!0,s.columns.setOrder([c.i6.CLUSTER,c.i6.MEMBERS,c.i6.WEB_LOGO,...this.getStringAggregatedColumns(),c.i6.DISTRIBUTION,c.i6.MEAN_DIFFERENCE,c.i6.P_VALUE,c.i6.RATIO,...n]),s.columns.rowHeader.visible=!1,s.props.rowHeight=55;const h=new r.LruCache,f=new r.LruCache,p=this.positionColumns.length,m=s.columns.byName(c.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,o=function*(){var e,n,i;const o=t.cell,s=o.tableRowIndex;if(!o.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(o.bounds.height-2,0),w=this.bitsets[s];if((null===(e=o.tableColumn)||void 0===e?void 0:e.name)===c.i6.CLUSTER)u.k8(l,o.cell.value,this.clusterSelection,m),t.preventDefault();else if((null===(n=o.tableColumn)||void 0===n?void 0:n.name)===c.i6.WEB_LOGO){const e=Math.floor((o.bounds.width-2-4*(p-1))/p);let n=h.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:d.P4.LEFT,maxHeight:1e3,minHeight:y,positionWidth:e,showPositionLabels:!1}),h.set(s,n)}n.root.style.height=`${y}px`,o.element=n.root,t.preventDefault()}else if((null===(i=o.tableColumn)||void 0===i?void 0:i.name)===c.i6.DISTRIBUTION){let e=f.get(s);void 0===e&&(e=(0,g.FZ)(v,w).plot.histogram({filteringEnabled:!1,valueColumnName:v.name,splitColumnName:c.$2.SPLIT_COL,legendVisibility:"Never",showXAxis:!1,showColumnSelector:!1,showRangeSlider:!1,showBinSelector:!1,backColor:r.Color.toHtml(r.Color.white),xAxisHeight:1,showSplitSelector:!1}),e.root.style.width="auto",f.set(s,e)),e.root.style.height=`${y}px`,o.element=e.root,t.preventDefault()}}finally{l.restore()}},new((i=void 0)||(i=Promise))((function(t,r){function s(t){try{l(o.next(t))}catch(t){r(t)}}function a(t){try{l(o.throw(t))}catch(t){r(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((o=o.apply(e,n||[])).next())}));var e,n,i,o})),s.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),r.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)!==c.i6.CLUSTER)return;null!==this.currentRowIndex&&-1!==this.currentRowIndex&&this.modifyClusterSelection(this.getCluster(s.cell(c.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(c.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)!==c.i6.CLUSTER)return;const r=this.getCluster(n);this.modifyClusterSelection(r,{shiftPressed:t.shiftKey,ctrlPressed:t.ctrlKey}),s.invalidate(),y._package.files.readAsText("help/logo-summary-table.md").then((t=>{o.shell.windows.help.showHelp(i.markdown(t))})).catch((t=>o.log.error(t)))})),s.onCellTooltip(((t,e,n)=>{var i;if(!t.isTableCell)return this.model.unhighlight(),!0;const o=this.getCluster(t);return this.highlightCluster(o),(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===c.i6.CLUSTER&&this.showTooltip(o,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(c.i6.CLUSTER,t.tableRowIndex);return{positionOrClusterType:this.dataFrame.getCol(this.clustersColumnName).categories.includes(e)?E.ORIGINAL:E.CUSTOM,monomerOrCluster:e}}updateFilter(){const t=this.logoSummaryTable.getCol(c.i6.MEMBERS),e=this.logoSummaryTable.getCol(c.i6.CLUSTER),n=e.getRawData(),i=e.categories,o=i.indexOf("-1"),r=t.getRawData();let s=0;r.forEach(((t,e)=>{"-1"!==i[n[e]]&&(s=Math.max(s,r[e]))}));const a=Math.ceil(s*this.membersRatioThreshold);this.logoSummaryTable.filter.init((t=>r[t]>a&&(-1===o||"-1"!==i[n[t]])))}clusterFromSelection(){const t=this.model.getVisibleSelection(),e=this.logoSummaryTable.columns,n=e.length,i=new Array(e.length),o=this.getScaledActivityColumn(),r=v.A.fromString(t.toBinaryString()),s=(0,h.GT)(o.getRawData(),r);this.bitsets.push(t.clone());const a=this.dataFrame.columns.getUnusedName("New Cluster"),l={},u={},d=this.getTotalViewerAggColumns(),f=this.getStringAggregatedColumns();for(const[e,n]of d){const i=A(n,e),o=this.dataFrame.getCol(e);l[i]=(0,h.lh)(o,n,t)}for(const e of f)u[e]=(0,h.J1)(this.dataFrame,e,t);for(let o=0;o<n;++o){const n=e.byIndex(o);i[o]=n.name===c.i6.CLUSTER?a:n.name===c.i6.MEMBERS?t.trueCount:n.name===c.i6.WEB_LOGO||n.name===c.i6.DISTRIBUTION?null:n.name===c.i6.MEAN_DIFFERENCE?s.meanDifference:n.name===c.i6.P_VALUE?s.pValue:n.name===c.i6.RATIO?s.ratio:n.name in l?l[n.name]:n.name in u?u[n.name]:void 0,void 0===i[o]&&y._package.logger.warning(`PeptidesLSTWarn: value for column ${n.name} is undefined`)}this.logoSummaryTable.rows.addNew(i),this.clusterStats[E.CUSTOM][a]=s,this.addNewCluster(a)}removeCluster(){const t=this.clusterSelection[E.CUSTOM];if(0===t.length)return void o.shell.warning("No custom clusters selected to be removed");const e=this.logoSummaryTable.rows,n=this.logoSummaryTable.getCol(c.i6.CLUSTER),i=n.categories,r=this.dataFrame.columns;for(const n of t){t.splice(t.indexOf(n),1),r.remove(n),delete this.clusterStats[E.CUSTOM][n];const o=i.indexOf(n);e.removeAt(o),this.bitsets.splice(o,1)}n.compact(),this.clusterSelection[E.CUSTOM]=t,this.render()}addNewCluster(t){const e=r.Column.fromBitSet(t,this.model.getVisibleSelection());e.setTag(c.gp.CUSTOM_CLUSTER,"1"),e.setTag(c.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 o=this.dataFrame.filter,s=o.anyFalse?this.dataFrame.clone(o):this.dataFrame,a=s.rowCount,l=new v.A(a,!1),c=this.getScaledActivityColumn(o.anyFalse),u=c.getRawData();if(t.positionOrClusterType===E.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 d=o.anyFalse?(0,h.GT)(u,l):this.clusterStats[t.positionOrClusterType][t.monomerOrCluster];if(!d.count)return null;const f=r.BitSet.fromBytes(l.buffer.buffer,a),p=(0,g.FZ)(c,f),y=(0,m.M1)(p,!0),C=(0,m.QD)(d),w=(0,h.I_)(this.dataFrame,this.getTotalViewerAggColumns(),{filterDf:!0,mask:f}),b=Object.assign(Object.assign({},C),w),A=(0,g.F2)(y,b);return i.tooltip.show(A,e,n),A}createWebLogoDf(t,e){const n=r.DataFrame.fromColumns([t]);return n.filter.copyFrom(e),n}}},3541:(t,e,n)=>{"use strict";n.d(e,{J:()=>M,UJ:()=>O,ds:()=>i,xN:()=>N});var i,o,r,s,a=n(4328),l=n(7389),c=n(6082),u=n(7233),d=n.n(u),h=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),x=n(8223),T=n(726),_=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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"}(o||(o={})),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"}(r||(r={})),function(t){t.GENERAL="General",t.INVARIANT_MAP="Invariant Map",t.MUTATION_CLIFFS="Mutation Cliffs",t.AGGREGATION="Aggregation"}(s||(s={}));class N extends c.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(o.SEQUENCE,{category:s.GENERAL,semType:c.SEMTYPE.MACROMOLECULE,nullable:!1}),this.activityColumnName=this.column(o.ACTIVITY,{category:s.GENERAL,nullable:!1}),this.activityScaling=this.string(o.ACTIVITY_SCALING,h.rg.NONE,{category:s.GENERAL,choices:Object.values(h.rg),nullable:!1}),this.activityTarget=this.string(o.ACTIVITY_TARGET,h.wf.HIGH,{category:s.GENERAL,choices:Object.values(h.wf),nullable:!1}),this.targetColumnName=this.column(o.TARGET,{category:s.GENERAL,nullable:!0,columnTypeFilter:"categorical",userEditable:!0}),this.minActivityDelta=this.float(o.MIN_ACTIVITY_DELTA,0,{category:s.MUTATION_CLIFFS,min:0,max:100}),this.maxMutations=this.int(o.MAX_MUTATIONS,1,{category:s.MUTATION_CLIFFS,min:1,max:20}),this.columns=this.columnList(o.COLUMNS,[],{category:s.AGGREGATION}),this.aggregation=this.string(o.AGGREGATION,c.AGG.AVG,{category:s.AGGREGATION,choices:h.V5}),this.valueColumnName=this.column(o.VALUE_INVARIANT_MAP,{category:s.INVARIANT_MAP,userEditable:!0,nullable:!1,columnTypeFilter:"numerical"}),this.valueAggregation=this.string(o.AGGREGATION_INVARIANT_MAP_VALUE,c.AGG.TOTAL_COUNT,{category:s.INVARIANT_MAP,choices:h.V5,userEditable:!0,nullable:!1}),this.mutationCliffsDebouncer=(0,b.sg)(((t,e,n)=>_(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[h.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 M?this._positionColumns=i(p.q.MOST_POTENT_RESIDUES):this instanceof O&&(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),T.Z.getSeqHelper()).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 N&&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 N||null!=this.targetColumnName&&null!=(null===(i=this.targetCategoryInput)||void 0===i?void 0:i.value))||!(t instanceof N&&this.valueColumnName==(null==t?void 0:t.valueColumnName)&&this.valueAggregation==(null==t?void 0:t.valueAggregation))&&(t instanceof N||this.valueColumnName&&this.valueAggregation&&this.valueAggregation!=c.AGG.VALUE_COUNT&&this.valueAggregation!=c.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 M?this._monomerPositionStats=n(p.q.MOST_POTENT_RESIDUES):this instanceof O&&(this._monomerPositionStats=n(p.q.SEQUENCE_VARIABILITY_MAP));const i=this.targetColumnName?this.dataFrame.col(this.targetColumnName):null,o=this.targetCategoryInput.value,r=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&&o?{col:i,cat:o}:void 0,aggValue:s&&r?{col:r,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===(o=n.targetCategoryInput)||void 0===o?void 0:o.value)===(null===(r=null==i?void 0:i.targetCategoryInput)||void 0===r?void 0:r.value)&&n.minActivityDelta===(null==i?void 0:i.minActivityDelta)&&n.maxMutations===(null==i?void 0:i.maxMutations)?e._mutationCliffs:null;var n,i,o,r};return this instanceof M?this._mutationCliffs=t(p.q.MOST_POTENT_RESIDUES):this instanceof O&&(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 M?h.YX.MP:h.YX.MPR,n=this.dataFrame.getTag(`${e}${h.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 M?h.YX.MP:h.YX.MPR;this.dataFrame.setTag(`${e}${h.gp.MUTATION_CLIFFS_SELECTION}`,JSON.stringify(t)),this.model.fireBitsetChanged(this instanceof M?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?c.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`${o.SEQUENCE}${h.To}`:this._positionColumns=null,this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null;break;case`${o.ACTIVITY}${h.To}`:case o.ACTIVITY_SCALING:this._monomerPositionStats=null,this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this._viewerGrid=null,this._scaledActivityColumn=null;break;case`${o.VALUE_INVARIANT_MAP}${h.To}`:case o.AGGREGATION_INVARIANT_MAP_VALUE:this._monomerPositionStats=null,this._viewerGrid=null,this._invariantMapSelection=null;break;case o.MIN_ACTIVITY_DELTA:case o.MAX_MUTATIONS:this._mutationCliffs=null,this._mutationCliffStats=null,this._mutationCliffsSelection=null,this.doRender=!1;break;case o.COLUMNS:case o.AGGREGATION:this instanceof O&&(this._viewerGrid=null);break;case o.ACTIVITY_TARGET:(this instanceof O||this instanceof M)&&(this._viewerGrid=null)}null===this._mutationCliffs&&this.sequenceColumnName&&this.activityColumnName&&this.calculateMutationCliffs().then((t=>{this.mutationCliffs=t.cliffs,this.cliffStats=t.cliffStats})),t.name===`${o.TARGET}${h.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(`${o.SEQUENCE}${h.To}`))||void 0===t||t.set(this,this.dataFrame.columns.bySemType(c.SEMTYPE.MACROMOLECULE).name),null===(e=this.getProperty(`${o.ACTIVITY}${h.To}`))||void 0===e||e.set(this,g()(this.dataFrame.columns.numerical).next().value.name),null===(n=this.getProperty(`${o.VALUE_INVARIANT_MAP}${h.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,x.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:{}})),o=new Set;i.forEach((t=>Object.keys(t).forEach((t=>o.add(t))))),o.delete("colors"),e.group("Monomer Meta").items(Array.from(o),(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 _(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},o=t.getRawData(),r=yield this.mutationCliffsDebouncer(o,e,i);return{cliffs:r,cliffStats:(0,w.Lw)(r,o)}}))}}class M extends N{constructor(){super(),this.currentGridCell=null,this.customColorRange=!1,this.minColorValue=0,this.maxColorValue=0,this.logScaleColor=!1,this.colorColumnName=this.column(r.COLOR,{category:s.INVARIANT_MAP,nullable:!1,columnTypeFilter:"numerical"}),this.colorAggregation=this.string(r.COLOR_AGGREGATION,c.AGG.AVG,{category:s.INVARIANT_MAP,choices:h.V5}),this.lowerBoundColor=this.int(r.LOWER_BOUND_COLOR,4278190335,{category:s.INVARIANT_MAP,editor:"color"}),this.middleColor=this.int(r.MIDDLE_COLOR,4294967295,{category:s.INVARIANT_MAP,editor:"color"}),this.upperBoundColor=this.int(r.UPPER_BOUND_COLOR,4294901760,{category:s.INVARIANT_MAP,editor:"color"}),this.logScaleColor=this.bool(r.LOG_SCALE_COLOR,!1,{category:s.INVARIANT_MAP}),this.customColorRange=this.bool(r.CUSTOM_COLOR_RANGE,!1,{category:s.INVARIANT_MAP}),this.minColorValue=this.float(r.MIN_COLOR_VALUE,0,{category:s.INVARIANT_MAP}),this.maxColorValue=this.float(r.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(h.gp.MONOMER_POSITION_MODE))&&void 0!==t?t:i.MUTATION_CLIFFS}set mode(t){this.dataFrame.setTag(h.gp.MONOMER_POSITION_MODE,t),this.viewerGrid.invalidate()}get invariantMapSelection(){var t;const e=this.dataFrame.getTag(`${h.YX.MP}${h.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(`${h.YX.MP}${h.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(`${r.COLOR}${h.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(`${o.TARGET}${h.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===o.SEQUENCE&&(this._invariantMapSelection=null),null===(e=this.positionColumns)||void 0===e||e.forEach((t=>{t.temp[h.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=c.Column.fromStrings(h.$2.MONOMER,n),o=c.DataFrame.fromColumns([i]),r=(0,x.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=o.columns.addNewString(t);r.then((n=>{e.init((e=>{var i,o;return null!==(o=null===(i=n[e][t])||void 0===i?void 0:i.toString())&&void 0!==o?o:""}))}))})),o.name="SAR";for(const t of e)o.columns.addNewBool(t.name);return o}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,o=null==i?void 0:i.getRawData(),r=this.targetCategoryInput.value,s=null==r?null:null==i?void 0:i.categories.indexOf(r);for(const i of this.positionColumns){i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]={};const r=i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE],a=i.name,l=i.getRawData(),u=i.categories;if(!this.monomerPositionStats[a])continue;const d=this.monomerPositionStats[a];for(const a of Object.keys(d)){if("general"===a)continue;const d=[];for(let t=0;t<i.length;++t){const e=u[l[t]]===a,n=!o||null==s||-1==s||o[t]===s;e&&n&&d.push(t)}const h=c.Column.float("color",d.length).init((e=>t[d[e]])).aggregate(this.colorAggregation);r[a]=h,e=Math.min(e,h),n=Math.max(n,h)}i.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=r}const a=this.customColorRange&&null!=this.minColorValue&&null!=this.maxColorValue;let l=a?this.minColorValue:e,u=a?this.maxColorValue:n;const d=this.logScaleColor&&l>1e-30&&u>1e-30&&e>1e-30&&n>1e-30;d&&(l=Math.log(l),u=Math.log(u));for(const t of this.positionColumns){const i=t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE];if(i){for(const t of Object.keys(i))this.activityTarget===h.wf.LOW&&(i[t]=u-i[t]+l),i[t]=c.Color.scaleColor(d?Math.log(i[t]):i[t],l,u,void 0,[this.lowerBoundColor,this.middleColor,this.upperBoundColor]);t.temp[h.gp.INVARIANT_MAP_COLOR_CACHE]=i,t.temp[h.gp.INVARIANT_MAP_COLOR_MIN_CACHE]=e,t.temp[h.gp.INVARIANT_MAP_COLOR_MAX_CACHE]=n}}}}createViewerGrid(){const t=this.createMonomerPositionDf(),e=t.plot.grid();e.sort([h.$2.MONOMER]);const n=this.positionColumns.map((t=>t.name));e.columns.setOrder([h.$2.MONOMER,...this._monomerMetaColumns,...n]);const o=t.getCol(h.$2.MONOMER);f.rI(o,this.alphabet,!0),this.cacheInvariantMapColors(),e.onCellRender.subscribe((t=>L(t,this,this.mode===i.INVARIANT_MAP,this.dataFrame.getCol(this.colorColumnName),this.colorAggregation))),e.onCellTooltip(((t,e,n)=>{var o,r,s;if(!t.isTableCell||!(null===(o=null==t?void 0:t.cell.column)||void 0===o?void 0:o.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!==c.AGG.VALUE_COUNT&&this.valueAggregation!==c.AGG.TOTAL_COUNT&&l.unshift([this.valueColumnName,this.valueAggregation])),(0,C.D)(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===(r=this.cliffStats)||void 0===r?void 0:r.stats)&&void 0!==s?s:void 0})})),e.root.addEventListener("mouseleave",(t=>this.model.unhighlight())),c.debounce(e.onCurrentCellChanged,500).subscribe((t=>{var n,o,r,s,a,l,c,u;try{if(!t||!t.dart||!(null===(o=null===(n=null==t?void 0:t.cell)||void 0===n?void 0:n.column)||void 0===o?void 0:o.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===(r=this.mutationCliffs)||void 0===r?void 0:r.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 d=this.getMonomerPosition(t);this.mode===i.INVARIANT_MAP?this.modifyInvariantMapSelection(d,{shiftPressed:!0,ctrlPressed:!1},!0):(null===(u=null===(c=null===(l=this.mutationCliffs)||void 0===l?void 0:l.get(d.monomerOrCluster))||void 0===c?void 0:c.get(d.positionOrClusterType))||void 0===u?void 0:u.size)&&this.modifyMutationCliffsSelection(d,{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 o,r,s,a,l;const c=e.hitTest(n.offsetX,n.offsetY);if(!(null==c?void 0:c.isTableCell)||(null===(o=null==c?void 0:c.tableColumn)||void 0===o?void 0:o.name)===h.$2.MONOMER||(null===(r=null==c?void 0:c.tableColumn)||void 0===r?void 0:r.name)&&this._monomerMetaColumns.has(c.tableColumn.name))return;const u=this.getMonomerPosition(c);this.mode===i.INVARIANT_MAP?(this.modifyInvariantMapSelection(u,{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(u.monomerOrCluster))||void 0===a?void 0:a.get(u.positionOrClusterType))||void 0===l?void 0:l.size)&&this.modifyMutationCliffsSelection(u,{shiftPressed:n.shiftKey,ctrlPressed:n.ctrlKey}),e.invalidate(),this.showHelp()})),I(e);const r=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$2.MONOMER);if(40!==t.width){t.width=40;for(const t of n)e.col(t).width=40}else r.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(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:t.tableColumn.name}}render(){var t,e,n;if(d()(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 o=this.getProperty(r.COLOR);o&&(o.choices=g()(a.shell.t.columns.numerical).toArray().map((t=>t.name)),o.get(this)===h.$2.ACTIVITY_SCALED&&o.set(this,h.$2.ACTIVITY)),d()(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=>{d()(t.root).find(".ui-input-editor").css("margin","0px").attr("type","radio"),d()(t.root).find(".ui-input-description").css("padding","0px").css("padding-right","16px"),d()(t.captionLabel).addClass("ui-label-right")};n(t),n(e),s=l.divH([t.root,e.root],{id:"pep-viewer-title"}),d()(s).css("width","auto").css("align-self","center")}const c=this.viewerGrid.root;c.style.width="auto";const u=l.iconFA("expand-alt",(()=>{const t=l.dialog();t.add(l.divV([s,c],{style:{height:"100%"}})),t.onCancel((()=>this.render())),t.showModal(!0),this.viewerGrid.invalidate()}),"Show Sequence Variability Map Table in full screen");d()(u).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([u,s,f],{style:{alignSelf:"center",lineHeight:"normal",flexDirection:"column"}});this.root.appendChild(l.divV([m,c])),null===(n=this.viewerGrid)||void 0===n||n.invalidate()}}class O extends N{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),o=new Array(n.length),r=new Array(n.length),s=new Array(n.length),a=new Array(n.length),l=new Array(n.length),u=this.getTotalViewerAggColumns(),d=u.map((([t,e])=>(0,v.hX)(e,t))),f=new Array(d.length);d.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===h.wf.HIGH&&C[1].meanDifference<e.meanDifference||this.activityTarget===h.wf.LOW&&C[1].meanDifference>e.meanDifference)&&(C=[t,e]);if(null===C)continue;n[p]=parseInt(m),i[p]=C[0],o[p]=C[1].meanDifference,r[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=c.BitSet.fromBytes(w.mask.buffer.buffer,this.model.df.col(this.activityColumnName).length);for(let t=0;t<d.length;t++){const[e,n]=u[t];f[t][p]=(0,v.lh)(this.model.df.getCol(e),n,b)}++p}n.length=p,i.length=p,o.length=p,r.length=p,s.length=p,a.length=p,l.length=p;const m=c.DataFrame.create(p),g=m.columns;return g.add(c.Column.fromList(c.TYPE.INT,h.$2.POSITION,n)),g.add(c.Column.fromList(c.TYPE.STRING,h.$2.MONOMER,i)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.MEAN_DIFFERENCE,o)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.MEAN,l)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.P_VALUE,r)),g.add(c.Column.fromList(c.TYPE.INT,h.$2.COUNT,s)),g.add(c.Column.fromList(c.TYPE.FLOAT,h.$2.RATIO,a)),d.forEach(((t,e)=>g.add(c.Column.fromList(c.TYPE.FLOAT,t,f[e])))),m}createViewerGrid(){const t=this.createMostPotentResiduesDf(),e=t.plot.grid();e.sort([h.$2.POSITION]);const n=e.col(h.$2.P_VALUE);n.format="#.000",n.name="P-value";const i=t.getCol(h.$2.MONOMER);f.rI(i,this.alphabet,!0),e.onCellRender.subscribe((t=>L(t,this,!1))),e.onCellTooltip(((t,e,n)=>{var i,o;if(!t.isTableCell)return this.model.unhighlight(),!0;const r=this.getMonomerPosition(t);if((0,b.dl)(r,this.dataFrame,this.monomerPositionStats),this.model.isHighlighting=!0,(null===(i=t.tableColumn)||void 0===i?void 0:i.name)===h.$2.MONOMER)r.positionOrClusterType=h.$2.MONOMER;else if((null===(o=t.tableColumn)||void 0===o?void 0:o.name)!==h.$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.D)(this.model.df,this.getScaledActivityColumn(),s,{fromViewer:!0,isMostPotentResidues:!0,monomerPosition:r,x:e,y:n,mpStats:this.monomerPositionStats,aggrColValues:a})})),c.debounce(e.onCurrentCellChanged,500).subscribe((n=>{var i,o,r;try{if(this.keyPressed&&t.currentCol.name!==h.$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===(r=null===(o=null===(i=this.mutationCliffs)||void 0===i?void 0:i.get(s.monomerOrCluster))||void 0===o?void 0:o.get(s.positionOrClusterType))||void 0===r?void 0:r.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,o;const r=e.hitTest(t.offsetX,t.offsetY);if(!(null==r?void 0:r.isTableCell)||r.tableColumn.name!==h.$2.MEAN_DIFFERENCE)return;const s=this.getMonomerPosition(r);(null===(o=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===o?void 0:o.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))))})),I(e);const o=e.col(h.$2.MEAN_DIFFERENCE);o.name="Diff";const r=e.onAfterDrawContent.subscribe((()=>{const t=e.col(h.$2.MONOMER);40!==t.width?(t.width=40,o.width=40):r.unsubscribe()}));return e}getMonomerPosition(t){return{monomerOrCluster:t.cell.dataFrame.get(h.$2.MONOMER,t.tableRowIndex),positionOrClusterType:`${t.cell.dataFrame.get(h.$2.POSITION,t.tableRowIndex)}`}}render(){var t;if(d()(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 L(t,e,n,i,o){var r,s,a,l,u;const d=[...e.positionColumns.map((t=>t.name)),h.$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===(r=g.tableColumn)||void 0===r?void 0:r.name,y=g.tableRowIndex;if(!g.isTableCell||-1===d.indexOf(v))return void p.restore();const C=g.grid.table,w=C.get(h.$2.MONOMER,y),b=v!==h.$2.MEAN_DIFFERENCE?v:C.get(h.$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[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==a?a:{};let o=c.Color.white;null!=i[w]?o=i[w]:e instanceof M&&(e.cacheInvariantMapColors(),o=null!==(u=(null!==(l=n.temp[h.gp.INVARIANT_MAP_COLOR_CACHE])&&void 0!==l?l:{})[w])&&void 0!==u?u:c.Color.white),f.rW(p,w,b,e.invariantMapSelection,t,m,o)}else f.Yd(p,w,b,e,m);t.preventDefault(),p.restore()}function I(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,o=n(7389),r=n(6082),s=n(7233),a=n.n(s),l=n(4139),c=n(5070),u=n(8608),d=n(5480),h=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 o.divText("No distribution");const n=()=>{const n=[C(f,t,e)];for(const o of Object.values(i))"true"!==t.getTag(o)||o===i.SEPARATE_CLUSTERS&&!e.clusterColName||n.push(C(o,t,e));return 1===n.length?n[0]:o.div(n)},r=o.div(n()),s=Object.values(i),l=new Array(s.length);for(let c=0;c<s.length;c++){const u=s[c].substring(8);l[c]=o.input.bool(u,{value:"true"===t.getTag(s[c]),onValueChanged:e=>{t.setTag(s[c],`${e}`),a()(r).empty(),r.append(n())}}),a()(l[c].captionLabel).addClass("ui-label-right").css("text-align","left"),a()(l[c].root).find(".ui-input-editor").css("margin","0px"),a()(l[c].root).find(".ui-input-description").css("margin","0px"),l[c].setTooltip(`Show distribution for each ${u}`),u===i.SEPARATE_CLUSTERS?l[c].enabled=!(!e.clusterColName||!e.clusterSelection[d.W.ORIGINAL]):u!==i.SEPARATE_MONOMERS&&u!==i.SEPARATE_POSITIONS||(l[c].enabled=0!==Object.entries(e.monomerPositionSelection).length)}const c=o.form(l);return o.divV([c,r])}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 o=g((0,u.FZ)(n.activityCol,t.selection,n.peptideSelection)),s=(0,c.I_)(t,Object.entries(n.columns),{filterDf:!0,mask:r.BitSet.fromBytes(e.mask.buffer.buffer,e.mask.length)}),l=v(e),d=Object.assign(Object.assign({},l),s),h=(0,u.F2)(o,d,i);return a()(h).addClass("d4-flex-col"),h}function C(t,e,n){let r=o.divText("No distribution");switch(t){case f:const t=h.A.fromSeq(e.selection.length,(t=>e.selection.get(t))),s=e.selection.anyTrue&&e.selection.anyFalse?(0,c.GT)(n.activityCol.getRawData(),t):{count:n.activityCol.length,pValue:null,meanDifference:0,ratio:1,mask:t,mean:n.activityCol.stats.avg};r=y(e,s,n);break;case i.SEPARATE_CLUSTERS:r=function(t,e,n){const i=t.rowCount,r=[],s=e.activityCol.getRawData(),a=t.getCol(e.clusterColName),l=a.categories,f=a.getRawData(),p=n[d.W.ORIGINAL].map((t=>l.indexOf(t))),m=new Array(p.length).fill(new h.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],o=(0,c.GT)(s,m[n]);r.push(y(t,o,e,{[u.AN.SELECTION]:l[i]}))}const g=n[d.W.CUSTOM];for(const n of g){const o=t.getCol(n),a=h.A.fromUint32Array(i,o.getRawData()),l=(0,c.GT)(s,a);r.push(y(t,l,e,{[u.AN.SELECTION]:n}))}return o.div(r,"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);r=function(t,e,n){var i,r,s;const a=Object.keys(n),l=t.rowCount,d=[],f=[],p=[],m=[],g=e.activityCol.getRawData();for(const o of a){const a=n[o],v=new h.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!==(r=p[e])&&void 0!==r||(p[e]=f[e].categories),null!==(s=m[e])&&void 0!==s||(m[e]=f[e].getRawData());const c=p[e].indexOf(o);for(let t=0;t<l;t++)m[e][t]===c&&v.setTrue(t)}const C=(0,c.GT)(g,v);d.push(y(t,C,e,{[u.AN.SELECTION]:o}))}return o.div(d,"d4-flex-wrap")}(e,n,a);break;case i.SEPARATE_POSITIONS:r=function(t,e,n){var i,r,s;const a=Object.keys(n),l=t.rowCount,d=[],f=e.activityCol.getRawData(),p=[],m=[],g=[];for(let o=0;o<a.length;o++){const v=a[o],C=n[v];if(0===C.length)continue;null!==(i=p[o])&&void 0!==i||(p[o]=t.getCol(v)),null!==(r=m[o])&&void 0!==r||(m[o]=p[o].categories),null!==(s=g[o])&&void 0!==s||(g[o]=p[o].getRawData());const w=new h.A(t.rowCount);for(let t=0;t<C.length;t++){const e=C[t],n=m[o].indexOf(e);for(let t=0;t<l;t++)g[o][t]===n&&w.setTrue(t)}const b=(0,c.GT)(f,w);d.push(y(t,b,e,{[u.AN.SELECTION]:v}))}return o.div(d,"d4-flex-wrap")}(e,n,n.monomerPositionSelection)}return o.divV([o.h1(p(t)),r])}},7923:(t,e,n)=>{"use strict";n.d(e,{F:()=>l});var i=n(7389),o=n(6082),r=n(4139),s=n(8608),a=n(2935);function l(t,e,n=!0){const r=c(t,e);if(!r)return new o.Widget(i.label("No mutations table generated"));const{pairsGrid:a,uniqueSequencesGrid:l,aminoToInput:u}=r,d=[a,l],h=i.divV([u.root,...d.map((t=>t.root))],{style:{width:"100%"}});return n&&(0,s.BE)("Mutation Cliffs pairs",u.root,h,(()=>{const n=c(t,e);return i.divV([n.aminoToInput.root,n.pairsGrid.root,n.uniqueSequencesGrid.root],{style:{width:"100%",height:"100%"}})})),new o.Widget(h)}function c(t,e){var n,l;const c=t.filter.getSelectedIndexes(),u=Object.keys(e.mutationCliffsSelection);if(!u.length||null===e.mutationCliffs)return null;const d=[],h=[],f=[],p=[],m=[],g=t.getCol(e.sequenceColumnName),v=g.categories,y=g.getRawData(),C=e.activityCol.getRawData(),w=new Map,b=o.BitSet.create(t.rowCount),A=Object.fromEntries(e.positionColumns.map((t=>[t.name,t])));for(const t of u){const i=A[t],o=i.categories,r=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(!c.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)||!c.includes(a))continue;w.has(a)||w.set(a,[]);const e=v[y[a]];w.get(a).push(t),d.push(`${i}#${e}`),h.push(s-C[a]),f.push(o[r[a]]),p.push(t),m.push(a),b.set(t,!0),b.set(a,!0)}}}}if(0===d.length)return null;const E=o.Column.fromStrings("Mutation",d),S=o.Column.fromList("double","Delta",h),x=o.Column.fromStrings("~to",f),T=o.Column.fromList(o.COLUMN_TYPE.INT,"~toIdx",m),_=o.Column.fromList(o.COLUMN_TYPE.INT,"~fromIdx",p),N=o.DataFrame.fromColumns([E,S,x,T,_]);N.name="Mutation Cliff pairs";const M=i.input.string("Mutated to:",{value:"",onValueChanged:t=>{const e=t;""!==e?N.filter.init((t=>x.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=r.uF.MACROMOLECULE_DIFFERENCE,E.tags[r.gp.SEPARATOR]=(0,s.AY)(g),E.tags[o.TAGS.UNITS]=g.tags[o.TAGS.UNITS],E.tags[o.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(T.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:()=>c});var i=n(4328),o=(n(7389),n(6082)),r=(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(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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,n,c,u,d){return l(this,arguments,void 0,(function*(t,e,n,l,c,u,d={}){var h,f,p,m,g;let v=null;if(t.type!==o.COLUMN_TYPE.FLOAT&&t.type!==o.COLUMN_TYPE.INT&&t.type!==o.COLUMN_TYPE.QNUM)return i.shell.error("The activity column must be of numeric type!"),v;const y=o.TaskBarProgressIndicator.create("Loading SAR..."),C=o.DataFrame.create(l.rowCount);C.name="Peptides analysis";const w=C.columns;w.add(c);for(const t of l.columns)"true"!==t.getTag(r.gp.ANALYSIS_COL)&&(t.name.toLowerCase()===c.name.toLowerCase()&&(t.name=l.columns.getUnusedName(t.name)),w.add(t));const b={sequenceColumnName:e.name,activityColumnName:t.name,activityScaling:u,columns:{},showDendrogram:!1,showSequenceSpace:!1,sequenceSpaceParams:new s.GI(!!d.useEmbeddingsClusters&&!n),mclSettings:null!==(h=d.mclSettings)&&void 0!==h?h:new s.av};if(n){const t=C.getCol(n.name);t.type!==o.COLUMN_TYPE.STRING&&w.replace(t,t.convertTo(o.COLUMN_TYPE.STRING))}C.setTag(r.gp.SETTINGS,JSON.stringify(b));const A=o.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:u,activityColumnName:t.name};yield v.addLogoSummaryTable(i)}if(yield v.addMonomerPosition(),yield v.addMostPotentResidues(),null!==(f=d.addSequenceSpace)&&void 0!==f&&f){if(yield v.addSequenceSpace({clusterCol:n,clusterEmbeddings:d.useEmbeddingsClusters}),!n&&null!==(p=d.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)===o.COLUMN_TYPE.STRING}));if(n){const i={clustersColumnName:n,sequenceColumnName:e.name,activityScaling:u,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=d.addMCL)&&void 0!==m&&m&&(yield v.addMCLClusters(),!n&&null!==(g=d.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:u,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,o,r,s,a,l,c=n(7389),u=n(4328),d=n(6082),h=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"}(o||(o={})),function(t){t.DENDROGRAM="Dendrogram"}(r||(r={})),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]:o,[i.VIEWERS]:r,[i.COLUMNS]:s,[i.SEQUENCE_SPACE]:a,[i.MCL]:l};function A(t){var e,n,r,m,v,b,A,E,S,x;null==t.settings&&u.log.error("PeptidesError: Settings are not initialized");const T=c.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!==(r=null==_?void 0:_.sequenceSpaceParams)&&void 0!==r?r:new h.GI,R=null!==(m=null==_?void 0:_.mclSettings)&&void 0!==m?m:new h.av,P=c.input.column(o.ACTIVITY,{table:t.df,value:t.df.getCol(t.settings.activityColumnName),onValueChanged:t=>{O.activityColumnName=t.name},filter:t=>(t.type===d.TYPE.FLOAT||t.type===d.TYPE.INT)&&t.name!==f.$2.ACTIVITY&&0===t.stats.missingValueCount});P.setTooltip("Numeric activity column");const k=c.input.choice(o.ACTIVITY_SCALING,{value:N,items:Object.values(f.rg),onValueChanged:t=>O.activityScaling=t});k.setTooltip("Activity column transformation method"),T.addPane(i.GENERAL,(()=>c.inputs([P,k])),!0),L[i.GENERAL]=[P,k];const G=y()(t.analysisView.viewers).some((t=>t.type===p.q.DENDROGRAM)),D=c.input.bool(p.q.DENDROGRAM,{value:null!=G&&G,onValueChanged:t=>O.showDendrogram=t}),U=c.input.bool(p.q.CLUSTER_MAX_ACTIVITY,{value:!!(null==_?void 0:_.showClusterMaxActivity),onValueChanged:t=>{O.showClusterMaxActivity=null!=t?t:void 0}}),V=c.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)(),T.addPane(i.VIEWERS,(()=>c.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=c.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=c.input.choice(s.AGGREGATION,{value:null!==(v=M[t])&&void 0!==v?v:d.AGG.AVG,items:Object.values(d.STATS),onValueChanged:i=>{var o;null!==(o=O.columns)&&void 0!==o||(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 o=c.inputsRow(e.name,[n,i]);H.push(n,i),g()(o).find("div.ui-div").css("display","inline-flex"),F.push(o)}0!==F.length&&(T.addPane(i.COLUMNS,(()=>c.divV(F)),!1),L[i.COLUMNS]=H);const q={};function B(t,e){if(Z(),null==e||""===e)return;q[t]=e;let n=!0;for(const[t,e]of Object.entries(q))if(e!==I[t]){n=!1;break}n?delete O.sequenceSpaceParams:O.sequenceSpaceParams=Object.assign(Object.assign({},I),q)}function Y(t,e){t.forEach((t=>{t.root.style.display=e?"flex":"none"}))}const $=c.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=>B("distanceF",t)});$.setTooltip("Distance function for sequences");const j=c.input.float(a.GAP_OPEN,{value:I.gapOpen,onValueChanged:t=>B("gapOpen",t)}),W=c.input.float(a.GAP_EXTEND,{value:I.gapExtend,onValueChanged:t=>B("gapExtend",t)}),z=c.input.bool(a.CLUSTER_EMBEDDINGS,{value:null!==(b=I.clusterEmbeddings)&&void 0!==b&&b,onValueChanged:t=>B("clusterEmbeddings",t)});z.setTooltip("Cluster embeddings using DBSCAN algorithm");const K=c.input.float(a.EPSILON,{value:I.epsilon,onValueChanged:t=>B("epsilon",t)});K.setTooltip("Epsilon parameter for DBSCAN. Minimum distance between two points to be considered as a cluster");const Q=c.input.int(a.MIN_PTS,{value:I.minPts,onValueChanged:t=>B("minPts",t)});Q.setTooltip("Minimum number of points in a cluster");const X=c.input.choice(a.FINGERPRINT_TYPE,{value:I.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>B("fingerprintType",t)});function Z(){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)}Z();const J={};function tt(t,e){if(et(),null==e||""===e)return;J[t]=e;let n=!0;for(const[t,e]of Object.entries(J))if(e!==R[t]){n=!1;break}n?delete O.mclSettings:O.mclSettings=Object.assign(Object.assign({},R),J)}function et(){Y([it,ot],nt.value===w.Z.NEEDLEMANN_WUNSCH),Y([rt],nt.value===w.Z.MONOMER_CHEMICAL_DISTANCE||nt.value===w.Z.NEEDLEMANN_WUNSCH)}const nt=c.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=c.input.float(l.GAP_OPEN,{value:R.gapOpen,onValueChanged:t=>tt("gapOpen",t)}),ot=c.input.float(l.GAP_EXTEND,{value:R.gapExtend,onValueChanged:t=>tt("gapExtend",t)}),rt=c.input.choice(l.FINGERPRINT_TYPE,{value:R.fingerprintType,items:["Morgan","RDKit","Pattern","AtomPair","MACCS","TopologicalTorsion"],onValueChanged:t=>tt("fingerprintType",t)}),st=c.input.int(l.THRESHOLD,{value:null!==(A=R.threshold)&&void 0!==A?A:80,onValueChanged:t=>tt("threshold",t)}),at=c.input.int(l.MAX_ITERATIONS,{value:null!==(E=R.maxIterations)&&void 0!==E?E:5,onValueChanged:t=>tt("maxIterations",t)}),lt=c.input.float(l.INFLATION,{value:null!==(S=R.inflation)&&void 0!==S?S:1.4,onValueChanged:t=>{tt("inflation",t)}}),ct=c.input.bool(l.USE_WEBGPU,{value:R.useWebGPU,onValueChanged:t=>tt("useWebGPU",t)});ct.enabled=!1,R.webGPUDescriptionPromise.then((()=>{R.webGPUDescription!==h.Ku?(ct.setTooltip(`Use WebGPU for MCL algorithm (${R.webGPUDescription})`),ct.enabled=!0):(ct.setTooltip(h.Ku),ct.enabled=!1,ct.value=!1)}));const ut=c.input.int(l.MIN_CLUSTER_SIZE,{value:null!==(x=R.minClusterSize)&&void 0!==x?x:5,onValueChanged:t=>tt("minClusterSize",t)});et();const dt=[st,nt,rt,it,ot,lt,at,ut,ct];T.addPane(i.MCL,(()=>c.inputs(dt)),!0),L[i.MCL]=dt;const ht=[$,X,j,W,z,K,Q],ft=T.addPane(i.SEQUENCE_SPACE,(()=>c.inputs(ht)),!0);L[i.SEQUENCE_SPACE]=ht,V.fireChanged();const pt=c.dialog("Peptides settings").add(T);return pt.root.style.width="400px",pt.onOK((()=>{t.settings=O})),pt.show(),{dialog:pt,accordion:T,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 o=e[i]={exports:{},id:i,loaded:!1};return t[i].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var i=n(1).default,o=n(39).default,r=n(52).default,s=n(40).default,a=n(54).default,l=n(80).default,c=n(84).default,u=n(65).default,d=t.exports=function(t){if(!p(t))throw new Error("wu: `"+t+"` is not iterable!");return new h(t)};function h(t){var e=m(t);this.next=e.next.bind(e)}d.prototype=h.prototype,d.prototype[r]=function(){return this};var f={},p=function(t){return t&&"function"==typeof t[r]},m=function(t){if(p(t))return s(t);throw new TypeError("Not iterable: "+t)},g=function(t,e){e.prototype=h.prototype,d[t]=e},v=function(t,e){var n=arguments.length<=2||void 0===arguments[2]?e.length:arguments[2];return e.prototype=h.prototype,h.prototype[t]=e,n+=1,void(d[t]=d.curryable((function(){for(var e,n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];var r=i.pop();return(e=d(r))[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 d(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 o=arguments.length,r=Array(o),s=0;s<o;s++)r[s]=arguments[s];return r.length>=e?t.apply(this,r):function(t,e){return function(){for(var n=arguments.length,o=Array(n),r=0;r<n;r++)o[r]=arguments[r];return t.call.apply(t,[this].concat(i(e),o))}}(n,r)}})),C("entries",a.mark((function t(e){var n,i,o,r,c,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(l(e));case 5:if(n=(c=r.next()).done){t.next=12;break}return u=c.value,t.next=9,[u,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,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){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]])}))),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,o,r,c,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(l(e));case 5:if(n=(c=r.next()).done){t.next=12;break}return u=c.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,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){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("cycle",a.mark((function t(){var e,n,i,o,r,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=[],n=!0,i=!1,o=void 0,t.prev=4,r=s(this);case 6:if(n=(l=r.next()).done){t.next=14;break}return c=l.value,t.next=10,c;case 10:e.push(c);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,o=t.t0;case 20:t.prev=20,t.prev=21,!n&&r.return&&r.return();case 23:if(t.prev=23,!i){t.next=26;break}throw o;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,o,r,l,c,u,d,h=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,o=h.length,r=Array(o),l=0;l<o;l++)r[l]=h[l];c=s(r);case 6:if(e=(u=c.next()).done){t.next=12;break}return d=u.value,t.delegateYield(d,"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&&c.return&&c.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,o,r,l,c,u,d=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,o=!1,r=void 0,t.prev=5,l=s(this);case 7:if(i=(c=l.next()).done){t.next=18;break}if(u=c.value,e[n++]=u,n!==d){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),o=!0,r=t.t0;case 24:t.prev=24,t.prev=25,!i&&l.return&&l.return();case 27:if(t.prev=27,!o){t.next=30;break}throw r;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,o,r,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=11;break}return c=l.value,t.delegateYield(e(c),"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,o=t.t1;case 17:t.prev=17,t.prev=18,!n&&r.return&&r.return();case 20:if(t.prev=20,!i){t.next=23;break}throw o;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,o,r,l,c,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=0,i=!0,o=!1,r=void 0,t.prev=4,l=s(this);case 6:if(i=(c=l.next()).done){t.next=16;break}if(u=c.value,!(n++<e)){t.next=10;break}return t.abrupt("continue",13);case 10:return t.next=12,u;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),o=!0,r=t.t0;case 22:t.prev=22,t.prev=23,!i&&l.return&&l.return();case 25:if(t.prev=25,!o){t.next=28;break}throw r;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,o,r,l,c=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,o=s(this);case 5:if(e=(r=o.next()).done){t.next=15;break}if(l=r.value,!c(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&&o.return&&o.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,d.count()]),"t0",1);case 1:case"end":return t.stop()}}),t,this)}))),w("filter",a.mark((function t(){var e,n,i,o,r,l,c=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,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}if(l=r.value,!c(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&&o.return&&o.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,o,r,l,c=!(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,o=s(this);case 5:if(e=(r=o.next()).done){t.next=16;break}if("string"==typeof(l=r.value)||!p(l)){t.next=11;break}return t.delegateYield(c?l:d(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&&o.return&&o.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,o,r,l,c,u,d,h,f=arguments;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=!0,i=!1,o=void 0,t.prev=3,r=f.length,l=Array(r>1?r-1:0),c=1;c<r;c++)l[c-1]=f[c];u=s(this);case 6:if(n=(d=u.next()).done){t.next=13;break}return h=d.value,t.next=10,h[e].apply(h,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,o=t.t0;case 19:t.prev=19,t.prev=20,!n&&u.return&&u.return();case 22:if(t.prev=22,!i){t.next=25;break}throw o;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,o,r,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=12;break}return c=l.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,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){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("pluck",a.mark((function t(e){var n,i,o,r,l,c;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,i=!1,o=void 0,t.prev=3,r=s(this);case 5:if(n=(l=r.next()).done){t.next=12;break}return c=l.value,t.next=9,c[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,o=t.t0;case 18:t.prev=18,t.prev=19,!n&&r.return&&r.return();case 21:if(t.prev=21,!i){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("reductions",a.mark((function t(e){var n,i,o,r,l,c,u,d,h,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,o=!1,r=void 0,t.prev=5,l=s(this);case 7:if(i=(c=l.next()).done){t.next=14;break}return u=c.value,n=u,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),o=!0,r=t.t0;case 20:t.prev=20,t.prev=21,!i&&l.return&&l.return();case 23:if(t.prev=23,!o){t.next=26;break}throw r;case 26:return t.finish(23);case 27:return t.finish(20);case 28:return t.next=30,n;case 30:d=!0,h=!1,f=void 0,t.prev=33,p=s(this);case 35:if(d=(m=p.next()).done){t.next=42;break}return u=m.value,t.next=39,n=e(n,u);case 39:d=!0,t.next=35;break;case 42:t.next=48;break;case 44:t.prev=44,t.t1=t.catch(33),h=!0,f=t.t1;case 48:t.prev=48,t.prev=49,!d&&p.return&&p.return();case 51:if(t.prev=51,!h){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,o,r,l,c=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,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}if(l=r.value,c(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&&o.return&&o.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,r,l,c,u,d,h=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<h)){t.next=2;break}throw new RangeError("parameter `stop` (= "+f+") must be >= `start` (= "+h+")");case 2:e=!0,n=!1,i=void 0,t.prev=5,r=s(this.enumerate());case 7:if(e=(l=r.next()).done){t.next=20;break}if(c=o(l.value,2),u=c[0],!((d=c[1])<h)){t.next=13;break}return t.abrupt("continue",17);case 13:if(!(d>=f)){t.next=15;break}return t.abrupt("break",20);case 15:return t.next=17,u;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&&r.return&&r.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,o,r,l,c,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=!0,o=!1,r=void 0,t.prev=3,l=s(this);case 5:if(n=(c=l.next()).done){t.next=12;break}return u=c.value,t.next=9,e.apply(void 0,i(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),o=!0,r=t.t0;case 18:t.prev=18,t.prev=19,!n&&l.return&&l.return();case 21:if(t.prev=21,!o){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("take",a.mark((function t(e){var n,i,o,r,l,c,u;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,o=!1,r=void 0,t.prev=6,l=s(this);case 8:if(i=(c=l.next()).done){t.next=17;break}return u=c.value,t.next=12,u;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),o=!0,r=t.t0;case 23:t.prev=23,t.prev=24,!i&&l.return&&l.return();case 26:if(t.prev=26,!o){t.next=29;break}throw r;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,o,r,l,c=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,o=s(this);case 5:if(e=(r=o.next()).done){t.next=14;break}if(l=r.value,c(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&&o.return&&o.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,o,r,l,c=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,o=s(this);case 5:if(e=(r=o.next()).done){t.next=13;break}return l=r.value,c(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&&o.return&&o.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,o,r,l,u;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=new c,n=!0,i=!1,o=void 0,t.prev=4,r=s(this);case 6:if(n=(l=r.next()).done){t.next=15;break}if(u=l.value,e.has(u)){t.next=12;break}return t.next=11,u;case 11:e.add(u);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,o=t.t0;case 21:t.prev=21,t.prev=22,!n&&r.return&&r.return();case 24:if(t.prev=24,!i){t.next=27;break}throw o;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,o,r,l,c,u,d,h,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,o=0,r=!1;case 6:if(r){t.next=44;break}l=[],c=!0,u=!1,d=void 0,t.prev=11,h=s(n);case 13:if(c=(f=h.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:++o==i&&(r=!0);case 22:void 0===v?l.length++:l.push(v);case 23:c=!0,t.next=13;break;case 26:t.next=32;break;case 28:t.prev=28,t.t0=t.catch(11),u=!0,d=t.t0;case 32:t.prev=32,t.prev=33,!c&&h.return&&h.return();case 35:if(t.prev=35,!u){t.next=38;break}throw d;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),o=1;o<n;o++)i[o-1]=arguments[o];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)}))),d.MAX_BLOCK=15,d.TIMEOUT=1,v("asyncEach",(function(t){var e=arguments.length<=1||void 0===arguments[1]?d.MAX_BLOCK:arguments[1],n=arguments.length<=2||void 0===arguments[2]?d.TIMEOUT:arguments[2],i=m(this);return new u((function(o,r){!function a(){var l=Date.now(),c=!0,u=!1,d=void 0;try{for(var h,f=s(i);!(c=(h=f.next()).done);c=!0){var p=h.value;try{t(p)}catch(t){return void r(t)}if(Date.now()-l>e)return void setTimeout(a,n)}}catch(t){u=!0,d=t}finally{try{!c&&f.return&&f.return()}finally{if(u)throw d}}o()}()}))}),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 o,r=s(this);!(e=(o=r.next()).done);e=!0)if(!t(o.value))return!1}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}return!0}),1),v("find",(function(t){var e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0){var a=o.value;if(t(a))return a}}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.return()}finally{if(n)throw i}}})),v("forEach",(function(t){var e=!0,n=!1,i=void 0;try{for(var o,r=s(this);!(e=(o=r.next()).done);e=!0)t(o.value)}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.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,o=void 0;try{for(var r,a=s(this);!(n=(r=a.next()).done);n=!0){e=r.value;break}}catch(t){i=!0,o=t}finally{try{!n&&a.return&&a.return()}finally{if(i)throw o}}}var l=!0,c=!1,u=void 0;try{for(var d,h=s(this);!(l=(d=h.next()).done);l=!0)e=t(e,d.value)}catch(t){c=!0,u=t}finally{try{!l&&h.return&&h.return()}finally{if(c)throw u}}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 o,r=s(this);!(e=(o=r.next()).done);e=!0)if(t(o.value))return!0}catch(t){n=!0,i=t}finally{try{!e&&r.return&&r.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,o,r,s,l;return a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n.items,o=0;case 2:if(o!==i.length){t.next=14;break}if(r=e.next(),s=r.done,l=r.value,!s){t.next=10;break}return n.returned===f&&(n.returned=l),t.abrupt("break",25);case 10:return t.next=12,i[o++]=l;case 12:t.next=23;break;case 14:if(o!==n.tail){t.next=21;break}return l=i[o],500===o?(i=n.items=i.slice(o),o=0,n.tail=0):(i[o]=void 0,n.tail=++o),t.next=19,l;case 19:t.next=23;break;case 21:return t.next=23,i[o++];case 23:t.next=2;break;case 25:return n.tail===o&&(i.length=0),t.abrupt("return",n.returned);case 27:case"end":return t.stop()}}),t,this)})));A.prototype=h.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),d.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),o=n(7);t.exports=function(t){return function(e,n){var r,s,a=String(o(e)),l=i(n),c=a.length;return l<0||l>=c?t?"":void 0:(r=a.charCodeAt(l))<55296||r>56319||l+1===c||(s=a.charCodeAt(l+1))<56320||s>57343?t?a.charAt(l):r:t?a.slice(l,l+2):s-56320+(r-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),o=n(10),r=n(13),s=n(14),a=n(19),l=n(20)("iterator"),c=n(23),u=!([].keys&&"next"in[].keys()),d="@@iterator",h="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 h:case f:return function(){return new m(this,t)}}return function(){return new m(this,t)}},E=e+" Iterator",S=t.prototype,x=S[l]||S[d]||v&&S[v],T=x||A(v);if(x){var _=n(15).getProto(T.call(new t));n(25)(_,E,!0),!i&&a(S,d)&&s(_,l,p)}if(i&&!C||s(S,l,T),c[e]=T,c[E]=p,v)if(w={keys:y?T:A(h),values:v==f?T:A(f),entries:v!=f?T:A("entries")},C)for(b in w)b in S||r(S,b,w[b]);else o(o.P+o.F*u,e,w)}},function(t,e){t.exports=!0},function(t,e,n){var i=n(11),o=n(12),r="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},a=function(t,e,n){var l,c,u,d,h=t&a.G,f=t&a.P,p=h?i:t&a.S?i[e]:(i[e]||{})[r],m=h?o:o[e]||(o[e]={});for(l in h&&(n=e),n)(c=!(t&a.F)&&p&&l in p)&&l in m||(u=c?p[l]:n[l],h&&"function"!=typeof p[l]?d=n[l]:t&a.B&&c?d=s(u,i):t&a.W&&p[l]==u?function(t){(d=function(e){return this instanceof t?new t(e):t(e)})[r]=t[r]}(u):d=f&&"function"==typeof u?s(Function.call,u):u,m[l]=d,f&&((m[r]||(m[r]={}))[l]=u))};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),o=n(16);t.exports=n(17)?function(t,e,n){return i.setDesc(t,e,o(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"),o=n(11).Symbol;t.exports=function(t){return i[t]||(i[t]=o&&o[t]||(o||n(22))("Symbol."+t))}},function(t,e,n){var i=n(11),o="__core-js_shared__",r=i[o]||(i[o]={});t.exports=function(t){return r[t]||(r[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),o={};n(14)(o,n(20)("iterator"),(function(){return this})),t.exports=function(t,e,r){t.prototype=i.create(o,{next:n(16)(1,r)}),n(25)(t,e+" Iterator")}},function(t,e,n){var i=n(19),o=n(14),r=n(20)("toStringTag");t.exports=function(t,e,n){t&&!i(t=n?t:t.prototype,r)&&o(t,r,e)}},function(t,e,n){"use strict";var i=n(27),o=n(10),r=n(29),s=n(30),a=n(33),l=n(34),c=n(35);o(o.S+o.F*!n(38)((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,o,u,d=r(t),h="function"==typeof this?this:Array,f=arguments[1],p=void 0!==f,m=0,g=c(d);if(p&&(f=i(f,arguments[2],2)),null==g||h==Array&&a(g))for(n=new h(e=l(d.length));e>m;m++)n[m]=p?f(d[m],m):d[m];else for(u=g.call(d),n=new h;!(o=u.next()).done;m++)n[m]=p?s(u,f,[o.value,m],!0):o.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,o){return t.call(e,n,i,o)}}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,o){try{return o?e(i(n)[0],n[1]):e(n)}catch(e){var r=t.return;throw void 0!==r&&i(r.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),o=n(20)("iterator");t.exports=function(t){return(i.Array||Array.prototype[o])===t}},function(t,e,n){var i=n(6),o=Math.min;t.exports=function(t){return t>0?o(i(t),9007199254740991):0}},function(t,e,n){var i=n(36),o=n(20)("iterator"),r=n(23);t.exports=n(12).getIteratorMethod=function(t){if(null!=t)return t[o]||t["@@iterator"]||r[i(t)]}},function(t,e,n){var i=n(37),o=n(20)("toStringTag"),r="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))[o])?n:r?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"),o=!1;try{var r=[7][i]();r.return=function(){o=!0},Array.from(r,(function(){throw 2}))}catch(t){}t.exports=function(t){if(!o)return!1;var e=!1;try{var n=[7],r=n[i]();r.next=function(){e=!0},n[i]=function(){return r},t(n)}catch(t){}return e}},function(t,e,n){"use strict";var i=n(40).default,o=n(49).default;e.default=function(t,e){if(Array.isArray(t))return t;if(o(Object(t)))return function(t,e){var n=[],o=!0,r=!1,s=void 0;try{for(var a,l=i(t);!(o=(a=l.next()).done)&&(n.push(a.value),!e||n.length!==e);o=!0);}catch(t){r=!0,s=t}finally{try{!o&&l.return&&l.return()}finally{if(r)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),o=n(45),r=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,o(1)):o(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),r.Arguments=r.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),o=n(7);t.exports=function(t){return i(o(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),o=n(35);t.exports=n(12).getIterator=function(t){var e=o(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),o=n(20)("iterator"),r=n(23);t.exports=n(12).isIterable=function(t){var e=Object(t);return o in e||"@@iterator"in e||r.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,o=i.regeneratorRuntime&&Object.getOwnPropertyNames(i).indexOf("regeneratorRuntime")>=0,r=o&&i.regeneratorRuntime;if(i.regeneratorRuntime=void 0,t.exports=n(55),o)i.regeneratorRuntime=r;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 o=n(57).default,r=n(52).default,s=n(63).default,a=n(65).default;!function(e){var n,l=Object.prototype.hasOwnProperty,c="function"==typeof o&&r||"@@iterator",u="object"==typeof t,d=e.regeneratorRuntime;if(d)u&&(t.exports=d);else{(d=e.regeneratorRuntime=u?t.exports:{}).wrap=y;var h="suspendedStart",f="suspendedYield",p="executing",m="completed",g={},v=A.prototype=w.prototype;b.prototype=v.constructor=A,A.constructor=b,b.displayName="GeneratorFunction",d.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},d.mark=function(t){return t.__proto__=A,t.prototype=s(v),t},d.awrap=function(t){return new S(t)},E(x.prototype),d.async=function(t,e,n,i){var o=new x(y(t,e,n,i));return d.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},E(v),v[c]=function(){return this},v.toString=function(){return"[object Generator]"},d.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}},d.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 r.type="throw",r.arg=t,e.next=n,!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],r=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=l.call(o,"catchLoc"),a=l.call(o,"finallyLoc");if(s&&a){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!a)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.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 o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var r=o?o.completion:{};return r.type=t,r.arg=e,o?this.next=o.finallyLoc:this.complete(r),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 o=i.arg;_(n)}return o}}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,o){var r=s((e||w).prototype);return r._invoke=function(t,e,i){var o=h;return function(r,s){if(o===p)throw new Error("Generator is already running");if(o===m){if("throw"===r)throw s;return O()}for(;;){var a=i.delegate;if(a){if("return"===r||"throw"===r&&a.iterator[r]===n){i.delegate=null;var l=a.iterator.return;if(l&&"throw"===(c=C(l,a.iterator,s)).type){r="throw",s=c.arg;continue}if("return"===r)continue}var c;if("throw"===(c=C(a.iterator[r],a.iterator,s)).type){i.delegate=null,r="throw",s=c.arg;continue}if(r="next",s=n,!(u=c.arg).done)return o=f,u;i[a.resultName]=u.value,i.next=a.nextLoc,i.delegate=null}if("next"===r)i.sent=o===f?s:n;else if("throw"===r){if(o===h)throw o=m,s;i.dispatchException(s)&&(r="next",s=n)}else"return"===r&&i.abrupt("return",s);if(o=p,"normal"===(c=C(t,e,i)).type){o=i.done?m:f;var u={value:c.arg,done:i.done};if(c.arg!==g)return u;i.delegate&&"next"===r&&(s=n)}else"throw"===c.type&&(o=m,r="throw",s=c.arg)}}}(t,i||null,new N(o||[])),r}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 x(t){function e(e,n){var i=t[e](n),s=i.value;return s instanceof S?a.resolve(s.arg).then(o,r):a.resolve(s).then((function(t){return i.value=t,i}))}"object"==typeof i&&i.domain&&(e=i.domain.bind(e));var n,o=e.bind(t,"next"),r=e.bind(t,"throw");e.bind(t,"return"),this._invoke=function(t,i){var o=n?n.then((function(){return e(t,i)})):new a((function(n){n(e(t,i))}));return n=o.catch((function(t){})),o}}function T(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(T,this),this.reset(!0)}function M(t){if(t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=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 o.next=o}}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={},o=[],r=!1,s=-1;function a(){r=!1,n.length?o=n.concat(o):s=-1,o.length&&l()}function l(){if(!r){var t=setTimeout(a);r=!0;for(var e=o.length;e;){for(n=o,o=[];++s<e;)n&&n[s].run();s=-1,e=o.length}n=null,r=!1,clearTimeout(t)}}function c(t,e){this.fun=t,this.array=e}function u(){}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];o.push(new c(t,e)),1!==o.length||r||setTimeout(l,0)},c.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=u,i.addListener=u,i.once=u,i.off=u,i.removeListener=u,i.removeAllListeners=u,i.emit=u,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),o=n(11),r=n(19),s=n(17),a=n(10),l=n(13),c=n(18),u=n(21),d=n(25),h=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,x=o.Symbol,T=!1,_=f("_hidden"),N=i.isEnum,M=u("symbol-registry"),O=u("symbols"),L="function"==typeof x,I=Object.prototype,R=s&&c((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(x.prototype);return e._k=t,s&&T&&R(I,t,{configurable:!0,set:function(e){r(this,_)&&r(this[_],t)&&(this[_][t]=!1),R(this,t,w(1,e))}}),e},k=function(t,e,n){return n&&r(O,e)?(n.enumerable?(r(t,_)&&t[_][e]&&(t[_][e]=!1),n=E(n,{enumerable:w(0,!1)})):(r(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)),o=0,r=i.length;r>o;)k(t,n=i[o++],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||!r(this,t)||!r(O,t)||r(this,_)&&this[_][t])||e},V=function(t,e){var n=b(t=C(t),e);return!n||!r(O,e)||r(t,_)&&t[_][e]||(n.enumerable=!0),n},F=function(t){for(var e,n=S(C(t)),i=[],o=0;n.length>o;)r(O,e=n[o++])||e==_||i.push(e);return i},H=function(t){for(var e,n=S(C(t)),i=[],o=0;n.length>o;)r(O,e=n[o++])&&i.push(O[e]);return i};L||(x=function(){if(this instanceof x)throw TypeError("Symbol is not a constructor");return P(h(arguments[0]))},l(x.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&&!c((function(){return"[null]"!=JSON.stringify([x()])}))||l(x.prototype,"toJSON",(function(){if(L&&v(this))return this}));var q={for:function(t){return r(M,t+="")?M[t]:M[t]=x(t)},keyFor:function(t){return p(M,t)},useSetter:function(){T=!0},useSimple:function(){T=!1}};i.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),(function(t){var e=f(t);q[t]=L?e:P(e)})),T=!0,a(a.G+a.W,{Symbol:x}),a(a.S,"Symbol",q),a(a.S+a.F*!L,"Object",{create:D,defineProperty:k,defineProperties:G,getOwnPropertyDescriptor:V,getOwnPropertyNames:F,getOwnPropertySymbols:H}),d(x,"Symbol"),d(Math,"Math",!0),d(o.JSON,"JSON",!0)},function(t,e,n){var i=n(15),o=n(46);t.exports=function(t,e){for(var n,r=o(t),s=i.getKeys(r),a=s.length,l=0;a>l;)if(r[n=s[l++]]===e)return n}},function(t,e,n){var i={}.toString,o=n(46),r=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 r(t)}catch(t){return s.slice()}}(t):r(o(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 o,r=n(t),s=i.isEnum,a=0;r.length>a;)s.call(t,o=r[a++])&&e.push(o);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,o=n(15),r=n(9),s=n(11),a=n(27),l=n(36),c=n(10),u=n(32),d=n(31),h=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],x=function(t){var e=new S((function(){}));return t&&(e.constructor=Object),S.resolve(e)===e},T=function(){var t=!1;function e(t){var n=new S(t);return m(n,e.prototype),n}try{if(t=S&&S.resolve&&x(),m(e,S),e.prototype=o.create(S.prototype,{constructor:{value:e}}),e.resolve(5).then((function(){}))instanceof e||(t=!1),t&&n(17)){var i=!1;S.resolve(o.setDesc({},"then",{get:function(){i=!0}})),t=i}}catch(e){t=!1}return t}(),_=function(t){var e=d(t)[y];return null!=e?e:t},N=function(t){var e;return!(!u(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,o=1==t.s,r=0,a=function(e){var n,r,s=o?e.ok:e.fail;try{s?(o||(t.h=!0),(n=!0===s?i:s(i))===e.P?e.rej(TypeError("Promise-chain cycle")):(r=N(n))?r.call(n,e.res,e.rej):e.res(n)):e.rej(i)}catch(t){e.rej(t)}};n.length>r;)a(n[r++]);n.length=0,t.n=!1,e&&setTimeout((function(){var e,n,o=t.p;O(o)&&(E?A.emit("unhandledRejection",i,o):(e=s.onunhandledrejection)?e({promise:o,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,o=0;if(n.h)return!1;for(;i.length>o;)if((e=i[o++]).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)}}};T||(S=function(t){h(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=d(d(this).constructor)[y],i={ok:"function"!=typeof t||t,fail:"function"==typeof e&&e},o=i.P=new(null!=n?n:S)((function(t,e){i.res=t,i.rej=e}));h(i.res),h(i.rej);var r=this[C];return r.c.push(i),r.a&&r.a.push(i),r.s&&M(r,!1),o},catch:function(t){return this.then(void 0,t)}})),c(c.G+c.W+c.F*!T,{Promise:S}),n(25)(S,b),v(S),v(i=n(12)[b]),c(c.S+c.F*!T,b,{reject:function(t){return new this((function(e,n){n(t)}))}}),c(c.S+c.F*(!T||x(!0)),b,{resolve:function(t){return u(n=t)&&(T?"Promise"==l(n):C in n)&&(e=t.constructor,r&&e===S&&this===i||g(e,this))?t:new this((function(e){e(t)}));var e,n}}),c(c.S+c.F*!(T&&n(38)((function(t){S.all(t).catch((function(){}))}))),b,{all:function(t){var e=_(this),n=[];return new e((function(i,r){p(t,!1,n.push,n);var s=n.length,a=Array(s);s?o.each.call(n,(function(t,n){e.resolve(t).then((function(t){a[n]=t,--s||i(a)}),r)})):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),o=n(30),r=n(33),s=n(31),a=n(34),l=n(35);t.exports=function(t,e,n,c){var u,d,h,f=l(t),p=i(n,c,e?2:1),m=0;if("function"!=typeof f)throw TypeError(t+" is not iterable!");if(r(f))for(u=a(t.length);u>m;m++)e?p(s(d=t[m])[0],d[1]):p(t[m]);else for(h=f.call(t);!(d=h.next()).done;)o(h,p,d.value,e)}},function(t,e,n){var i=n(15).getDesc,o=n(32),r=n(31),s=function(t,e){if(r(t),!o(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,o){try{(o=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:o(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),o=n(20)("species");t.exports=function(t){n(17)&&!(o in t)&&i.setDesc(t,o,{configurable:!0,get:function(){return this}})}},function(t,e,n){var i,o,r,s=n(11),a=n(75).set,l=s.MutationObserver||s.WebKitMutationObserver,c=s.process,u="process"==n(37)(c),d=function(){var t,e;for(u&&(t=c.domain)&&(c.domain=null,t.exit());i;)(e=i.domain)&&e.enter(),i.fn.call(),e&&e.exit(),i=i.next;o=void 0,t&&t.enter()};if(u)r=function(){c.nextTick(d)};else if(l){var h=1,f=document.createTextNode("");new l(d).observe(f,{characterData:!0}),r=function(){f.data=h=-h}}else r=function(){a.call(s,d)};t.exports=function(t){var e={fn:t,next:void 0,domain:u&&c.domain};o&&(o.next=e),i||(i=e,r()),o=e}},function(t,e,n){"use strict";var i,o,r,s=n(27),a=n(76),l=n(77),c=n(78),u=n(11),d=u.process,h=u.setImmediate,f=u.clearImmediate,p=u.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)};h&&f||(h=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)(d)?i=function(t){d.nextTick(s(y,t,1))}:p?(r=(o=new p).port2,o.port1.onmessage=C,i=s(r.postMessage,r,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScript?(i=function(t){u.postMessage(t+"","*")},u.addEventListener("message",C,!1)):i=v in c("script")?function(t){l.appendChild(c("script"))[v]=function(){l.removeChild(this),y.call(t)}}:function(t){setTimeout(s(y,t,1),0)}),t.exports={set:h,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),o=n(11).document,r=i(o)&&i(o.createElement);t.exports=function(t){return r?o.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),o=(n(12).Object||{})[t]||Object[t],r={};r[t]=e(o),i(i.S+i.F*n(18)((function(){o(1)})),"Object",r)}},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),o=n(14),r=n(27),s=n(73),a=n(69),l=n(7),c=n(70),u=n(45),d=n(22)("id"),h=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(!h(t,d)){if(!p(t))return"F";if(!e)return"E";o(t,d,++v)}return"O"+t[d]},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,o,s){var u=t((function(t,n){a(t,u,e),t._i=i.create(null),t._f=void 0,t._l=void 0,t[g]=0,null!=n&&c(n,o,t[s],t)}));return n(79)(u.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,o=n.p;delete e._i[n.i],n.r=!0,o&&(o.n=i),i&&(i.p=o),e._f==n&&(e._f=i),e._l==n&&(e._l=o),e[g]--}return!!n},forEach:function(t){for(var e,n=r(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(u.prototype,"size",{get:function(){return l(this[g])}}),u},def:function(t,e,n){var i,o,r=C(t,e);return r?r.v=n:(t._l=r={i:o=y(e,!0),k:e,v:n,p:i=t._l,n:void 0,r:!1},t._f||(t._f=r),i&&(i.n=r),t[g]++,"F"!==o&&(t._i[o]=r)),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)?u(0,"keys"==e?n.k:"values"==e?n.v:[n.k,n.v]):(t._t=void 0,u(1))}),i?"entries":"values",!i,!0),s(t),s(n(12)[e])}}},function(t,e,n){"use strict";var i=n(15),o=n(10),r=n(14),s=n(70),a=n(69);t.exports=function(t,e,l,c,u,d){var h=n(11)[t],f=h,p=u?"set":"add",m=f&&f.prototype,g={};return n(17)&&"function"==typeof f&&(d||m.forEach&&!n(18)((function(){(new f).entries().next()})))?(f=e((function(e,n){a(e,f,t),e._c=new h,null!=n&&s(n,u,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)||d&&"clear"==t||r(f.prototype,t,(function(n,i){var o=this._c[t](0===n?0:n,i);return e?this:o}))})),"size"in m&&i.setDesc(f.prototype,"size",{get:function(){return this._c.size}})):(f=c.getConstructor(e,t,u,p),n(79)(f.prototype,l)),n(25)(f,t),g[t]=f,o(o.G+o.W+o.F,g),d||c.setStrong(f,t,u),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),o=n(36);t.exports=function(t){return function(){if(o(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 o=e[i];if(void 0!==o)return o.exports;var r=e[i]={id:i,loaded:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.loaded=!0,r.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&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");if(i.length)for(var o=i.length-1;o>-1&&(!t||!/^http(s?):/.test(t));)t=i[o--].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:()=>R,initAutoTests:()=>k,test:()=>P,tests:()=>e.CN});var t=n(6082),e=n(8070),o=n(4328),r=n(5082),s=n(9484),a=n(4139),l=n(8608),c=n(2003),u=n(726),d=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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";(0,e.gM)((()=>d(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));let i=null;(0,e.t6)("Start analysis: simple",(()=>d(void 0,void 0,void 0,(function*(){const o=t.DataFrame.fromCsv(yield R.files.readAsText("aligned.csv")),u=o.getCol("IC50"),d=o.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,c.YI.PT),d.setTag(t.TAGS.UNITS,c.Hi.FASTA),d.setTag(c.gp.aligned,"SEQ.MSA");const h=(0,l.Y1)(u,a.rg.MINUS_LG);i=yield(0,r.n)(u,d,null,o,h,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",(()=>d(void 0,void 0,void 0,(function*(){const n=t.DataFrame.fromCsv(yield R.files.readAsText("aligned_2.csv")),o=n.getCol("Activity"),u=n.getCol("MSA");u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(a.gp.ALPHABET,c.YI.UN),u.setTag(t.TAGS.UNITS,c.Hi.SEPARATOR),u.setTag(c.gp.aligned,"SEQ.MSA"),u.setTag(a.gp.SEPARATOR,"/");const d=(0,l.Y1)(o,a.rg.MINUS_LG);i=yield(0,r.n)(o,u,null,n,d,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",(()=>d(void 0,void 0,void 0,(function*(){const s=t.DataFrame.fromCsv(yield R.files.readAsText("aligned.csv")),u=s.getCol("IC50"),d=s.getCol(n);d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(a.gp.ALPHABET,c.YI.PT),d.setTag(t.TAGS.UNITS,c.Hi.FASTA),d.setTag(c.gp.aligned,"SEQ.MSA");const h=(0,l.Y1)(u,a.rg.MINUS_LG);i=yield(0,r.n)(u,d,null,s,h,a.rg.MINUS_LG);let f=o.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 o.dapi.layouts.save(m);yield o.dapi.tables.uploadDataFrame(p);const C=yield o.dapi.tables.save(g),w=yield o.dapi.projects.save(v);f.close(),yield(0,e.bk)((()=>void 0===o.shell.tableView("Peptides analysis")),"Table never closed",3e3),yield w.open(),f=o.shell.getTableView("Peptides analysis"),yield o.dapi.layouts.delete(y),yield o.dapi.tables.delete(C),yield o.dapi.projects.delete(w)}))),{skipReason:"ViewLayout should become ViewInfo in 1.18."})}),{clear:!0});var h=n(3657),f=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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 p=[5,50,100,200];function m(e){return f(this,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const n=(yield R.files.readBinaryDataFrames(`tests/${e}k.d42`))[0],i=n.getCol("activity").getRawData(),o=[];let r=1;for(;null!==n.col(r.toString());){const t=n.getCol(r.toString());o.push({name:t.name,rawData:t.getRawData(),cat:t.categories}),++r}yield t.timeAsync("Mutation Cliffs",(()=>f(this,void 0,void 0,(function*(){return yield(0,h.uz)(i,o)}))))}))}(0,e.L1)("Benchmarks: Mutation Cliffs",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const t of p)(0,e.t6)(`${t}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){return yield m(t)}))),{timeout:3e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Cluster stats",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const n of p)(0,e.t6)(`${n}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield R.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",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const n of p)(0,e.t6)(`${n}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return null;const e=(yield R.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=[];let o=1;for(;null!==e.col(o.toString());)i.push(e.getCol(o.toString())),++o;const r=(0,l.Y1)(e.getCol("activity"),a.rg.NONE);e.columns.names().map((t=>t.toLowerCase())).includes(r.name.toLowerCase())&&e.columns.remove(r.name),e.columns.add(r),t.time(`Monomer-Position stats benchmark - ${n}k`,(()=>(0,h.Ej)(r,t.BitSet.create(0),i)))}))),{timeout:1e5})}),{benchmarks:!0}),(0,e.L1)("Benchmarks: Analysis start",(()=>{(0,e.gM)((()=>f(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper()}))));for(const n of p)(0,e.t6)(`${n}k sequences`,(()=>f(void 0,void 0,void 0,(function*(){if(!t.Test.isInBenchmark)return;const e=(yield R.files.readBinaryDataFrames(`tests/${n}k.d42`))[0],i=e.getCol("activity"),s=(0,l.Y1)(i,a.rg.NONE),u=e.getCol("cluster"),d=e.getCol("sequence");d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,n===p[0]?c.Hi.HELM:c.Hi.FASTA),yield t.timeAsync("Analysis start",(()=>f(void 0,void 0,void 0,(function*(){const t=yield(0,r.n)(i,d,u,e,s,a.rg.NONE);t&&o.shell.closeTable(t.df)}))))}))),{timeout:1e5})}),{benchmarks:!0});var g,v=n(3541),y=n(5480),C=n(4326);!function(t){t.SEQUENCE="sequence",t.ACTIVITY="activity",t.CLUSTER="cluster"}(g||(g={}));var w=n(912),b=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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)((()=>b(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.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,(()=>b(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,o,u,d,h,f;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),u=n.getCol(g.SEQUENCE),u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(g.CLUSTER);const p=yield(0,r.n)(o,u,d,n,h,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)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>b(void 0,void 0,void 0,(function*(){const t=f.viewerGrid.cell("9",6),n=f.getMonomerPosition(t);(0,e.E3)((0,w.D)(i.df,o,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",(()=>b(void 0,void 0,void 0,(function*(){if(null===f)throw new Error("Monomer-Position viewer doesn't exist");(0,e.E3)(f.mode,v.ds.MUTATION_CLIFFS,`Default Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS}`),f.mode=v.ds.INVARIANT_MAP,(0,e.E3)(f.mode,v.ds.INVARIANT_MAP,`Monomer-Position mode is not ${v.ds.INVARIANT_MAP} after switching`),f.mode=v.ds.MUTATION_CLIFFS,(0,e.E3)(f.mode,v.ds.MUTATION_CLIFFS,`Monomer-Position mode is not ${v.ds.MUTATION_CLIFFS} after switching`)}))))}),{clear:!1}),(0,e.L1)("Viewers: Most Potent Residues",(()=>{let n,i,o,u,d,h,f;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),u=n.getCol(g.SEQUENCE),u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(g.CLUSTER);const p=yield(0,r.n)(o,u,d,n,h,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)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Tooltip",(()=>b(void 0,void 0,void 0,(function*(){const t="Diff",n=f.viewerGrid.cell(t,6),r=f.getMonomerPosition(n);(0,e.E3)((0,w.D)(i.df,o,Object.entries(i.settings.columns),{monomerPosition:r,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,o,u,d,h,f;(0,e.gM)((()=>b(void 0,void 0,void 0,(function*(){n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),u=n.getCol(g.SEQUENCE),u.semType=t.SEMTYPE.MACROMOLECULE,u.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(g.CLUSTER);const p=yield(0,r.n)(o,u,d,n,h,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)((()=>b(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Properties",(()=>b(void 0,void 0,void 0,(function*(){f.getProperty("webLogoMode").set(f,C.fH.full),(0,e.E3)(f.webLogoMode,C.fH.full,`Web Logo Mode property is not changed to ${C.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",(()=>b(void 0,void 0,void 0,(function*(){const t=f.showTooltip({monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL},0,0);(0,e.E3)(null!==t,!0,"Tooltip is not shown for cluster '0'")}))))}),{clear:!1});var A=n(5429),E=n(7654),S=n(7923),x=n(144),T=n.n(x),_=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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,o,s,d,h;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),s=n.getCol(g.SEQUENCE),s.semType=t.SEMTYPE.MACROMOLECULE,s.setTag(t.TAGS.UNITS,c.Hi.HELM),h=(0,l.Y1)(o,a.rg.NONE),d=n.getCol(g.CLUSTER);const f=yield(0,r.n)(o,s,d,n,h,a.rg.NONE);if(null===f)throw new Error("Model is null");i=f,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("UI",(()=>_(void 0,void 0,void 0,(function*(){const t=(0,A.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(A.OO))(0,e.E3)(n.includes(t),!0,`Pane ${t} is missing`);for(const n of Object.values(A.OO)){const i=t.inputs[n].map((t=>t.caption));for(const t of Object.values(A.Av[n]))(0,e.E3)(i.includes(t),!0,`Input ${t} is missing from ${n}`)}}))))})),(0,e.L1)("Widgets: Distribution panel",(()=>{let n,i,o,d,h,f;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),h=n.getCol(g.CLUSTER);const s=yield(0,r.n)(o,d,h,n,f,a.rg.NONE);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)("UI",(()=>_(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,E.HV)(i.df,{peptideSelection:t.BitSet.create(i.df.rowCount),columns:i.settings.columns,activityCol:f,clusterSelection:n.clusterSelection,clusterColName:h.name,monomerPositionSelection:i.webLogoSelection})}))))})),(0,e.L1)("Widgets: Mutation cliffs",(()=>{let n,i,o,d,h,f;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),h=n.getCol(g.CLUSTER);const s=yield(0,r.n)(o,d,h,n,f,a.rg.NONE);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)("UI",(()=>_(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,S.F)(i.df,{mutationCliffs:n.mutationCliffs,mutationCliffsSelection:n.mutationCliffsSelection,gridColumns:i.analysisView.grid.columns,sequenceColumnName:n.sequenceColumnName,positionColumns:n.positionColumns,activityCol:f})}))))})),(0,e.L1)("Widgets: Actions",(()=>{let n,i,d,h,f,p;(0,e.gM)((()=>_(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),yield n.meta.detectSemanticTypes(),d=n.getCol(g.ACTIVITY),h=n.getCol(g.SEQUENCE),h.semType=t.SEMTYPE.MACROMOLECULE,h.setTag(t.TAGS.UNITS,c.Hi.HELM),p=(0,l.Y1)(d,a.rg.NONE),f=n.getCol(g.CLUSTER);const o=yield(0,r.n)(d,h,f,n,p,a.rg.NONE);if(null===o)throw new Error("Model is null");i=o,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>_(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("New view",(()=>_(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 r=i.df.selection;r.set(0,!0,!1),r.set(1,!0,!1);const l=i.createNewView(),c=o.shell.t;(0,e.E3)(c.getTag(a.gp.MULTIPLE_VIEWS),"1","Current table is expected to have multiple views tag"),(0,e.E3)(c.getTag(t.TAGS.ID),l,"Current table is expected to have the same UUID as new view"),(0,e.E3)(c.rowCount,2,"Current table is expected to have 2 rows"),yield(0,e.cb)(500);const u=c.temp[s.i.modelName].findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==u,!0,"New view is expected to have Logo Summary Table viewer attached")})))),(0,e.t6)("Custom clusters",(()=>_(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 o=T()(n.customClusters).toArray();(0,e.E3)(o.length,1,"Expected to have 1 custom cluster");const r=o[0].name;(0,e.E3)(null!==i.df.col(r),!0,"Expected to have custom cluster column in the table"),(0,e.E3)(-1!==n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(r),!0,"Expected to have custom cluster in the Logo Summary Table"),n.modifyClusterSelection({monomerOrCluster:r,positionOrClusterType:y.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(r),!0,"Expected to have no custom cluster column in the table"),(0,e.E3)(-1===n.viewerGrid.table.getCol(a.i6.CLUSTER).categories.indexOf(r),!0,"Expected to have no custom cluster in the Logo Summary Table")}))))}),{clear:!1});var N=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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,o,d,h,f;const p="none",m={monomerOrCluster:"Aze",positionOrClusterType:"10",mcCount:3,imCount:1},v={monomerOrCluster:"meI",positionOrClusterType:"1",mcCount:2,imCount:10},C={monomerOrCluster:"0",positionOrClusterType:y.W.ORIGINAL,count:3},w={monomerOrCluster:"1",positionOrClusterType:y.W.ORIGINAL,count:3};(0,e.gM)((()=>N(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(o,p),h=n.getCol(g.CLUSTER);const s=yield(0,r.n)(o,d,h,n,f,p);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>N(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Visible columns",(()=>N(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 o=t.byIndex(i),r=o.column.name,s=n.includes(r)||r===a.$2.ACTIVITY;(0,e.E3)(o.visible,s,`Column ${r} is visible === ${o.visible} but should be ${s}`)}})))),(0,e.t6)("Mutation Cliffs selection",(()=>N(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(m),(0,e.E3)(n.mutationCliffsSelection[m.positionOrClusterType].includes(m.monomerOrCluster),!0,`Monomer ${m.monomerOrCluster} is not selected at position ${m.positionOrClusterType}`),(0,e.E3)(t.trueCount,m.mcCount,`Selection count is not equal to ${m.mcCount} for monomer ${m.monomerOrCluster} at position ${m.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not selected at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.mcCount+m.mcCount,`Selection count is not equal to ${v.mcCount+m.mcCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),n.modifyMutationCliffsSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(n.mutationCliffsSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still selected at position ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,m.mcCount,`Selection count is not equal to ${m.mcCount} for monomer ${m.monomerOrCluster} at position ${m.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 o=i.findViewer(s.q.LOGO_SUMMARY_TABLE);(0,e.E3)(null!==o,!0,"Couldn't find Logo Summary Table viewer"),o.modifyClusterSelection(C),(0,e.E3)(o.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!0,`Cluster ${C.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,C.count,`Selection count is not equal to ${C.count} for cluster ${C.monomerOrCluster}`),o.modifyClusterSelection(w,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(o.clusterSelection[w.positionOrClusterType].includes(w.monomerOrCluster),!0,`Cluster ${w.monomerOrCluster} is not selected`),(0,e.E3)(t.trueCount,C.count+w.count,`Selection count is not equal to ${C.count+w.count} for cluster ${C.monomerOrCluster} and cluster \n ${w.monomerOrCluster}`),o.modifyClusterSelection(C,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(o.clusterSelection[C.positionOrClusterType].includes(C.monomerOrCluster),!1,`Cluster ${C.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 ${C.monomerOrCluster}`),o.initClusterSelection(),(0,e.E3)(o.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",(()=>N(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(v),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!0,`Monomer ${v.monomerOrCluster} is not filtered at position ${v.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${v.monomerOrCluster} at position ${v.positionOrClusterType}`),i.modifyWebLogoSelection(m,{shiftPressed:!0,ctrlPressed:!1}),(0,e.E3)(i.webLogoSelection[m.positionOrClusterType].includes(m.monomerOrCluster),!0,`Monomer ${m.monomerOrCluster} is not filtered at position ${m.positionOrClusterType}`),(0,e.E3)(t.trueCount,v.imCount,`Filter count is not equal to ${v.imCount} for monomer ${m.monomerOrCluster} at position ${m.positionOrClusterType}`),i.modifyWebLogoSelection(v,{shiftPressed:!0,ctrlPressed:!0}),(0,e.E3)(i.webLogoSelection[v.positionOrClusterType].includes(v.monomerOrCluster),!1,`Monomer ${v.monomerOrCluster} is still filtered at position \n ${v.positionOrClusterType} after deselection`),(0,e.E3)(t.trueCount,m.imCount,`Filter count is not equal to ${m.imCount} for monomer ${m.monomerOrCluster} at position ${m.positionOrClusterType} after deselection of monomer ${v.monomerOrCluster} at position ${v.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 M=n(5070),O=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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,o,d,h,f;(0,e.gM)((()=>O(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),n=t.DataFrame.fromCsv(yield R.files.readAsText("tests/HELM_small.csv")),o=n.getCol(g.ACTIVITY),d=n.getCol(g.SEQUENCE),d.semType=t.SEMTYPE.MACROMOLECULE,d.setTag(t.TAGS.UNITS,c.Hi.HELM),f=(0,l.Y1)(o,a.rg.NONE),h=n.getCol(g.CLUSTER);const s=yield(0,r.n)(o,d,h,n,f,a.rg.NONE);if(null===s)throw new Error("Model is null");i=s,yield(0,e.cb)(500)})))),(0,e.Pl)((()=>O(void 0,void 0,void 0,(function*(){return yield(0,e.cb)(3e3)})))),(0,e.t6)("Activity scaling",(()=>O(void 0,void 0,void 0,(function*(){var t;const n=(t,e)=>`Activity mismatch at row ${t} for scaling method '${e}'`,r=1e-4,s=i.df.getCol(null===(t=i.settings)||void 0===t?void 0:t.activityColumnName).getRawData(),c=i.df.getCol(a.$2.ACTIVITY),u=i.df.rowCount;let d=c.getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],s[t],r,n(t,a.rg.NONE));d=(0,l.Y1)(o,a.rg.LG).getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],Math.log10(s[t]),r,n(t,a.rg.LG));d=(0,l.Y1)(o,a.rg.MINUS_LG).getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],-Math.log10(s[t]),r,n(t,a.rg.MINUS_LG));d=f.getRawData();for(let t=0;t<u;t++)(0,e.Wj)(d[t],s[t],r,n(t,a.rg.NONE))})))),(0,e.t6)("Mutation Cliffs",(()=>O(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",(()=>O(void 0,void 0,void 0,(function*(){var n,o;const r="rank",a={[r]:t.AGG.AVG};i.settings={columns:a};const l=i.findViewer(s.q.LOGO_SUMMARY_TABLE),c=(0,M.hX)(t.AGG.AVG,r);(0,e.E3)(null!==l.viewerGrid.col(c),!0,`Expected to include column '${r}' 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===(o=i.settings)||void 0===o?void 0:o.columns).join(" & ")}} are still included`),(0,e.E3)(null===l.viewerGrid.col(c),!0,`Expected to remove column '${r}' from ${s.q.LOGO_SUMMARY_TABLE} but it is still present`)})))),(0,e.t6)("Dendrogram",(()=>O(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 L=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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,o,r;(0,e.gM)((()=>L(void 0,void 0,void 0,(function*(){yield u.Z.loadSeqHelper(),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}))),r=(0,l.eY)(t.Column.fromList("string","target",["1","2","2"])),o={maxMutations:1,minActivityDelta:2}})))),(0,e.t6)("MutationCliffs",(()=>L(void 0,void 0,void 0,(function*(){let t=yield(0,h.uz)(n,i,o);(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"),c=a.get("3");(0,e.E3)(l.has(1),!0,"MutationCliffsInfo['C']['3'] should have key 1"),(0,e.E3)(c.has(2),!0,"MutationCliffsInfo['D']['3'] should have key 2");const u=l.get(1),d=c.get(2);(0,e.E3)(u[0],2,"MutationCliffsInfo['C']['3'][1] should have value 2"),(0,e.E3)(d[0],1,"MutationCliffsInfo['D']['3'][2] should have value 1"),o.targetCol=r,o.currentTarget="1",t=yield(0,h.uz)(n,i,o),(0,e.E3)(t.size,0,"MutationCliffsInfo should be empty for target '1'")}))))}));var I=function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{l(i.next(t))}catch(t){r(t)}}function a(t){try{l(i.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?o(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 R=new t.Package;function P(n,i,o){return I(this,void 0,void 0,(function*(){(null==o?void 0:o.catchUnhandled)&&(o.catchUnhandled=!1);const r=yield(0,e.N$)({category:n,test:i,testContext:o});return t.DataFrame.fromObjects(r)}))}function k(){return I(this,void 0,void 0,(function*(){yield(0,e.Xb)(R,R.getModule("package-test.js"))}))}})(),peptides_test=i})();
|
|
2
2
|
//# sourceMappingURL=package-test.js.map
|