(function(U,V,W,X,R,Y,C,N,A,D,G,S,Z,H,$,F,v,K,P,Q,L,O,aa,T,ba,ca,da,ea,fa,ga,M,ha,ia,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,j,n){C("JS");A(["JU.BS","$.V3"],"JS.VTemp",null,function(){c$=G(function(){this.bsTemp=this.vNorm4=this.vNorm3=this.vNorm2=this.vTemp2=this.vTemp1=this.vB=this.vA=this.vTemp=null;D(this,arguments)},JS,"VTemp");L(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})});C("J.api");T(J.api,"SmilesMatcherInterface");C("JS");A(["J.api.SmilesMatcherInterface"],"JS.SmilesMatcher","JU.AU $.BS $.PT JS.InvalidSmilesException $.SmilesAtom $.SmilesBond $.SmilesGenerator $.SmilesParser $.SmilesSearch JU.BSUtil $.Elements $.Logger $.Node $.Point3fi".split(" "),function(){c$=Q(JS,"SmilesMatcher",null,J.api.SmilesMatcherInterface);n(c$,"getLastException",function(){return JS.InvalidSmilesException.getLastError()});
n(c$,"getMolecularFormula",function(a,b){JS.InvalidSmilesException.clear();var c=JS.SmilesParser.newSearch("/nostereo/"+a,b,!0);c.createTopoMap(null);c.nodes=c.targetAtoms;return c.getMolecularFormula(!b,null,!1)},"~S,~B");n(c$,"getSmiles",function(a,b,c,d,e){JS.InvalidSmilesException.clear();return(new JS.SmilesGenerator).getSmiles(this,a,b,c,d,e)},"~A,~N,JU.BS,~S,~N");n(c$,"areEqual",function(a,b){JS.InvalidSmilesException.clear();var c=this.findPriv(a,JS.SmilesParser.newSearch(b,!1,!0),(0<=a.indexOf("*")?
2:1)|8,2);return null==c?-1:c.length},"~S,~S");j(c$,"areEqualTest",function(a,b){var c=this.findPriv(a,b,9,2);return null!=c&&1==c.length},"~S,JS.SmilesSearch");n(c$,"find",function(a,b,c){JS.InvalidSmilesException.clear();b=JS.SmilesParser.cleanPattern(b);a=JS.SmilesParser.cleanPattern(a);b=JS.SmilesParser.newSearch(b,!1,!0);a=this.findPriv(a,b,c,3);for(c=a.length;0<=--c;)for(var d=a[c],e=d.length;0<=--e;)d[e]=b.targetAtoms[d[e]].mapIndex;return a},"~S,~S,~N");n(c$,"getRelationship",function(a,b){if(null==
a||null==b||0==a.length||0==b.length)return"";var c=this.getMolecularFormula(a,!1),d=this.getMolecularFormula(b,!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");n(c$,"reverseChirality",function(a){a=JU.PT.rep(a,"@@","!@");a=JU.PT.rep(a,"@","@@");return a=JU.PT.rep(a,"!@@","@")},"~S");n(c$,"getSubstructureSet",function(a,b,c,d,e){return this.matchPriv(a,b,c,d,null,!0,e|JS.SmilesParser.getFlags(a),1)},"~S,~A,~N,JU.BS,~N");n(c$,"getMMFF94AtomTypes",function(a,b,c,d,e,f){JS.InvalidSmilesException.clear();var g=new JS.SmilesParser(!0,!0),h=null,h=g.parse("");h.exitFirstMatch=
!1;h.targetAtoms=b;h.targetAtomCount=Math.abs(c);h.setSelected(d);h.flags=770;h.getRingData(f,!0,!0);h.asVector=!1;h.subSearches=Array(1);h.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(h.clear(),h.subSearches[0]=g.getSubsearch(h,JS.SmilesParser.cleanPattern(a[d]),770),f=JU.BSUtil.copy(h.search()),e.addLast(f),b.or(f),b.cardinality()==c)break},"~A,~A,~N,JU.BS,JU.Lst,~A");n(c$,"getSubstructureSetArray",function(a,b,c,
d,e,f){return this.matchPriv(a,b,c,d,e,!0,f,2)},"~S,~A,~N,JU.BS,JU.BS,~N");j(c$,"getAtropisomerKeys",function(a,b,c,d,e,f){return this.matchPriv(a,b,c,d,e,!1,f,4)},"~S,~A,~N,JU.BS,JU.BS,~N");n(c$,"polyhedronToSmiles",function(a,b,c,d,e,f){for(var g=Array(c),h=0;h<c;h++){g[h]=new JS.SmilesAtom;var m=null==d?null:d[h];N(m,JU.Node)?(g[h].elementNumber=m.getElementNumber(),g[h].bioAtomName=m.getAtomName(),g[h].atomNumber=m.getAtomNumber(),g[h].setT(m)):g[h].elementNumber=N(m,JU.Point3fi)?m.sD:-2;g[h].index=
h}m=0;for(h=b.length;0<=--h;)for(var s=b[h],k=s.length,l,j,q=k;0<=--q;)if(!((l=s[q])>=c||(j=s[(q+1)%k])>=c)&&null==g[l].getBondTo(g[j]))(new JS.SmilesBond(g[l],g[j],1,!1)).index=m++;for(h=0;h<c;h++)if(k=g[h].bondCount,0==k||k!=g[h].bonds.length)g[h].bonds=JU.AU.arrayCopyObject(g[h].bonds,k);b=null;b=new JS.SmilesGenerator;null!=d&&(b.polySmilesCenter=a);JS.InvalidSmilesException.clear();b=b.getSmiles(this,g,c,JU.BSUtil.newBitSet2(0,c),null,e|4144);65536==(e&65536)&&(b="//* "+a+" *//\t["+JU.Elements.elementSymbolFromNumber(a.getElementNumber())+
"@PH"+c+(null==f?"":"/"+f+"/")+"]."+b);return b},"JU.Node,~A,~N,~A,~N,~S");n(c$,"getCorrelationMaps",function(a,b,c,d,e){return this.matchPriv(a,b,c,d,null,!0,e,3)},"~S,~A,~N,JU.BS,~N");j(c$,"findPriv",function(a,b,c,d){var e=new JU.BS;b.setFlags(b.flags|JS.SmilesParser.getFlags(a));b.createTopoMap(e);return this.matchPriv(a,b.targetAtoms,-b.targetAtoms.length,null,e,e.isEmpty(),c,d)},"~S,JS.SmilesSearch,~N,~N");j(c$,"matchPriv",function(a,b,c,d,e,f,g,h){JS.InvalidSmilesException.clear();try{var m=
2==(g&2),s=JS.SmilesParser.newSearch(a,m,!1);!m&&!s.patternAromatic&&(null==e&&(e=new JU.BS),JS.SmilesSearch.normalizeAromaticity(s.patternAtoms,e,s.flags),s.isNormalized=!0);s.targetAtoms=b;s.targetAtomCount=Math.abs(c);0>c&&(s.haveTopo=!0);if(0!=c&&(null==d||!d.isEmpty())){var k=!N(b[0],JS.SmilesAtom);s.setSelected(d);s.getSelections();f||(s.bsAromatic=e);s.setRingData(null,null,k||f);s.exitFirstMatch=8==(g&8);s.mapUnique=128==(g&128)}switch(h){case 1:return s.asVector=!1,s.search();case 2:s.asVector=
!0;var l=s.search();return l.toArray(Array(l.size()));case 4:return s.exitFirstMatch=!0,s.setAtropicity=!0,s.search(),s.atropKeys;case 3:s.getMaps=!0;s.setFlags(g|s.flags);var j=s.search();return j.toArray(JU.AU.newInt2(j.size()))}}catch(q){if(F(q,Exception))throw JU.Logger.debugging&&q.printStackTrace(),null==JS.InvalidSmilesException.getLastError()&&JS.InvalidSmilesException.clear(),new JS.InvalidSmilesException(JS.InvalidSmilesException.getLastError());throw q;}return null},"~S,~A,~N,JU.BS,JU.BS,~B,~N,~N");
n(c$,"cleanSmiles",function(a){return JS.SmilesParser.cleanPattern(a)},"~S");n(c$,"getMapForJME",function(a,b,c){var d=new JS.SmilesSearch,e=JU.PT.getTokens(a);a=JU.PT.parseInt(e[0]);for(var f=JU.PT.parseInt(e[1]),g=2,h=0;h<a;h++,g+=3){var m=e[g],s=d.addAtom(),k=m.indexOf("+"),l=0;if(0<=k)l=k==m.length-1?1:JU.PT.parseInt(m.substring(k+1));else if(0<=(k=m.indexOf("-")))l=JU.PT.parseInt(m.substring(k));s.setCharge(l);s.setSymbol(0>k?m:m.substring(0,k))}for(h=0;h<f;h++){s=JU.PT.parseInt(e[g++])-1;k=
JU.PT.parseInt(e[g++])-1;m=JU.PT.parseInt(e[g++]);s=d.patternAtoms[s];k=d.patternAtoms[k];l=1;switch(m){case 2:l=2;break;case 3:l=3}(new JS.SmilesBond(s,k,l,!1)).index=h}e="";try{d.isSmarts=!0;d.set();var j=JU.BSUtil.newBitSet2(0,a),e=this.getSmiles(d.patternAtoms,d.ac,j,null,34),q=this.getCorrelationMaps(e,d.patternAtoms,a,j,42),p=this.getCorrelationMaps(e,b,c.cardinality(),c,42);return M(-1,[q[0],p[0]])}catch(r){if(F(r,Exception))r.printStackTrace();else throw r;}return null},"~S,~A,JU.BS");K(c$,
"MODE_BITSET",1,"MODE_ARRAY",2,"MODE_MAP",3,"MODE_ATROP",4)});C("JS");A(["java.lang.Exception"],"JS.InvalidSmilesException",null,function(){c$=Q(JS,"InvalidSmilesException",Exception);c$.getLastError=j(c$,"getLastError",function(){return JS.InvalidSmilesException.lastError});c$.clear=j(c$,"clear",function(){JS.InvalidSmilesException.lastError=null});n(c$,"getMessage",function(){return JS.InvalidSmilesException.lastError});H(c$,function(a){O(this,JS.InvalidSmilesException,[a]);JS.InvalidSmilesException.lastError=
a.startsWith("Jmol SMILES")?a:"Jmol SMILES Exception: "+a},"~S");K(c$,"lastError",null)});C("JS");A(["JU.JmolMolecule","JU.BS","$.Lst"],"JS.SmilesSearch","java.lang.Float java.util.Hashtable JU.AU $.SB JS.InvalidSmilesException $.SmilesAromatic $.SmilesAtom $.SmilesBond $.SmilesMeasure $.SmilesParser $.VTemp JU.BSUtil $.Edge $.Logger".split(" "),function(){c$=G(function(){this.isSmarts=!1;this.targetAtoms=this.patternAtoms=this.pattern=this.top=null;this.targetAtomCount=0;this.v=this.bsSelected=null;
this.patternBioSequence=this.isTopology=this.haveTopo=this.patternAromatic=this.setAtropicity=this.groupByModel=this.exitFirstMatch=this.invertStereochemistry=this.ignoreStereochemistry=this.ignoreAtomClass=this.noAromatic=this.aromaticDouble=this.aromaticPlanar=this.aromaticStrict=this.aromaticOpen=!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.ringSets=null;this.ringCount=0;this.measures=null;this.flags=0;this.lastChainAtom=this.atropKeys=this.bsAromatic6=this.bsAromatic5=this.bsAromatic=null;this.isRingCheck=this.isSilent=this.haveComponents=this.isNormalized=this.getMaps=this.asVector=!1;this.selectedAtomCount=0;this.htNested=this.bsFound=this.ringConnections=this.ringCounts=this.ringData=null;this.nNested=0;this.bsCheck=this.bsReturn=this.uniqueList=this.vReturn=this.nestedBond=null;this.mapUnique=!1;this.bsAromaticRings=null;D(this,
arguments)},JS,"SmilesSearch",JU.JmolMolecule);L(c$,function(){this.patternAtoms=Array(16);this.measures=new JU.Lst;this.bsAromatic=new JU.BS;this.bsAromatic5=new JU.BS;this.bsAromatic6=new JU.BS;this.bsFound=new JU.BS;this.bsReturn=new JU.BS});H(c$,function(){O(this,JS.SmilesSearch,[]);this.top=this;this.v=new JS.VTemp});j(c$,"setTop",function(a){for(;a.top!==a;)a=a.top;this.top=a},"JS.SmilesSearch");c$.addFlags=j(c$,"addFlags",function(a,b){0<=b.indexOf("OPEN")&&(a|=5);0<=b.indexOf("BIO")&&(a|=
1048576);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|=8192);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");j(c$,"setFlags",function(a){this.flags=a;this.exitFirstMatch=(new Boolean(this.exitFirstMatch|8==(a&8))).valueOf();this.aromaticOpen=5==(a&5);this.aromaticDouble=512==(a&512);this.aromaticStrict=256==(a&256);this.aromaticPlanar=1024==(a&1024);this.groupByModel=
67108864==(a&67108864);this.noAromatic=16==(a&16);this.ignoreAtomClass=2048==(a&2048);this.ignoreStereochemistry=32==(a&32);this.invertStereochemistry=!this.ignoreStereochemistry&&64==(a&64)},"~N");j(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.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],g;if(f.isConnection&&f.atom2===b&&(g=f.atom1.component)!=d)for(f=this.ac;0<=
--f;)this.patternAtoms[f].component==d&&(this.patternAtoms[f].component=g)}});j(c$,"setSelected",function(a){null==a&&(a=JU.BS.newN(this.targetAtomCount),a.setBits(0,this.targetAtomCount));this.bsSelected=a},"JU.BS");j(c$,"addAtom",function(){return this.appendAtom(new JS.SmilesAtom)});j(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");j(c$,"addNested",
function(a){null==this.htNested&&(this.htNested=new java.util.Hashtable);this.setNested(++this.nNested,a);return this.nNested},"~S");j(c$,"clear",function(){this.bsReturn.clearAll();this.nNested=0;this.nestedBond=this.htNested=null;this.clearBsFound(-1)});j(c$,"clearBsFound",function(a){0>a?null==this.bsCheck&&this.bsFound.clearAll():this.bsFound.clear(a)},"~N");j(c$,"setNested",function(a,b){this.top.htNested.put("_"+a,b)},"~N,~O");j(c$,"getNested",function(a){return this.top.htNested.get("_"+a)},
"~N");j(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});j(c$,"setRingData",function(a,b,c){if(this.isTopology||this.patternBioSequence)this.needAromatic=!1;this.needAromatic&&(this.needRingData=!0);this.needAromatic=(new Boolean(this.needAromatic&(new Boolean(null==a&16!=(this.flags&16))).valueOf())).valueOf();if(!this.needAromatic&&(this.bsAromatic.clearAll(),null!=a&&this.bsAromatic.or(a),!this.needRingMemberships&&
!this.needRingData))return;this.getRingData(b,this.needRingData,c)},"JU.BS,~A,~B");j(c$,"getRingData",function(a,b,c){var d=this.aromaticStrict||!this.aromaticOpen&&!this.aromaticPlanar,e=this.aromaticOpen&&!this.aromaticStrict,f=!d?0:768==(this.flags&768)?2:1,g=0==f,h=128==(this.flags&128),m=this.needAromatic&&c&&(d||e),s=null==a?new JU.Lst:a[3]=new JU.Lst,k=m?new JU.Lst:null,l=m?v(this.targetAtomCount,0):null;h&&this.needAromatic&&(JS.SmilesAromatic.checkAromaticDefined(this.targetAtoms,this.bsSelected,
this.bsAromatic),f=0);var j=this.targetAtomCount,q=0==j||N(this.targetAtoms[0],JS.SmilesAtom);0>this.ringDataMax&&(this.ringDataMax=8);0<f&&6>this.ringDataMax&&(this.ringDataMax=6);b&&(this.ringCounts=v(j,0),this.ringConnections=v(this.targetAtomCount,0),this.ringData=Array(this.ringDataMax+1));this.ringSets=new JU.Lst;for(var p="****",r=this.ringDataMax;p.length<r;)p+=p;for(var n=3;n<=r;n++)if(!(n>j)){var t="*1"+p.substring(0,n-2)+"*1",t=JS.SmilesParser.newSearch(t,!0,!0),t=this.subsearch(t,2);if(null!=
a&&5>=n){for(var u=new JU.Lst,y=t.size();0<=--y;)u.addLast(t.get(y));a[n-3]=u}if(0!=t.size()&&(this.needAromatic&&(!h&&4<=n&&7>=n)&&JS.SmilesAromatic.setAromatic(n,this.targetAtoms,this.bsSelected,t,this.bsAromatic,f,e,q,g,this.v,s,k,l,c),b)){this.ringData[n]=new JU.BS;for(u=t.size();0<=--u;){var w=t.get(u);this.ringData[n].or(w);for(y=w.nextSetBit(0);0<=y;y=w.nextSetBit(y+1))this.ringCounts[y]++}}}if(this.needAromatic){m&&JS.SmilesAromatic.finalizeAromatic(this.targetAtoms,this.bsAromatic,s,k,l,
e,d);this.bsAromatic5.clearAll();this.bsAromatic6.clearAll();for(n=s.size();0<=--n;)switch(a=s.get(n),a.and(this.bsAromatic),a.cardinality()){case 5:this.bsAromatic5.or(a);break;case 6:this.bsAromatic6.or(a)}}if(b)for(n=this.bsSelected.nextSetBit(0);0<=n;n=this.bsSelected.nextSetBit(n+1))if(b=this.targetAtoms[n],s=b.getEdges(),null!=s)for(u=s.length;0<=--u;)0<this.ringCounts[b.getBondedAtomIndex(u)]&&this.ringConnections[n]++},"~A,~B,~B");j(c$,"subsearch",function(a,b){a.ringSets=this.ringSets;a.mapUnique=
this.mapUnique;a.targetAtoms=this.targetAtoms;a.targetAtomCount=this.targetAtomCount;a.bsSelected=this.bsSelected;a.htNested=this.htNested;a.haveTopo=this.haveTopo;a.bsCheck=this.bsCheck;a.isSmarts=!0;a.bsAromatic=this.bsAromatic;a.bsAromatic5=this.bsAromatic5;a.bsAromatic6=this.bsAromatic6;a.ringData=this.ringData;a.ringCounts=this.ringCounts;a.ringConnections=this.ringConnections;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.asVector=this.asVector,a.vReturn=this.vReturn,a.bsReturn=this.bsReturn,a.haveBondStereochemistry=this.haveBondStereochemistry}return a.search2(1==b)},"JS.SmilesSearch,~N");j(c$,"search",function(){return this.search2(!1)});j(c$,"search2",function(a){this.setFlags(this.flags);!this.isRingCheck&&(JU.Logger.debugging&&!this.isSilent)&&JU.Logger.debug("SmilesSearch processing "+
this.pattern);if(null==this.vReturn&&(this.asVector||this.getMaps))this.vReturn=new JU.Lst;null==this.bsSelected&&(this.bsSelected=JU.BS.newN(this.targetAtomCount),this.bsSelected.setBits(0,this.targetAtomCount));this.selectedAtomCount=this.bsSelected.cardinality();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&&(null==this.nestedBond?this.clearBsFound(-1):this.bsReturn.clearAll(),this.nextPatternAtom(-1,-1,a,-1));return this.asVector||this.getMaps?this.vReturn:this.bsReturn},"~B");j(c$,"nextPatternAtom",function(a,b,c,d){var e,f;if(++a<this.ac){var g=this.patternAtoms[a],h=0<=b?g.getBondTo(null):0==a?this.nestedBond:null;if(null==h){b=JU.BSUtil.copy(this.bsFound);var m=JU.BSUtil.copy(this.bsFound);if(0<=g.notBondedIndex)if(e=this.patternAtoms[g.notBondedIndex],h=e.getMatchingAtom(),e.isBioAtom)e=
h.getOffsetResidueAtom("\x00",1),0<=e&&b.set(e),e=h.getOffsetResidueAtom("\x00",-1),0<=e&&b.set(e);else{f=h.getEdges();for(e=0;e<f.length;e++)b.set(f[e].getOtherNode(h).getIndex())}f=g.isBioAtomWild;e=this.bsSelected.nextSetBit(0);e=f&&0<=e?this.targetAtoms[e].getOffsetResidueAtom("\x00",e):e;for(var s,k=(0<a?this.patternAtoms[a-1]:g).component,l=g.component,j=this.haveComponents&&-2147483648!=l,h=e;0<=h;h=this.bsSelected.nextSetBit(h+1)){if(!b.get(h)&&!this.bsFound.get(h)){e=this.targetAtoms[h];
if(j&&!this.isRingCheck&&(d=this.groupByModel?e.getModelIndex():e.getMoleculeNumber(!1),s=0<a?this.patternAtoms[a-1].matchingComponent:d,k==l!=(s==d)))continue;if(!this.nextTargetAtom(g,e,a,h,c,d))return!1}f&&(e=this.targetAtoms[h].getOffsetResidueAtom(g.bioAtomName,1),0<=e&&(h=e-1))}this.bsFound=m;return!0}e=h.atom1.getMatchingAtom();switch(h.order){case 96:h=e.getOffsetResidueAtom(g.bioAtomName,1);if(0<=h){b=JU.BSUtil.copy(this.bsFound);e.getGroupBits(this.bsFound);if(this.doCheckAtom(h)&&!this.nextTargetAtom(g,
this.targetAtoms[h],a,h,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(h=2;h<f.size();h+=3)if(m=f.get(h).intValue(),this.doCheckAtom(m)&&!this.nextTargetAtom(g,this.targetAtoms[m],a,m,c,d))return!1;this.bsFound=b;return!0}f=e.getEdges();if(null!=f)for(h=0;h<f.length;h++)if(m=e.getBondedAtomIndex(h),this.doCheckAtom(m)&&!this.nextTargetAtom(g,this.targetAtoms[m],a,m,c,d))return!1;this.clearBsFound(b);
return!0}if(!this.ignoreStereochemistry&&!this.isRingCheck&&!this.checkStereochemistry())return!0;b=new JU.BS;for(h=d=0;h<this.ac;h++)if(g=this.patternAtoms[h].getMatchingAtomIndex(),c||!this.top.haveSelected||this.patternAtoms[h].selected){d++;b.set(g);this.patternAtoms[h].isBioAtomWild&&this.targetAtoms[g].getGroupBits(b);if(c)break;if(!this.isSmarts&&!this.setAtropicity&&0<this.patternAtoms[h].explicitHydrogenCount){g=this.targetAtoms[g];e=0;for(f=g.getEdges().length;e<f;e++)m=g.getBondedAtomIndex(e),
1==this.targetAtoms[m].getElementNumber()&&b.set(m)}}if(!this.isSmarts&&b.cardinality()!=this.selectedAtomCount)return!0;if(null!=this.bsCheck)if(c){this.bsCheck.clearAll();for(h=0;h<this.ac;h++)this.bsCheck.set(this.patternAtoms[h].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(h=this.uniqueList.size();0<=--h;)if(this.uniqueList.get(h).equals(b))return!0;
this.uniqueList.addLast(b)}a=v(d,0);for(b=h=0;h<this.ac;h++)if(c||!this.top.haveSelected||this.patternAtoms[h].selected)a[b++]=this.patternAtoms[h].getMatchingAtomIndex();this.vReturn.addLast(a);return!this.exitFirstMatch}if(this.asVector){c=!0;for(h=this.vReturn.size();0<=--h&&c;)c=!this.vReturn.get(h).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.ringSets.addLast(c);
return!0}return this.exitFirstMatch?!1:b.cardinality()!=this.selectedAtomCount},"~N,~N,~B,~N");j(c$,"doCheckAtom",function(a){return this.bsSelected.get(a)&&!this.bsFound.get(a)},"~N");j(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 g=0;g<a.nSubAtoms;g++){if(!this.checkPrimitiveAtom(a.subAtoms[g],d))return!0}else{for(g=0;g<a.nSubAtoms;g++)if(!this.nextTargetAtom(a.subAtoms[g],
b,c,d,e,f))return!1;return!0}b=b.getEdges();for(g=a.getBondCount();0<=--g;){var h=a.getBond(g);if(h.getAtomIndex2()==a.index){var m=h.atom1,s=m.getMatchingAtomIndex();switch(h.order){case 96:case 112:if(!this.checkMatchBond(a,m,h,d,s,null))return!0;break;default:for(var k=0,l=null;k<b.length&&(!(l=b[k]).isCovalent()||!(l.getAtomIndex1()==s||l.getAtomIndex2()==s));k++);if(k==b.length||!this.checkMatchBond(a,m,h,d,s,l))return!0}}}a=this.patternAtoms[a.index];a.setMatchingAtom(this.targetAtoms[d],d);
a.matchingComponent=f;if(JU.Logger.debugging&&!this.isRingCheck){for(g=0;g<=c;g++)JU.Logger.debug("pattern atoms "+this.patternAtoms[g]+" "+this.patternAtoms[g].matchingComponent);JU.Logger.debug("--ss--")}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");j(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.targetAtoms[b],c=a.not;;){if(0<a.iNested){c=this.getNested(a.iNested);N(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)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(),g=a.getBioSmilesType(),h=!0,f=!1;switch(g){case "\x00":case "*":h=!0;break;case "n":h="r"==e||"c"==e;f=!0;break;case "r":case "c":f=!0;default:h=e==g}if(!h)break;h=d.getGroup1("\x00").toUpperCase();g=null==a.residueChar?"*":a.residueChar.charAt(0);h=g==h.charAt(0);switch(g){case "*":h=!0;break;case "N":h=
f?"r"==e||"c"==e:h;break;case "R":h=f?d.isPurine():h;break;case "Y":h=f?d.isPyrimidine():h}if(!h)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.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()-d.getImplicitHydrogenCount())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.ringData){if(-1<=a.ringSize)if(0>=a.ringSize){if(0==
this.ringCounts[b]!=(0==a.ringSize))break}else{d=this.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.bsAromatic5.get(b))break}else if(600==a.ringSize&&!this.bsAromatic6.get(b))break}if(-1<=a.ringMembership&&(-1==a.ringMembership?0==this.ringCounts[b]:this.ringCounts[b]!=a.ringMembership))break;if(0<=a.ringConnectivity&&(f=this.ringConnections[b],-1==a.ringConnectivity&&0==f||-1!=a.ringConnectivity&&f!=a.ringConnectivity))break}}c=
!c;break}return c},"JS.SmilesAtom,~N");j(c$,"checkMatchBond",function(a,b,c,d,e,f){if(null!=c.bondsOr){for(var g=0;g<c.nBondsOr;g++)if(this.checkMatchBond(a,b,c.bondsOr[g],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");j(c$,"checkPrimitiveBond",
function(a,b,c,d){var e=!1;switch(a.order){case 96:return a.isNot!=(this.targetAtoms[c].getOffsetResidueAtom("\x00",1)==this.targetAtoms[b].getOffsetResidueAtom("\x00",0));case 112:return a.isNot!=this.targetAtoms[b].isCrossLinked(this.targetAtoms[c])}var f=!this.noAromatic&&this.bsAromatic.get(b),g=!this.noAromatic&&this.bsAromatic.get(c);d=d.getCovalentOrder();var h=a.order;if(f&&g)switch(h){case 17:case 65:e=JS.SmilesSearch.isRingBond(this.ringSets,null,b,c);break;case 1:e=!this.isSmarts||!JS.SmilesSearch.isRingBond(this.ringSets,
this.getBSAromaticRings(),b,c);break;case 2:e=this.isNormalized||this.aromaticDouble&&(2==d||514==d);break;case 65537:case 65538:e=!a.isNot;break;case 81:case -1:e=!0}else switch(h){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==h;break;case 65:e=JS.SmilesSearch.isRingBond(this.ringSets,null,b,c)}return e!=
a.isNot},"JS.SmilesBond,~N,~N,JU.Edge");j(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});c$.isRingBond=j(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");j(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,c=null,a=0;a<this.ac;a++){for(var d=this.patternAtoms[a],e=null,f=null,g=null,h=0,m=0,s=0,k=d.getBondCount(),l=!1,j=!0,q=0;q<k;q++){var c=d.getBond(q),p=c.atom2===d,j=c.atom1.index<c.atom2.index,r=c.order;switch(r){case 65537:case 65538:if(!j)continue;
case 2:if(p)continue;e=c.atom2;s=r;(l=2!=r)&&(h=c.isNot?-1:1);break;case 1025:case 1041:f=p?c.atom1:c.atom2,h=p!=(1025==r)?1:-1}}if(l){if(this.setAtropicity){null==b&&(b=new JU.Lst);b.addLast(c);continue}g=d.getBond(c.atropType[0]);if(null==g)return!1;f=g.getOtherAtom(d);g=e.getBond(c.atropType[1]);if(null==g)return!1;g=g.getOtherAtom(e);JU.Logger.debugging&&JU.Logger.info("atropisomer check for atoms "+f+d+" "+e+g)}else{if(null==e||0==h)continue;k=d;for(q=0;2==e.getBondCount()&&4==e.getValence();)q++,
p=e.getEdges(),p=p[p[0].getOtherNode(e)===k?1:0],k=e,e=p.getOtherNode(e);if(1==q%2)continue;k=e.getBondCount();for(q=0;q<k&&0==m;q++)switch(c=e.getBond(q),r=c.order,r){case 1025:case 1041:g=(p=c.atom2===e)?c.atom1:c.atom2,m=p!=(1025==r)?1:-1}if(0==m)continue}k=d.getMatchingAtom();q=e.getMatchingAtom();f=f.getMatchingAtom();g=g.getMatchingAtom();if(null==f||null==g)return!1;this.haveTopo&&this.setTopoCoordinates(k,q,f,g,s);f=JS.SmilesMeasure.setTorsionData(f,k,q,g,this.v,l);if(l){if(f*=h*(65537==s?
1:-1)*(j?1:-1),JU.Logger.debugging&&JU.Logger.info("atrop dihedral "+f+" "+d+" "+e+" "+c),1>f)return!1}else if(0>this.v.vTemp1.dot(this.v.vTemp2)*h*m)return!1}if(this.setAtropicity){this.atropKeys="";for(a=0;a<b.size();a++)this.atropKeys+=","+this.getAtropIndex(c=b.get(a),!0)+this.getAtropIndex(c,!1)}return!0});j(c$,"getAtropIndex",function(a,b){for(var c=b?a.atom1:a.atom2,d=c.getMatchingAtom(),d=JU.Edge.getAtropismNode(a.matchingBond.order,d,b),e=c.bonds,f=c.getBondCount();0<=--f;)if(e[f].getOtherNode(c).getMatchingAtom()===
d)return f+1;return 0},"JS.SmilesBond,~B");j(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),b=65537==e.order?1:-1,c.set(-1,1,0),d.set(1,1,b/2);else{d=c=0;for(var f=a.getEdges(),g=f.length;0<=--g;)if(e=f[g],2!=e.order){var h=e.getOtherNode(a);h.set(-1,0==c++?-1:1,0);h=e.getAtomIndex2()==a.getIndex()?c:-c;switch(e.order){case 1025:d=h;break;case 1041:d=-h}}var m=0;c=0;a=Array(2);f=b.getEdges();for(g=f.length;0<=--g;)if(e=f[g],2!=e.order)switch(h=e.getOtherNode(b),
a[c]=h,h.set(1,0==c++?1:-1,0),h=e.getAtomIndex2()==b.getIndex()?c:-c,e.order){case 1025:m=h;break;case 1041:m=-h}0<d*m==(Math.abs(d)%2==Math.abs(m)%2)&&(b=a[0].y,a[0].y=a[1].y,a[1].y=b)}},"JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,JS.SmilesAtom,~N");j(c$,"createTopoMap",function(a){var b=null==a,c=this.getMissingHydrogenCount(),c=this.ac+c,d=Array(c);this.targetAtoms=d;for(var e=0,f=0;e<this.ac;e++,f++){var g=this.patternAtoms[e],h=g.explicitHydrogenCount;0>h&&(h=0);var m=d[f]=(new JS.SmilesAtom).setTopoAtom(g.component,
f,g.symbol,g.getCharge());m.implicitHydrogenCount=h;if(!b){m.mapIndex=e;m.stereo=g.stereo;m.setAtomicMass(g.getAtomicMass());m.bioAtomName=g.bioAtomName;m.residueName=g.residueName;m.residueChar=g.residueChar;m.residueNumber=g.residueNumber;m.atomNumber=g.residueNumber;m.insCode=g.insCode;m.atomClass=g.atomClass;m.explicitHydrogenCount=0;m.isBioAtom=g.isBioAtom;m.bioType=g.bioType;m.$isLeadAtom=g.$isLeadAtom;!b&&g.isAromatic&&a.set(f);g.setMatchingAtom(null,f);g=Array(g.getBondCount()+h);for(m.setBonds(g);0<=
--h;){g=d[++f]=(new JS.SmilesAtom).setTopoAtom(m.component,f,"H",0);g.mapIndex=-e-1;g.setBonds(Array(1));var s=new JS.SmilesBond(m,g,1,!1);JU.Logger.debugging&&JU.Logger.info(""+s)}}}if(!b){for(e=0;e<this.ac;e++){g=this.patternAtoms[e];h=g.getMatchingAtomIndex();a=d[h];h=g.getBondCount();for(b=0;b<h;b++)if(f=g.getBond(b),f.atom1===g){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}m=d[f.atom2.getMatchingAtomIndex()];
s=new JS.SmilesBond(a,m,s,!1);s.isConnection=f.isConnection;m.bondCount--;JU.Logger.debugging&&JU.Logger.info(""+s)}else m=d[f.atom1.getMatchingAtomIndex()],s=m.getBondTo(a),a.addBond(s)}for(e=0;e<c;e++)if(s=d[e],g=s.bonds,!(2>g.length||g[0].isFromPreviousTo(s)))for(h=g.length;1<=--h;)if(g[h].isFromPreviousTo(s)){s=g[h];g[h]=g[0];g[0]=s;break}if(!this.ignoreStereochemistry)for(e=this.ac;0<=--e;)g=this.patternAtoms[e],null!=g.stereo&&g.stereo.fixStereo(g)}},"JU.BS");c$.normalizeAromaticity=j(c$,"normalizeAromaticity",
function(a,b,c){var d=new JS.SmilesSearch;d.setFlags(c);d.targetAtoms=a;d.targetAtomCount=a.length;d.bsSelected=JU.BSUtil.newBitSet2(0,a.length);c=JU.AU.createArrayOfArrayList(4);d.setRingData(null,c,!0);b.or(d.bsAromatic);if(!b.isEmpty()){b=c[3];for(d=b.size();0<=--d;){c=b.get(d);for(var e=c.nextSetBit(0);0<=e;e=c.nextSetBit(e+1)){var f=a[e];!f.isAromatic&&!(-2==f.elementNumber||0==f.elementNumber)&&f.setSymbol(f.symbol.toLowerCase())}}}},"~A,JU.BS,~N");j(c$,"getSelections",function(){var a=this.top.htNested;
if(!(null==a||0==this.targetAtoms.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.targetAtoms[0].findAtomsLike(d.substring(6));null==e&&(e=new JU.BS);b.put(d,e);c.setValue(e)}}});j(c$,"findImplicitHydrogen",function(a){for(var b=a.getEdges().length;0<=--b;){var c=a.getBondedAtomIndex(b);if(1==this.targetAtoms[c].getElementNumber()&&!this.bsFound.get(c))return this.targetAtoms[c]}return null},
"JU.Node");j(c$,"toString",function(){var a=(new JU.SB).append(this.pattern);a.append("\nmolecular formula: "+this.getMolecularFormula(!0,null,!1));return a.toString()});K(c$,"SUBMODE_NESTED",1,"SUBMODE_RINGCHECK",2,"SUBMODE_OR",3)});C("JS");A(["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$=G(function(){this.atoms=
null;this.ac=0;this.bsAromatic=this.bsSelected=null;this.flags=0;this.explicitH=!1;this.vTemp=this.ringSets=null;this.nPairsMax=this.nPairs=0;this.bsIncludingH=this.bsRingKeys=this.htRings=this.htRingsSequence=this.alleneStereo=this.prevSp2Atoms=this.prevAtom=this.bsToDo=this.bsBondsDn=this.bsBondsUp=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.ptSp2Atom0=this.ptAtom=this.iHypervalent=0;this.atemp=null;this.chainCheck=0;D(this,arguments)},JS,"SmilesGenerator");L(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});j(c$,"getSmiles",function(a,b,c,d,e,f){var g=d.nextSetBit(0);if(0>g)return"";this.sm=a;this.flags=f;this.atoms=b;this.ac=c;this.bsSelected=d=JU.BSUtil.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.explicitH=4096==(f&4096);this.topologyOnly=8192==(f&8192);this.getAromatic=16!=(f&16);this.noStereo=32==(f&32);this.isPolyhedral=65536==(f&65536);return this.getSmilesComponent(b[g],d,!0,!1,!1)},"JS.SmilesMatcher,~A,~N,JU.BS,~S,~N");j(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 g=f||c,h=new JU.SB;null!=b&&!this.noBioComment&&h.append("//* Jmol bioSMILES ").append(b.$replace("*","_")).append(" *//");b=this.noBioComment?"":"\n";var m=new JU.BS,s=null,k="",l,j=new JU.Lst;try{for(var q=0,p=a.nextSetBit(0);0<=p;p=a.nextSetBit(p+1)){var r=this.atoms[p],n=r.getGroup1("?"),t=r.getBioStructureTypeName(),u=n===n.toLowerCase();if(null!=b)if(0<h.length()&&h.append(b),
b=null,q=0,0<t.length)0!=r.getChainID()&&!e&&(l="//* chain "+r.getChainIDStr()+" "+t+" "+r.getResno()+" *// ",q=l.length,h.append(l)),q++,h.append("~").appendC(t.toLowerCase().charAt(0)).append("~");else{l=this.getSmilesComponent(r,a,!1,!0,!0);if(l.equals(s)){b="";continue}var s=l,y=r.getGroup3(!0),w;e?w="/"+l+"/":(null!=y&&(l="//* "+y+" *//"+l),w=l+"//");if(0<=k.indexOf(w)){b="";continue}k+=w;h.append(l);b=e?".":".\n";continue}75<=q&&!e&&(h.append("\n  "),q=2);this.addAtomComment&&h.append("\n//* ["+
r.getGroup3(!1)+"#"+r.getResno()+"] *//\t");u?this.addBracketedBioName(h,r,0<t.length?".0":null,!1):h.append(n);q++;if(g){r.getCrossLinkVector(j,f,c);for(var x=0;x<j.size();x+=3)h.append(":"),l=this.getRingCache(j.get(x).intValue(),j.get(x+1).intValue(),this.htRingsSequence),h.append(l),q+=1+l.length;j.clear()}r.getGroupBits(m);a.andNot(m);var z=r.getOffsetResidueAtom("\x00",1);if(0>z||!a.get(z)){e||h.append(" //* ").appendI(r.getResno()).append(" *//");if(0>z&&0>(z=a.nextSetBit(p+1)))break;0<q&&
(b=e?".":".\n")}p=z-1}}catch(B){if(F(B,Exception))throw new JS.InvalidSmilesException("//* error: "+B.getMessage()+" *//");throw B;}if(!d&&!this.htRingsSequence.isEmpty())throw this.dumpRingKeys(h,this.htRingsSequence),new JS.InvalidSmilesException("//* ?ring error? *//");l=h.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");j(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");j(c$,"getSmilesComponent",function(a,b,c,d,e){!this.explicitH&&(1==a.getAtomicAndIsotopeNumber()&&0<a.getEdges().length)&&(a=this.atoms[a.getBondedAtomIndex(0)]);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(!this.explicitH)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.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)null==a&&c.append("."),this.getSmilesAt(c,this.atoms[b],d,!1,e),a=null;if(null!=a)for(;null!=(a=this.getSmilesAt(c,a,d,!0,e)););for(;0<this.bsToDo.cardinality()||
!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)););}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 g=d.indexOf("^-");if(0>g)break;d=d.substring(0,g+1)+f.substring(b,b+2)+d.substring(g+1);b+=3}}catch(h){if(F(h,Exception))System.out.println("???"),d=e;else throw h;}}return d},"JU.Node,JU.BS,~B,~B,~B");j(c$,"generateRingData",function(){var a=JS.SmilesParser.newSearch("[r500]",!0,!0);a.targetAtoms=this.atoms;a.setSelected(this.bsSelected);a.setFlags(this.flags);a.targetAtomCount=this.ac;a.ringDataMax=7;a.flags=
this.flags;var b=JU.AU.createArrayOfArrayList(4);a.setRingData(null,b,!0);this.bsAromatic=a.bsAromatic;this.ringSets=a.ringSets;this.aromaticRings=b[3]});j(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");j(c$,"setBondDirections",function(){for(var a=new JU.BS,b=M(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 g=e[f],h=g.index,m;if(!a.get(h)&&!(2!=g.getCovalentOrder()||JS.SmilesSearch.isRingBond(this.ringSets,null,c,(m=g.getOtherNode(d)).getIndex()))){a.set(h);g=0;for(h=d;2==m.getCovalentBondCount()&&4==m.getValence();){var s=m.getEdges(),s=s[s[0].getOtherNode(m)===h?1:0];a.set(s.index);h=m;m=s.getOtherNode(m);g++}if(1!=g%2){for(var k=g=null,h=0,s=M(-1,[d,m]),k=1,l=0;2>l&&0<k&&3>k;l++)for(var k=0,j=s[l],q=j.getEdges(),p=0;p<q.length;p++){var r;
if(!(1!=q[p].getCovalentOrder()||1==(r=q[p].getOtherNode(j)).getElementNumber()&&0==r.getIsotopeNumber()))b[l][k++]=q[p],"\x00"!=this.getBondStereochemistry(q[p],j)&&(g=q[p],h=l)}if(!(3==k||0==k))if(null==g&&(h=0,g=b[h][0],this.bsBondsUp.set(g.index)),j=this.getBondStereochemistry(g,s[h]),k=g.getOtherNode(s[h]),null!=k)for(l=0;2>l;l++)for(q=0;2>q;q++)if(p=b[l][q],!(null==p||p===g)){var n=p.index,t=p.getOtherNode(s[l]);if(null!=t){var u=this.getBondStereochemistry(p,s[l]),y=JS.SmilesStereo.isDiaxial(s[h],
s[l],k,t,this.vTemp,0);"\x00"==u||u!=j==y?("\\"==j&&y||"/"==j&&!y)==(p.getAtomIndex1()!=t.getIndex())?this.bsBondsUp.set(n):this.bsBondsDn.set(n):JU.Logger.error("BOND STEREOCHEMISTRY ERROR");JU.Logger.debugging&&JU.Logger.debug(this.getBondStereochemistry(g,s[0])+" "+k.getIndex()+" "+t.getIndex()+" "+this.getBondStereochemistry(p,s[l]))}}}}}});j(c$,"getSmilesAt",function(a,b,c,d,e){var f=b.getIndex();if(!this.bsToDo.get(f))return null;this.ptAtom++;this.bsToDo.clear(f);var g=f==this.iHypervalent||
this.explicitH,h=!this.bsSelected.get(f),m=null==this.prevAtom?-1:this.prevAtom.getIndex(),j=this.bsAromatic.get(f),k=this.prevSp2Atoms,l=null!=k,n=b.getElementNumber(),q=0,p=this.alleneStereo;this.alleneStereo=null;var r=new JU.Lst,I=null,t=null,u=b.getEdges();null!=this.polySmilesCenter&&(d=!1,this.sortBonds(b,this.prevAtom,this.polySmilesCenter));var y=null,w=j?10:0;JU.Logger.debugging&&JU.Logger.debug(a.toString());if(null!=u)for(var x=u.length;0<=--x;){var z=u[x];if(z.isCovalent()){var B=u[x].getOtherNode(b),
v=B.getIndex();if(v==m)t=u[x];else{var E=!g&&1==B.getElementNumber()&&0==B.getIsotopeNumber();if(!this.bsIncludingH.get(v))if(!E&&c&&this.bsSelected.get(f))this.bsToDo.set(v);else continue;E?(y=B,q++,1<q&&(w=10)):r.addLast(u[x])}}}1<q&&(k=null);u=null!=k?2:0;null==k&&(!j&&1>=q)&&(k=Array(5));var C=null;null!=t&&(C=this.getBondOrder(t,f,m,j),null!=k&&!l&&(k[u++]=this.prevAtom));null!=k&&!l&&(this.ptSp2Atom0=this.ptAtom);1==q&&(k[u++]=y);m=0;v=new JU.BS;B=r.size();if(d)for(x=0;x<B;x++){var z=r.get(x),
E=z.getOtherNode(b),A=E.getCovalentBondCount()-(g?0:E.getCovalentHydrogenCount()),D=z.getCovalentOrder();if(1==A&&(null!=I||x<B-1))v.set(z.index);else if((1<D||A>m)&&!this.htRings.containsKey(JS.SmilesGenerator.getRingKey(E.getIndex(),f)))m=1<D?1E3+D:A,I=z}g=null==I?null:I.getOtherNode(b);m=null==I?0:I.getCovalentOrder();B=Array(7);7>w&&null!=t&&(l&&2==t.getCovalentOrder()&&2==m&&null!=k[1]?(B[w++]=k[0],B[w++]=k[1]):B[w++]=this.prevAtom);7>w&&1==q&&(B[w++]=y);A=1==m&&null==k;z=this.getBondStereochemistry(t,
this.prevAtom);if(null!=C||"\x00"!=z)"\x00"!=z&&(C=""+z),a.append(C);for(var D=w,G=u,t=new JU.SB,y=new JU.Lst,x=0;x<r.size();x++)if(z=r.get(x),v.get(z.index)){E=z.getOtherNode(b);z=new JU.SB;this.prevAtom=b;this.prevSp2Atoms=this.alleneStereo=null;var C=this.ptSp2Atom0,F=this.ptAtom;this.getSmilesAt(z,E,c,d,e);this.ptAtom=F;this.ptSp2Atom0=C;z=z.toString();r.removeItemAt(x--);null==I?y.addLast(z):t.append("(").append(z).append(")");7>w&&(B[w++]=E);null!=k&&5>u&&(k[u++]=E)}c=new JU.SB;var F=w,H=u,
v=null;if(!d&&!this.noStereo&&null==this.polySmilesCenter&&(5==r.size()||6==r.size()))v=this.sortInorganic(b,r,this.vTemp);for(x=0;x<r.size();x++)z=r.get(x),z!==I&&(E=z.getOtherNode(b),C=this.getBondOrder(z,f,E.getIndex(),j),A||(z=this.getBondStereochemistry(z,b),"\x00"!=z&&(C=""+z)),c.append(C),c.append(this.getRingCache(f,E.getIndex(),this.htRings)),7>w&&(B[w++]=E),null!=k&&5>u&&(k[u++]=E));D!=F&&F!=w&&this.swapArray(B,D,F,w);G!=H&&H!=u&&this.swapArray(k,G,H,u);if(l&&2==w&&2==m){u=this.ptAtom-this.ptSp2Atom0;
d=g.getCovalentBondCount();l=7==g.getElementNumber();if(0==u%2)w=8;else if(3==d||2==d&&l){u=g.getEdges();for(l=0;l<u.length;l++)r=g.getBondedAtomIndex(l),u[l].isCovalent()&&r!=f&&(B[w++]=this.atoms[r]);2==d&&(B[w++]=g);4==w&&(this.alleneStereo=B,1==B[3].getAtomicAndIsotopeNumber()&&(A=B[3],B[3]=B[2],B[2]=A))}u=0}else null!=g&&7>w&&(B[w++]=g);null!=p&&p[3]!==B[2]&&(p=a.lastIndexOf("@]="),0<p&&(d=a.substring(p),a.setLength("@"==a.charAt(p-1)?p-1:p+1),a.append(d)));p=b.getFormalCharge();d=b.getIsotopeNumber();
l=b.getValence();r=this.openSMILES?b.getFloatProperty("property_atomclass"):NaN;x=b.getAtomName();E=b.getBioStructureTypeName();this.addAtomComment&&a.append("\n//* "+b.toString()+" *//\t");this.topologyOnly?a.append("*"):h&&0!=E.length&&0!=x.length?this.addBracketedBioName(a,b,"."+x,!1):a.append(JS.SmilesAtom.getAtomLabel(n,d,e?-1:l,p,r,q,j,null!=v?v:this.noStereo?null:this.checkStereoPairs(b,null==this.alleneStereo?f:-1,B,w)));a.appendSB(c);if(null!=I)a.appendSB(t);else{A=y.size()-1;if(0<=A){for(x=
0;x<A;x++)a.append("(").append(y.get(x)).append(")");a.append(y.get(A))}return null}null!=k&&2==m&&(1==u||2==u)?(null==k[0]&&(k[0]=b),null==k[1]&&(k[1]=b)):k=null;this.prevSp2Atoms=k;this.prevAtom=b;return g},"JU.SB,JU.SimpleNode,~B,~B,~B");j(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");j(c$,"getBondOrder",function(a,
b,c,d){if(this.topologyOnly)return"";if(65537==(a.order&65537))return"^-";a=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");j(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");j(c$,"sortBonds",function(a,b,c){if(null==this.smilesStereo)try{this.smilesStereo=
JS.SmilesStereo.newStereo(null)}catch(d){if(!F(d,JS.InvalidSmilesException))throw d;}this.smilesStereo.sortBondsByStereo(a,b,c,a.getEdges(),this.vTemp.vA)},"JU.SimpleNode,JU.SimpleNode,JU.P3");j(c$,"sortInorganic",function(a,b,c){for(var d=a.getIndex(),e=b.size(),f=new JU.Lst,g=new JU.Lst,h,m,j=null,k=null,l,n,q=new JU.BS,p=null,r=Array(6),p=!0,v="",t=0,u=0;u<e;u++)if(l=b.get(u),r[0]=h=l.getOtherNode(a),0==u?v=this.addStereoCheck(0,d,h,"",null):p&&null!=this.addStereoCheck(0,d,h,v,null)&&(p=!1),!q.get(u)){q.set(u);
for(var y=!1,w=u+1;w<e;w++)if(!q.get(w)&&(n=b.get(w),m=n.getOtherNode(a),JS.SmilesStereo.isDiaxial(a,a,h,m,c,-0.95))){switch(++t){case 1:j=h;break;case 2:k=h;break;case 3:2==JS.SmilesStereo.getHandedness(k,j,h,a,c)&&(h=l,l=n,n=h)}f.addLast(M(-1,[l,n]));y=!0;q.set(w);break}y||g.addLast(l)}d=f.size();if(p||6==e&&3!=d||5==e&&0==d)return"";p=f.get(0);l=p[0];r[0]=l.getOtherNode(a);b.clear();b.addLast(l);1<d&&g.addLast(f.get(1)[0]);3==d&&g.addLast(f.get(2)[0]);1<d&&g.addLast(f.get(1)[1]);3==d&&g.addLast(f.get(2)[1]);
for(u=0;u<g.size();u++)l=g.get(u),b.addLast(l),r[u+1]=l.getOtherNode(a);b.addLast(p[1]);r[e-1]=p[1].getOtherNode(a);return JS.SmilesStereo.getStereoFlag(a,r,e,c)},"JU.SimpleNode,JU.Lst,JS.VTemp");j(c$,"checkStereoPairs",function(a,b,c,d){if(4>d)return"";if(0<=b&&4==d&&6==a.getElementNumber())for(var e="",f=0;4>f;f++)if(null==(e=this.addStereoCheck(0,b,c[f],e,JU.BSUtil.newAndSetBit(b)))){d=10;break}return 6<d?"":JS.SmilesStereo.getStereoFlag(a,c,d,this.vTemp)},"JU.SimpleNode,~N,~A,~N");j(c$,"addStereoCheck",
function(a,b,c,d,e){null!=e&&e.set(b);var f=c.getAtomicAndIsotopeNumber(),g=c.getCovalentBondCount(),h=6==f&&!this.explicitH?c.getCovalentHydrogenCount():0;if(6==f?4!=g:1==f||1<g)return d;var m=";"+a+"/"+f+"/"+h+"/"+g+(0==a?",":"_");if(6==f)switch(h){case 1:return d+m+ ++this.chainCheck;case 0:case 2:if(null==e)return d;for(var j=c.getEdges(),k="",l="",n=2==h?0:3,f=c.getBondCount();0<=--f;){var l=j[f].getOtherNode(c),q=l.getIndex();!e.get(q)&&(j[f].isCovalent()&&1!=l.getElementNumber())&&(e.set(q),
l=this.addStereoCheck(a+1,c.getIndex(),l,"",e),0<=k.indexOf(l)&&n--,k+=l)}if(3==n)return d+m+ ++this.chainCheck;m=(m+k).$replace(",","_");if(0<a)return d+m}if(0<=d.indexOf(m)){if(3==h){for(f=a=0;f<g&&3>a;f++)e=c.getBondedAtomIndex(f),e!=b&&(a+=this.atoms[e].getAtomicAndIsotopeNumber());if(3<a)return d}return null}return d+m},"~N,~N,JU.SimpleNode,~S,JU.BS");j(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,M(-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");
j(c$,"getRingPointer",function(a){return 10>a?""+a:100>a?"%"+a:"%("+a+")"},"~N");j(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=j(c$,"getRingKey",function(a,b){return Math.min(a,b)+"_"+Math.max(a,b)},"~N,~N")});C("JS");A(null,"JS.SmilesAromatic","java.util.Hashtable JU.BS $.Lst $.Measure $.V3 JS.SmilesRing $.SmilesRingSet JU.BSUtil $.Logger".split(" "),
function(){c$=Q(JS,"SmilesAromatic");c$.setAromatic=j(c$,"setAromatic",function(a,b,c,d,e,f,g,h,m,j,k,l,n,q){g=g||0<f;if(q)for(w=d.size();0<=--w;){if(x=d.get(w),q=JS.SmilesAromatic.isSp2Ring(a,b,c,x,h?3.4028235E38:0<f?0.1:0.01,m,0==f)){e.or(x);if(g){j=new JU.Lst;for(var p=x.nextSetBit(0);0<=p;p=x.nextSetBit(p+1))for(var r=b[p],v=r.getEdges(),t=r.getIndex(),u=v.length;0<=--u;){var y=v[u].getOtherNode(r).getIndex();y>t&&x.get(y)&&j.addLast(v[u])}switch(JS.SmilesAromatic.checkHueckelAromatic(a,b,e,x,
f,n)){case -1:continue;case 0:q=!1;case 1:if(null!=l&&l.addLast(new JS.SmilesRing(a,x,j,q)),!q)continue}}k.addLast(x)}}else for(var w=d.size();0<=--w;){var x=JU.BSUtil.copy(d.get(w));x.and(e);x.cardinality()==a&&k.addLast(x)}},"~N,~A,JU.BS,JU.Lst,JU.BS,~N,~B,~B,~B,JS.VTemp,JU.Lst,JU.Lst,~A,~B");c$.checkAromaticDefined=j(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].order){case 515:case 514:case 513:c.set(e[f].getAtomIndex1()),
c.set(e[f].getAtomIndex2())}},"~A,JU.BS,JU.BS");c$.isSp2Ring=j(c$,"isSp2Ring",function(a,b,c,d,e,f,g){if(f)for(var h=d.nextSetBit(0);0<=h;h=d.nextSetBit(h+1)){if(3<b[h].getCovalentBondCount())return!1}else for(h=d.nextSetBit(0);0<=h;h=d.nextSetBit(h+1))if(3<b[h].getCovalentBondCountPlusMissingH())return!1;if(3.4028235E38==e)return!0;0>=e&&(e=0.01);for(var m=f=a=null,h=d.cardinality(),j=Array(2*h),k=0,l=1-5*e,h=d.nextSetBit(0);0<=h;h=d.nextSetBit(h+1)){for(var n=b[h],q=-1,p=-1,r=-1,v=n.getEdges().length;0<=
--v;){var t=n.getBondedAtomIndex(v);if(c.get(t))if(d.get(t))0>p?p=t:r=t;else{if(16==n.getElementNumber()){if(!g)return!1;t=-1}q=t}}null==m&&(m=new JU.V3,a=new JU.V3,f=new JU.V3);v=0;for(n=h;2>v;v++){JU.Measure.getNormalThroughPoints(b[p],b[n],b[r],a,f);if(!JS.SmilesAromatic.addNormal(a,m,l))return!1;j[k++]=JU.V3.newV(a);if(0>(n=q))break}}return JS.SmilesAromatic.checkStandardDeviation(j,m,k,e)},"~N,~A,JU.BS,JU.BS,~N,~B,~B");c$.addNormal=j(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=j(c$,"checkStandardDeviation",function(a,b,c,d){for(var e=0,f=0,g=0;g<c;g++)var h=a[g].dot(b),e=e+h,f=f+h*h;e=Math.sqrt((f-e*e/c)/(c-1));return e<d},"~A,JU.V3,~N,~N");c$.checkHueckelAromatic=j(c$,"checkHueckelAromatic",function(a,b,c,d,e,f){for(var g=0,h=0,m=d.nextSetBit(0);0<=m&&0<=g;m=d.nextSetBit(m+1)){var j=b[m],k=j.getElementNumber(),l=j.getCovalentBondCountPlusMissingH(),l=l+j.getValence(),
l=l-4;if(6==k){var n=j.getFormalCharge();-2147483648!=n&&(l+=n)}k=5<=k&&8>=k?k-5:15==k?2:34==k?3:33==k?4:16==k?5:-1;if(0<=k){k=JS.SmilesAromatic.OS_PI_COUNTS[k];if(0>l||l>=k.length)return-1;switch(l=k[l]){case -2:return-1;case -1:k=j.getEdges();l=0;for(n=k.length;0<=--n;){var q=k[n];if(2==q.getCovalentOrder()){l=q.getOtherNode(j);l=6==l.getElementNumber()||c.get(l.getIndex())?1:0<e?-100:0;break}}default:if(0>l)return-1;null!=f&&(f[m]=l);g+=l;1==l&&h++;JU.Logger.debugging&&JU.Logger.info("atom "+j+
" pi="+l+" npi="+g)}}}return 0==(g-2)%4&&(2>e||5==a||6==h)?1:0},"~N,~A,JU.BS,JU.BS,~N,~A");c$.finalizeAromatic=j(c$,"finalizeAromatic",function(a,b,c,d,e,f,g){g&&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(g||f)for(e=b.nextSetBit(0);0<=e;e=b.nextSetBit(e+1)){c=a[e].getEdges();f=0;for(var h=c.length;0<=--h;){var m=c[h].getOtherNode(a[e]),j=c[h].getCovalentOrder(),k=m.getIndex();if(b.get(k)){if(2==j){m=!1;
for(j=d.size();0<=--j;){var l=d.get(j);if(l.get(e)&&l.get(k)){m=!0;break}}if(!m){f=-1;break}}f++}else if(g&&6==m.getElementNumber()&&2==j){f=-1;break}}2>f&&(b.clear(e),e=-1)}},"~A,JU.BS,JU.Lst,JU.Lst,~A,~B,~B");c$.removeBridgingRings=j(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=j(c$,"checkBridges",function(a,b,c,d,e){for(var f=a===c,g=a.size();0<=--g;)for(var h=a.get(g),m=f?g+1:0,j=c.size();--j>=m;){var k=c.get(j);k.equals(h)||(e.clearAll(),e.or(h),e.and(k),2<e.cardinality()&&(b.set(g),d.set(j)))}},"JU.Lst,JU.BS,JU.Lst,JU.BS,JU.BS");c$.checkFusedRings=j(c$,"checkFusedRings",function(a,b,c){for(var d=new java.util.Hashtable,e=a.size();0<=--e;){for(var f=a.get(e),g=f.edges,h=g.size();0<=--h;){var m=JS.SmilesRing.getSetByEdge(g.get(h),
d);null==m||m===f.$set||(null!=f.$set?m.addSet(f.$set,d):m.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==(m=f.$set)||m.isEmpty())){if(2==m.getElectronCount(b)%4)for(h=m.size();0<=--h;)(f=m.get(h)).isOK||c.addLast(f);m.clear()}},"JU.Lst,~A,JU.Lst");K(c$,"OS_PI_COUNTS",M(-1,[v(-1,[-2,1,0]),v(-1,[1,2,1,-1]),v(-1,[2,1,2,1,1]),v(-1,[2,1]),v(-1,[-2,1,2,1,-2]),v(-1,[2,1,2,2])]))});C("JS");A(["JU.BS"],"JS.SmilesRing",
null,function(){c$=G(function(){this.bsEdgesToCheck=this.edges=this.$set=null;this.isOK=!1;this.n=0;D(this,arguments)},JS,"SmilesRing",JU.BS);H(c$,function(a,b,c,d){O(this,JS.SmilesRing,[]);this.or(b);this.edges=c;this.isOK=d;this.n=a},"~N,JU.BS,JU.Lst,~B");j(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=j(c$,"getSetByEdge",function(a,b){return b.get(JS.SmilesRing.getKey(a))},"JU.Edge,java.util.Hashtable");
c$.getKey=j(c$,"getKey",function(a){var b=a.getAtomIndex1();a=a.getAtomIndex2();return b<a?b+"_"+a:a+"_"+b},"JU.Edge")});C("JS");A(["JU.Lst","$.BS"],"JS.SmilesRingSet",null,function(){c$=G(function(){this.bs=null;D(this,arguments)},JS,"SmilesRingSet",JU.Lst);L(c$,function(){this.bs=new JU.BS});H(c$,function(){O(this,JS.SmilesRingSet,[])});j(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");j(c$,"addRing",function(a){this.addLast(a);
a.$set=this;this.bs.or(a)},"JS.SmilesRing");j(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")});C("JS");A(["JU.P3","JU.Node"],"JS.SmilesAtom",["java.lang.Float","JU.AU","JU.Elements","$.Logger"],function(){c$=G(function(){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.missingHydrogenCount=0;D(this,arguments)},JS,"SmilesAtom",JU.P3,JU.Node);L(c$,function(){this.bonds=Array(4)});
c$.allowSmilesUnbracketed=j(c$,"allowSmilesUnbracketed",function(a){return 0<="B, C, N, O, P, S, F, Cl, Br, I, *,".indexOf(a+",")},"~S");H(c$,function(){O(this,JS.SmilesAtom,[])});n(c$,"getAtomType",function(){return null==this.atomType?this.bioAtomName:this.atomType});j(c$,"getChiralClass",function(){return null==this.stereo?-2147483648:this.stereo.getChiralClass(this)});j(c$,"isDefined",function(){return this.hasSubpattern||0!=this.iNested||this.isBioAtom||-2147483648!=this.component||-2!=this.elementNumber||
0<this.nSubAtoms});j(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");j(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");j(c$,"setBonds",function(a){this.bonds=a},"~A");j(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");j(c$,"setIndex",function(a){this.index=a;return this},"~N");j(c$,"setTopoAtom",function(a,b,c,d){this.component=a;this.index=b;this.setSymbol(c);this.charge=d;this.isTopoAtom=!0;return this},"~N,~N,~S,~N");j(c$,"setHydrogenCount",function(){this.missingHydrogenCount=
this.explicitHydrogenCount;if(-2147483648!=this.explicitHydrogenCount)return!0;var a=JS.SmilesAtom.getDefaultCount(this.elementNumber,this.isAromatic);if(0>a)return this.missingHydrogenCount=0,-1==a;7==this.elementNumber&&this.isAromatic&&2==this.bondCount&&1==this.bonds[0].order&&1==this.bonds[1].order&&a++;for(var b=0;b<this.bondCount;b++){var c=this.bonds[b];switch(c.order){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.order}}0<=a&&(this.missingHydrogenCount=this.explicitHydrogenCount=a);return!0});c$.getDefaultCount=j(c$,"getDefaultCount",function(a,b){switch(a){case 0:case -1:case -2:return-1;case 6:return b?3:4;case 8:case 16:return 2;case 7:return b?2:3;case 5:case 15:return 3;case 9:case 17:case 35:case 53:return 1}return-2},"~N,~B");n(c$,"getIndex",function(){return this.index});j(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");n(c$,"getElementNumber",
function(){return this.elementNumber});j(c$,"getAtomicMass",function(){return this.atomicMass});n(c$,"getAtomNumber",function(){return this.atomNumber});j(c$,"setAtomicMass",function(a){this.atomicMass=a},"~N");j(c$,"getCharge",function(){return this.charge});j(c$,"setCharge",function(a){this.charge=a},"~N");j(c$,"getMatchingAtomIndex",function(){return this.matchingIndex});j(c$,"getMatchingAtom",function(){return this.matchingNode});j(c$,"setMatchingAtom",function(a,b){this.matchingNode=a;this.matchingIndex=
b},"JU.Node,~N");j(c$,"setExplicitHydrogenCount",function(a){this.explicitHydrogenCount=a},"~N");j(c$,"setImplicitHydrogenCount",function(a){this.implicitHydrogenCount=a},"~N");j(c$,"setDegree",function(a){this.degree=a},"~N");j(c$,"setNonhydrogenDegree",function(a){this.nonhydrogenDegree=a},"~N");j(c$,"setValence",function(a){this.valence=a},"~N");j(c$,"setConnectivity",function(a){this.connectivity=a},"~N");j(c$,"setRingMembership",function(a){this.ringMembership=a},"~N");j(c$,"setRingSize",function(a){this.ringSize=
a;if(500==this.ringSize||600==this.ringSize)this.isAromatic=!0},"~N");j(c$,"setRingConnectivity",function(a){this.ringConnectivity=a},"~N");n(c$,"getModelIndex",function(){return this.component});n(c$,"getMoleculeNumber",function(){return this.component},"~B");n(c$,"getAtomSite",function(){return this.atomSite});n(c$,"getFormalCharge",function(){return this.charge});n(c$,"getIsotopeNumber",function(){return this.atomicMass});n(c$,"getAtomicAndIsotopeNumber",function(){return JU.Elements.getAtomicAndIsotopeNumber(this.elementNumber,
this.atomicMass)});n(c$,"getAtomName",function(){return null==this.bioAtomName?"":this.bioAtomName});n(c$,"getGroup3",function(){return null==this.residueName?"":this.residueName},"~B");n(c$,"getGroup1",function(){return null==this.residueChar?"":this.residueChar},"~S");j(c$,"addBond",function(a){this.bondCount>=this.bonds.length&&(this.bonds=JU.AU.doubleLength(this.bonds));this.bonds[this.bondCount]=a;this.bondCount++},"JS.SmilesBond");j(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.order&&(b.order=112);b.atom1.index>b.atom2.index&&b.switchAtoms()}});n(c$,"getEdges",function(){return null!=this.parent?this.parent.getEdges():this.bonds});j(c$,"getBond",function(a){return null!=this.parent?this.parent.getBond(a):
0<=a&&a<this.bondCount?this.bonds[a]:null},"~N");n(c$,"getCovalentBondCount",function(){return this.getBondCount()});n(c$,"getBondCount",function(){return null!=this.parent?this.parent.getBondCount():this.bondCount});n(c$,"getCovalentBondCountPlusMissingH",function(){return this.getBondCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});n(c$,"getTotalHydrogenCount",function(){return this.getCovalentHydrogenCount()+(this.isTopoAtom?0:this.missingHydrogenCount)});n(c$,"getImplicitHydrogenCount",
function(){return this.implicitHydrogenCount});j(c$,"getExplicitHydrogenCount",function(){return this.explicitHydrogenCount});j(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");n(c$,"getBondedAtomIndex",function(a){return null!=this.parent?this.parent.getBondedAtomIndex(a):this.bonds[a].getOtherAtom(this).index},"~N");n(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});n(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.bonds.length;0<=
--b;)a+=this.bonds[b].getValence();return this.valence=a});n(c$,"getTotalValence",function(){return this.getValence()+(this.isTopoAtom?0:this.missingHydrogenCount)});j(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");j(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");n(c$,"isLeadAtom",function(){return this.$isLeadAtom});n(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].order)return this.bonds[c].getOtherAtom(this).index}return-1},"~S,~N");n(c$,"getGroupBits",function(a){a.set(this.index)},"JU.BS");n(c$,"isCrossLinked",function(a){return this.getBondTo(a).isHydrogen()},
"JU.Node");n(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");n(c$,"getBioStructureTypeName",function(){return null});n(c$,"getInsertionCode",function(){return this.insCode});n(c$,"getResno",function(){return this.residueNumber});
n(c$,"getChainID",function(){return 0});n(c$,"getChainIDStr",function(){return""});c$.getAtomLabel=j(c$,"getAtomLabel",function(a,b,c,d,e,f,g,h){var m=JU.Elements.elementSymbolFromNumber(a);g&&(m=m.toLowerCase(),6!=a&&(c=2147483647));return(2147483647==c||0!=b||0!=d||!Float.isNaN(e)||null!=h&&0<h.length?-1:JS.SmilesAtom.getDefaultCount(a,!1))==c?m:"["+(0>=b?"":""+b)+m+(null==h?"":h)+(1<f?"H"+f:1==f?"H":"")+(0>d&&-2147483648!=d?""+d:0<d?"+"+d:"")+(Float.isNaN(e)?"":":"+S(e))+"]"},"~N,~N,~N,~N,~N,~N,~B,~S");
n(c$,"getBioSmilesType",function(){return this.bioType});j(c$,"isNucleic",function(){return"n"==this.bioType||"r"==this.bioType||"d"==this.bioType});n(c$,"isPurine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="AG".indexOf(this.residueChar)});n(c$,"isPyrimidine",function(){return null!=this.residueChar&&this.isNucleic()&&0<="CTUI".indexOf(this.residueChar)});n(c$,"isDeleted",function(){return!1});n(c$,"findAtomsLike",function(){return null},"~S");n(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+")"});n(c$,"getFloatProperty",function(a){return"property_atomclass"===a?this.atomClass:NaN},"~S");n(c$,"getMass",function(){return this.atomicMass});n(c$,"getCIPChirality",function(){return""},"~B");n(c$,"setCIPChirality",function(){},"~N");n(c$,"getCIPChiralityCode",function(){return 0});n(c$,"getXYZ",function(){return this});K(c$,"UNBRACKETED_SET","B, C, N, O, P, S, F, Cl, Br, I, *,")});C("JS");A(["JU.Edge"],
"JS.SmilesBond",["JS.InvalidSmilesException"],function(){c$=G(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;D(this,arguments)},JS,"SmilesBond",JU.Edge);c$.getBondOrderString=j(c$,"getBondOrderString",function(a){switch(a){case 2:return"=";case 3:return"#";case 4:return"$";default:return""}},"~N");c$.getBondTypeFromCode=j(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");j(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},"JS.SmilesBond");j(c$,"setAtropType",function(a){this.atropType=
v(-1,[R(a/10)-1,a%10-1])},"~N");j(c$,"setPrimitive",function(a){a=this.primitives[a];this.order=a.order;this.isNot=a.isNot;this.atropType=a.atropType;return a},"~N");j(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});j(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});n(c$,"toString",function(){return this.atom1+" -"+(this.isNot?"!":"")+this.order+"- "+this.atom2});H(c$,function(a,b,c,d){O(this,JS.SmilesBond,[]);this.set2(c,d);this.set2a(a,b)},"JS.SmilesAtom,JS.SmilesAtom,~N,~B");
j(c$,"set2",function(a,b){this.order=a;this.isNot=b},"~N,~B");j(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");j(c$,"setAtom2",function(a){this.atom2=a;null!=this.atom2&&(a.addBond(this),this.isConnection=!0)},"JS.SmilesAtom,JS.SmilesSearch");j(c$,"isFromPreviousTo",function(a){return!this.isConnection&&this.atom2===a},"JS.SmilesAtom");c$.isBondType=
j(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");j(c$,"getBondType",function(){return this.order});j(c$,"getValence",function(){return this.order&7});j(c$,"getOtherAtom",function(a){return this.atom1===a?this.atom2:this.atom1},"JS.SmilesAtom");
n(c$,"getAtomIndex1",function(){return this.atom1.index});n(c$,"getAtomIndex2",function(){return this.atom2.index});n(c$,"getCovalentOrder",function(){return this.order});n(c$,"getOtherNode",function(a){return a===this.atom1?this.atom2:a===this.atom2||null==a?this.atom1:null},"JU.SimpleNode");n(c$,"isCovalent",function(){return 112!=this.order});n(c$,"isHydrogen",function(){return 112==this.order});j(c$,"switchAtoms",function(){var a=this.atom1;this.atom1=this.atom2;this.atom2=a;switch(this.order){case 65537:this.order=
65538;break;case 65538:this.order=65537;break;case 1025:this.order=1041;break;case 1041:this.order=1025}});K(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","-=#$:/\\.~^`")});C("JS");A(null,"JS.SmilesMeasure",["JU.PT"],function(){c$=G(function(){this.search=null;this.index=this.type=this.nPoints=0;this.isNot=!1;this.points=this.minmax=this.indices=null;D(this,arguments)},
JS,"SmilesMeasure");L(c$,function(){this.indices=v(4,0);this.points=Array(4)});H(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");j(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");j(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.targetAtoms[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=j(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");
n(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});K(c$,"TYPES","__dat","radiansPerDegree",0.017453292519943295)});C("JS");A(["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$=
G(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;D(this,arguments)},JS,"SmilesParser");L(c$,function(){this.connections=new java.util.Hashtable;this.htMeasures=new java.util.Hashtable});c$.newSearch=j(c$,"newSearch",function(a,b,c){return(new JS.SmilesParser(b,c)).parse(a)},
"~S,~B,~B");H(c$,function(a,b){this.isSmarts=a;this.isTarget=b},"~B,~B");j(c$,"parse",function(a){if(null==a)throw new JS.InvalidSmilesException("expression must not be null");var b=new JS.SmilesSearch;0<=a.indexOf("$(select")&&(a=this.parseNested(b,a,"select"));var c=v(1,0);a=JS.SmilesParser.extractFlags(a,c);this.flags=c[0];this.ignoreStereochemistry=32==(this.flags&32);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");j(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=v(1,0);for(f=null;0<=(c=a.indexOf("[$",c+1));){var g=c,h=-2147483648,m=-2147483648,c=JS.SmilesParser.getDigits(a,c+2,d),h=d[0];-2147483648!=h&&"-"==JS.SmilesParser.getChar(a,c)&&(c=JS.SmilesParser.getDigits(a,c+1,d),m=d[0]);if("("==JS.SmilesParser.getChar(a,c)&&(f=JS.SmilesParser.getSubPattern(a,g,"["),f.endsWith(")"))){var j=g+f.length+2,k=JS.SmilesParser.getSubPattern(a,c,"("),l=c;JS.SmilesParser.getSubPattern(a,
c,"[");c+=1+k.length;if(0<=k.indexOf(":")&&0>k.indexOf("|")){for(var n=0,q=k.length,p=-1,f=0;f<q;f++)switch(k.charAt(f)){case "[":case "(":n++;break;case ")":case "]":n--;break;case ".":0<=p&&0==n&&(q=f);break;case ":":0>p&&0==n&&(p=f)}0<p&&(k=k.substring(0,p)+"("+k.substring(p,q)+")"+k.substring(q))}if(-2147483648==h){if(f=k.indexOf("|"),0<=f)return this.parseVariableLength(a.substring(0,g)+"[$1"+a.substring(l,l+f+1)+")]"+a.substring(j)+"||"+a.substring(0,g)+"[$1("+a.substring(l+f+2)+a.substring(j))}else{-2147483648==
m&&(m=h);0<=k.indexOf("|")&&(k="[$("+k+")]");for(f=h;f<=m;f++){h=new JU.SB;h.append("||").append(a.substring(0,g));for(l=0;l<f;l++)h.append(k);h.append(a.substring(j));b.appendSB(h)}}}}}return e?this.parseVariableLength(b.substring(2)):2>b.length()?a:b.substring(2)},"~S");j(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.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");j(c$,"checkNested",function(a,b,c){if(0<b.iNested){var d=a.getNested(b.iNested);
if(N(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");j(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");j(c$,"parseSmiles",function(a,b,c,d){var e=v(1,0),
f=0,g,h=null,m=!1,j=!1;a:for(;null!=b&&0!=b.length;){var k=0;null==c&&(k=this.checkBioType(b,0),k==b.length&&(b+="*"),this.isBioSequence&&(a.needAromatic=a.top.needAromatic=!1));g=JS.SmilesParser.getChar(b,k);var l=this.checkBrace(a,g,"{");l&&(g=JS.SmilesParser.getChar(b,++k));if("("==g)if(h=JS.SmilesParser.getSubPattern(b,k,"("),g="."==JS.SmilesParser.getChar(b,k+1),null==c){if(g||!this.isSmarts)throw new JS.InvalidSmilesException("No previous atom for measure");a.haveComponents=!0;do this.componentCount++,
this.componentParenCount++,g=JS.SmilesParser.getChar(b=b.substring(1),0);while("("==g);if(!l&&!0==(l=this.checkBrace(a,g,"{")))g=JS.SmilesParser.getChar(b=b.substring(1),0)}else m=j=!1,h.startsWith(".")?(this.parseMeasure(a,h.substring(1),c),m=!0):0==h.length&&this.isBioSequence?c.notCrossLinked=!0:(this.branchLevel++,this.parseSmiles(a,h,c,!0),j=!0,this.branchLevel--),k=h.length+2,g=JS.SmilesParser.getChar(b,k),"}"==g&&this.checkBrace(a,g,"}")&&k++,g="\x00";if("\x00"!=g){f=k;b:for(;"\x00"!=g;){switch(JS.SmilesBond.isBondType(g,
this.isSmarts,this.isBioSequence)){case 0:break b;case -1:if(!((JU.PT.isDigit(JS.SmilesParser.getChar(b,++k))&&0<k++?JU.PT.isDigit(JS.SmilesParser.getChar(b,k++)):1)&&"-"==(g=JS.SmilesParser.getChar(b,k))))throw new JS.InvalidSmilesException("malformed atropisomerism bond ^nn-  or ^^nn-");continue}g=JS.SmilesParser.getChar(b,++k)}g=JS.SmilesParser.getChar(b,k);if(")"==g){switch(JS.SmilesParser.getChar(b,++k)){case "\x00":case ")":case ".":if(b=b.substring(k),this.componentParenCount--,0<=this.componentParenCount)continue a}throw new JS.InvalidSmilesException("invalid continuation after component grouping (SMARTS).(SMARTS)");
}h=this.parseBond(a,null,b.substring(f,k),null,c,!1,d,k-f,e);l&&-1!=h.order&&(g=JS.SmilesParser.getChar(b,k=f));this.checkBrace(a,g,"{")&&(g=JS.SmilesParser.getChar(b,++k));switch(g){case "~":0==h.order&&(k=this.checkBioType(b,k),k==b.length&&(b+="*"));break;case "(":do this.componentCount++,this.componentParenCount++,g=JS.SmilesParser.getChar(b,++k);while("("==g);break;case "\x00":if(0==h.order)return}l=JU.PT.isDigit(g)||"%"==g;f=!l&&("_"==g||"["==g||"*"==g||JU.PT.isLetter(g));if(l){if(m||j)throw new JS.InvalidSmilesException("connection number must immediately follow its connecting atom");
k=JS.SmilesParser.getRingNumber(b,k,g,e);this.parseConnection(a,e[0],c,h)}else if(f)switch(m=j=!1,g){case "[":case "_":l=JS.SmilesParser.getSubPattern(b,k,g);k+=l.length+("["==g?2:0);this.isBioSequence&&("["==g&&0>l.indexOf(".")&&0>l.indexOf("_"))&&(l+=".0");c=this.parseAtom(a,null,l,c,h,"["==g,!1,d);c.hasSubpattern=!0;-1!=h.order&&0!=h.order&&this.setBondAtom(h,null,c,a);break;default:l=!this.isBioSequence&&JU.PT.isUpperCase(g)?JS.SmilesParser.getChar(b,k+1):"\x00";if("X"!=g||"x"!=l)if(!JU.PT.isLowerCase(l)||
0==JU.Elements.elementNumberFromSymbol(b.substring(k,k+2),!0))l="\x00";"\x00"!=l&&0<="NA CA BA PA SC AC".indexOf(b.substring(k,k+2))&&(l="\x00");g=JU.PT.isUpperCase(g)&&JU.PT.isLowerCase(l)?2:1;c=this.parseAtom(a,null,b.substring(k,k+g),c,h,!1,!1,d);k+=g}else throw new JS.InvalidSmilesException("Unexpected character: "+JS.SmilesParser.getChar(b,k));g=JS.SmilesParser.getChar(b,k);"}"==g&&this.checkBrace(a,g,"}")&&k++}b=b.substring(k);d=!1}},"JS.SmilesSearch,~S,JS.SmilesAtom,~B");j(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.top.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");j(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=j(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");j(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");j(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 g=this.htMeasures.get(e);if(null==g==0>d||0==f)break;try{if(0<d){var h="__dat".indexOf(e.charAt(0));if(2>h)break;var m=v(1,0);JS.SmilesParser.getDigits(e,1,m);var j=m[0];b=b.substring(d+1);var k=b.startsWith("!");k&&(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 n=JU.PT.split(b,
",");if(1==n.length%2||k&&2!=n.length)break;for(var q=P(n.length,0),p=n.length;0<=--p&&!Float.isNaN(q[p]=JU.PT.fVal(n[p])););if(0<=p)break;g=new JS.SmilesMeasure(a,j,h,k,q);a.measures.addLast(g);0<j?this.htMeasures.put(e,g):0==j&&JU.Logger.debugging&&JU.Logger.debug("measure created: "+g)}else{if(!g.addPoint(c.index))break;g.nPoints==g.type&&(this.htMeasures.remove(e),JU.Logger.debugging&&JU.Logger.debug("measure created: "+g));return}if(!g.addPoint(c.index))break}catch(r){if(F(r,NumberFormatException))break;
else throw r;}return}throw new JS.InvalidSmilesException("invalid measure: "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom");j(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");j(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,g=b.substring(f);b=b.substring(0,d);var h="";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)))h="&";1<g.length&&0>",;&!)]".indexOf(g.charAt(0))&&(g="&"+g);b=b+h+"_"+a.top.addNested(e)+"_"+g}return b},"JS.SmilesSearch,~S,~S");j(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");j(c$,"parseAtom",function(a,b,c,d,e,f,g,h){if(null==c||0==c.length)throw new JS.InvalidSmilesException("Empty atom definition");var m=new JS.SmilesAtom;0<this.componentParenCount&&(m.component=this.componentCount);null==b&&a.appendAtom(m);if(!this.checkLogic(a,c,m,null,d,g,h,null)){var j=v(1,0);this.isBioSequence&&1==c.length&&(c+=".0");var k=c.charAt(0),l=0,n=!1;if(this.isSmarts&&"!"==k){k=JS.SmilesParser.getChar(c,++l);if("\x00"==k)throw new JS.InvalidSmilesException("invalid '!'");
m.not=n=!0}var q=c.indexOf(".");if(0<=q){m.isBioResidue=!0;var p=c.substring(l,q);c=c.substring(q+1).toUpperCase();var r=p.length;if(0<=(q=p.indexOf("^")))q==r-2&&(k=p.charAt(r-1),"*"!=k&&(m.insCode=k)),p=p.substring(0,q);if(0<=(q=p.indexOf("#")))JS.SmilesParser.getDigits(p,q+1,j),m.residueNumber=j[0],p=p.substring(0,q);0==p.length&&(p="*");1<p.length?m.residueName=p.toUpperCase():p.equals("*")||(m.residueChar=p);p=c;if(0<=(q=p.indexOf("#")))JS.SmilesParser.getDigits(p,q+1,j),m.elementNumber=j[0],
p=p.substring(0,q);0==p.length?p="*":p.equals("0")&&(p="\x00");p.equals("*")?m.isBioAtomWild=!0:m.setAtomName(p);k="\x00"}m.setBioAtom(this.bioType);for(q=-2147483648;"\x00"!=k;){m.setAtomName(this.isBioSequence?"\x00":"");if(JU.PT.isDigit(k)){l=JS.SmilesParser.getDigits(c,l,j);k=j[0];if(-2147483648==k)throw new JS.InvalidSmilesException("Non numeric atomic mass");"?"==JS.SmilesParser.getChar(c,l)&&(l++,k=-k);if(m.elementDefined)throw new JS.InvalidSmilesException('atom mass must precede atom symbol or be separated from it with ";"');
m.setAtomicMass(k)}else switch(k){case '"':k=JU.PT.getQuotedStringAt(c,l);l+=k.length+2;m.atomType=k;break;case "_":l=JS.SmilesParser.getDigits(c,l+1,j)+1;if(-2147483648==j[0])throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(l));m.iNested=j[0];if(!f)throw new JS.InvalidSmilesException("nesting must appear in [...]: $("+a.getNested(j[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,j);m.jmolIndex=j[0];break;case "#":k="-"==c.charAt(l+1);l=JS.SmilesParser.getDigits(c,l+(k?2:1),j);k?m.atomNumber=j[0]:m.elementNumber=j[0];break;case "-":case "+":l=this.checkCharge(c,l,m);break;case "@":null==a.stereo&&(a.stereo=JS.SmilesStereo.newStereo(null));l=JS.SmilesStereo.checkChirality(c,l,a.patternAtoms[m.index]);break;case ":":l=JS.SmilesParser.getDigits(c,++l,j);if(-2147483648==j[0])throw new JS.InvalidSmilesException("Invalid atom class");m.atomClass=j[0];break;default:var p=JS.SmilesParser.getChar(c,
l+1),r=l+(JU.PT.isLowerCase(p)&&(!f||!JU.PT.isDigit(JS.SmilesParser.getChar(c,l+2)))?2:1),A=c.substring(l+1,r),t=Character.toUpperCase(k)+A,u=!0;f&&JU.PT.isLetter(k)&&(!n&&(g?b:m).hasSymbol?u=!1:"H"==k?u=1==c.length||!JU.PT.isDigit(p):JU.PT.isDigit(p)?u=!1:!t.equals("A")&&!t.equals("Xx")&&(u=("h"==k?2==r:!0)&&0<JU.Elements.elementNumberFromSymbol(t,!0),!u&&2==r&&(A="",t=t.substring(0,1),u=0<JU.Elements.elementNumberFromSymbol(t,!0))));if(u){if(!f&&!this.isSmarts&&!this.isBioSequence&&!JS.SmilesAtom.allowSmilesUnbracketed(t)||
!m.setSymbol(t=k+A))throw new JS.InvalidSmilesException("Invalid atom symbol: "+t);g&&(b.hasSymbol=!0);l+=t.length}else switch(l=JS.SmilesParser.getDigits(c,l+1,j),r=j[0],k){default:throw new JS.InvalidSmilesException("Invalid SEARCH primitive: "+c.substring(l));case "D":m.setDegree(-2147483648==r?1:r);break;case "d":m.setNonhydrogenDegree(-2147483648==r?1:r);break;case "H":q=-2147483648==r?1:r;break;case "h":m.setImplicitHydrogenCount(-2147483648==r?-1:r);break;case "R":-2147483648==r&&(r=-1);m.setRingMembership(r);
a.top.needRingData=!0;break;case "r":if(-2147483648==r)r=-1,m.setRingMembership(r);else{m.setRingSize(r);switch(r){case 500:r=5;break;case 600:r=6}r>a.ringDataMax&&(a.ringDataMax=r)}a.top.needRingData=!0;break;case "v":m.setValence(-2147483648==r?1:r);break;case "X":m.setConnectivity(-2147483648==r?1:r);break;case "x":m.setRingConnectivity(-2147483648==r?-1:r),a.top.needRingData=!0}}k=JS.SmilesParser.getChar(c,l);if(n&&"\x00"!=k)throw new JS.InvalidSmilesException("'!' may only involve one primitive.");
}-2147483648==q&&f&&(q=-2147483647);m.setExplicitHydrogenCount(q);a.patternAtoms[m.index].setExplicitHydrogenCount(q)}0<this.braceCount&&(m.selected=!0);null!=b&&b.addSubAtom(m,g);null!=d&&0==e.order&&(m.notBondedIndex=d.index);null!=d&&0!=e.order&&(-1==e.order&&(e.order=this.isBioSequence&&h?112:this.isSmarts||d.isAromatic&&m.isAromatic?81:1),f||this.setBondAtom(e,null,m,a),0==this.branchLevel&&(17==e.order||112==e.order)&&this.branchLevel++);0==this.branchLevel&&(a.lastChainAtom=m);return m},"JS.SmilesSearch,JS.SmilesAtom,~S,JS.SmilesAtom,JS.SmilesBond,~B,~B,~B");
j(c$,"checkCharge",function(a,b,c){var d=a.length,e=a.charAt(b),f=1;++b;if(b<d){var g=a.charAt(b);if(JU.PT.isDigit(g)){if(d=v(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");j(c$,"parseBond",function(a,b,c,d,e,f,g,h,j){var n;if(0<h)switch(n=c.charAt(0)){case ">":if(!c.equals(">>")){h=-1;break}case ".":if(null==d&&null==b)return this.isBioSequence=
"~"==JS.SmilesParser.getChar(c,1),new JS.SmilesBond(null,null,0,!1);h=-1;break;case "+":null!=b&&(h=-1)}else n="\x00";d=null==b?null==d?new JS.SmilesBond(e,null,this.isBioSequence&&null!=e?g?112:96:-1,!1):d:f?b.addPrimitive():b.addBondOr();if(0<h&&!this.checkLogic(a,c,null,d,e,f,!1,j)){if(f="!"==n)if(n=JS.SmilesParser.getChar(c,1),"\x00"==n||"!"==n)throw new JS.InvalidSmilesException("invalid '!'");g=JS.SmilesBond.getBondTypeFromCode(n);65==g&&(a.top.needRingMemberships=!0);if(null==e&&0!=g)throw new JS.InvalidSmilesException("Bond without a previous atom");
switch(g){case 65537:case 65538:(h=c.length)<(f?3:2)||"-"!=c.charAt(h-1)?h=0:h==(f?3:2)?d.setAtropType(22):(JS.SmilesParser.getDigits(c,f?2:1,j),d.setAtropType(j[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(g,f);this.isBioSequence&&null!=b&&b.set2(g,f)}if(-1==h)throw new JS.InvalidSmilesException("invalid bond:"+n);return d},
"JS.SmilesSearch,JS.SmilesBond,~S,JS.SmilesBond,JS.SmilesAtom,~B,~B,~N,~A");j(c$,"checkLogic",function(a,b,c,d,e,f,g,h){var j=b.lastIndexOf("!");null!=c&&(c.pattern=b);for(;0<j;)0>",;&!".indexOf(b.charAt(j-1))&&(b=b.substring(0,j)+"&"+b.substring(j)),j=b.lastIndexOf("!",j-1);var j=b.indexOf(","),n=b.length,k="&";a:for(;;){var l=0<j;if(l&&!this.isSmarts||0==j)break;j=b.indexOf(";");if(0<=j){if(!this.isSmarts||0==j)break;l?(k=";",l=!1):b=b.$replace(";","&")}var v=0;if(l)for(b+=",";0<(j=b.indexOf(",",
v))&&j<=n;){v=b.substring(v,j);if(0==v.length)throw new JS.InvalidSmilesException("missing "+(null==d?"atom":"bond")+" token");null==d?this.parseAtom(a,c,v,null,null,!0,!1,g):this.parseBond(a,d,v,null,e,!1,!1,v.length,h);v=j+1}else if(0<=(j=b.indexOf(k))||null!=d&&1<n&&!f){if(0==j||null==d&&!this.isSmarts)break;if(null!=d&&0>j&&1<n){f=new JU.SB;for(l=0;l<n;){var q=b.charAt(l++);f.appendC(q);switch(q){case "!":if(!this.isSmarts)break a;continue;case "^":case "`":for(;"-"!=(q=b.charAt(l++))&&"\x00"!=
q;)f.appendC(q);f.appendC("-")}if(l<n){if(!this.isSmarts)break a;f.append(k)}}b=f.toString();n=b.length}for(b+=k;0<(j=b.indexOf(k,v))&&j<=n;)v=b.substring(v,j),null==d?this.parseAtom(a,c,v,null,null,!0,!0,g):this.parseBond(a,this.isSmarts?d:null,v,this.isSmarts?null:d,e,!0,!1,v.length,h),v=j+1}else return!1;return!0}q=b.charAt(j);throw new JS.InvalidSmilesException((this.isSmarts?"invalid placement for '"+q+"'":"["+q+"] notation only valid with SMARTS, not SMILES,")+" in "+b);},"JS.SmilesSearch,~S,JS.SmilesAtom,JS.SmilesBond,JS.SmilesAtom,~B,~B,~A");
c$.getSubPattern=j(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,h=b+1;h<f;h++){var j=a.charAt(h);if(j==d){if(g--,0==g)return a.substring(b+e,h+1-e)}else j==c&&g++}throw new JS.InvalidSmilesException("Unmatched "+c);},"~S,~N,~S");c$.getChar=j(c$,"getChar",function(a,b){return b<a.length?a.charAt(b):"\x00"},"~S,~N");c$.getDigits=j(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(!F(f,NumberFormatException))throw f;}c[0]=-2147483648;return d},"~S,~N,~A");c$.skipTo=j(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=j(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=j(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=j(c$,"getFlags",function(a){var b=v(1,0);JS.SmilesParser.extractFlags(a,b);return b[0]},"~S")});C("JS");A(null,"JS.SmilesExt","java.lang.Float JU.AU $.BS $.Lst $.M4 $.Measure $.P3 J.api.Interface JU.Logger".split(" "),
function(){c$=G(function(){this.sm=this.e=null;D(this,arguments)},JS,"SmilesExt");H(c$,function(){});j(c$,"init",function(a){this.e=a;this.sm=this.e.vwr.getSmilesMatcher();return this},"~O");j(c$,"getSmilesCorrelation",function(a,b,c,d,e,f,g,h,j,n,k,l){var v=null==j?0.1:3.4028235E38;try{null==d&&(d=new JU.Lst,e=new JU.Lst);var q=new JU.M4,p=new JU.P3,r=this.e.vwr.ms.at,A=this.e.vwr.ms.ac,t=this.sm.getCorrelationMaps(c,r,A,a,l|8);null==t&&this.e.evalError(this.sm.getLastException(),null);if(0==t.length)return NaN;
var u=t[0];for(a=0;a<u.length;a++)d.addLast(r[u[a]]);t=this.sm.getCorrelationMaps(c,r,A,b,l);null==t&&this.e.evalError(this.sm.getLastException(),null);if(0==t.length)return NaN;JU.Logger.info(t.length+" mappings found");if(k||!h){b=3.4028235E38;c=null;for(a=0;a<t.length;a++){e.clear();for(var y=0;y<t[a].length;y++)e.addLast(r[t[a][y]]);J.api.Interface.getInterface("JU.Eigen",this.e.vwr,"script");var w=1==e.size()?0:JU.Measure.getTransformMatrix4(d,e,q,null);JU.Logger.info("getSmilesCorrelation stddev="+
w);if(null!=g&&w<v){for(var x=new JU.BS,y=0;y<t[a].length;y++)x.set(t[a][y]);g.addLast(x)}w<b&&(c=t[a],null!=f&&f.setM4(q),null!=n&&n.setT(p),b=w)}null!=j&&(j[0]=u,j[1]=c);e.clear();for(a=0;a<c.length;a++)e.addLast(r[c[a]]);return b}for(a=0;a<t.length;a++)for(y=0;y<t[a].length;y++)e.addLast(r[t[a][y]])}catch(z){if(F(z,Exception))this.e.evalError(z.getMessage(),null);else throw z;}return 0},"JU.BS,JU.BS,~S,JU.Lst,JU.Lst,JU.M4,JU.Lst,~B,~A,JU.P3,~B,~N");j(c$,"getSmilesMatches",function(a,b,c,d,e,f,
g){if(0==a.length||a.endsWith("///")||a.equals("H")||a.equals("top")||a.equalsIgnoreCase("NOAROMATIC"))try{return this.e.vwr.getSmilesOpt(c,0,0,e|(a.equals("H")?4096:0)|(a.equals("top")?8192:0)|(a.equalsIgnoreCase("NOAROMATIC")?16:0),a.endsWith("///")?a:null)}catch(h){if(F(h,Exception))this.e.evalError(h.getMessage(),null);else throw h;}var j;if(null==d){d=2==(e&2);try{if(null==b)j=this.sm.getSubstructureSetArray(a,this.e.vwr.ms.at,this.e.vwr.ms.ac,c,null,e);else{var n=this.sm.find(a,b,(d?2:1)|(g?
8:0));if(!f)return!g?n:0==n.length?v(0,0):n[0];var k=new JU.BS;for(f=0;f<n.length;f++)for(var l=n[f],A=l.length;0<=--A;)0<=l[A]&&k.set(l[A]);if(!d)return v(k.cardinality(),0);var q=v(k.cardinality(),0);f=0;for(var p=k.nextSetBit(0);0<=p;p=k.nextSetBit(p+1))q[f++]=p;return q}}catch(r){if(F(r,Exception))return this.e.evalError(r.getMessage(),null),null;throw r;}}else{j=new JU.Lst;k=this.getSmilesCorrelation(d,c,a,null,null,null,j,!1,null,null,!1,e);if(Float.isNaN(k))return f?new JU.BS:M(-1,[]);this.e.showString("RMSD "+
k+" Angstroms");j=j.toArray(Array(j.size()))}if(f){k=new JU.BS;for(f=0;f<j.length;f++)k.or(j[f]);return k}k=new JU.Lst;for(f=0;f<j.length;f++)k.addLast(j[f]);return k},"~S,~S,JU.BS,JU.BS,~N,~B,~B");j(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=P(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=P(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=j(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")})})(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);
