functionbruh_moment(){alert("this is a bruh moment")}constdownloadToFile=(e,t,n)=>{consto=document.createElement("a");n=newBlob([e],{type:n});o.href=URL.createObjectURL(n),o.download=t,o.click(),URL.revokeObjectURL(o.href)};functionget_smiles_from_element_text(e){e=`https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/name/${document.getElementById(e).value}/property/CanonicalSMILES/JSON`;console.log(e),fetch(e).then(e=>e.json()).then(e=>{console.log("Aye, got that dub from PubChem"),document.getElementById("inputSMILES").value=e.PropertyTable.Properties[0].CanonicalSMILES}).catch(e=>{throwbruh_moment(),e})}functiondraw_me_like_one_of_your_french_girls(e){e.condense_abbreviations();vart=document.getElementById("draw-output"),e=e.get_svg();t.outerHTML="<div id='drawing-1'>"+e+"</div>",document.getElementById("drawing-1").children[0].setAttribute("height","100%"),document.getElementById("drawing-1").children[0].setAttribute("width","100%")}functioncalculate_and_disperse(e){constt=["NumUnspecifiedAtomStereoCenters","NumAliphaticHeterocycles","NumSaturatedHeterocycles","NumAromaticHeterocycles","NumAmideBonds","NumAromaticRings","NumAliphaticRings","NumSaturatedRings","NumSpiroAtoms","NumBridgeheadAtoms","NumAtomStereoCenters"];try{varn=JSON.parse(e.get_descriptors())}catch(e){alert("oo wee, failed to calculate descriptors senpai")}leto=document.getElementById("analyse_table");varr=Object.keys(n);for(lete=0;e<r.length;e++){vara,d,i,l=r[e];-1!==t.indexOf(l)||(a=(i=o.insertRow(-1)).insertCell(0),d=i.insertCell(-1),i=document.createTextNode(l),l=document.createTextNode(n[l]),a.appendChild(i),d.appendChild(l))}}functionconvert_me_senpai(r){vara=OpenBabelModule();a.onRuntimeInitialized=function(){vare=newa.ObConversionWrapper;try{vart=r;e.setInFormat("","smiles");varn=newa.OBMol;e.readString(n,t),e.setOutFormat("","pdbqt");varo=e.writeString(n,!1);returndocument.getElementById("download-pdbqt").disabled=!1,o}finally{e.delete()}}}functionanalyse_me_senpai(e){vart=document.getElementById(e).value,e=Module.get_mol(t);draw_me_like_one_of_your_french_girls(e),calculate_and_disperse(e),smiles_text=convert_me_senpai(t)}functiondownload_pdbqt(){vare;e=""===document.getElementById("inputName").value?"compound.pdbqt":`${document.getElementById("inputName").value}.pdbqt`;try{downloadToFile(smiles_text,e,"chemical/x-pdbqt")}catch(e){console.error(e),bruh_moment()}}