(function(Y,Z,$,aa,T,ba,F,K,z,H,I,U,ca,M,da,G,x,P,R,S,N,Q,ea,V,W,X,fa,ga,ha,ia,O,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia,Ja,g,m){F("JS");z(["JU.BS","$.V3"],"JS.VTemp",null,function(){c$=I(function(){this.bsTemp=this.vNorm4=this.vNorm3=this.vNorm2=this.vTemp2=this.vTemp1=this.vB=this.vA=this.vTemp=null;H(this,arguments)},JS,"VTemp");N(c$,function(){this.vTemp=new JU.V3;this.vA=new JU.V3;this.vB=new JU.V3;this.vTemp1=new JU.V3;this.vTemp2=new JU.V3;this.vNorm2=
new JU.V3;this.vNorm3=new JU.V3;this.vNorm4=new JU.V3;this.bsTemp=new JU.BS})});F("J.api");V(J.api,"SmilesMatcherInterface");F("JS");z(["J.api.SmilesMatcherInterface"],"JS.SmilesMatcher","java.lang.Boolean JU.AU $.BS $.PT JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesGenerator $.SmilesParser $.SmilesSearch JU.BSUtil $.Elements $.Logger $.Node $.Point3fi".split(" "),function(){c$=I(function(){this.okMF=!0;H(this,arguments)},JS,"SmilesMatcher",null,J.api.SmilesMatcherInterface);m(c$,"getLastException",
function(){return!0==this.okMF?JS.InvalidSmilesException.getLastError():"MF_FAILED"});m(c$,"getMolecularFormula",function(a,b,c){this.clearExceptions();a=JS.SmilesParser.newSearch("/nostereo/"+a,b,!0);a.createTopoMap(null);a.nodes=a.target.nodes;return a.getMolecularFormula(!b,null,c)},"~S,~B,~B");g(c$,"clearExceptions",function(){JS.InvalidSmilesException.clear()});m(c$,"getSmiles",function(a,b,c,d,e){this.clearExceptions();return(new JS.SmilesGenerator).getSmiles(this,a,b,c,d,e)},"~A,~N,JU.BS,~S,~N");
m(c$,"areEqual",function(a,b){this.clearExceptions();var c=0<=a.indexOf("*");if(!c&&a.equals(b))return 1;c=this.matchPriv(a,null,0,null,null,!1,(c?2:1)|8,2,JS.SmilesParser.newSearch(b,!1,!0));return null==c?-1:c.length},"~S,~S");g(c$,"areEqualTest",function(a,b){b.set();var c=this.matchPriv(a,null,0,null,null,!1,9,2,b);return null!=c&&1==c.length},"~S,JS.SmilesSearch");m(c$,"find",function(a,b,c){this.clearExceptions();b=JS.SmilesParser.cleanPattern(b);a=JS.SmilesParser.cleanPattern(a);b=JS.SmilesParser.newSearch(b,
!1,!0);a=this.matchPriv(a,null,0,null,null,!1,c,3,b);for(c=a.length;0<=--c;)for(var d=a[c],e=d.length;0<=--e;)d[e]=b.target.nodes[d[e]].mapIndex;return a},"~S,~S,~N");m(c$,"hasStructure",function(a,b,c){var d=x(b.length,0);1!=(c&1)&&(c|=2);this.clearExceptions();a=JS.SmilesParser.cleanPattern(a);try{for(var e=JS.SmilesParser.newSearch(a,!0,!1),f=0;f<b.length;f++){var h=JS.SmilesParser.cleanPattern(b[f]),j=JS.SmilesParser.newSearch(h,!1,!0);j.setFlags(j.flags|JS.SmilesParser.getFlags(a));try{this.clearExceptions(),
d[f]=this.matchPattern(e,null,0,null,null,!1,c|8,5,j)===Boolean.TRUE?1:0}catch(k){if(G(k,Exception))d[f]=-1,k.printStackTrace();else throw k;}}}catch(s){if(G(s,Exception))throw JU.Logger.debugging&&s.printStackTrace(),null==JS.InvalidSmilesException.getLastError()&&this.clearExceptions(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw s;}return d},"~S,~A,~N");m(c$,"getAtoms",function(a){this.clearExceptions();a=JS.SmilesParser.cleanPattern(a);a=JS.SmilesParser.newSearch(a,
!1,!0);a.createTopoMap(new JU.BS);return a.target.nodes},"~S");m(c$,"getRelationship",function(a,b){if(null==a||null==b||0==a.length||0==b.length)return"";var c=this.getMolecularFormula(a,!1,!1),d=this.getMolecularFormula(b,!1,!1);if(!c.equals(d))return"none";var e,c=JU.PT.countChar(JU.PT.rep(a,"@@","@"),"@"),d=JU.PT.countChar(JU.PT.rep(b,"@@","@"),"@");e=c==d&&0<this.areEqual(b,a);if(!e){e=a+b;if(0<=e.indexOf("/")||0<=e.indexOf("\\")||0<=e.indexOf("@")){if(c==d&&(0<c&&0>e.indexOf("@SP"))&&(e=0<this.areEqual("/invertstereo/"+
b,a)))return"enantiomers";if(e=0<this.areEqual("/nostereo/"+b,a))return c==d?"diastereomers":"ambiguous stereochemistry!"}return"constitutional isomers"}return"identical"},"~S,~S");m(c$,"reverseChirality",function(a){a=JU.PT.rep(a,"@@","!@");a=JU.PT.rep(a,"@","@@");return a=JU.PT.rep(a,"!@@","@")},"~S");m(c$,"getSubstructureSet",function(a,b,c,d,e){var f=K(b,JS.SmilesSearch)?null:b;return this.matchPriv(a,f,c,d,null,!0,e|JS.SmilesParser.getFlags(a.toString()),1,null==f?b:null)},"~O,~O,~N,JU.BS,~N");
m(c$,"getMMFF94AtomTypes",function(a,b,c,d,e,f){this.clearExceptions();var h=new JS.SmilesParser(!0,!0),j=null,j=h.parse("");j.exitFirstMatch=!1;j.target.setAtoms(b,Math.abs(c),d);j.flags=770;j.getRingData(f,!0,!0);j.asVector=!1;j.subSearches=Array(1);j.getSelections();b=new JU.BS;for(d=0;d<a.length;d++)if(null==a[d]||0==a[d].length||a[d].startsWith("#"))e.addLast(null);else if(j.clear(),j.subSearches[0]=h.getSubsearch(j,JS.SmilesParser.cleanPattern(a[d]),770),f=JU.BSUtil.copy(j.search()),e.addLast(f),
b.or(f),b.cardinality()==c)break},"~A,~A,~N,JU.BS,JU.Lst,~A");m(c$,"getSubstructureSetArray",function(a,b,c,d,e,f){return this.matchPriv(a,b,c,d,e,!0,f,2,null)},"~S,~A,~N,JU.BS,JU.BS,~N");g(c$,"getAtropisomerKeys",function(a,b,c,d,e,f){return this.matchPriv(a,b,c,d,e,!1,f,4,null)},"~S,~A,~N,JU.BS,JU.BS,~N");m(c$,"polyhedronToSmiles",function(a,b,c,d,e,f){for(var h=Array(c),j=0;j<c;j++){h[j]=new JS.SmilesAtom;var k=null==d?null:d[j];K(k,JU.Node)?(h[j].elementNumber=k.getElementNumber(),h[j].bioAtomName=
k.getAtomName(),h[j].atomNumber=k.getAtomNumber(),h[j].setT(k)):(h[j].elementNumber=K(k,JU.Point3fi)?k.sD:-2,null!=k&&h[j].setT(k));h[j].index=j}k=0;for(j=b.length;0<=--j;)for(var s=b[j],n=s.length,l,g,p=n;0<=--p;)if(!((l=s[p])>=c||(g=s[(p+1)%n])>=c)&&null==h[l].getBondTo(h[g]))(new JS.SmilesBond(h[l],h[g],1,!1)).index=k++;for(j=0;j<c;j++)if(n=h[j].bondCount,0==n||n!=h[j].bonds.length)h[j].bonds=JU.AU.arrayCopyObject(h[j].bonds,n);b=null;b=new JS.SmilesGenerator;null!=d&&(b.polySmilesCenter=a);this.clearExceptions();
b=b.getSmiles(this,h,c,JU.BSUtil.newBitSet2(0,c),null,e|4144);65536==(e&65536)&&(b=(0==(e&131072)?"":"//* "+a+" *//\t")+"["+JU.Elements.elementSymbolFromNumber(a.getElementNumber())+"@PH"+c+(null==f?"":"/"+f+"/")+"]."+b);return b},"JU.Node,~A,~N,~A,~N,~S");m(c$,"getCorrelationMaps",function(a,b,c,d,e){return this.matchPriv(a,b,c,d,null,!0,e,3,null)},"~S,~A,~N,JU.BS,~N");g(c$,"matchPriv",function(a,b,c,d,e,f,h,j,k){this.clearExceptions();try{var s=K(a,JS.SmilesSearch);s&&(h|=2);var n=s?a:JS.SmilesParser.newSearch(null==
a?null:a.toString(),2==(h&2),!1);null!=k&&k.setFlags(k.flags|JS.SmilesParser.getFlags(a.toString()));return this.matchPattern(n,b,c,d,e,f,h,j,k)}catch(g){if(G(g,Exception))throw JU.Logger.debugging&&g.printStackTrace(),null==JS.InvalidSmilesException.getLastError()&&this.clearExceptions(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw g;}},"~O,~A,~N,JU.BS,JU.BS,~B,~N,~N,JS.SmilesSearch");g(c$,"matchPattern",function(a,b,c,d,e,f,h,j,k){var s=2==(h&2);this.okMF=!0;if(null!=
k)if(k.targetSet)a.setTarget(k);else if(a.haveSmilesTarget=!0,e=new JU.BS,k.createTopoMap(e),b=k.target.nodes,c=k.target.nodes.length,s){var g=k.elementCounts,l=a.elementCounts;k=k.elementNumberMax;if(k==a.elementNumberMax)for(var r=1;r<=k;r++){if(g[r]<l[r]){this.okMF=!1;break}}else this.okMF=!1}else if(g=a.getMFArray(!0,null,!1),l=k.getMFArray(!0,null,!1),k=k.elementNumberMax,k==a.elementNumberMax)for(r=2;r<=k;r++){if(g[r]!=l[r]){this.okMF=!1;break}}else this.okMF=!1;if(this.okMF&&(!s&&!a.patternAromatic&&
(null==e&&(e=new JU.BS),a.normalizeAromaticity(e),a.isNormalized=!0),a.targetSet||a.target.setAtoms(b,c,d),a.targetSet||0!=c&&(null==d||!d.isEmpty())))b=a.targetSet||!K(b[0],JS.SmilesAtom),a.getSelections(),f||(a.target.bsAromatic=e),a.target.hasRingData(h)||a.setRingData(null,null,b||f||a.patternAromatic),a.exitFirstMatch=8==(h&8),a.mapUnique=128==(h&128);switch(j){case 1:return a.asVector=!1,this.okMF?a.search():new JU.BS;case 2:if(!this.okMF)return[];a.asVector=!0;a=a.search();return a.toArray(Array(a.size()));
case 4:if(!this.okMF)return"";a.exitFirstMatch=!0;a.setAtropicity=!0;a.search();return a.atropKeys;case 3:if(!this.okMF)return x(0,0,0);a.getMaps=!0;a.setFlags(h|a.flags);a=a.search();return a.toArray(JU.AU.newInt2(a.size()));case 5:if(!this.okMF)return Boolean.FALSE;a.retBoolean=!0;a.setFlags(h|a.flags);return a.search()}return null},"JS.SmilesSearch,~A,~N,JU.BS,JU.BS,~B,~N,~N,JS.SmilesSearch");m(c$,"cleanSmiles",function(a){return JS.SmilesParser.cleanPattern(a)},"~S");m(c$,"getMapForJME",function(a,
b,c){try{var d=JS.SmilesMatcher.jmeToMolecule(a),e=JU.BSUtil.newBitSet2(0,d.ac),f=this.getSmiles(d.patternAtoms,d.ac,e,null,34),h=this.getCorrelationMaps(f,d.patternAtoms,d.ac,e,42),j=this.getCorrelationMaps(f,b,c.cardinality(),c,42);return O(-1,[h[0],j[0]])}catch(k){if(G(k,Exception))k.printStackTrace();else throw k;}return null},"~S,~A,JU.BS");c$.jmeToMolecule=g(c$,"jmeToMolecule",function(a){var b=new JS.SmilesSearch;a=JU.PT.getTokens(a);for(var c=JU.PT.parseInt(a[0]),d=JU.PT.parseInt(a[1]),e=
2,f=0;f<c;f++,e+=3){var h=a[e],j=b.addAtom(),k=h.indexOf("+"),s=0;if(0<=k)s=k==h.length-1?1:JU.PT.parseInt(h.substring(k+1));else if(0<=(k=h.indexOf("-")))s=JU.PT.parseInt(h.substring(k));j.setCharge(s);j.setSymbol(0>k?h:h.substring(0,k))}for(f=0;f<d;f++){h=JU.PT.parseInt(a[e++])-1;j=JU.PT.parseInt(a[e++])-1;c=JU.PT.parseInt(a[e++]);h=b.patternAtoms[h];j=b.patternAtoms[j];k=1;switch(c){case 2:k=2;break;case 3:k=3}(new JS.SmilesBond(h,j,k,!1)).index=f}b.isSmarts=!0;b.set();return b},"~S");m(c$,"getSmilesFromJME",
function(a){try{var b=JS.SmilesMatcher.jmeToMolecule(a),c=JU.BSUtil.newBitSet2(0,b.ac);return this.getSmiles(b.patternAtoms,b.ac,c,null,1)}catch(d){if(G(d,Exception))return null;throw d;}},"~S");m(c$,"compileSmartsPattern",function(a){a=JS.SmilesParser.cleanPattern(a);return JS.SmilesParser.newSearch(a,!0,!1)},"~S");m(c$,"compileSearchTarget",function(a,b,c){var d=new JS.SmilesSearch;d.target.setAtoms(a,b,c);d.targetSet=!0;return d},"~A,~N,JU.BS");P(c$,"MODE_BITSET",1,"MODE_ARRAY",2,"MODE_MAP",3,
"MODE_ATROP",4,"MODE_BOOLEAN",5)});F("JS");z(["java.lang.Exception"],"JS.InvalidSmilesException",null,function(){c$=S(JS,"InvalidSmilesException",Exception);c$.getLastError=g(c$,"getLastError",function(){return JS.InvalidSmilesException.lastError});c$.clear=g(c$,"clear",function(){JS.InvalidSmilesException.lastError=null});m(c$,"getMessage",function(){return JS.InvalidSmilesException.lastError});M(c$,function(a){Q(this,JS.InvalidSmilesException,[a]);JS.InvalidSmilesException.lastError=a.startsWith("Jmol SMILES")?
a:"Jmol SMILES Exception: "+a},"~S");P(c$,"lastError",null)});F("JS");z(["JU.JmolMolecule","JU.BS","$.Lst"],"JS.SmilesSearch","java.lang.Boolean $.Float java.util.Hashtable JU.AU $.SB JS.InvalidSmilesException $.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesParser $.SmilesStereo $.VTemp JU.BSUtil $.Logger".split(" "),function(){c$=I(function(){this.isSmarts=!1;this.v=this.patternAtoms=this.pattern=this.target=this.top=null;this.patternBioSequence=this.isTopology=this.haveSmilesTarget=
this.patternAromatic=this.setAtropicity=this.groupByModel=this.exitFirstMatch=this.invertStereochemistry=this.ignoreStereochemistry=this.ignoreElement=this.ignoreAtomClass=this.noAromatic=this.aromaticUnknown=this.aromaticDefined=this.aromaticMMFF94=this.aromaticDouble=this.aromaticPlanar=this.aromaticStrict=this.aromaticOpen=this.targetSet=!1;this.subSearches=null;this.haveBondStereochemistry=this.haveSelected=!1;this.stereo=null;this.needRingData=!1;this.needAromatic=!0;this.needRingMemberships=
!1;this.nDouble=0;this.ringDataMax=-2147483648;this.measures=null;this.flags=0;this.lastChainAtom=this.atropKeys=null;this.isRingCheck=this.isSilent=this.haveComponents=this.isNormalized=this.retBoolean=this.getMaps=this.asVector=!1;this.htNested=this.bsFound=null;this.nNested=0;this.bsCheck=this.bsReturn=this.uniqueList=this.vReturn=this.nestedBond=null;this.mapUnique=!1;this.polyAtom=this.polyhedronStereo=null;this.autoAddImplicitH=!0;this.pattern0=null;H(this,arguments)},JS,"SmilesSearch",JU.JmolMolecule);
N(c$,function(){this.patternAtoms=Array(16);this.measures=new JU.Lst;this.bsFound=new JU.BS;this.bsReturn=new JU.BS});c$.isRingBond=g(c$,"isRingBond",function(a,b,c,d){if(null!=a)for(var e=a.size();0<=--e;){var f=a.get(e);if(f.get(c)&&f.get(d)&&(null==b||b.get(e)))return!0}return!1},"JU.Lst,JU.BS,~N,~N");M(c$,function(){Q(this,JS.SmilesSearch,[]);this.top=this;this.target=new JS.SmilesSearch.SmilesTarget;this.v=new JS.VTemp});g(c$,"setTarget",function(a){this.target=a.target;this.targetSet=!0},"JS.SmilesSearch");
g(c$,"setTop",function(a){for(;a.top!==a;)a=a.top;this.top=a},"JS.SmilesSearch");c$.addFlags=g(c$,"addFlags",function(a,b){0<=b.indexOf("OPEN")&&(a|=5);0<=b.indexOf("BIO")&&(a|=1048576);0<=b.indexOf("HYDROGEN2")?a|=8192:0<=b.indexOf("HYDROGEN")&&(a|=4096);0<=b.indexOf("FIRSTMATCHONLY")&&(a|=8);0<=b.indexOf("STRICT")&&(a|=256);0<=b.indexOf("PLANAR")&&(a|=1024);if(0<=b.indexOf("NOAROMATIC")||0<=b.indexOf("NONAROMATIC"))a|=16;0<=b.indexOf("AROMATICDOUBLE")&&(a|=512);0<=b.indexOf("AROMATICDEFINED")&&
(a|=128);0<=b.indexOf("MMFF94")&&(a|=768);0<=b.indexOf("TOPOLOGY")&&(a|=16384);0<=b.indexOf("NOATOMCLASS")&&(a|=2048);0<=b.indexOf("NOSTEREO")?a|=32:0<=b.indexOf("INVERTSTEREO")&&(a=0!=(a&64)?a&-65:a|64);0<=b.indexOf("ATOMCOMMENT")&&(a|=131072);0<=b.indexOf("GROUPBYMODEL")&&(a|=67108864);1048576==(a&1048576)&&(0<=b.indexOf("NOCOMMENT")&&(a|=34603008),0<=b.indexOf("UNMATCHED")&&(a|=3145728),0<=b.indexOf("COVALENT")&&(a|=5242880),0<=b.indexOf("HBOND")&&(a|=9437184));return a},"~N,~S");g(c$,"setFlags",
function(a){this.flags=a;this.exitFirstMatch=(new Boolean(this.exitFirstMatch|8==(a&8))).valueOf();this.aromaticOpen=5==(a&5);this.aromaticStrict=256==(a&256);this.aromaticPlanar=1024==(a&1024);this.aromaticMMFF94=768==(a&768);this.aromaticDouble=512==(a&512);this.aromaticDefined=128==(a&128);this.noAromatic=(new Boolean(this.noAromatic|16==(a&16))).valueOf();this.aromaticUnknown=!this.noAromatic&&!this.aromaticOpen&&!this.aromaticDouble&&!this.aromaticStrict&&!this.aromaticPlanar&&!this.aromaticMMFF94&&
!this.aromaticDefined;this.groupByModel=67108864==(a&67108864);this.ignoreAtomClass=2048==(a&2048);this.ignoreStereochemistry=32==(a&32);this.invertStereochemistry=!this.ignoreStereochemistry&&64==(a&64);this.ignoreElement=16384==(a&16384)},"~N");g(c$,"set",function(){this.patternAtoms.length>this.ac&&(this.patternAtoms=JU.AU.arrayCopyObject(this.patternAtoms,this.ac));this.nodes=this.patternAtoms;this.isTopology=!0;this.patternAromatic=!1;this.patternBioSequence=!0;for(var a=this.ac;0<=--a;){var b=
this.patternAtoms[a];this.isTopology&&b.isDefined()&&(this.isTopology=!1);b.isBioResidue||(this.patternBioSequence=!1);b.isAromatic&&(this.patternAromatic=!0);b.setBondArray();if(this.autoAddImplicitH&&!this.isSmarts&&"\x00"==b.bioType&&!b.setHydrogenCount())throw new JS.InvalidSmilesException("unbracketed atoms must be one of: B, C, N, O, P, S, F, Cl, Br, I, *,");}if(this.haveComponents)for(a=this.ac;0<=--a;)for(var b=this.patternAtoms[a],c=b.bonds,d=b.component,e=b.bondCount;0<=--e;){var f=c[e],
h;if(f.isConnection&&f.atom2===b&&(h=f.atom1.component)!=d)for(f=this.ac;0<=--f;)this.patternAtoms[f].component==d&&(this.patternAtoms[f].component=h)}});g(c$,"addAtom",function(){return this.appendAtom(new JS.SmilesAtom)});g(c$,"appendAtom",function(a){this.ac>=this.patternAtoms.length&&(this.patternAtoms=JU.AU.doubleLength(this.patternAtoms));return this.patternAtoms[this.ac]=a.setIndex(this.ac++)},"JS.SmilesAtom");g(c$,"addNested",function(a){null==this.htNested&&(this.htNested=new java.util.Hashtable);
this.setNested(++this.nNested,a);return this.nNested},"~S");g(c$,"clear",function(){this.bsReturn.clearAll();this.nNested=0;this.nestedBond=this.htNested=null;this.clearBsFound(-1)});g(c$,"clearBsFound",function(a){0>a?null==this.bsCheck&&this.bsFound.clearAll():this.bsFound.clear(a)},"~N");g(c$,"setNested",function(a,b){this.top.htNested.put("_"+a,b)},"~N,~O");g(c$,"getNested",function(a){return this.top.htNested.get("_"+a)},"~N");g(c$,"getMissingHydrogenCount",function(){for(var a=0,b,c=0;c<this.ac;c++)if(0<=
(b=this.patternAtoms[c].explicitHydrogenCount))a+=b;return a});g(c$,"setRingData",function(a,b,c){if(this.isTopology||this.patternBioSequence)this.needAromatic=!1;if(this.needAromatic=(new Boolean(this.needAromatic&(new Boolean(null==a&!this.noAromatic)).valueOf())).valueOf())this.needRingData=!0;if(!this.needAromatic&&(this.target.bsAromatic.clearAll(),null!=a&&this.target.bsAromatic.or(a),!this.needRingMemberships&&!this.needRingData))return;this.getRingData(b,this.needRingData,c)},"JU.BS,~A,~B");
g(c$,"getRingData",function(a,b,c){var d=this.needAromatic&&(this.aromaticStrict||!this.aromaticOpen&&!this.aromaticPlanar);d&&this.aromaticUnknown&&0<this.target.ac&&this.target.nodes[this.target.bsSelected.nextSetBit(0)].modelIsRawPDB()&&(d=!1);var e=this.needAromatic&&this.aromaticOpen&&!this.aromaticStrict,f=this.needAromatic&&!d,h=this.needAromatic&&c&&(d||e),j=this.needAromatic&&!this.aromaticDefined,k=null==a?new JU.Lst:a[3]=new JU.Lst,s=h?new JU.Lst:null,g=!d?0:this.aromaticMMFF94?2:1;this.needAromatic&&
this.aromaticDefined&&(this.target.checkAromaticDefined(),g=0);this.ringDataMax=this.target.setRingData(g,b,this.ringDataMax);if(!(3>this.target.selectedAtomCount)){for(var l="****",r=this.ringDataMax;l.length<r;)l+=l;for(var p=h&&j?x(this.target.ac,0):null,t=j&&K(this.target.nodes[0],JS.SmilesAtom),q=3;q<=r&&!(q>this.target.ac);q++){var m="*1"+l.substring(0,q-2)+"*1",m=JS.SmilesParser.newSearch(m,!0,!0),m=this.subsearch(m,2);if(null!=a&&5>=q){for(var w=new JU.Lst,u=m.size();0<=--u;)w.addLast(m.get(u));
a[q-3]=w}if(0!=m.size()&&(j&&(4<=q&&7>=q)&&JS.SmilesAromatic.setAromatic(q,this.target.nodes,this.target.bsSelected,m,this.target.bsAromatic,g,e,t,f,this.v,k,s,p,c),b)){this.target.ringData[q]=new JU.BS;for(w=m.size();0<=--w;){var E=m.get(w);this.target.ringData[q].or(E);for(u=E.nextSetBit(0);0<=u;u=E.nextSetBit(u+1))this.target.ringCounts[u]++}}}this.needAromatic&&(h&&JS.SmilesAromatic.finalizeAromatic(this.target.nodes,this.target.bsAromatic,k,s,p,e,d),this.target.finalizeAromatic(k));b&&this.target.finalizeRingData()}},
"~A,~B,~B");g(c$,"subsearch",function(a,b){a.mapUnique=this.mapUnique;a.target=this.target;a.htNested=this.htNested;a.haveSmilesTarget=this.haveSmilesTarget;a.bsCheck=this.bsCheck;a.isSmarts=!0;switch(b){case 1:a.exitFirstMatch=!1;break;case 2:a.isRingCheck=!0;a.isSilent=!0;a.asVector=!0;break;case 3:a.ignoreAtomClass=this.ignoreAtomClass,a.aromaticDouble=this.aromaticDouble,a.haveSelected=this.haveSelected,a.exitFirstMatch=this.exitFirstMatch,a.getMaps=this.getMaps,a.retBoolean=this.retBoolean,a.asVector=
this.asVector,a.vReturn=this.vReturn,a.bsReturn=this.bsReturn,a.haveBondStereochemistry=this.haveBondStereochemistry}return a.search2(1==b)},"JS.SmilesSearch,~N");g(c$,"search",function(){this.bsReturn.clearAll();return this.search2(!1)});g(c$,"search2",function(a){this.setFlags(this.flags);!this.isRingCheck&&(JU.Logger.debuggingHigh&&!this.isSilent)&&JU.Logger.debug("SmilesSearch processing "+this.pattern);if(null==this.vReturn&&(this.asVector||this.getMaps))this.vReturn=new JU.Lst;if(null!=this.subSearches)for(a=
0;a<this.subSearches.length&&!(null!=this.subSearches[a]&&(this.subsearch(this.subSearches[a],3),this.exitFirstMatch&&(null==this.vReturn?0<=this.bsReturn.nextSetBit(0):0<this.vReturn.size())));a++);else 0<this.ac&&this.ac<=this.target.selectedAtomCount&&(null==this.nestedBond?this.clearBsFound(-1):this.bsReturn.clearAll(),this.nextPatternAtom(-1,-1,a,-1));return this.asVector||this.getMaps?this.vReturn:!this.retBoolean?this.bsReturn:Boolean.$valueOf(!this.bsReturn.isEmpty())},"~B");g(c$,"nextPatternAtom",
function(a,b,c,d){var e,f;if(++a<this.ac){var h=this.patternAtoms[a],j=0<=b?h.getBondTo(null):0==a?this.nestedBond:null;if(null==j){b=JU.BSUtil.copy(this.bsFound);var k=JU.BSUtil.copy(this.bsFound);if(0<=h.notBondedIndex)if(e=this.patternAtoms[h.notBondedIndex],j=e.getMatchingAtom(),e.isBioAtom)e=j.getOffsetResidueAtom("\x00",1),0<=e&&b.set(e),e=j.getOffsetResidueAtom("\x00",-1),0<=e&&b.set(e);else if(e===this.polyAtom)b.set(e.getMatchingAtomIndex());else{f=j.getEdges();for(e=0;e<f.length;e++)b.set(f[e].getOtherNode(j).getIndex())}f=
h.isBioAtomWild;e=this.target.bsSelected.nextSetBit(0);e=f&&0<=e?this.target.nodes[e].getOffsetResidueAtom("\x00",e):e;for(var s,g=(0<a?this.patternAtoms[a-1]:h).component,l=h.component,r=this.haveComponents&&-2147483648!=l,j=e;0<=j;j=this.target.bsSelected.nextSetBit(j+1)){if(!b.get(j)&&!this.bsFound.get(j)){e=this.target.nodes[j];if(r&&!this.isRingCheck&&(d=this.groupByModel?e.getModelIndex():e.getMoleculeNumber(!1),s=0<a?this.patternAtoms[a-1].matchingComponent:d,g==l!=(s==d)))continue;if(!this.nextTargetAtom(h,
e,a,j,c,d))return!1}f&&(e=this.target.nodes[j].getOffsetResidueAtom(h.bioAtomName,1),0<=e&&(j=e-1))}this.bsFound=k;return!0}e=j.atom1.getMatchingAtom();switch(j.order){case 96:j=e.getOffsetResidueAtom(h.bioAtomName,1);if(0<=j){b=JU.BSUtil.copy(this.bsFound);e.getGroupBits(this.bsFound);if(this.doCheckAtom(j)&&!this.nextTargetAtom(h,this.target.nodes[j],a,j,c,d))return!1;this.bsFound=b}return!0;case 112:f=new JU.Lst;e.getCrossLinkVector(f,!0,!0);b=JU.BSUtil.copy(this.bsFound);e.getGroupBits(this.bsFound);
for(j=2;j<f.size();j+=3)if(k=f.get(j).intValue(),this.doCheckAtom(k)&&!this.nextTargetAtom(h,this.target.nodes[k],a,k,c,d))return!1;this.bsFound=b;return!0}f=e.getEdges();if(null!=f)for(j=0;j<f.length;j++)if(k=e.getBondedAtomIndex(j),this.doCheckAtom(k)&&!this.nextTargetAtom(h,this.target.nodes[k],a,k,c,d))return!1;this.clearBsFound(b);return!0}if(!this.ignoreStereochemistry&&!this.isRingCheck){if(JU.Logger.debuggingHigh){for(h=0;h<a;h++)JU.Logger.debug("pattern atoms "+this.patternAtoms[h]+" "+this.patternAtoms[h].matchingComponent);
JU.Logger.debug("--ss-- "+this.bsFound.cardinality())}if(!this.checkStereochemistry())return!0}b=new JU.BS;for(j=d=0;j<this.ac;j++)if(h=this.patternAtoms[j].getMatchingAtomIndex(),c||!this.top.haveSelected||this.patternAtoms[j].selected){d++;b.set(h);this.patternAtoms[j].isBioAtomWild&&this.target.nodes[h].getGroupBits(b);if(c)break;if(!this.isSmarts&&!this.setAtropicity&&0<this.patternAtoms[j].explicitHydrogenCount){h=this.target.nodes[h];e=0;for(f=h.getEdges().length;e<f;e++)k=h.getBondedAtomIndex(e),
1==this.target.nodes[k].getElementNumber()&&b.set(k)}}if(!this.isSmarts&&b.cardinality()!=this.target.selectedAtomCount)return!0;if(null!=this.bsCheck)if(c){this.bsCheck.clearAll();for(j=0;j<this.ac;j++)this.bsCheck.set(this.patternAtoms[j].getMatchingAtomIndex());if(this.bsCheck.cardinality()!=this.ac)return!0}else if(b.cardinality()!=this.ac)return!0;this.bsReturn.or(b);if(this.getMaps){if(this.mapUnique){null==this.uniqueList&&(this.uniqueList=new JU.Lst);for(j=this.uniqueList.size();0<=--j;)if(this.uniqueList.get(j).equals(b))return!0;
this.uniqueList.addLast(b)}a=x(d,0);for(b=j=0;j<this.ac;j++)if(c||!this.top.haveSelected||this.patternAtoms[j].selected)a[b++]=this.patternAtoms[j].getMatchingAtomIndex();this.vReturn.addLast(a);return!this.exitFirstMatch}if(this.asVector){c=!0;for(j=this.vReturn.size();0<=--j&&c;)c=!this.vReturn.get(j).equals(b);if(!c)return!0;this.vReturn.addLast(b)}if(this.isRingCheck){c=new JU.BS;for(e=3*a+2;--e>a;)c.set(this.patternAtoms[(e<=2*a?2*a-e+1:e-1)%a].getMatchingAtomIndex());this.target.ringSets.addLast(c);
return!0}return this.exitFirstMatch?!1:b.cardinality()!=this.target.selectedAtomCount},"~N,~N,~B,~N");g(c$,"doCheckAtom",function(a){return this.target.bsSelected.get(a)&&!this.bsFound.get(a)},"~N");g(c$,"nextTargetAtom",function(a,b,c,d,e,f){if(!this.isRingCheck&&!this.isTopology)if(null==a.subAtoms){if(!this.checkPrimitiveAtom(a,d))return!0}else if(a.isAND)for(var h=0;h<a.nSubAtoms;h++){if(!this.checkPrimitiveAtom(a.subAtoms[h],d))return!0}else{for(h=0;h<a.nSubAtoms;h++)if(!this.nextTargetAtom(a.subAtoms[h],
b,c,d,e,f))return!1;return!0}b=b.getEdges();for(h=a.getBondCount();0<=--h;){var j=a.getBond(h);if(j.getAtomIndex2()==a.index){var k=j.atom1,s=k.getMatchingAtomIndex();switch(j.order){case 96:case 112:if(!this.checkMatchBond(a,k,j,d,s,null))return!0;break;default:for(var g=0,l=null;g<b.length&&(!(l=b[g]).isCovalent()||!(l.getAtomIndex1()==s||l.getAtomIndex2()==s));g++);if(g==b.length||!this.checkMatchBond(a,k,j,d,s,l))return!0}}}a=this.patternAtoms[a.index];a.setMatchingAtom(this.target.nodes[d],d);
a.matchingComponent=f;this.bsFound.set(d);if(!this.nextPatternAtom(c,d,e,f))return!1;0<=d&&this.clearBsFound(d);return!0},"JS.SmilesAtom,JU.Node,~N,~N,~B,~N");g(c$,"checkPrimitiveAtom",function(a,b){if(0<a.nSubAtoms){for(var c=0;c<a.nSubAtoms;c++)if(this.checkPrimitiveAtom(a.subAtoms[c],b))return!0;return!1}for(var d=this.target.nodes[b],c=a.not;;){if(0<a.iNested){c=this.getNested(a.iNested);K(c,JS.SmilesSearch)&&(a.isBioAtom&&(c.nestedBond=a.getBondTo(null)),c=this.subsearch(c,1),null==c&&(c=new JU.BS),
a.isBioAtom||this.setNested(a.iNested,c));c=a.not!=c.get(b);break}var e=d.getElementNumber(),f=a.elementNumber;if(0<=e&&0<=f&&f!=e&&!this.ignoreElement)break;if(a.isBioResidue){if(null!=a.bioAtomName&&(a.isLeadAtom()?!d.isLeadAtom():!a.bioAtomName.equals(d.getAtomName().toUpperCase())))break;if(null!=a.residueName&&!a.residueName.equals(d.getGroup3(!1).toUpperCase()))break;if(-2147483648!=a.residueNumber&&a.residueNumber!=d.getResno())break;if("\x00"!=a.insCode&&a.insCode!=d.getInsertionCode())break;
if(null!=a.residueChar||-2==a.elementNumber){var e=d.getBioSmilesType(),h=a.getBioSmilesType(),j=!0,f=!1;switch(h){case "\x00":case "*":j=!0;break;case "n":j="r"==e||"c"==e;f=!0;break;case "r":case "c":f=!0;default:j=e==h}if(!j)break;j=d.getGroup1("\x00").toUpperCase();h=null==a.residueChar?"*":a.residueChar.charAt(0);j=h==j.charAt(0);switch(h){case "*":j=!0;break;case "N":j=f?"r"==e||"c"==e:j;break;case "R":j=f?d.isPurine():j;break;case "Y":j=f?d.isPyrimidine():j}if(!j)break}if(a.isBioAtom&&a.notCrossLinked&&
d.getCrossLinkVector(null,!0,!0))break}else{if(-2147483648!=a.atomNumber&&a.atomNumber!=d.getAtomNumber())break;if(0<=a.jmolIndex&&d.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(d.getAtomType()))break;if(-2147483648!=(f=a.getAtomicMass())&&(0<=f&&f!=(e=d.getIsotopeNumber())||0>f&&0!=e&&-f!=e))break;if(!this.noAromatic&&!a.aromaticAmbiguous&&a.isAromatic!=this.target.bsAromatic.get(b))break;if(-2147483648!=(f=a.getCharge())&&f!=d.getFormalCharge())break;f=a.getCovalentHydrogenCount()+
a.explicitHydrogenCount;if(0<=f&&f!=d.getTotalHydrogenCount())break;if(-2147483648!=(f=a.implicitHydrogenCount))if(e=d.getImplicitHydrogenCount(),-1==f?0==e:f!=e)break;if(0<a.degree&&a.degree!=d.getCovalentBondCount())break;if(0<a.nonhydrogenDegree&&a.nonhydrogenDegree!=d.getCovalentBondCount()-d.getCovalentHydrogenCount())break;if(this.isSmarts&&0<a.valence&&a.valence!=d.getTotalValence())break;if(0<a.connectivity&&a.connectivity!=d.getCovalentBondCountPlusMissingH())break;if(-2147483648!=a.atomNumber&&
a.atomNumber!=d.getAtomNumber())break;if(0<=a.jmolIndex&&d.getIndex()!=a.jmolIndex)break;if(null!=a.atomType&&!a.atomType.equals(d.getAtomType()))break;if((!this.ignoreAtomClass||this.isSmarts)&&!Float.isNaN(a.atomClass)&&a.atomClass!=d.getFloatProperty("property_atomclass"))break;if(null!=this.target.ringData){if(-1<=a.ringSize)if(0>=a.ringSize){if(0==this.target.ringCounts[b]!=(0==a.ringSize))break}else{d=this.target.ringData[500==a.ringSize?5:600==a.ringSize?6:a.ringSize];if(null==d||!d.get(b))break;
if(!this.noAromatic)if(500==a.ringSize){if(!this.target.bsAromatic5.get(b))break}else if(600==a.ringSize&&!this.target.bsAromatic6.get(b))break}if(-1<=a.ringMembership&&(-1==a.ringMembership?0==this.target.ringCounts[b]:this.target.ringCounts[b]!=a.ringMembership))break;if(0<=a.ringConnectivity&&(f=this.target.ringConnections[b],-1==a.ringConnectivity&&0==f||-1!=a.ringConnectivity&&f!=a.ringConnectivity))break}}c=!c;break}return c},"JS.SmilesAtom,~N");g(c$,"checkMatchBond",function(a,b,c,d,e,f){if(null!=
c.bondsOr){for(var h=0;h<c.nBondsOr;h++)if(this.checkMatchBond(a,b,c.bondsOr[h],d,e,f))return!0;return!1}if(!this.isRingCheck&&!this.isTopology)if(0==c.nPrimitives){if(!this.checkPrimitiveBond(c,d,e,f))return!1}else for(a=0;a<c.nPrimitives;a++)if(b=c.setPrimitive(a),!this.checkPrimitiveBond(b,d,e,f))return!1;c.matchingBond=f;return!0},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesBond,~N,~N,JU.Edge");g(c$,"checkPrimitiveBond",function(a,b,c,d){var e=!1;switch(a.order){case 96:return a.isNot!=(this.target.nodes[c].getOffsetResidueAtom("\x00",
1)==this.target.nodes[b].getOffsetResidueAtom("\x00",0));case 112:return a.isNot!=this.target.nodes[b].isCrossLinked(this.target.nodes[c])}var f=!this.noAromatic&&this.target.bsAromatic.get(b),h=!this.noAromatic&&this.target.bsAromatic.get(c);d=d.getCovalentOrder();var j=a.order;if(f&&h)switch(j){case 17:case 65:e=JS.SmilesSearch.isRingBond(this.target.ringSets,null,b,c);break;case 1:e=!this.isSmarts||!JS.SmilesSearch.isRingBond(this.target.ringSets,this.target.getBSAromaticRings(),b,c);break;case 2:e=
this.isNormalized||81==d||this.aromaticDouble&&(2==d||514==d);break;case 65537:case 65538:e=!a.isNot;break;case 81:case -1:e=!0}else switch(j){case 17:if(!this.noAromatic)break;case 81:case -1:e=!0;break;case 1:case 1025:case 1041:switch(d){case 1:case 1025:case 1041:e=!0}break;case 65537:case 65538:switch(d){case 1:case 65537:case 65538:e=!a.isNot}break;case 2:case 3:case 4:e=d==j;break;case 65:e=JS.SmilesSearch.isRingBond(this.target.ringSets,null,b,c)}return e!=a.isNot},"JS.SmilesBond,~N,~N,JU.Edge");
g(c$,"checkStereochemistry",function(){for(var a=0;a<this.measures.size();a++)if(!this.measures.get(a).check())return!1;if(null!=this.stereo&&!this.stereo.checkStereoChemistry(this,this.v))return!1;if(!this.haveBondStereochemistry)return!0;for(var b=null,a=null,c=0;c<this.ac;c++){for(var d=this.patternAtoms[c],e=null,f=null,h=null,j=0,k=0,s=0,g=d.getBondCount(),l=!1,r=!0,p=0;p<g;p++){var a=d.getBond(p),t=a.atom2===d,r=a.atom1.index<a.atom2.index,q=a.getBondType();switch(q){case 65537:case 65538:if(!r)continue;
case 2:if(t)continue;e=a.atom2;s=q;(l=2!=q)&&(j=a.isNot?-1:1);break;case 1025:case 1041:f=t?a.atom1:a.atom2,j=t!=(1025==q)?1:-1}}if(l){if(this.setAtropicity){null==b&&(b=new JU.Lst);b.addLast(a);continue}h=d.getBond(a.atropType[0]);if(null==h)return!1;f=h.getOtherAtom(d);h=e.getBond(a.atropType[1]);if(null==h)return!1;h=h.getOtherAtom(e);JU.Logger.debugging&&JU.Logger.info("atropisomer check for atoms "+f+d+" "+e+h)}else{if(null==e||0==j)continue;g=d;for(p=0;2==e.getBondCount()&&4==e.getValence();)p++,
t=e.getEdges(),t=t[t[0].getOtherNode(e)===g?1:0],g=e,e=t.getOtherNode(e);if(1==p%2)continue;g=e.getBondCount();for(p=0;p<g&&0==k;p++)switch(a=e.getBond(p),q=a.getBondType(),q){case 1025:case 1041:h=(t=a.atom2===e)?a.atom1:a.atom2,k=t!=(1025==q)?1:-1}if(0==k)continue}g=d.getMatchingAtom();p=e.getMatchingAtom();f=f.getMatchingAtom();h=h.getMatchingAtom();if(null==f||null==h)return!1;this.haveSmilesTarget&&JS.SmilesSearch.setTopoCoordinates(g,p,f,h,s);f=JS.SmilesMeasure.setTorsionData(f,g,p,h,this.v,
l);if(l){if(f*=-1*j*(65537==s?1:-1)*(r?1:-1),JU.Logger.debugging&&JU.Logger.info("atrop dihedral "+f+" "+d+" "+e+" "+a),1>f)return!1}else if(0>this.v.vTemp1.dot(this.v.vTemp2)*j*k)return!1}if(this.setAtropicity){this.atropKeys="";for(a=0;a<b.size();a++)this.atropKeys+=","+this.getAtropIndex(b.get(a))}return!0});g(c$,"getAtropIndex",function(a){var b=Array(4),c="";b[1]=a.atom1.getMatchingAtom();b[2]=a.atom2.getMatchingAtom();for(var d=a.atom1.bonds,e,f=a.atom1.getBondCount();0<=--f;)if((e=d[f].getOtherNode(a.atom1))!==
a.atom2){c+=f+1;b[0]=e.getMatchingAtom();break}d=a.atom2.bonds;for(f=0;f<=a.atom2.getBondCount();f++)if((e=d[f].getOtherNode(a.atom2))!==a.atom1){c+=f+1;b[3]=e.getMatchingAtom();break}c.equals("22")&&(c="");c=(1==JS.SmilesStereo.getAtropicStereoFlag(b)?"":"^")+c;return(c+"   ").substring(0,3)},"JS.SmilesBond");c$.setTopoCoordinates=g(c$,"setTopoCoordinates",function(a,b,c,d,e){a.set(-1,0,0);b.set(1,0,0);if(2!=e)e=a.getBondTo(b),a=a.getBondedAtomIndex(e.atropType[0])==c.index,b=b.getBondedAtomIndex(e.atropType[1])==
d.index,b=(65537==e.order?1:-1)*(a==b?1:-1),c.set(-1,1,0),d.set(1,1,-1*(b/2));else{d=c=0;for(var f=a.getEdges(),h=f.length;0<=--h;)if(e=f[h],2!=e.order){var j=e.getOtherNode(a);j.set(-1,0==c++?-1:1,0);j=e.getAtomIndex2()==a.getIndex()?c:-c;switch(e.order){case 1025:d=j;break;case 1041:d=-j}}var k=0;c=0;a=Array(2);f=b.getEdges();for(h=f.length;0<=--h;)if(e=f[h],2!=e.order)switch(j=e.getOtherNode(b),a[c]=j,j.set(1,0==c++?1:-1,0),j=e.getAtomIndex2()==b.getIndex()?c:-c,e.order){case 1025:k=j;break;case 1041:k=
-j}0<d*k==(Math.abs(d)%2==Math.abs(k)%2)&&(b=a[0].y,a[0].y=a[1].y,a[1].y=b)}},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,~N");g(c$,"createTopoMap",function(a){var b=null==a,c=this.autoAddImplicitH?this.getMissingHydrogenCount():0,c=this.ac+c,d=Array(c);this.target.nodes=d;for(var e=0,f=0;e<this.ac;e++,f++){var h=this.patternAtoms[e],j=h.explicitHydrogenCount;if(0>j||!this.autoAddImplicitH)j=0;var k=d[f]=(new JS.SmilesAtom).setTopoAtom(h.component,f,h.symbol,h.getCharge(),e);k.implicitHydrogenCount=
j;if(!b){k.mapIndex=e;k.stereo=h.stereo;k.setAtomicMass(h.getAtomicMass());k.bioAtomName=h.bioAtomName;k.residueName=h.residueName;k.residueChar=h.residueChar;k.residueNumber=h.residueNumber;k.atomNumber=h.residueNumber;k.insCode=h.insCode;k.hasDoubleBond=h.hasDoubleBond;k.isAromatic=h.isAromatic;k.atomClass=h.atomClass;k.explicitHydrogenCount=0;k.isBioAtom=h.isBioAtom;k.bioType=h.bioType;k.$isLeadAtom=h.$isLeadAtom;!b&&h.isAromatic&&a.set(f);h.setMatchingAtom(null,f);h=Array(h.getBondCount()+j);
for(k.setBonds(h);0<=--j;){h=d[++f]=(new JS.SmilesAtom).setTopoAtom(k.component,f,"H",0,-1);h.mapIndex=-e-1;h.setBonds(Array(1));var s=new JS.SmilesBond(k,h,1,!1);JU.Logger.debugging&&JU.Logger.info(""+s)}}}if(!b){for(e=0;e<this.ac;e++){h=this.patternAtoms[e];j=h.getMatchingAtomIndex();a=d[j];j=h.getBondCount();for(b=0;b<j;b++)if(f=h.getBond(b),f.atom1===h){s=1;switch(f.order){case 1:case 2:case 3:case 4:case 1025:case 1041:case 65537:case 65538:case 112:case 96:s=f.order;break;case 17:s=514}k=d[f.atom2.getMatchingAtomIndex()];
s=new JS.SmilesBond(a,k,s,!1);s.isConnection=f.isConnection;s.atropType=f.atropType;s.isNot=f.isNot;k.bondCount--;JU.Logger.debugging&&JU.Logger.info(""+s)}else k=d[f.atom1.getMatchingAtomIndex()],s=k.getBondTo(a),a.addBond(s)}for(e=0;e<c;e++)if(s=d[e],h=s.bonds,!(2>h.length||h[0].isFromPreviousTo(s)))for(j=h.length;1<=--j;)if(h[j].isFromPreviousTo(s)){s=h[j];h[j]=h[0];h[0]=s;break}if(!this.ignoreStereochemistry)for(e=this.ac;0<=--e;)h=this.patternAtoms[e],null!=h.stereo&&h.stereo.fixStereo(h)}},
"JU.BS");g(c$,"normalizeAromaticity",function(a){var b=this.patternAtoms,c=new JS.SmilesSearch;c.noAromatic=this.noAromatic;c.setFlags(this.flags);c.target.nodes=b;c.target.ac=b.length;c.target.bsSelected=JU.BSUtil.newBitSet2(0,b.length);var d=JU.AU.createArrayOfArrayList(4);c.setRingData(null,d,!0);a.or(c.target.bsAromatic);if(!a.isEmpty()&&(a=d[3],null!=a))for(c=a.size();0<=--c;)for(var d=a.get(c),e=d.nextSetBit(0);0<=e;e=d.nextSetBit(e+1)){var f=b[e];!f.isAromatic&&!(-2==f.elementNumber||0==f.elementNumber)&&
f.setSymbol(f.symbol.toLowerCase())}},"JU.BS");g(c$,"getSelections",function(){var a=this.top.htNested;if(!(null==a||0==this.target.nodes.length))for(var b=new java.util.Hashtable,c,a=a.entrySet().iterator();a.hasNext()&&((c=a.next())||1);){var d=c.getValue().toString();if(d.startsWith("select")){var e=b.containsKey(d)?b.get(d):this.target.nodes[0].findAtomsLike(d.substring(6));null==e&&(e=new JU.BS);b.put(d,e);c.setValue(e)}}});g(c$,"findImplicitHydrogen",function(a){for(var b=a.getEdges().length;0<=
--b;){var c=a.getBondedAtomIndex(b);if(1==this.target.nodes[c].getElementNumber()&&!this.bsFound.get(c))return this.target.nodes[c]}return null},"JU.Node");g(c$,"toString",function(){if(null!=this.pattern0)return this.pattern0;if(this.targetSet)return"molecular formula: "+this.target.getMolecularFormula(!0,null,!1);var a=(new JU.SB).append(this.pattern);a.append("\nmolecular formula: "+this.getMolecularFormula(!0,null,!1));return a.toString()});X(self.c$);c$=I(function(){this.bsSelected=null;this.selectedAtomCount=
0;this.ringSets=null;this.ringCount=0;this.ringData=null;this.ringDataMax=0;this.bsAromaticRings=this.bsAromatic6=this.bsAromatic5=this.bsAromatic=this.ringConnections=this.ringCounts=null;this.$hasRingData=!1;this.flags=-1;H(this,arguments)},JS.SmilesSearch,"SmilesTarget",JU.JmolMolecule);N(c$,function(){this.bsAromatic=new JU.BS;this.bsAromatic5=new JU.BS;this.bsAromatic6=new JU.BS});g(c$,"hasRingData",function(a){a!=this.flags&&(this.flags=a,this.$hasRingData=!1);a=this.$hasRingData;this.$hasRingData=
!0;return a},"~N");g(c$,"setAtoms",function(a,b,c){this.nodes=a;this.ac=b;this.selectedAtomCount=null==c?b:c.cardinality();null==c&&(c=JU.BS.newN(b),c.setBits(0,b));this.bsSelected=c},"~A,~N,JU.BS");g(c$,"checkAromaticDefined",function(){JS.SmilesAromatic.checkAromaticDefined(this.nodes,this.bsSelected,this.bsAromatic)});g(c$,"getBSAromaticRings",function(){if(null==this.bsAromaticRings&&(this.bsAromaticRings=new JU.BS,null!=this.ringSets&&null!=this.bsAromatic))for(var a=this.ringSets.size();0<=
--a;){var b=this.ringSets.get(a).clone();b.andNot(this.bsAromatic);b.isEmpty()&&this.bsAromaticRings.set(a)}return this.bsAromaticRings});g(c$,"setRingData",function(a,b,c){0>c&&(c=8);0<a&&6>c&&(c=6);b&&(this.ringCounts=x(this.ac,0),this.ringConnections=x(this.ac,0),this.ringData=Array(c+1));this.ringSets=new JU.Lst;return this.ringDataMax=c},"~N,~B,~N");g(c$,"finalizeAromatic",function(a){this.bsAromatic5.clearAll();this.bsAromatic6.clearAll();for(var b=a.size();0<=--b;){var c=a.get(b);c.and(this.bsAromatic);
switch(c.cardinality()){case 5:this.bsAromatic5.or(c);break;case 6:this.bsAromatic6.or(c)}}},"JU.Lst");g(c$,"finalizeRingData",function(){for(var a=this.bsSelected.nextSetBit(0);0<=a;a=this.bsSelected.nextSetBit(a+1))for(var b=this.nodes[a],c=b.getBondCount();0<=--c;)0<this.ringCounts[b.getBondedAtomIndex(c)]&&this.ringConnections[a]++});g(c$,"hasDoubleBonds",function(){for(var a=0;a<this.nodes.length;a++)if(null==this.bsSelected||this.bsSelected.get(a)){var b=this.nodes[a];if(1!=b.getElementNumber())for(var c=
b.getBondCount(),b=b.getEdges(),d=0;d<c;d++)if(b[d].isCovalent()&&1!=b[d].getBondType())return!0}return!1});c$=W();P(c$,"SUBMODE_NESTED",1,"SUBMODE_RINGCHECK",2,"SUBMODE_OR",3,"ATROPIC_SWITCH",1)});F("JS");z(["java.util.Hashtable","JU.BS","JS.VTemp"],"JS.SmilesGenerator","JU.AU $.Lst $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesParser $.SmilesSearch $.SmilesStereo JU.BSUtil $.Elements $.JmolMolecule $.Logger".split(" "),function(){c$=I(function(){this.atoms=null;this.ac=0;this.bsAromatic=
this.bsSelected=null;this.explicitHydrogen=this.flags=0;this.vTemp=this.ringSets=null;this.nPairsMax=this.nPairs=0;this.bsToDo=this.bsBondsDn=this.bsBondsUp=null;this.bsIgnoreHydrogen=new JU.BS;this.bsIncludingH=this.bsRingKeys=this.htRings=this.htRingsSequence=this.alleneStereo=this.prevSp2Atoms=this.prevAtom=null;this.topologyOnly=!1;this.getAromatic=!0;this.openSMILES=this.noStereo=this.aromaticDouble=this.noBioComment=this.addAtomComment=!1;this.smilesStereo=this.polySmilesCenter=null;this.isPolyhedral=
!1;this.sm=this.aromaticRings=null;this.iHypervalent=0;this.noBranches=this.haveSmilesAtoms=this.is2D=!1;this.ptSp2Atom0=this.ptAtom=0;this.atemp=null;this.chainCheck=0;H(this,arguments)},JS,"SmilesGenerator");N(c$,function(){this.vTemp=new JS.VTemp;this.bsBondsUp=new JU.BS;this.bsBondsDn=new JU.BS;this.htRingsSequence=new java.util.Hashtable;this.htRings=new java.util.Hashtable;this.bsRingKeys=new JU.BS});g(c$,"getSmiles",function(a,b,c,d,e,f){var h=d.nextSetBit(0);if(0>h)return"";this.haveSmilesAtoms=
K(b[h],JS.SmilesAtom)&&b[h].definesStereo();this.sm=a;this.flags=f;this.atoms=b;this.ac=c;d=JU.BSUtil.copy(d);this.bsSelected=JU.BS.copy(d);this.flags=f=JS.SmilesSearch.addFlags(f,null==e?"":e.toUpperCase());if(1048576==(f&1048576))return this.getBioSmiles(d,e,f);this.openSMILES=5==(f&5);this.addAtomComment=131072==(f&131072);this.aromaticDouble=512==(f&512);this.explicitHydrogen=8192==(f&8192)?8192:4096==(f&4096)?4096:0;if(8192==this.explicitHydrogen){a=new JU.BS;for(c=d.nextSetBit(0);0<=c;c=d.nextSetBit(c+
1))if(e=b[c],3==e.getCovalentHydrogenCount()&&4==e.getCovalentBondCount()){var j=!0;a.clearAll();for(var k=e.getBondCount();0<=--k;){var s=e.getBondedAtomIndex(k);if(1==b[s].getElementNumber())if(j=1==b[s].getElementNumber())a.set(s);else break;j&&(this.bsIgnoreHydrogen.set(c),d.andNot(a))}}}this.topologyOnly=16384==(f&16384);this.getAromatic=16!=(f&16);this.noStereo=32==(f&32);this.isPolyhedral=65536==(f&65536);this.is2D=134217728==(f&134217728);this.noBranches=!1;return this.getSmilesComponent(b[h],
d,!0,!1,!1)},"JS.SmilesMatcher,~A,~N,JU.BS,~S,~N");g(c$,"getBioSmiles",function(a,b,c){this.addAtomComment=131072==(c&131072);var d=3145728==(c&3145728),e=34603008==(c&34603008),f=5242880==(c&5242880);c=9437184==(c&9437184);var h=f||c,j=new JU.SB;null!=b&&!this.noBioComment&&j.append("//* Jmol bioSMILES ").append(b.$replace("*","_")).append(" *//");b=this.noBioComment?"":"\n";var k=new JU.BS,s=null,g="",l,r=new JU.Lst;try{for(var p=0,t=a.nextSetBit(0);0<=t;t=a.nextSetBit(t+1)){var q=this.atoms[t],
m=q.getGroup1("?"),w=q.getBioStructureTypeName(),u=m===m.toLowerCase();if(null!=b)if(0<j.length()&&j.append(b),b=null,p=0,0<w.length)0!=q.getChainID()&&!e&&(l="//* chain "+q.getChainIDStr()+" "+w+" "+q.getResno()+" *// ",p=l.length,j.append(l)),p++,j.append("~").appendC(w.toLowerCase().charAt(0)).append("~");else{l=this.getSmilesComponent(q,a,!1,!0,!0);if(l.equals(s)){b="";continue}var s=l,E=q.getGroup3(!0),v;e?v="/"+l+"/":(null!=E&&(l="//* "+E+" *//"+l),v=l+"//");if(0<=g.indexOf(v)){b="";continue}g+=
v;j.append(l);b=e?".":".\n";continue}75<=p&&!e&&(j.append("\n  "),p=2);this.addAtomComment&&j.append("\n//* ["+q.getGroup3(!1)+"#"+q.getResno()+"] *//\t");u?this.addBracketedBioName(j,q,0<w.length?".0":null,!1):j.append(m);p++;if(h){q.getCrossLinkVector(r,f,c);for(var A=0;A<r.size();A+=3)j.append(":"),l=this.getRingCache(r.get(A).intValue(),r.get(A+1).intValue(),this.htRingsSequence),j.append(l),p+=1+l.length;r.clear()}q.getGroupBits(k);a.andNot(k);var y=q.getOffsetResidueAtom("\x00",1);if(0>y||!a.get(y)){e||
j.append(" //* ").appendI(q.getResno()).append(" *//");if(0>y&&0>(y=a.nextSetBit(t+1)))break;0<p&&(b=e?".":".\n")}t=y-1}}catch(C){if(G(C,Exception))throw new JS.InvalidSmilesException("//* error: "+C.getMessage()+" *//");throw C;}if(!d&&!this.htRingsSequence.isEmpty())throw this.dumpRingKeys(j,this.htRingsSequence),new JS.InvalidSmilesException("//* ?ring error? *//");l=j.toString();l.endsWith(".\n")?l=l.substring(0,l.length-2):e&&l.endsWith(".")&&(l=l.substring(0,l.length-1));return l},"JU.BS,~S,~N");
g(c$,"addBracketedBioName",function(a,b,c,d){a.append("[");if(null!=c){var e=b.getChainIDStr();a.append(b.getGroup3(!1));c.equals(".0")||a.append(c).append("#").appendI(b.getElementNumber());d&&(a.append("//* ").appendI(b.getResno()),0<e.length&&a.append(":").append(e),a.append(" *//"))}else a.append(JU.Elements.elementNameFromNumber(b.getElementNumber()));a.append("]")},"JU.SB,JU.Node,~S,~B");g(c$,"getSmilesComponent",function(a,b,c,d,e){a=this.checkFirstAtom(a);this.bsSelected=JU.JmolMolecule.getBranchBitSet(this.atoms,
a.getIndex(),JU.BSUtil.copy(b),null,-1,!0,c);b.andNot(this.bsSelected);this.iHypervalent=-1;for(b=this.bsSelected.nextSetBit(0);0<=b&&0>this.iHypervalent;b=this.bsSelected.nextSetBit(b+1))if(4<this.atoms[b].getCovalentBondCount()||this.isPolyhedral)this.iHypervalent=b;this.bsIncludingH=JU.BSUtil.copy(this.bsSelected);if(0==this.explicitHydrogen)for(b=this.bsSelected.nextSetBit(0);0<=b;b=this.bsSelected.nextSetBit(b+1))c=this.atoms[b],1==c.getAtomicAndIsotopeNumber()&&(0<c.getBondCount()&&c.getBondedAtomIndex(0)!=
this.iHypervalent&&!this.isExplicitOnly(this.atoms[c.getBondedAtomIndex(0)]))&&this.bsSelected.clear(b);this.bsAromatic=new JU.BS;!this.topologyOnly&&2<this.bsSelected.cardinality()&&(this.generateRingData(),this.setBondDirections());this.bsToDo=JU.BSUtil.copy(this.bsSelected);c=new JU.SB;for(b=this.bsToDo.nextSetBit(0);0<=b;b=this.bsToDo.nextSetBit(b+1))if(4<this.atoms[b].getCovalentBondCount()||this.isPolyhedral||this.noBranches)null==a&&c.append("."),this.getSmilesAt(c,this.atoms[b],d,!1,e,!1),
a=null;if(null!=a)for(;null!=(a=this.getSmilesAt(c,a,d,!0,e,!1)););for(;!this.bsToDo.isEmpty()||!this.htRings.isEmpty();){a=this.htRings.values().iterator();if(a.hasNext()){if(a=this.atoms[a.next()[1].intValue()],!this.bsToDo.get(a.getIndex()))break}else a=this.atoms[this.bsToDo.nextSetBit(0)];c.append(".");for(this.prevAtom=this.prevSp2Atoms=this.alleneStereo=null;null!=(a=this.getSmilesAt(c,a,d,!0,e,!1)););}if(!this.htRings.isEmpty())throw this.dumpRingKeys(c,this.htRings),new JS.InvalidSmilesException("//* ?ring error? *//\n"+
c);d=c.toString();if(0<=d.indexOf("^-")){e=d;try{var f=this.sm.getAtropisomerKeys(d,this.atoms,this.ac,this.bsSelected,this.bsAromatic,this.flags);for(b=1;b<f.length;){var h=d.indexOf("^-");if(0>h)break;d=d.substring(0,h+1)+f.substring(b,b+3).trim()+d.substring(h+1);b+=3}}catch(j){if(G(j,Exception))j.printStackTrace(),d=e;else throw j;}}return d},"JU.Node,JU.BS,~B,~B,~B");g(c$,"checkFirstAtom",function(a){0==this.explicitHydrogen&&(1==a.getAtomicAndIsotopeNumber()&&0<a.getEdges().length)&&(a=this.atoms[a.getBondedAtomIndex(0)]);
for(var b=a,c=null;2==b.getCovalentBondCount();){var d=b.getEdges();if(2!=d[0].getBondType()||2!=d[1].getBondType())break;var e=d[0].getOtherNode(b);e===c&&(e=d[1].getOtherNode(b));c=b;b=e}return null==b?a:b},"JU.Node");g(c$,"generateRingData",function(){var a=JS.SmilesParser.newSearch("[r500]",!0,!0);a.target.setAtoms(this.atoms,this.ac,this.bsSelected);a.setFlags(this.flags);!a.needRingData&&a.target.hasDoubleBonds()&&(a.needRingData=!0);a.ringDataMax=7;a.flags=this.flags;var b=JU.AU.createArrayOfArrayList(4);
a.setRingData(null,b,!0);this.bsAromatic=a.target.bsAromatic;this.ringSets=a.target.ringSets;this.aromaticRings=b[3]});g(c$,"getBondStereochemistry",function(a,b){if(null==a)return"\x00";var c=a.index,d=null==b||a.getAtomIndex1()==b.getIndex();return this.bsBondsUp.get(c)?d?"/":"\\":this.bsBondsDn.get(c)?d?"\\":"/":"\x00"},"JU.Edge,JU.SimpleNode");g(c$,"setBondDirections",function(){for(var a=new JU.BS,b=O(2,3,null),c=this.bsSelected.nextSetBit(0);0<=c;c=this.bsSelected.nextSetBit(c+1))for(var d=
this.atoms[c],e=d.getEdges(),f=0;f<e.length;f++){var h=e[f],j=h.index,k;if(!a.get(j)&&!(2!=h.getCovalentOrder()||JS.SmilesSearch.isRingBond(this.ringSets,null,c,(k=h.getOtherNode(d)).getIndex()))){a.set(j);h=0;for(j=d;2==k.getCovalentBondCount()&&4==k.getValence();){var s=k.getEdges(),s=s[s[0].getOtherNode(k)===j?1:0];a.set(s.index);j=k;k=s.getOtherNode(k);h++}if(1!=h%2){for(var g=h=null,g=0,j=O(-1,[d,k]),l=1,s=0;2>s&&0<l&&3>l;s++)for(var l=0,r=j[s],p=r.getEdges(),t=0<this.explicitHydrogen||this.isExplicitOnly(r),
q=0;q<p.length;q++){var m;if(!(1!=p[q].getCovalentOrder()||!t&&1==(m=p[q].getOtherNode(r)).getElementNumber()&&0==m.getIsotopeNumber()))b[s][l++]=p[q],"\x00"!=this.getBondStereochemistry(p[q],r)&&(h=p[q],g=s)}if(!(3==l||0==l))if(null==h&&(g=0,h=b[g][0],this.bsBondsUp.set(h.index)),l=j[g],r=this.getBondStereochemistry(h,l),g=h.getOtherNode(l),null!=g)for(s=0;2>s;s++){p=j[s];for(t=0;2>t;t++)if(q=b[s][t],!(null==q||q===h)){var w=q.index,u=q.getOtherNode(p);if(null!=u){var E=this.getBondStereochemistry(q,
p),v;if(this.haveSmilesAtoms){v=g.isStereoOpposite(u.getIndex(),l.getIndex(),p.getIndex());if(null==v){JU.Logger.debugging&&JU.Logger.debug("SmilesGenerator could not find stereo for "+g+"/"+u);continue}v=v.booleanValue()}else v=JS.SmilesStereo.isDiaxial(l,p,g,u,this.vTemp,0);"\x00"==E||E!=r==v?("\\"==r&&v||"/"==r&&!v)==(q.getAtomIndex1()!=u.getIndex())?this.bsBondsUp.set(w):this.bsBondsDn.set(w):(this.bsBondsUp.clear(w),this.bsBondsDn.clear(w),JU.Logger.error("BOND STEREOCHEMISTRY PARITY ERROR-stereochemistry for bond "+
w+""));JU.Logger.debugging&&JU.Logger.debug(this.getBondStereochemistry(h,l)+" "+g.getIndex()+" "+u.getIndex()+" "+this.getBondStereochemistry(q,p))}}}}}}});g(c$,"getSmilesAt",function(a,b,c,d,e,f){var h=b.getIndex();if(!this.bsToDo.get(h))return null;this.ptAtom++;this.bsToDo.clear(h);var j=h==this.iHypervalent||0!=this.explicitHydrogen&&!this.bsIgnoreHydrogen.get(h),k=this.isExplicitOnly(b),g=this.bsAromatic.get(h),n=!this.bsSelected.get(h),l=null==this.prevAtom?-1:this.prevAtom.getIndex(),r=this.prevSp2Atoms,
p=null!=r,m=b.getElementNumber(),q=0,L=this.alleneStereo;this.alleneStereo=null;var w=new JU.Lst,u=null,E=null,v=b.getEdges();!f&&null!=this.polySmilesCenter&&(d=!1,this.sortPolyBonds(b,this.prevAtom,this.polySmilesCenter));var A=null;f=g?10:0;JU.Logger.debugging&&JU.Logger.debug(a.toString());if(null!=v)for(var y=0,C=v.length;y<C;y++){var B=v[y];if(B.isCovalent()){var D=v[y].getOtherNode(b),x=D.getIndex();if(x==l)E=v[y];else{B=!j&&!k&&1==D.getElementNumber()&&0>=D.getIsotopeNumber();if(!this.bsIncludingH.get(x)){if(B||
!c||!this.bsSelected.get(h))continue;this.bsToDo.set(x)}B?(A=D,q++,1<q&&(f=10)):w.addLast(v[y])}}}1<q&&(r=null);C=null!=r?2:0;null==r&&(!g&&1>=q)&&(r=Array(5));var F=null;null!=E&&(F=this.getBondOrder(E,h,l,g),null!=r&&!p&&(r[C++]=this.prevAtom));null!=r&&!p&&(this.ptSp2Atom0=this.ptAtom);null!=r&&1==q&&(r[C++]=A);k=0;x=new JU.BS;D=w.size();if(d)for(y=0;y<D;y++){var B=w.get(y),v=B.getOtherNode(b),z=v.getCovalentBondCount()-(j||this.isExplicitOnly(v)?0:v.getCovalentHydrogenCount()),G=B.getCovalentOrder();
if(!this.htRings.containsKey(JS.SmilesGenerator.getRingKey(v.getIndex(),h)))if(v=null!=u||y<D-1,1==z&&v)x.set(B.index);else if(1<G||z>k)k=1<G?1E3+G:z,u=B}j=null==u?null:u.getOtherNode(b);k=null==u?0:u.getCovalentOrder();D=Array(7);7>f&&null!=E&&(p&&2==E.getCovalentOrder()&&2==k&&null!=r[1]?(D[f++]=r[0],D[f++]=r[1]):D[f++]=this.prevAtom);7>f&&1==q&&(D[f++]=A);B=this.getBondStereochemistry(E,this.prevAtom);if(null!=F||"\x00"!=B)"\x00"!=B&&(F=""+B),a.append(F);z=f;G=C;E=new JU.SB;A=new JU.Lst;for(y=
0;y<w.size();y++)if(B=w.get(y),x.get(B.index)){v=B.getOtherNode(b);B=new JU.SB;this.prevAtom=b;this.prevSp2Atoms=this.alleneStereo=null;var F=this.ptSp2Atom0,H=this.ptAtom;this.getSmilesAt(B,v,c,d,e,!0);this.ptAtom=H;this.ptSp2Atom0=F;B=B.toString();w.removeItemAt(y--);null==u?A.addLast(B):E.append("(").append(B).append(")");7>f&&(D[f++]=v);null!=r&&5>C&&(r[C++]=v)}c=new JU.SB;var H=f,I=C,x=null;if(!d&&!this.noStereo&&null==this.polySmilesCenter&&(5==w.size()||6==w.size()))x=this.sortInorganic(b,
w,this.vTemp);for(y=0;y<w.size();y++)B=w.get(y),B!==u&&(v=B.getOtherNode(b),d=v.getIndex(),F=this.getBondOrder(B,h,d,g),B=this.getBondStereochemistry(B,b),"\x00"!=B&&(F=""+B),c.append(F),c.append(this.getRingCache(h,d,this.htRings)),7>f&&(D[f++]=v),null!=r&&5>C&&(r[C++]=v));z!=H&&H!=f&&this.swapArray(D,z,H,f);G!=I&&I!=C&&this.swapArray(r,G,I,C);if(p&&2==f&&2==k){p=this.ptAtom-this.ptSp2Atom0;C=j.getCovalentBondCount();w=7==j.getElementNumber();if(0==p%2)f=8;else if(3==C||2==C&&w){v=j.getEdges();for(p=
0;p<v.length;p++)w=j.getBondedAtomIndex(p),v[p].isCovalent()&&w!=h&&(D[f++]=this.atoms[w]);2==C&&(D[f++]=j);4==f&&(this.alleneStereo=D,1==D[3].getAtomicAndIsotopeNumber()&&(z=D[3],D[3]=D[2],D[2]=z))}C=0}else null!=j&&7>f&&(D[f++]=j);null!=L&&L[3]!==D[2]&&(L=a.lastIndexOf("@]="),0<L&&(p=a.substring(L),a.setLength("@"==a.charAt(L-1)?L-1:L+1),a.append(p)));this.haveSmilesAtoms&&(null==x&&4==f)&&(x=b.getStereoAtAt(D));L=b.getFormalCharge();p=b.getIsotopeNumber();w=b.getValence();d=this.openSMILES?b.getFloatProperty("property_atomclass"):
NaN;y=b.getAtomName();v=b.getBioStructureTypeName();this.addAtomComment&&a.append("\n//* "+b.toString()+" *//\t");this.topologyOnly?a.append("*"):n&&0!=v.length&&0!=y.length?this.addBracketedBioName(a,b,"."+y,!1):a.append(JS.SmilesAtom.getAtomLabel(m,p,e?-1:w,L,d,q,g,null!=x?x:this.noStereo?null:this.checkStereoPairs(b,null==this.alleneStereo?h:-1,D,f,-1==l),this.is2D));a.appendSB(c);if(null!=u)a.appendSB(E);else{z=A.size()-1;if(0<=z){for(y=0;y<z;y++)a.append("(").append(A.get(y)).append(")");a.append(A.get(z))}return null}null!=
r&&2==k&&(1==C||2==C)?(null==r[0]&&(r[0]=b),null==r[1]&&(r[1]=b)):r=null;this.prevSp2Atoms=r;this.prevAtom=b;return j},"JU.SB,JU.SimpleNode,~B,~B,~B,~B");g(c$,"isExplicitOnly",function(a){return 7==a.getElementNumber()&&2==a.getCovalentBondCount()||6==a.getElementNumber()&&17==a.getIsotopeNumber()},"JU.SimpleNode");g(c$,"swapArray",function(a,b,c,d){b=c-b;if(null==this.atemp||this.atemp.length<b)this.atemp=Array(b);for(var e=b,f=c;0<e;)this.atemp[--e]=a[--f];for(f=c;f<d;f++)a[f-b]=a[f];e=b;for(f=
d;0<e;)a[--f]=this.atemp[--e]},"~A,~N,~N,~N");g(c$,"getBondOrder",function(a,b,c,d){if(this.topologyOnly)return"";if(65537==(a.order&65537))return"^-";a=Math.max(a.isPartial()?1:0,a.getCovalentOrder());return!d||!this.bsAromatic.get(c)?JS.SmilesBond.getBondOrderString(a):1==a&&!this.isSameAromaticRing(b,c)?"-":this.aromaticDouble&&(2==a||514==a)?"=":""},"JU.Edge,~N,~N,~B");g(c$,"isSameAromaticRing",function(a,b){for(var c,d=this.aromaticRings.size();0<=--d;)if((c=this.aromaticRings.get(d)).get(a)&&
c.get(b))return!0;return!1},"~N,~N");g(c$,"sortPolyBonds",function(a,b,c){if(null==this.smilesStereo)try{this.smilesStereo=JS.SmilesStereo.newStereo(null)}catch(d){if(!G(d,JS.InvalidSmilesException))throw d;}this.smilesStereo.sortPolyBondsByStereo(a,b,c,a.getEdges(),this.vTemp.vA)},"JU.SimpleNode,JU.SimpleNode,JU.P3");g(c$,"sortInorganic",function(a,b,c){for(var d=a.getIndex(),e=b.size(),f=new JU.Lst,h=new JU.Lst,j,k,g=null,n=null,l,r,p=new JU.BS,m=null,q=Array(6),m=!0,x="",w=0,u=0;u<e;u++)if(l=b.get(u),
q[0]=j=l.getOtherNode(a),0==u?x=this.addStereoCheck(0,d,j,"",null):m&&null!=this.addStereoCheck(0,d,j,x,null)&&(m=!1),!p.get(u)){p.set(u);for(var E=!1,v=u+1;v<e;v++)if(!p.get(v)&&(r=b.get(v),k=r.getOtherNode(a),JS.SmilesStereo.isDiaxial(a,a,j,k,c,-0.95))){switch(++w){case 1:g=j;break;case 2:n=j;break;case 3:2==JS.SmilesStereo.getHandedness(n,g,j,a,c)&&(j=l,l=r,r=j)}f.addLast(O(-1,[l,r]));E=!0;p.set(v);break}E||h.addLast(l)}d=f.size();if(m||6==e&&3!=d||5==e&&0==d)return"";m=f.get(0);l=m[0];q[0]=l.getOtherNode(a);
b.clear();b.addLast(l);1<d&&h.addLast(f.get(1)[0]);3==d&&h.addLast(f.get(2)[0]);1<d&&h.addLast(f.get(1)[1]);3==d&&h.addLast(f.get(2)[1]);for(u=0;u<h.size();u++)l=h.get(u),b.addLast(l),q[u+1]=l.getOtherNode(a);b.addLast(m[1]);q[e-1]=m[1].getOtherNode(a);return JS.SmilesStereo.getStereoFlag(a,q,e,c,this.is2D)},"JU.SimpleNode,JU.Lst,JS.VTemp");g(c$,"checkStereoPairs",function(a,b,c,d,e){if(10==d||d<(this.is2D?3:4))return"";if(0==this.explicitHydrogen&&(0<=b&&4==d)&&17>=a.getElementNumber())for(var f=
"",h=0;4>h;h++)if(null==(f=this.addStereoCheck(0,b,c[h],f,JU.BSUtil.newAndSetBit(b))))return"";if(this.is2D){b=4==d||!e?1:-1;e=a.getEdges();f=null;for(h=a.getBondCount();0<=--h;){var j=e[h];if(a===j.getAtom(0))switch(j.getBondType()){case 1025:f=JS.SmilesGenerator.setStereoTemp(null,c,j.getAtom(1),b);break;case 1041:f=JS.SmilesGenerator.setStereoTemp(null,c,j.getAtom(1),-b)}}if(null==f)return"";3==d&&(c[d++]=JS.SmilesGenerator.setStereoTemp(a,c,f,0))}return JS.SmilesStereo.getStereoFlag(a,c,d,this.vTemp,
this.is2D)},"JU.SimpleNode,~N,~A,~N,~B");c$.setStereoTemp=g(c$,"setStereoTemp",function(a,b,c,d){for(var e=new JS.SmilesAtom,f=0;4>f;f++){var h=b[f]===c;if(null==a){if(h)return a=c.getXYZ(),e.set(a.x,a.y,d),b[f]=e}else 3>f&&e.add(b[f])}if(null==a)return null;e.scale(-0.33333334);e.scaleAdd2(2,a,e);return e},"JU.SimpleNode,~A,JU.SimpleNode,~N");g(c$,"addStereoCheck",function(a,b,c,d,e){null!=e&&e.set(b);var f=c.getAtomicAndIsotopeNumber();if(1==f&&0==this.explicitHydrogen)return"H";var h=c.getCovalentBondCount(),
j=c.getCovalentHydrogenCount(),k=6==f&&0!=this.explicitHydrogen?j:0;if(6==f||16==f?4!=h:1==f||1<h)return d+ ++this.chainCheck;var g=";"+a+"/"+f+"/"+k+"/"+h+(0==a?",":"_");if(6==f||16==f)switch(k){case 1:return d+g+ ++this.chainCheck;case 0:case 2:if(null==e)return d;for(var f=c.getEdges(),n="",l="",r=2==k?0:3,k=c.getBondCount();0<=--k;){var l=f[k].getOtherNode(c),p=l.getIndex();!e.get(p)&&f[k].isCovalent()&&(e.set(p),l=this.addStereoCheck(a+1,c.getIndex(),l,"",e.clone()),0<=n.indexOf(l)&&r--,n+=l)}if(3==
r)return d+g+ ++this.chainCheck;g=(g+n).$replace(",","_");if(0<a)return d+g}if(0<=d.indexOf(g)){if(3==j){for(k=a=0;k<h&&3>a;k++)e=c.getBondedAtomIndex(k),e!=b&&(a+=this.atoms[e].getAtomicAndIsotopeNumber());if(3<a)return d}return null}return d+g},"~N,~N,JU.SimpleNode,~S,JU.BS");g(c$,"getRingCache",function(a,b,c){var d=JS.SmilesGenerator.getRingKey(a,b),e=c.get(d),f=null==e?null:e[0];if(null==f)this.bsRingKeys.set(++this.nPairs),this.nPairsMax=Math.max(this.nPairs,this.nPairsMax),c.put(d,O(-1,[f=
this.getRingPointer(this.nPairs),Integer.$valueOf(b),Integer.$valueOf(this.nPairs)])),JU.Logger.debugging&&JU.Logger.debug("adding for "+a+" ring key "+this.nPairs+": "+d);else{c.remove(d);a=e[2].intValue();this.bsRingKeys.clear(a);if(0>this.bsRingKeys.nextSetBit(0)&&(2==this.nPairsMax||99==this.nPairsMax))this.nPairsMax=this.nPairs=99==this.nPairsMax?10:0;JU.Logger.debugging&&JU.Logger.debug("using ring key "+d)}return f},"~N,~N,java.util.Map");g(c$,"getRingPointer",function(a){return 10>a?""+a:
100>a?"%"+a:"%("+a+")"},"~N");g(c$,"dumpRingKeys",function(a,b){JU.Logger.info(a.toString()+"\n\n");for(var c,d=b.keySet().iterator();d.hasNext()&&((c=d.next())||1);)JU.Logger.info("unmatched connection: "+c)},"JU.SB,java.util.Map");c$.getRingKey=g(c$,"getRingKey",function(a,b){return Math.min(a,b)+"_"+Math.max(a,b)},"~N,~N")});F("JS");z(null,"JS.SmilesAromatic","java.util.Hashtable JU.BS $.Lst $.Measure $.V3 JS.SmilesRing $.SmilesRingSet JU.BSUtil $.Logger".split(" "),function(){c$=S(JS,"SmilesAromatic");
c$.setAromatic=g(c$,"setAromatic",function(a,b,c,d,e,f,h,j,k,g,n,l,r,p){h=h||0<f;if(p)for(v=d.size();0<=--v;){if(A=d.get(v),p=JS.SmilesAromatic.isSp2Ring(a,b,c,A,j?3.4028235E38:0<f?0.1:0.01,k,0==f)){e.or(A);if(h){g=new JU.Lst;for(var m=A.nextSetBit(0);0<=m;m=A.nextSetBit(m+1))for(var q=b[m],x=q.getEdges(),w=q.getIndex(),u=x.length;0<=--u;){var E=x[u].getOtherNode(q).getIndex();E>w&&A.get(E)&&g.addLast(x[u])}switch(JS.SmilesAromatic.checkHueckelAromatic(a,b,e,A,f,r)){case -1:continue;case 0:p=!1;case 1:if(null!=
l&&l.addLast(new JS.SmilesRing(a,A,g,p)),!p)continue}}n.addLast(A)}}else for(var v=d.size();0<=--v;){var A=JU.BSUtil.copy(d.get(v));A.and(e);A.cardinality()==a&&n.addLast(A)}},"~N,~A,JU.BS,JU.Lst,JU.BS,~N,~B,~B,~B,JS.VTemp,JU.Lst,JU.Lst,~A,~B");c$.checkAromaticDefined=g(c$,"checkAromaticDefined",function(a,b,c){for(var d=b.nextSetBit(0);0<=d;d=b.nextSetBit(d+1))for(var e=a[d].getEdges(),f=0;f<e.length;f++)switch(e[f].getBondType()){case 515:case 514:case 513:c.set(e[f].getAtomIndex1()),c.set(e[f].getAtomIndex2())}},
"~A,JU.BS,JU.BS");c$.isSp2Ring=g(c$,"isSp2Ring",function(a,b,c,d,e,f,h){if(f)for(var j=d.nextSetBit(0);0<=j;j=d.nextSetBit(j+1)){if(3<b[j].getCovalentBondCount())return!1}else for(j=d.nextSetBit(0);0<=j;j=d.nextSetBit(j+1))if(3<b[j].getCovalentBondCountPlusMissingH())return!1;if(3.4028235E38==e)return!0;0>=e&&(e=0.01);for(var k=f=a=null,j=d.cardinality(),g=Array(2*j),n=0,l=1-5*e,j=d.nextSetBit(0);0<=j;j=d.nextSetBit(j+1)){for(var r=b[j],p=-1,m=-1,q=-1,x=r.getEdges().length;0<=--x;){var w=r.getBondedAtomIndex(x);
if(c.get(w))if(d.get(w))0>m?m=w:q=w;else{if(16==r.getElementNumber()){if(!h)return!1;w=-1}p=w}}null==k&&(k=new JU.V3,a=new JU.V3,f=new JU.V3);x=0;for(r=j;2>x;x++){JU.Measure.getNormalThroughPoints(b[m],b[r],b[q],a,f);if(!JS.SmilesAromatic.addNormal(a,k,l))return!1;g[n++]=JU.V3.newV(a);if(0>(r=p))break}}return JS.SmilesAromatic.checkStandardDeviation(g,k,n,e)},"~N,~A,JU.BS,JU.BS,~N,~B,~B");c$.addNormal=g(c$,"addNormal",function(a,b,c){var d=b.dot(a);if(0!=d&&Math.abs(d)<c)return!1;0>d&&a.scale(-1);
b.add(a);b.normalize();return!0},"JU.V3,JU.V3,~N");c$.checkStandardDeviation=g(c$,"checkStandardDeviation",function(a,b,c,d){for(var e=0,f=0,h=0;h<c;h++)var j=a[h].dot(b),e=e+j,f=f+j*j;e=Math.sqrt((f-e*e/c)/(c-1));return e<d},"~A,JU.V3,~N,~N");c$.checkHueckelAromatic=g(c$,"checkHueckelAromatic",function(a,b,c,d,e,f){for(var h=0,j=0,k=d.nextSetBit(0);0<=k&&0<=h;k=d.nextSetBit(k+1)){var g=b[k],n=g.getElementNumber(),l=g.getCovalentBondCountPlusMissingH(),l=l+g.getValence(),l=l-4;if(6==n){var r=g.getFormalCharge();
-2147483648!=r&&(l+=r)}n=5<=n&&8>=n?n-5:15==n?2:34==n?3:33==n?4:16==n?5:-1;if(0<=n){n=JS.SmilesAromatic.OS_PI_COUNTS[n];if(0>l||l>=n.length)return-1;switch(l=n[l]){case -2:return-1;case -1:n=g.getEdges();l=0;for(r=n.length;0<=--r;){var p=n[r];if(2==p.getCovalentOrder()){l=p.getOtherNode(g);l=6==l.getElementNumber()||c.get(l.getIndex())?1:0<e?-100:0;break}}default:if(0>l)return-1;null!=f&&(f[k]=l);h+=l;1==l&&j++;JU.Logger.debuggingHigh&&JU.Logger.info("atom "+g+" pi="+l+" npi="+h)}}}return 0==(h-2)%
4&&(2>e||5==a||6==j)?1:0},"~N,~A,JU.BS,JU.BS,~N,~A");c$.finalizeAromatic=g(c$,"finalizeAromatic",function(a,b,c,d,e,f,h){h&&JS.SmilesAromatic.removeBridgingRings(c,d);JS.SmilesAromatic.checkFusedRings(d,e,c);b.clearAll();for(e=c.size();0<=--e;)b.or(c.get(e));if(h||f)for(e=b.nextSetBit(0);0<=e;e=b.nextSetBit(e+1)){c=a[e].getEdges();f=0;for(var j=c.length;0<=--j;){var k=c[j].getOtherNode(a[e]),g=c[j].getCovalentOrder(),n=k.getIndex();if(b.get(n)){if(2==g){k=!1;for(g=d.size();0<=--g;){var l=d.get(g);
if(l.get(e)&&l.get(n)){k=!0;break}}if(!k){f=-1;break}}f++}else if(h&&6==k.getElementNumber()&&2==g){f=-1;break}}2>f&&(b.clear(e),e=-1)}},"~A,JU.BS,JU.Lst,JU.Lst,~A,~B,~B");c$.removeBridgingRings=g(c$,"removeBridgingRings",function(a,b){var c=new JU.BS,d=new JU.BS,e=new JU.BS;JS.SmilesAromatic.checkBridges(a,d,a,d,c);JS.SmilesAromatic.checkBridges(b,e,b,e,c);JS.SmilesAromatic.checkBridges(a,d,b,e,c);for(c=a.size();0<=--c;)d.get(c)&&a.removeItemAt(c);for(c=b.size();0<=--c;)e.get(c)&&b.removeItemAt(c)},
"JU.Lst,JU.Lst");c$.checkBridges=g(c$,"checkBridges",function(a,b,c,d,e){for(var f=a===c,h=a.size();0<=--h;)for(var j=a.get(h),k=f?h+1:0,g=c.size();--g>=k;){var n=c.get(g);n.equals(j)||(e.clearAll(),e.or(j),e.and(n),2<e.cardinality()&&(b.set(h),d.set(g)))}},"JU.Lst,JU.BS,JU.Lst,JU.BS,JU.BS");c$.checkFusedRings=g(c$,"checkFusedRings",function(a,b,c){for(var d=new java.util.Hashtable,e=a.size();0<=--e;){for(var f=a.get(e),h=f.edges,j=h.size();0<=--j;){var k=JS.SmilesRing.getSetByEdge(h.get(j),d);null==
k||k===f.$set||(null!=f.$set?k.addSet(f.$set,d):k.addRing(f))}(null==f.$set?f.$set=new JS.SmilesRingSet:f.$set).addRing(f);f.addEdges(d)}for(e=a.size();0<=--e;)if(!(f=a.get(e)).isOK&&!(null==(k=f.$set)||k.isEmpty())){if(2==k.getElectronCount(b)%4)for(j=k.size();0<=--j;)(f=k.get(j)).isOK||c.addLast(f);k.clear()}},"JU.Lst,~A,JU.Lst");P(c$,"OS_PI_COUNTS",O(-1,[x(-1,[-2,1,0]),x(-1,[1,2,1,-1]),x(-1,[2,1,2,1,1]),x(-1,[2,1]),x(-1,[-2,1,2,1,-2]),x(-1,[2,1,2,2])]))});F("JS");z(["JU.BS"],"JS.SmilesRing",null,
function(){c$=I(function(){this.bsEdgesToCheck=this.edges=this.$set=null;this.isOK=!1;this.n=0;H(this,arguments)},JS,"SmilesRing",JU.BS);M(c$,function(a,b,c,d){Q(this,JS.SmilesRing,[]);this.or(b);this.edges=c;this.isOK=d;this.n=a},"~N,JU.BS,JU.Lst,~B");g(c$,"addEdges",function(a){for(var b=this.edges.size();0<=--b;)a.put(JS.SmilesRing.getKey(this.edges.get(b)),this.$set)},"java.util.Hashtable");c$.getSetByEdge=g(c$,"getSetByEdge",function(a,b){return b.get(JS.SmilesRing.getKey(a))},"JU.Edge,java.util.Hashtable");
c$.getKey=g(c$,"getKey",function(a){var b=a.getAtomIndex1();a=a.getAtomIndex2();return b<a?b+"_"+a:a+"_"+b},"JU.Edge")});F("JS");z(["JU.Lst","$.BS"],"JS.SmilesRingSet",null,function(){c$=I(function(){this.bs=null;H(this,arguments)},JS,"SmilesRingSet",JU.Lst);N(c$,function(){this.bs=new JU.BS});M(c$,function(){Q(this,JS.SmilesRingSet,[])});g(c$,"addSet",function(a,b){for(var c=a.size();0<=--c;){var d=a.get(c);this.addRing(d);d.addEdges(b)}},"JS.SmilesRingSet,java.util.Hashtable");g(c$,"addRing",function(a){this.addLast(a);
a.$set=this;this.bs.or(a)},"JS.SmilesRing");g(c$,"getElectronCount",function(a){for(var b=0,c=this.bs.nextSetBit(0);0<=c;c=this.bs.nextSetBit(c+1))b+=a[c];return b},"~A")});F("JS");z(["JU.P3","JU.Node"],"JS.SmilesAtom",["java.lang.Float","JU.AU","JU.Elements","$.Logger","JV.JC"],function(){c$=I(function(){this.patternIndex=-1;this.pattern=null;this.primitiveType=0;this.isAND=!1;this.subAtoms=null;this.index=this.nSubAtoms=0;this.residueChar=this.residueName=this.referance=null;this.insCode="\x00";
this.isBioAtomWild=this.isBioResidue=this.isBioAtom=!1;this.bioType="\x00";this.$isLeadAtom=!1;this.notBondedIndex=-1;this.notCrossLinked=!1;this.aromaticAmbiguous=!0;this.covalentHydrogenCount=-1;this.elementDefined=this.hasSymbol=this.selected=this.not=!1;this.bioAtomName=this.atomType=null;this.isFirst=!0;this.jmolIndex=-1;this.elementNumber=-2;this.implicitHydrogenCount=this.explicitHydrogenCount=this.residueNumber=this.atomNumber=-2147483648;this.bonds=this.parent=null;this.iNested=this.bondCount=
0;this.isAromatic=!1;this.charge=this.atomicMass=-2147483648;this.matchingIndex=-1;this.stereo=null;this.component=-2147483648;this.atomSite=this.matchingComponent=0;this.nonhydrogenDegree=this.degree=-1;this.valence=0;this.connectivity=-1;this.ringSize=this.ringMembership=-2147483648;this.ringConnectivity=-1;this.matchingNode=null;this.hasSubpattern=!1;this.mapIndex=-1;this.atomClass=NaN;this.symbol=null;this.isTopoAtom=!1;this.cipChirality=this.missingHydrogenCount=0;this.hasDoubleBond=!1;H(this,
arguments)},JS,"SmilesAtom",JU.P3,JU.Node);N(c$,function(){this.bonds=Array(4)});c$.allowSmilesUnbracketed=g(c$,"allowSmilesUnbracketed",function(a){return 0<="B, C, N, O, P, S, F, Cl, Br, I, *,".indexOf(a+",")},"~S");M(c$,function(){Q(this,JS.SmilesAtom,[])});m(c$,"getAtomType",function(){return null==this.atomType?this.bioAtomName:this.atomType});g(c$,"getChiralClass",function(){return null==this.stereo?-2147483648:this.stereo.getChiralClass(this)});g(c$,"isDefined",function(){return this.hasSubpattern||
0!=this.iNested||this.isBioAtom||-2147483648!=this.component||-2!=this.elementNumber||0<this.nSubAtoms});g(c$,"setBioAtom",function(a){this.isBioAtom="\x00"!=a;this.bioType=a;null!=this.parent&&(this.parent.bioType=a,this.parent.isBioAtom=this.isBioAtom,this.parent.isBioAtomWild=this.isBioAtomWild)},"~S");g(c$,"setAtomName",function(a){null!=a&&(0<a.length&&(this.bioAtomName=a),a.equals("\x00")&&(this.$isLeadAtom=!0),null!=this.parent&&(this.parent.bioAtomName=a))},"~S");g(c$,"setBonds",function(a){this.bonds=
a},"~A");g(c$,"addSubAtom",function(a,b){this.isAND=b;null==this.subAtoms&&(this.subAtoms=Array(2));this.nSubAtoms>=this.subAtoms.length&&(this.subAtoms=JU.AU.doubleLength(this.subAtoms));a.setIndex(this.index);a.parent=this;this.subAtoms[this.nSubAtoms++]=a;this.setSymbol("*");this.hasSymbol=!1;return a},"JS.SmilesAtom,~B");g(c$,"setIndex",function(a){this.index=a;return this},"~N");g(c$,"setTopoAtom",function(a,b,c,d,e){this.component=a;this.index=b;this.patternIndex=e;this.setSymbol(c);this.charge=
d;this.isTopoAtom=!0;return this},"~N,~N,~S,~N,~N");g(c$,"setHydrogenCount",function(){this.missingHydrogenCount=this.explicitHydrogenCount;if(-2147483648!=this.explicitHydrogenCount)return!0;var a=this.getFormalCharge(),a=JS.SmilesAtom.getDefaultHCount(this.elementNumber,this.isAromatic,-2147483648==a?0:a);if(0>a)return this.missingHydrogenCount=0,-1==a;7==this.elementNumber&&this.isAromatic&&2==this.bondCount&&1==this.bonds[0].getBondType()&&1==this.bonds[1].getBondType()&&a++;for(var b=0;b<this.bondCount;b++){var c=
this.bonds[b];switch(c.getBondType()){case 81:7==this.elementNumber&&JU.Logger.info("Ambiguous bonding to aromatic N found -- MF may be in error");a-=1;break;case 1025:case 1041:case 65537:case 65538:a-=1;break;case 2:a-=this.isAromatic&&6==this.elementNumber?1:2;break;case 1:case 3:case 4:a-=c.getBondType()}}0<=a&&(this.missingHydrogenCount=this.explicitHydrogenCount=a);return!0});c$.getDefaultHCount=g(c$,"getDefaultHCount",function(a,b,c){switch(a){case 0:case -1:case -2:return-1;case 1:return 1;
case 6:return(b?3:4)+(0==c?0:1);case 8:case 16:return 2+c;case 7:return(b?2:3)+c;case 5:case 15:return 3;case 9:case 17:case 35:case 53:return 1+c;default:return 0}},"~N,~B,~N");m(c$,"getIndex",function(){return this.index});g(c$,"setSymbol",function(a){this.symbol=a;this.isAromatic=a.equals(a.toLowerCase());this.elementDefined=this.hasSymbol=!0;if(a.equals("*"))return this.isAromatic=!1,this.elementNumber=-2,!0;if(a.equals("Xx"))return this.elementNumber=0,!0;this.aromaticAmbiguous=!1;if(a.equals("a")||
a.equals("A"))return 0>this.elementNumber&&(this.elementNumber=-1),!0;this.isAromatic&&(a=a.substring(0,1).toUpperCase()+(1==a.length?"":a.substring(1)));this.elementNumber=JU.Elements.elementNumberFromSymbol(a,!0);return 0!=this.elementNumber},"~S");m(c$,"getElementNumber",function(){return this.elementNumber});g(c$,"getAtomicMass",function(){return this.atomicMass});m(c$,"getAtomNumber",function(){return this.atomNumber});g(c$,"setAtomicMass",function(a){this.atomicMass=a},"~N");g(c$,"getCharge",
function(){return this.charge});g(c$,"setCharge",function(a){this.charge=a},"~N");g(c$,"getMatchingAtomIndex",function(){return this.matchingIndex});g(c$,"getMatchingAtom",function(){return null==this.matchingNode?this:this.matchingNode});g(c$,"setMatchingAtom",function(a,b){this.matchingNode=a;this.matchingIndex=b},"JU.Node,~N");g(c$,"setExplicitHydrogenCount",function(a){this.explicitHydrogenCount=a},"~N");g(c$,"setImplicitHydrogenCount",function(a){this.implicitHydrogenCount=a},"~N");g(c$,"setDegree",
function(a){this.degree=a},"~N");g(c$,"setNonhydrogenDegree",function(a){this.nonhydrogenDegree=a},"~N");g(c$,"setValence",function(a){this.valence=a},"~N");g(c$,"setConnectivity",function(a){this.connectivity=a},"~N");g(c$,"setRingMembership",function(a){this.ringMembership=a},"~N");g(c$,"setRingSize",function(a){this.ringSize=a;if(500==this.ringSize||600==this.ringSize)this.isAromatic=!0},"~N");g(c$,"setRingConnectivity",function(a){this.ringConnectivity=a},"~N");m(c$,"getModelIndex",function(){return this.component});
m(c$,"getMoleculeNumber",function(){return this.component},"~B");m(c$,"getAtomSite",function(){return this.atomSite});m(c$,"getFormalCharge",function(){return this.charge});m(c$,"getIsotopeNumber",function(){return this.atomicMass});m(c$,"getAtomicAndIsotopeNumber",function(){return JU.Elements.getAtomicAndIsotopeNumber(this.elementNumber,this.atomicMass)});m(c$,"getAtomName",function(){return null==this.bioAtomName?"":this.bioAtomName});m(c$,"getGroup3",function(){return null==this.residueName?"":
this.residueName},"~B");m(c$,"getGroup1",function(){return null==this.residueChar?"":this.residueChar},"~S");g(c$,"addBond",function(a){this.bondCount>=this.bonds.length&&(this.bonds=JU.AU.doubleLength(this.bonds));this.bonds[this.bondCount]=a;2==a.order&&(this.hasDoubleBond=!0);this.bondCount++},"JS.SmilesBond");g(c$,"setBondArray",function(){this.bonds.length>this.bondCount&&(this.bonds=JU.AU.arrayCopyObject(this.bonds,this.bondCount));null!=this.subAtoms&&this.subAtoms.length>this.nSubAtoms&&(this.subAtoms=
JU.AU.arrayCopyObject(this.subAtoms,this.subAtoms.length));for(var a=0;a<this.bonds.length;a++){var b=this.bonds[a];this.isBioAtom&&17==b.getBondType()?b.order=112:2==b.order&&(b.atom1.hasDoubleBond=b.atom2.hasDoubleBond=!0);b.atom1.index>b.atom2.index&&b.switchAtoms()}});m(c$,"getEdges",function(){return null!=this.parent?this.parent.getEdges():this.bonds});g(c$,"getBond",function(a){return null!=this.parent?this.parent.getBond(a):0<=a&&a<this.bondCount?this.bonds[a]:null},"~N");m(c$,"getCovalentBondCount",
function(){return this.getBondCount()});m(c$,"getBondCount",function(){return null!=this.parent?this.parent.getBondCount():this.bondCount});m(c$,"getCovalentBondCountPlusMissingH",function(){return this.getBondCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});m(c$,"getTotalHydrogenCount",function(){return this.getCovalentHydrogenCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});m(c$,"getImplicitHydrogenCount",function(){return this.implicitHydrogenCount});m(c$,"getExplicitHydrogenCount",
function(){return this.explicitHydrogenCount});g(c$,"getMatchingBondedAtom",function(a){if(null!=this.parent)return this.parent.getMatchingBondedAtom(a);if(a>=this.bondCount)return-1;a=this.bonds[a];return(a.atom1===this?a.atom2:a.atom1).matchingIndex},"~N");m(c$,"getBondedAtomIndex",function(a){return null!=this.parent?this.parent.getBondedAtomIndex(a):this.bonds[a].getOtherAtom(this).index},"~N");m(c$,"getCovalentHydrogenCount",function(){if(0<=this.covalentHydrogenCount)return this.covalentHydrogenCount;
if(null!=this.parent)return this.covalentHydrogenCount=this.parent.getCovalentHydrogenCount();for(var a=this.covalentHydrogenCount=0;a<this.bonds.length;a++)1==this.bonds[a].getOtherAtom(this).elementNumber&&this.covalentHydrogenCount++;return this.covalentHydrogenCount});m(c$,"getValence",function(){if(null!=this.parent)return this.parent.getValence();var a=this.valence;if(0>=a&&null!=this.bonds)for(var b=this.bondCount;0<=--b;)a+=this.bonds[b].getValence();return this.valence=a});m(c$,"getTotalValence",
function(){return this.getValence()+(this.isTopoAtom?0:this.missingHydrogenCount)});g(c$,"getBondTo",function(a){if(null!=this.parent)return this.parent.getBondTo(a);for(var b,c=0;c<this.bonds.length;c++)if(null!=(b=this.bonds[c]))if(null==a?b.atom2===this:b.getOtherAtom(this)===a)return b;return null},"JS.SmilesAtom");g(c$,"getBondNotTo",function(a,b){for(var c,d=0;d<this.bonds.length;d++)if(null!=(c=this.bonds[d])){var e=c.getOtherAtom(this);if(a!==e&&(b||1!=e.elementNumber))return c}return null},
"JS.SmilesAtom,~B");m(c$,"isLeadAtom",function(){return this.$isLeadAtom});m(c$,"getOffsetResidueAtom",function(a,b){if(this.isBioAtom){if(0==b)return this.index;for(var c=0;c<this.bonds.length;c++)if(this.bonds[c].getAtomIndex1()==this.index&&96==this.bonds[c].getBondType())return this.bonds[c].getOtherAtom(this).index}return-1},"~S,~N");m(c$,"getGroupBits",function(a){a.set(this.index)},"JU.BS");m(c$,"isCrossLinked",function(a){return this.getBondTo(a).isHydrogen()},"JU.Node");m(c$,"getCrossLinkVector",
function(a){for(var b=!1,c=0;c<this.bonds.length;c++)if(112==this.bonds[c].order){if(null==a)return!0;a.addLast(Integer.$valueOf(this.index));a.addLast(Integer.$valueOf(this.bonds[c].getOtherAtom(this).index));a.addLast(Integer.$valueOf(this.bonds[c].getOtherAtom(this).index));b=!0}return b},"JU.Lst,~B,~B");m(c$,"getBioStructureTypeName",function(){return null});m(c$,"getInsertionCode",function(){return this.insCode});m(c$,"getResno",function(){return this.residueNumber});m(c$,"getChainID",function(){return 0});
m(c$,"getChainIDStr",function(){return""});c$.getAtomLabel=g(c$,"getAtomLabel",function(a,b,c,d,e,f,h,j,k){var g=JU.Elements.elementSymbolFromNumber(a);if(1==a||h&&!(g=g.toLowerCase()).equals("c")&&!g.equals("o")&&!g.equals("s"))c=2147483647;h=2147483647!=c&&0>=b&&0==d&&Float.isNaN(e)&&(null==j||0==j.length);var n=JS.SmilesAtom.getDefaultHCount(a,!1,-2147483648==d?0:d);if(k&&0==f){if(h&&6==a)return g;f=n-c}return h&&n==c?g:"["+(0>=b?"":""+b)+g+(null==j?"":j)+(1<f?"H"+f:1==f?"H":"")+(-2147483648==
d||0==d?"":0>d?""+d:"+"+d)+(Float.isNaN(e)?"":":"+U(e))+"]"},"~N,~N,~N,~N,~N,~N,~B,~S,~B");m(c$,"getBioSmilesType",function(){return this.bioType});g(c$,"isNucleic",function(){return"n"==this.bioType||"r"==this.bioType||"d"==this.bioType});m(c$,"isPurine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="AG".indexOf(this.residueChar)});m(c$,"isPyrimidine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="CTUI".indexOf(this.residueChar)});m(c$,"isDeleted",function(){return!1});
m(c$,"findAtomsLike",function(){return null},"~S");m(c$,"toString",function(){var a=null!=this.residueChar||null!=this.residueName?(null==this.residueChar?this.residueName:this.residueChar)+"."+this.bioAtomName:null!=this.bioAtomName&&-2147483648!=this.atomNumber?null:-1==this.elementNumber?"A":-2==this.elementNumber?"*":JU.Elements.elementSymbolFromNumber(this.elementNumber);if(null==a)return this.bioAtomName+" #"+this.atomNumber;this.isAromatic&&(a=a.toLowerCase());for(var b="",c=0;c<this.bondCount;c++)b+=
this.bonds[c].getOtherAtom(this).index+", ";return"["+a+"."+this.index+(0<=this.matchingIndex?"("+this.matchingNode+")":"")+"]->"+b+"("+this.x+","+this.y+","+this.z+")"});m(c$,"getFloatProperty",function(a){return"property_atomclass"===a?this.atomClass:NaN},"~S");m(c$,"getMass",function(){return this.atomicMass});m(c$,"getCIPChirality",function(){return JV.JC.getCIPChiralityName(this.cipChirality&-225)},"~B");m(c$,"setCIPChirality",function(a){this.cipChirality=a},"~N");m(c$,"getCIPChiralityCode",
function(){return this.cipChirality});m(c$,"getXYZ",function(){return this});g(c$,"getStereo",function(){return this.stereo});g(c$,"getPatternIndex",function(){return this.patternIndex});m(c$,"modelIsRawPDB",function(){return!1});g(c$,"definesStereo",function(){return!1});g(c$,"getStereoAtAt",function(){return null},"~A");g(c$,"isStereoOpposite",function(){return null},"~N,~N,~N");P(c$,"UNBRACKETED_SET","B, C, N, O, P, S, F, Cl, Br, I, *,")});F("JS");z(["JU.Edge"],"JS.SmilesBond",["JS.InvalidSmilesException"],
function(){c$=I(function(){this.atom2=this.atom1=null;this.isNot=!1;this.primitives=this.matchingBond=null;this.nPrimitives=0;this.bondsOr=null;this.nBondsOr=0;this.isConnection=!1;this.atropType=null;this.isChain=!1;H(this,arguments)},JS,"SmilesBond",JU.Edge);c$.getBondOrderString=g(c$,"getBondOrderString",function(a){switch(a){case 2:return"=";case 3:return"#";case 4:return"$";default:return""}},"~N");c$.getBondTypeFromCode=g(c$,"getBondTypeFromCode",function(a){switch(a){case ".":return 0;case "-":return 1;
case "=":return 2;case "#":return 3;case "$":return 4;case ":":return 17;case "/":return 1025;case "\\":return 1041;case "^":return 65537;case "`":return 65538;case "@":return 65;case "~":return 81;case "+":return 96}return-1},"~S");g(c$,"getAtom1",function(){return this.atom1});g(c$,"set",function(a){this.order=a.order;this.isNot=a.isNot;this.primitives=a.primitives;this.nPrimitives=a.nPrimitives;this.bondsOr=a.bondsOr;this.nBondsOr=a.nBondsOr;this.atropType=a.atropType},"JS.SmilesBond");g(c$,"setAtropType",
function(a){this.atropType=x(-1,[T(a/10)-1,a%10-1])},"~N");g(c$,"setPrimitive",function(a){a=this.primitives[a];this.order=a.order;this.isNot=a.isNot;this.atropType=a.atropType;return a},"~N");g(c$,"addBondOr",function(){null==this.bondsOr&&(this.bondsOr=Array(2));if(this.nBondsOr>=this.bondsOr.length){var a=Array(2*this.bondsOr.length);System.arraycopy(this.bondsOr,0,a,0,this.bondsOr.length);this.bondsOr=a}a=new JS.SmilesBond(null,null,-1,!1);this.bondsOr[this.nBondsOr]=a;this.nBondsOr++;return a});
g(c$,"addPrimitive",function(){null==this.primitives&&(this.primitives=Array(2));if(this.nPrimitives>=this.primitives.length){var a=Array(2*this.primitives.length);System.arraycopy(this.primitives,0,a,0,this.primitives.length);this.primitives=a}a=new JS.SmilesBond(null,null,-1,!1);this.primitives[this.nPrimitives]=a;this.nPrimitives++;return a});m(c$,"toString",function(){return this.atom1+" -"+(this.isNot?"!":"")+this.order+"- "+this.atom2});M(c$,function(a,b,c,d){Q(this,JS.SmilesBond,[]);this.set2(c,
d);this.set2a(a,b)},"JS.SmilesAtom,JS.SmilesAtom,~N,~B");g(c$,"set2",function(a,b){this.order=a;this.isNot=b},"~N,~B");g(c$,"set2a",function(a,b){null!=a&&(this.atom1=a,a.addBond(this));null!=b&&(this.atom2=b,b.isBioAtomWild&&this.atom1.isBioAtomWild&&(this.order=96),b.isFirst=!1,b.addBond(this))},"JS.SmilesAtom,JS.SmilesAtom");g(c$,"setAtom2",function(a){this.atom2=a;null!=this.atom2&&(a.addBond(this),this.isConnection=!0)},"JS.SmilesAtom,JS.SmilesSearch");g(c$,"isFromPreviousTo",function(a){return!this.isConnection&&
this.atom2===a},"JS.SmilesAtom");c$.isBondType=g(c$,"isBondType",function(a,b,c){if(">"==a)return 1;if(0>"-=#$:/\\.~^`+!,&;@".indexOf(a))return 0;if(!b&&0>"-=#$:/\\.~^`".indexOf(a))throw new JS.InvalidSmilesException("SMARTS bond type "+a+" not allowed in SMILES");switch(a){case "~":return c?0:1;case "^":case "`":return-1;default:return 1}},"~S,~B,~B");g(c$,"getValence",function(){return this.order&7});g(c$,"getOtherAtom",function(a){return this.atom1===a?this.atom2:this.atom1},"JS.SmilesAtom");m(c$,
"getAtomIndex1",function(){return this.atom1.index});m(c$,"getAtomIndex2",function(){return this.atom2.index});m(c$,"getCovalentOrder",function(){return this.order&131071});m(c$,"getOtherNode",function(a){return a===this.atom1?this.atom2:a===this.atom2||null==a?this.atom1:null},"JU.SimpleNode");m(c$,"isCovalent",function(){return 112!=this.order});m(c$,"isPartial",function(){return!1});m(c$,"isHydrogen",function(){return 112==this.order});g(c$,"switchAtoms",function(){var a=this.atom1;this.atom1=
this.atom2;this.atom2=a;switch(this.order&131071){case 65537:this.order=65538;break;case 65538:this.order=65537;break;case 1025:this.order=1041;break;case 1041:this.order=1025}});g(c$,"getRealCovalentOrder",function(){switch(this.order&131071){case 65537:case 65538:case 1025:case 1041:return 1}return this.order&131071});g(c$,"getMatchingBond",function(){return null==this.matchingBond?this:this.matchingBond});m(c$,"getAtom",function(a){return 1==a?this.atom2:this.atom1},"~N");P(c$,"TYPE_UNKNOWN",-1,
"TYPE_NONE",0,"TYPE_AROMATIC",17,"TYPE_RING",65,"TYPE_ANY",81,"TYPE_BIO_SEQUENCE",96,"TYPE_BIO_CROSSLINK",112,"ALL_BONDS","-=#$:/\\.~^`+!,&;@","SMILES_BONDS","-=#$:/\\.~^`")});F("JS");z(null,"JS.SmilesMeasure",["JU.PT"],function(){c$=I(function(){this.search=null;this.index=this.type=this.nPoints=0;this.isNot=!1;this.points=this.minmax=this.indices=null;H(this,arguments)},JS,"SmilesMeasure");N(c$,function(){this.indices=x(4,0);this.points=Array(4)});M(c$,function(a,b,c,d,e){this.search=a;this.type=
Math.min(4,Math.max(c,2));this.index=b;this.isNot=d;this.minmax=e;for(a=e.length-2;0<=a;a-=2)e[a]>e[a+1]&&(b=e[a+1],e[a+1]=e[a],e[a]=b)},"JS.SmilesSearch,~N,~N,~B,~A");g(c$,"addPoint",function(a){if(this.nPoints==this.type)return!1;if(0==this.nPoints)for(var b=1;b<this.type;b++)this.indices[b]=a+b;this.indices[this.nPoints++]=a;return!0},"~N");g(c$,"check",function(){for(var a=0;a<this.type;a++){var b=this.search.patternAtoms[this.indices[a]].getMatchingAtomIndex();this.points[a]=this.search.target.nodes[b]}b=
0;switch(this.type){case 2:b=this.points[0].distance(this.points[1]);break;case 3:this.search.v.vA.sub2(this.points[0],this.points[1]);this.search.v.vB.sub2(this.points[2],this.points[1]);b=this.search.v.vA.angle(this.search.v.vB)/0.017453292;break;case 4:b=JS.SmilesMeasure.setTorsionData(this.points[0],this.points[1],this.points[2],this.points[3],this.search.v,!0)}for(a=this.minmax.length-2;0<=a;a-=2)if(b>=this.minmax[a]&&b<=this.minmax[a+1])return!this.isNot;return this.isNot});c$.setTorsionData=
g(c$,"setTorsionData",function(a,b,c,d,e,f){e.vTemp1.sub2(a,b);e.vTemp2.sub2(d,c);if(!f)return 0;e.vNorm2.sub2(b,c);e.vNorm2.normalize();e.vTemp1.cross(e.vTemp1,e.vNorm2);e.vTemp1.normalize();e.vTemp2.cross(e.vTemp2,e.vNorm2);e.vTemp2.normalize();e.vNorm3.cross(e.vTemp1,e.vTemp2);return e.vTemp1.angle(e.vTemp2)/0.017453292*(0>e.vNorm2.dot(e.vNorm3)?1:-1)},"JU.T3,JU.T3,JU.T3,JU.T3,JS.VTemp,~B");m(c$,"toString",function(){for(var a="(."+"__dat".charAt(this.type)+this.index+":"+JU.PT.toJSON(null,this.minmax)+
") for",b=0;b<this.type;b++)a+=" "+(b>=this.nPoints?"?":""+this.indices[b]);return a});P(c$,"TYPES","__dat","radiansPerDegree",0.017453292519943295)});F("JS");z(["java.util.Hashtable"],"JS.SmilesParser","java.lang.Character $.Float JU.Lst $.PT $.SB JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesSearch $.SmilesStereo JU.Elements $.Logger".split(" "),function(){c$=I(function(){this.htMeasures=this.connections=null;this.flags=0;this.isBioSequence=this.isSmarts=!1;this.bioType=
"\x00";this.componentParenCount=this.componentCount=this.branchLevel=this.braceCount=0;this.ignoreStereochemistry=!1;this.bondDirectionPaired=!0;this.isTarget=!1;H(this,arguments)},JS,"SmilesParser");N(c$,function(){this.connections=new java.util.Hashtable;this.htMeasures=new java.util.Hashtable});c$.newSearch=g(c$,"newSearch",function(a,b,c){return(new JS.SmilesParser(b,c)).parse(a)},"~S,~B,~B");M(c$,function(a,b){this.isSmarts=a;this.isTarget=b},"~B,~B");g(c$,"parse",function(a){if(null==a)throw new JS.InvalidSmilesException("expression must not be null");
var b=new JS.SmilesSearch;this.isSmarts&&!this.isTarget&&(b.pattern0=a);0<=a.indexOf("$(select")&&(a=this.parseNested(b,a,"select"));var c=x(1,0);a=JS.SmilesParser.extractFlags(a,c);this.flags=c[0];b.setFlags(this.flags);0<=a.indexOf("$")&&(a=this.parseVariables(a));this.isSmarts&&0<=a.indexOf("[$")&&(a=this.parseVariableLength(a));if(0>a.indexOf("||"))return this.getSubsearch(b,a,this.flags);a=JU.PT.split(a,"||");c="";b.subSearches=Array(a.length);for(var d=0;d<a.length;d++){var e="|"+a[d]+"|";0>
c.indexOf(e)&&(b.subSearches[d]=this.getSubsearch(b,a[d],this.flags),c+=e)}return b},"~S");g(c$,"parseVariableLength",function(a){for(var b=new JU.SB,c=a.length-1,d=0,e=!1,f=0;f<c;f++)switch(a.charAt(f)){case "(":d++;break;case ")":d--;break;case "|":0<d&&(e=!0,"|"==a.charAt(f+1)&&(a=a.substring(0,f)+a.substring(f+1),c--))}if(0<=a.indexOf("||")){c=JU.PT.split(a,"||");for(f=0;f<c.length;f++)b.append("||").append(this.parseVariableLength(c[f]))}else{c=-1;d=x(1,0);for(f=null;0<=(c=a.indexOf("[$",c+1));){var h=
c,j=-2147483648,k=-2147483648,c=JS.SmilesParser.getDigits(a,c+2,d),j=d[0];-2147483648!=j&&"-"==JS.SmilesParser.getChar(a,c)&&(c=JS.SmilesParser.getDigits(a,c+1,d),k=d[0]);if("("==JS.SmilesParser.getChar(a,c)&&(f=JS.SmilesParser.getSubPattern(a,h,"["),f.endsWith(")"))){var g=h+f.length+2,n=JS.SmilesParser.getSubPattern(a,c,"("),l=c;JS.SmilesParser.getSubPattern(a,c,"[");c+=1+n.length;if(0<=n.indexOf(":")&&0>n.indexOf("|")){for(var r=0,p=n.length,m=-1,f=0;f<p;f++)switch(n.charAt(f)){case "[":case "(":r++;
break;case ")":case "]":r--;break;case ".":0<=m&&0==r&&(p=f);break;case ":":0>m&&0==r&&(m=f)}0<m&&(n=n.substring(0,m)+"("+n.substring(m,p)+")"+n.substring(p))}if(-2147483648==j){if(f=n.indexOf("|"),0<=f)return this.parseVariableLength(a.substring(0,h)+"[$1"+a.substring(l,l+f+1)+")]"+a.substring(g)+"||"+a.substring(0,h)+"[$1("+a.substring(l+f+2)+a.substring(g))}else{-2147483648==k&&(k=j);0<=n.indexOf("|")&&(n="[$("+n+")]");for(f=j;f<=k;f++){j=new JU.SB;j.append("||").append(a.substring(0,h));for(l=
0;l<f;l++)j.append(n);j.append(a.substring(g));b.appendSB(j)}}}}}return e?this.parseVariableLength(b.substring(2)):2>b.length()?a:b.substring(2)},"~S");g(c$,"getSubsearch",function(a,b,c){this.htMeasures=new java.util.Hashtable;var d=new JS.SmilesSearch;d.setTop(a);d.isSmarts=this.isSmarts;d.pattern=b;d.pattern0=a.pattern0;d.setFlags(c);0<=b.indexOf("$(")&&(b=this.parseNested(d,b,""));this.parseSmiles(d,b,null,!1);if(0!=this.braceCount)throw new JS.InvalidSmilesException("unmatched '{'");if(!this.connections.isEmpty())throw new JS.InvalidSmilesException("Open connection");
d.set();if(this.isSmarts)for(a=d.ac;0<=--a;)this.checkNested(d,d.patternAtoms[a],c);else this.isBioSequence||(d.elementCounts[1]=d.getMissingHydrogenCount());!this.ignoreStereochemistry&&!this.isTarget&&this.fixChirality(d);return d},"JS.SmilesSearch,~S,~N");g(c$,"checkNested",function(a,b,c){if(0<b.iNested){var d=a.getNested(b.iNested);if(K(d,String)){if(d.startsWith("select"))return;"~"!=d.charAt(0)&&"\x00"!=b.bioType&&(d="~"+b.bioType+"~"+d);d=this.getSubsearch(a,d,c);0<d.ac&&d.patternAtoms[0].selected&&
(b.selected=!0);a.setNested(b.iNested,d)}}for(d=0;d<b.nSubAtoms;d++)this.checkNested(a,b.subAtoms[d],c)},"JS.SmilesSearch,JS.SmilesAtom,~N");g(c$,"fixChirality",function(a){for(var b=a.ac;0<=--b;){var c=a.patternAtoms[b];null!=c.stereo&&c.stereo.fixStereo(c)}},"JS.SmilesSearch");g(c$,"parseSmiles",function(a,b,c,d){var e=x(1,0),f=0,h,j=null,k=!1;a:for(;null!=b&&0!=b.length;){var g=0;null==c&&(g=this.checkBioType(b,0),g==b.length&&(b+="*"),this.isBioSequence&&(a.needAromatic=a.top.needAromatic=!1));
h=JS.SmilesParser.getChar(b,g);var n=this.checkBrace(a,h,"{");n&&(h=JS.SmilesParser.getChar(b,++g));if("("==h)if(j=JS.SmilesParser.getSubPattern(b,g,"("),h="."==JS.SmilesParser.getChar(b,g+1),null==c){if(h||!this.isSmarts)throw new JS.InvalidSmilesException("No previous atom for measure");a.haveComponents=!0;do this.componentCount++,this.componentParenCount++,h=JS.SmilesParser.getChar(b=b.substring(1),0);while("("==h);if(!n&&!0==(n=this.checkBrace(a,h,"{")))h=JS.SmilesParser.getChar(b=b.substring(1),
0)}else k=!1,j.startsWith(".")?(this.parseMeasure(a,j.substring(1),c),k=!0):0==j.length&&this.isBioSequence?c.notCrossLinked=!0:(this.branchLevel++,this.parseSmiles(a,j,c,!0),this.branchLevel--),g=j.length+2,h=JS.SmilesParser.getChar(b,g),"}"==h&&this.checkBrace(a,h,"}")&&g++,h="\x00";if("\x00"!=h){f=g;b:for(;"\x00"!=h;){switch(JS.SmilesBond.isBondType(h,this.isSmarts,this.isBioSequence)){case 0:break b;case -1:if(!((JU.PT.isDigit(JS.SmilesParser.getChar(b,++g))&&0<g++?JU.PT.isDigit(JS.SmilesParser.getChar(b,
g++)):1)&&"-"==(h=JS.SmilesParser.getChar(b,g))))throw new JS.InvalidSmilesException("malformed atropisomerism bond ^nn-  or ^^nn-");continue}h=JS.SmilesParser.getChar(b,++g)}h=JS.SmilesParser.getChar(b,g);if(")"==h){switch(JS.SmilesParser.getChar(b,++g)){case "\x00":case ")":case ".":if(b=b.substring(g),this.componentParenCount--,0<=this.componentParenCount)continue a}throw new JS.InvalidSmilesException("invalid continuation after component grouping (SMARTS).(SMARTS)");}j=this.parseBond(a,null,b.substring(f,
g),null,c,!1,d,g-f,e);n&&-1!=j.order&&(h=JS.SmilesParser.getChar(b,g=f));this.checkBrace(a,h,"{")&&(h=JS.SmilesParser.getChar(b,++g));switch(h){case "~":0==j.order&&(g=this.checkBioType(b,g),g==b.length&&(b+="*"));break;case "(":do this.componentCount++,this.componentParenCount++,h=JS.SmilesParser.getChar(b,++g);while("("==h);break;case "\x00":if(0==j.order)return}n=JU.PT.isDigit(h)||"%"==h;f=!n&&("_"==h||"["==h||"*"==h||JU.PT.isLetter(h));if(n){if(k)throw new JS.InvalidSmilesException("connection number must immediately follow its connecting atom");
g=JS.SmilesParser.getRingNumber(b,g,h,e);this.parseConnection(a,e[0],c,j)}else if(f)switch(k=!1,h){case "[":case "_":n=JS.SmilesParser.getSubPattern(b,g,h);g+=n.length+("["==h?2:0);this.isBioSequence&&("["==h&&0>n.indexOf(".")&&0>n.indexOf("_"))&&(n+=".0");c=this.parseAtom(a,null,n,c,j,"["==h,!1,d);c.hasSubpattern=!0;-1!=j.order&&0!=j.order&&this.setBondAtom(j,null,c,a);break;default:n=!this.isBioSequence&&JU.PT.isUpperCase(h)?JS.SmilesParser.getChar(b,g+1):"\x00";if("X"!=h||"x"!=n)if(!JU.PT.isLowerCase(n)||
0==JU.Elements.elementNumberFromSymbol(b.substring(g,g+2),!0))n="\x00";"\x00"!=n&&0<="NA CA BA PA SC AC Na Ca Ba Pa Sc Ac".indexOf(b.substring(g,g+2))&&(n="\x00");h=JU.PT.isUpperCase(h)&&JU.PT.isLowerCase(n)?2:1;c=this.parseAtom(a,null,b.substring(g,g+h),c,j,!1,!1,d);g+=h}else throw new JS.InvalidSmilesException("Unexpected character: "+JS.SmilesParser.getChar(b,g));h=JS.SmilesParser.getChar(b,g);"}"==h&&this.checkBrace(a,h,"}")&&g++}b=b.substring(g);d=!1}},"JS.SmilesSearch,~S,JS.SmilesAtom,~B");
g(c$,"parseConnection",function(a,b,c,d){b=Integer.$valueOf(b);var e=this.connections.get(b);if(null==e)this.connections.put(b,d),a.target.ringCount++;else{this.connections.remove(b);switch(d.order){case -1:d.order=-1!=e.order?e.order:this.isSmarts||c.isAromatic&&e.atom1.isAromatic?81:1;break;case 1025:d.order=1041;break;case 1041:d.order=1025}if(-1!=e.order&&e.order!=d.order||c===e.atom1||null!=e.atom1.getBondTo(c))throw new JS.InvalidSmilesException("Bad connection type or atom");e.set(d);c.bondCount--;
e.setAtom2(c,a)}},"JS.SmilesSearch,~N,JS.SmilesAtom,JS.SmilesBond");g(c$,"setBondAtom",function(a,b,c,d){a.set2a(b,c);null!=d&&(2==a.order&&null!=a.atom1&&null!=a.atom2&&a.atom1.isAromatic&&a.atom2.isAromatic&&0==(this.flags&512))&&d.setFlags(this.flags|=512)},"JS.SmilesBond,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesSearch");c$.getRingNumber=g(c$,"getRingNumber",function(a,b,c,d){switch(c){case "%":if("("==JS.SmilesParser.getChar(a,b+1)){if(a=JS.SmilesParser.getSubPattern(a,b+1,"("),JS.SmilesParser.getDigits(a,
0,d),b+=a.length+3,0>d[0])throw new JS.InvalidSmilesException("Invalid number designation: "+a);}else if(b+3<=a.length&&(b=JS.SmilesParser.getDigits(a.substring(0,b+3),b+1,d)),10>d[0])throw new JS.InvalidSmilesException("Two digits must follow the % sign");a=d[0];break;default:a=c.charCodeAt(0)-48,b++}d[0]=a;return b},"~S,~N,~S,~A");g(c$,"checkBioType",function(a,b){if(this.isBioSequence="~"==a.charAt(b)){b++;this.bioType="*";var c=JS.SmilesParser.getChar(a,2);if("~"==c&&("*"==(c=a.charAt(1))||JU.PT.isLowerCase(c)))this.bioType=
c,b=3}return b},"~S,~N");g(c$,"parseMeasure",function(a,b,c){for(var d=b.indexOf(":"),e=0>d?b:b.substring(0,d);0!=d;){var f=e.length;1==f&&(e+="0");var h=this.htMeasures.get(e);if(null==h==0>d||0==f)break;try{if(0<d){var j="__dat".indexOf(e.charAt(0));if(2>j)break;var g=x(1,0);JS.SmilesParser.getDigits(e,1,g);var s=g[0];b=b.substring(d+1);var n=b.startsWith("!");n&&(b=b.substring(1));var l=b.startsWith("-");l&&(b=b.substring(1));b=JU.PT.rep(b,"-",",");b=JU.PT.rep(b,",,",",-");l&&(b="-"+b);var m=JU.PT.split(b,
",");if(1==m.length%2||n&&2!=m.length)break;for(var p=R(m.length,0),t=m.length;0<=--t&&!Float.isNaN(p[t]=Float.parseFloat(m[t])););if(0<=t)break;h=new JS.SmilesMeasure(a,s,j,n,p);a.measures.addLast(h);0<s?this.htMeasures.put(e,h):0==s&&JU.Logger.debugging&&JU.Logger.debug("measure created: "+h)}else{if(!h.addPoint(c.index))break;h.nPoints==h.type&&(this.htMeasures.remove(e),JU.Logger.debugging&&JU.Logger.debug("measure created: "+h));return}if(!h.addPoint(c.index))break}catch(q){if(G(q,NumberFormatException))break;
else throw q;}return}throw new JS.InvalidSmilesException("invalid measure: "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom");g(c$,"checkBrace",function(a,b,c){switch(b){case "{":if(b!=c)break;this.braceCount++;return a.top.haveSelected=!0;case "}":if(b!=c)break;if(0<this.braceCount)return this.braceCount--,!0;break;default:return!1}throw new JS.InvalidSmilesException("Unmatched '}'");},"JS.SmilesSearch,~S,~S");g(c$,"parseNested",function(a,b,c){var d;for(c="$("+c;0<=(d=b.lastIndexOf(c));){var e=JS.SmilesParser.getSubPattern(b,
d+1,"("),f=d+e.length+3,h=b.substring(f);b=b.substring(0,d);var j="";if(b.endsWith("]"))throw new JS.InvalidSmilesException("$(...) must be enclosed in brackets: "+b+"$("+e+")");if(1<d&&2==c.length&&1<(f=b.length)&&0>",;&![".indexOf(b.substring(f-1)))j="&";1<h.length&&0>",;&!)]".indexOf(h.charAt(0))&&(h="&"+h);b=b+j+"_"+a.top.addNested(e)+"_"+h}return b},"JS.SmilesSearch,~S,~S");g(c$,"parseVariables",function(a){var b=new JU.Lst,c=new JU.Lst,d,e=0,f=-1;for(JU.Logger.debugging&&JU.Logger.info(a);0<=
(d=a.indexOf("$",e))&&"("!=JS.SmilesParser.getChar(a,d+1);){e=JS.SmilesParser.skipTo(a,d,"=");if(e<=d+1||'"'!=JS.SmilesParser.getChar(a,e+1))break;d=a.substring(d,e);if(0<d.lastIndexOf("$")||0<d.indexOf("]"))throw new JS.InvalidSmilesException("Invalid variable name: "+d);f=JS.SmilesParser.getSubPattern(a,e+1,'"');b.addLast("["+d+"]");c.addLast(f);e+=f.length+2;e=JS.SmilesParser.skipTo(a,e,";");f=++e}if(0>f)return a;a=a.substring(f);for(e=b.size();0<=--e;)d=b.get(e),f=c.get(e),f.equals(d)||(a=JU.PT.rep(a,
d,f));JU.Logger.debugging&&JU.Logger.info(a);return a},"~S");g(c$,"parseAtom",function(a,b,c,d,e,f,h,j){if(null==c||0==c.length)throw new JS.InvalidSmilesException("Empty atom definition");var g=new JS.SmilesAtom;0<this.componentParenCount&&(g.component=this.componentCount);null==b&&a.appendAtom(g);if(!this.checkLogic(a,c,g,null,d,h,j,null)){var m=x(1,0);this.isBioSequence&&1==c.length&&(c+=".0");var n=c.charAt(0),l=0,r=!1;if(this.isSmarts&&"!"==n){n=JS.SmilesParser.getChar(c,++l);if("\x00"==n)throw new JS.InvalidSmilesException("invalid '!'");
g.not=r=!0}var p=0<=c.indexOf("@PH")?-1:c.indexOf(".");if(0<=p){g.isBioResidue=!0;var t=c.substring(l,p);c=c.substring(p+1).toUpperCase();var q=t.length;if(0<=(p=t.indexOf("^")))p==q-2&&(n=t.charAt(q-1),"*"!=n&&(g.insCode=n)),t=t.substring(0,p);if(0<=(p=t.indexOf("#")))JS.SmilesParser.getDigits(t,p+1,m),g.residueNumber=m[0],t=t.substring(0,p);0==t.length&&(t="*");1<t.length?g.residueName=t.toUpperCase():t.equals("*")||(g.residueChar=t);t=c;if(0<=(p=t.indexOf("#")))JS.SmilesParser.getDigits(t,p+1,
m),g.elementNumber=m[0],t=t.substring(0,p);0==t.length?t="*":t.equals("0")&&(t="\x00");t.equals("*")?g.isBioAtomWild=!0:g.setAtomName(t);n="\x00"}g.setBioAtom(this.bioType);for(p=-2147483648;"\x00"!=n;){g.setAtomName(this.isBioSequence?"\x00":"");if(JU.PT.isDigit(n)){l=JS.SmilesParser.getDigits(c,l,m);n=m[0];if(-2147483648==n)throw new JS.InvalidSmilesException("Non numeric atomic mass");"?"==JS.SmilesParser.getChar(c,l)&&(l++,n=-n);if(g.elementDefined)throw new JS.InvalidSmilesException('atom mass must precede atom symbol or be separated from it with ";"');
g.setAtomicMass(n)}else switch(n){case '"':n=JU.PT.getQuotedStringAt(c,l);l+=n.length+2;g.atomType=n;break;case "_":l=JS.SmilesParser.getDigits(c,l+1,m)+1;if(-2147483648==m[0])throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(l));g.iNested=m[0];if(!f)throw new JS.InvalidSmilesException("nesting must appear in [...]: $("+a.getNested(m[0])+")");if(this.isBioSequence&&l!=c.length)throw new JS.InvalidSmilesException("invalid characters: "+c.substring(l));break;case "=":l=JS.SmilesParser.getDigits(c,
l+1,m);g.jmolIndex=m[0];break;case "#":n="-"==c.charAt(l+1);l=JS.SmilesParser.getDigits(c,l+(n?2:1),m);n?g.atomNumber=m[0]:g.elementNumber=m[0];break;case "-":case "+":l=this.checkCharge(c,l,g);break;case "@":null==a.stereo&&(a.stereo=JS.SmilesStereo.newStereo(a));l=JS.SmilesStereo.checkChirality(a,c,l,a.patternAtoms[g.index]);break;case ":":l=JS.SmilesParser.getDigits(c,++l,m);if(-2147483648==m[0])throw new JS.InvalidSmilesException("Invalid atom class");g.atomClass=m[0];break;default:var t=JS.SmilesParser.getChar(c,
l+1),q=l+(JU.PT.isLowerCase(t)&&(!f||!JU.PT.isDigit(JS.SmilesParser.getChar(c,l+2)))?2:1),z=c.substring(l+1,q),w=Character.toUpperCase(n)+z,u=!0;f&&JU.PT.isLetter(n)&&(!r&&(h?b:g).hasSymbol?u=!1:"H"==n?u=1==c.length||!JU.PT.isDigit(t):JU.PT.isDigit(t)?u=!1:!w.equals("A")&&!w.equals("Xx")&&(u=("h"==n?2==q:!0)&&0<JU.Elements.elementNumberFromSymbol(w,!0),!u&&2==q&&(z="",w=w.substring(0,1),u=0<JU.Elements.elementNumberFromSymbol(w,!0))));if(u){if(!f&&!this.isSmarts&&!this.isBioSequence&&!JS.SmilesAtom.allowSmilesUnbracketed(w)||
!g.setSymbol(w=n+z))throw new JS.InvalidSmilesException("Invalid atom symbol: "+w);h&&(b.hasSymbol=!0);l+=w.length}else switch(l=JS.SmilesParser.getDigits(c,l+1,m),q=m[0],n){default:throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(l));case "D":g.setDegree(-2147483648==q?1:q);break;case "d":g.setNonhydrogenDegree(-2147483648==q?1:q);break;case "H":p=-2147483648==q?1:q;break;case "h":g.setImplicitHydrogenCount(-2147483648==q?-1:q);break;case "R":-2147483648==q&&(q=-1);g.setRingMembership(q);
a.top.needRingData=!0;break;case "r":if(-2147483648==q)q=-1,g.setRingMembership(q);else{g.setRingSize(q);switch(q){case 500:q=5;break;case 600:q=6}q>a.ringDataMax&&(a.ringDataMax=q)}a.top.needRingData=!0;break;case "v":g.setValence(-2147483648==q?1:q);break;case "X":g.setConnectivity(-2147483648==q?1:q);break;case "x":g.setRingConnectivity(-2147483648==q?-1:q),a.top.needRingData=!0}}n=JS.SmilesParser.getChar(c,l);if(r&&"\x00"!=n)throw new JS.InvalidSmilesException("'!' may only involve one primitive.");
}-2147483648==p&&f&&(p=-2147483647);g.setExplicitHydrogenCount(p);a.patternAtoms[g.index].setExplicitHydrogenCount(p)}0<this.braceCount&&(g.selected=!0);null!=b&&b.addSubAtom(g,h);null!=d&&0==e.order&&(g.notBondedIndex=d.index);null!=d&&0!=e.order&&(-1==e.order&&(e.order=this.isBioSequence&&j?112:this.isSmarts||d.isAromatic&&g.isAromatic?81:1),f||this.setBondAtom(e,null,g,a),0==this.branchLevel&&(17==e.getBondType()||112==e.order)&&this.branchLevel++);0==this.branchLevel&&(a.lastChainAtom=g);return g},
"JS.SmilesSearch,JS.SmilesAtom,~S,JS.SmilesAtom,JS.SmilesBond,~B,~B,~B");g(c$,"checkCharge",function(a,b,c){var d=a.length,e=a.charAt(b),f=1;++b;if(b<d){var h=a.charAt(b);if(JU.PT.isDigit(h)){if(d=x(1,0),b=JS.SmilesParser.getDigits(a,b,d),f=d[0],-2147483648==f)throw new JS.InvalidSmilesException("Non numeric charge");}else for(;b<d&&a.charAt(b)==e;)b++,f++}c.setCharge("+"==e?f:-f);return b},"~S,~N,JS.SmilesAtom");g(c$,"parseBond",function(a,b,c,d,e,f,h,g,k){var m;if(0<g)switch(m=c.charAt(0)){case ">":if(!c.equals(">>")){g=
-1;break}case ".":if(null==d&&null==b)return this.isBioSequence="~"==JS.SmilesParser.getChar(c,1),new JS.SmilesBond(null,null,0,!1);g=-1;break;case "+":null!=b&&(g=-1)}else m="\x00";d=null==b?null==d?new JS.SmilesBond(e,null,this.isBioSequence&&null!=e?h?112:96:-1,!1):d:f?b.addPrimitive():b.addBondOr();if(0<g&&!this.checkLogic(a,c,null,d,e,f,!1,k)){if(f="!"==m)if(m=JS.SmilesParser.getChar(c,1),"\x00"==m||"!"==m)throw new JS.InvalidSmilesException("invalid '!'");h=JS.SmilesBond.getBondTypeFromCode(m);
65==h&&(a.top.needRingMemberships=!0);if(null==e&&0!=h)throw new JS.InvalidSmilesException("Bond without a previous atom");switch(h){case 65537:case 65538:(g=c.length)<(f?3:2)||"-"!=c.charAt(g-1)?g=0:g==(f?3:2)?d.setAtropType(22):(JS.SmilesParser.getDigits(c,f?2:1,k),d.setAtropType(k[0]));a.haveBondStereochemistry=!0;break;case 1025:case 1041:this.bondDirectionPaired=!this.bondDirectionPaired;a.haveBondStereochemistry=!0;break;case 2:a.top.nDouble++;case 1:e.isAromatic&&(a.top.needRingData=!0)}d.set2(h,
f);this.isBioSequence&&null!=b&&b.set2(h,f)}if(-1==g)throw new JS.InvalidSmilesException("invalid bond:"+m);return d},"JS.SmilesSearch,JS.SmilesBond,~S,JS.SmilesBond,JS.SmilesAtom,~B,~B,~N,~A");g(c$,"checkLogic",function(a,b,c,d,e,f,g,j){var k=b.lastIndexOf("!");null!=c&&(c.pattern=b);for(;0<k;)0>",;&!(".indexOf(b.charAt(k-1))&&(b=b.substring(0,k)+"&"+b.substring(k)),k=b.lastIndexOf("!",k-1);var k=b.indexOf(","),m=b.length,n="&";a:for(;;){var l=0<k;if(l&&!this.isSmarts||0==k)break;k=b.indexOf(";");
if(0<=k){if(!this.isSmarts||0==k)break;l?(n=";",l=!1):b=b.$replace(";","&")}var r=0;if(l)for(b+=",";0<(k=b.indexOf(",",r))&&k<=m;){r=b.substring(r,k);if(0==r.length)throw new JS.InvalidSmilesException("missing "+(null==d?"atom":"bond")+" token");null==d?this.parseAtom(a,c,r,null,null,!0,!1,g):this.parseBond(a,d,r,null,e,!1,!1,r.length,j);r=k+1}else if(0<=(k=b.indexOf(n))||null!=d&&1<m&&!f){if(0==k||null==d&&!this.isSmarts)break;if(null!=d&&0>k&&1<m){f=new JU.SB;for(l=0;l<m;){var p=b.charAt(l++);f.appendC(p);
switch(p){case "!":if(!this.isSmarts)break a;continue;case "^":case "`":for(;"-"!=(p=b.charAt(l++))&&"\x00"!=p;)f.appendC(p);f.appendC("-")}if(l<m){if(!this.isSmarts)break a;f.append(n)}}b=f.toString();m=b.length}for(b+=n;0<(k=b.indexOf(n,r))&&k<=m;)r=b.substring(r,k),null==d?this.parseAtom(a,c,r,null,null,!0,!0,g):this.parseBond(a,this.isSmarts?d:null,r,this.isSmarts?null:d,e,!0,!1,r.length,j),r=k+1}else return!1;return!0}p=b.charAt(k);throw new JS.InvalidSmilesException((this.isSmarts?"invalid placement for '"+
p+"'":"["+p+"] notation only valid with SMARTS, not SMILES,")+" in "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom,JS.SmilesBond,JS.SmilesAtom,~B,~B,~A");c$.getSubPattern=g(c$,"getSubPattern",function(a,b,c){var d,e=1;switch(c){case "[":d="]";break;case '"':case "%":case "/":d=c;break;case "(":d=")";break;default:d=c,e=0}for(var f=a.length,g=1,j=b+1;j<f;j++){var k=a.charAt(j);if(k==d){if(g--,0==g)return a.substring(b+e,j+1-e)}else k==c&&g++}throw new JS.InvalidSmilesException("Unmatched "+c);},"~S,~N,~S");
c$.getChar=g(c$,"getChar",function(a,b){return b<a.length?a.charAt(b):"\x00"},"~S,~N");c$.getDigits=g(c$,"getDigits",function(a,b,c){for(var d=b,e=a.length;d<e&&JU.PT.isDigit(a.charAt(d));)d++;if(d>b)try{return c[0]=Integer.parseInt(a.substring(b,d)),d}catch(f){if(!G(f,NumberFormatException))throw f;}c[0]=-2147483648;return d},"~S,~N,~A");c$.skipTo=g(c$,"skipTo",function(a,b,c){for(var d;(d=JS.SmilesParser.getChar(a,++b))!=c&&"\x00"!=d;);return"\x00"==d?-1:b},"~S,~N,~S");c$.cleanPattern=g(c$,"cleanPattern",
function(a){a=JU.PT.replaceAllCharacters(a," \t\n\r","");a=JU.PT.rep(a,"^^","`");for(var b=0,c=0;0<=(b=a.indexOf("//*"))&&(c=a.indexOf("*//"))>=b;)a=a.substring(0,b)+a.substring(c+3);return a=JU.PT.rep(a,"//","")},"~S");c$.extractFlags=g(c$,"extractFlags",function(a,b){a=JS.SmilesParser.cleanPattern(a);for(var c=0;a.startsWith("/");){var d=JS.SmilesParser.getSubPattern(a,0,"/").toUpperCase();a=a.substring(d.length+2);c=JS.SmilesSearch.addFlags(c,d)}b[0]=c;return a},"~S,~A");c$.getFlags=g(c$,"getFlags",
function(a){var b=x(1,0);JS.SmilesParser.extractFlags(a,b);return b[0]},"~S")});F("JS");z(null,"JS.SmilesExt","java.lang.Float JU.AU $.BS $.Lst $.M4 $.Measure $.P3 J.api.Interface JU.Logger".split(" "),function(){c$=I(function(){this.e=null;H(this,arguments)},JS,"SmilesExt");M(c$,function(){});g(c$,"init",function(a){this.e=a;return this},"~O");g(c$,"getSmilesCorrelation",function(a,b,c,d,e,f,g,j,k,m,n,l){var r=null==k?0.1:3.4028235E38;try{null==d&&(d=new JU.Lst,e=new JU.Lst);var p=new JU.M4,t=new JU.P3,
q=this.e.vwr.ms.at,x=this.e.vwr.ms.ac,w=this.e.vwr.getSmilesMatcher(),u=w.getCorrelationMaps(c,q,x,a,l|8);null==u&&this.e.evalError(w.getLastException(),null);if(0==u.length)return NaN;var z=u[0];for(a=0;a<z.length;a++)d.addLast(q[z[a]]);u=w.getCorrelationMaps(c,q,x,b,l);null==u&&this.e.evalError(w.getLastException(),null);if(0==u.length)return NaN;JU.Logger.info(u.length+" mappings found");if(n||!j){b=3.4028235E38;c=null;for(a=0;a<u.length;a++){e.clear();for(var v=0;v<u[a].length;v++)e.addLast(q[u[a][v]]);
J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");var A=1==e.size()?0:JU.Measure.getTransformMatrix4(d,e,p,null);JU.Logger.info("getSmilesCorrelation stddev="+A);if(null!=g&&A<r){for(var y=new JU.BS,v=0;v<u[a].length;v++)y.set(u[a][v]);g.addLast(y)}A<b&&(c=u[a],null!=f&&f.setM4(p),null!=m&&m.setT(t),b=A)}null!=k&&(k[0]=z,k[1]=c);e.clear();for(a=0;a<c.length;a++)e.addLast(q[c[a]]);return b}for(a=0;a<u.length;a++)for(v=0;v<u[a].length;v++)e.addLast(q[u[a][v]])}catch(C){if(G(C,Exception))this.e.evalError(C.getMessage(),
null);else throw C;}return 0},"JU.BS,JU.BS,~S,JU.Lst,JU.Lst,JU.M4,JU.Lst,~B,~A,JU.P3,~B,~N");g(c$,"getSmilesMatches",function(a,b,c,d,e,f,g){if(0==a.length||a.endsWith("///")||a.equals("H")||a.equals("H2")||a.equals("top")||a.equalsIgnoreCase("NOAROMATIC"))try{return this.e.vwr.getSmilesOpt(c,0,0,e|(a.equals("H2")?8192:0)|(a.equals("H")?4096:0)|(a.equals("top")?16384:0)|(a.equalsIgnoreCase("NOAROMATIC")?16:0),a.endsWith("///")?a:null)}catch(j){if(G(j,Exception))this.e.evalError(j.getMessage(),null);
else throw j;}var k;if(null==d)try{if(null==b)k=this.e.vwr.getSubstructureSetArray(a,c,e);else{if(a.equals("chirality"))return this.e.vwr.calculateChiralityForSmiles(b);k=2==(e&2);e=(k?2:1)|(g?8:0)|(16384==(e&16384)?16384:0);if(!K(b,String))return this.e.vwr.getSmilesMatcher().hasStructure(a,b,e);var m=this.e.vwr.getSmilesMatcher().find(a,b,e);if(!f)return!g?m:0==m.length?x(0,0):m[0];var n=new JU.BS;for(f=0;f<m.length;f++)for(var l=m[f],r=l.length;0<=--r;)0<=l[r]&&n.set(l[r]);if(!k)return x(n.cardinality(),
0);var p=x(n.cardinality(),0);f=0;for(var t=n.nextSetBit(0);0<=t;t=n.nextSetBit(t+1))p[f++]=t;return p}}catch(q){if(G(q,Exception))return this.e.evalError(q.getMessage(),null),null;throw q;}else{n=new JU.Lst;p=this.getSmilesCorrelation(d,c,a,null,null,null,n,!1,null,null,!1,e);if(Float.isNaN(p))return f?new JU.BS:O(-1,[]);this.e.showString("RMSD "+p+" Angstroms");k=n.toArray(Array(n.size()))}if(f){n=new JU.BS;for(f=0;f<k.length;f++)n.or(k[f]);return n}n=new JU.Lst;for(f=0;f<k.length;f++)n.addLast(k[f]);
return n},"~S,~O,JU.BS,JU.BS,~N,~B,~B");g(c$,"getFlexFitList",function(a,b,c,d){var e=JU.AU.newInt2(2);this.getSmilesCorrelation(a,b,c,null,null,null,null,!1,e,null,!1,d?2:1);if(null==e[0])return null;a=this.e.vwr.ms.getDihedralMap(e[0]);b=null==a?null:this.e.vwr.ms.getDihedralMap(e[1]);if(null==b||b.length!=a.length)return null;e=R(a.length,3,0);c=this.e.vwr.ms.at;JS.SmilesExt.getTorsions(c,b,e,0);JS.SmilesExt.getTorsions(c,a,e,1);b=R(6*a.length,0);for(d=c=0;c<a.length;c++){var f=a[c];b[d++]=f[0];
b[d++]=f[1];b[d++]=f[2];b[d++]=f[3];b[d++]=e[c][0];b[d++]=e[c][1]}return b},"JU.BS,JU.BS,~S,~B");c$.getTorsions=g(c$,"getTorsions",function(a,b,c,d){for(var e=b.length;0<=--e;){var f=b[e],f=JU.Measure.computeTorsion(a[f[0]],a[f[1]],a[f[2]],a[f[3]],!0);1==d&&(180<f-c[e][0]?f-=360:-180>=f-c[e][0]&&(f+=360));c[e][d]=f}},"~A,~A,~A,~N");g(c$,"mapPolyhedra",function(a,b,c,d){var e=new JU.Lst,f=new JU.Lst,g;g=O(-1,[Integer.$valueOf(a),null]);this.e.getShapePropertyData(21,"syminfo",g);a=g[1];g[0]=Integer.$valueOf(b);
g[1]=null;this.e.getShapePropertyData(21,"syminfo",g);b=g[1];if(null==a||null==b)return NaN;g=a.get("polySmiles");var j=b.get("polySmiles");c=this.getSmilesMatches(j,g,null,null,c?1:16385,!1,!0);if(0==c.length)return NaN;e.addLast(a.get("center"));a=a.get("vertices");g=0;for(j=a.length;g<j;g++)e.add(a[c[g+1]-1]);f.addLast(b.get("center"));a=b.get("vertices");g=0;for(j=a.length;g<j;g++)f.add(a[g]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");return JU.Measure.getTransformMatrix4(e,
f,d,null)},"~N,~N,~B,JU.M4")})})(Clazz,Clazz.getClassName,Clazz.newLongArray,Clazz.doubleToByte,Clazz.doubleToInt,Clazz.doubleToLong,Clazz.declarePackage,Clazz.instanceOf,Clazz.load,Clazz.instantialize,Clazz.decorateAsClass,Clazz.floatToInt,Clazz.floatToLong,Clazz.makeConstructor,Clazz.defineEnumConstant,Clazz.exceptionOf,Clazz.newIntArray,Clazz.defineStatics,Clazz.newFloatArray,Clazz.declareType,Clazz.prepareFields,Clazz.superConstructor,Clazz.newByteArray,Clazz.declareInterface,Clazz.p0p,Clazz.pu$h,
Clazz.newShortArray,Clazz.innerTypeInstance,Clazz.isClassDefined,Clazz.prepareCallback,Clazz.newArray,Clazz.castNullAs,Clazz.floatToShort,Clazz.superCall,Clazz.decorateAsType,Clazz.newBooleanArray,Clazz.newCharArray,Clazz.implementOf,Clazz.newDoubleArray,Clazz.overrideConstructor,Clazz.clone,Clazz.doubleToShort,Clazz.getInheritedLevel,Clazz.getParamsType,Clazz.isAF,Clazz.isAB,Clazz.isAI,Clazz.isAS,Clazz.isASS,Clazz.isAP,Clazz.isAFloat,Clazz.isAII,Clazz.isAFF,Clazz.isAFFF,Clazz.tryToSearchAndExecute,
Clazz.getStackTrace,Clazz.inheritArgs,Clazz.alert,Clazz.defineMethod,Clazz.overrideMethod,Clazz.declareAnonymous,Clazz.cloneFinals);
