(function(R,S,T,I,U,M,s,N,O,P,D,V,Q,W,A,G,X,v,Y,Z,$,aa,ba,ca,da,ea,fa,ga,ha,x,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,l){M("JS");N(null,"JS.MathExt","java.lang.Float $.Number java.util.Date $.Hashtable $.Random JU.AU $.BS $.CU $.Lst $.M4 $.Measure $.P3 $.P4 $.PT $.Quat $.SB $.V3 J.api.Interface J.atomdata.RadiusData J.bspt.Bspt J.c.VDW J.i18n.GT JM.BondSet JS.SV $.ScriptParam $.T JU.BSUtil $.Escape $.JmolMolecule $.Logger $.Parser $.Point3fi $.SimpleUnitCell JV.JC".split(" "),
function(){c$=P(function(){this.pm=this.rand=this.e=this.vwr=null;O(this,arguments)},JS,"MathExt");Q(c$,function(){});l(c$,"init",function(d){this.e=d;this.vwr=this.e.vwr;return this},"~O");l(c$,"evaluate",function(d,a,b,c){switch(c){case 134218250:case 134218242:case 134218245:case 134217749:case 134218244:case 134218246:return this.evaluateMath(d,b,c);case 1275069441:case 1275068928:case 1275068929:case 1275068930:case 1275068931:case 1275335685:case 1275334681:return this.evaluateList(d,a.intValue,
b);case 268435520:0==b.length&&(d.wasX=!1);case 1275068418:return this.evaluateArray(d,b,1275068418==c&&268435665==a.tok);case 134217731:case 134221850:return this.evaluateQuaternion(d,b,c);case 1275068420:return this.evaluateBin(d,b);case 134221829:return this.evaluateCache(d,b);case 1275068934:case 1275068935:return this.evaluateRowCol(d,b,c);case 1765808134:return this.evaluateColor(d,b);case 134221831:return this.evaluateCompare(d,b);case 1228931587:case 134217736:case 1275203608:return this.evaluateConnected(d,
b,c);case 1747587102:return this.evaluateUnitCell(d,b);case 134353926:return this.evaluateContact(d,b);case 134221834:return this.evaluateData(d,b);case 1275069444:case 1275069442:return this.evaluateDotDist(d,b,c,a.intValue);case 1275069443:if(268435665==a.tok)return this.evaluateDotDist(d,b,c,a.intValue);case 134217729:case 1745489939:return this.evaluateMeasure(d,b,a.tok);case 1228935687:case 134222849:return this.evaluateLoad(d,b,1228935687==c);case 1275068427:return this.evaluateFind(d,b);case 1287653388:case 1825200146:return this.evaluateFormat(d,
a.intValue,b,1825200146==c);case 134320141:return this.evaluateUserFunction(d,a.value,b,a.intValue,268435665==a.tok);case 1275068449:case 1275082245:case 1275072526:return this.evaluateGetProperty(d,b,c,268435665==a.tok);case 136314895:return this.evaluateHelix(d,b);case 134219265:case 134217750:case 134219266:return this.evaluatePlane(d,b,c);case 134218253:case 134238732:case 134222850:case 134222350:return this.evaluateScript(d,b,c);case 1275069446:case 1275069447:case 1275068932:return this.evaluateString(d,
a.intValue,b);case 134217751:return this.evaluatePoint(d,b);case 134217762:return this.evaluatePointGroup(d,b);case 134256131:return this.evaluatePrompt(d,b);case 134219268:return this.evaluateRandom(d,b);case 1275068432:return this.evaluateIn(d,b);case 1275072532:return this.evaluateModulation(d,b);case 1275068443:return this.evaluateReplace(d,b);case 134218756:case 134218757:case 1237320707:return this.evaluateSubstructure(d,b,c,268435665==a.tok);case 1275068444:case 1275068425:return this.evaluateSort(d,
b,c);case 1296041474:return this.evaluateSymop(d,b,268435665==a.tok);case 1275068445:return this.evaluateTensor(d,b);case 134217759:return this.evaluateWithin(d,b);case 134221856:return this.evaluateWrite(d,b)}return!1},"JS.ScriptMathProcessor,JS.T,~A,~N");l(c$,"evaluatePointGroup",function(d,a){var b,c=null,e=NaN,f=NaN;switch(a.length){case 4:f=a[3].asFloat();case 3:e=a[2].asFloat();case 2:switch(a[1].tok){case 8:c=JS.SV.ptValue(a[1]);break;case 10:b=JS.SV.getBitSet(a[0],!1);c=b.nextSetBit(0);if(0>
c||c>=this.vwr.ms.ac||1!=b.cardinality())return!1;c=this.vwr.ms.at[c];break}case 1:switch(a[0].tok){case 1073742001:var g=a[0].getList();b=Array(g.size());for(var h=b.length;0<=--h;)b[h]=JS.SV.ptValue(g.get(h));break;case 10:b=JS.SV.getBitSet(a[0],!1);g=this.vwr.ms.getAtomPointVector(b);b=Array(g.size());for(h=b.length;0<=--h;)b[h]=g.get(h);break;default:return!1}break;default:return!1}e=this.vwr.ms.getSymTemp(!0).setPointGroup(null,c,b,null,!1,Float.isNaN(e)?this.vwr.getFloat(570425382):e,Float.isNaN(f)?
this.vwr.getFloat(570425384):f,!0);return d.addXMap(e.getPointGroupInfo(-1,!1,!0,null,0,1))},"JS.ScriptMathProcessor,~A");l(c$,"evaluateUnitCell",function(d,a){var b=a.length-1,c=1;switch(0>b?0:a[b].tok){case 2:case 3:c=a[b].asFloat(),b--}var e=0>b?0:a[0].tok,f=7==e?a[0].getList():null,g=null,h=null!=f;if(h&&4>f.size())return!1;var j=h?1:0,g=null;!h&&8!=e&&(g=this.vwr.getCurrentUnitCell(),g=null==g?x(-1,[JU.P3.new3(0,0,0),JU.P3.new3(1,0,0),JU.P3.new3(0,1,0),JU.P3.new3(0,0,1)]):g.getUnitCellVectors());
if(null==g)if(g=Array(4),h){g[0]=JU.P3.newP(JS.SV.ptValue(f.get(0)));for(e=1;4>e;e++)g[e]=JU.P3.newP(JS.SV.ptValue(f.get(e)))}else switch(g[0]=JS.SV.ptValue(a[0]),b){case 3:for(e=1;4>e;e++)(g[e]=JU.P3.newP(JS.SV.ptValue(a[e]))).sub(g[0]);break;case 1:if(f=a[1].getList(),null!=f&&3==f.size()){for(e=0;3>e;e++)g[e+1]=JS.SV.ptValue(f.get(e));break}default:return!1}b=j<=b?a[j].asString():null;if((f="primitive".equalsIgnoreCase(b))||"conventional".equalsIgnoreCase(b)){if(!JU.SimpleUnitCell.transformCubic(f,
a[++j].asString(),g))return!1}else"reciprocal".equalsIgnoreCase(b)&&(g=JU.SimpleUnitCell.getReciprocal(g));if(1!=c)for(e=1;4>e;e++)g[e].scale(c);return d.addXObj(g)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateArray",function(d,a,b){if(b){b=d.getX();switch(1==a.length?b.tok:0){case 6:var c=new JU.Lst,e=a[0].asString(),f=b.getMap(),g=b.getKeys(!1);b=0;for(a=g.length;b<a;b++)if(null==f.get(g[b]).getMap())return!1;b=0;for(a=g.length;b<a;b++){var h=f.get(g[b]),h=h.getMap(),h=JS.SV.deepCopy(h,!0,!1);h.put(e,
JS.SV.newS(g[b]));c.addLast(JS.SV.newV(6,h))}return d.addXList(c);case 7:c=new java.util.Hashtable;e=b.getList();f=a[0].asString();b=0;for(a=e.size();b<a;b++)if(h=e.get(b).getMap(),null==h||null==h.get(f))return!1;b=0;for(a=e.size();b<a;b++)h=e.get(b),h=JS.SV.deepCopy(h.getMap(),!0,!1),g=h.remove(f),c.put(g.asString(),JS.SV.newV(6,h));return d.addXObj(c)}return!1}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&&4!=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]),h=4==a.length?JS.SV.sValue(a[3]):null,j=null;if(c)b=b.value;else{c=b.getList();b=v(c.size(),0);null!=h&&(j=JU.AU.createArrayOfHashtable(c.size()));try{for(var k=c.size();0<=--k;)b[k]=JS.SV.fValue(null==h?c.get(k):(j[k]=c.get(k).getMap()).get(h))}catch(p){if(A(p,Exception))return!1;throw p;}}for(var f=Math.max(I(Math.floor((f-e)/g+0.01)),
1),c=G(f,0),m=b.length,k=0;k<m;k++){var n=I(Math.floor((b[k]-e)/g));0>n?n=0:n>=f&&(n=f-1);c[n]++;if(null!=h){var q=j[k];if(null!=q){q.put("_bin",JS.SV.newI(n));var l=e+g*n,t=l+g;q.put("_binMin",JS.SV.newV(3,Float.$valueOf(0==n?-3.4028235E38:l)));q.put("_binMax",JS.SV.newV(3,Float.$valueOf(n==f-1?3.4028235E38:t)))}}}return d.addXAI(c)},"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&&(1073742335==a[3].tok||1073742334==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=1073742335==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),j=a[2].asInt();2>j&&(j=20);f.scale(1/(j-1));for(b=0;b<j;b++)h.append(JU.Escape.escapeColor(JU.CU.colorPtToFFRGB(g?JU.CU.hslToRGB(e):e))),e.add(f);return d.addXStr(h.toString())}j=c?null:this.vwr.cm.getColorEncoder(b);if(!c&&null==j)return d.addXStr("");
e=1<a.length?JS.SV.fValue(a[1]):3.4028235E38;f=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==f;3.4028235E38==f&&0==b.length&&(g=e,f=this.vwr.getCurrentColorRange(),e=f[0],f=f[1]);if(c){j=b.substring(1);j=x(-1,[j,null]);if(!this.vwr.shm.getShapePropertyData(24,"colorEncoder",j))return d.addXStr("");j=j[1]}else j.setRange(e,f,e>f);b=j.getColorKey();return h?d.addXPt(JU.CU.colorPtFromInt(j.getArgb(3.4028235E38==
f?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),j=10==a[0].tok?a[0].value:null,k=10==a[1].tok?a[1].value:null,p=null==j?JS.SV.sValue(a[0]):"",m=null==k?JS.SV.sValue(a[1]):"",n=new JU.M4;b=NaN;var q,l;try{if(h&&(null==j||null==k))return!1;if(g){if(4!=
a.length)return!1;p=JS.SV.sValue(a[2]);h=p.equalsIgnoreCase("SMILES");try{h&&(p=this.vwr.getSmiles(j))}catch(t){if(A(t,Exception))this.e.evalError(t.getMessage(),null);else throw t;}var r=this.e.getSmilesExt().getFlexFitList(j,k,p,!h);return null==r?d.addXStr(""):d.addXAF(r)}if(f){if(3!=a.length)return!1;if(null==j&&null==k)return d.addXStr(this.vwr.getSmilesMatcher().getRelationship(p,m).toUpperCase());var s=null==j?this.vwr.getSmilesMatcher().getMolecularFormula(p,!1):JU.JmolMolecule.getMolecularFormula(this.vwr.ms.at,
j,!1,null,!1),v=null==k?this.vwr.getSmilesMatcher().getMolecularFormula(m,!1):JU.JmolMolecule.getMolecularFormula(this.vwr.ms.at,k,!1,null,!1);if(!s.equals(v))return d.addXStr("NONE");null!=j&&(p=this.e.getSmilesExt().getSmilesMatches("",null,j,null,1,!0,!1));var w;w=null==k?0<this.vwr.getSmilesMatcher().areEqual(m,p):0<=this.e.getSmilesExt().getSmilesMatches(p,null,k,null,1,!0,!1).nextSetBit(0);if(!w){q=p+m;if(0<=q.indexOf("/")||0<=q.indexOf("\\")||0<=q.indexOf("@")){if(0<=p.indexOf("@")&&(null!=
k||0<=m.indexOf("@")))if(p="/invertstereo/"+p,w=null==k?0<this.vwr.getSmilesMatcher().areEqual(p,m):0<=this.e.getSmilesExt().getSmilesMatches(p,null,k,null,1,!0,!1).nextSetBit(0))return d.addXStr("ENANTIOMERS");if(null==k)w=0<this.vwr.getSmilesMatcher().areEqual("/nostereo/"+m,p);else{var z=this.e.getSmilesExt().getSmilesMatches("/nostereo/"+p,null,k,null,1,!0,!1);w=0<=z.nextSetBit(0)}if(w)return d.addXStr("DIASTERIOMERS")}return d.addXStr("CONSTITUTIONAL ISOMERS")}if(null==j||null==k)return d.addXStr("IDENTICAL");
b=this.e.getSmilesExt().getSmilesCorrelation(j,k,p,null,null,null,null,!1,null,null,!1,1);return d.addXStr(0.2>b?"IDENTICAL":"IDENTICAL or CONFORMATIONAL ISOMERS (RMSD="+b+")")}if(h){q=new JU.Lst;l=new JU.Lst;var c=JS.SV.sValue(a[2]),y=c.equalsIgnoreCase("MAP"),h=c.equalsIgnoreCase("SMILES"),x=y||c.equalsIgnoreCase("SMARTS");if(h||x)c=a.length>(e?4:3)?JS.SV.sValue(a[3]):null;var E="H".equalsIgnoreCase(c)||"allH".equalsIgnoreCase(c)||"bestH".equalsIgnoreCase(c),K="polyhedra".equalsIgnoreCase(c);K&&
(c=a.length>(e?5:4)?JS.SV.sValue(a[4]):null);var B="all".equalsIgnoreCase(c)||"allH".equalsIgnoreCase(c),C="best".equalsIgnoreCase(c)||"bestH".equalsIgnoreCase(c);"stddev".equals(c)&&(c=null);p=c;if(null==c||E||B||C){if(!y&&!h||E&&K)return!1;p="/noaromatic"+(B||C?"/":" nostereo/")+this.e.getSmilesExt().getSmilesMatches(E?"H":"",null,j,null,1,!0,!1)}else B=!0;b=this.e.getSmilesExt().getSmilesCorrelation(j,k,p,q,l,n,null,y,null,null,C,(h?1:2)|(!B&&!C?64:0));if(y){var H=q.size();if(0==H)return d.addXStr("");
var D=I(l.size()/H),z=new JU.Lst;for(b=k=0;k<D;k++){var L=JU.AU.newInt2(H);z.addLast(L);for(c=0;c<H;c++,b++)L[c]=G(-1,[q.get(c).i,l.get(b).i])}return B?d.addXList(z):0<z.size()?d.addXAII(z.get(0)):d.addXStr("")}}else{switch(a.length){case 2:break;case 3:if(e)break;default:return!1}q=this.e.getPointVector(a[0],0);l=this.e.getPointVector(a[1],0);null!=q&&null!=l&&(J.api.Interface.getInterface("JU.Eigen",this.vwr,"script"),b=JU.Measure.getTransformMatrix4(q,l,n,null))}return e||Float.isNaN(b)?d.addXFloat(b):
d.addXM4(n.round(1E-7))}catch(F){if(A(F,Exception))return this.e.evalError(null==F.getMessage()?F.toString():F.getMessage(),null),!1;throw F;}},"JS.ScriptMathProcessor,~A");l(c$,"evaluateConnected",function(d,a,b){if(5<a.length)return!1;var c=-2147483648,e=2147483647,f=0,g=3.4028235E38,h=65535,j=null,k=null,p=!1,m=!1;switch(b){case 1275203608:j=-2147483648;k=null;if(0<a.length)switch(a[0].tok){case 2:j=a[0].intValue;break;case 4:k=JS.SV.sValue(a[0])}j=x(-1,[Integer.$valueOf(j),k,null]);this.vwr.shm.getShapePropertyData(21,
"centers",j);return d.addXBs(null==j[2]?new JU.BS:j[2]);case 1228931587:j=d.getX();if(10!=j.tok||1!=a.length||10!=a[0].tok)return!1;j=JS.SV.bsSelectVar(j);k=JS.SV.bsSelectVar(a[0]);a=new JU.Lst;f=this.vwr.ms.at;for(b=j.nextSetBit(0);0<=b;b=j.nextSetBit(b+1)){for(var n=0,g=f[b].bonds,m=g.length;0<=--m;)k.get(g[m].getOtherAtom(f[b]).i)&&n++;a.addLast(Integer.$valueOf(n))}return d.addXList(a)}for(b=0;b<a.length;b++){var q=a[b];switch(q.tok){case 10:if((m=s(q.value,JM.BondSet))&&null!=j)return!1;if(null==
j)j=JS.SV.bsSelectVar(q);else if(null==k)k=JS.SV.bsSelectVar(q);else return!1;break;case 4:n=JS.SV.sValue(q);h=n.equalsIgnoreCase("hbond")?30720:JS.ScriptParam.getBondOrderFromString(n);if(131071==h)return!1;break;case 3:p=!0;default:n=q.asInt();q=q.asFloat();if(2147483647!=e)return!1;-2147483648==c?(c=Math.max(n,0),f=q):(e=n,g=q)}}-2147483648==c?(c=1,e=100,f=0.1,g=1E8):2147483647==e&&(e=c,g=f,f=0.1);null==j&&(j=this.vwr.getAllAtoms());p&&null==k&&(k=j);return null!=k?(a=new JU.BS,this.vwr.makeConnections(f,
g,h,1086324745,j,k,a,m,!1,0),d.addX(JS.SV.newV(10,JM.BondSet.newBS(a,this.vwr.ms.getAtomIndices(this.vwr.ms.getAtoms(1677721602,a)))))):d.addXBs(this.vwr.ms.getAtomsConnected(c,e,h,j))},"JS.ScriptMathProcessor,~A,~N");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||!s(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$,"evaluateData",function(d,a){var b=JS.SV.sValue(a[0]);switch(a.length){case 1:break;case 2:case 3:if(10==a[0].tok)return d.addXStr(this.vwr.getModelFileData(b,JS.SV.sValue(a[1]),3==a.length&&JS.SV.bValue(a[2])));
break;case 4:var b=a[1].asInt(),c=a[2].asInt(),e=a[3].asInt(),b=JU.Parser.parseFloatArrayFromMatchAndField(JS.SV.sValue(a[0]),null,0,0,null,b,c,null,e);return d.addXStr(JU.Escape.escapeFloatA(b,!1));default:return!1}if(0==b.indexOf("data2d_"))return b=this.vwr.getDataObj(b,null,2),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_"))return b=
this.vwr.getDataObj(b,null,1),null==b?d.addXStr(""):d.addXStr(JU.Escape.escapeFloatA(b,!1));b=this.vwr.getDataObj(b,null,-1);return d.addXStr(null==b?"":""+b[1])},"JS.ScriptMathProcessor,~A");l(c$,"evaluateDotDist",function(d,a,b,c){var e=1275069443==b,f,g,h=null;switch(a.length){case 2:if(2147483647==c){f=a[0];g=a[1];break}h=a[1];case 1:f=d.getX();g=a[0];break;default:return!1}if(1275069442==b)return f=JU.P3.newP(d.ptValue(f)),f.cross(f,d.ptValue(g)),d.addXPt(f);b=7==g.tok?null:d.ptValue(g);a=d.planeValue(g);
if(e){var j=-2147483648==c?0:c&480,k=32==j||64==j,p=480==j;switch(f.tok){case 10:var m=JS.SV.bsSelectVar(f),n=null,q=k&&null!=h&&h.asBoolean();switch(g.tok){case 10:n=10==g.tok?JS.SV.bsSelectVar(g):null;case 8:e=this.vwr.ms.at;if(q){g=NaN;k=2147483647;for(h=m.nextSetBit(0);0<=h;h=m.nextSetBit(h+1))if(p=null==n?e[h].distanceSquared(b):this.e.getBitsetProperty(n,c,e[h],a,f.value,null,!1,f.index,!1).floatValue(),!(32==j?p>=g:p<=g))g=p,k=h;return d.addXBs(2147483647==k?new JU.BS:JU.BSUtil.newAndSetBit(k))}if(p){if(null==
n){g=v(m.cardinality(),0);j=0;for(h=m.nextSetBit(0);0<=h;h=m.nextSetBit(h+1),j++)g[j]=e[h].distance(b);return d.addXAF(g)}f=v(m.cardinality(),n.cardinality(),0);j=0;for(h=m.nextSetBit(0);0<=h;h=m.nextSetBit(h+1),j++){b=0;for(a=n.nextSetBit(0);0<=a;a=n.nextSetBit(a+1),b++)f[j][b]=e[h].distance(e[a])}return d.addXAFF(f)}if(k){g=v(m.cardinality(),0);h=m.nextSetBit(0);for(j=0;0<=h;h=m.nextSetBit(h+1))g[j++]=this.e.getBitsetProperty(n,c,e[h],a,f.value,null,!1,f.index,!1).floatValue();return d.addXAF(g)}return d.addXObj(this.e.getBitsetProperty(m,
c,b,a,f.value,null,!1,f.index,!1))}}}m=d.ptValue(f);f=d.planeValue(f);n=NaN;try{e?n=null!=a&&null!=h?JU.Measure.directedDistanceToPlane(m,a,JS.SV.ptValue(h)):null==f?null==a?b.distance(m):JU.Measure.distanceToPlane(a,m):JU.Measure.distanceToPlane(f,b):null!=f&&null!=a?n=f.x*a.x+f.y*a.y+f.z*a.z+f.w*a.w:(null!=f?m=JU.P3.new3(f.x,f.y,f.z):null!=a&&(b=JU.P3.new3(a.x,a.y,a.z)),n=m.dot(b))}catch(l){if(!A(l,Exception))throw l;}return d.addXFloat(n)},"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]),f=d.ptValue(a[1]);if(0==b||9!=a[2].tok||null==e||null==f)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=s(a[0].value,JU.BS)?a[0].value:this.vwr.ms.getAtoms(1094715412,new Integer(a[0].asInt()));switch(b){case 134217751:return d.addXObj(this.getHelixData(c,
134217751));case 1073741854:return d.addXObj(this.getHelixData(c,1073741854));case 1665140738:return d.addXObj(this.getHelixData(c,1665140738));case 134217729:return d.addXFloat(this.getHelixData(c,134217729).floatValue());case 135176:case 1745489939:return d.addXObj(this.getHelixData(c,b));case 1275068418: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){var b=d.getX(),c=7==b.tok,e=0==a.length,f=e?"":JS.SV.sValue(a[0]),g=1<a.length&&1073742335!=a[1].tok&&1073742334!=a[1].tok?JS.SV.sValue(a[1]):"",h=!c&&f.equalsIgnoreCase("SEQUENCE"),j=!c&&f.equalsIgnoreCase("SEQ"),k=!c&&f.equalsIgnoreCase("SMILES"),p=!c&&f.equalsIgnoreCase("SMARTS"),m=!c&&f.equalsIgnoreCase("CHEMICAL"),n=!c&&f.equalsIgnoreCase("MF"),l=!c&&f.equalsIgnoreCase("CELLFORMULA"),u=0<
a.length?a[a.length-1]:JS.SV.vF,t=!c&&1073742335==u.tok;try{if(m){var r=10==b.tok?this.vwr.getSmiles(JS.SV.getBitSet(b,!1)):JS.SV.sValue(b),r=0==r.length?"":this.vwr.getChemicalInfo(r,1<a.length?JS.T.getTokenFromName(g.toLowerCase()):null);r.endsWith("\n")&&(r=r.substring(0,r.length-1));r.startsWith("InChI")&&(r=JU.PT.rep(JU.PT.rep(r,"InChI=",""),"InChIKey=",""));return d.addXStr(r)}if(k||p||10==b.tok){var m=k||p?2:1,s=m<a.length&&10==a[m].tok?a[m++].value:null,v="bonds".equalsIgnoreCase(JS.SV.sValue(a[a.length-
1])),r=v||t,m=null;switch(b.tok){case 4:var w=JS.SV.sValue(b);if(null!=s||k&&1==a.length)return!1;if(g.equalsIgnoreCase("mf"))m=this.vwr.getSmilesMatcher().getMolecularFormula(w,p);else{j=g;k=!0;n=!1;switch(a.length){case 4:k=JS.SV.bValue(a[3]);case 3:n=JS.SV.bValue(a[2])}try{m=this.e.getSmilesExt().getSmilesMatches(j,w,null,null,p?2:1,!n,!k)}catch(z){if(A(z,Exception))return d.addXInt(-1);throw z;}if(!n&&(!k||!p)){var y=m.length;return d.addXInt(!k&&0<y?1:y)}}break;case 10:if(n&&0!=g.length)return d.addXBs(JU.JmolMolecule.getBitSetForMF(this.vwr.ms.at,
b.value,g));if(n||l)return d.addXStr(JU.JmolMolecule.getMolecularFormula(this.vwr.ms.at,b.value,!1,n?null:this.vwr.ms.getCellWeights(b.value),t));if(h||j){var x=u.asString().equalsIgnoreCase("H"),r=(new Boolean(r|x)).valueOf();return d.addXStr(this.vwr.getSmilesOpt(b.value,-1,-1,(r?77824|(x?90112:0):0)|(j?327680:65536)))}if(k||p)f=1<a.length&&10==a[1].tok?this.vwr.getSmilesOpt(a[1].value,0,0,0):g;if(v)var E=this.vwr.getSmilesMatcher().getCorrelationMaps(f,this.vwr.ms.at,this.vwr.ms.ac,b.value,(k?
1:2)|64),m=0<E.length?this.vwr.ms.getDihedralMap(E[0]):G(0,0);else var D=(k?1:2)|(t&&0==f.length?204800:0),m=this.e.getSmilesExt().getSmilesMatches(f,null,b.value,s,D,!t,!1)}null==m&&this.e.invArg();return d.addXObj(m)}}catch(B){if(A(B,Exception))this.e.evalError(B.getMessage(),null);else throw B;}p=0<=g.indexOf("v");y=0<=g.indexOf("i");g=0<=g.indexOf("m");w=2==a.length;if(c||w){k=this.getPatternMatcher();h=j=null;w=c?b.getList():null;if(0<f.length)try{j=0==f.length?null:k.compile(f,y),h=JS.SV.strListValue(b)}catch(C){if(A(C,
Exception))this.e.evalError(C.toString(),null);else throw C;}y=null==h?w.size():h.length;JU.Logger.debugging&&JU.Logger.debug("finding "+f);f=new JU.BS;k=0;l=null;n=g?new JU.Lst:null;u="";for(b=0;b<y;b++){if(null==j)switch(t=w.get(b),t.tok){case 6:t=t.getMap().isEmpty()!=e;break;case 7:t=0==t.getList().size()!=e;break;case 4:t=0==t.asString().length!=e;break;default:t=!0}else u=h[b],l=j.matcher(u),t=l.find();if(g&&t||!g&&t==!p)k++,f.set(b),g&&n.addLast(p?u.substring(0,l.start())+u.substring(l.end()):
l.group())}if(!c)return g?d.addXStr(1==n.size()?n.get(0):""):p?d.addXBool(1==k):g?d.addXStr(0==k?"":l.group()):d.addXInt(0==k?0:l.start()+1);if(g){c=Array(k);if(0<k)for(b=h.length;0<=--b;)f.get(b)&&(--k,c[k]=g?n.get(k):h[b]);return d.addXAS(c)}c=new JU.Lst;for(b=f.nextSetBit(0);0<=b;b=f.nextSetBit(b+1))c.addLast(w.get(b));return d.addXList(c)}return h?d.addXStr(this.vwr.getJBR().toStdAmino3(JS.SV.sValue(b))):d.addXInt(JS.SV.sValue(b).indexOf(f)+1)},"JS.ScriptMathProcessor,~A");l(c$,"evaluateGetProperty",
function(d,a,b,c){var e=c&&1275082245==b;b=1275068449==b;var f=0,g=0==a.length?0:a[0].tok;if(2==a.length&&(7==g||6==g||14==g))return d.addXObj(this.vwr.extractProperty(a[0].value,a[1].value.toString(),-1));var h=c&&1==a.length&&10==a[0].tok?JS.SV.bsSelectVar(a[0]):null,j=null==h&&0<a.length?JS.SV.sValue(a[f++]):"",g=j,k=g.toLowerCase();!e&&0>k.indexOf("[select ")&&(g=k);var p=!1;g.equals("json")&&a.length>f&&(p=!0,g=JS.SV.sValue(a[f++]));var m=null;if(c)switch(m=d.getX(),m.tok){case 10:break;case 4:return b=
m.value,a=Array(3),b.startsWith("$")?(b=b.substring(1),c=this.vwr.shm.getShapeIdFromObjectName(b),0<=c&&(a[0]=b,this.vwr.shm.getShapePropertyData(c,"index",a),null!=a[1]&&!j.equals("index")&&(b=a[1].intValue(),a[1]=this.vwr.shm.getShapePropertyIndex(c,j.intern(),b)))):(c=JV.JC.shapeTokenIndex(JS.T.getTokFromName(b)),0<=c&&(a[0]=j,a[1]=Integer.$valueOf(-1),this.vwr.shm.getShapePropertyData(c,j.intern(),a))),null==a[1]?d.addXStr(""):d.addXObj(a[1]);case 7:if(null!=h){a=m.getList();c=new JU.Lst;for(f=
h.nextSetBit(0);0<=f;f=h.nextSetBit(f+1))c.addLast(a.get(f));return d.addXList(c)}default:return e&&(g="[SELECT "+g+"]"),d.addXObj(this.vwr.extractProperty(m,g,-1))}c&&(!k.startsWith("bondinfo")&&!k.startsWith("atominfo"))&&(g="atomInfo."+g);j="";if(g.equalsIgnoreCase("fileContents")&&2<a.length){j=JS.SV.sValue(a[1]);for(f=2;f<a.length;f++)j+="|"+JS.SV.sValue(a[f]);f=a.length}else if(a.length>f)switch(a[f].tok){case 10:j=JS.SV.bsSelectVar(a[f++]);g.equalsIgnoreCase("bondInfo")&&(a.length>f&&10==a[f].tok)&&
(j=x(-1,[j,JS.SV.bsSelectVar(a[f])]));break;case 6:case 4:this.vwr.checkPropertyParameter(g)&&(j=a[f++].value)}if(c&&(j=JS.SV.bsSelectVar(m),0>j.nextSetBit(0)))return d.addXStr("");b&&!c&&(g="auxiliaryInfo.models."+g);g=JU.PT.rep(g,".[","[");c=this.vwr.getProperty(null,g,j);f<a.length&&(c=this.vwr.extractProperty(c,a,f));return d.addXObj(p?"{"+JU.PT.toJSON("value",c)+"}":JS.SV.isVariableType(c)?c:JU.Escape.toReadable(g,c))},"JS.ScriptMathProcessor,~A,~N,~B");l(c$,"evaluateFormat",function(d,a,b,c){var e=
2>b.length||1287653388==a?d.getX():null,f=0==b.length?"%U":7==b[0].tok?null:JS.SV.sValue(b[0]);if(!c&&0<b.length&&null!=e&&10!=e.tok&&null!=f){if(2==b.length){var e=e.getList(),g=b[1].getList();if(null==e||null==g)return!1;e=JS.SV.getVariableList(this.getSublist(e,g))}b=x(-1,[b[0],e]);e=null}if(null==e){a=c?-1:JS.SV.getFormatType(f);if(0<=a&&2!=b.length)return!1;if(0<=a||2>b.length||7!=b[1].tok)return b=JS.SV.format(b,a,!1),f.equalsIgnoreCase("json")?d.addXStr(b):d.addXObj(b);f=b[1].getList();b=x(-1,
[b[0],null]);c=Array(f.size());for(e=c.length;0<=--e;)b[1]=f.get(e),c[e]=JS.SV.format(b,a,!0).toString();return d.addXAS(c)}if(7==e.tok&&null==f)return e=e.getList(),g=b[0].getList(),f=this.getSublist(e,g),d.addXList(f);b=JS.SV.getBitSet(e,!0);a=JS.T.tokAttr(a,480);return d.addXObj(null==f?"":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$,"getSublist",function(d,a){for(var b=new JU.Lst,c,e,f,g=0,h=
d.size();g<h;g++)switch(e=d.get(g),e.tok){case 6:c=e.getMap();f=new JU.Lst;for(var j=0,k=a.size();j<k;j++)e=c.get(JS.SV.sValue(a.get(j))),f.addLast(null==e?JS.SV.newS(""):e);b.addLast(JS.SV.getVariableList(f));break;case 7:c=new java.util.Hashtable;f=e.getList();j=0;for(k=Math.min(f.size(),a.size());j<k;j++)c.put(JS.SV.sValue(a.get(j)),f.get(j));b.addLast(JS.SV.getVariable(c))}return b},"JU.Lst,JU.Lst");l(c$,"evaluateList",function(d,a,b){var c=b.length,e=d.getX(),f=7==e.tok,g;switch(a){case 1275335685:return 2==
c&&d.addX(e.pushPop(b[1],b[0]))||1==c&&d.addX(e.pushPop(b[0],null));case 1275334681:return 1==c&&d.addX(e.pushPop(null,b[0]))||0==c&&d.addX(e.pushPop(null,null));case 1275069441:if(1!=c&&2!=c)return!1;break;case 1275069447:case 1275069446:break;default:if(1!=c)return!1}var h=null,j=null,k=null;if(2==c){var p=JS.SV.sValue(b[0]);g=b[1];if(1275069441==a){h=f?JS.SV.strListValue(e):JU.PT.split(JS.SV.sValue(e),"\n");j=7==g.tok?JS.SV.strListValue(g):JU.PT.split(JS.SV.sValue(g),"\n");k=Array(c=Math.max(h.length,
j.length));for(e=0;e<c;e++)k[e]=(e>=h.length?"":h[e])+p+(e>=j.length?"":j[e]);return d.addXAS(k)}if(1073742335!=g.tok)return!1;k=e.getList();(c=0==p.length)&&(p=",");if(1275069446==a){j=Array(k.size());for(e=k.size();0<=--e;)if(b=k.get(e).getList(),null==b)j[e]=k.get(e);else{a=new JU.SB;f=0;for(h=b.size();f<h;f++)0<f&&a.append(p),g=b.get(f),a.append(c&&4==g.tok?'"'+JU.PT.rep(g.value,'"','""')+'"':""+g.asString());j[e]=JS.SV.newS(a.toString())}return d.addXAV(j)}a=new JU.Lst;c&&(p="\x00");j=G(2,0);
e=0;for(g=k.size();e<g;e++){f=k.get(e).asString();if(c){j[1]=0;for(h=j[0]=0;;){b=JU.PT.getCSVString(f,j);if(null==b){if(-1==j[1]){f+=++e<g?"\n"+k.get(e).asString():'"';j[1]=h;continue}f=f.substring(0,h)+f.substring(h).$replace(",","\x00");break}f=f.substring(0,h)+f.substring(h,j[0]).$replace(",","\x00")+b+f.substring(j[1]);j[1]=h=j[0]+b.length}}for(var m=f.$plit(p),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(!A(q,
Exception))throw q;}else try{l.addLast(JS.SV.getVariable(Float.$valueOf(Float.parseFloat(b))));continue}catch(u){if(!A(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(1073742327,"all"):b[0];k=1073742327==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,p=e.getList(),s=g.getList();f?c=p.size():m?c=2147483647:(h=JU.PT.split(JS.SV.sValue(e),
"\n"),l=v(c=h.length,0),JU.PT.parseFloatArrayData(h,l));if(k&&1275069446!=a){k=0;if(f)for(e=c;0<=--e;)k+=JS.SV.fValue(p.get(e));else if(!m)for(e=c;0<=--e;)k+=l[e];return d.addXFloat(k)}if(1275069446==a&&4==g.tok){a=new JU.SB;if(m)a.append(JS.SV.sValue(e));else{b=k?"":g.value.toString();for(e=0;e<c;e++)a.append(0<e?b:"").append(JS.SV.sValue(p.get(e)))}return d.addXStr(a.toString())}var x=null;t?x=g:7==g.tok?c=Math.min(c,s.size()):(j=JU.PT.split(JS.SV.sValue(g),"\n"),r=v(j.length,0),JU.PT.parseFloatArrayData(j,
r),c=Math.min(c,r.length));var w=this.opTokenFor(a),z=Array(c);if(f&&k)return k=new JU.Lst,d.addXList(this.addAllLists(e.getList(),k));b=m?e:null;for(var y,e=0;e<c;e++){y=t?x:7==g.tok?s.get(e):Float.isNaN(r[e])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(j[e])):JS.SV.newV(3,Float.$valueOf(r[e]));m||(b=f?p.get(e):Float.isNaN(l[e])?JS.SV.getVariable(JS.SV.unescapePointOrBitsetAsVariable(h[e])):JS.SV.newV(3,Float.$valueOf(l[e])));1275069446==a&&7!=b.tok&&(k=new JU.Lst,k.addLast(b),b=JS.SV.getVariableList(k));
if(!d.binaryOp(w,b,y))return!1;z[e]=d.getX()}return d.addXAV(z)},"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=1073742335==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(134217749==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(134218250==
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 134218242:return d.addXFloat(180*Math.acos(a)/3.141592653589793);case 134218245:return d.addXFloat(Math.cos(3.141592653589793*a/180));case 134218244:return d.addXFloat(Math.sin(3.141592653589793*a/180));case 134218246: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 1745489939:b=new JU.Lst;
for(var e=v(-1,[3.4028235E38,3.4028235E38]),f=null,g=null,h=!1,j=!1,k=0,l=!1,m=null,n=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++;n++;break;case 8:r=new JU.Point3fi;r.setT(a[m].value);b.addLast(r);c++;break;case 2:case 3:e[k++%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")?
j=!0:r.equalsIgnoreCase("connected")?h=!0:r.equalsIgnoreCase("minArray")?s=1<=n:r.equalsIgnoreCase("asArray")?t=1<=n: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<k||j&&h)return!1;if(l||3.4028235E38!=q&&(2!=n||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,j,null,!0,0,0,null).getMeasurements(t,s));case 134217729: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++)if(null==(b[m]=d.ptValue(a[m])))return!1;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(134219265==b&&3!=a.length||
134219266==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 s(a,JU.P4)?d.addXPt4(a):d.addXStr(""+a);case 2:if(134219266==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]);return null==e?d.addXStr(""):d.addXPt(JU.Measure.getIntersection(e,null,g,f,b,h))}case 3:case 4:switch(b){case 134219265: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 134219266:c=d.ptValue(a[0]);e=d.ptValue(a[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]);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]);e=d.ptValue(a[1]);if(null==e)return!1;f=2<a.length&&(10==a[2].tok||8==a[2].tok)?d.ptValue(a[2]):null;b=JU.V3.newV(e);if(null==f)return g=new JU.P4,2==a.length||2!=a[2].tok&&3!=a[2].tok&&!a[2].asBoolean()?(f=JU.P3.newP(c),f.add(e),f.scale(0.5),b.sub(c),b.normalize()):1073742335==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=4==a.length?d.ptValue(a[3]):null;a=JU.Measure.getDirectedNormalThroughPoints(c,e,f,a,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 s(b,JU.P3)?d.addXPt(b):d.addXStr(""+b);case 2:switch(a[1].tok){case 1073742334:if(null==(b=JS.SV.ptValue(a[0])))return!1;this.vwr.tm.unTransformPoint(b,b);break;case 1073742335:if(null==(b=JS.SV.ptValue(a[0])))return!1;this.vwr.tm.transformPt3f(b,b);break;case 8:var c=a[0].getList();if(null==c||4!=c.size())return!1;var e=JS.SV.ptValue(a[1]),b=JU.P3.newP(JS.SV.ptValue(c.get(0)));b.scaleAdd2(e.x,JS.SV.ptValue(c.get(1)),b);b.scaleAdd2(e.y,JS.SV.ptValue(c.get(2)),
b);b.scaleAdd2(e.z,JS.SV.ptValue(c.get(3)),b);break;default:return!1}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;134221850==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(134221850==
b){if(7==a[0].tok&&(7==a[1].tok||1073742335==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]))||134221850!=b&&8==a[1].tok)return!1;break;case 3:if(134221850!=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 j=h=null,k=null;switch(e){case 0:return d.addXPt4(this.vwr.tm.getRotationQ().toPoint4f());default:if(134221850==b&&7==a[0].tok){b=this.e.getQuaternionArray(a[0].getList(),
1073742001);a=JU.Quat.sphereMean(b,null,1E-4);h=s(a,JU.Quat)?a:null;break}else if(134221850==b&&10==a[0].tok)j=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)k=a[0].value;else if(k=JS.SV.sValue(a[0]),k=JU.Escape.uP(k.equalsIgnoreCase("best")?this.vwr.getOrientationText(1073741863,null):k),!s(k,JU.P4))return!1;134217731==b&&(h=JU.Quat.newVA(JU.P3.new3(k.x,k.y,k.z),k.w));break;case 2:if(134221850==b){if(7==a[0].tok&&7==a[1].tok){b=
this.e.getQuaternionArray(a[0].getList(),1073742001);j=this.e.getQuaternionArray(a[1].getList(),1073742001);j=JU.Quat.div(j,b,f,g);break}if(7==a[0].tok&&1073742335==a[1].tok)return b=this.e.getQuaternionArray(a[0].getList(),1073742001),f=v(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);j=this.vwr.getAtomGroupQuaternions(a[1].value,2147483647);j=JU.Quat.div(j,b,f,g);break}}h=d.ptValue(a[1]);k=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:134221850==b?k=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!=j){if(2147483647!=f){f=new JU.Lst;for(h=0;h<j.length;h++)f.addLast(j[h].toPoint4f());return d.addXList(f)}h=0<j.length?j[0]:null}return d.addXPt4((null==h?JU.Quat.newP4(k):h).toPoint4f())},"JS.ScriptMathProcessor,~A,~N");l(c$,"evaluateRandom",function(d,a){if(3<a.length)return!1;null==this.rand&&(this.rand=new java.util.Random);var b=0,c=1;switch(a.length){case 3:this.rand.setSeed(D(JS.SV.fValue(a[2])));
case 2:c=JS.SV.fValue(a[1]);case 1:b=JS.SV.fValue(a[0]);case 0:break;default:return!1}return d.addXFloat(this.rand.nextFloat()*(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 1275068935:return b=v(3,0),c.getRow(a,b),d.addXAF(b);default:return b=v(3,0),c.getColumn(a,b),d.addXAF(b)}case 12:if(0>a||2<a)break;c=c.value;switch(b){case 1275068935:return b=
v(4,0),c.getRow(a,b),d.addXAF(b);default:return b=v(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((134218253==b||134222350==b||134238732==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 134218253:return d.addXObj(this.vwr.evaluateExpressionAsVariable(c));case 134222850: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 134222350:this.e.runScriptBuffer("show "+c,e);break;case 134238732: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(1275068444==b){if(1==a.length&&4==a[0].tok)return d.addX(d.getX().sortMapArray(a[0].asString()));
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 j=b==h?null:g.get(b);if(!(null!=a&&null!=j&&!JS.SV.areEqual(j,
a)))if(JS.SV.areEqual(j,e))f.intValue++;else{if(null!=e){var k=new JU.Lst;k.addLast(e);k.addLast(f);c.addLast(JS.SV.getVariableList(k))}f=JS.SV.newI(1);e=j}}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]):1275068932==a?"":"\n";switch(b.length){case 0:case 1:break;case 2:if(7==c.tok)break;if(1275069447==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&&1275068932!=a&&(1275069447!=a||2==b.length))return d.addX(c),this.evaluateList(d,a,b);b=1275069447==a&&10==c.tok||1275068932==a&&7==c.tok?null:JS.SV.sValue(c);switch(a){case 1275069447: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 1275069446: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 1275068932: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,c){if(0==a.length||c&&1!=a.length)return!1;var e=new JU.BS,f=JS.SV.sValue(a[0]);if(0<f.length)try{var g=c?JS.SV.bsSelectVar(d.getX()):2==a.length&&10==a[1].tok?JS.SV.bsSelectVar(a[1]):
null,e=this.vwr.getSmilesMatcher().getSubstructureSet(f,this.vwr.ms.at,this.vwr.ms.ac,g,134218757==b?1:2)}catch(h){if(A(h,Exception))this.e.evalError(h.getMessage(),null);else throw h;}return d.addXBs(e)},"JS.ScriptMathProcessor,~A,~N,~B");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]):null;if(2==a.length&&null!=f)return d.addXObj(this.vwr.ms.getSymTemp(!1).getSymmetryInfoAtom(this.vwr.ms,b,c,e,f,null,null,134217751));a=(1==a.length?"matrix":JS.SV.sValue(a[a.length-1])).toLowerCase();var g=135176;a.equalsIgnoreCase("matrix")?g=12:a.equalsIgnoreCase("array")||a.equalsIgnoreCase("list")?g=1073742001:a.equalsIgnoreCase("description")?g=1825200146:a.equalsIgnoreCase("xyz")?g=1073741982:a.equalsIgnoreCase("translation")?
g=1073742178:a.equalsIgnoreCase("axis")?g=1073741854:a.equalsIgnoreCase("plane")?g=134217750:a.equalsIgnoreCase("angle")?g=134217729:a.equalsIgnoreCase("axispoint")?g=134217751:a.equalsIgnoreCase("center")&&(g=12289);return d.addXObj(this.vwr.ms.getSymTemp(!1).getSymmetryInfoAtom(this.vwr.ms,b,c,e,f,null,a,g))},"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)switch(f=d.getX(),f.tok){case 10:break;case 6:if(0<b.length)return!1;f=f.getMap().get(a);return null==f?d.addXStr(""):d.addX(f);default:return!1}a=a.toLowerCase();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,x(-1,[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;if(1==b&&10==a[0].tok)return d.addX(a[0]);var c=0,e=a[0].value,f=""+e,g=a[0].tok;4==g&&(g=JS.T.getTokFromName(f));var h=1648363544==g;h&&(c=100,e=null);var j;j=this.vwr.ms;var k=!1,l=!1,m=h||3==g||2==g,n=null;switch(g){case 7:1==b&&(e=a[0].asString(),g=0);break;
case 1073742328:return 3==b&&s(a[1].value,JU.BS)&&s(a[2].value,JU.BS)&&d.addXBs(this.vwr.getBranchBitSet(a[2].value.nextSetBit(0),a[1].value.nextSetBit(0),!0));case 134218757:case 1237320707:case 134218756:c=null;e=!0;switch(b){case 2:break;case 3:if(e=10==a[2].tok)c=a[2].value;break;default:e=!1}e||this.e.invArg();return d.addXObj(this.e.getSmilesExt().getSmilesMatches(JS.SV.sValue(a[1]),null,c,null,134218756==g?2:1,d.asBitSet,!1))}if(s(e,String)){if(0==g){g=1073742362;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 1073742335:case 1073742334:k=a[1].asBoolean();b=0;2<a.length&&JS.SV.sValue(a[2]).equalsIgnoreCase("unitcell")&&(g=1747587102);break;case 4:e=JS.SV.sValue(a[1]);if(e.startsWith("$"))return d.addXBs(this.getAtomsNearSurface(c,e.substring(1)));if(e.equalsIgnoreCase("group"))l=!0,g=1086324742;else if(e.equalsIgnoreCase("vanderwaals")||e.equalsIgnoreCase("vdw"))h=!0,g=1648363544;else if(e.equalsIgnoreCase("unitcell"))g=1747587102;else return!1}}else return!1;
var q=e=null;switch(b){case 1:switch(g){case 136314895:case 2097184:case 1678381065:return d.addXBs(j.getAtoms(g,null));case 1073741864:return d.addXBs(j.getAtoms(g,""));case 1073742362:return d.addXBs(j.getAtoms(1086324744,f))}return!1;case 2:switch(g){case 1073742362:g=1086324744;break;case 1073741824:case 1086326786:case 1086326785:case 1073741864:case 1086324744: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 1073742335:case 1073742334:case 1086324742:case 1648363544:case 1747587102:case 134217750:case 134219265:case 1073742329:case 8:break;case 1086324744:f=JS.SV.sValue(a[2]);break;default:return!1}}b=a.length-1;switch(a[b].tok){case 9:q=a[b].value;break;case 8:e=a[b].value;JS.SV.sValue(a[1]).equalsIgnoreCase("hkl")&&(q=this.e.getHklPlane(e));break;case 7:if(e=2==b?JS.SV.ptValue(a[1]):1==b?JU.P3.new3(NaN,0,0):null,null==e)return!1}if(0<b&&null==q&&null==e&&!s(a[b].value,JU.BS))return!1;
if(null!=q)return d.addXBs(j.getAtomsNearPlane(c,q));j=10==a[b].tok?JS.SV.bsSelectVar(a[b]):null;if(1747587102==g)return d.addXObj(this.vwr.ms.getUnitCellPointsWithin(c,j,e,k));if(null!=e){if(7==a[b].tok){k=a[b].getList();f=new JU.Lst;h=new J.bspt.Bspt(3,0);if(Float.isNaN(e.x)){g=Array(k.size());for(b=g.length;0<=--b;){l=JS.SV.ptValue(k.get(b));if(null==l)return!1;e=new JU.Point3fi;e.setT(l);e.i=b;g[b]=e;h.addTuple(e)}l=h.allocateCubeIterator();m=JU.BSUtil.newBitSet2(0,k.size());for(b=g.length;0<=
--b;){l.initialize(e=g[b],c,!1);h=c*c;for(n=0;l.hasMoreElements();)k=l.nextElement(),m.get(k.i)&&(k.distanceSquared(e)<=h&&1<++n)&&m.clear(k.i)}for(b=m.nextSetBit(0);0<=b;b=m.nextSetBit(b+1))f.addLast(JU.P3.newP(g[b]));return d.addXList(f)}if(0==c){g=null;h=3.4028235E38;for(b=k.size();0<=--b;)f=JS.SV.ptValue(k.get(b)),c=f.distanceSquared(e),c<h&&(g=f,h=c);return null==g?d.addXStr(""):d.addXPt(g)}for(b=k.size();0<=--b;)h.addTuple(JS.SV.ptValue(k.get(b)));l=h.allocateCubeIterator();l.initialize(e,c,
!1);for(h=c*c;l.hasMoreElements();)k=l.nextElement(),k.distanceSquared(e)<=h&&f.addLast(k);l.release();return d.addXList(f)}return d.addXBs(this.vwr.getAtomsNearPt(c,e))}if(1086324744==g)return d.addXBs(this.vwr.ms.getSequenceBits(f,j,new JU.BS));null==j&&(j=new JU.BS);if(!m)return d.addXBs(this.vwr.ms.getAtoms(g,j));if(l)return d.addXBs(this.vwr.getGroupsWithin(D(c),j));h&&(n=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),0>c&&(c=0));return d.addXBs(this.vwr.ms.getAtomsWithinRadius(c,j,k,n))},"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(134221856,!0,a))},"JS.ScriptMathProcessor,~A");l(c$,"getAtomsNearSurface",function(d,a){var b=x(-1,[a,null,null]);if(this.e.getShapePropertyData(24,"getVertices",
b))return this.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$,"getAtomsNearPts",function(d,a,b){var c=new JU.BS;if(0==a.length||null!=b&&0==b.cardinality())return c;null==b&&(b=JU.BSUtil.setAll(a.length));for(var e=this.vwr.ms.at,f=this.vwr.ms.ac;0<=--f;)for(var g=e[f],h=b.nextSetBit(0);0<=h;h=b.nextSetBit(h+1))if(g.distance(a[h])<d){c.set(f);break}return c},
"~N,~A,JU.BS");l(c$,"getMinMax",function(d,a){for(var b=null,c=null,e=0,f=null;;){if(JU.AU.isAF(d)){if(1140850707==a)break;b=d;e=b.length;if(0==e)break}else if(s(d,JU.Lst))if(c=d,e=c.size(),0==e){if(1140850707!=a)break}else{var g=c.get(0);if(8==g.tok)return this.getMinMaxPoint(c,a);if(4==g.tok&&g.value.startsWith("{")){b=JS.SV.ptValue(g);if(s(b,JU.P3))return this.getMinMaxPoint(c,a);if(s(b,JU.P4))return this.getMinMaxQuaternion(c,a);break}}else break;var h,j=!1;switch(a){case 1140850707:f=new java.util.Hashtable;
g=h=0;break;case 32:j=!0;g=3.4028235E38;h=2147483647;break;case 64:g=-3.4028235E38;h=-2147483647;break;default:g=h=0}for(var k=0,l=0,m=!0,n=1140850707==a;0<=--e;){var q=null==c?JS.SV.vF:c.get(e),u=n?1:null==b?JS.SV.fValue(q):b[e];if(!Float.isNaN(u))switch(l++,a){case 160:case 192:k+=u*u;case 128:case 96:g+=u;break;case 1140850707:m=(new Boolean(m&2==q.tok)).valueOf();q=q.asString();u=f.get(q);f.put(q,null==u?new Integer(1):new Integer(u.intValue()+1));break;case 32:case 64:m=(new Boolean(m&2==q.tok)).valueOf(),
j==u<g&&(g=u,m&&(h=q.intValue))}}if(1140850707==a)return f;if(0==l)break;switch(a){case 96:g/=l;break;case 192:if(1==l)break;g=Math.sqrt((k-g*g/l)/(l-1));break;case 32:case 64:if(m)return Integer.$valueOf(h);break;case 160:g=k}return Float.$valueOf(g)}return"NaN"},"~O,~N");l(c$,"getMinMaxPoint",function(d,a){var b=null,c=null,e=0;s(d,Array)?(b=d,e=b.length):s(d,JU.Lst)&&(c=d,e=c.size());if(null==c&&null==b)return"NaN";for(var f=new JU.P3,g=v(e,0),h=0;3>h;h++){for(var j=0;j<e;j++){var k=null==b?JS.SV.ptValue(c.get(j)):
b[j];if(null==k)return"NaN";switch(h){case 0:g[j]=k.x;break;case 1:g[j]=k.y;break;case 2:g[j]=k.z}}j=this.getMinMax(g,a);if(!s(j,Number))return"NaN";j=j.floatValue();switch(h){case 0:f.x=j;break;case 1:f.y=j;break;case 2:f.z=j}}return f},"~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=v(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 1275069441:case 1275069446:return JS.T.tokenPlus;case 1275068931:return JS.T.tokenMinus;case 1275068929:return JS.T.tokenTimes;case 1275068930:return JS.T.tokenMul3;case 1275068928:return JS.T.tokenDivide}return null},"~N");l(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);
