(function(N,O,P,z,Q,A,q,H,I,K,L,R,M,S,x,B,T,s,U,V,W,X,Y,Z,$,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na,oa,pa,qa,ra,sa,ta,ua,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,l,t){A("JS");H(["JS.JmolMathExtension"],"JS.MathExt","java.lang.Float java.util.Date JU.AU $.BS $.CU $.Lst $.M3 $.M4 $.Measure $.P3 $.P4 $.PT $.Quat $.SB $.V3 J.api.Interface J.atomdata.RadiusData J.c.VDW J.i18n.GT JM.BondSet JS.SV $.ScriptParam $.T JU.BSUtil $.Escape $.JmolMolecule $.Logger $.Parser $.Point3fi".split(" "),function(){c$=K(function(){this.pm=
this.e=this.vwr=null;I(this,arguments)},JS,"MathExt",null,JS.JmolMathExtension);M(c$,function(){});t(c$,"init",function(d){this.e=d;this.vwr=this.e.vwr;return this},"~O");t(c$,"evaluate",function(d,a,b,c){switch(c){case 135266826:case 135266819:case 135266821:case 135266318:case 135266820:case 135266822:return this.evaluateMath(d,b,c);case 1276118017:case 1276117504:case 1276117507:case 1276117508:case 1276117511:case 1276384259:case 1276383249:return this.evaluateList(d,a.intValue,b);case 135266306:case 269484096:return this.evaluateArray(d,
b,269484096==c);case 135266307:case 135270418:return this.evaluateQuaternion(d,b,c);case 1276118529:return this.evaluateBin(d,b);case 135270423:return this.evaluateCache(d,b);case 1276117514:case 1276117515:return this.evaluateRowCol(d,b,c);case 1766856708:return this.evaluateColor(d,b);case 135270405:return this.evaluateCompare(d,b);case 135266310:return this.evaluateConnected(d,b);case 135402505:return this.evaluateContact(d,b);case 135267329:return this.evaluateCross(d,b);case 135270408:return this.evaluateData(d,
b);case 1276118018:case 1276117505:if(269484241==a.tok)return this.evaluateDot(d,b,c,a.intValue);case 135266305:case 1746538509:return this.evaluateMeasure(d,b,a.tok);case 1229984263:case 135271427:return this.evaluateLoad(d,b,1229984263==c);case 1276118531:return this.evaluateFind(d,b);case 1288701959:case 1826248716:return this.evaluateFormat(d,a.intValue,b,1826248716==c);case 135368713:return this.evaluateUserFunction(d,a.value,b,a.intValue,269484241==a.tok);case 1276121098:return this.evaluateGetProperty(d,
b,269484241==a.tok);case 137363467:return this.evaluateHelix(d,b);case 135267841:case 135266319:case 135267842:return this.evaluatePlane(d,b,c);case 135266829:case 135287308:case 135271429:case 135270926:return this.evaluateScript(d,b,c);case 1276118020:case 1276118021:case 1276117512:return this.evaluateString(d,a.intValue,b);case 135266320:return this.evaluatePoint(d,b);case 135304707:return this.evaluatePrompt(d,b);case 135267332:return this.evaluateRandom(d,b);case 1276116993:return this.evaluateIn(d,
b);case 1276121113:return this.evaluateModulation(d,b);case 1276120578:return this.evaluateReplace(d,b);case 135267335:case 135267336:case 1238369286:return this.evaluateSubstructure(d,b,c);case 1276117011:case 1276117012:return this.evaluateSort(d,b,c);case 1297090050:return this.evaluateSymop(d,b,269484241==a.tok);case 1276117016:return this.evaluateTensor(d,b);case 135266325:return this.evaluateWithin(d,b);case 135270422:return this.evaluateWrite(d,b)}return!1},"JS.ScriptMathProcessor,JS.T,~A,~N");
l(c$,"evaluateArray",function(d,a,b){var c=a.length;if(b&&(4==c||3==c)){var e=!0;for(b=0;b<c&&e;b++)e=7==a[b].tok&&a[b].getList().size()==c;if(e){var f=s(c*c,0),g=0;for(b=0;b<c&&e;b++)for(var h=a[b].getList(),k=0;k<c;k++){var j=JS.SV.fValue(h.get(k));if(Float.isNaN(j)){e=!1;break}f[g++]=j}if(e)return 3==c?d.addXM3(JU.M3.newA9(f)):d.addXM4(JU.M4.newA16(f))}}c=Array(a.length);for(b=c.length;0<=--b;)c[b]=JS.SV.newT(a[b]);return d.addXAV(c)},"JS.ScriptMathProcessor,~A,~B");l(c$,"evaluateBin",function(d,
a){if(3!=a.length)return!1;var b=d.getX(),c=13==b.tok;if(!c&&7!=b.tok)return d.addX(b);var e=JS.SV.fValue(a[0]),f=JS.SV.fValue(a[1]),g=JS.SV.fValue(a[2]);if(c)b=b.value;else for(var h=b.getList(),b=s(h.size(),0),c=h.size();0<=--c;)b[c]=JS.SV.fValue(h.get(c));for(var f=Math.max(z(Math.floor((f-e)/g+0.01)),1),h=B(f,0),k=b.length,c=0;c<k;c++){var j=z(Math.floor((b[c]-e)/g));0>j?j=0:j>=f&&(j=f-1);h[j]++}return d.addXAI(h)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateCache",function(d,a){return 0<a.length?
!1:d.addXMap(this.vwr.fm.cacheList())},"JS.ScriptMathProcessor,~A");l(c$,"evaluateColor",function(d,a){var b=0<a.length?JS.SV.sValue(a[0]):"",c=b.startsWith("$");if(2==a.length&&b.equalsIgnoreCase("TOHSL"))return d.addXPt(JU.CU.rgbToHSL(JU.P3.newP(8==a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString())),!0));if(2==a.length&&b.equalsIgnoreCase("TORGB")){var e=JU.P3.newP(8==a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString()));return d.addXPt(8==a[1].tok?JU.CU.hslToRGB(e):
e)}if(4==a.length&&(1048589==a[3].tok||1048588==a[3].tok)){var e=JU.P3.newP(8==a[0].tok?JS.SV.ptValue(a[0]):JU.CU.colorPtFromString(a[0].asString())),f=JU.P3.newP(8==a[1].tok?JS.SV.ptValue(a[1]):JU.CU.colorPtFromString(a[1].asString())),g=1048589==a[3].tok;g&&(e=JU.CU.rgbToHSL(e,!1),f=JU.CU.rgbToHSL(f,!1));var h=new JU.SB,f=JU.V3.newVsub(f,e),k=a[2].asInt();2>k&&(k=20);f.scale(1/(k-1));for(b=0;b<k;b++)h.append(JU.Escape.escapeColor(JU.CU.colorPtToFFRGB(g?JU.CU.hslToRGB(e):e))),e.add(f);return d.addXStr(h.toString())}f=
c?null:this.vwr.cm.getColorEncoder(b);if(!c&&null==f)return d.addXStr("");e=1<a.length?JS.SV.fValue(a[1]):3.4028235E38;k=2<a.length?JS.SV.fValue(a[2]):3.4028235E38;g=3<a.length?JS.SV.fValue(a[3]):3.4028235E38;h=3.4028235E38!=g||3.4028235E38!=e&&3.4028235E38==k;3.4028235E38==k&&0==b.length&&(g=e,k=this.vwr.getCurrentColorRange(),e=k[0],k=k[1]);if(c){f=[b.substring(1),null];if(!this.vwr.shm.getShapePropertyData(24,"colorEncoder",f))return d.addXStr("");f=f[1]}else f.setRange(e,k,e>k);b=f.getColorKey();
return h?d.addXPt(JU.CU.colorPtFromInt(f.getArgb(3.4028235E38==k?e:g),null)):d.addX(JS.SV.getVariableMap(b))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateCompare",function(d,a){if(2>a.length||5<a.length)return!1;var b,c=JS.SV.sValue(a[a.length-1]),e=c.equalsIgnoreCase("stddev"),f=c.equalsIgnoreCase("ISOMER"),g=c.equalsIgnoreCase("BONDS"),h=!f&&a.length>(e?3:2),k=10==a[0].tok?a[0].value:null,j=10==a[1].tok?a[1].value:null,n=null==k?JS.SV.sValue(a[0]):"",m=null==j?JS.SV.sValue(a[1]):"",p=new JU.M4;b=
NaN;var l,u;if(h&&(null==k||null==j))return!1;if(g){if(4!=a.length)return!1;n=JS.SV.sValue(a[2]);h=n.equalsIgnoreCase("SMILES");try{h&&(n=this.vwr.getSmiles(k))}catch(q){if(x(q,Exception))this.e.evalError(q.getMessage(),null);else throw q;}var r=this.e.getSmilesExt().getFlexFitList(k,j,n,!h);return null==r?d.addXStr(""):d.addXAF(r)}try{if(f){if(3!=a.length)return!1;if(null==k&&null==j)return d.addXStr(this.vwr.getSmilesMatcher().getRelationship(n,m).toUpperCase());var s=null==k?this.vwr.getSmilesMatcher().getMolecularFormula(n,
!1):JU.JmolMolecule.getMolecularFormula(this.vwr.ms.at,k,!1,null,!1),v=null==j?this.vwr.getSmilesMatcher().getMolecularFormula(m,!1):JU.JmolMolecule.getMolecularFormula(this.vwr.ms.at,j,!1,null,!1);if(!s.equals(v))return d.addXStr("NONE");null!=k&&(n=this.e.getSmilesExt().getSmilesMatches("",null,k,null,!1,!0));var w;w=null==j?0<this.vwr.getSmilesMatcher().areEqual(m,n):0<=this.e.getSmilesExt().getSmilesMatches(n,null,j,null,!1,!0).nextSetBit(0);if(!w){l=n+m;if(0<=l.indexOf("/")||0<=l.indexOf("\\")||
0<=l.indexOf("@")){if(0<=n.indexOf("@")&&(null!=j||0<=m.indexOf("@")))if(n=this.vwr.getSmilesMatcher().reverseChirality(n),w=null==j?0<this.vwr.getSmilesMatcher().areEqual(n,m):0<=this.e.getSmilesExt().getSmilesMatches(n,null,j,null,!1,!0).nextSetBit(0))return d.addXStr("ENANTIOMERS");null==j?w=0<this.vwr.getSmilesMatcher().areEqual("/nostereo/"+m,n):(r=this.e.getSmilesExt().getSmilesMatches("/nostereo/"+n,null,j,null,!1,!0),w=0<=r.nextSetBit(0));if(w)return d.addXStr("DIASTERIOMERS")}return d.addXStr("CONSTITUTIONAL ISOMERS")}if(null==
k||null==j)return d.addXStr("IDENTICAL");b=this.e.getSmilesExt().getSmilesCorrelation(k,j,n,null,null,null,null,!1,!1,null,null,!1,!1);return d.addXStr(0.2>b?"IDENTICAL":"IDENTICAL or CONFORMATIONAL ISOMERS (RMSD="+b+")")}if(h){l=new JU.Lst;u=new JU.Lst;var c=JS.SV.sValue(a[2]),y=c.equalsIgnoreCase("MAP"),h=c.equalsIgnoreCase("SMILES"),t=y||c.equalsIgnoreCase("SMARTS");if(h||t)c=3<a.length?JS.SV.sValue(a[3]):null;var B="H".equals(c)||"allH".equals(c)||"bestH".equals(c),C="all".equals(c)||"allH".equals(c),
E="best".equals(c)||"bestH".equals(c);if(null==c||B||C||E)if(y||h)c="/noaromatic"+(C||E?"/":" nostereo/")+this.e.getSmilesExt().getSmilesMatches(B?"H":"",null,k,null,!1,!0);else return!1;else C=!0;b=this.e.getSmilesExt().getSmilesCorrelation(k,j,c,l,u,p,null,!h,y,null,null,!C&&!E,E);if(y){var F=l.size();if(0==F)return d.addXStr("");for(var A=z(u.size()/F),r=new JU.Lst,n=j=0;j<A;j++){var G=JU.AU.newInt2(F);r.addLast(G);for(m=0;m<F;m++,n++)G[m]=[l.get(m).i,u.get(n).i]}return!C?0<r.size()?d.addXAII(r.get(0)):
d.addXStr(""):d.addXList(r)}}else l=this.e.getPointVector(a[0],0),u=this.e.getPointVector(a[1],0),null!=l&&null!=u&&(J.api.Interface.getInterface("JU.Eigen",this.vwr,"script"),b=JU.Measure.getTransformMatrix4(l,u,p,null));return e||Float.isNaN(b)?d.addXFloat(b):d.addXM4(p)}catch(D){if(x(D,Exception))return this.e.evalError(null==D.getMessage()?D.toString():D.getMessage(),null),!1;throw D;}},"JS.ScriptMathProcessor,~A");l(c$,"evaluateConnected",function(d,a){if(5<a.length)return!1;for(var b=-2147483648,
c=2147483647,e=0,f=3.4028235E38,g=65535,h=null,k=null,j=!1,n=!1,m=0;m<a.length;m++){var p=a[m];switch(p.tok){case 10:if((n=q(p.value,JM.BondSet))&&null!=h)return!1;if(null==h)h=JS.SV.bsSelectVar(p);else if(null==k)k=JS.SV.bsSelectVar(p);else return!1;break;case 4:g=JS.SV.sValue(p);g=g.equalsIgnoreCase("hbond")?30720:JS.ScriptParam.getBondOrderFromString(g);if(131071==g)return!1;break;case 3:j=!0;default:var l=p.asInt(),p=p.asFloat();if(2147483647!=c)return!1;-2147483648==b?(b=Math.max(l,0),e=p):(c=
l,f=p)}}-2147483648==b?(b=1,c=100,e=0.1,f=1E8):2147483647==c&&(c=b,f=e,e=0.1);null==h&&(h=this.vwr.getAllAtoms());j&&null==k&&(k=h);return null!=k?(b=new JU.BS,this.vwr.makeConnections(e,f,g,1087373321,h,k,b,n,!1,0),d.addX(JS.SV.newV(10,JM.BondSet.newBS(b,this.vwr.ms.getAtomIndices(this.vwr.ms.getAtoms(1678770178,b)))))):d.addXBs(this.vwr.ms.getAtomsConnected(b,c,g,h))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateContact",function(d,a){if(1>a.length||3<a.length)return!1;var b=0,c=100;switch(a[0].tok){case 3:case 2:c=
JS.SV.fValue(a[b++]);break;case 10:break;default:return!1}if(b==a.length||!q(a[b].value,JU.BS))return!1;var e=JU.BSUtil.copy(JS.SV.bsSelectVar(a[b++])),b=b<a.length?JU.BSUtil.copy(JS.SV.bsSelectVar(a[b])):null,c=new J.atomdata.RadiusData(null,10<c?c/100:c,10<c?J.atomdata.RadiusData.EnumType.FACTOR:J.atomdata.RadiusData.EnumType.OFFSET,J.c.VDW.AUTO),b=this.setContactBitSets(e,b,!0,NaN,c,!1);b.or(e);return d.addXBs(b)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateCross",function(d,a){if(2!=a.length)return!1;
var b=a[0],c=a[1];if(8!=b.tok||8!=c.tok)return!1;b=JU.V3.newV(b.value);c=JU.V3.newV(c.value);b.cross(b,c);return d.addXPt(JU.P3.newP(b))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateData",function(d,a){if(1!=a.length&&2!=a.length&&4!=a.length)return!1;var b=JS.SV.sValue(a[0]),c=2==a.length?JS.SV.sValue(a[1]):"";if(4==a.length){var c=a[1].asInt(),e=a[2].asInt(),f=a[3].asInt(),b=JU.Parser.parseFloatArrayFromMatchAndField(b,null,0,0,null,c,e,null,f);return d.addXStr(JU.Escape.escapeFloatA(b,!1))}if(0==
b.indexOf("data2d_"))return b=this.vwr.getDataFloat2D(b),null==b?d.addXStr(""):2==a.length&&2==a[1].tok?(c=a[1].intValue,0>c&&(c+=b.length),0<=c&&c<b.length?d.addXStr(JU.Escape.escapeFloatA(b[c],!1)):d.addXStr("")):d.addXStr(JU.Escape.escapeFloatAA(b,!1));if(0==b.indexOf("property_")){b=this.vwr.getDataFloat(b);if(null==b)return d.addXStr("");c=0==c.indexOf("property_")?this.vwr.getDataFloat(c):null;if(null!=c){b=JU.AU.arrayCopyF(b,-1);for(e=Math.min(b.length,c.length);0<=--e;)b[e]+=c[e]}return d.addXStr(JU.Escape.escapeFloatA(b,
!1))}return 1==a.length?(b=this.vwr.getData(b),d.addXStr(null==b?"":""+b[1])):d.addXStr(this.vwr.getData(b,c))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateDot",function(d,a,b,c){switch(a.length){case 1:if(1276117505==b)return!1;case 2:break;default:return!1}var e=d.getX(),f=a[0],g=7==f.tok?null:d.ptValue(f,!1),h=d.planeValue(f);if(1276118018==b){var k=c&480,j=32==k||64==k,n=480==k;switch(e.tok){case 10:var m=JS.SV.bsSelectVar(e),p=null;a=j&&2==a.length&&a[1].asBoolean();switch(f.tok){case 10:p=10==
f.tok?JS.SV.bsSelectVar(f):null;case 8:b=this.vwr.ms.at;if(a){n=NaN;f=2147483647;for(j=m.nextSetBit(0);0<=j;j=m.nextSetBit(j+1))if(a=null==p?b[j].distanceSquared(g):this.e.getBitsetProperty(p,c,b[j],h,e.value,null,!1,e.index,!1).floatValue(),!(32==k?a>=n:a<=n))n=a,f=j;return d.addXBs(2147483647==f?new JU.BS:JU.BSUtil.newAndSetBit(f))}if(n){if(null==p){n=s(m.cardinality(),0);k=0;for(j=m.nextSetBit(0);0<=j;j=m.nextSetBit(j+1),k++)n[k]=b[j].distance(g);return d.addXAF(n)}c=s(m.cardinality(),p.cardinality(),
0);k=0;for(j=m.nextSetBit(0);0<=j;j=m.nextSetBit(j+1),k++){e=0;for(g=p.nextSetBit(0);0<=g;g=p.nextSetBit(g+1),e++)c[k][e]=b[j].distance(b[g])}return d.addXAFF(c)}if(j){n=s(m.cardinality(),0);j=m.nextSetBit(0);for(k=0;0<=j;j=m.nextSetBit(j+1))n[k++]=this.e.getBitsetProperty(p,c,b[j],h,e.value,null,!1,e.index,!1).floatValue();return d.addXAF(n)}return d.addXObj(this.e.getBitsetProperty(m,c,g,h,e.value,null,!1,e.index,!1))}}}return d.addXFloat(this.getDistance(d,e,f,b))},"JS.ScriptMathProcessor,~A,~N,~N");
l(c$,"evaluateHelix",function(d,a){if(1>a.length||5<a.length)return!1;var b=2<a.length?3:1,c=b>=a.length?"array":JS.SV.sValue(a[b]),b=JS.T.getTokFromName(c);if(2<a.length){var e=d.ptValue(a[0],!0),f=d.ptValue(a[1],!0);if(0==b||9!=a[2].tok)return!1;var g=JU.Quat.newP4(a[2].value),g=JU.Measure.computeHelicalAxis(e,f,g);return null==g?!1:d.addXObj(JU.Escape.escapeHelical(c,b,e,f,g))}c=q(a[0].value,JU.BS)?a[0].value:this.vwr.ms.getAtoms(1095761939,new Integer(a[0].asInt()));switch(b){case 135266320:return d.addXObj(this.getHelixData(c,
135266320));case 1073741854:return d.addXObj(this.getHelixData(c,1073741854));case 1666189314:return d.addXObj(this.getHelixData(c,1666189314));case 135266305:return d.addXFloat(this.getHelixData(c,135266305).floatValue());case 135176:case 1746538509:return d.addXObj(this.getHelixData(c,b));case 135266306:g=this.getHelixData(c,1073742001);if(null==g)break;return d.addXAS(g)}return!1},"JS.ScriptMathProcessor,~A");l(c$,"getHelixData",function(d,a){var b=d.nextSetBit(0);return 0>b?"null":this.vwr.ms.at[b].group.getHelixData(a,
this.vwr.getQuaternionFrame(),this.vwr.getInt(553648146))},"JU.BS,~N");l(c$,"evaluateFind",function(d,a){if(0==a.length)return!1;var b=d.getX(),c=JS.SV.sValue(a[0]),e=1<a.length&&1048589!=a[1].tok&&1048588!=a[1].tok?JS.SV.sValue(a[1]):"",f=c.equalsIgnoreCase("SEQUENCE"),g=c.equalsIgnoreCase("SMILES"),h=c.equalsIgnoreCase("SMARTS"),k=c.equalsIgnoreCase("CHEMICAL"),j=c.equalsIgnoreCase("MF"),n=c.equalsIgnoreCase("CELLFORMULA"),m=1048589==a[a.length-1].tok;try{if(k){var p=10==b.tok?this.vwr.getSmiles(JS.SV.getBitSet(b,
!1)):JS.SV.sValue(b),p=0==p.length?"":this.vwr.getChemicalInfo(p,1<a.length?JS.T.getTokenFromName(e.toLowerCase()):null);p.endsWith("\n")&&(p=p.substring(0,p.length-1));p.startsWith("InChI")&&(p=JU.PT.rep(JU.PT.rep(p,"InChI=",""),"InChIKey=",""));return d.addXStr(p)}if(g||h||10==b.tok){var k=g||h?2:1,l=k<a.length&&10==a[k].tok?a[k++].value:null,q="bonds".equalsIgnoreCase(JS.SV.sValue(a[a.length-1])),k=q||m,p=null;switch(b.tok){case 4:var s=JS.SV.sValue(b);if(null!=l)return!1;p=e.equalsIgnoreCase("mf")?
this.vwr.getSmilesMatcher().getMolecularFormula(s,h):this.e.getSmilesExt().getSmilesMatches(e,s,null,null,h,!k);break;case 10:if(j&&0!=e.length)return d.addXBs(JU.JmolMolecule.getBitSetForMF(this.vwr.ms.at,b.value,e));if(j||n)return d.addXStr(JU.JmolMolecule.getMolecularFormula(this.vwr.ms.at,b.value,!1,j?null:this.vwr.ms.getCellWeights(b.value),m));if(f)return d.addXStr(this.vwr.getSmilesOpt(b.value,-1,-1,!1,!0,k,k,!1));if(g||h)c=e;if(q)var r=this.vwr.getSmilesMatcher().getCorrelationMaps(c,this.vwr.ms.at,
this.vwr.ms.ac,b.value,!g,!0),p=0<r.length?this.vwr.ms.getDihedralMap(r[0]):B(0,0);else p=this.e.getSmilesExt().getSmilesMatches(c,null,b.value,l,!g,!k)}null==p&&this.e.invArg();return d.addXObj(p)}}catch(t){if(x(t,Exception))this.e.evalError(t.getMessage(),null);else throw t;}f=0<=e.indexOf("v");j=0<=e.indexOf("i");e=0<=e.indexOf("m");g=7==b.tok;h=2==a.length;if(g||h){n=this.getPatternMatcher();h=null;try{h=n.compile(c,j)}catch(v){if(x(v,Exception))this.e.evalError(v.toString(),null);else throw v;
}b=JS.SV.strListValue(b);JU.Logger.debugging&&JU.Logger.debug("finding "+c);c=new JU.BS;j=l=0;q=null;n=e?new JU.Lst:null;for(m=0;m<b.length;m++)if(s=b[m],q=h.matcher(s),r=q.find(),e&&r||!e&&r==!f)j++,l=m,c.set(m),e&&n.addLast(f?s.substring(0,q.start())+s.substring(q.end()):q.group());if(!g)return e?d.addXStr(1==n.size()?n.get(0):""):f?d.addXBool(1==j):e?d.addXStr(0==j?"":q.group()):d.addXInt(0==j?0:q.start()+1);if(1==j)return d.addXStr(e?n.get(0):b[l]);f=Array(j);if(0<j)for(m=b.length;0<=--m;)c.get(m)&&
(--j,f[j]=e?n.get(j):b[m]);return d.addXAS(f)}return d.addXInt(JS.SV.sValue(b).indexOf(c)+1)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateGetProperty",function(d,a,b){var c=0,e=0==a.length?0:a[0].tok;if(2==a.length&&(7==e||6==e||14==e))return d.addXObj(this.vwr.extractProperty(a[0].value,a[1].value.toString(),-1));var e=0<a.length?JS.SV.sValue(a[c++]):"",f=e.toLowerCase();0>f.indexOf("[select ")&&(e=f);f=!1;e.equals("json")&&a.length>c&&(f=!0,e=JS.SV.sValue(a[c++]));e.startsWith("$");b&&!e.equalsIgnoreCase("bondInfo")&&
(e="atomInfo."+e);var g="";if(e.equalsIgnoreCase("fileContents")&&2<a.length){c=JS.SV.sValue(a[1]);for(g=2;g<a.length;g++)c+="|"+JS.SV.sValue(a[g]);g=c;c=a.length}else if(a.length>c)switch(a[c].tok){case 10:g=JS.SV.bsSelectVar(a[c++]);e.equalsIgnoreCase("bondInfo")&&(a.length>c&&10==a[c].tok)&&(g=[g,JS.SV.bsSelectVar(a[c])]);break;case 4:this.vwr.checkPropertyParameter(e)&&(g=a[c++].value)}if(b){g=d.getX();if(10!=g.tok)return!1;g=JS.SV.bsSelectVar(g).nextSetBit(0);if(0>g)return d.addXStr("");g=JU.BSUtil.newAndSetBit(g)}g=
this.vwr.getProperty(null,e,g);c<a.length&&(g=this.vwr.extractProperty(g,a,c));b&&q(g,JU.Lst)&&(g=0<g.size()?g.get(0):"");return d.addXObj(f?"{"+JU.PT.toJSON("value",g)+"}":JS.SV.isVariableType(g)?g:JU.Escape.toReadable(e,g))},"JS.ScriptMathProcessor,~A,~B");l(c$,"evaluateFormat",function(d,a,b,c){var e=2>b.length?d.getX():null,f=0==b.length?"%U":JS.SV.sValue(b[0]);if(null==e){e=c?-1:JS.SV.getFormatType(f);if(0<=e&&2!=b.length)return!1;if(0<=e||2>b.length||7!=b[1].tok)return d.addXObj(JS.SV.format(b,
e));f=b[1].getList();b=[b[0],null];a=Array(f.size());for(c=a.length;0<=--c;)b[1]=f.get(c),a[c]=JS.SV.format(b,e).toString();return d.addXAS(a)}b=JS.SV.getBitSet(e,!0);a=JS.T.tokAttr(a,480);return d.addXObj(null==b?JS.SV.sprintf(JU.PT.formatCheck(f),e):this.e.getCmdExt().getBitsetIdent(b,f,e.value,!0,e.index,a))},"JS.ScriptMathProcessor,~N,~A,~B");l(c$,"evaluateList",function(d,a,b){var c=b.length,e=d.getX(),f=7==e.tok,g;switch(a){case 1276384259:return 2==c&&d.addX(e.pushPop(b[1],b[0]))||1==c&&d.addX(e.pushPop(b[0],
null));case 1276383249:return 1==c&&d.addX(e.pushPop(null,b[0]))||0==c&&d.addX(e.pushPop(null,null));case 1276118017:if(1!=c&&2!=c)return!1;break;case 1276118021:case 1276118020:break;default:if(1!=c)return!1}var h=null,k=null,j=null;if(2==c){var n=JS.SV.sValue(b[0]);g=b[1];if(1276118017==a){h=f?JS.SV.strListValue(e):JU.PT.split(JS.SV.sValue(e),"\n");k=7==g.tok?JS.SV.strListValue(g):JU.PT.split(JS.SV.sValue(g),"\n");j=Array(c=Math.max(h.length,k.length));for(e=0;e<c;e++)j[e]=(e>=h.length?"":h[e])+
n+(e>=k.length?"":k[e]);return d.addXAS(j)}if(1048589!=g.tok)return!1;j=e.getList();(c=0==n.length)&&(n=",");if(1276118020==a){k=Array(j.size());for(e=j.size();0<=--e;)if(b=j.get(e).getList(),null==b)k[e]=j.get(e);else{a=new JU.SB;f=0;for(h=b.size();f<h;f++)0<f&&a.append(n),g=b.get(f),a.append(c&&4==g.tok?'"'+JU.PT.rep(g.value,'"','""')+'"':""+g.asString());k[e]=JS.SV.newS(a.toString())}return d.addXAV(k)}a=new JU.Lst;c&&(n="\x00");k=B(2,0);e=0;for(g=j.size();e<g;e++){f=j.get(e).asString();if(c){k[1]=
0;for(h=k[0]=0;;){b=JU.PT.getCSVString(f,k);if(null==b){if(-1==k[1]){f+=++e<g?"\n"+j.get(e).asString():'"';k[1]=h;continue}f=f.substring(0,h)+f.substring(h).$replace(",","\x00");break}f=f.substring(0,h)+f.substring(h,k[0]).$replace(",","\x00")+b+f.substring(k[1]);k[1]=h=k[0]+b.length}}for(var m=f.$plit(n),l=new JU.Lst,f=0,h=m.length;f<h;f++){b=m[f];if(0>b.indexOf("."))try{l.addLast(JS.SV.newI(Integer.parseInt(b)));continue}catch(q){if(!x(q,Exception))throw q;}else try{l.addLast(JS.SV.getVariable(Float.$valueOf(Float.parseFloat(b))));
continue}catch(u){if(!x(u,Exception))throw u;}l.addLast(JS.SV.newS(b))}a.addLast(JS.SV.getVariableList(l))}return d.addXObj(JS.SV.getVariableList(a))}g=0==c?JS.SV.newV(1048579,"all"):b[0];j=1048579==g.tok;if(!f&&4!=e.tok)return d.binaryOp(this.opTokenFor(a),e,g);var m=JS.SV.isScalar(e),t=JS.SV.isScalar(g),r=l=null,n=e.getList(),z=g.getList();f?c=n.size():m?c=2147483647:(h=JU.PT.split(JS.SV.sValue(e),"\n"),l=s(c=h.length,0),JU.PT.parseFloatArrayData(h,l));if(j&&1276118020!=a){j=0;if(f)for(e=c;0<=--e;)j+=
JS.SV.fValue(n.get(e));else if(!m)for(e=c;0<=--e;)j+=l[e];return d.addXFloat(j)}if(1276118020==a&&4==g.tok){a=new JU.SB;if(m)a.append(JS.SV.sValue(e));else{b=j?"":g.value.toString();for(e=0;e<c;e++)a.append(0<e?b:"").append(JS.SV.sValue(n.get(e)))}return d.addXStr(a.toString())}var v=null;t?v=g:7==g.tok?c=Math.min(c,z.size()):(k=JU.PT.split(JS.SV.sValue(g),"\n"),r=s(k.length,0),JU.PT.parseFloatArrayData(k,r),c=Math.min(c,r.length));var w=this.opTokenFor(a),y=Array(c);if(f&&j)return j=new JU.Lst,d.addXList(this.addAllLists(e.getList(),
j));b=m?e:null;for(var A,e=0;e<c;e++){A=t?v:7==g.tok?z.get(e):Float.isNaN(r[e])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(k[e])):JS.SV.newV(3,Float.$valueOf(r[e]));m||(b=f?n.get(e):Float.isNaN(l[e])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(h[e])):JS.SV.newV(3,Float.$valueOf(l[e])));1276118020==a&&7!=b.tok&&(j=new JU.Lst,j.addLast(b),b=JS.SV.getVariableList(j));if(!d.binaryOp(w,b,A))return!1;y[e]=d.getX()}return d.addXAV(y)},"JS.ScriptMathProcessor,~N,~A");l(c$,"addAllLists",
function(d,a){for(var b=d.size(),c=0;c<b;c++){var e=d.get(c);7==e.tok?this.addAllLists(e.getList(),a):a.addLast(e)}return a},"JU.Lst,JU.Lst");l(c$,"evaluateLoad",function(d,a,b){var c=-1,e=!1,f=this.vwr.async;switch(a.length){case 3:f=JS.SV.bValue(a[2]);case 2:c=2==a[1].tok?a[1].asInt():-1,e=1048589==a[1].tok;case 1:a=JS.SV.sValue(a[0]);a=a.$replace("\\","/");break;default:return!1}if(e)return d.addXMap(this.vwr.fm.getFileAsMap(a));e=a.startsWith("?");if(this.vwr.isJS&&(e||f)){if(b&&e)return d.addXStr("");
a=this.e.loadFileAsync("load()_",a,d.oPt,!0)}return d.addXStr(b?this.vwr.fm.getFilePath(a,!1,!1):this.vwr.getFileAsString4(a,c,!1,!1,!0,"script"))},"JS.ScriptMathProcessor,~A,~B");l(c$,"evaluateMath",function(d,a,b){if(135266318==b)return 1==a.length&&4==a[0].tok?d.addXStr(new java.util.Date+"\t"+JS.SV.sValue(a[0])):d.addXInt((System.currentTimeMillis()&2147483647)-(0==a.length?0:a[0].asInt()));if(1!=a.length)return!1;if(135266826==b)return 2==a[0].tok?d.addXInt(Math.abs(a[0].asInt())):d.addXFloat(Math.abs(a[0].asFloat()));
a=JS.SV.fValue(a[0]);switch(b){case 135266819:return d.addXFloat(180*Math.acos(a)/3.141592653589793);case 135266821:return d.addXFloat(Math.cos(3.141592653589793*a/180));case 135266820:return d.addXFloat(Math.sin(3.141592653589793*a/180));case 135266822:return d.addXFloat(Math.sqrt(a))}return!1},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateMeasure",function(d,a,b){var c=0;switch(b){case 1746538509:b=new JU.Lst;for(var e=[3.4028235E38,3.4028235E38],f=null,g=null,h=!1,k=!1,j=0,l=!1,m=null,p=0,q=3.4028235E38,
s=!1,t=!1,m=0;m<a.length;m++)switch(a[m].tok){case 10:var r=a[m].value;0==r.length()&&(l=!0);b.addLast(r);c++;p++;break;case 8:r=new JU.Point3fi;r.setT(a[m].value);b.addLast(r);c++;break;case 2:case 3:e[j++%2]=JS.SV.fValue(a[m]);break;case 4:r=JS.SV.sValue(a[m]);r.equalsIgnoreCase("vdw")||r.equalsIgnoreCase("vanderwaals")?q=(m+1<a.length&&2==a[m+1].tok?a[++m].asInt():100)/100:r.equalsIgnoreCase("notConnected")?k=!0:r.equalsIgnoreCase("connected")?h=!0:r.equalsIgnoreCase("minArray")?s=1<=p:r.equalsIgnoreCase("asArray")?
t=1<=p:JU.PT.isOneOf(r.toLowerCase(),";nm;nanometers;pm;picometers;angstroms;ang;au;")||r.endsWith("hz")?g=r.toLowerCase():f=c+":"+r;break;default:return!1}if(2>c||4<c||2<j||k&&h)return!1;if(l||3.4028235E38!=q&&(2!=p||2!=c))return d.addXStr("");m=3.4028235E38==q?new J.atomdata.RadiusData(e,0,null,null):new J.atomdata.RadiusData(null,q,J.atomdata.RadiusData.EnumType.FACTOR,J.c.VDW.AUTO);return d.addXObj(this.vwr.newMeasurementData(null,b).set(0,null,m,f,g,null,h,k,null,!0,0,0,null).getMeasurements(t,
s));case 135266305:if(3!=(c=a.length)&&4!=c)return!1;break;default:if(2!=(c=a.length))return!1}b=Array(c);for(m=0;m<c;m++)b[m]=d.ptValue(a[m],!0);switch(c){case 2:return d.addXFloat(b[0].distance(b[1]));case 3:return d.addXFloat(JU.Measure.computeAngleABC(b[0],b[1],b[2],!0));case 4:return d.addXFloat(JU.Measure.computeTorsion(b[0],b[1],b[2],b[3],!0))}return!1},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateModulation",function(d,a){var b="",c=NaN,e=null;switch(a.length){case 0:break;case 1:switch(a[0].tok){case 8:e=
a[0].value;break;case 4:b=a[0].asString();break;default:c=JS.SV.fValue(a[0])}break;case 2:b=JS.SV.sValue(a[0]);c=JS.SV.fValue(a[1]);break;default:return!1}null==e&&1E6>c&&(e=JU.P3.new3(c,c,c));c=JS.SV.getBitSet(d.getX(),!1);return d.addXList(this.vwr.ms.getModulationList(c,(b+"D").toUpperCase().charAt(0),e))},"JS.ScriptMathProcessor,~A");l(c$,"evaluatePlane",function(d,a,b){if(135267841==b&&3!=a.length||135267842==b&&2!=a.length&&3!=a.length||0==a.length||4<a.length)return!1;var c,e,f,g,h;switch(a.length){case 1:if(10==
a[0].tok&&(b=JS.SV.getBitSet(a[0],!1),3==b.cardinality()))return a=this.vwr.ms.getAtomPointVector(b),d.addXPt4(JU.Measure.getPlaneThroughPoints(a.get(0),a.get(1),a.get(2),new JU.V3,new JU.V3,new JU.P4));a=JU.Escape.uP(JS.SV.sValue(a[0]));return q(a,JU.P4)?d.addXPt4(a):d.addXStr(""+a);case 2:if(135267842==b){if(9!=a[1].tok)return!1;f=new JU.P3;b=new JU.V3;h=new JU.V3;g=a[1].value;if(9==a[0].tok)return a=JU.Measure.getIntersectionPP(a[0].value,g),null==a?d.addXStr(""):d.addXList(a);e=d.ptValue(a[0],
!1);return null==e?d.addXStr(""):d.addXPt(JU.Measure.getIntersection(e,null,g,f,b,h))}case 3:case 4:switch(b){case 135267841:return d.addXPt4(this.e.getHklPlane(JU.P3.new3(JS.SV.fValue(a[0]),JS.SV.fValue(a[1]),JS.SV.fValue(a[2]))));case 135267842:c=d.ptValue(a[0],!1);e=d.ptValue(a[1],!1);if(null==c||null==e)return d.addXStr("");e=JU.V3.newV(e);e.normalize();if(9==a[2].tok)return f=new JU.P3,b=new JU.V3,h=new JU.V3,c=JU.Measure.getIntersection(c,e,a[2].value,f,b,h),null==c?d.addXStr(""):d.addXPt(c);
f=d.ptValue(a[2],!1);if(null==f)return d.addXStr("");a=new JU.V3;JU.Measure.projectOntoAxis(f,c,e,a);return d.addXPt(f)}switch(a[0].tok){case 2:case 3:if(3==a.length)return c=JS.SV.fValue(a[0]),f=JS.SV.fValue(a[1]),a=JS.SV.fValue(a[2]),b=JU.V3.new3(0,0,1),e=JU.P3.new3(0,1,0),a=JU.Quat.newVA(e,a),a.getMatrix().rotate(b),e.set(0,0,1),a=JU.Quat.newVA(e,f),a.getMatrix().rotate(b),e.setT(b),e.scale(c),g=new JU.P4,JU.Measure.getPlaneThroughPoint(e,b,g),d.addXPt4(g);break;case 10:case 8:c=d.ptValue(a[0],
!1);e=d.ptValue(a[1],!1);if(null==e)return!1;f=2<a.length&&(10==a[2].tok||8==a[2].tok)?d.ptValue(a[2],!1):null;b=JU.V3.newV(e);if(null==f)return g=new JU.P4,2==a.length||!a[2].asBoolean()?(f=JU.P3.newP(c),f.add(e),f.scale(0.5),b.sub(c),b.normalize()):1048589==a[2].tok?f=c:(b.sub(c),f=new JU.P3,f.scaleAdd2(a[2].asFloat(),b,c)),JU.Measure.getPlaneThroughPoint(f,b,g),d.addXPt4(g);h=new JU.V3;a=JU.Measure.getDirectedNormalThroughPoints(c,e,f,4==a.length?d.ptValue(a[3],!0):null,b,h);return d.addXPt4(JU.P4.new4(b.x,
b.y,b.z,a))}}if(4!=a.length)return!1;b=JS.SV.fValue(a[0]);e=JS.SV.fValue(a[1]);c=JS.SV.fValue(a[2]);a=JS.SV.fValue(a[3]);return d.addXPt4(JU.P4.new4(b,e,c,a))},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluatePoint",function(d,a){switch(a.length){default:return!1;case 1:if(3==a[0].tok||2==a[0].tok)return d.addXInt(a[0].asInt());var b=JS.SV.sValue(a[0]);7==a[0].tok&&(b="{"+b+"}");b=JU.Escape.uP(b);return q(b,JU.P3)?d.addXPt(b):d.addXStr(""+b);case 2:b=JS.SV.ptValue(a[0]);if(null==b)return!1;1048588==
a[1].tok?this.vwr.tm.unTransformPoint(b,b):this.vwr.tm.transformPt3f(b,b);return d.addXPt(b);case 3:return d.addXPt(JU.P3.new3(a[0].asFloat(),a[1].asFloat(),a[2].asFloat()));case 4:return d.addXPt4(JU.P4.new4(a[0].asFloat(),a[1].asFloat(),a[2].asFloat(),a[3].asFloat()))}},"JS.ScriptMathProcessor,~A");l(c$,"evaluatePrompt",function(d,a){if(1!=a.length&&2!=a.length&&3!=a.length)return!1;var b=JS.SV.sValue(a[0]),c=1<a.length&&7==a[1].tok?JS.SV.strListValue(a[1]):null,e=null!=c||1==a.length||3==a.length&&
a[2].asBoolean(),f=null!=c?null:2<=a.length?JS.SV.sValue(a[1]):"OK",b=""+this.vwr.prompt(b,f,c,e);return e&&null!=c?d.addXInt(Integer.parseInt(b)+1):d.addXStr(b)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateQuaternion",function(d,a,b){var c=null,e=a.length,f=2147483647,g=!1;135270418==b&&(1<e&&(4==a[e-1].tok&&a[e-1].value.equalsIgnoreCase("relative"))&&(e--,g=!0),1<e&&(2==a[e-1].tok&&10==a[0].tok)&&(f=a[e-1].asInt(),0>=f&&(f=2147483646),e--));switch(e){case 0:case 1:case 4:break;case 2:if(135270418==
b){if(7==a[0].tok&&(7==a[1].tok||1048589==a[1].tok))break;if(10==a[0].tok&&(2==a[1].tok||10==a[1].tok))break}if(null==(c=d.ptValue(a[0],!1))||135270418!=b&&8==a[1].tok)return!1;break;case 3:if(135270418!=b)return!1;if(9==a[0].tok){if(8!=a[2].tok&&10!=a[2].tok)return!1;break}for(var h=0;3>h;h++)if(8!=a[h].tok&&10!=a[h].tok)return!1;break;default:return!1}var k=h=null,j=null;switch(e){case 0:return d.addXPt4(JU.Quat.newM(this.vwr.tm.matrixRotate).toPoint4f());default:if(135270418==b&&7==a[0].tok){b=
this.e.getQuaternionArray(a[0].getList(),1073742001);a=JU.Quat.sphereMean(b,null,1E-4);h=q(a,JU.Quat)?a:null;break}else if(135270418==b&&10==a[0].tok)k=this.vwr.getAtomGroupQuaternions(a[0].value,f);else if(11==a[0].tok)h=JU.Quat.newM(a[0].value);else if(9==a[0].tok)j=a[0].value;else if(j=JS.SV.sValue(a[0]),j=JU.Escape.uP(j.equalsIgnoreCase("best")?this.vwr.getOrientationText(1073741863,null):j),!q(j,JU.P4))return!1;135266307==b&&(h=JU.Quat.newVA(JU.P3.new3(j.x,j.y,j.z),j.w));break;case 2:if(135270418==
b){if(7==a[0].tok&&7==a[1].tok){b=this.e.getQuaternionArray(a[0].getList(),1073742001);k=this.e.getQuaternionArray(a[1].getList(),1073742001);k=JU.Quat.div(k,b,f,g);break}if(7==a[0].tok&&1048589==a[1].tok)return b=this.e.getQuaternionArray(a[0].getList(),1073742001),f=s(1,0),JU.Quat.sphereMean(b,f,1E-4),d.addXFloat(f[0]);if(10==a[0].tok&&10==a[1].tok){b=this.vwr.getAtomGroupQuaternions(a[0].value,2147483647);k=this.vwr.getAtomGroupQuaternions(a[1].value,2147483647);k=JU.Quat.div(k,b,f,g);break}}h=
d.ptValue(a[1],!1);j=d.planeValue(a[0]);h=null!=h?JU.Quat.getQuaternionFrame(JU.P3.new3(0,0,0),c,h):JU.Quat.newVA(c,JS.SV.fValue(a[1]));break;case 3:if(9==a[0].tok)return f=8==a[2].tok?a[2].value:this.vwr.ms.getAtomSetCenter(a[2].value),d.addXStr(JU.Escape.drawQuat(JU.Quat.newP4(a[0].value),"q",JS.SV.sValue(a[1]),f,1));b=Array(3);for(h=0;3>h;h++)b[h]=8==a[h].tok?a[h].value:this.vwr.ms.getAtomSetCenter(a[h].value);h=JU.Quat.getQuaternionFrame(b[0],b[1],b[2]);break;case 4:135270418==b?j=JU.P4.new4(JS.SV.fValue(a[1]),
JS.SV.fValue(a[2]),JS.SV.fValue(a[3]),JS.SV.fValue(a[0])):h=JU.Quat.newVA(JU.P3.new3(JS.SV.fValue(a[0]),JS.SV.fValue(a[1]),JS.SV.fValue(a[2])),JS.SV.fValue(a[3]))}if(null!=k){if(2147483647!=f){f=new JU.Lst;for(h=0;h<k.length;h++)f.addLast(k[h].toPoint4f());return d.addXList(f)}h=0<k.length?k[0]:null}return d.addXPt4((null==h?JU.Quat.newP4(j):h).toPoint4f())},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateRandom",function(d,a){if(2<a.length)return!1;var b=2>a.length?0:JS.SV.fValue(a[0]),c=0==a.length?
1:JS.SV.fValue(a[a.length-1]);return d.addXFloat(Math.random()*(c-b)+b)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateRowCol",function(d,a,b){if(1!=a.length)return!1;a=a[0].asInt()-1;var c=d.getX();switch(c.tok){case 11:if(0>a||2<a)break;c=c.value;switch(b){case 1276117515:return b=s(3,0),c.getRow(a,b),d.addXAF(b);default:return b=s(3,0),c.getColumn(a,b),d.addXAF(b)}case 12:if(0>a||2<a)break;c=c.value;switch(b){case 1276117515:return b=s(4,0),c.getRow(a,b),d.addXAF(b);default:return b=s(4,0),c.getColumn(a,
b),d.addXAF(b)}case 7:b=c.getList();for(var c=new JU.Lst,e=0,f=b.size();e<f;e++){var g=b.get(e).getList();if(null==g)return d.addXStr("");c.addLast(a<g.size()?g.get(a):JS.SV.newS(""))}return d.addXList(c)}return!1},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateIn",function(d,a){var b=d.getX();switch(a.length){case 1:var c=a[0].getList();if(null!=c)for(var e=0,f=c.size();e<f;e++)if(JS.SV.areEqual(b,c.get(e)))return d.addXInt(e+1);break;default:for(e=0;e<a.length;e++)if(JS.SV.areEqual(b,a[e]))return d.addXInt(e+
1)}return d.addXInt(0)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateReplace",function(d,a){var b=!1,c,e;switch(a.length){case 0:b=!0;c=e=null;break;case 3:b=JS.SV.bValue(a[2]);case 2:c=JS.SV.sValue(a[0]);e=JS.SV.sValue(a[1]);break;default:return!1}var f=d.getX();if(7==f.tok){for(var f=JS.SV.strListValue(f),g=Array(f.length),h=f.length;0<=--h;)g[h]=null==c?JU.PT.clean(f[h]):b?JU.PT.replaceAllCharacters(f[h],c,e):JU.PT.rep(f[h],c,e);return d.addXAS(g)}f=JS.SV.sValue(f);return d.addXStr(null==c?JU.PT.clean(f):
b?JU.PT.replaceAllCharacters(f,c,e):JU.PT.rep(f,c,e))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateScript",function(d,a,b){if((135266829==b||135270926==b||135287308==b)&&1!=a.length||0==a.length||2<a.length)return!1;var c=JS.SV.sValue(a[0]),e=new JU.SB;switch(b){case 135266829:return d.addXObj(this.vwr.evaluateExpressionAsVariable(c));case 135271429:a=2==a.length?JS.SV.sValue(a[1]):".";a.equals(".")||e.append(this.vwr.jsEval(a+"\u0001"+c));(a.equals(".")||a.equals("*"))&&this.e.runScriptBuffer(c,e);
break;case 135270926:this.e.runScriptBuffer("show "+c,e);break;case 135287308:e.append(this.vwr.jsEval(c))}var c=e.toString(),f;return Float.isNaN(f=JU.PT.parseFloatStrict(c))?d.addXStr(c):0<=c.indexOf(".")?d.addXFloat(f):d.addXInt(JU.PT.parseInt(c))},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateSort",function(d,a,b){if(1<a.length)return!1;if(1276117011==b){var c=0==a.length?0:a[0].asInt();return d.addX(d.getX().sortOrReverse(c))}b=d.getX();a=0==a.length?null:a[0];if(4==b.tok){var c=0,e=JS.SV.sValue(b);
if(null==a)return d.addXInt(0);a=JS.SV.sValue(a);for(b=0;b<e.length;b++){b=e.indexOf(a,b);if(0>b)break;c++}return d.addXInt(c)}var c=new JU.Lst,f=e=null,g=JS.SV.getVariable(b.value).sortOrReverse(0).getList();if(null==g)return null==a?d.addXStr(""):d.addXInt(0);b=0;for(var h=g.size();b<=h;b++){var k=b==h?null:g.get(b);if(!(null!=a&&null!=k&&!JS.SV.areEqual(k,a)))if(JS.SV.areEqual(k,e))f.intValue++;else{if(null!=e){var j=new JU.Lst;j.addLast(e);j.addLast(f);c.addLast(JS.SV.getVariableList(j))}f=JS.SV.newI(1);
e=k}}return null==a?d.addX(JS.SV.getVariableList(c)):c.isEmpty()?d.addXInt(0):d.addX(c.get(0).getList().get(1))},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateString",function(d,a,b){var c=d.getX(),e=0<b.length?JS.SV.sValue(b[0]):1276117512==a?"":"\n";switch(b.length){case 0:case 1:break;case 2:if(7==c.tok)break;if(1276118021==a){c=JS.SV.getVariable(JU.PT.split(JU.PT.rep(c.value,"\n\r","\n").$replace("\r","\n"),"\n"));break}default:return!1}if(7==c.tok&&1276117512!=a&&(1276118021!=a||2==b.length))return d.addX(c),
this.evaluateList(d,a,b);b=1276118021==a&&10==c.tok||1276117512==a&&7==c.tok?null:JS.SV.sValue(c);switch(a){case 1276118021:if(10==c.tok){var c=JS.SV.bsSelectVar(c),e="\n",f=this.vwr.ms.mc;b="";for(a=0;a<f;a++){b+=0==a?"":"\n";var g=this.vwr.getModelUndeletedAtomsBitSet(a);g.and(c);b+=JU.Escape.eBS(g)}}return d.addXAS(JU.PT.split(b,e));case 1276118020:return 0<b.length&&"\n"==b.charAt(b.length-1)&&(b=b.substring(0,b.length-1)),d.addXStr(JU.PT.rep(b,"\n",e));case 1276117512:if(null!=b)return d.addXStr(JU.PT.trim(b,
e));b=JS.SV.strListValue(c);for(a=b.length;0<=--a;)b[a]=JU.PT.trim(b[a],e);return d.addXAS(b)}return d.addXStr("")},"JS.ScriptMathProcessor,~N,~A");l(c$,"evaluateSubstructure",function(d,a,b){if(0==a.length)return!1;var c=new JU.BS,e=JS.SV.sValue(a[0]);if(0<e.length)try{var f=2==a.length&&10==a[1].tok?JS.SV.bsSelectVar(a[1]):null,c=this.vwr.getSmilesMatcher().getSubstructureSet(e,this.vwr.ms.at,this.vwr.ms.ac,f,135267336!=b,!1)}catch(g){if(x(g,Exception))this.e.evalError(g.getMessage(),null);else throw g;
}return d.addXBs(c)},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateSymop",function(d,a,b){if(0==a.length)return!1;b=b?d.getX():null;if(null!=b&&10!=b.tok)return!1;b=null!=b?b.value:2<a.length&&10==a[1].tok?a[1].value:this.vwr.getAllAtoms();var c;switch(a[0].tok){case 4:c=JS.SV.sValue(a[0]);break;case 12:c=a[0].escape();break;default:c=null}var e=null==c?a[0].asInt():0,f=1<a.length?d.ptValue(a[1],!0):null;if(2==a.length&&!Float.isNaN(f.x))return d.addXObj(this.vwr.ms.getSymTemp(!1).getSymmetryInfoAtom(this.vwr.ms,
b,c,e,f,null,null,135266320));var g=(1==a.length?"":JS.SV.sValue(a[a.length-1])).toLowerCase(),h=135176;1==a.length||g.equalsIgnoreCase("matrix")?h=12:g.equalsIgnoreCase("array")||g.equalsIgnoreCase("list")?h=1073742001:g.equalsIgnoreCase("description")?h=1826248716:g.equalsIgnoreCase("xyz")?h=1073741982:g.equalsIgnoreCase("translation")?h=1073742178:g.equalsIgnoreCase("axis")?h=1073741854:g.equalsIgnoreCase("plane")?h=135266319:g.equalsIgnoreCase("angle")?h=135266305:g.equalsIgnoreCase("axispoint")?
h=135266320:g.equalsIgnoreCase("center")&&(h=12289);return d.addXObj(this.vwr.ms.getSymTemp(!1).getSymmetryInfoAtom(this.vwr.ms,b,c,e,f,null,g,h))},"JS.ScriptMathProcessor,~A,~B");l(c$,"evaluateTensor",function(d,a){if(2<a.length)return!1;var b=JS.SV.getBitSet(d.getX(),!1),c=0==a.length?null:JS.SV.sValue(a[0]).toLowerCase(),e=this.vwr.getNMRCalculation();if("unique".equals(c))return d.addXBs(e.getUniqueTensorSet(b));var f=2>a.length?null:JS.SV.sValue(a[1]).toLowerCase();return d.addXList(e.getTensorInfo(c,
f,b))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateUserFunction",function(d,a,b,c,e){var f=null;if(e&&(f=d.getX(),10!=f.tok))return!1;d.wasX=!1;for(var g=new JU.Lst,h=0;h<b.length;h++)g.addLast(b[h]);if(e)return d.addXObj(this.e.getBitsetProperty(JS.SV.bsSelectVar(f),c,null,null,f.value,[a,g],!1,f.index,!1));a=this.e.getUserFunctionResult(a,g,null);return null==a?!1:d.addX(a)},"JS.ScriptMathProcessor,~S,~A,~N,~B");l(c$,"evaluateWithin",function(d,a){if(1>a.length||5<a.length)return!1;var b=a.length,
c=0,e=a[0].value,f=""+e,g=a[0].tok;4==g&&(g=JS.T.getTokFromName(f));var h=1649412120==g;h&&(c=100,e=null);var k=this.vwr.ms,j=!1,l=!1,m=h||3==g||2==g,p=null;switch(g){case 1048580:return 3==b&&q(a[1].value,JU.BS)&&q(a[2].value,JU.BS)&&d.addXBs(this.vwr.getBranchBitSet(a[2].value.nextSetBit(0),a[1].value.nextSetBit(0),!0));case 135267336:case 1238369286:case 135267335:c=null;f=!0;switch(b){case 2:break;case 3:if(f=10==a[2].tok)c=a[2].value;break;default:f=!1}f||this.e.invArg();return d.addXObj(this.e.getSmilesExt().getSmilesMatches(JS.SV.sValue(a[1]),
null,c,null,135267335==g,d.asBitSet))}if(q(e,String)){if(0==g){g=1048614;if(2<b)return!1;b=2}}else if(m){h||(c=JS.SV.fValue(a[0]));if(2>b)return!1;switch(g=a[1].tok){case 1048589:case 1048588:j=a[1].asBoolean();b=0;break;case 4:g=JS.SV.sValue(a[1]);if(g.startsWith("$"))return d.addXBs(this.getAtomsNearSurface(c,g.substring(1)));l=g.equalsIgnoreCase("group");g=(h=g.equalsIgnoreCase("vanderwaals"))?1649412120:1087373318}}else return!1;var s=e=null;switch(b){case 1:switch(g){case 137363467:case 3145760:case 1679429641:return d.addXBs(k.getAtoms(g,
null));case 1073741864:return d.addXBs(k.getAtoms(g,""));case 1048614:return d.addXBs(k.getAtoms(1087373320,f))}return!1;case 2:switch(g){case 1048614:g=1087373320;break;case 1087375362:case 1087375361:case 1073741864:case 1087373320:case 1073741916:case 1073742128:case 1073741925:case 1073742189:return d.addXBs(this.vwr.ms.getAtoms(g,JS.SV.sValue(a[a.length-1])))}break;case 3:switch(g){case 1048589:case 1048588:case 1087373318:case 1649412120:case 135266319:case 135267841:case 1048581:break;case 1087373320:f=
JS.SV.sValue(a[2]);break;default:return!1}}b=a.length-1;q(a[b].value,JU.P4)?s=a[b].value:q(a[b].value,JU.P3)&&(e=a[b].value,JS.SV.sValue(a[1]).equalsIgnoreCase("hkl")&&(s=this.e.getHklPlane(e)));if(0<b&&null==s&&null==e&&!q(a[b].value,JU.BS))return!1;if(null!=s)return d.addXBs(k.getAtomsNearPlane(c,s));if(null!=e)return d.addXBs(this.vwr.getAtomsNearPt(c,e));b=10==a[b].tok?JS.SV.bsSelectVar(a[b]):null;if(1087373320==g)return d.addXBs(this.vwr.ms.getSequenceBits(f,b));null==b&&(b=new JU.BS);if(!m)return d.addXBs(this.vwr.ms.getAtoms(g,
b));if(l)return d.addXBs(this.vwr.getGroupsWithin(L(c),b));h&&(p=new J.atomdata.RadiusData(null,10<c?c/100:c,10<c?J.atomdata.RadiusData.EnumType.FACTOR:J.atomdata.RadiusData.EnumType.OFFSET,J.c.VDW.AUTO));return d.addXBs(this.vwr.ms.getAtomsWithinRadius(c,b,j,p))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateWrite",function(d,a){switch(a.length){case 0:return!1;case 1:if(!a[0].asString().toUpperCase().equals("PNGJ"))break;return d.addXMap(this.vwr.fm.getFileAsMap(null))}return d.addXStr(this.e.getCmdExt().dispatch(135270422,
!0,a))},"JS.ScriptMathProcessor,~A");l(c$,"getAtomsNearSurface",function(d,a){var b=[a,null,null];if(this.e.getShapePropertyData(24,"getVertices",b))return this.vwr.ms.getAtomsNearPts(d,b[1],b[2]);b[1]=Integer.$valueOf(0);b[2]=Integer.$valueOf(-1);return this.e.getShapePropertyData(22,"getCenter",b)?this.vwr.getAtomsNearPt(d,b[2]):new JU.BS},"~N,~S");l(c$,"getDistance",function(d,a,b,c){var e=d.ptValue(a,!0);a=d.planeValue(a);var f=d.ptValue(b,!0);d=d.planeValue(b);if(1276117505==c){if(null!=a&&null!=
d)return a.x*d.x+a.y*d.y+a.z*d.z+a.w*d.w;null!=a&&(e=JU.P3.new3(a.x,a.y,a.z));null!=d&&(f=JU.P3.new3(d.x,d.y,d.z));return e.x*f.x+e.y*f.y+e.z*f.z}return null==a?null==d?f.distance(e):JU.Measure.distanceToPlane(d,e):JU.Measure.distanceToPlane(a,f)},"JS.ScriptMathProcessor,JS.SV,JS.SV,~N");t(c$,"getMinMax",function(d,a){for(var b=null,c=null,e=0;;){if(JU.PT.isAF(d)){if(b=d,e=b.length,0==e)break}else if(q(d,JU.Lst)){c=d;e=c.size();if(0==e)break;var f=c.get(0);if(4==f.tok&&f.value.startsWith("{")){b=
JS.SV.ptValue(f);if(q(b,JU.P3))return this.getMinMaxPoint(c,a);if(q(b,JU.P4))return this.getMinMaxQuaternion(c,a);break}}else break;switch(a){case 32:f=3.4028235E38;break;case 64:f=-3.4028235E38;break;default:f=0}for(var g=0,h=0;0<=--e;){var k=null==b?JS.SV.fValue(c.get(e)):b[e];if(!Float.isNaN(k))switch(h++,a){case 160:case 192:g+=k*k;case 128:case 96:f+=k;break;case 32:k<f&&(f=k);break;case 64:k>f&&(f=k)}}if(0==h)break;switch(a){case 96:f/=h;break;case 192:if(1==h)break;f=Math.sqrt((g-f*f/h)/(h-
1));break;case 160:f=g}return Float.$valueOf(f)}return"NaN"},"~O,~N");l(c$,"getMinMaxPoint",function(d,a){var b=null,c=null,e=0;q(d,Array)?(b=d,e=b.length):q(d,JU.Lst)&&(c=d,e=c.size());if(null!=c||null!=b){for(var f=new JU.P3,g=s(e,0),h=!0,k=0;3>k&&h;k++){for(var j=0;j<e;j++){var l=null==b?JS.SV.ptValue(c.get(j)):b[j];if(null==l){h=!1;break}switch(k){case 0:g[j]=l.x;break;case 1:g[j]=l.y;break;case 2:g[j]=l.z}}if(!h)break;j=this.getMinMax(g,a);if(q(j,Float))switch(j=j.floatValue(),k){case 0:f.x=
j;break;case 1:f.y=j;break;case 2:f.z=j}else break}return f}return"NaN"},"~O,~N");l(c$,"getMinMaxQuaternion",function(d,a){var b;switch(a){case 32:case 64:case 128:case 160:return"NaN"}for(;;){b=this.e.getQuaternionArray(d,1073742001);if(null==b)break;var c=s(1,0);b=JU.Quat.sphereMean(b,c,1E-4);switch(a){case 96:return b;case 192:return Float.$valueOf(c[0])}break}return"NaN"},"JU.Lst,~N");l(c$,"getPatternMatcher",function(){return null==this.pm?this.pm=J.api.Interface.getUtil("PatternMatcher",this.e.vwr,
"script"):this.pm});l(c$,"opTokenFor",function(d){switch(d){case 1276118017:case 1276118020:return JS.T.tokenPlus;case 1276117511:return JS.T.tokenMinus;case 1276117507:return JS.T.tokenTimes;case 1276117508:return JS.T.tokenMul3;case 1276117504:return JS.T.tokenDivide}return null},"~N");t(c$,"setContactBitSets",function(d,a,b,c,e,f){var g,h;null==a?(a=JU.BSUtil.setAll(this.vwr.ms.ac),JU.BSUtil.andNot(a,this.vwr.slm.bsDeleted),a.andNot(d),g=!1):(h=JU.BSUtil.copy(d),h.or(a),h=this.vwr.ms.getModelBS(h,
!1).cardinality(),g=1<h,f&&(1<h&&!this.e.tQuiet)&&this.e.showString(J.i18n.GT._("Note: More than one model is involved in this contact!")));if(!d.equals(a)){if(f=!b||d.cardinality()<a.cardinality())h=this.vwr.ms.getAtomsWithinRadius(c,d,g,Float.isNaN(c)?e:null),a.and(h);b&&(h=this.vwr.ms.getAtomsWithinRadius(c,a,g,Float.isNaN(c)?e:null),d.and(h),f||(h=this.vwr.ms.getAtomsWithinRadius(c,d,g,Float.isNaN(c)?e:null),a.and(h)),h=JU.BSUtil.copy(a),h.and(d),h.equals(d)?a.andNot(d):h.equals(a)&&d.andNot(a))}return a},
"JU.BS,JU.BS,~B,~N,J.atomdata.RadiusData,~B")})})(Clazz,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.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);
