markdown-it-smiles
Version:
A markdown-it plugin for rendering SMILES (Simplified molecular input line entry specification) chemical structures
6 lines (5 loc) • 3.52 MB
JavaScript
var MarkdownItSmiles = (function (exports) {
'use strict';
var gIe=Object.create;var AI=Object.defineProperty;var TIe=Object.getOwnPropertyDescriptor;var SIe=Object.getOwnPropertyNames;var vIe=Object.getPrototypeOf,AIe=Object.prototype.hasOwnProperty;var wIe=(e,t,n)=>t in e?AI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var et=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var yh=(e,t)=>()=>(e&&(t=e(e=0)),t);var H=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xX=(e,t)=>{for(var n in t)AI(e,n,{get:t[n],enumerable:!0});},FX=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of SIe(t))!AIe.call(e,a)&&a!==n&&AI(e,a,{get:()=>t[a],enumerable:!(i=TIe(t,a))||i.enumerable});return e};var IIe=(e,t,n)=>(n=e!=null?gIe(vIe(e)):{},FX(t||!e||!e.__esModule?AI(n,"default",{value:e,enumerable:!0}):n,e)),bX=e=>FX(AI({},"__esModule",{value:!0}),e);var Xn=(e,t,n)=>(wIe(e,typeof t!="symbol"?t+"":t,n),n),z7=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var k=(e,t,n)=>(z7(e,t,"read from private field"),n?n.call(e):t.get(e)),en=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n);},Et=(e,t,n,i)=>(z7(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);var G4=(e,t,n,i)=>({set _(a){Et(e,t,a,n);},get _(){return k(e,t,i)}}),Jt=(e,t,n)=>(z7(e,t,"access private method"),n);var vv=H((NEt,BX)=>{var nF=class e{static clone(t){let n=Array.isArray(t)?Array():{};for(let i in t){let a=t[i];typeof a.clone=="function"?n[i]=a.clone():n[i]=typeof a=="object"?e.clone(a):a;}return n}static equals(t,n){if(t.length!==n.length)return !1;let i=t.slice().sort(),a=n.slice().sort();for(var r=0;r<i.length;r++)if(i[r]!==a[r])return !1;return !0}static print(t){if(t.length==0)return "";let n="(";for(let i=0;i<t.length;i++)n+=t[i].id?t[i].id+", ":t[i]+", ";return n=n.substring(0,n.length-2),n+")"}static each(t,n){for(let i=0;i<t.length;i++)n(t[i]);}static get(t,n,i){for(let a=0;a<t.length;a++)if(t[a][n]==i)return t[a]}static contains(t,n){if(!n.property&&!n.func){for(let i=0;i<t.length;i++)if(t[i]==n.value)return !0}else if(n.func){for(let i=0;i<t.length;i++)if(n.func(t[i]))return !0}else for(let i=0;i<t.length;i++)if(t[i][n.property]==n.value)return !0;return !1}static intersection(t,n){let i=new Array;for(let a=0;a<t.length;a++)for(let r=0;r<n.length;r++)t[a]===n[r]&&i.push(t[a]);return i}static unique(t){let n={};return t.filter(function(i){return n[i]!==void 0?!1:n[i]=!0})}static count(t,n){let i=0;for(let a=0;a<t.length;a++)t[a]===n&&i++;return i}static toggle(t,n){let i=Array(),a=!1;for(let r=0;r<t.length;r++)t[r]!==n?i.push(t[r]):a=!0;return a||i.push(n),i}static remove(t,n){let i=Array();for(let a=0;a<t.length;a++)t[a]!==n&&i.push(t[a]);return i}static removeUnique(t,n){let i=t.indexOf(n);return i>-1&&t.splice(i,1),t}static removeAll(t,n){return t.filter(function(i){return n.indexOf(i)===-1})}static merge(t,n){let i=new Array(t.length+n.length);for(let a=0;a<t.length;a++)i[a]=t[a];for(let a=0;a<n.length;a++)i[t.length+a]=n[a];return i}static containsAll(t,n){let i=0;for(let a=0;a<t.length;a++)for(let r=0;r<n.length;r++)t[a]===n[r]&&i++;return i===n.length}static sortByAtomicNumberDesc(t){let n=t.map(function(i,a){return {index:a,value:i.atomicNumber.split(".").map(Number)}});return n.sort(function(i,a){let r=Math.min(a.value.length,i.value.length),s=0;for(;s<r&&a.value[s]===i.value[s];)s++;return s===r?a.value.length-i.value.length:a.value[s]-i.value[s]}),n.map(function(i){return t[i.index]})}static deepCopy(t){let n=Array();for(let i=0;i<t.length;i++){let a=t[i];a instanceof Array?n[i]=e.deepCopy(a):n[i]=a;}return n}};BX.exports=nF;});var Av=H((xEt,UX)=>{var rF=class e{static round(t,n){return n=n||1,+(Math.round(t+"e"+n)+"e-"+n)}static meanAngle(t){let n=0,i=0;for(var a=0;a<t.length;a++)n+=Math.sin(t[a]),i+=Math.cos(t[a]);return Math.atan2(n/t.length,i/t.length)}static innerAngle(t){return e.toRad((t-2)*180/t)}static polyCircumradius(t,n){return t/(2*Math.sin(Math.PI/n))}static apothem(t,n){return t*Math.cos(Math.PI/n)}static apothemFromSideLength(t,n){let i=e.polyCircumradius(t,n);return e.apothem(i,n)}static centralAngle(t){return e.toRad(360/t)}static toDeg(t){return t*e.degFactor}static toRad(t){return t*e.radFactor}static parityOfPermutation(t){let n=new Uint8Array(t.length),i=0,a=function(s,o=0){return n[s]===1?o:(o++,n[s]=1,a(t[s],o))};for(var r=0;r<t.length;r++){if(n[r]===1)continue;let s=a(r);i+=1-s%2;}return i%2?-1:1}static get radFactor(){return Math.PI/180}static get degFactor(){return 180/Math.PI}static get twoPI(){return 2*Math.PI}};UX.exports=rF;});var E0=H((FEt,qX)=>{var iF=class e{constructor(t,n){arguments.length==0?(this.x=0,this.y=0):arguments.length==1?(this.x=t.x,this.y=t.y):(this.x=t,this.y=n);}clone(){return new e(this.x,this.y)}toString(){return "("+this.x+","+this.y+")"}add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.x-=t.x,this.y-=t.y,this}divide(t){return this.x/=t,this.y/=t,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}invert(){return this.x=-this.x,this.y=-this.y,this}angle(){return Math.atan2(this.y,this.x)}distance(t){return Math.sqrt((t.x-this.x)*(t.x-this.x)+(t.y-this.y)*(t.y-this.y))}distanceSq(t){return (t.x-this.x)*(t.x-this.x)+(t.y-this.y)*(t.y-this.y)}clockwise(t){let n=this.y*t.x,i=this.x*t.y;return n>i?-1:n===i?0:1}relativeClockwise(t,n){let i=(this.y-t.y)*(n.x-t.x),a=(this.x-t.x)*(n.y-t.y);return i>a?-1:i===a?0:1}rotate(t){let n=new e(0,0),i=Math.cos(t),a=Math.sin(t);return n.x=this.x*i-this.y*a,n.y=this.x*a+this.y*i,this.x=n.x,this.y=n.y,this}rotateAround(t,n){let i=Math.sin(t),a=Math.cos(t);this.x-=n.x,this.y-=n.y;let r=this.x*a-this.y*i,s=this.x*i+this.y*a;return this.x=r+n.x,this.y=s+n.y,this}rotateTo(t,n,i=0){this.x+=.001,this.y-=.001;let a=e.subtract(this,n),r=e.subtract(t,n),s=e.angle(r,a);return this.rotateAround(s+i,n),this}rotateAwayFrom(t,n,i){this.rotateAround(i,n);let a=this.distanceSq(t);this.rotateAround(-2*i,n),this.distanceSq(t)<a&&this.rotateAround(2*i,n);}getRotateAwayFromAngle(t,n,i){let a=this.clone();a.rotateAround(i,n);let r=a.distanceSq(t);return a.rotateAround(-2*i,n),a.distanceSq(t)<r?i:-i}getRotateTowardsAngle(t,n,i){let a=this.clone();a.rotateAround(i,n);let r=a.distanceSq(t);return a.rotateAround(-2*i,n),a.distanceSq(t)>r?i:-i}getRotateToAngle(t,n){let i=e.subtract(this,n),a=e.subtract(t,n),r=e.angle(a,i);return Number.isNaN(r)?0:r}isInPolygon(t){let n=!1;for(let i=0,a=t.length-1;i<t.length;a=i++)t[i].y>this.y!=t[a].y>this.y&&this.x<(t[a].x-t[i].x)*(this.y-t[i].y)/(t[a].y-t[i].y)+t[i].x&&(n=!n);return n}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSq(){return this.x*this.x+this.y*this.y}normalize(){return this.divide(this.length()),this}normalized(){return e.divideScalar(this,this.length())}whichSide(t,n){return (this.x-t.x)*(n.y-t.y)-(this.y-t.y)*(n.x-t.x)}sameSideAs(t,n,i){let a=this.whichSide(t,n),r=i.whichSide(t,n);return a<0&&r<0||a==0&&r==0||a>0&&r>0}static add(t,n){return new e(t.x+n.x,t.y+n.y)}static subtract(t,n){return new e(t.x-n.x,t.y-n.y)}static multiply(t,n){return new e(t.x*n.x,t.y*n.y)}static multiplyScalar(t,n){return new e(t.x,t.y).multiplyScalar(n)}static midpoint(t,n){return new e((t.x+n.x)/2,(t.y+n.y)/2)}static normals(t,n){let i=e.subtract(n,t);return [new e(-i.y,i.x),new e(i.y,-i.x)]}static units(t,n){let i=e.subtract(n,t);return [new e(-i.y,i.x).normalize(),new e(i.y,-i.x).normalize()]}static divide(t,n){return new e(t.x/n.x,t.y/n.y)}static divideScalar(t,n){return new e(t.x/n,t.y/n)}static dot(t,n){return t.x*n.x+t.y*n.y}static angle(t,n){let i=e.dot(t,n);return Math.acos(i/(t.length()*n.length()))}static threePointangle(t,n,i){let a=e.subtract(n,t),r=e.subtract(i,n),s=t.distance(n),o=n.distance(i);return Math.acos(e.dot(a,r)/(s*o))}static scalarProjection(t,n){let i=n.normalized();return e.dot(t,i)}static averageDirection(t){let n=new e(0,0);for(var i=0;i<t.length;i++){let a=t[i];n.add(a);}return n.normalize()}};qX.exports=iF;});var zT=H((PEt,GX)=>{var $X=Av(),K4=vv(),CI=E0();DI();var sF=class e{constructor(t,n=0,i=0){this.id=null,this.value=t,this.position=new CI(n||0,i||0),this.previousPosition=new CI(0,0),this.parentVertexId=null,this.children=Array(),this.spanningTreeChildren=Array(),this.edges=Array(),this.positioned=!1,this.angle=null,this.dir=1,this.neighbourCount=0,this.neighbours=Array(),this.neighbouringElements=Array(),this.forcePositioned=!1;}setPosition(t,n){this.position.x=t,this.position.y=n;}setPositionFromVector(t){this.position.x=t.x,this.position.y=t.y;}addChild(t){this.children.push(t),this.neighbours.push(t),this.neighbourCount++;}addRingbondChild(t,n){if(this.children.push(t),this.value.bracket){let i=1;this.id===0&&this.value.bracket.hcount===0&&(i=0),this.value.bracket.hcount===1&&n===0&&(i=2),this.value.bracket.hcount===1&&n===1&&(this.neighbours.length<3?i=2:i=3),this.value.bracket.hcount===null&&n===0&&(i=1),this.value.bracket.hcount===null&&n===1&&(this.neighbours.length<3?i=1:i=2),this.neighbours.splice(i,0,t);}else this.neighbours.push(t);this.neighbourCount++;}setParentVertexId(t){this.neighbourCount++,this.parentVertexId=t,this.neighbours.push(t);}isTerminal(){return this.value.hasAttachedPseudoElements?!0:this.parentVertexId===null&&this.children.length<2||this.children.length===0}clone(){let t=new e(this.value,this.position.x,this.position.y);return t.id=this.id,t.previousPosition=new CI(this.previousPosition.x,this.previousPosition.y),t.parentVertexId=this.parentVertexId,t.children=K4.clone(this.children),t.spanningTreeChildren=K4.clone(this.spanningTreeChildren),t.edges=K4.clone(this.edges),t.positioned=this.positioned,t.angle=this.angle,t.forcePositioned=this.forcePositioned,t}equals(t){return this.id===t.id}getAngle(t=null,n=!1){let i=null;return t?i=CI.subtract(this.position,t):i=CI.subtract(this.position,this.previousPosition),n?$X.toDeg(i.angle()):i.angle()}getTextDirection(t,n=!1){let i=this.getDrawnNeighbours(t),a=Array();if(t.length===1)return "right";for(let s=0;s<i.length;s++)a.push(this.getAngle(t[i[s]].position));let r=$X.meanAngle(a);if(this.isTerminal()||n)Math.round(r*100)/100===1.57&&(r=r-.2),r=Math.round(Math.round(r/Math.PI)*Math.PI);else {let s=Math.PI/2;r=Math.round(Math.round(r/s)*s);}return r===2?"down":r===-2?"up":r===0||r===-0?"right":r===3||r===-3?"left":"down"}getNeighbours(t=null){if(t===null)return this.neighbours.slice();let n=Array();for(let i=0;i<this.neighbours.length;i++)this.neighbours[i]!==t&&n.push(this.neighbours[i]);return n}getDrawnNeighbours(t){let n=Array();for(let i=0;i<this.neighbours.length;i++)t[this.neighbours[i]].value.isDrawn&&n.push(this.neighbours[i]);return n}getNeighbourCount(){return this.neighbourCount}getSpanningTreeNeighbours(t=null){let n=Array();for(let i=0;i<this.spanningTreeChildren.length;i++)(t===void 0||t!=this.spanningTreeChildren[i])&&n.push(this.spanningTreeChildren[i]);return this.parentVertexId!=null&&(t===void 0||t!=this.parentVertexId)&&n.push(this.parentVertexId),n}getNextInRing(t,n,i){let a=this.getNeighbours();for(let r=0;r<a.length;r++)if(K4.contains(t[a[r]].value.rings,{value:n})&&a[r]!=i)return a[r];return null}};GX.exports=sF;});var oF=H((REt,WX)=>{zT();wv();var aF=class{constructor(t,n){this.id=null,this.firstRingId=t.id,this.secondRingId=n.id,this.vertices=new Set;for(var i=0;i<t.members.length;i++){let a=t.members[i];for(let r=0;r<n.members.length;r++){let s=n.members[r];a===s&&this.addVertex(a);}}}addVertex(t){this.vertices.add(t);}updateOther(t,n){this.firstRingId===n?this.secondRingId=t:this.firstRingId=t;}containsRing(t){return this.firstRingId===t||this.secondRingId===t}isBridge(t){if(this.vertices.size>2)return !0;for(let n of this.vertices)if(t[n].value.rings.length>2)return !0;return !1}static isBridge(t,n,i,a){let r=null;for(let s=0;s<t.length;s++)if(r=t[s],r.firstRingId===i&&r.secondRingId===a||r.firstRingId===a&&r.secondRingId===i)return r.isBridge(n);return !1}static getNeighbours(t,n){let i=[];for(let a=0;a<t.length;a++){let r=t[a];r.firstRingId===n?i.push(r.secondRingId):r.secondRingId===n&&i.push(r.firstRingId);}return i}static getVertices(t,n,i){for(let a=0;a<t.length;a++){let r=t[a];if(r.firstRingId===n&&r.secondRingId===i||r.firstRingId===i&&r.secondRingId===n)return [...r.vertices]}}};WX.exports=aF;});var wv=H((UEt,VX)=>{var uF=vv(),qIe=E0();zT();var $Ie=oF(),lF=class e{constructor(t){this.id=null,this.members=t,this.edges=[],this.insiders=[],this.neighbours=[],this.positioned=!1,this.center=new qIe(0,0),this.rings=[],this.isBridged=!1,this.isPartOfBridged=!1,this.isSpiro=!1,this.isFused=!1,this.centralAngle=0,this.canFlip=!0;}clone(){let t=new e(this.members);return t.id=this.id,t.insiders=uF.clone(this.insiders),t.neighbours=uF.clone(this.neighbours),t.positioned=this.positioned,t.center=this.center.clone(),t.rings=uF.clone(this.rings),t.isBridged=this.isBridged,t.isPartOfBridged=this.isPartOfBridged,t.isSpiro=this.isSpiro,t.isFused=this.isFused,t.centralAngle=this.centralAngle,t.canFlip=this.canFlip,t}getSize(){return this.members.length}getPolygon(t){let n=[];for(let i=0;i<this.members.length;i++)n.push(t[this.members[i]].position);return n}getAngle(){return Math.PI-this.centralAngle}eachMember(t,n,i,a){i=i||i===0?i:this.members[0];let r=i,s=0;for(;r!=null&&s<100;){let o=r;n(o),r=t[r].getNextInRing(t,this.id,a),a=o,r==i&&(r=null),s++;}}getOrderedNeighbours(t){let n=Array(this.neighbours.length);for(let i=0;i<this.neighbours.length;i++){let a=$Ie.getVertices(t,this.id,this.neighbours[i]);n[i]={n:a.length,neighbour:this.neighbours[i]};}return n.sort(function(i,a){return a.n-i.n}),n}isBenzeneLike(t){let n=this.getDoubleBondCount(t),i=this.members.length;return n===3&&i===6||n===2&&i===5}getDoubleBondCount(t){let n=0;for(let i=0;i<this.members.length;i++){let a=t[this.members[i]].value;(a.bondType==="="||a.branchBond==="=")&&n++;}return n}contains(t){for(let n=0;n<this.members.length;n++)if(this.members[n]==t)return !0;return !1}};VX.exports=lF;});var DI=H((GEt,ZX)=>{var GIe=vv();zT();wv();var cF=class e{constructor(t,n="-"){this.idx=null,this.element=t.length===1?t.toUpperCase():t,this.drawExplicit=!1,this.ringbonds=Array(),this.rings=Array(),this.bondType=n,this.branchBond=null,this.isBridge=!1,this.isBridgeNode=!1,this.originalRings=Array(),this.bridgedRing=null,this.anchoredRings=Array(),this.bracket=null,this.plane=0,this.attachedPseudoElements={},this.hasAttachedPseudoElements=!1,this.isDrawn=!0,this.isConnectedToRing=!1,this.neighbouringElements=Array(),this.isPartOfAromaticRing=t!==this.element,this.bondCount=0,this.chirality="",this.isStereoCenter=!1,this.priority=0,this.mainChain=!1,this.hydrogenDirection="down",this.subtreeDepth=1,this.hasHydrogen=!1,this.class=void 0;}addNeighbouringElement(t){this.neighbouringElements.push(t);}attachPseudoElement(t,n,i=0,a=0){i===null&&(i=0),a===null&&(a=0);let r=i+t+a;this.attachedPseudoElements[r]?this.attachedPseudoElements[r].count+=1:this.attachedPseudoElements[r]={element:t,count:1,hydrogenCount:i,previousElement:n,charge:a},this.hasAttachedPseudoElements=!0;}getAttachedPseudoElements(){let t={},n=this;return Object.keys(this.attachedPseudoElements).sort().forEach(function(i){t[i]=n.attachedPseudoElements[i];}),t}getAttachedPseudoElementsCount(){return Object.keys(this.attachedPseudoElements).length}isHeteroAtom(){return this.element!=="C"&&this.element!=="H"}addAnchoredRing(t){GIe.contains(this.anchoredRings,{value:t})||this.anchoredRings.push(t);}getRingbondCount(){return this.ringbonds.length}backupRings(){this.originalRings=Array(this.rings.length);for(let t=0;t<this.rings.length;t++)this.originalRings[t]=this.rings[t];}restoreRings(){this.rings=Array(this.originalRings.length);for(let t=0;t<this.originalRings.length;t++)this.rings[t]=this.originalRings[t];}haveCommonRingbond(t,n){for(let i=0;i<t.ringbonds.length;i++)for(let a=0;a<n.ringbonds.length;a++)if(t.ringbonds[i].id==n.ringbonds[a].id)return !0;return !1}neighbouringElementsEqual(t){if(t.length!==this.neighbouringElements.length)return !1;t.sort(),this.neighbouringElements.sort();for(var n=0;n<this.neighbouringElements.length;n++)if(t[n]!==this.neighbouringElements[n])return !1;return !0}getAtomicNumber(){return e.atomicNumbers[this.element]}getMaxBonds(){return e.maxBonds[this.element]}static get maxBonds(){return {H:1,C:4,N:3,O:2,P:3,S:2,B:3,F:1,I:1,Cl:1,Br:1}}static get atomicNumbers(){return {H:1,He:2,Li:3,Be:4,B:5,b:5,C:6,c:6,N:7,n:7,O:8,o:8,F:9,Ne:10,Na:11,Mg:12,Al:13,Si:14,P:15,p:15,S:16,s:16,Cl:17,Ar:18,K:19,Ca:20,Sc:21,Ti:22,V:23,Cr:24,Mn:25,Fe:26,Co:27,Ni:28,Cu:29,Zn:30,Ga:31,Ge:32,As:33,Se:34,Br:35,Kr:36,Rb:37,Sr:38,Y:39,Zr:40,Nb:41,Mo:42,Tc:43,Ru:44,Rh:45,Pd:46,Ag:47,Cd:48,In:49,Sn:50,Sb:51,Te:52,I:53,Xe:54,Cs:55,Ba:56,La:57,Ce:58,Pr:59,Nd:60,Pm:61,Sm:62,Eu:63,Gd:64,Tb:65,Dy:66,Ho:67,Er:68,Tm:69,Yb:70,Lu:71,Hf:72,Ta:73,W:74,Re:75,Os:76,Ir:77,Pt:78,Au:79,Hg:80,Tl:81,Pb:82,Bi:83,Po:84,At:85,Rn:86,Fr:87,Ra:88,Ac:89,Th:90,Pa:91,U:92,Np:93,Pu:94,Am:95,Cm:96,Bk:97,Cf:98,Es:99,Fm:100,Md:101,No:102,Lr:103,Rf:104,Db:105,Sg:106,Bh:107,Hs:108,Mt:109,Ds:110,Rg:111,Cn:112,Uut:113,Uuq:114,Uup:115,Uuh:116,Uus:117,Uuo:118}}static get mass(){return {H:1,He:2,Li:3,Be:4,B:5,b:5,C:6,c:6,N:7,n:7,O:8,o:8,F:9,Ne:10,Na:11,Mg:12,Al:13,Si:14,P:15,p:15,S:16,s:16,Cl:17,Ar:18,K:19,Ca:20,Sc:21,Ti:22,V:23,Cr:24,Mn:25,Fe:26,Co:27,Ni:28,Cu:29,Zn:30,Ga:31,Ge:32,As:33,Se:34,Br:35,Kr:36,Rb:37,Sr:38,Y:39,Zr:40,Nb:41,Mo:42,Tc:43,Ru:44,Rh:45,Pd:46,Ag:47,Cd:48,In:49,Sn:50,Sb:51,Te:52,I:53,Xe:54,Cs:55,Ba:56,La:57,Ce:58,Pr:59,Nd:60,Pm:61,Sm:62,Eu:63,Gd:64,Tb:65,Dy:66,Ho:67,Er:68,Tm:69,Yb:70,Lu:71,Hf:72,Ta:73,W:74,Re:75,Os:76,Ir:77,Pt:78,Au:79,Hg:80,Tl:81,Pb:82,Bi:83,Po:84,At:85,Rn:86,Fr:87,Ra:88,Ac:89,Th:90,Pa:91,U:92,Np:93,Pu:94,Am:95,Cm:96,Bk:97,Cf:98,Es:99,Fm:100,Md:101,No:102,Lr:103,Rf:104,Db:105,Sg:106,Bh:107,Hs:108,Mt:109,Ds:110,Rg:111,Cn:112,Uut:113,Uuq:114,Uup:115,Uuh:116,Uus:117,Uuo:118}}};ZX.exports=cF;});var NI=H((WEt,XX)=>{var Iv=E0(),hF=class e{constructor(t=new Iv(0,0),n=new Iv(0,0),i=null,a=null,r=!1,s=!1){this.from=t,this.to=n,this.elementFrom=i,this.elementTo=a,this.chiralFrom=r,this.chiralTo=s;}clone(){return new e(this.from.clone(),this.to.clone(),this.elementFrom,this.elementTo)}getLength(){return Math.sqrt(Math.pow(this.to.x-this.from.x,2)+Math.pow(this.to.y-this.from.y,2))}getAngle(){return Iv.subtract(this.getRightVector(),this.getLeftVector()).angle()}getRightVector(){return this.from.x<this.to.x?this.to:this.from}getLeftVector(){return this.from.x<this.to.x?this.from:this.to}getRightElement(){return this.from.x<this.to.x?this.elementTo:this.elementFrom}getLeftElement(){return this.from.x<this.to.x?this.elementFrom:this.elementTo}getRightChiral(){return this.from.x<this.to.x?this.chiralTo:this.chiralFrom}getLeftChiral(){return this.from.x<this.to.x?this.chiralFrom:this.chiralTo}setRightVector(t,n){return this.from.x<this.to.x?(this.to.x=t,this.to.y=n):(this.from.x=t,this.from.y=n),this}setLeftVector(t,n){return this.from.x<this.to.x?(this.from.x=t,this.from.y=n):(this.to.x=t,this.to.y=n),this}rotateToXAxis(){let t=this.getLeftVector();return this.setRightVector(t.x+this.getLength(),t.y),this}rotate(t){let n=this.getLeftVector(),i=this.getRightVector(),a=Math.sin(t),r=Math.cos(t),s=r*(i.x-n.x)-a*(i.y-n.y)+n.x,o=a*(i.x-n.x)-r*(i.y-n.y)+n.y;return this.setRightVector(s,o),this}shortenFrom(t){let n=Iv.subtract(this.to,this.from);return n.normalize(),n.multiplyScalar(t),this.from.add(n),this}shortenTo(t){let n=Iv.subtract(this.from,this.to);return n.normalize(),n.multiplyScalar(t),this.to.add(n),this}shortenRight(t){return this.from.x<this.to.x?this.shortenTo(t):this.shortenFrom(t),this}shortenLeft(t){return this.from.x<this.to.x?this.shortenFrom(t):this.shortenTo(t),this}shorten(t){let n=Iv.subtract(this.from,this.to);return n.normalize(),n.multiplyScalar(t/2),this.to.add(n),this.from.subtract(n),this}};XX.exports=hF;});var fF=H((VEt,KX)=>{var dF=class e{constructor(t,n,i=1){this.id=null,this.sourceId=t,this.targetId=n,this.weight=i,this.bondType="-",this.isPartOfAromaticRing=!1,this.center=!1,this.wedge="";}setBondType(t){this.bondType=t,this.weight=e.bonds[t];}static get bonds(){return {"-":1,"/":1,"\\":1,"=":2,"#":3,$:4}}};KX.exports=dF;});var HF=H((ZEt,zX)=>{function WIe(e){return e===1?"+":e===2?"2+":e===-1?"-":e===-2?"2-":""}zX.exports={getChargeText:WIe};});var JX=H((YEt,OX)=>{var Cv=Av(),gh=E0();NI();zT();wv();var {getChargeText:YX}=HF(),pF=class{constructor(t,n,i){typeof t=="string"||t instanceof String?this.canvas=document.getElementById(t):this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.themeManager=n,this.opts=i,this.drawingWidth=0,this.drawingHeight=0,this.offsetX=0,this.offsetY=0,this.fontLarge=this.opts.fontSizeLarge+"pt Helvetica, Arial, sans-serif",this.fontSmall=this.opts.fontSizeSmall+"pt Helvetica, Arial, sans-serif",this.updateSize(this.opts.width,this.opts.height),this.ctx.font=this.fontLarge,this.hydrogenWidth=this.ctx.measureText("H").width,this.halfHydrogenWidth=this.hydrogenWidth/2,this.halfBondThickness=this.opts.bondThickness/2;}updateSize(t,n){this.devicePixelRatio=window.devicePixelRatio||1,this.backingStoreRatio=this.ctx.webkitBackingStorePixelRatio||this.ctx.mozBackingStorePixelRatio||this.ctx.msBackingStorePixelRatio||this.ctx.oBackingStorePixelRatio||this.ctx.backingStorePixelRatio||1,this.ratio=this.devicePixelRatio/this.backingStoreRatio,this.ratio!==1?(this.canvas.width=t*this.ratio,this.canvas.height=n*this.ratio,this.canvas.style.width=t+"px",this.canvas.style.height=n+"px",this.ctx.setTransform(this.ratio,0,0,this.ratio,0,0)):(this.canvas.width=t*this.ratio,this.canvas.height=n*this.ratio);}setTheme(t){this.colors=t;}scale(t){let n=-Number.MAX_VALUE,i=-Number.MAX_VALUE,a=Number.MAX_VALUE,r=Number.MAX_VALUE;for(var s=0;s<t.length;s++){if(!t[s].value.isDrawn)continue;let h=t[s].position;n<h.x&&(n=h.x),i<h.y&&(i=h.y),a>h.x&&(a=h.x),r>h.y&&(r=h.y);}var o=this.opts.padding;n+=o,i+=o,a-=o,r-=o,this.drawingWidth=n-a,this.drawingHeight=i-r;var u=this.canvas.offsetWidth/this.drawingWidth,l=this.canvas.offsetHeight/this.drawingHeight,c=u<l?u:l;this.ctx.scale(c,c),this.offsetX=-a,this.offsetY=-r,u<l?this.offsetY+=this.canvas.offsetHeight/(2*c)-this.drawingHeight/2:this.offsetX+=this.canvas.offsetWidth/(2*c)-this.drawingWidth/2;}reset(){this.ctx.setTransform(1,0,0,1,0,0);}getColor(t){return t=t.toUpperCase(),t in this.colors?this.colors[t]:this.colors.C}drawCircle(t,n,i,a,r=!0,s=!1,o=""){let u=this.ctx,l=this.offsetX,c=this.offsetY;u.save(),u.lineWidth=1.5,u.beginPath(),u.arc(t+l,n+c,i,0,Cv.twoPI,!0),u.closePath(),s?(r?(u.fillStyle="#f00",u.fill()):(u.strokeStyle="#f00",u.stroke()),this.drawDebugText(t,n,o)):r?(u.fillStyle=a,u.fill()):(u.strokeStyle=a,u.stroke()),u.restore();}drawLine(t,n=!1,i=1){let a=this.ctx,r=this.offsetX,s=this.offsetY,o=t.clone().shorten(4),u=o.getLeftVector().clone(),l=o.getRightVector().clone();u.x+=r,u.y+=s,l.x+=r,l.y+=s,n||(a.save(),a.globalCompositeOperation="destination-out",a.beginPath(),a.moveTo(u.x,u.y),a.lineTo(l.x,l.y),a.lineCap="round",a.lineWidth=this.opts.bondThickness+1.2,a.strokeStyle=this.themeManager.getColor("BACKGROUND"),a.stroke(),a.globalCompositeOperation="source-over",a.restore()),u=t.getLeftVector().clone(),l=t.getRightVector().clone(),u.x+=r,u.y+=s,l.x+=r,l.y+=s,a.save(),a.beginPath(),a.moveTo(u.x,u.y),a.lineTo(l.x,l.y),a.lineCap="round",a.lineWidth=this.opts.bondThickness;let c=this.ctx.createLinearGradient(u.x,u.y,l.x,l.y);c.addColorStop(.4,this.themeManager.getColor(t.getLeftElement())||this.themeManager.getColor("C")),c.addColorStop(.6,this.themeManager.getColor(t.getRightElement())||this.themeManager.getColor("C")),n&&(a.setLineDash([1,1.5]),a.lineWidth=this.opts.bondThickness/1.5),i<1&&(a.globalAlpha=i),a.strokeStyle=c,a.stroke(),a.restore();}drawWedge(t,n=1){if(isNaN(t.from.x)||isNaN(t.from.y)||isNaN(t.to.x)||isNaN(t.to.y))return;let i=this.ctx,a=this.offsetX,r=this.offsetY,s=t.clone().shorten(5),o=s.getLeftVector().clone(),u=s.getRightVector().clone();o.x+=a,o.y+=r,u.x+=a,u.y+=r,o=t.getLeftVector().clone(),u=t.getRightVector().clone(),o.x+=a,o.y+=r,u.x+=a,u.y+=r,i.save();let l=gh.normals(o,u);l[0].normalize(),l[1].normalize();let c=t.getRightChiral(),h=o,d=u;c&&(h=u,d=o);let f=gh.add(h,gh.multiplyScalar(l[0],this.halfBondThickness)),L=gh.add(d,gh.multiplyScalar(l[0],1.5+this.halfBondThickness)),_=gh.add(d,gh.multiplyScalar(l[1],1.5+this.halfBondThickness)),g=gh.add(h,gh.multiplyScalar(l[1],this.halfBondThickness));i.beginPath(),i.moveTo(f.x,f.y),i.lineTo(L.x,L.y),i.lineTo(_.x,_.y),i.lineTo(g.x,g.y);let y=this.ctx.createRadialGradient(u.x,u.y,this.opts.bondLength,u.x,u.y,0);y.addColorStop(.4,this.themeManager.getColor(t.getLeftElement())||this.themeManager.getColor("C")),y.addColorStop(.6,this.themeManager.getColor(t.getRightElement())||this.themeManager.getColor("C")),i.fillStyle=y,i.fill(),i.restore();}drawDashedWedge(t){if(isNaN(t.from.x)||isNaN(t.from.y)||isNaN(t.to.x)||isNaN(t.to.y))return;let n=this.ctx,i=this.offsetX,a=this.offsetY,r=t.getLeftVector().clone(),s=t.getRightVector().clone();r.x+=i,r.y+=a,s.x+=i,s.y+=a,n.save();let o=gh.normals(r,s);o[0].normalize(),o[1].normalize();let u=t.getRightChiral(),l,c,h,d,f=t.clone();u?(l=s,c=r,f.shortenRight(1),h=f.getRightVector().clone(),d=f.getLeftVector().clone()):(l=r,c=s,f.shortenLeft(1),h=f.getLeftVector().clone(),d=f.getRightVector().clone()),h.x+=i,h.y+=a,d.x+=i,d.y+=a;let L=gh.subtract(c,l).normalize();n.strokeStyle=this.themeManager.getColor("C"),n.lineCap="round",n.lineWidth=this.opts.bondThickness,n.beginPath();let _=t.getLength(),g=1.25/(_/(this.opts.bondThickness*3)),y=!1;for(var P=0;P<1;P+=g){let w=gh.multiplyScalar(L,P*_),q=gh.add(l,w),V=1.5*P,Ce=gh.multiplyScalar(o[0],V);!y&&P>.5&&(n.stroke(),n.beginPath(),n.strokeStyle=this.themeManager.getColor(t.getRightElement())||this.themeManager.getColor("C"),y=!0),q.subtract(Ce),n.moveTo(q.x,q.y),q.add(gh.multiplyScalar(Ce,2)),n.lineTo(q.x,q.y);}n.stroke(),n.restore();}drawDebugText(t,n,i){let a=this.ctx;a.save(),a.font="5px Droid Sans, sans-serif",a.textAlign="start",a.textBaseline="top",a.fillStyle="#ff0000",a.fillText(i,t+this.offsetX,n+this.offsetY),a.restore();}drawBall(t,n,i){let a=this.ctx;a.save(),a.beginPath(),a.arc(t+this.offsetX,n+this.offsetY,this.opts.bondLength/4.5,0,Cv.twoPI,!1),a.fillStyle=this.themeManager.getColor(i),a.fill(),a.restore();}drawPoint(t,n,i){let a=this.ctx,r=this.offsetX,s=this.offsetY;a.save(),a.globalCompositeOperation="destination-out",a.beginPath(),a.arc(t+r,n+s,1.5,0,Cv.twoPI,!0),a.closePath(),a.fill(),a.globalCompositeOperation="source-over",a.beginPath(),a.arc(t+this.offsetX,n+this.offsetY,.75,0,Cv.twoPI,!1),a.fillStyle=this.themeManager.getColor(i),a.fill(),a.restore();}drawText(t,n,i,a,r,s,o,u,l,c={}){let h=this.ctx,d=this.offsetX,f=this.offsetY;h.save(),h.textAlign="start",h.textBaseline="alphabetic";let _="",g=0;o&&(_=YX(o),h.font=this.fontSmall,g=h.measureText(_).width);let y="0",P=0;u>0&&(y=u.toString(),h.font=this.fontSmall,P=h.measureText(y).width),o===1&&i==="N"&&c.hasOwnProperty("0O")&&c.hasOwnProperty("0O-1")&&(c={"0O":{element:"O",count:2,hydrogenCount:0,previousElement:"C",charge:""}},o=0),h.font=this.fontLarge,h.fillStyle=this.themeManager.getColor("BACKGROUND");let w=h.measureText(i);w.totalWidth=w.width+g,w.height=parseInt(this.fontLarge,10);let q=w.width>this.opts.fontSizeLarge?w.width:this.opts.fontSizeLarge;q/=1.5,h.globalCompositeOperation="destination-out",h.beginPath(),h.arc(t+d,n+f,q,0,Cv.twoPI,!0),h.closePath(),h.fill(),h.globalCompositeOperation="source-over";let V=-w.width/2,Ce=-w.width/2;h.fillStyle=this.themeManager.getColor(i),h.fillText(i,t+d+V,n+this.opts.halfFontSizeLarge+f),V+=w.width,o&&(h.font=this.fontSmall,h.fillText(_,t+d+V,n-this.opts.fifthFontSizeSmall+f),V+=g),u>0&&(h.font=this.fontSmall,h.fillText(y,t+d+Ce-P,n-this.opts.fifthFontSizeSmall+f),Ce-=P),h.font=this.fontLarge;let _e=0,he=0;if(a===1){let Ve=t+d,Ue=n+f+this.opts.halfFontSizeLarge;_e=this.hydrogenWidth,Ce-=_e,r==="left"?Ve+=Ce:r==="right"||r==="up"&&s||r==="down"&&s?Ve+=V:r==="up"&&!s?(Ue-=this.opts.fontSizeLarge+this.opts.quarterFontSizeLarge,Ve-=this.halfHydrogenWidth):r==="down"&&!s&&(Ue+=this.opts.fontSizeLarge+this.opts.quarterFontSizeLarge,Ve-=this.halfHydrogenWidth),h.fillText("H",Ve,Ue),V+=_e;}else if(a>1){let Ve=t+d,Ue=n+f+this.opts.halfFontSizeLarge;_e=this.hydrogenWidth,h.font=this.fontSmall,he=h.measureText(a).width,Ce-=_e+he,r==="left"?Ve+=Ce:r==="right"||r==="up"&&s||r==="down"&&s?Ve+=V:r==="up"&&!s?(Ue-=this.opts.fontSizeLarge+this.opts.quarterFontSizeLarge,Ve-=this.halfHydrogenWidth):r==="down"&&!s&&(Ue+=this.opts.fontSizeLarge+this.opts.quarterFontSizeLarge,Ve-=this.halfHydrogenWidth),h.font=this.fontLarge,h.fillText("H",Ve,Ue),h.font=this.fontSmall,h.fillText(a,Ve+this.halfHydrogenWidth+he,Ue+this.opts.fifthFontSizeSmall),V+=_e+this.halfHydrogenWidth+he;}for(let Ve in c){if(!c.hasOwnProperty(Ve))continue;let Ue=0,ze=0,X=c[Ve].element,Ne=c[Ve].count,nt=c[Ve].hydrogenCount,Mt=c[Ve].charge;h.font=this.fontLarge,Ne>1&&nt>0&&(Ue=h.measureText("(").width,ze=h.measureText(")").width);let hn=h.measureText(X).width,Wn=0,ht="",st=0;_e=0,nt>0&&(_e=this.hydrogenWidth),h.font=this.fontSmall,Ne>1&&(Wn=h.measureText(Ne).width),Mt!==0&&(ht=YX(Mt),st=h.measureText(ht).width),he=0,nt>1&&(he=h.measureText(nt).width),h.font=this.fontLarge;let jt=t+d,mn=n+f+this.opts.halfFontSizeLarge;h.fillStyle=this.themeManager.getColor(X),Ne>0&&(Ce-=Wn),Ne>1&&nt>0&&(r==="left"?(Ce-=ze,h.fillText(")",jt+Ce,mn)):(h.fillText("(",jt+V,mn),V+=Ue)),r==="left"?(Ce-=hn,h.fillText(X,jt+Ce,mn)):(h.fillText(X,jt+V,mn),V+=hn),nt>0&&(r==="left"?(Ce-=_e+he,h.fillText("H",jt+Ce,mn),nt>1&&(h.font=this.fontSmall,h.fillText(nt,jt+Ce+_e,mn+this.opts.fifthFontSizeSmall))):(h.fillText("H",jt+V,mn),V+=_e,nt>1&&(h.font=this.fontSmall,h.fillText(nt,jt+V,mn+this.opts.fifthFontSizeSmall),V+=he))),h.font=this.fontLarge,Ne>1&&nt>0&&(r==="left"?(Ce-=Ue,h.fillText("(",jt+Ce,mn)):(h.fillText(")",jt+V,mn),V+=ze)),h.font=this.fontSmall,Ne>1&&(r==="left"?h.fillText(Ne,jt+Ce+Ue+ze+_e+he+hn,mn+this.opts.fifthFontSizeSmall):(h.fillText(Ne,jt+V,mn+this.opts.fifthFontSizeSmall),V+=Wn)),Mt!==0&&(r==="left"?h.fillText(ht,jt+Ce+Ue+ze+_e+he+hn,n-this.opts.fifthFontSizeSmall+f):(h.fillText(ht,jt+V,n-this.opts.fifthFontSizeSmall+f),V+=st));}h.restore();}getChargeText(t){return t===1?"+":t===2?"2+":t===-1?"-":t===-2?"2-":""}drawDebugPoint(t,n,i="",a="#f00"){this.drawCircle(t,n,2,a,!0,!0,i);}drawAromaticityRing(t){let n=this.ctx,i=Cv.apothemFromSideLength(this.opts.bondLength,t.getSize());n.save(),n.strokeStyle=this.themeManager.getColor("C"),n.lineWidth=this.opts.bondThickness,n.beginPath(),n.arc(t.center.x+this.offsetX,t.center.y+this.offsetY,i-this.opts.bondSpacing,0,Math.PI*2,!0),n.closePath(),n.stroke(),n.restore();}clear(){this.ctx.clearRect(0,0,this.canvas.offsetWidth,this.canvas.offsetHeight);}};OX.exports=pF;});var z4=H((QEt,jX)=>{var QX=Av();E0();var VIe=zT(),ZIe=fF();wv();var XIe=DI(),mF=class e{constructor(t,n=!1){this.vertices=Array(),this.edges=Array(),this.atomIdxToVertexId=Array(),this.vertexIdsToEdgeId={},this.isomeric=n,this._atomIdx=0,this._time=0,this._init(t);}_init(t,n=0,i=null,a=!1){let r=t.atom.element?t.atom.element:t.atom,s=new XIe(r,t.bond);(r!=="H"||!t.hasNext&&i===null)&&(s.idx=this._atomIdx,this._atomIdx++),s.branchBond=t.branchBond,s.ringbonds=t.ringbonds,s.bracket=t.atom.element?t.atom:null,s.class=t.atom.class;let o=new VIe(s),u=this.vertices[i];if(this.addVertex(o),s.idx!==null&&this.atomIdxToVertexId.push(o.id),i!==null){o.setParentVertexId(i),o.value.addNeighbouringElement(u.value.element),u.addChild(o.id),u.value.addNeighbouringElement(s.element),u.spanningTreeChildren.push(o.id);let d=new ZIe(i,o.id,1);a?(d.setBondType(o.value.branchBond||"-"),o.id,d.setBondType(o.value.branchBond||"-"),o.id):(d.setBondType(u.value.bondType||"-"),u.id);this.addEdge(d);}let l=t.ringbondCount+1;s.bracket&&(l+=s.bracket.hcount);let c=0;if(s.bracket&&s.bracket.chirality){s.isStereoCenter=!0,c=s.bracket.hcount;for(var h=0;h<c;h++)this._init({atom:"H",isBracket:"false",branches:Array(),branchCount:0,ringbonds:Array(),ringbondCount:!1,next:null,hasNext:!1,bond:"-"},h,o.id,!0);}for(var h=0;h<t.branchCount;h++)this._init(t.branches[h],h+l,o.id,!0);t.hasNext&&this._init(t.next,t.branchCount+l,o.id);}clear(){this.vertices=Array(),this.edges=Array(),this.vertexIdsToEdgeId={};}addVertex(t){return t.id=this.vertices.length,this.vertices.push(t),t.id}addEdge(t){let n=this.vertices[t.sourceId],i=this.vertices[t.targetId];return t.id=this.edges.length,this.edges.push(t),this.vertexIdsToEdgeId[t.sourceId+"_"+t.targetId]=t.id,this.vertexIdsToEdgeId[t.targetId+"_"+t.sourceId]=t.id,t.isPartOfAromaticRing=n.value.isPartOfAromaticRing&&i.value.isPartOfAromaticRing,n.value.bondCount+=t.weight,i.value.bondCount+=t.weight,n.edges.push(t.id),i.edges.push(t.id),t.id}getEdge(t,n){let i=this.vertexIdsToEdgeId[t+"_"+n];return i===void 0?null:this.edges[i]}getEdges(t){let n=Array(),i=this.vertices[t];for(var a=0;a<i.neighbours.length;a++)n.push(this.vertexIdsToEdgeId[t+"_"+i.neighbours[a]]);return n}hasEdge(t,n){return this.vertexIdsToEdgeId[t+"_"+n]!==void 0}getVertexList(){let t=[this.vertices.length];for(var n=0;n<this.vertices.length;n++)t[n]=this.vertices[n].id;return t}getEdgeList(){let t=Array(this.edges.length);for(var n=0;n<this.edges.length;n++)t[n]=[this.edges[n].sourceId,this.edges[n].targetId];return t}getAdjacencyMatrix(){let t=this.vertices.length,n=Array(t);for(var i=0;i<t;i++)n[i]=new Array(t),n[i].fill(0);for(var i=0;i<this.edges.length;i++){let r=this.edges[i];n[r.sourceId][r.targetId]=1,n[r.targetId][r.sourceId]=1;}return n}getComponentsAdjacencyMatrix(){let t=this.vertices.length,n=Array(t),i=this.getBridges();for(var a=0;a<t;a++)n[a]=new Array(t),n[a].fill(0);for(var a=0;a<this.edges.length;a++){let s=this.edges[a];n[s.sourceId][s.targetId]=1,n[s.targetId][s.sourceId]=1;}for(var a=0;a<i.length;a++)n[i[a][0]][i[a][1]]=0,n[i[a][1]][i[a][0]]=0;return n}getSubgraphAdjacencyMatrix(t){let n=t.length,i=Array(n);for(var a=0;a<n;a++){i[a]=new Array(n),i[a].fill(0);for(var r=0;r<n;r++)a!==r&&this.hasEdge(t[a],t[r])&&(i[a][r]=1);}return i}getDistanceMatrix(){let t=this.vertices.length,n=this.getAdjacencyMatrix(),i=Array(t);for(var a=0;a<t;a++)i[a]=Array(t),i[a].fill(1/0);for(var a=0;a<t;a++)for(var r=0;r<t;r++)n[a][r]===1&&(i[a][r]=1);for(var s=0;s<t;s++)for(var a=0;a<t;a++)for(var r=0;r<t;r++)i[a][r]>i[a][s]+i[s][r]&&(i[a][r]=i[a][s]+i[s][r]);return i}getSubgraphDistanceMatrix(t){let n=t.length,i=this.getSubgraphAdjacencyMatrix(t),a=Array(n);for(var r=0;r<n;r++)a[r]=Array(n),a[r].fill(1/0);for(var r=0;r<n;r++)for(var s=0;s<n;s++)i[r][s]===1&&(a[r][s]=1);for(var o=0;o<n;o++)for(var r=0;r<n;r++)for(var s=0;s<n;s++)a[r][s]>a[r][o]+a[o][s]&&(a[r][s]=a[r][o]+a[o][s]);return a}getAdjacencyList(){let t=this.vertices.length,n=Array(t);for(var i=0;i<t;i++){n[i]=[];for(var a=0;a<t;a++)i!==a&&this.hasEdge(this.vertices[i].id,this.vertices[a].id)&&n[i].push(a);}return n}getSubgraphAdjacencyList(t){let n=t.length,i=Array(n);for(var a=0;a<n;a++){i[a]=Array();for(var r=0;r<n;r++)a!==r&&this.hasEdge(t[a],t[r])&&i[a].push(r);}return i}getBridges(){let t=this.vertices.length,n=new Array(t),i=new Array(t),a=new Array(t),r=new Array(t),s=this.getAdjacencyList(),o=Array();n.fill(!1),r.fill(null),this._time=0;for(var u=0;u<t;u++)n[u]||this._bridgeDfs(u,n,i,a,r,s,o);return o}traverseBF(t,n){let i=this.vertices.length,a=new Array(i);a.fill(!1);for(var r=[t];r.length>0;){let o=r.shift(),u=this.vertices[o];n(u);for(var s=0;s<u.neighbours.length;s++){let l=u.neighbours[s];a[l]||(a[l]=!0,r.push(l));}}}getTreeDepth(t,n){if(t===null||n===null)return 0;let i=this.vertices[t].getSpanningTreeNeighbours(n),a=0;for(var r=0;r<i.length;r++){let s=i[r],o=this.getTreeDepth(s,t);o>a&&(a=o);}return a+1}traverseTree(t,n,i,a=999999,r=!1,s=1,o=null){if(o===null&&(o=new Uint8Array(this.vertices.length)),s>a+1||o[t]===1)return;o[t]=1;let u=this.vertices[t],l=u.getNeighbours(n);(!r||s>1)&&i(u);for(var c=0;c<l.length;c++)this.traverseTree(l[c],t,i,a,r,s+1,o);}kkLayout(t,n,i,a,r,s=.1,o=.1,u=2e3,l=50,c=1e9){let h=r;for(var d=t.length;d--;)var f=this.vertices[t[d]].neighbours.length;let L=this.getSubgraphDistanceMatrix(t),_=t.length,g=QX.polyCircumradius(500,_),y=QX.centralAngle(_),P=0,w=new Float32Array(_),q=new Float32Array(_),V=Array(_);for(d=_;d--;){let _t=this.vertices[t[d]];_t.positioned?(w[d]=_t.position.x,q[d]=_t.position.y):(w[d]=n.x+Math.cos(P)*g,q[d]=n.y+Math.sin(P)*g),V[d]=_t.positioned,P+=y;}let Ce=Array(_);for(d=_;d--;){Ce[d]=new Array(_);for(var f=_;f--;)Ce[d][f]=r*L[d][f];}let _e=Array(_);for(d=_;d--;){_e[d]=Array(_);for(var f=_;f--;)_e[d][f]=h*Math.pow(L[d][f],-2);}let he=Array(_),Ve=new Float32Array(_),Ue=new Float32Array(_);for(d=_;d--;)he[d]=Array(_);d=_;let ze,X,Ne,nt,Mt,hn,Wn;for(;d--;){ze=w[d],X=q[d],Ne=0,nt=0;let _t=_;for(;_t--;)d!==_t&&(Mt=w[_t],hn=q[_t],Wn=1/Math.sqrt((ze-Mt)*(ze-Mt)+(X-hn)*(X-hn)),he[d][_t]=[_e[d][_t]*(ze-Mt-Ce[d][_t]*(ze-Mt)*Wn),_e[d][_t]*(X-hn-Ce[d][_t]*(X-hn)*Wn)],he[_t][d]=he[d][_t],Ne+=he[d][_t][0],nt+=he[d][_t][1]);Ve[d]=Ne,Ue[d]=nt;}let ht=function(_t){return [Ve[_t]*Ve[_t]+Ue[_t]*Ue[_t],Ve[_t],Ue[_t]]},st=function(){let _t=0,gn=0,Jn=0,qn=0;for(d=_;d--;){let[Nr,pr,zi]=ht(d);Nr>_t&&V[d]===!1&&(_t=Nr,gn=d,Jn=pr,qn=zi);}return [gn,_t,Jn,qn]},jt=function(_t,gn,Jn){let qn=0,Nr=0,pr=0,zi=w[_t],mt=q[_t],Wa=Ce[_t],Is=_e[_t];for(d=_;d--;){if(d===_t)continue;let D=w[d],b=q[d],B=Wa[d],oe=Is[d],le=(zi-D)*(zi-D),xe=1/Math.pow(le+(mt-b)*(mt-b),1.5);qn+=oe*(1-B*(mt-b)*(mt-b)*xe),Nr+=oe*(1-B*le*xe),pr+=oe*(B*(zi-D)*(mt-b)*xe);}qn===0&&(qn=.1),Nr===0&&(Nr=.1),pr===0&&(pr=.1);let Cs=gn/qn+Jn/pr;Cs/=pr/qn-Nr/pr;let ai=-(pr*Cs+gn)/qn;w[_t]+=ai,q[_t]+=Cs;let ss=he[_t];gn=0,Jn=0,zi=w[_t],mt=q[_t];let Tt,Sn,fu,$e,co;for(d=_;d--;)_t!==d&&(Tt=w[d],Sn=q[d],fu=ss[d][0],$e=ss[d][1],co=1/Math.sqrt((zi-Tt)*(zi-Tt)+(mt-Sn)*(mt-Sn)),ai=Is[d]*(zi-Tt-Wa[d]*(zi-Tt)*co),Cs=Is[d]*(mt-Sn-Wa[d]*(mt-Sn)*co),ss[d]=[ai,Cs],gn+=ai,Jn+=Cs,Ve[d]+=ai-fu,Ue[d]+=Cs-$e);Ve[_t]=gn,Ue[_t]=Jn;},mn=0,zr=0,_r=0,Yr=0,sr=0,Ci=0;for(;c>s&&u>sr;)for(sr++,[mn,c,zr,_r]=st(),Yr=c,Ci=0;Yr>o&&l>Ci;)Ci++,jt(mn,zr,_r),[Yr,zr,_r]=ht(mn);for(d=_;d--;){let _t=t[d],gn=this.vertices[_t];gn.position.x=w[d],gn.position.y=q[d],gn.positioned=!0,gn.forcePositioned=!0;}}_bridgeDfs(t,n,i,a,r,s,o){n[t]=!0,i[t]=a[t]=++this._time;for(var u=0;u<s[t].length;u++){let l=s[t][u];n[l]?l!==r[t]&&(a[t]=Math.min(a[t],i[l])):(r[l]=t,this._bridgeDfs(l,n,i,a,r,s,o),a[t]=Math.min(a[t],a[l]),a[l]>i[t]&&o.push([t,l]));}}static getConnectedComponents(t){let n=t.length,i=new Array(n),a=new Array;i.fill(!1);for(var s=0;s<n;s++)if(!i[s]){let o=Array();i[s]=!0,o.push(s),e._ccGetDfs(s,i,t,o),o.length>1&&a.push(o);}return a}static getConnectedComponentCount(t){let n=t.length,i=new Array(n),a=0;i.fill(!1);for(var r=0;r<n;r++)i[r]||(i[r]=!0,a++,e._ccCountDfs(r,i,t));return a}static _ccCountDfs(t,n,i){for(var a=0;a<i[t].length;a++)!i[t][a]||n[a]||t===a||(n[a]=!0,e._ccCountDfs(a,n,i));}static _ccGetDfs(t,n,i,a){for(var r=0;r<i[t].length;r++)!i[t][r]||n[r]||t===r||(n[r]=!0,a.push(r),e._ccGetDfs(r,n,i,a));}};jX.exports=mF;});var tK=H((jEt,eK)=>{var KIe=z4(),EF=class e{static getRings(t,n=!1){let i=t.getComponentsAdjacencyMatrix();if(i.length===0)return null;let a=KIe.getConnectedComponents(i),r=Array();for(var s=0;s<a.length;s++){let l=a[s],c=t.getSubgraphAdjacencyMatrix([...l]),h=new Uint16Array(c.length),d=new Uint16Array(c.length);for(var o=0;o<c.length;o++){d[o]=0,h[o]=0;for(var u=0;u<c[o].length;u++)h[o]+=c[o][u];}let f=0;for(var o=0;o<c.length;o++)for(var u=o+1;u<c.length;u++)f+=c[o][u];let L=f-c.length+1,_=!0;for(var o=0;o<h.length;o++)h[o]!==3&&(_=!1);if(_&&(L=2+f-c.length),L===1){r.push([...l]);continue}n&&(L=999);let{d:g,pe:y,pe_prime:P}=e.getPathIncludedDistanceMatrices(c),w=e.getRingCandidates(g,y,P),q=e.getSSSR(w,g,c,y,P,h,d,L);for(var o=0;o<q.length;o++){let Ce=Array(q[o].size),_e=0;for(let he of q[o])Ce[_e++]=l[he];r.push(Ce);}}return r}static matrixToString(t){let n="";for(var i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)n+=t[i][a]+" ";n+=`
`;}return n}static getPathIncludedDistanceMatrices(t){let n=t.length,i=Array(n),a=Array(n),r=Array(n);for(var s=0,o=0,u=0,l=n;l--;){i[l]=Array(n),a[l]=Array(n),r[l]=Array(n);for(var h=n;h--;)i[l][h]=l===h||t[l][h]===1?t[l][h]:Number.POSITIVE_INFINITY,i[l][h]===1?a[l][h]=[[[l,h]]]:a[l][h]=Array(),r[l][h]=Array();}for(var c=n,h;c--;)for(l=n;l--;)for(h=n;h--;){let d=i[l][h],f=i[l][c]+i[c][h];if(d>f){var s,o,u;if(d===f+1)for(r[l][h]=[a[l][h].length],s=a[l][h].length;s--;)for(r[l][h][s]=[a[l][h][s].length],o=a[l][h][s].length;o--;)for(r[l][h][s][o]=[a[l][h][s][o].length],u=a[l][h][s][o].length;u--;)r[l][h][s][o][u]=[a[l][h][s][o][0],a[l][h][s][o][1]];else r[l][h]=Array();for(i[l][h]=f,a[l][h]=[[]],s=a[l][c][0].length;s--;)a[l][h][0].push(a[l][c][0][s]);for(s=a[c][h][0].length;s--;)a[l][h][0].push(a[c][h][0][s]);}else if(d===f){if(a[l][c].length&&a[c][h].length){var s;if(a[l][h].length){let _=Array();for(s=a[l][c][0].length;s--;)_.push(a[l][c][0][s]);for(s=a[c][h][0].length;s--;)_.push(a[c][h][0][s]);a[l][h].push(_);}else {let _=Array();for(s=a[l][c][0].length;s--;)_.push(a[l][c][0][s]);for(s=a[c][h][0].length;s--;)_.push(a[c][h][0][s]);a[l][h][0]=_;}}}else if(d===f-1){var s;if(r[l][h].length){let _=Array();for(s=a[l][c][0].length;s--;)_.push(a[l][c][0][s]);for(s=a[c][h][0].length;s--;)_.push(a[c][h][0][s]);r[l][h].push(_);}else {let _=Array();for(s=a[l][c][0].length;s--;)_.push(a[l][c][0][s]);for(s=a[c][h][0].length;s--;)_.push(a[c][h][0][s]);r[l][h][0]=_;}}}return {d:i,pe:a,pe_prime:r}}static getRingCandidates(t,n,i){let a=t.length,r=Array(),s=0;for(let o=0;o<a;o++)for(let u=0;u<a;u++)t[o][u]===0||n[o][u].length===1&&i[o][u]===0||(i[o][u].length!==0?s=2*(t[o][u]+.5):s=2*t[o][u],s!==1/0&&r.push([s,n[o][u],i[o][u]]));return r.sort(function(o,u){return o[0]-u[0]}),r}static getSSSR(t,n,i,a,r,s,o,u){let l=Array(),c=Array();for(let d=0;d<t.length;d++)if(t[d][0]%2!==0)for(let f=0;f<t[d][2].length;f++){let L=t[d][1][0].concat(t[d][2][f]);for(var h=0;h<L.length;h++)L[h][0].constructor===Array&&(L[h]=L[h][0]);let _=e.bondsToAtoms(L);if(e.getBondCount(_,i)===_.size&&!e.pathSetsContain(l,_,L,c,s,o)&&(l.push(_),c=c.concat(L)),l.length>u)return l}else for(let f=0;f<t[d][1].length-1;f++){let L=t[d][1][f].concat(t[d][1][f+1]);for(var h=0;h<L.length;h++)L[h][0].constructor===Array&&(L[h]=L[h][0]);let _=e.bondsToAtoms(L);if(e.getBondCount(_,i)===_.size&&!e.pathSetsContain(l,_,L,c,s,o)&&(l.push(_),c=c.concat(L)),l.length>u)return l}return l}static getEdgeCount(t){let n=0,i=t.length;for(var a=i-1;a--;)for(var r=i;r--;)t[a][r]===1&&n++;return n}static getEdgeList(t){let n=t.length,i=Array();for(var a=n-1;a--;)for(var r=n;r--;)t[a][r]===1&&i.push([a,r]);return i}static bondsToAtoms(t){let n=new Set;for(var i=t.length;i--;)n.add(t[i][0]),n.add(t[i][1]);return n}static getBondCount(t,n){let i=0;for(let a of t)for(let r of t)a!==r&&(i+=n[a][r]);return i/2}static pathSetsContain(t,n,i,a,r,s){for(var o=t.length;o--;){if(e.isSupersetOf(n,t[o]))return !0;if(t[o].size===n.size&&e.areSetsEqual(t[o],n))return !0}let u=0,l=!1;for(o=i.length;o--;)for(var c=a.length;c--;)(i[o][0]===a[c][0]&&i[o][1]===a[c][1]||i[o][1]===a[c][0]&&i[o][0]===a[c][1])&&u++,u===i.length&&(l=!0);let h=!1;if(l){for(let d of n)if(s[d]<r[d]){h=!0;break}}if(l&&!h)return !0;for(let d of n)s[d]++;return !1}static areSetsEqual(t,n){if(t.size!==n.size)return !1;for(let i of t)if(!n.has(i))return !1;return !0}static isSupersetOf(t,n){for(var i of n)if(!t.has(i))return !1;return !0}};eK.exports=EF;});var Y4=H((e_t,nK)=>{var _F=class{constructor(t,n){this.colors=t,this.theme=this.colors[n];}getColor(t){return t&&(t=t.toUpperCase(),t in this.theme)?this.theme[t]:this.theme.C}setTheme(t){this.colors.hasOwnProperty(t)&&(this.theme=this.colors[t]);}};nK.exports=_F;});var O4=H((t_t,rK)=>{var yF=class{static extend(){let t=this,n={},i=!1,a=0,r=arguments.length;Object.prototype.toString.call(arguments[0])==="[object Boolean]"&&(i=arguments[0],a++);let s=function(o){for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(i&&Object.prototype.toString.call(o[u])==="[object Object]"?n[u]=t.extend(!0,n[u],o[u]):n[u]=o[u]);};for(;a<r;a++){let o=arguments[a];s(o);}return n}};rK.exports=yF;});var oK=H((r_t,aK)=>{var Ns=Av(),_0=vv(),Dn=E0(),fo=NI();zT();var zIe=fF(),J4=DI(),iK=wv(),Q4=oF(),YIe=JX(),sK=z4(),OIe=tK(),JIe=Y4(),QIe=O4(),LF=class{constructor(t){this.graph=null,this.doubleBondConfigCount=0,this.doubleBondConfig=null,this.ringIdCounter=0,this.ringConnectionIdCounter=0,this.canvasWrapper=null,this.totalOverlapScore=0,this.defaultOptions={width:500,height:500,scale:0,bondThickness:1,bondLength:30,shortBondLength:.8,bondSpacing:.17*30,atomVisualization:"default",isomeric:!0,debug:!1,terminalCarbons:!1,explicitHydrogens:!0,overlapSensitivity:.42,overlapResolutionIterations:1,compactDrawing:!0,fontFamily:"Arial, Helvetica, sans-serif",fontSizeLarge:11,fontSizeSmall:3,padding:10,experimentalSSSR:!1,kkThreshold:.1,kkInnerThreshold:.1,kkMaxIteration:2e4,kkMaxInnerIteration:50,kkMaxEnergy:1e9,weights:{colormap:null,additionalPadding:20,sigma:10,interval:0,opacity:1},themes:{dark:{C:"#fff",O:"#e74c3c",N:"#3498db",F:"#27ae60",CL:"#16a085",BR:"#d35400",I:"#8e44ad",P:"#d35400",S:"#f1c40f",B:"#e67e22",SI:"#e67e22",H:"#aaa",BACKGROUND:"#141414"},light:{C:"#222",O:"#e74c3c",N:"#3498db",F:"#27ae60",CL:"#16a085",BR:"#d35400",I:"#8e44ad",P:"#d35400",S:"#f1c40f",B:"#e67e22",SI:"#e67e22",H:"#666",BACKGROUND:"#fff"},oldschool:{C:"#000",O:"#000",N:"#000",F:"#000",CL:"#000",BR:"#000",I:"#000",P:"#000",S:"#000",B:"#000",SI:"#000",H:"#000",BACKGROUND:"#fff"},solarized:{C:"#586e75",O:"#dc322f",N:"#268bd2",F:"#859900",CL:"#16a085",BR:"#cb4b16",I:"#6c71c4",P:"#d33682",S:"#b58900",B:"#2aa198",SI:"#2aa198",H:"#657b83",BACKGROUND:"#fff"},"solarized-dark":{C:"#93a1a1",O:"#dc322f",N:"#268bd2",F:"#859900",CL:"#16a085",BR:"#cb4b16",I:"#6c71c4",P:"#d33682",S:"#b58900",B:"#2aa198",SI:"#2aa198",H:"#839496",BACKGROUND:"#fff"},matrix:{C:"#678c61",O:"#2fc079",N:"#4f7e7e",F:"#90d762",CL:"#82d967",BR:"#23755a",I:"#409931",P:"#c1ff8a",S:"#faff00",B:"#50b45a",SI:"#409931",H:"#426644",BACKGROUND:"#fff"},github:{C:"#24292f",O:"#cf222e",N:"#0969da",F:"#2da44e",CL:"#6fdd8b",BR:"#bc4c00",I:"#8250df",P:"#bf3989",S:"#d4a72c",B:"#fb8f44",SI:"#bc4c00",H:"#57606a",BACKGROUND:"#fff"},carbon:{C:"#161616",O:"#da1e28",N:"#0f62fe",F:"#198038",CL:"#007d79",BR:"#fa4d56",I:"#8a3ffc",P:"#ff832b",S:"#f1c21b",B:"#8a3800",SI:"#e67e22",H:"#525252",BACKGROUND:"#fff"},cyberpunk:{C:"#ea00d9",O:"#ff3131",N:"#0abdc6",F:"#00ff9f",CL:"#00fe00",BR:"#fe9f20",I:"#ff00ff",P:"#fe7f00",S:"#fcee0c",B:"#ff00ff",SI:"#ffffff",H:"#913cb1",BACKGROUND:"#fff"},gruvbox:{C:"#665c54",O:"#cc241d",N:"#458588",F:"#98971a",CL:"#79740e",BR:"#d65d0e",I:"#b16286",P:"#af3a03",S:"#d79921",B:"#689d6a",SI:"#427b58",H:"#7c6f64",BACKGROUND:"#fbf1c7"},"gruvbox-dark":{C:"#ebdbb2",O:"#cc241d",N:"#458588",F:"#98971a",CL:"#b8bb26",BR:"#d65d0e",I:"#b16286",P:"#fe8019",S:"#d79921",B:"#8ec07c",SI:"#83a598",H:"#bdae93",BACKGROUND:"#282828"},custom:{C:"#222",O:"#e74c3c",N:"#3498db",F:"#27ae60",CL:"#16a085",BR:"#d35400",I:"#8e44ad",P:"#d35400",S:"#f1c40f",B:"#e67e22",SI:"#e67e22",H:"#666",BACKGROUND:"#fff"}}},this.opts=QIe.extend(!0,this.defaultOptions,t),this.opts.halfBondSpacing=this.opts.bondSpacing/2,this.opts.bondLengthSq=this.opts.bondLength*this.opts.bondLength,this.opts.halfFontSizeLarge=this.opts.fontSizeLarge/2,this.opts.quarterFontSizeLarge=this.opts.fontSizeLarge/4,this.opts.fifthFontSizeSmall=this.opts.fontSizeSmall/5,this.theme=this.opts.themes.dark;}draw(t,n,i="light",a=!1){this.initDraw(t,i,a),this.infoOnly||(this.themeManager=new JIe(this.opts.themes,i),this.canvasWrapper=new YIe(n,this.themeManager,this.opts)),a||(this.processGraph(),this.canvasWrapper.scale(this.graph.vertices),this.drawEdges(this.opts.debug),this.drawVertices(this.opts.debug),this.canvasWrapper.reset(),this.opts.debug&&(console.log(this.graph),console.log(this.rings),console.log(this.ringConnections)));}edgeRingCount(t){let n=this.graph.edges[t],i=this.graph.vertices[n.sourceId],a=this.graph.vertices[n.targetId];return Math.min(i.value.rings.length,a.value.rings.length)}getBridgedRings(){let t=Array();for(var n=0;n<this.rings.length;n++)this.rings[n].isBridged&&t.push(this.rings[n]);return t}getFusedRings(){let t=Array();for(var n=0;n<this.rings.length;n++)this.rings[n].isFused&&t.push(this.rings[n]);return t}getSpiros(){let t=Array();for(var n=0;n<this.rings.length;n++)this.rings[n].isSpiro&&t.push(this.rings[n]);return t}printRingInfo(){let t="";for(var n=0;n<this.rings.length;n++){let i=this.rings[n];t+=i.id+";",t+=i.members.length+";",t+=i.neighbours.length+";",t+=i.isSpiro?"true;":"false;",t+=i.isFused?"true;":"false;",t+=i.isBridged?"true;":"false;",t+=i.rings.length+";",t+=`
`;}return t}rotateDrawing(){let t=0,n=0,i=0;for(var a=0;a<this.graph.vertices.length;a++){let o=this.graph.vertices[a];if(o.value.isDrawn)for(var r=a+1;r<this.graph.vertices.length;r++){let u=this.graph.vertices[r];if(!u.value.isDrawn)continue;let l=o.position.distanceSq(u.position);l>i&&(i=l,t=a,n=r);}}let s=-Dn.subtract(this.graph.vertices[t].position,this.graph.vertices[n].position).angle();if(!isNaN(s)){let o=s%.523599;o<.2617995?s=s-o:s+=.523599-o;for(var a=0;a<this.graph.vertices.length;a++)a!==n&&this.graph.vertices[a].position.rotateAround(s,this.graph.vertices[n].position);for(var a=0;a<this.rings.length;a++)this.rings[a].center.rotateAround(s,this.graph.vertices[n].position);}}getTotalOverlapScore(){return this.totalOverlapScore}getRingCount(){return this.rings.length}hasBridgedRing(){return this.bridgedRing}getHeavyAtomCount(){let t=0;for(var n=0;n<this.graph.vertices.length;n++)this.graph.vertices[n].val