//
// ChemDoodle Web Components 5.1.0
//
// http://web.chemdoodle.com
//
// Copyright 2009-2013 iChemLabs, LLC.  All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// As a special exception to the GPL, any HTML file in a public website
// or any free web service which merely makes function calls to this
// code, and for that purpose includes it by reference, shall be deemed
// a separate work for copyright law purposes. If you modify this code,
// you may extend this exception to your version of the code, but you
// are not obligated to do so. If you do not wish to do so, delete this
// exception statement from your version.
//
// As an additional exception to the GPL, you may distribute this
// packed form of the code without the copy of the GPL license normally
// required, provided you include this license notice and a URL through
// which recipients can access the corresponding unpacked source code.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// Please contact iChemLabs <http://www.ichemlabs.com/contact-us> for
// alternate licensing options.
//
var ChemDoodle=function(){var c={structures:{}};c.structures.d2={};c.structures.d3={};c.iChemLabs={};c.informatics={};c.io={};c.getVersion=function(){return"5.1.0"};return c}();
ChemDoodle.extensions=function(c,b,a){return{stringStartsWith:function(a,f){return a.slice(0,f.length)===f},vec3AngleFrom:function(g,f){var e=b.length(g),o=b.length(f),e=b.dot(g,f)/e/o;return a.acos(e)},contextHashTo:function(a,f,e,o,d,k,b){var l=0,h=(new c.Point(f,e)).distance(new c.Point(o,d)),j=!1,m=f,t=e;f=o-f;for(e=d-e;l<h;){if(j)if(l+b>h){a.moveTo(o,d);break}else{var n=b/h,m=m+n*f,t=t+n*e;a.moveTo(m,t);l+=b}else if(l+k>h){a.lineTo(o,d);break}else n=k/h,m+=n*f,t+=n*e,a.lineTo(m,t),l+=k;j=!j}},
contextRoundRect:function(a,f,e,o,d,k){a.beginPath();a.moveTo(f+k,e);a.lineTo(f+o-k,e);a.quadraticCurveTo(f+o,e,f+o,e+k);a.lineTo(f+o,e+d-k);a.quadraticCurveTo(f+o,e+d,f+o-k,e+d);a.lineTo(f+k,e+d);a.quadraticCurveTo(f,e+d,f,e+d-k);a.lineTo(f,e+k);a.quadraticCurveTo(f,e,f+k,e);a.closePath()},contextEllipse:function(a,f,e,o,d){var k=0.5522848*(o/2),b=0.5522848*(d/2),l=f+o,h=e+d;o=f+o/2;d=e+d/2;a.beginPath();a.moveTo(f,d);a.bezierCurveTo(f,d-b,o-k,e,o,e);a.bezierCurveTo(o+k,e,l,d-b,l,d);a.bezierCurveTo(l,
d+b,o+k,h,o,h);a.bezierCurveTo(o-k,h,f,d+b,f,d);a.closePath()}}}(ChemDoodle.structures,vec3,Math);
ChemDoodle.math=function(c,b,a){var g={},f={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",
darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",
gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c","indigo ":"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",
lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",
oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",
skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};g.angleBetweenLargest=function(e){if(0===e.length)return{angle:0,largest:2*a.PI};if(1===e.length)return{angle:e[0]+a.PI,largest:2*a.PI};for(var o=0,d=0,k=0,f=e.length-1;k<f;k++){var g=e[k+1]-e[k];
g>o&&(o=g,d=(e[k+1]+e[k])/2)}k=e[0]+2*a.PI-e[e.length-1];k>o&&(d=e[0]-k/2,o=k,0>d&&(d+=2*a.PI));return{angle:d,largest:o}};g.isBetween=function(a,o,d){if(o>d){var k=o;o=d;d=k}return a>=o&&a<=d};g.getRGB=function(a,o){var d=[0,0,0];f[a.toLowerCase()]&&(a=f[a.toLowerCase()]);if("#"===a.charAt(0))return 4===a.length&&(a="#"+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)+a.charAt(3)+a.charAt(3)),[parseInt(a.substring(1,3),16)/255*o,parseInt(a.substring(3,5),16)/255*o,parseInt(a.substring(5,7),16)/255*
o];if(c.stringStartsWith(a,"rgb")){var k=a.replace(/rgb\(|\)/g,"").split(",");return 3!==k.length?d:[parseInt(k[0])/255*o,parseInt(k[1])/255*o,parseInt(k[2])/255*o]}return d};g.distanceFromPointToLineInclusive=function(e,o,d){var k=o.distance(d);d=o.angle(d);d=a.PI/2-d;d=o.angle(e)+d;e=o.distance(e);e=new b.Point(e*a.cos(d),-e*a.sin(d));return g.isBetween(-e.y,0,k)?a.abs(e.x):-1};g.calculateDistanceInterior=function(e,o,d){if(this.isBetween(o.x,d.x,d.x+d.w)&&this.isBetween(o.y,d.y,d.y+d.w))return e.distance(o);
var k=[];k.push({x1:d.x,y1:d.y,x2:d.x+d.w,y2:d.y});k.push({x1:d.x,y1:d.y+d.h,x2:d.x+d.w,y2:d.y+d.h});k.push({x1:d.x,y1:d.y,x2:d.x,y2:d.y+d.h});k.push({x1:d.x+d.w,y1:d.y,x2:d.x+d.w,y2:d.y+d.h});d=[];for(var f=0;4>f;f++){var g=k[f];(g=this.intersectLines(o.x,o.y,e.x,e.y,g.x1,g.y1,g.x2,g.y2))&&d.push(g)}if(0===d.length)return 0;f=o=0;for(k=d.length;f<k;f++){var g=d[f],b=e.x-g.x,g=e.y-g.y;o=a.max(o,a.sqrt(b*b+g*g))}return o};g.intersectLines=function(a,f,d,k,g,b,h,c){d-=a;k-=f;h-=g;c-=b;var m=k*h-d*c;
if(0===m)return!1;h=(c*(a-g)-h*(f-b))/m;g=(k*(a-g)-d*(f-b))/m;return 0<=g&&1>=g&&0<=h&&1>=h?{x:a+h*d,y:f+h*k}:!1};g.hsl2rgb=function(a,f,d){var k=function(a,d,k){0>k?k+=1:1<k&&(k-=1);return k<1/6?a+6*(d-a)*k:0.5>k?d:k<2/3?a+6*(d-a)*(2/3-k):a};if(0===f)d=f=a=d;else{var g=0.5>d?d*(1+f):d+f-d*f,b=2*d-g;d=k(b,g,a+1/3);f=k(b,g,a);a=k(b,g,a-1/3)}return[255*d,255*f,255*a]};g.isPointInPoly=function(a,f){for(var d=!1,k=-1,g=a.length,b=g-1;++k<g;b=k)(a[k].y<=f.y&&f.y<a[b].y||a[b].y<=f.y&&f.y<a[k].y)&&f.x<(a[b].x-
a[k].x)*(f.y-a[k].y)/(a[b].y-a[k].y)+a[k].x&&(d=!d);return d};return g}(ChemDoodle.extensions,ChemDoodle.structures,Math);
(function(c,b){c.Bounds=function(){};var a=c.Bounds.prototype;a.minX=a.minY=a.minZ=Infinity;a.maxX=a.maxY=a.maxZ=-Infinity;a.expand=function(a,f,e,o){a instanceof c.Bounds?(this.minX=b.min(this.minX,a.minX),this.minY=b.min(this.minY,a.minY),this.maxX=b.max(this.maxX,a.maxX),this.maxY=b.max(this.maxY,a.maxY),Infinity!==a.maxZ&&(this.minZ=b.min(this.minZ,a.minZ),this.maxZ=b.max(this.maxZ,a.maxZ))):(this.minX=b.min(this.minX,a),this.maxX=b.max(this.maxX,a),this.minY=b.min(this.minY,f),this.maxY=b.max(this.maxY,
f),void 0!==e&&void 0!==o&&(this.minX=b.min(this.minX,e),this.maxX=b.max(this.maxX,e),this.minY=b.min(this.minY,o),this.maxY=b.max(this.maxY,o)))};a.expand3D=function(a,f,e,o,d,k){this.minX=b.min(this.minX,a);this.maxX=b.max(this.maxX,a);this.minY=b.min(this.minY,f);this.maxY=b.max(this.maxY,f);this.minZ=b.min(this.minZ,e);this.maxZ=b.max(this.maxZ,e);void 0!==o&&(void 0!==d&&void 0!==k)&&(this.minX=b.min(this.minX,o),this.maxX=b.max(this.maxX,o),this.minY=b.min(this.minY,d),this.maxY=b.max(this.maxY,
d),this.minZ=b.min(this.minZ,k),this.maxZ=b.max(this.maxZ,k))}})(ChemDoodle.math,Math);
(function(){var c={subtract:function(a,d){return{x:a.x-d.x,y:a.y-d.y}},dotProduct:function(a,d){return a.x*d.x+a.y*d.y},square:function(a){return Math.sqrt(a.x*a.x+a.y*a.y)},scale:function(a,d){return{x:a.x*d,y:a.y*d}}},b=Math.pow(2,-65),a=function(a,d){for(var k=[],e=d.length-1,o=2*e-1,b=[],v=[],q=[],r=[],w=[[1,0.6,0.3,0.1],[0.4,0.6,0.6,0.4],[0.1,0.3,0.6,1]],p=0;p<=e;p++)b[p]=c.subtract(d[p],a);for(p=0;p<=e-1;p++)v[p]=c.subtract(d[p+1],d[p]),v[p]=c.scale(v[p],3);for(p=0;p<=e-1;p++)for(var y=0;y<=
e;y++)q[p]||(q[p]=[]),q[p][y]=c.dotProduct(v[p],b[y]);for(p=0;p<=o;p++)r[p]||(r[p]=[]),r[p].y=0,r[p].x=parseFloat(p)/o;o=e-1;for(b=0;b<=e+o;b++){p=Math.max(0,b-o);for(v=Math.min(b,e);p<=v;p++)y=b-p,r[p+y].y+=q[y][p]*w[y][p]}e=d.length-1;r=g(r,2*e-1,k,0);o=c.subtract(a,d[0]);q=c.square(o);for(p=w=0;p<r;p++)o=c.subtract(a,f(d,e,k[p],null,null)),o=c.square(o),o<q&&(q=o,w=k[p]);o=c.subtract(a,d[e]);o=c.square(o);o<q&&(q=o,w=1);return{location:w,distance:q}},g=function(a,d,k,e){var o=[],c=[],v=[],q=[],
r=0,w,p;p=0==a[0].y?0:0<a[0].y?1:-1;for(var y=1;y<=d;y++)w=0==a[y].y?0:0<a[y].y?1:-1,w!=p&&r++,p=w;switch(r){case 0:return 0;case 1:if(64<=e)return k[0]=(a[0].x+a[d].x)/2,1;var z,x,A,r=a[0].y-a[d].y;w=a[d].x-a[0].x;p=a[0].x*a[d].y-a[d].x*a[0].y;y=z=0;for(x=1;x<d;x++)A=r*a[x].x+w*a[x].y+p,A>z?z=A:A<y&&(y=A);A=w;x=0*A-1*r;z=(1*(p-z)-0*A)*(1/x);A=w;x=0*A-1*r;r=(1*(p-y)-0*A)*(1/x);w=Math.min(z,r);if(Math.max(z,r)-w<b)return v=a[d].x-a[0].x,q=a[d].y-a[0].y,k[0]=0+1*(v*(a[0].y-0)-q*(a[0].x-0))*(1/(0*v-
1*q)),1}f(a,d,0.5,o,c);a=g(o,d,v,e+1);d=g(c,d,q,e+1);for(e=0;e<a;e++)k[e]=v[e];for(e=0;e<d;e++)k[e+a]=q[e];return a+d},f=function(a,d,k,e,f){for(var o=[[]],g=0;g<=d;g++)o[0][g]=a[g];for(a=1;a<=d;a++)for(g=0;g<=d-a;g++)o[a]||(o[a]=[]),o[a][g]||(o[a][g]={}),o[a][g].x=(1-k)*o[a-1][g].x+k*o[a-1][g+1].x,o[a][g].y=(1-k)*o[a-1][g].y+k*o[a-1][g+1].y;if(null!=e)for(g=0;g<=d;g++)e[g]=o[g][0];if(null!=f)for(g=0;g<=d;g++)f[g]=o[d-g][g];return o[d][0]},e={},o=function(a,d){var k,f=a.length-1;k=e[f];if(!k){k=[];
var g=function(a){return function(){return a}},o=function(){return function(a){return a}},b=function(){return function(a){return 1-a}},c=function(a){return function(d){for(var k=1,e=0;e<a.length;e++)k*=a[e](d);return k}};k.push(new function(){return function(a){return Math.pow(a,f)}});for(var v=1;v<f;v++){for(var w=[new g(f)],p=0;p<f-v;p++)w.push(new o);for(p=0;p<v;p++)w.push(new b);k.push(new c(w))}k.push(new function(){return function(a){return Math.pow(1-a,f)}});e[f]=k}for(b=o=g=0;b<a.length;b++)g+=
a[b].x*k[b](d),o+=a[b].y*k[b](d);return{x:g,y:o}},d=function(a,d){return Math.sqrt(Math.pow(a.x-d.x,2)+Math.pow(a.y-d.y,2))},k=function(a,k,e){for(var f=o(a,k),g=0,b=0<e?1:-1,c=null;g<Math.abs(e);)k+=0.005*b,c=o(a,k),g+=d(c,f),f=c;return{point:c,location:k}},v=function(a,d){var k=o(a,d),e=o(a.slice(0,a.length-1),d),f=e.y-k.y,k=e.x-k.x;return 0==f?Infinity:Math.atan(f/k)};ChemDoodle.math.jsBezier={distanceFromCurve:a,gradientAtPoint:v,gradientAtPointAlongCurveFrom:function(a,d,e){d=k(a,d,e);1<d.location&&
(d.location=1);0>d.location&&(d.location=0);return v(a,d.location)},nearestPointOnCurve:function(d,k){var e=a(d,k);return{point:f(k,k.length-1,e.location,null,null),location:e.location}},pointOnCurve:o,pointAlongCurveFrom:function(a,d,e){return k(a,d,e).point},perpendicularToCurveAt:function(a,d,e,f){d=k(a,d,null==f?0:f);a=v(a,d.location);f=Math.atan(-1/a);a=e/2*Math.sin(f);e=e/2*Math.cos(f);return[{x:d.point.x+e,y:d.point.y+a},{x:d.point.x-e,y:d.point.y-a}]},locationAlongCurveFrom:function(a,d,e){return k(a,
d,e).location},getLength:function(a){for(var k=o(a,0),e=0,f=0,g=null;1>f;)f+=0.005,g=o(a,f),e+=d(g,k),k=g;return e}}})(ChemDoodle.math);
ChemDoodle.featureDetection=function(c,b,a,g){var f={supports_canvas:function(){return!!a.createElement("canvas").getContext},supports_canvas_text:function(){return!f.supports_canvas()?!1:"function"===typeof a.createElement("canvas").getContext("2d").fillText},supports_webgl:function(){var e=a.createElement("canvas");try{if(e.getContext("webgl")||e.getContext("experimental-webgl"))return!0}catch(f){}return!1},supports_xhr2:function(){return b.support.cors},supports_touch:function(){return"ontouchstart"in
g},supports_gesture:function(){return"ongesturestart"in g}};return f}(ChemDoodle.iChemLabs,jQuery,document,window);ChemDoodle.SYMBOLS="H He Li Be B C N O F Ne Na Mg Al Si P S Cl Ar K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe Cs Ba La Ce Pr Nd Pm Sm Eu Gd Tb Dy Ho Er Tm Yb Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr Rf Db Sg Bh Hs Mt Ds Rg Cn Uut Uuq Uup Uuh Uus Uuo".split(" ");
ChemDoodle.ELEMENT=function(c){function b(a,f,d){this.symbol=a;this.name=f;this.atomicNumber=d}var a=[];a.H=new b("H","Hydrogen",1);a.He=new b("He","Helium",2);a.Li=new b("Li","Lithium",3);a.Be=new b("Be","Beryllium",4);a.B=new b("B","Boron",5);a.C=new b("C","Carbon",6);a.N=new b("N","Nitrogen",7);a.O=new b("O","Oxygen",8);a.F=new b("F","Fluorine",9);a.Ne=new b("Ne","Neon",10);a.Na=new b("Na","Sodium",11);a.Mg=new b("Mg","Magnesium",12);a.Al=new b("Al","Aluminum",13);a.Si=new b("Si","Silicon",14);
a.P=new b("P","Phosphorus",15);a.S=new b("S","Sulfur",16);a.Cl=new b("Cl","Chlorine",17);a.Ar=new b("Ar","Argon",18);a.K=new b("K","Potassium",19);a.Ca=new b("Ca","Calcium",20);a.Sc=new b("Sc","Scandium",21);a.Ti=new b("Ti","Titanium",22);a.V=new b("V","Vanadium",23);a.Cr=new b("Cr","Chromium",24);a.Mn=new b("Mn","Manganese",25);a.Fe=new b("Fe","Iron",26);a.Co=new b("Co","Cobalt",27);a.Ni=new b("Ni","Nickel",28);a.Cu=new b("Cu","Copper",29);a.Zn=new b("Zn","Zinc",30);a.Ga=new b("Ga","Gallium",31);
a.Ge=new b("Ge","Germanium",32);a.As=new b("As","Arsenic",33);a.Se=new b("Se","Selenium",34);a.Br=new b("Br","Bromine",35);a.Kr=new b("Kr","Krypton",36);a.Rb=new b("Rb","Rubidium",37);a.Sr=new b("Sr","Strontium",38);a.Y=new b("Y","Yttrium",39);a.Zr=new b("Zr","Zirconium",40);a.Nb=new b("Nb","Niobium",41);a.Mo=new b("Mo","Molybdenum",42);a.Tc=new b("Tc","Technetium",43);a.Ru=new b("Ru","Ruthenium",44);a.Rh=new b("Rh","Rhodium",45);a.Pd=new b("Pd","Palladium",46);a.Ag=new b("Ag","Silver",47);a.Cd=new b("Cd",
"Cadmium",48);a.In=new b("In","Indium",49);a.Sn=new b("Sn","Tin",50);a.Sb=new b("Sb","Antimony",51);a.Te=new b("Te","Tellurium",52);a.I=new b("I","Iodine",53);a.Xe=new b("Xe","Xenon",54);a.Cs=new b("Cs","Cesium",55);a.Ba=new b("Ba","Barium",56);a.La=new b("La","Lanthanum",57);a.Ce=new b("Ce","Cerium",58);a.Pr=new b("Pr","Praseodymium",59);a.Nd=new b("Nd","Neodymium",60);a.Pm=new b("Pm","Promethium",61);a.Sm=new b("Sm","Samarium",62);a.Eu=new b("Eu","Europium",63);a.Gd=new b("Gd","Gadolinium",64);
a.Tb=new b("Tb","Terbium",65);a.Dy=new b("Dy","Dysprosium",66);a.Ho=new b("Ho","Holmium",67);a.Er=new b("Er","Erbium",68);a.Tm=new b("Tm","Thulium",69);a.Yb=new b("Yb","Ytterbium",70);a.Lu=new b("Lu","Lutetium",71);a.Hf=new b("Hf","Hafnium",72);a.Ta=new b("Ta","Tantalum",73);a.W=new b("W","Tungsten",74);a.Re=new b("Re","Rhenium",75);a.Os=new b("Os","Osmium",76);a.Ir=new b("Ir","Iridium",77);a.Pt=new b("Pt","Platinum",78);a.Au=new b("Au","Gold",79);a.Hg=new b("Hg","Mercury",80);a.Tl=new b("Tl","Thallium",
81);a.Pb=new b("Pb","Lead",82);a.Bi=new b("Bi","Bismuth",83);a.Po=new b("Po","Polonium",84);a.At=new b("At","Astatine",85);a.Rn=new b("Rn","Radon",86);a.Fr=new b("Fr","Francium",87);a.Ra=new b("Ra","Radium",88);a.Ac=new b("Ac","Actinium",89);a.Th=new b("Th","Thorium",90);a.Pa=new b("Pa","Protactinium",91);a.U=new b("U","Uranium",92);a.Np=new b("Np","Neptunium",93);a.Pu=new b("Pu","Plutonium",94);a.Am=new b("Am","Americium",95);a.Cm=new b("Cm","Curium",96);a.Bk=new b("Bk","Berkelium",97);a.Cf=new b("Cf",
"Californium",98);a.Es=new b("Es","Einsteinium",99);a.Fm=new b("Fm","Fermium",100);a.Md=new b("Md","Mendelevium",101);a.No=new b("No","Nobelium",102);a.Lr=new b("Lr","Lawrencium",103);a.Rf=new b("Rf","Rutherfordium",104);a.Db=new b("Db","Dubnium",105);a.Sg=new b("Sg","Seaborgium",106);a.Bh=new b("Bh","Bohrium",107);a.Hs=new b("Hs","Hassium",108);a.Mt=new b("Mt","Meitnerium",109);a.Ds=new b("Ds","Darmstadtium",110);a.Rg=new b("Rg","Roentgenium",111);a.Cn=new b("Cn","Copernicium",112);a.Uut=new b("Uut",
"Ununtrium",113);a.Uuq=new b("Uuq","Ununquadium",114);a.Uup=new b("Uup","Ununpentium",115);a.Uuh=new b("Uuh","Ununhexium",116);a.Uus=new b("Uus","Ununseptium",117);a.Uuo=new b("Uuo","Ununoctium",118);a.B.addH=!0;a.C.addH=!0;a.N.addH=!0;a.O.addH=!0;a.F.addH=!0;a.Si.addH=!0;a.P.addH=!0;a.S.addH=!0;a.Cl.addH=!0;a.As.addH=!0;a.Se.addH=!0;a.Br.addH=!0;a.Te.addH=!0;a.I.addH=!0;a.At.addH=!0;a.H.jmolColor="#FFFFFF";a.He.jmolColor="#D9FFFF";a.Li.jmolColor="#CC80FF";a.Be.jmolColor="#C2FF00";a.B.jmolColor="#FFB5B5";
a.C.jmolColor="#909090";a.N.jmolColor="#3050F8";a.O.jmolColor="#FF0D0D";a.F.jmolColor="#90E050";a.Ne.jmolColor="#B3E3F5";a.Na.jmolColor="#AB5CF2";a.Mg.jmolColor="#8AFF00";a.Al.jmolColor="#BFA6A6";a.Si.jmolColor="#F0C8A0";a.P.jmolColor="#FF8000";a.S.jmolColor="#FFFF30";a.Cl.jmolColor="#1FF01F";a.Ar.jmolColor="#80D1E3";a.K.jmolColor="#8F40D4";a.Ca.jmolColor="#3DFF00";a.Sc.jmolColor="#E6E6E6";a.Ti.jmolColor="#BFC2C7";a.V.jmolColor="#A6A6AB";a.Cr.jmolColor="#8A99C7";a.Mn.jmolColor="#9C7AC7";a.Fe.jmolColor=
"#E06633";a.Co.jmolColor="#F090A0";a.Ni.jmolColor="#50D050";a.Cu.jmolColor="#C88033";a.Zn.jmolColor="#7D80B0";a.Ga.jmolColor="#C28F8F";a.Ge.jmolColor="#668F8F";a.As.jmolColor="#BD80E3";a.Se.jmolColor="#FFA100";a.Br.jmolColor="#A62929";a.Kr.jmolColor="#5CB8D1";a.Rb.jmolColor="#702EB0";a.Sr.jmolColor="#00FF00";a.Y.jmolColor="#94FFFF";a.Zr.jmolColor="#94E0E0";a.Nb.jmolColor="#73C2C9";a.Mo.jmolColor="#54B5B5";a.Tc.jmolColor="#3B9E9E";a.Ru.jmolColor="#248F8F";a.Rh.jmolColor="#0A7D8C";a.Pd.jmolColor="#006985";
a.Ag.jmolColor="#C0C0C0";a.Cd.jmolColor="#FFD98F";a.In.jmolColor="#A67573";a.Sn.jmolColor="#668080";a.Sb.jmolColor="#9E63B5";a.Te.jmolColor="#D47A00";a.I.jmolColor="#940094";a.Xe.jmolColor="#429EB0";a.Cs.jmolColor="#57178F";a.Ba.jmolColor="#00C900";a.La.jmolColor="#70D4FF";a.Ce.jmolColor="#FFFFC7";a.Pr.jmolColor="#D9FFC7";a.Nd.jmolColor="#C7FFC7";a.Pm.jmolColor="#A3FFC7";a.Sm.jmolColor="#8FFFC7";a.Eu.jmolColor="#61FFC7";a.Gd.jmolColor="#45FFC7";a.Tb.jmolColor="#30FFC7";a.Dy.jmolColor="#1FFFC7";a.Ho.jmolColor=
"#00FF9C";a.Er.jmolColor="#00E675";a.Tm.jmolColor="#00D452";a.Yb.jmolColor="#00BF38";a.Lu.jmolColor="#00AB24";a.Hf.jmolColor="#4DC2FF";a.Ta.jmolColor="#4DA6FF";a.W.jmolColor="#2194D6";a.Re.jmolColor="#267DAB";a.Os.jmolColor="#266696";a.Ir.jmolColor="#175487";a.Pt.jmolColor="#D0D0E0";a.Au.jmolColor="#FFD123";a.Hg.jmolColor="#B8B8D0";a.Tl.jmolColor="#A6544D";a.Pb.jmolColor="#575961";a.Bi.jmolColor="#9E4FB5";a.Po.jmolColor="#AB5C00";a.At.jmolColor="#754F45";a.Rn.jmolColor="#428296";a.Fr.jmolColor="#420066";
a.Ra.jmolColor="#007D00";a.Ac.jmolColor="#70ABFA";a.Th.jmolColor="#00BAFF";a.Pa.jmolColor="#00A1FF";a.U.jmolColor="#008FFF";a.Np.jmolColor="#0080FF";a.Pu.jmolColor="#006BFF";a.Am.jmolColor="#545CF2";a.Cm.jmolColor="#785CE3";a.Bk.jmolColor="#8A4FE3";a.Cf.jmolColor="#A136D4";a.Es.jmolColor="#B31FD4";a.Fm.jmolColor="#B31FBA";a.Md.jmolColor="#B30DA6";a.No.jmolColor="#BD0D87";a.Lr.jmolColor="#C70066";a.Rf.jmolColor="#CC0059";a.Db.jmolColor="#D1004F";a.Sg.jmolColor="#D90045";a.Bh.jmolColor="#E00038";a.Hs.jmolColor=
"#E6002E";a.Mt.jmolColor="#EB0026";a.Ds.jmolColor="#000000";a.Rg.jmolColor="#000000";a.Cn.jmolColor="#000000";a.Uut.jmolColor="#000000";a.Uuq.jmolColor="#000000";a.Uup.jmolColor="#000000";a.Uuh.jmolColor="#000000";a.Uus.jmolColor="#000000";a.Uuo.jmolColor="#000000";for(var g=0,f=c.length;g<f;g++)a[c[g]].pymolColor=a[c[g]].jmolColor;a.H.pymolColor="#E6E6E6";a.C.pymolColor="#33FF33";a.N.pymolColor="#3333FF";a.O.pymolColor="#FF4D4D";a.F.pymolColor="#B3FFFF";a.S.pymolColor="#E6C640";a.H.covalentRadius=
0.31;a.He.covalentRadius=0.28;a.Li.covalentRadius=1.28;a.Be.covalentRadius=0.96;a.B.covalentRadius=0.84;a.C.covalentRadius=0.76;a.N.covalentRadius=0.71;a.O.covalentRadius=0.66;a.F.covalentRadius=0.57;a.Ne.covalentRadius=0.58;a.Na.covalentRadius=1.66;a.Mg.covalentRadius=1.41;a.Al.covalentRadius=1.21;a.Si.covalentRadius=1.11;a.P.covalentRadius=1.07;a.S.covalentRadius=1.05;a.Cl.covalentRadius=1.02;a.Ar.covalentRadius=1.06;a.K.covalentRadius=2.03;a.Ca.covalentRadius=1.76;a.Sc.covalentRadius=1.7;a.Ti.covalentRadius=
1.6;a.V.covalentRadius=1.53;a.Cr.covalentRadius=1.39;a.Mn.covalentRadius=1.39;a.Fe.covalentRadius=1.32;a.Co.covalentRadius=1.26;a.Ni.covalentRadius=1.24;a.Cu.covalentRadius=1.32;a.Zn.covalentRadius=1.22;a.Ga.covalentRadius=1.22;a.Ge.covalentRadius=1.2;a.As.covalentRadius=1.19;a.Se.covalentRadius=1.2;a.Br.covalentRadius=1.2;a.Kr.covalentRadius=1.16;a.Rb.covalentRadius=2.2;a.Sr.covalentRadius=1.95;a.Y.covalentRadius=1.9;a.Zr.covalentRadius=1.75;a.Nb.covalentRadius=1.64;a.Mo.covalentRadius=1.54;a.Tc.covalentRadius=
1.47;a.Ru.covalentRadius=1.46;a.Rh.covalentRadius=1.42;a.Pd.covalentRadius=1.39;a.Ag.covalentRadius=1.45;a.Cd.covalentRadius=1.44;a.In.covalentRadius=1.42;a.Sn.covalentRadius=1.39;a.Sb.covalentRadius=1.39;a.Te.covalentRadius=1.38;a.I.covalentRadius=1.39;a.Xe.covalentRadius=1.4;a.Cs.covalentRadius=2.44;a.Ba.covalentRadius=2.15;a.La.covalentRadius=2.07;a.Ce.covalentRadius=2.04;a.Pr.covalentRadius=2.03;a.Nd.covalentRadius=2.01;a.Pm.covalentRadius=1.99;a.Sm.covalentRadius=1.98;a.Eu.covalentRadius=1.98;
a.Gd.covalentRadius=1.96;a.Tb.covalentRadius=1.94;a.Dy.covalentRadius=1.92;a.Ho.covalentRadius=1.92;a.Er.covalentRadius=1.89;a.Tm.covalentRadius=1.9;a.Yb.covalentRadius=1.87;a.Lu.covalentRadius=1.87;a.Hf.covalentRadius=1.75;a.Ta.covalentRadius=1.7;a.W.covalentRadius=1.62;a.Re.covalentRadius=1.51;a.Os.covalentRadius=1.44;a.Ir.covalentRadius=1.41;a.Pt.covalentRadius=1.36;a.Au.covalentRadius=1.36;a.Hg.covalentRadius=1.32;a.Tl.covalentRadius=1.45;a.Pb.covalentRadius=1.46;a.Bi.covalentRadius=1.48;a.Po.covalentRadius=
1.4;a.At.covalentRadius=1.5;a.Rn.covalentRadius=1.5;a.Fr.covalentRadius=2.6;a.Ra.covalentRadius=2.21;a.Ac.covalentRadius=2.15;a.Th.covalentRadius=2.06;a.Pa.covalentRadius=2;a.U.covalentRadius=1.96;a.Np.covalentRadius=1.9;a.Pu.covalentRadius=1.87;a.Am.covalentRadius=1.8;a.Cm.covalentRadius=1.69;a.Bk.covalentRadius=0;a.Cf.covalentRadius=0;a.Es.covalentRadius=0;a.Fm.covalentRadius=0;a.Md.covalentRadius=0;a.No.covalentRadius=0;a.Lr.covalentRadius=0;a.Rf.covalentRadius=0;a.Db.covalentRadius=0;a.Sg.covalentRadius=
0;a.Bh.covalentRadius=0;a.Hs.covalentRadius=0;a.Mt.covalentRadius=0;a.Ds.covalentRadius=0;a.Rg.covalentRadius=0;a.Cn.covalentRadius=0;a.Uut.covalentRadius=0;a.Uuq.covalentRadius=0;a.Uup.covalentRadius=0;a.Uuh.covalentRadius=0;a.Uus.covalentRadius=0;a.Uuo.covalentRadius=0;a.H.vdWRadius=1.2;a.He.vdWRadius=1.4;a.Li.vdWRadius=1.82;a.Be.vdWRadius=0;a.B.vdWRadius=0;a.C.vdWRadius=1.7;a.N.vdWRadius=1.55;a.O.vdWRadius=1.52;a.F.vdWRadius=1.47;a.Ne.vdWRadius=1.54;a.Na.vdWRadius=2.27;a.Mg.vdWRadius=1.73;a.Al.vdWRadius=
0;a.Si.vdWRadius=2.1;a.P.vdWRadius=1.8;a.S.vdWRadius=1.8;a.Cl.vdWRadius=1.75;a.Ar.vdWRadius=1.88;a.K.vdWRadius=2.75;a.Ca.vdWRadius=0;a.Sc.vdWRadius=0;a.Ti.vdWRadius=0;a.V.vdWRadius=0;a.Cr.vdWRadius=0;a.Mn.vdWRadius=0;a.Fe.vdWRadius=0;a.Co.vdWRadius=0;a.Ni.vdWRadius=1.63;a.Cu.vdWRadius=1.4;a.Zn.vdWRadius=1.39;a.Ga.vdWRadius=1.87;a.Ge.vdWRadius=0;a.As.vdWRadius=1.85;a.Se.vdWRadius=1.9;a.Br.vdWRadius=1.85;a.Kr.vdWRadius=2.02;a.Rb.vdWRadius=0;a.Sr.vdWRadius=0;a.Y.vdWRadius=0;a.Zr.vdWRadius=0;a.Nb.vdWRadius=
0;a.Mo.vdWRadius=0;a.Tc.vdWRadius=0;a.Ru.vdWRadius=0;a.Rh.vdWRadius=0;a.Pd.vdWRadius=1.63;a.Ag.vdWRadius=1.72;a.Cd.vdWRadius=1.58;a.In.vdWRadius=1.93;a.Sn.vdWRadius=2.17;a.Sb.vdWRadius=0;a.Te.vdWRadius=2.06;a.I.vdWRadius=1.98;a.Xe.vdWRadius=2.16;a.Cs.vdWRadius=0;a.Ba.vdWRadius=0;a.La.vdWRadius=0;a.Ce.vdWRadius=0;a.Pr.vdWRadius=0;a.Nd.vdWRadius=0;a.Pm.vdWRadius=0;a.Sm.vdWRadius=0;a.Eu.vdWRadius=0;a.Gd.vdWRadius=0;a.Tb.vdWRadius=0;a.Dy.vdWRadius=0;a.Ho.vdWRadius=0;a.Er.vdWRadius=0;a.Tm.vdWRadius=0;
a.Yb.vdWRadius=0;a.Lu.vdWRadius=0;a.Hf.vdWRadius=0;a.Ta.vdWRadius=0;a.W.vdWRadius=0;a.Re.vdWRadius=0;a.Os.vdWRadius=0;a.Ir.vdWRadius=0;a.Pt.vdWRadius=1.75;a.Au.vdWRadius=1.66;a.Hg.vdWRadius=1.55;a.Tl.vdWRadius=1.96;a.Pb.vdWRadius=2.02;a.Bi.vdWRadius=0;a.Po.vdWRadius=0;a.At.vdWRadius=0;a.Rn.vdWRadius=0;a.Fr.vdWRadius=0;a.Ra.vdWRadius=0;a.Ac.vdWRadius=0;a.Th.vdWRadius=0;a.Pa.vdWRadius=0;a.U.vdWRadius=1.86;a.Np.vdWRadius=0;a.Pu.vdWRadius=0;a.Am.vdWRadius=0;a.Cm.vdWRadius=0;a.Bk.vdWRadius=0;a.Cf.vdWRadius=
0;a.Es.vdWRadius=0;a.Fm.vdWRadius=0;a.Md.vdWRadius=0;a.No.vdWRadius=0;a.Lr.vdWRadius=0;a.Rf.vdWRadius=0;a.Db.vdWRadius=0;a.Sg.vdWRadius=0;a.Bh.vdWRadius=0;a.Hs.vdWRadius=0;a.Mt.vdWRadius=0;a.Ds.vdWRadius=0;a.Rg.vdWRadius=0;a.Cn.vdWRadius=0;a.Uut.vdWRadius=0;a.Uuq.vdWRadius=0;a.Uup.vdWRadius=0;a.Uuh.vdWRadius=0;a.Uus.vdWRadius=0;a.Uuo.vdWRadius=0;a.H.valency=1;a.He.valency=0;a.Li.valency=1;a.Be.valency=2;a.B.valency=3;a.C.valency=4;a.N.valency=3;a.O.valency=2;a.F.valency=1;a.Ne.valency=0;a.Na.valency=
1;a.Mg.valency=0;a.Al.valency=0;a.Si.valency=4;a.P.valency=3;a.S.valency=2;a.Cl.valency=1;a.Ar.valency=0;a.K.valency=0;a.Ca.valency=0;a.Sc.valency=0;a.Ti.valency=1;a.V.valency=1;a.Cr.valency=2;a.Mn.valency=3;a.Fe.valency=2;a.Co.valency=1;a.Ni.valency=1;a.Cu.valency=0;a.Zn.valency=0;a.Ga.valency=0;a.Ge.valency=4;a.As.valency=3;a.Se.valency=2;a.Br.valency=1;a.Kr.valency=0;a.Rb.valency=0;a.Sr.valency=0;a.Y.valency=0;a.Zr.valency=0;a.Nb.valency=1;a.Mo.valency=2;a.Tc.valency=3;a.Ru.valency=2;a.Rh.valency=
1;a.Pd.valency=0;a.Ag.valency=0;a.Cd.valency=0;a.In.valency=0;a.Sn.valency=4;a.Sb.valency=3;a.Te.valency=2;a.I.valency=1;a.Xe.valency=0;a.Cs.valency=0;a.Ba.valency=0;a.La.valency=0;a.Ce.valency=0;a.Pr.valency=0;a.Nd.valency=0;a.Pm.valency=0;a.Sm.valency=0;a.Eu.valency=0;a.Gd.valency=0;a.Tb.valency=0;a.Dy.valency=0;a.Ho.valency=0;a.Er.valency=0;a.Tm.valency=0;a.Yb.valency=0;a.Lu.valency=0;a.Hf.valency=0;a.Ta.valency=1;a.W.valency=2;a.Re.valency=3;a.Os.valency=2;a.Ir.valency=3;a.Pt.valency=0;a.Au.valency=
1;a.Hg.valency=0;a.Tl.valency=0;a.Pb.valency=4;a.Bi.valency=3;a.Po.valency=2;a.At.valency=1;a.Rn.valency=0;a.Fr.valency=0;a.Ra.valency=0;a.Ac.valency=0;a.Th.valency=0;a.Pa.valency=0;a.U.valency=0;a.Np.valency=0;a.Pu.valency=0;a.Am.valency=0;a.Cm.valency=0;a.Bk.valency=0;a.Cf.valency=0;a.Es.valency=0;a.Fm.valency=0;a.Md.valency=0;a.No.valency=0;a.Lr.valency=0;a.Rf.valency=0;a.Db.valency=0;a.Sg.valency=0;a.Bh.valency=0;a.Hs.valency=0;a.Mt.valency=0;a.Ds.valency=0;a.Rg.valency=0;a.Cn.valency=0;a.Uut.valency=
0;a.Uuq.valency=0;a.Uup.valency=0;a.Uuh.valency=0;a.Uus.valency=0;a.Uuo.valency=0;a.H.mass=1;a.He.mass=4;a.Li.mass=7;a.Be.mass=9;a.B.mass=11;a.C.mass=12;a.N.mass=14;a.O.mass=16;a.F.mass=19;a.Ne.mass=20;a.Na.mass=23;a.Mg.mass=24;a.Al.mass=27;a.Si.mass=28;a.P.mass=31;a.S.mass=32;a.Cl.mass=35;a.Ar.mass=40;a.K.mass=39;a.Ca.mass=40;a.Sc.mass=45;a.Ti.mass=48;a.V.mass=51;a.Cr.mass=52;a.Mn.mass=55;a.Fe.mass=56;a.Co.mass=59;a.Ni.mass=58;a.Cu.mass=63;a.Zn.mass=64;a.Ga.mass=69;a.Ge.mass=74;a.As.mass=75;a.Se.mass=
80;a.Br.mass=79;a.Kr.mass=84;a.Rb.mass=85;a.Sr.mass=88;a.Y.mass=89;a.Zr.mass=90;a.Nb.mass=93;a.Mo.mass=98;a.Tc.mass=0;a.Ru.mass=102;a.Rh.mass=103;a.Pd.mass=106;a.Ag.mass=107;a.Cd.mass=114;a.In.mass=115;a.Sn.mass=120;a.Sb.mass=121;a.Te.mass=130;a.I.mass=127;a.Xe.mass=132;a.Cs.mass=133;a.Ba.mass=138;a.La.mass=139;a.Ce.mass=140;a.Pr.mass=141;a.Nd.mass=142;a.Pm.mass=0;a.Sm.mass=152;a.Eu.mass=153;a.Gd.mass=158;a.Tb.mass=159;a.Dy.mass=164;a.Ho.mass=165;a.Er.mass=166;a.Tm.mass=169;a.Yb.mass=174;a.Lu.mass=
175;a.Hf.mass=180;a.Ta.mass=181;a.W.mass=184;a.Re.mass=187;a.Os.mass=192;a.Ir.mass=193;a.Pt.mass=195;a.Au.mass=197;a.Hg.mass=202;a.Tl.mass=205;a.Pb.mass=208;a.Bi.mass=209;a.Po.mass=0;a.At.mass=0;a.Rn.mass=0;a.Fr.mass=0;a.Ra.mass=0;a.Ac.mass=0;a.Th.mass=232;a.Pa.mass=231;a.U.mass=238;a.Np.mass=0;a.Pu.mass=0;a.Am.mass=0;a.Cm.mass=0;a.Bk.mass=0;a.Cf.mass=0;a.Es.mass=0;a.Fm.mass=0;a.Md.mass=0;a.No.mass=0;a.Lr.mass=0;a.Rf.mass=0;a.Db.mass=0;a.Sg.mass=0;a.Bh.mass=0;a.Hs.mass=0;a.Mt.mass=0;a.Ds.mass=0;a.Rg.mass=
0;a.Cn.mass=0;a.Uut.mass=0;a.Uuq.mass=0;a.Uup.mass=0;a.Uuh.mass=0;a.Uus.mass=0;a.Uuo.mass=0;return a}(ChemDoodle.SYMBOLS);
ChemDoodle.RESIDUE=function(){function c(a,g){this.symbol=a;this.name=g}var b=[];b.Ala=new c("Ala","Alanine");b.Arg=new c("Arg","Arginine");b.Asn=new c("Asn","Asparagine");b.Asp=new c("Asp","Aspartic Acid");b.Cys=new c("Cys","Cysteine");b.Gln=new c("Gln","Glutamine");b.Glu=new c("Glu","Glutamic Acid");b.Gly=new c("Gly","Glycine");b.His=new c("His","Histidine");b.Ile=new c("Ile","Isoleucine");b.Leu=new c("Leu","Leucine");b.Lys=new c("Lys","Lysine");b.Met=new c("Met","Methionine");b.Phe=new c("Phe",
"Phenylalanine");b.Pro=new c("Pro","Proline");b.Ser=new c("Ser","Serine");b.Thr=new c("Thr","Threonine");b.Trp=new c("Trp","Tryptophan");b.Tyr=new c("Tyr","Tyrosine");b.Val=new c("Val","Valine");b.Asx=new c("Asx","Asparagine/Aspartic Acid");b.Glx=new c("Glx","Glutamine/Glutamic Acid");b["*"]=new c("*","Other");b.A=new c("A","Adenine");b.G=new c("G","Guanine");b.I=new c("I","");b.C=new c("C","Cytosine");b.T=new c("T","Thymine");b.U=new c("U","Uracil");b.Ala.polar=!1;b.Arg.polar=!0;b.Asn.polar=!0;b.Asp.polar=
!0;b.Cys.polar=!0;b.Gln.polar=!0;b.Glu.polar=!0;b.Gly.polar=!1;b.His.polar=!0;b.Ile.polar=!1;b.Leu.polar=!1;b.Lys.polar=!0;b.Met.polar=!1;b.Phe.polar=!1;b.Pro.polar=!1;b.Ser.polar=!0;b.Thr.polar=!0;b.Trp.polar=!0;b.Tyr.polar=!0;b.Val.polar=!1;b.Asx.polar=!0;b.Glx.polar=!0;b.Ala.aminoColor="#C8C8C8";b.Arg.aminoColor="#145AFF";b.Asn.aminoColor="#00DCDC";b.Asp.aminoColor="#E60A0A";b.Cys.aminoColor="#E6E600";b.Gln.aminoColor="#00DCDC";b.Glu.aminoColor="#E60A0A";b.Gly.aminoColor="#EBEBEB";b.His.aminoColor=
"#8282D2";b.Ile.aminoColor="#0F820F";b.Leu.aminoColor="#0F820F";b.Lys.aminoColor="#145AFF";b.Met.aminoColor="#E6E600";b.Phe.aminoColor="#3232AA";b.Pro.aminoColor="#DC9682";b.Ser.aminoColor="#FA9600";b.Thr.aminoColor="#FA9600";b.Trp.aminoColor="#B45AB4";b.Tyr.aminoColor="#3232AA";b.Val.aminoColor="#0F820F";b.Asx.aminoColor="#FF69B4";b.Glx.aminoColor="#FF69B4";b["*"].aminoColor="#BEA06E";b.A.aminoColor="#BEA06E";b.G.aminoColor="#BEA06E";b.I.aminoColor="#BEA06E";b.C.aminoColor="#BEA06E";b.T.aminoColor=
"#BEA06E";b.U.aminoColor="#BEA06E";b.Ala.shapelyColor="#8CFF8C";b.Arg.shapelyColor="#00007C";b.Asn.shapelyColor="#FF7C70";b.Asp.shapelyColor="#A00042";b.Cys.shapelyColor="#FFFF70";b.Gln.shapelyColor="#FF4C4C";b.Glu.shapelyColor="#660000";b.Gly.shapelyColor="#FFFFFF";b.His.shapelyColor="#7070FF";b.Ile.shapelyColor="#004C00";b.Leu.shapelyColor="#455E45";b.Lys.shapelyColor="#4747B8";b.Met.shapelyColor="#B8A042";b.Phe.shapelyColor="#534C52";b.Pro.shapelyColor="#525252";b.Ser.shapelyColor="#FF7042";b.Thr.shapelyColor=
"#B84C00";b.Trp.shapelyColor="#4F4600";b.Tyr.shapelyColor="#8C704C";b.Val.shapelyColor="#FF8CFF";b.Asx.shapelyColor="#FF00FF";b.Glx.shapelyColor="#FF00FF";b["*"].shapelyColor="#FF00FF";b.A.shapelyColor="#A0A0FF";b.G.shapelyColor="#FF7070";b.I.shapelyColor="#80FFFF";b.C.shapelyColor="#FF8C4B";b.T.shapelyColor="#A0FFA0";b.U.shapelyColor="#FF8080";return b}();
(function(c){c.Queue=function(){this.queue=[]};c=c.Queue.prototype;c.queueSpace=0;c.getSize=function(){return this.queue.length-this.queueSpace};c.isEmpty=function(){return 0===this.queue.length};c.enqueue=function(b){this.queue.push(b)};c.dequeue=function(){var b;this.queue.length&&(b=this.queue[this.queueSpace],2*++this.queueSpace>=this.queue.length&&(this.queue=this.queue.slice(this.queueSpace),this.queueSpace=0));return b};c.getOldestElement=function(){var b;this.queue.length&&(b=this.queue[this.queueSpace]);
return b}})(ChemDoodle.structures);
(function(c,b){c.Point=function(a,f){this.x=a?a:0;this.y=f?f:0};var a=c.Point.prototype;a.sub=function(a){this.x-=a.x;this.y-=a.y};a.add=function(a){this.x+=a.x;this.y+=a.y};a.distance=function(a){var f=a.x-this.x;a=a.y-this.y;return b.sqrt(f*f+a*a)};a.angleForStupidCanvasArcs=function(a){var f=a.x-this.x;a=a.y-this.y;for(var e=0,e=0===f?0===a?0:0<a?b.PI/2:3*b.PI/2:0===a?0<f?0:b.PI:0>f?b.atan(a/f)+b.PI:0>a?b.atan(a/f)+2*b.PI:b.atan(a/f);0>e;)e+=2*b.PI;return e%=2*b.PI};a.angle=function(a){var f=a.x-
this.x;a=this.y-a.y;for(var e=0,e=0===f?0===a?0:0<a?b.PI/2:3*b.PI/2:0===a?0<f?0:b.PI:0>f?b.atan(a/f)+b.PI:0>a?b.atan(a/f)+2*b.PI:b.atan(a/f);0>e;)e+=2*b.PI;return e%=2*b.PI}})(ChemDoodle.structures,Math);
(function(c,b,a,g,f,e){g.Atom=function(a,d,k,e){this.label=a?a.replace(/\s/g,""):"C";c[this.label]||(this.label="C");this.x=d?d:0;this.y=k?k:0;this.z=e?e:0};g=g.Atom.prototype=new g.Point(0,0);g.charge=0;g.numLonePair=0;g.numRadical=0;g.mass=-1;g.coordinationNumber=0;g.bondNumber=0;g.angleOfLeastInterference=0;g.isHidden=!1;g.altLabel=void 0;g.any=!1;g.rgroup=-1;g.isLone=!1;g.isHover=!1;g.isSelected=!1;g.add3D=function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z};g.sub3D=function(a){this.x-=a.x;this.y-=
a.y;this.z-=a.z};g.distance3D=function(a){var d=a.x-this.x,k=a.y-this.y;a=a.z-this.z;return f.sqrt(d*d+k*k+a*a)};g.draw=function(a,d){if(this.isLassoed){var k=a.createRadialGradient(this.x-1,this.y-1,0,this.x,this.y,7);k.addColorStop(0,"rgba(212, 99, 0, 0)");k.addColorStop(0.7,"rgba(212, 99, 0, 0.8)");a.fillStyle=k;a.beginPath();a.arc(this.x,this.y,5,0,2*f.PI,!1);a.fill()}this.textBounds=[];this.specs&&(d=this.specs);k=d.getFontString(d.atoms_font_size_2D,d.atoms_font_families_2D,d.atoms_font_bold_2D,
d.atoms_font_italic_2D);a.font=k;a.fillStyle=d.atoms_color;!this.any&&-1===this.rgroup&&(d.atoms_useJMOLColors?a.fillStyle=c[this.label].jmolColor:d.atoms_usePYMOLColors&&(a.fillStyle=c[this.label].pymolColor));if(this.isLone&&!d.atoms_displayAllCarbonLabels_2D||d.atoms_circles_2D)a.beginPath(),a.arc(this.x,this.y,d.atoms_circleDiameter_2D/2,0,2*f.PI,!1),a.fill(),0<d.atoms_circleBorderWidth_2D&&(a.lineWidth=d.atoms_circleBorderWidth_2D,a.strokeStyle="black",a.stroke(this.x,this.y,0,2*f.PI,d.atoms_circleDiameter_2D/
2));else if(this.isLabelVisible(d)){a.textAlign="center";a.textBaseline="middle";if(void 0!==this.altLabel){a.fillText(this.altLabel,this.x,this.y);var e=a.measureText(this.altLabel).width;this.textBounds.push({x:this.x-e/2,y:this.y-d.atoms_font_size_2D/2+1,w:e,h:d.atoms_font_size_2D-2})}else if(this.any)a.font=d.getFontString(d.atoms_font_size_2D+5,d.atoms_font_families_2D,!0),a.fillText("*",this.x+1,this.y+3),e=a.measureText("*").width,this.textBounds.push({x:this.x-e/2,y:this.y-d.atoms_font_size_2D/
2+1,w:e,h:d.atoms_font_size_2D-2});else if(-1!==this.rgroup)k="R"+this.rgroup,a.fillText(k,this.x,this.y),e=a.measureText(k).width,this.textBounds.push({x:this.x-e/2,y:this.y-d.atoms_font_size_2D/2+1,w:e,h:d.atoms_font_size_2D-2});else{a.fillText(this.label,this.x,this.y);e=a.measureText(this.label).width;this.textBounds.push({x:this.x-e/2,y:this.y-d.atoms_font_size_2D/2+1,w:e,h:d.atoms_font_size_2D-2});if(-1!==this.mass){var g=d.getFontString(0.7*d.atoms_font_size_2D,d.atoms_font_families_2D,d.atoms_font_bold_2D,
d.atoms_font_italic_2D),h=a.font;a.font=g;g=a.measureText(this.mass).width;a.fillText(this.mass,this.x-g-0.5,this.y-0.3*d.atoms_font_size_2D);a.font=h}h=this.getImplicitHydrogenCount();if(d.atoms_implicitHydrogens_2D&&0<h){var j=a.measureText("H").width;if(1<h){var m=e/2+j/2,t=0,g=d.getFontString(0.8*d.atoms_font_size_2D,d.atoms_font_families_2D,d.atoms_font_bold_2D,d.atoms_font_italic_2D);a.font=g;var n=a.measureText(h).width;1===this.bondNumber?this.angleOfLeastInterference>f.PI/2&&this.angleOfLeastInterference<
3*f.PI/2&&(m=-e/2-n-j/2):this.angleOfLeastInterference<=f.PI/4||(this.angleOfLeastInterference<3*f.PI/4?(m=0,t=0.9*-d.atoms_font_size_2D):this.angleOfLeastInterference<=5*f.PI/4?m=-e/2-n-j/2:this.angleOfLeastInterference<7*f.PI/4&&(m=0,t=0.9*d.atoms_font_size_2D));a.font=k;a.fillText("H",this.x+m,this.y+t);a.font=g;a.fillText(h,this.x+m+j/2+n/2,this.y+t+0.3*d.atoms_font_size_2D);this.textBounds.push({x:this.x+m-j/2,y:this.y+t-d.atoms_font_size_2D/2+1,w:j,h:d.atoms_font_size_2D-2});this.textBounds.push({x:this.x+
m+j/2,y:this.y+t+0.3*d.atoms_font_size_2D-d.atoms_font_size_2D/2+1,w:n,h:0.8*d.atoms_font_size_2D-2})}else m=e/2+j/2,t=0,1===this.bondNumber?this.angleOfLeastInterference>f.PI/2&&this.angleOfLeastInterference<3*f.PI/2&&(m=-e/2-j/2):this.angleOfLeastInterference<=f.PI/4||(this.angleOfLeastInterference<3*f.PI/4?(m=0,t=0.9*-d.atoms_font_size_2D):this.angleOfLeastInterference<=5*f.PI/4?m=-e/2-j/2:this.angleOfLeastInterference<7*f.PI/4&&(m=0,t=0.9*d.atoms_font_size_2D)),a.fillText("H",this.x+m,this.y+
t),this.textBounds.push({x:this.x+m-j/2,y:this.y+t-d.atoms_font_size_2D/2+1,w:j,h:d.atoms_font_size_2D-2})}}0!==this.charge&&(k=this.charge.toFixed(0),k="1"===k?"+":"-1"===k?"\u2013":b.stringStartsWith(k,"-")?k.substring(1)+"\u2013":k+"+",e=this.angleOfLeastInterference,g=d.atoms_font_size_2D,this.isLabelVisible(d)&&0<h&&(e+=f.PI/4),a.textAlign="center",a.textBaseline="middle",a.fillText(k,this.x+g*f.cos(e),this.y-g*f.sin(e)));if(0<this.numLonePair||0<this.numRadical)a.fillStyle="black",2===this.bondNumber&&
f.abs(this.largestAngle-f.PI)<f.PI/60?0===this.numRadical?(this.drawElectrons(a,d,f.floor(this.numLonePair/2),0,this.angleOfLeastInterference,this.largestAngle),this.drawElectrons(a,d,f.floor(this.numLonePair/2)+this.numLonePair%2,0,this.angleOfLeastInterference+f.PI,this.largestAngle)):0===this.numLonePair?(this.drawElectrons(a,d,0,f.floor(this.numRadical/2),this.angleOfLeastInterference,this.largestAngle),this.drawElectrons(a,d,0,f.floor(this.numRadical/2)+this.numRadical%2,this.angleOfLeastInterference+
f.PI,this.largestAngle)):(this.drawElectrons(a,d,this.numLonePair,0,this.angleOfLeastInterference,this.largestAngle),this.drawElectrons(a,d,0,this.numRadical,this.angleOfLeastInterference+f.PI,this.largestAngle)):this.drawElectrons(a,d,this.numLonePair,this.numRadical,this.angleOfLeastInterference,this.largestAngle)}};g.drawElectrons=function(a,d,e,g,b,c){var j=c/(e+g+(0===this.bondNumber?0:1));c=b-c/2+j;for(var m=0;m<e;m++){b=c+m*j;var t=this.x+Math.cos(b)*d.atoms_lonePairDistance_2D,n=this.y-Math.sin(b)*
d.atoms_lonePairDistance_2D,u=b+Math.PI/2;b=Math.cos(u)*d.atoms_lonePairSpread_2D/2;u=-Math.sin(u)*d.atoms_lonePairSpread_2D/2;a.beginPath();a.arc(t+b,n+u,d.atoms_lonePairDiameter_2D,0,2*f.PI,!1);a.fill();a.beginPath();a.arc(t-b,n-u,d.atoms_lonePairDiameter_2D,0,2*f.PI,!1);a.fill()}for(m=0;m<g;m++)b=c+(m+e)*j,t=this.x+Math.cos(b)*d.atoms_lonePairDistance_2D,n=this.y-Math.sin(b)*d.atoms_lonePairDistance_2D,a.beginPath(),a.arc(t,n,d.atoms_lonePairDiameter_2D,0,2*f.PI,!1),a.fill()};g.drawDecorations=
function(a){if(this.isHover||this.isSelected)a.strokeStyle=this.isHover?"#885110":"#0060B2",a.lineWidth=1.2,a.beginPath(),a.arc(this.x,this.y,this.isHover?7:15,0,2*f.PI,!1),a.stroke();this.isOverlap&&(a.strokeStyle="#C10000",a.lineWidth=1.2,a.beginPath(),a.arc(this.x,this.y,7,0,2*f.PI,!1),a.stroke())};g.render=function(a,d){this.specs&&(d=this.specs);var k=e.translate(a.modelViewMatrix,[this.x,this.y,this.z],[]),f=d.atoms_useVDWDiameters_3D?c[this.label].vdWRadius*d.atoms_vdwMultiplier_3D:d.atoms_sphereDiameter_3D/
2;0===f&&(f=1);e.scale(k,[f,f,f]);f=d.atoms_color;d.atoms_useJMOLColors?f=c[this.label].jmolColor:d.atoms_usePYMOLColors&&(f=c[this.label].pymolColor);a.material.setDiffuseColor(f);a.setMatrixUniforms(k);a.drawElements(a.TRIANGLES,(this.renderAsStar?a.starBuffer:a.sphereBuffer).vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0)};g.isLabelVisible=function(a){return a.atoms_displayAllCarbonLabels_2D||"C"!==this.label||this.altLabel||this.any||-1!==this.rgroup||-1!==this.mass||0!==this.charge||0!==this.numLonePair||
this.isHidden&&a.atoms_showHiddenCarbons_2D||a.atoms_displayTerminalCarbonLabels_2D&&1===this.bondNumber};g.getImplicitHydrogenCount=function(){if("H"===this.label||!c[this.label]||!c[this.label].addH)return 0;var a=c[this.label].valency,d=a-this.coordinationNumber;0<this.charge?(a=4-a,d=this.charge<=a?d+this.charge:4-this.coordinationNumber-this.charge+a):d+=this.charge;return 0>d?0:f.floor(d)};g.getBounds=function(){var e=new a.Bounds;e.expand(this.x,this.y);if(this.textBounds)for(var d=0,k=this.textBounds.length;d<
k;d++){var f=this.textBounds[d];e.expand(f.x,f.y,f.x+f.w,f.y+f.h)}return e}})(ChemDoodle.ELEMENT,ChemDoodle.extensions,ChemDoodle.math,ChemDoodle.structures,Math,mat4);
(function(c,b,a,g,f,e,o){a.Bond=function(a,d,e){this.a1=a;this.a2=d;this.bondOrder=void 0!==e?e:1};a.Bond.STEREO_NONE="none";a.Bond.STEREO_PROTRUDING="protruding";a.Bond.STEREO_RECESSED="recessed";a.Bond.STEREO_AMBIGUOUS="ambiguous";var d=a.Bond.prototype;d.stereo=a.Bond.STEREO_NONE;d.isHover=!1;d.ring=void 0;d.getCenter=function(){return new a.Point((this.a1.x+this.a2.x)/2,(this.a1.y+this.a2.y)/2)};d.getLength=function(){return this.a1.distance(this.a2)};d.getLength3D=function(){return this.a1.distance3D(this.a2)};
d.contains=function(a){return a===this.a1||a===this.a2};d.getNeighbor=function(a){if(a===this.a1)return this.a2;if(a===this.a2)return this.a1};d.draw=function(d,e){if(!(this.a1.x===this.a2.x&&this.a1.y===this.a2.y)){this.specs&&(e=this.specs);var o=this.a1.x,h=this.a2.x,j=this.a1.y,m=this.a2.y,t=this.a1.distance(this.a2),n=h-o,u=m-j;if(this.a1.isLassoed&&this.a2.isLassoed){var q=d.createLinearGradient(o,j,h,m);q.addColorStop(0,"rgba(212, 99, 0, 0)");q.addColorStop(0.5,"rgba(212, 99, 0, 0.8)");q.addColorStop(1,
"rgba(212, 99, 0, 0)");var r=2.5,w=this.a1.angle(this.a2)+f.PI/2,p=f.cos(w),w=f.sin(w),y=o-p*r,z=j+w*r,x=o+p*r,A=j-w*r,C=h+p*r,F=m-w*r,p=h-p*r,w=m+w*r;d.fillStyle=q;d.beginPath();d.moveTo(y,z);d.lineTo(x,A);d.lineTo(C,F);d.lineTo(p,w);d.closePath();d.fill()}if(e.atoms_display&&!e.atoms_circles_2D&&this.a1.isLabelVisible(e)&&this.a1.textBounds){r=p=0;for(y=this.a1.textBounds.length;r<y;r++)p=Math.max(p,g.calculateDistanceInterior(this.a1,this.a2,this.a1.textBounds[r]));p+=e.bonds_atomLabelBuffer_2D;
p/=t;o+=n*p;j+=u*p}if(e.atoms_display&&!e.atoms_circles_2D&&this.a2.isLabelVisible(e)&&this.a2.textBounds){r=p=0;for(y=this.a2.textBounds.length;r<y;r++)p=Math.max(p,g.calculateDistanceInterior(this.a2,this.a1,this.a2.textBounds[r]));p+=e.bonds_atomLabelBuffer_2D;p/=t;h-=n*p;m-=u*p}e.bonds_clearOverlaps_2D&&(p=o+0.15*n,w=j+0.15*u,r=h-0.15*n,t=m-0.15*u,d.strokeStyle=e.backgroundColor,d.lineWidth=e.bonds_width_2D+2*e.bonds_overlapClearWidth_2D,d.lineCap="round",d.beginPath(),d.moveTo(p,w),d.lineTo(r,
t),d.closePath(),d.stroke());d.strokeStyle=e.bonds_color;d.fillStyle=e.bonds_color;d.lineWidth=e.bonds_width_2D;d.lineCap=e.bonds_ends_2D;if(e.bonds_useJMOLColors||e.bonds_usePYMOLColors)p=d.createLinearGradient(o,j,h,m),w=c[this.a1.label].jmolColor,r=c[this.a2.label].jmolColor,e.atoms_usePYMOLColors&&(w=c[this.a1.label].pymolColor,r=c[this.a2.label].pymolColor),p.addColorStop(0,w),e.bonds_colorGradient||(p.addColorStop(0.5,w),p.addColorStop(0.51,r)),p.addColorStop(1,r),d.strokeStyle=p,d.fillStyle=
p;switch(this.bondOrder){case 0:h-=o;m-=j;h=f.sqrt(h*h+m*m);m=f.floor(h/e.bonds_dotSize_2D);h=(h-m*e.bonds_dotSize_2D+e.bonds_dotSize_2D)/2;1===m%2?h+=e.bonds_dotSize_2D/4:(h-=e.bonds_dotSize_2D/4,m+=2);m/=2;u=this.a1.angle(this.a2);p=o+h*Math.cos(u);w=j-h*Math.sin(u);d.beginPath();for(r=0;r<m;r++)d.arc(p,w,e.bonds_dotSize_2D/2,0,2*f.PI,!1),p+=2*e.bonds_dotSize_2D*Math.cos(u),w-=2*e.bonds_dotSize_2D*Math.sin(u);d.fill();break;case 0.5:d.beginPath();d.moveTo(o,j);b.contextHashTo(d,o,j,h,m,e.bonds_hashSpacing_2D,
e.bonds_hashSpacing_2D);d.stroke();break;case 1:if(this.stereo===a.Bond.STEREO_PROTRUDING||this.stereo===a.Bond.STEREO_RECESSED)u=e.bonds_width_2D/2,r=this.a1.distance(this.a2)*e.bonds_wedgeThickness_2D/2,w=this.a1.angle(this.a2)+f.PI/2,p=f.cos(w),w=f.sin(w),y=o-p*u,z=j+w*u,x=o+p*u,A=j-w*u,C=h+p*r,F=m-w*r,p=h-p*r,w=m+w*r,d.beginPath(),d.moveTo(y,z),d.lineTo(x,A),d.lineTo(C,F),d.lineTo(p,w),d.closePath(),this.stereo===a.Bond.STEREO_PROTRUDING?d.fill():(d.save(),d.clip(),d.lineWidth=2*r,d.lineCap="butt",
d.beginPath(),d.moveTo(o,j),b.contextHashTo(d,o,j,h,m,e.bonds_hashWidth_2D,e.bonds_hashSpacing_2D),d.stroke(),d.restore());else if(this.stereo===a.Bond.STEREO_AMBIGUOUS){d.beginPath();d.moveTo(o,j);h=f.floor(f.sqrt(n*n+u*u)/e.bonds_wavyLength_2D);w=this.a1.angle(this.a2)+f.PI/2;p=f.cos(w);w=f.sin(w);m=n/h;u/=h;r=0;for(y=h;r<y;r++)o+=m,j+=u,h=e.bonds_wavyLength_2D*p+o-0.5*m,t=e.bonds_wavyLength_2D*-w+j-0.5*u,n=e.bonds_wavyLength_2D*-p+o-0.5*m,z=e.bonds_wavyLength_2D*w+j-0.5*u,0===r%2?d.quadraticCurveTo(h,
t,o,j):d.quadraticCurveTo(n,z,o,j);d.stroke();break}else d.beginPath(),d.moveTo(o,j),d.lineTo(h,m),d.stroke();break;case 1.5:case 2:this.stereo===a.Bond.STEREO_AMBIGUOUS?(r=this.a1.distance(this.a2)*e.bonds_saturationWidth_2D/2,w=this.a1.angle(this.a2)+f.PI/2,p=f.cos(w),w=f.sin(w),y=o-p*r,z=j+w*r,x=o+p*r,A=j-w*r,C=h+p*r,F=m-w*r,p=h-p*r,w=m+w*r,d.beginPath(),d.moveTo(y,z),d.lineTo(C,F),d.moveTo(x,A),d.lineTo(p,w),d.stroke()):!e.bonds_symmetrical_2D&&(this.ring||"C"===this.a1.label&&"C"===this.a2.label)?
(d.beginPath(),d.moveTo(o,j),d.lineTo(h,m),p=0,t=this.a1.distance(this.a2),u=this.a1.angle(this.a2),w=u+f.PI/2,r=t*e.bonds_saturationWidth_2D,n=e.bonds_saturationAngle_2D,n<f.PI/2&&(p=-(r/f.tan(n))),f.abs(p)<t/2&&(n=o-f.cos(u)*p,o=h+f.cos(u)*p,h=j+f.sin(u)*p,j=m-f.sin(u)*p,p=f.cos(w),w=f.sin(w),y=n-p*r,z=h+w*r,x=n+p*r,A=h-w*r,C=o-p*r,F=j+w*r,p=o+p*r,w=j-w*r,!this.ring||this.ring.center.angle(this.a1)>this.ring.center.angle(this.a2)&&!(this.ring.center.angle(this.a1)-this.ring.center.angle(this.a2)>
f.PI)||this.ring.center.angle(this.a1)-this.ring.center.angle(this.a2)<-f.PI?(d.moveTo(y,z),2===this.bondOrder?d.lineTo(C,F):b.contextHashTo(d,y,z,C,F,e.bonds_hashSpacing_2D,e.bonds_hashSpacing_2D)):(d.moveTo(x,A),2===this.bondOrder?d.lineTo(p,w):b.contextHashTo(d,x,A,p,w,e.bonds_hashSpacing_2D,e.bonds_hashSpacing_2D)),d.stroke())):(r=this.a1.distance(this.a2)*e.bonds_saturationWidth_2D/2,w=this.a1.angle(this.a2)+f.PI/2,p=f.cos(w),w=f.sin(w),y=o-p*r,z=j+w*r,x=o+p*r,A=j-w*r,C=h+p*r,F=m-w*r,p=h-p*r,
w=m+w*r,d.beginPath(),d.moveTo(y,z),d.lineTo(p,w),d.moveTo(x,A),2===this.bondOrder?d.lineTo(C,F):b.contextHashTo(d,x,A,C,F,e.bonds_hashSpacing_2D,e.bonds_hashSpacing_2D),d.stroke());break;case 3:r=this.a1.distance(this.a2)*e.bonds_saturationWidth_2D,w=this.a1.angle(this.a2)+f.PI/2,p=f.cos(w),w=f.sin(w),y=o-p*r,z=j+w*r,x=o+p*r,A=j-w*r,C=h+p*r,F=m-w*r,p=h-p*r,w=m+w*r,d.beginPath(),d.moveTo(y,z),d.lineTo(p,w),d.moveTo(x,A),d.lineTo(C,F),d.moveTo(o,j),d.lineTo(h,m),d.stroke()}}};d.drawDecorations=function(a){if(this.isHover||
this.isSelected){var d=2*f.PI,e=(this.a1.angleForStupidCanvasArcs(this.a2)+f.PI/2)%d;a.strokeStyle=this.isHover?"#885110":"#0060B2";a.lineWidth=1.2;a.beginPath();var g=(e+f.PI)%d,g=g%(2*f.PI);a.arc(this.a1.x,this.a1.y,7,e,g,!1);a.stroke();a.beginPath();e+=f.PI;g=(e+f.PI)%d;a.arc(this.a2.x,this.a2.y,7,e,g,!1);a.stroke()}};d.render=function(a,d){this.specs&&(d=this.specs);var g=(d.bonds_renderAsLines_3D?1.1:1.001)*this.a1.distance3D(this.a2)/(d.bonds_useJMOLColors||d.bonds_usePYMOLColors?2:1);if(0===
g)return!1;var g=[d.bonds_cylinderDiameter_3D/2,g,d.bonds_cylinderDiameter_3D/2],h=e.translate(a.modelViewMatrix,[this.a1.x,this.a1.y,this.a1.z],[]),j,m=[this.a2.x-this.a1.x,this.a2.y-this.a1.y,this.a2.z-this.a1.z];if(d.bonds_useJMOLColors||d.bonds_usePYMOLColors)o.scale(m,0.5),j=e.translate(a.modelViewMatrix,[this.a2.x,this.a2.y,this.a2.z],[]);var t=[0],n;if(d.bonds_showBondOrders_3D){switch(this.bondOrder){case 2:t=[-d.bonds_cylinderDiameter_3D,d.bonds_cylinderDiameter_3D];break;case 3:t=[-1.2*
d.bonds_cylinderDiameter_3D,0,1.2*d.bonds_cylinderDiameter_3D]}if(1<t.length){n=[0,0,1];var u=e.inverse(a.rotationMatrix,[]);e.multiplyVec3(u,n);n=o.cross(m,n,[]);o.normalize(n)}}var q=[0,1,0],u=0;this.a1.x===this.a2.x&&this.a1.z===this.a2.z?(m=[0,0,1],this.a2.y<this.a1.y&&(u=f.PI)):(u=b.vec3AngleFrom(q,m),m=o.cross(q,m,[]));for(var q=0,r=t.length;q<r;q++){var w=e.set(h,[]);0!==t[q]&&e.translate(w,o.scale(n,t[q],[]));0!==u&&e.rotate(w,u,m);e.scale(w,g);var p=d.bonds_color;d.bonds_useJMOLColors?p=
c[this.a1.label].jmolColor:d.bonds_usePYMOLColors&&(p=c[this.a1.label].pymolColor);a.material.setDiffuseColor(p);a.setMatrixUniforms(w);d.bonds_renderAsLines_3D?a.drawArrays(a.LINES,0,a.lineBuffer.vertexPositionBuffer.numItems):a.drawArrays(a.TRIANGLE_STRIP,0,a.cylinderBuffer.vertexPositionBuffer.numItems);if(d.bonds_useJMOLColors||d.bonds_usePYMOLColors)e.set(j,w),0!==t[q]&&e.translate(w,o.scale(n,t[q],[])),e.rotate(w,u+f.PI,m),e.scale(w,g),a.material.setDiffuseColor(d.bonds_usePYMOLColors?c[this.a2.label].pymolColor:
c[this.a2.label].jmolColor),a.setMatrixUniforms(w),d.bonds_renderAsLines_3D?a.drawArrays(a.LINES,0,a.lineBuffer.vertexPositionBuffer.numItems):a.drawArrays(a.TRIANGLE_STRIP,0,a.cylinderBuffer.vertexPositionBuffer.numItems)}}})(ChemDoodle.ELEMENT,ChemDoodle.extensions,ChemDoodle.structures,ChemDoodle.math,Math,mat4,vec3);
(function(c,b){c.Ring=function(){this.atoms=[];this.bonds=[]};var a=c.Ring.prototype;a.center=void 0;a.setupBonds=function(){for(var a=0,f=this.bonds.length;a<f;a++)this.bonds[a].ring=this;this.center=this.getCenter()};a.getCenter=function(){for(var a=Infinity,f=Infinity,e=-Infinity,o=-Infinity,d=0,k=this.atoms.length;d<k;d++)a=b.min(this.atoms[d].x,a),f=b.min(this.atoms[d].y,f),e=b.max(this.atoms[d].x,e),o=b.max(this.atoms[d].y,o);return new c.Point((e+a)/2,(o+f)/2)}})(ChemDoodle.structures,Math);
(function(c,b,a,g,f){a.Molecule=function(){this.atoms=[];this.bonds=[];this.rings=[]};var e=a.Molecule.prototype;e.findRings=!0;e.draw=function(a,d){this.specs&&(d=this.specs);if(d.atoms_display&&!d.atoms_circles_2D)for(var e=0,f=this.atoms.length;e<f;e++)this.atoms[e].draw(a,d);if(d.bonds_display){e=0;for(f=this.bonds.length;e<f;e++)this.bonds[e].draw(a,d)}if(d.atoms_display&&d.atoms_circles_2D){e=0;for(f=this.atoms.length;e<f;e++)this.atoms[e].draw(a,d)}};e.render=function(e,d){this.specs&&(d=this.specs);
var f=0<this.atoms.length&&void 0!==this.atoms[0].hetatm;if(f){if(d.macro_displayBonds){0<this.bonds.length&&(d.bonds_renderAsLines_3D&&!this.residueSpecs||this.residueSpecs&&this.residueSpecs.bonds_renderAsLines_3D?(e.lineWidth(this.residueSpecs?this.residueSpecs.bonds_width_2D:d.bonds_width_2D),e.lineBuffer.bindBuffers(e)):e.cylinderBuffer.bindBuffers(e),e.material.setTempColors(d.bonds_materialAmbientColor_3D,void 0,d.bonds_materialSpecularColor_3D,d.bonds_materialShininess_3D));for(var b=0,c=
this.bonds.length;b<c;b++){var h=this.bonds[b];if(!h.a1.hetatm&&(-1===d.macro_atomToLigandDistance||void 0!==h.a1.closestDistance&&d.macro_atomToLigandDistance>=h.a1.closestDistance&&d.macro_atomToLigandDistance>=h.a2.closestDistance))h.render(e,this.residueSpecs?this.residueSpecs:d)}}if(d.macro_displayAtoms){0<this.atoms.length&&(e.sphereBuffer.bindBuffers(e),e.material.setTempColors(d.atoms_materialAmbientColor_3D,void 0,d.atoms_materialSpecularColor_3D,d.atoms_materialShininess_3D));b=0;for(c=
this.atoms.length;b<c;b++){var j=this.atoms[b];if(!j.hetatm&&(-1===d.macro_atomToLigandDistance||void 0!==j.closestDistance&&d.macro_atomToLigandDistance>=j.closestDistance))j.render(e,this.residueSpecs?this.residueSpecs:d)}}}if(d.bonds_display){0<this.bonds.length&&(d.bonds_renderAsLines_3D?(e.lineWidth(d.bonds_width_2D),e.lineBuffer.bindBuffers(e)):e.cylinderBuffer.bindBuffers(e),e.material.setTempColors(d.bonds_materialAmbientColor_3D,void 0,d.bonds_materialSpecularColor_3D,d.bonds_materialShininess_3D));
b=0;for(c=this.bonds.length;b<c;b++)h=this.bonds[b],(!f||h.a1.hetatm)&&h.render(e,d)}if(d.atoms_display){b=0;for(c=this.atoms.length;b<c;b++)j=this.atoms[b],j.bondNumber=0,j.renderAsStar=!1;b=0;for(c=this.bonds.length;b<c;b++)h=this.bonds[b],h.a1.bondNumber++,h.a2.bondNumber++;0<this.atoms.length&&(e.sphereBuffer.bindBuffers(e),e.material.setTempColors(d.atoms_materialAmbientColor_3D,void 0,d.atoms_materialSpecularColor_3D,d.atoms_materialShininess_3D));h=[];b=0;for(c=this.atoms.length;b<c;b++)if(j=
this.atoms[b],!f||j.hetatm&&(d.macro_showWater||!j.isWater))d.atoms_nonBondedAsStars_3D&&0===j.bondNumber?(j.renderAsStar=!0,h.push(j)):j.render(e,d);if(0<h.length){e.starBuffer.bindBuffers(e);b=0;for(c=h.length;b<c;b++)h[b].render(e,d)}}if(this.chains){e.setMatrixUniforms(e.modelViewMatrix);if(d.proteins_displayRibbon){e.material.setTempColors(d.proteins_materialAmbientColor_3D,void 0,d.proteins_materialSpecularColor_3D,d.proteins_materialShininess_3D);f=0;for(j=this.ribbons.length;f<j;f++)if(d.proteins_useShapelyColors||
d.proteins_useAminoColors||d.proteins_usePolarityColors){h=d.proteins_ribbonCartoonize?this.cartoons[f]:this.ribbons[f];h.front.bindBuffers(e);b=0;for(c=h.front.segments.length;b<c;b++)h.front.segments[b].render(e,d);h.back.bindBuffers(e);b=0;for(c=h.back.segments.length;b<c;b++)h.back.segments[b].render(e,d)}else if(d.proteins_ribbonCartoonize){h=this.cartoons[f];h.front.bindBuffers(e);b=0;for(c=h.front.cartoonSegments.length;b<c;b++)h.front.cartoonSegments[b].render(e,d);h.back.bindBuffers(e);b=
0;for(c=h.back.cartoonSegments.length;b<c;b++)h.back.cartoonSegments[b].render(e,d)}else h=this.ribbons[f],h.front.render(e,d),h.back.render(e,d)}if(d.proteins_displayBackbone){if(!this.alphaCarbonTrace){this.alphaCarbonTrace={nodes:[],edges:[]};f=0;for(j=this.chains.length;f<j;f++){var m=this.chains[f];if(!(2<m.length&&g[m[2].name]&&"#BEA06E"===g[m[2].name].aminoColor)&&0<m.length){b=1;for(c=m.length-2;b<c;b++)h=m[b].cp1,h.chainColor=m.chainColor,this.alphaCarbonTrace.nodes.push(h),h=new a.Bond(m[b].cp1,
m[b+1].cp1),h.residueName=m[b].name,h.chainColor=m.chainColor,this.alphaCarbonTrace.edges.push(h),b===m.length-3&&(h=m[b+1].cp1,h.chainColor=m.chainColor,this.alphaCarbonTrace.nodes.push(h))}}}if(0<this.alphaCarbonTrace.nodes.length){f=new a.VisualSpecifications;f.atoms_display=!0;f.bonds_display=!0;f.atoms_sphereDiameter_3D=d.proteins_backboneThickness;f.bonds_cylinderDiameter_3D=d.proteins_backboneThickness;f.bonds_useJMOLColors=!1;f.atoms_color=d.proteins_backboneColor;f.bonds_color=d.proteins_backboneColor;
f.atoms_useVDWDiameters_3D=!1;e.material.setTempColors(d.proteins_materialAmbientColor_3D,void 0,d.proteins_materialSpecularColor_3D,d.proteins_materialShininess_3D);e.material.setDiffuseColor(d.proteins_backboneColor);b=0;for(c=this.alphaCarbonTrace.nodes.length;b<c;b++)h=this.alphaCarbonTrace.nodes[b],d.macro_colorByChain&&(f.atoms_color=h.chainColor),e.sphereBuffer.bindBuffers(e),h.render(e,f);b=0;for(c=this.alphaCarbonTrace.edges.length;b<c;b++){var j=this.alphaCarbonTrace.edges[b],t,h=g[j.residueName]?
g[j.residueName]:g["*"];d.macro_colorByChain?t=j.chainColor:d.proteins_useShapelyColors?t=h.shapelyColor:d.proteins_useAminoColors?t=h.aminoColor:d.proteins_usePolarityColors&&(t=h.polar?"#C10000":"#FFFFFF");t&&(f.bonds_color=t);e.cylinderBuffer.bindBuffers(e);j.render(e,f)}}}if(d.nucleics_display){e.material.setTempColors(d.nucleics_materialAmbientColor_3D,void 0,d.nucleics_materialSpecularColor_3D,d.nucleics_materialShininess_3D);f=0;for(j=this.tubes.length;f<j;f++)e.setMatrixUniforms(e.modelViewMatrix),
h=this.tubes[f],h.render(e,d)}}d.crystals_displayUnitCell&&this.unitCell&&(e.setMatrixUniforms(e.modelViewMatrix),this.unitCell.bindBuffers(e),e.material.setDiffuseColor(d.crystals_unitCellColor),e.lineWidth(d.crystals_unitCellLineWidth),e.drawElements(e.LINES,this.unitCell.vertexIndexBuffer.numItems,e.UNSIGNED_SHORT,0));this.surface&&d.surfaces_display&&(e.setMatrixUniforms(e.modelViewMatrix),this.surface.bindBuffers(e),e.material.setTempColors(d.surfaces_materialAmbientColor_3D,d.surfaces_color,
d.surfaces_materialSpecularColor_3D,d.surfaces_materialShininess_3D),"Dot"===d.surfaces_style?e.drawArrays(e.POINTS,0,this.surface.vertexPositionBuffer.numItems):e.drawElements(e.TRIANGLES,this.surface.vertexIndexBuffer.numItems,e.UNSIGNED_SHORT,0))};e.getCenter3D=function(){if(1===this.atoms.length)return new a.Atom("C",this.atoms[0].x,this.atoms[0].y,this.atoms[0].z);var e=Infinity,d=Infinity,g=Infinity,b=-Infinity,c=-Infinity,h=-Infinity;if(this.chains)for(var j=0,m=this.chains.length;j<m;j++)for(var t=
this.chains[j],n=0,u=t.length;n<u;n++)var q=t[n],e=f.min(q.cp1.x,e),d=f.min(q.cp1.y,d),g=f.min(q.cp1.z,g),b=f.max(q.cp1.x,b),c=f.max(q.cp1.y,c),h=f.max(q.cp1.z,h),e=f.min(q.cp2.x,e),d=f.min(q.cp2.y,d),g=f.min(q.cp2.z,g),b=f.max(q.cp2.x,b),c=f.max(q.cp2.y,c),h=f.max(q.cp2.z,h);j=0;for(m=this.atoms.length;j<m;j++)e=f.min(this.atoms[j].x,e),d=f.min(this.atoms[j].y,d),g=f.min(this.atoms[j].z,g),b=f.max(this.atoms[j].x,b),c=f.max(this.atoms[j].y,c),h=f.max(this.atoms[j].z,h);return new a.Atom("C",(b+e)/
2,(c+d)/2,(h+g)/2)};e.getCenter=function(){if(1===this.atoms.length)return new a.Point(this.atoms[0].x,this.atoms[0].y);for(var e=Infinity,d=Infinity,g=-Infinity,b=-Infinity,c=0,h=this.atoms.length;c<h;c++)e=f.min(this.atoms[c].x,e),d=f.min(this.atoms[c].y,d),g=f.max(this.atoms[c].x,g),b=f.max(this.atoms[c].y,b);return new a.Point((g+e)/2,(b+d)/2)};e.getDimension=function(){if(1===this.atoms.length)return new a.Point(0,0);var e=Infinity,d=Infinity,g=-Infinity,b=-Infinity;if(this.chains){for(var c=
0,h=this.chains.length;c<h;c++)for(var j=this.chains[c],m=0,t=j.length;m<t;m++)var n=j[m],e=f.min(n.cp1.x,e),d=f.min(n.cp1.y,d),g=f.max(n.cp1.x,g),b=f.max(n.cp1.y,b),e=f.min(n.cp2.x,e),d=f.min(n.cp2.y,d),g=f.max(n.cp2.x,g),b=f.max(n.cp2.y,b);e-=30;d-=30;g+=30;b+=30}c=0;for(h=this.atoms.length;c<h;c++)e=f.min(this.atoms[c].x,e),d=f.min(this.atoms[c].y,d),g=f.max(this.atoms[c].x,g),b=f.max(this.atoms[c].y,b);return new a.Point(g-e,b-d)};e.check=function(a){if(a&&this.doChecks){if(this.findRings)if(this.bonds.length-
this.atoms.length!==this.fjNumCache){this.rings=(new c.informatics.SSSRFinder(this)).rings;for(var d=0,e=this.bonds.length;d<e;d++)this.bonds[d].ring=void 0;d=0;for(e=this.rings.length;d<e;d++)this.rings[d].setupBonds()}else{d=0;for(e=this.rings.length;d<e;d++){var f=this.rings[d];f.center=f.getCenter()}}d=0;for(e=this.atoms.length;d<e;d++)if(this.atoms[d].isLone=!1,"C"===this.atoms[d].label){for(var g=f=0,b=this.bonds.length;g<b;g++)(this.bonds[g].a1===this.atoms[d]||this.bonds[g].a2===this.atoms[d])&&
f++;0===f&&(this.atoms[d].isLone=!0)}f=!1;d=0;for(e=this.atoms.length;d<e;d++)0!==this.atoms[d].z&&(f=!0);f&&(this.sortAtomsByZ(),this.sortBondsByZ());this.setupMetaData();this.atomNumCache=this.atoms.length;this.bondNumCache=this.bonds.length;this.fjNumCache=this.bonds.length-this.atoms.length}this.doChecks=!a};e.getAngles=function(a){for(var d=[],e=0,f=this.bonds.length;e<f;e++)this.bonds[e].contains(a)&&d.push(a.angle(this.bonds[e].getNeighbor(a)));d.sort();return d};e.getCoordinationNumber=function(a){for(var d=
0,e=0,f=a.length;e<f;e++)d+=a[e].bondOrder;return d};e.getBonds=function(a){for(var d=[],e=0,f=this.bonds.length;e<f;e++)this.bonds[e].contains(a)&&d.push(this.bonds[e]);return d};e.sortAtomsByZ=function(){for(var a=1,d=this.atoms.length;a<d;a++)for(var e=a;0<e&&this.atoms[e].z<this.atoms[e-1].z;){var f=this.atoms[e];this.atoms[e]=this.atoms[e-1];this.atoms[e-1]=f;e--}};e.sortBondsByZ=function(){for(var a=1,d=this.bonds.length;a<d;a++)for(var e=a;0<e&&this.bonds[e].a1.z+this.bonds[e].a2.z<this.bonds[e-
1].a1.z+this.bonds[e-1].a2.z;){var f=this.bonds[e];this.bonds[e]=this.bonds[e-1];this.bonds[e-1]=f;e--}};e.setupMetaData=function(){for(var a=this.getCenter(),d=0,e=this.atoms.length;d<e;d++){var g=this.atoms[d];g.bonds=this.getBonds(g);g.angles=this.getAngles(g);g.isHidden=2===g.bonds.length&&f.abs(f.abs(g.angles[1]-g.angles[0])-f.PI)<f.PI/30&&g.bonds[0].bondOrder===g.bonds[1].bondOrder;var b=c.math.angleBetweenLargest(g.angles);g.angleOfLeastInterference=b.angle%(2*f.PI);g.largestAngle=b.largest;
g.coordinationNumber=this.getCoordinationNumber(g.bonds);g.bondNumber=g.bonds.length;g.molCenter=a}d=0;for(e=this.bonds.length;d<e;d++)this.bonds[d].molCenter=a};e.scaleToAverageBondLength=function(a){var d=this.getAverageBondLength();if(0!==d){a/=d;for(var d=0,e=this.atoms.length;d<e;d++)this.atoms[d].x*=a,this.atoms[d].y*=a}};e.getAverageBondLength=function(){if(0===this.bonds.length)return 0;for(var a=0,d=0,e=this.bonds.length;d<e;d++)a+=this.bonds[d].getLength();return a/=this.bonds.length};e.getBounds=
function(){for(var a=new b.Bounds,d=0,e=this.atoms.length;d<e;d++)a.expand(this.atoms[d].getBounds());if(this.chains){d=0;for(e=this.chains.length;d<e;d++)for(var f=this.chains[d],g=0,c=f.length;g<c;g++){var j=f[g];a.expand(j.cp1.x,j.cp1.y);a.expand(j.cp2.x,j.cp2.y)}a.minX-=30;a.minY-=30;a.maxX+=30;a.maxY+=30}return a}})(ChemDoodle,ChemDoodle.math,ChemDoodle.structures,ChemDoodle.RESIDUE,Math);
(function(c,b,a,g){var f,e=-1;c.Residue=function(a){this.resSeq=a};var o=c.Residue.prototype;o.setup=function(a,e){this.horizontalResolution=e;var f=[a.x-this.cp1.x,a.y-this.cp1.y,a.z-this.cp1.z],b=g.cross(f,[this.cp2.x-this.cp1.x,this.cp2.y-this.cp1.y,this.cp2.z-this.cp1.z],[]);this.D=g.cross(b,f,[]);g.normalize(b);g.normalize(this.D);this.guidePointsSmall=[];this.guidePointsLarge=[];f=[(a.x+this.cp1.x)/2,(a.y+this.cp1.y)/2,(a.z+this.cp1.z)/2];this.helix&&(g.scale(b,1.5),g.add(f,b));this.guidePointsSmall[0]=
new c.Atom("",f[0]-this.D[0]/2,f[1]-this.D[1]/2,f[2]-this.D[2]/2);for(b=1;b<e;b++)this.guidePointsSmall[b]=new c.Atom("",this.guidePointsSmall[0].x+this.D[0]*b/e,this.guidePointsSmall[0].y+this.D[1]*b/e,this.guidePointsSmall[0].z+this.D[2]*b/e);g.scale(this.D,4);this.guidePointsLarge[0]=new c.Atom("",f[0]-this.D[0]/2,f[1]-this.D[1]/2,f[2]-this.D[2]/2);for(b=1;b<e;b++)this.guidePointsLarge[b]=new c.Atom("",this.guidePointsLarge[0].x+this.D[0]*b/e,this.guidePointsLarge[0].y+this.D[1]*b/e,this.guidePointsLarge[0].z+
this.D[2]*b/e)};o.getGuidePointSet=function(a){if(0===a)return this.helix||this.sheet?this.guidePointsLarge:this.guidePointsSmall;if(1===a)return this.guidePointsSmall;if(2===a)return this.guidePointsLarge};o.computeLineSegments=function(d,g,b,c,o){if(o!==e){var j=o*o,m=o*o*o;f=a.multiply([-1/6,0.5,-0.5,1/6,0.5,-1,0.5,0,-0.5,0,0.5,0,1/6,2/3,1/6,0],[6/m,0,0,0,6/m,2/j,0,0,1/m,1/j,1/o,0,0,0,0,1],[]);e=o}this.split=g.helix!==this.helix||g.sheet!==this.sheet;this.lineSegments=this.innerCompute(0,d,g,b,
!1,o);c&&(this.lineSegmentsCartoon=this.innerCompute(g.helix||g.sheet?2:1,d,g,b,!0,o))};o.innerCompute=function(d,e,o,l,h,j){var m=[],t=this.getGuidePointSet(d);e=e.getGuidePointSet(d);o=o.getGuidePointSet(d);for(var n=l.getGuidePointSet(d),u=0,q=this.guidePointsLarge.length;u<q;u++){for(var r=a.multiply([e[u].x,e[u].y,e[u].z,1,t[u].x,t[u].y,t[u].z,1,o[u].x,o[u].y,o[u].z,1,n[u].x,n[u].y,n[u].z,1],f,[]),w=[],p=0;p<j;p++){for(d=3;0<d;d--)for(l=0;4>l;l++)r[4*d+l]+=r[4*(d-1)+l];w[p]=new c.Atom("",r[12]/
r[15],r[13]/r[15],r[14]/r[15])}m[u]=w}if(h&&this.arrow)for(d=0;d<j;d++){h=1.5-1.3*d/j;t=b.floor(this.horizontalResolution/2);e=m[t];l=0;for(o=m.length;l<o;l++)l!==t&&(n=e[d],u=m[l][d],q=[u.x-n.x,u.y-n.y,u.z-n.z],g.scale(q,h),u.x=n.x+q[0],u.y=n.y+q[1],u.z=n.z+q[2])}return m}})(ChemDoodle.structures,Math,mat4,vec3);
(function(c,b,a,g,f){b.Spectrum=function(){this.data=[];this.metadata=[];this.dataDisplay=[];this.memory={offsetTop:0,offsetLeft:0,offsetBottom:0,flipXAxis:!1,scale:1,width:0,height:0}};g=b.Spectrum.prototype;g.title=void 0;g.xUnit=void 0;g.yUnit=void 0;g.continuous=!0;g.integrationSensitivity=0.01;g.draw=function(a,g,d,b){this.specs&&(g=this.specs);var v=5,l=0,h=0;a.fillStyle=g.text_color;a.textAlign="center";a.textBaseline="alphabetic";a.font=g.getFontString(g.text_font_size,g.text_font_families);
this.xUnit&&(h+=g.text_font_size,a.fillText(this.xUnit,d/2,b-2));this.yUnit&&g.plots_showYAxis&&(l+=g.text_font_size,a.save(),a.translate(g.text_font_size,b/2),a.rotate(-f.PI/2),a.fillText(this.yUnit,0,0),a.restore());this.title&&(v+=g.text_font_size,a.fillText(this.title,d/2,g.text_font_size));h+=5+g.text_font_size;g.plots_showYAxis&&(l+=5+a.measureText("1000").width);g.plots_showGrid&&(a.strokeStyle=g.plots_gridColor,a.lineWidth=g.plots_gridLineWidth,a.strokeRect(l,v,d-l,b-h-v));a.textAlign="center";
a.textBaseline="top";for(var j=this.maxX-this.minX,m=j/100,t=0.001;t<m||25<j/t;)t*=10;for(var n=0,u=g.plots_flipXAxis?d:0,j=f.round(this.minX/t)*t;j<=this.maxX;j+=t/2){var q=this.getTransformedX(j,g,d,l);if(q>l)if(a.strokeStyle="black",a.lineWidth=1,0===n%2){a.beginPath();a.moveTo(q,b-h);a.lineTo(q,b-h+2);a.stroke();for(m=j.toFixed(5);"0"===m.charAt(m.length-1);)m=m.substring(0,m.length-1);"."===m.charAt(m.length-1)&&(m=m.substring(0,m.length-1));var r=a.measureText(m).width;g.plots_flipXAxis&&(r*=
-1);var w=q-r/2;if(g.plots_flipXAxis?w<u:w>u)a.fillText(m,q,b-h+2),u=q+r/2;g.plots_showGrid&&(a.strokeStyle=g.plots_gridColor,a.lineWidth=g.plots_gridLineWidth,a.beginPath(),a.moveTo(q,b-h),a.lineTo(q,v),a.stroke())}else a.beginPath(),a.moveTo(q,b-h),a.lineTo(q,b-h+2),a.stroke();n++}if(g.plots_showYAxis||g.plots_showGrid){t=1/g.scale;a.textAlign="right";a.textBaseline="middle";for(j=0;10>=j;j++)if(m=t/10*j,n=v+(b-h-v)*(1-m*g.scale),g.plots_showGrid&&(a.strokeStyle=g.plots_gridColor,a.lineWidth=g.plots_gridLineWidth,
a.beginPath(),a.moveTo(l,n),a.lineTo(d,n),a.stroke()),g.plots_showYAxis){a.strokeStyle="black";a.lineWidth=1;a.beginPath();a.moveTo(l,n);a.lineTo(l-3,n);a.stroke();m*=100;u=f.max(0,3-f.floor(m).toString().length);m=m.toFixed(u);if(0<u)for(;"0"===m.charAt(m.length-1);)m=m.substring(0,m.length-1);"."===m.charAt(m.length-1)&&(m=m.substring(0,m.length-1));a.fillText(m,l-3,n)}}a.strokeStyle="black";a.lineWidth=1;a.beginPath();a.moveTo(d,b-h);a.lineTo(l,b-h);g.plots_showYAxis&&a.lineTo(l,v);a.stroke();
if(0<this.dataDisplay.length){a.textAlign="left";a.textBaseline="top";j=m=0;for(t=this.dataDisplay.length;j<t;j++)if(this.dataDisplay[j].value)a.fillText([this.dataDisplay[j].display,": ",this.dataDisplay[j].value].join(""),l+10,v+10+m*(g.text_font_size+5)),m++;else if(this.dataDisplay[j].tag){n=0;for(u=this.metadata.length;n<u;n++)if(c.stringStartsWith(this.metadata[n],this.dataDisplay[j].tag)){u=this.metadata[n];this.dataDisplay[j].display&&(u=this.metadata[n].indexOf("\x3d"),u=[this.dataDisplay[j].display,
": ",-1<u?this.metadata[n].substring(u+2):this.metadata[n]].join(""));a.fillText(u,l+10,v+10+m*(g.text_font_size+5));m++;break}}}this.drawPlot(a,g,d,b,v,l,h);this.memory.offsetTop=v;this.memory.offsetLeft=l;this.memory.offsetBottom=h;this.memory.flipXAxis=g.plots_flipXAxis;this.memory.scale=g.scale;this.memory.width=d;this.memory.height=b};g.drawPlot=function(a,g,d,c,v,l,h){this.specs&&(g=this.specs);a.strokeStyle=g.plots_color;a.lineWidth=g.plots_width;var j=[];a.beginPath();if(this.continuous)for(var m=
!1,t=0,n=0,u=this.data.length;n<u;n++){var q=this.getTransformedX(this.data[n].x,g,d,l);if(q>=l&&q<d){var r=this.getTransformedY(this.data[n].y,g,c,h,v);g.plots_showIntegration&&f.abs(this.data[n].y)>this.integrationSensitivity&&j.push(new b.Point(this.data[n].x,this.data[n].y));m||(a.moveTo(q,r),m=!0);a.lineTo(q,r);t++;0===t%1E3&&(a.stroke(),a.beginPath(),a.moveTo(q,r))}else if(m)break}else{n=0;for(u=this.data.length;n<u;n++)q=this.getTransformedX(this.data[n].x,g,d,l),q>=l&&q<d&&(a.moveTo(q,c-h),
a.lineTo(q,this.getTransformedY(this.data[n].y,g,c,h,v)))}a.stroke();if(g.plots_showIntegration&&1<j.length){a.strokeStyle=g.plots_integrationColor;a.lineWidth=g.plots_integrationLineWidth;a.beginPath();n=j[1].x>j[0].x;if(this.flipXAxis&&!n||!this.flipXAxis&&n){for(n=j.length-2;0<=n;n--)j[n].y+=j[n+1].y;m=j[0].y}else{n=1;for(u=j.length;n<u;n++)j[n].y+=j[n-1].y;m=j[j.length-1].y}n=0;for(u=j.length;n<u;n++)q=this.getTransformedX(j[n].x,g,d,l),r=this.getTransformedY(j[n].y/g.scale/m,g,c,h,v),0===n?a.moveTo(q,
r):a.lineTo(q,r);a.stroke()}};g.getTransformedY=function(a,f,d,g,b){return b+(d-g-b)*(1-a*f.scale)};g.getInverseTransformedY=function(a){return 100*((1-(a-this.memory.offsetTop)/(this.memory.height-this.memory.offsetBottom-this.memory.offsetTop))/this.memory.scale)};g.getTransformedX=function(a,f,d,g){a=g+(a-this.minX)/(this.maxX-this.minX)*(d-g);f.plots_flipXAxis&&(a=d+g-a);return a};g.getInverseTransformedX=function(a){this.memory.flipXAxis&&(a=this.memory.width+this.memory.offsetLeft-a);return(a-
this.memory.offsetLeft)*(this.maxX-this.minX)/(this.memory.width-this.memory.offsetLeft)+this.minX};g.setup=function(){for(var a=Number.MAX_VALUE,g=Number.MIN_VALUE,d=Number.MIN_VALUE,b=0,c=this.data.length;b<c;b++)a=f.min(a,this.data[b].x),g=f.max(g,this.data[b].x),d=f.max(d,this.data[b].y);this.continuous?(this.minX=a,this.maxX=g):(this.minX=a-1,this.maxX=g+1);b=0;for(c=this.data.length;b<c;b++)this.data[b].y/=d};g.zoom=function(e,g,d,b){e=this.getInverseTransformedX(e);g=this.getInverseTransformedX(g);
this.minX=f.min(e,g);this.maxX=f.max(e,g);if(b){b=Number.MIN_VALUE;g=0;for(e=this.data.length;g<e;g++)a.isBetween(this.data[g].x,this.minX,this.maxX)&&(b=f.max(b,this.data[g].y));return 1/b}};g.translate=function(a,f){var d=a/(f-this.memory.offsetLeft)*(this.maxX-this.minX)*(this.memory.flipXAxis?1:-1);this.minX+=d;this.maxX+=d};g.alertMetadata=function(){alert(this.metadata.join("\n"))};g.getInternalCoordinates=function(a,f){return new ChemDoodle.structures.Point(this.getInverseTransformedX(a),this.getInverseTransformedY(f))};
g.getClosestPlotInternalCoordinates=function(e){var f=this.getInverseTransformedX(e-1);e=this.getInverseTransformedX(e+1);if(f>e){var d=f,f=e;e=d}for(var d=-1,g=-Infinity,b=!1,c=0,h=this.data.length;c<h;c++){var j=this.data[c];if(a.isBetween(j.x,f,e))j.y>g&&(b=!0,g=j.y,d=c);else if(b)break}if(-1!==d)return j=this.data[d],new ChemDoodle.structures.Point(j.x,100*j.y)};g.getClosestPeakInternalCoordinates=function(a){var g=this.getInverseTransformedX(a);a=0;for(var d=Infinity,b=0,c=this.data.length;b<
c;b++){var l=f.abs(this.data[b].x-g);if(l<=d)d=l,a=b;else break}g=highestRight=a;d=maxRight=this.data[a].y;b=a+1;for(c=this.data.length;b<c;b++)if(this.data[b].y+0.05>maxRight)maxRight=this.data[b].y,highestRight=b;else break;for(b=a-1;0<=b;b--)if(this.data[b].y+0.05>d)d=this.data[b].y,g=b;else break;a=this.data[g-a>highestRight-a?highestRight:g];return new ChemDoodle.structures.Point(a.x,100*a.y)}})(ChemDoodle.extensions,ChemDoodle.structures,ChemDoodle.math,jQuery,Math);
(function(c,b,a){b._Shape=function(){};b=b._Shape.prototype;b.drawDecorations=function(a,f){if(this.isHover)for(var e=this.getPoints(),b=0,d=e.length;b<d;b++){var c=e[b];this.drawAnchor(a,f,c,c===this.hoverPoint)}};b.getBounds=function(){for(var a=new c.Bounds,f=this.getPoints(),e=0,b=f.length;e<b;e++){var d=f[e];a.expand(d.x,d.y)}return a};b.drawAnchor=function(g,f,e,b){g.save();g.translate(e.x,e.y);g.rotate(a.PI/4);g.scale(1/f.scale,1/f.scale);g.beginPath();g.moveTo(-4,-4);g.lineTo(4,-4);g.lineTo(4,
4);g.lineTo(-4,4);g.closePath();g.fillStyle=b?"#885110":"white";g.fill();g.beginPath();g.moveTo(-4,-2);g.lineTo(-4,-4);g.lineTo(-2,-4);g.moveTo(2,-4);g.lineTo(4,-4);g.lineTo(4,-2);g.moveTo(4,2);g.lineTo(4,4);g.lineTo(2,4);g.moveTo(-2,4);g.lineTo(-4,4);g.lineTo(-4,2);g.moveTo(-4,-2);g.strokeStyle="rgba(0,0,0,.2)";g.lineWidth=5;g.stroke();g.strokeStyle="blue";g.lineWidth=1;g.stroke();g.restore()}})(ChemDoodle.math,ChemDoodle.structures.d2,Math);
(function(c,b,a,g,f){g.Bracket=function(e,f){this.p1=e?e:new a.Point;this.p2=f?f:new a.Point};g=g.Bracket.prototype=new g._Shape;g.charge=0;g.mult=0;g.repeat=0;g.draw=function(a,g){var d=f.min(this.p1.x,this.p2.x),b=f.max(this.p1.x,this.p2.x),v=f.min(this.p1.y,this.p2.y),l=f.max(this.p1.y,this.p2.y),h=l-v,j=h/10;a.beginPath();a.moveTo(d+j,v);a.lineTo(d,v);a.lineTo(d,l);a.lineTo(d+j,l);a.moveTo(b-j,l);a.lineTo(b,l);a.lineTo(b,v);a.lineTo(b-j,v);this.isLassoed&&(j=a.createLinearGradient(this.p1.x,this.p1.y,
this.p2.x,this.p2.y),j.addColorStop(0,"rgba(212, 99, 0, 0)"),j.addColorStop(0.5,"rgba(212, 99, 0, 0.8)"),j.addColorStop(1,"rgba(212, 99, 0, 0)"),a.lineWidth=g.shapes_lineWidth_2D+5,a.strokeStyle=j,a.lineJoin="miter",a.lineCap="square",a.stroke());a.strokeStyle=g.shapes_color;a.lineWidth=g.shapes_lineWidth_2D;a.lineJoin="miter";a.lineCap="butt";a.stroke();0!==this.charge&&(a.fillStyle=g.text_color,a.textAlign="left",a.textBaseline="alphabetic",a.font=g.getFontString(g.text_font_size,g.text_font_families),
j=this.charge.toFixed(0),j="1"===j?"+":"-1"===j?"\u2013":c.stringStartsWith(j,"-")?j.substring(1)+"\u2013":j+"+",a.fillText(j,b+5,v+5));0!==this.mult&&(a.fillStyle=g.text_color,a.textAlign="right",a.textBaseline="middle",a.font=g.getFontString(g.text_font_size,g.text_font_families),a.fillText(this.mult.toFixed(0),d-5,v+h/2));0!==this.repeat&&(a.fillStyle=g.text_color,a.textAlign="left",a.textBaseline="top",a.font=g.getFontString(g.text_font_size,g.text_font_families),j=this.repeat.toFixed(0),a.fillText(j,
b+5,l-5))};g.getPoints=function(){return[this.p1,this.p2]};g.isOver=function(a){return b.isBetween(a.x,this.p1.x,this.p2.x)&&b.isBetween(a.y,this.p1.y,this.p2.y)}})(ChemDoodle.extensions,ChemDoodle.math,ChemDoodle.structures,ChemDoodle.structures.d2,Math);
(function(c,b,a,g){a.Line=function(a,g){this.p1=a?a:new b.Point;this.p2=g?g:new b.Point};a.Line.ARROW_SYNTHETIC="synthetic";a.Line.ARROW_RETROSYNTHETIC="retrosynthetic";a.Line.ARROW_RESONANCE="resonance";a.Line.ARROW_EQUILIBRIUM="equilibrium";var f=a.Line.prototype=new a._Shape;f.arrowType=void 0;f.topText=void 0;f.bottomText=void 0;f.draw=function(e,f){if(this.isLassoed){var d=e.createLinearGradient(this.p1.x,this.p1.y,this.p2.x,this.p2.y);d.addColorStop(0,"rgba(212, 99, 0, 0)");d.addColorStop(0.5,
"rgba(212, 99, 0, 0.8)");d.addColorStop(1,"rgba(212, 99, 0, 0)");var b=2.5,c=this.p1.angle(this.p2)+g.PI/2,l=g.cos(c),c=g.sin(c),h=this.p1.x-l*b,j=this.p1.y+c*b,m=this.p1.x+l*b,t=this.p1.y-c*b,n=this.p2.x+l*b,u=this.p2.y-c*b,q=this.p2.x-l*b,r=this.p2.y+c*b;e.fillStyle=d;e.beginPath();e.moveTo(h,j);e.lineTo(m,t);e.lineTo(n,u);e.lineTo(q,r);e.closePath();e.fill()}e.strokeStyle=f.shapes_color;e.fillStyle=f.shapes_color;e.lineWidth=f.shapes_lineWidth_2D;e.lineJoin="miter";e.lineCap="butt";if(this.p1.x!==
this.p2.x||this.p1.y!==this.p2.y){if(this.arrowType===a.Line.ARROW_RETROSYNTHETIC){var d=2*g.sqrt(2),b=f.shapes_arrowLength_2D/d,l=this.p1.angle(this.p2),c=l+g.PI/2,d=f.shapes_arrowLength_2D/d,w=g.cos(l),p=g.sin(l),l=g.cos(c),c=g.sin(c),h=this.p1.x-l*b,j=this.p1.y+c*b,m=this.p1.x+l*b,t=this.p1.y-c*b,n=this.p2.x+l*b-w*d,u=this.p2.y-c*b+p*d,q=this.p2.x-l*b-w*d,r=this.p2.y+c*b+p*d,y=this.p2.x+2*l*b-2*w*d,z=this.p2.y-2*c*b+2*p*d,x=this.p2.x-2*l*b-2*w*d,b=this.p2.y+2*c*b+2*p*d;e.beginPath();e.moveTo(m,
t);e.lineTo(n,u);e.moveTo(y,z);e.lineTo(this.p2.x,this.p2.y);e.lineTo(x,b);e.moveTo(q,r);e.lineTo(h,j)}else this.arrowType===a.Line.ARROW_EQUILIBRIUM?(d=2*g.sqrt(2),b=f.shapes_arrowLength_2D/d/2,l=this.p1.angle(this.p2),c=l+g.PI/2,d=2*f.shapes_arrowLength_2D/g.sqrt(3),w=g.cos(l),p=g.sin(l),l=g.cos(c),c=g.sin(c),h=this.p1.x-l*b,j=this.p1.y+c*b,m=this.p1.x+l*b,t=this.p1.y-c*b,n=this.p2.x+l*b,u=this.p2.y-c*b,q=this.p2.x-l*b,r=this.p2.y+c*b,e.beginPath(),e.moveTo(m,t),e.lineTo(n,u),e.moveTo(q,r),e.lineTo(h,
j),e.stroke(),m=n-0.8*w*d,t=u+0.8*p*d,y=n+l*f.shapes_arrowLength_2D/3-w*d,z=u-c*f.shapes_arrowLength_2D/3+p*d,e.beginPath(),e.moveTo(n,u),e.lineTo(y,z),e.lineTo(m,t),e.closePath(),e.fill(),e.stroke(),m=h+0.8*w*d,t=j-0.8*p*d,y=h-l*f.shapes_arrowLength_2D/3+w*d,z=j+c*f.shapes_arrowLength_2D/3-p*d,e.beginPath(),e.moveTo(h,j),e.lineTo(y,z),e.lineTo(m,t),e.closePath(),e.fill()):this.arrowType===a.Line.ARROW_SYNTHETIC?(l=this.p1.angle(this.p2),c=l+g.PI/2,d=2*f.shapes_arrowLength_2D/g.sqrt(3),w=g.cos(l),
p=g.sin(l),l=g.cos(c),c=g.sin(c),e.beginPath(),e.moveTo(this.p1.x,this.p1.y),e.lineTo(this.p2.x-w*d/2,this.p2.y+p*d/2),e.stroke(),m=this.p2.x-0.8*w*d,t=this.p2.y+0.8*p*d,y=this.p2.x+l*f.shapes_arrowLength_2D/3-w*d,z=this.p2.y-c*f.shapes_arrowLength_2D/3+p*d,x=this.p2.x-l*f.shapes_arrowLength_2D/3-w*d,b=this.p2.y+c*f.shapes_arrowLength_2D/3+p*d,e.beginPath(),e.moveTo(this.p2.x,this.p2.y),e.lineTo(x,b),e.lineTo(m,t),e.lineTo(y,z),e.closePath(),e.fill()):this.arrowType===a.Line.ARROW_RESONANCE?(l=this.p1.angle(this.p2),
c=l+g.PI/2,d=2*f.shapes_arrowLength_2D/g.sqrt(3),w=g.cos(l),p=g.sin(l),l=g.cos(c),c=g.sin(c),e.beginPath(),e.moveTo(this.p1.x+w*d/2,this.p1.y-p*d/2),e.lineTo(this.p2.x-w*d/2,this.p2.y+p*d/2),e.stroke(),m=this.p2.x-0.8*w*d,t=this.p2.y+0.8*p*d,y=this.p2.x+l*f.shapes_arrowLength_2D/3-w*d,z=this.p2.y-c*f.shapes_arrowLength_2D/3+p*d,x=this.p2.x-l*f.shapes_arrowLength_2D/3-w*d,b=this.p2.y+c*f.shapes_arrowLength_2D/3+p*d,e.beginPath(),e.moveTo(this.p2.x,this.p2.y),e.lineTo(x,b),e.lineTo(m,t),e.lineTo(y,
z),e.closePath(),e.fill(),e.stroke(),m=this.p1.x+0.8*w*d,t=this.p1.y-0.8*p*d,y=this.p1.x-l*f.shapes_arrowLength_2D/3+w*d,z=this.p1.y+c*f.shapes_arrowLength_2D/3-p*d,x=this.p1.x+l*f.shapes_arrowLength_2D/3+w*d,b=this.p1.y-c*f.shapes_arrowLength_2D/3-p*d,e.beginPath(),e.moveTo(this.p1.x,this.p1.y),e.lineTo(x,b),e.lineTo(m,t),e.lineTo(y,z),e.closePath(),e.fill()):(e.beginPath(),e.moveTo(this.p1.x,this.p1.y),e.lineTo(this.p2.x,this.p2.y));e.stroke();this.topText&&(e.textAlign="center",e.textBaseline=
"bottom",e.fillText(this.topText,(this.p1.x+this.p2.x)/2,this.p1.y-5));this.bottomText&&(e.textAlign="center",e.textBaseline="top",e.fillText(this.bottomText,(this.p1.x+this.p2.x)/2,this.p1.y+5))}};f.getPoints=function(){return[this.p1,this.p2]};f.isOver=function(a,f){var d=c.distanceFromPointToLineInclusive(a,this.p1,this.p2);return-1!==d&&d<f}})(ChemDoodle.math,ChemDoodle.structures,ChemDoodle.structures.d2,Math);
(function(c,b,a,g,f){var e=function(e,d,g){if(d.molCenter){if(d instanceof a.Atom){var b=d.molCenter.angle(e);0===d.bondNumber&&(b+=f.PI);if(d.angles)for(var c=0,h=d.angles.length;c<h;c++)if(f.abs(d.angles[c]-b)<f.PI/6){b=d.angleOfLeastInterference;break}if(d.bonds){c=0;for(h=d.bonds.length;c<h;c++){var j=d.bonds[c];if(2===j.bondOrder&&(j=j.getNeighbor(d),"O"===j.label)){b=j.angle(d);break}}}return new a.Point(e.x+g*f.cos(b),e.y-g*f.sin(b))}b=d.a1.angle(d.a2);c=b+f.PI/2;b=c+f.PI;c=new a.Point(e.x+
g*f.cos(c),e.y-g*f.sin(c));e=new a.Point(e.x+g*f.cos(b),e.y-g*f.sin(b));return c.distance(d.molCenter)>e.distance(d.molCenter)?c:e}return e};g.Pusher=function(a,d,e){this.o1=a;this.o2=d;this.numElectron=e?e:1};c=g.Pusher.prototype=new g._Shape;c.drawDecorations=function(e,d){if(this.isHover)for(var f=this.o1 instanceof a.Atom?new a.Point(this.o1.x,this.o1.y):this.o1.getCenter(),g=this.o2 instanceof a.Atom?new a.Point(this.o2.x,this.o2.y):this.o2.getCenter(),f=[f,g],g=0,b=f.length;g<b;g++){var c=f[g];
this.drawAnchor(e,d,c,c===this.hoverPoint)}};c.draw=function(g,d){if(this.o1&&this.o2){g.strokeStyle=d.shapes_color;g.fillStyle=d.shapes_color;g.lineWidth=d.shapes_lineWidth_2D;g.lineJoin="miter";g.lineCap="butt";for(var b=this.o1 instanceof a.Atom?new a.Point(this.o1.x,this.o1.y):this.o1.getCenter(),c=this.o2 instanceof a.Atom?new a.Point(this.o2.x,this.o2.y):this.o2.getCenter(),l=f.max(50,b.distance(c)),h=e(b,this.o1,l),j=e(c,this.o2,l),m=h.angle(b),t=j.angle(c),n=f.max(m,t)-f.min(m,t);n+0.001>=
f.PI;)n-=f.PI;0.001>n&&(m+=f.PI/6,t+=f.PI/6,h.x=b.x+l*f.cos(m+f.PI),h.y=b.y-l*f.sin(m+f.PI),j.x=c.x+l*f.cos(t+f.PI),j.y=c.y-l*f.sin(t+f.PI));n=m+f.PI/2;l=f.cos(m);m=f.sin(m);if(d.pusher_showElectron_2D&&this.o1 instanceof a.Atom){var u=5;if(this.o1.isLabelVisible(d)||1<this.o1.bondOrder)u=8;b.x-=l*u;b.y+=m*u;2===this.numElectron?(u=Math.cos(n)*d.atoms_lonePairSpread_2D/2,n=-Math.sin(n)*d.atoms_lonePairSpread_2D/2,g.beginPath(),g.arc(b.x+u,b.y+n,d.atoms_lonePairDiameter_2D,0,2*f.PI,!1),g.fill(),g.beginPath(),
g.arc(b.x-u,b.y-n,d.atoms_lonePairDiameter_2D,0,2*f.PI,!1)):(g.beginPath(),g.arc(b.x,b.y,d.atoms_lonePairDiameter_2D,0,2*f.PI,!1));g.fill()}b.x-=5*l;b.y+=5*m;var n=t+f.PI/2,q=2*d.shapes_arrowLength_2D/f.sqrt(3),l=f.cos(t),m=f.sin(t),r=f.cos(n),w=f.sin(n);c.x-=5*l;c.y+=5*m;t=new a.Point(c.x,c.y);c.x-=0.8*l*q;c.y+=0.8*m*q;var n=t.x-0.8*l*q,u=t.y+0.8*m*q,p=new a.Point(t.x+r*d.shapes_arrowLength_2D/3-l*q,t.y-w*d.shapes_arrowLength_2D/3+m*q),l=new a.Point(t.x-r*d.shapes_arrowLength_2D/3-l*q,t.y+w*d.shapes_arrowLength_2D/
3+m*q),q=m=!0;1===this.numElectron&&(p.distance(h)>l.distance(h)?q=!1:m=!1);g.beginPath();g.moveTo(t.x,t.y);q&&g.lineTo(l.x,l.y);g.lineTo(n,u);m&&g.lineTo(p.x,p.y);g.closePath();g.fill();g.stroke();g.beginPath();g.moveTo(b.x,b.y);g.bezierCurveTo(h.x,h.y,j.x,j.y,c.x,c.y);g.stroke();this.cache=[b,h,j,c]}};c.getPoints=function(){return[]};c.isOver=function(a,d){return b.distanceFromCurve(a,this.cache).distance<d}})(ChemDoodle.math,ChemDoodle.math.jsBezier,ChemDoodle.structures,ChemDoodle.structures.d2,
Math);
(function(c){c._Mesh=function(){};c=c._Mesh.prototype;c.storeData=function(b,a,g){this.positionData=b;this.normalData=a;this.indexData=g};c.setupBuffers=function(b){this.vertexPositionBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.vertexPositionBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(this.positionData),b.STATIC_DRAW);this.vertexPositionBuffer.itemSize=3;this.vertexPositionBuffer.numItems=this.positionData.length/3;this.vertexNormalBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,this.vertexNormalBuffer);
b.bufferData(b.ARRAY_BUFFER,new Float32Array(this.normalData),b.STATIC_DRAW);this.vertexNormalBuffer.itemSize=3;this.vertexNormalBuffer.numItems=this.normalData.length/3;this.indexData&&(this.vertexIndexBuffer=b.createBuffer(),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer),b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.indexData),b.STATIC_DRAW),this.vertexIndexBuffer.itemSize=1,this.vertexIndexBuffer.numItems=this.indexData.length);if(this.partitions)for(var a=0,g=this.partitions.length;a<
g;a++){var f=this.partitions[a],e=this.generateBuffers(b,f.positionData,f.normalData,f.indexData);f.vertexPositionBuffer=e[0];f.vertexNormalBuffer=e[1];f.vertexIndexBuffer=e[2]}};c.generateBuffers=function(b,a,g,f){var e=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,e);b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);e.itemSize=3;e.numItems=a.length/3;a=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,a);b.bufferData(b.ARRAY_BUFFER,new Float32Array(g),b.STATIC_DRAW);a.itemSize=3;a.numItems=
g.length/3;var c;f&&(c=b.createBuffer(),b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,c),b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(f),b.STATIC_DRAW),c.itemSize=1,c.numItems=f.length);return[e,a,c]};c.bindBuffers=function(b){this.vertexPositionBuffer||this.setupBuffers(b);b.bindBuffer(b.ARRAY_BUFFER,this.vertexPositionBuffer);b.vertexAttribPointer(b.shader.vertexPositionAttribute,this.vertexPositionBuffer.itemSize,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.vertexNormalBuffer);b.vertexAttribPointer(b.shader.vertexNormalAttribute,
this.vertexNormalBuffer.itemSize,b.FLOAT,!1,0,0);this.vertexIndexBuffer&&b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer)}})(ChemDoodle.structures.d3,Math);(function(c,b){c.Cylinder=function(a,g,f){for(var e=[],c=[],d=0;d<f;d++){var k=2*d*b.PI/f,v=b.cos(k),k=b.sin(k);c.push(v,0,k);e.push(a*v,0,a*k);c.push(v,0,k);e.push(a*v,g,a*k)}c.push(1,0,0);e.push(a,0,0);c.push(1,0,0);e.push(a,g,0);this.storeData(e,c)};c.Cylinder.prototype=new c._Mesh})(ChemDoodle.structures.d3,Math);
(function(c,b){b.Label=function(){this.textImage=new b.TextImage};var a=b.Label.prototype;a.initialize=function(a){a.blendFuncSeparate(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA,a.ONE,a.ONE_MINUS_SRC_ALPHA);this.initGLTexture(a);this.initGLProgram(a,"attribute vec3 a_vertex_position;\nattribute vec2 a_vertex_texcoord;\nattribute vec2 a_translation;\nattribute float a_z_depth;\nuniform mat4 u_model_view_matrix;\nuniform mat4 u_projection_matrix;\nuniform vec2 u_dimension;\nvarying vec2 v_texcoord;\nvoid main() {\ngl_Position \x3d u_model_view_matrix * vec4(a_vertex_position, 1.0);\nvec4 depth_pos \x3d vec4(gl_Position);\ndepth_pos.z +\x3d a_z_depth;\ngl_Position \x3d u_projection_matrix * gl_Position;\ndepth_pos \x3d u_projection_matrix * depth_pos;\ngl_Position /\x3d gl_Position.w;\ngl_Position.xy +\x3d a_translation / u_dimension * 2.0;\ngl_Position.z \x3d depth_pos.z / depth_pos.w;\nv_texcoord \x3d a_vertex_texcoord;\n}",
"precision mediump float;\nuniform sampler2D u_image;\nvarying vec2 v_texcoord;\nvoid main() {\ngl_FragColor \x3d texture2D(u_image, v_texcoord);\n}")};a.loadShader=function(a,f,e){switch(e){case "x-shader/x-vertex":e=a.createShader(a.VERTEX_SHADER);break;case "x-shader/x-fragment":e=a.createShader(a.FRAGMENT_SHADER);break;default:return}a.shaderSource(e,f);a.compileShader(e);if(a.getShaderParameter(e,a.COMPILE_STATUS))return e};a.initGLProgram=function(a,f,e){f=this.loadShader(a,f,"x-shader/x-vertex");
e=this.loadShader(a,e,"x-shader/x-fragment");var b=a.createProgram();a.attachShader(b,f);a.attachShader(b,e);a.linkProgram(b);a.getProgramParameter(b,a.LINK_STATUS)&&(b.vertexPositionAttribute=a.getAttribLocation(b,"a_vertex_position"),b.vertexTexCoordAttribute=a.getAttribLocation(b,"a_vertex_texcoord"),b.vertexTranslationAttribute=a.getAttribLocation(b,"a_translation"),b.vertexZDepthAttribute=a.getAttribLocation(b,"a_z_depth"),this.modelViewMatrixUniform=a.getUniformLocation(b,"u_model_view_matrix"),
this.projectionMatrixUniform=a.getUniformLocation(b,"u_projection_matrix"),this.dimensionUniform=a.getUniformLocation(b,"u_dimension"),a.programLabel=b)};a.initGLTexture=function(a){this.textureImage=a.createTexture();a.bindTexture(a.TEXTURE_2D,this.textureImage);a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,!1);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST);a.texParameteri(a.TEXTURE_2D,
a.TEXTURE_MAG_FILTER,a.NEAREST);a.bindTexture(a.TEXTURE_2D,null)};a.changeFontTexture=function(a,f){this.textImage.updateFont(f);a.bindTexture(a.TEXTURE_2D,this.textureImage);a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,this.textImage.getCanvas())};a.setUniforms=function(a){a.uniformMatrix4fv(this.modelViewMatrixUniform,!1,a.modelViewMatrix);a.uniformMatrix4fv(this.projectionMatrixUniform,!1,a.projectionMatrix);a.uniform2f(this.dimensionUniform,a.canvas.clientWidth,a.canvas.clientHeight)};
a.updateVerticesBuffer=function(a,f,e){for(var b=0,d=f.length;b<d;b++){for(var k=f[b],v=k.labelMesh,l=k.atoms,h=this.textImage,j={position:[],texCoord:[],translation:[],zDepth:[]},m=0<l.length&&void 0!=l[0].hetatm,t=0,n=l.length;t<n;t++){var u=l[t],q=u.label,r=0.05;e.atoms_useVDWDiameters_3D?r+=c[q].vdWRadius*e.atoms_vdwMultiplier_3D:e.atoms_sphereDiameter_3D&&(r+=1.5*(e.atoms_sphereDiameter_3D/2));if(m)if(u.hetatm){if(u.isWater&&!e.macro_showWaters)continue}else if(!e.macro_displayAtoms)continue;
h.pushVertexData(q,[u.x,u.y,u.z],r,j)}if((k=k.chains)&&(e.proteins_displayRibbon||e.proteins_displayBackbone)){t=0;for(n=k.length;t<n;t++){l=k[t];m=0;for(q=l.length;m<q;m++){var w=l[m];w.name&&(u=w.cp1,r=0,e.atoms_useVDWDiameters_3D?r+=c[u.label].vdWRadius*e.atoms_vdwMultiplier_3D:e.atoms_sphereDiameter_3D&&(r+=1.5*(e.atoms_sphereDiameter_3D/2)),h.pushVertexData(w.name,[u.x,u.y,u.z],r,j))}}}v.storeData(a,j.position,j.texCoord,j.translation,j.zDepth)}};a.render=function(a,f,e){var b=a.programLabel,
d=a.program;a.useProgram(b);a.enable(a.BLEND);a.depthMask(!1);this.setUniforms(a);a.enableVertexAttribArray(b.vertexPositionAttribute);a.enableVertexAttribArray(b.vertexTexCoordAttribute);a.enableVertexAttribArray(b.vertexTranslationAttribute);a.enableVertexAttribArray(b.vertexZDepthAttribute);for(var c=0,v=e.length;c<v;c++)e[c].labelMesh&&e[c].labelMesh.render(a,f);a.disableVertexAttribArray(b.vertexPositionAttribute);a.disableVertexAttribArray(b.vertexTexCoordAttribute);a.disableVertexAttribArray(b.vertexTranslationAttribute);
a.disableVertexAttribArray(b.vertexZDepthAttribute);a.disable(a.BLEND);a.depthMask(!0);a.useProgram(d);a.enableVertexAttribArray(a.shader.vertexPositionAttribute);a.enableVertexAttribArray(a.shader.vertexNormalAttribute)};a.bindMoleculeLabel=function(a,f){for(var e=0,c=f.length;e<c;e++){var d=f[e];d.labelMesh instanceof b.TextMesh||(d.labelMesh=new b.TextMesh,d.labelMesh.initialize(a))}}})(ChemDoodle.ELEMENT,ChemDoodle.structures.d3);
(function(c,b){c.Sphere=function(a,g,f){for(var e=[],c=[],d=0;d<=g;d++)for(var k=d*b.PI/g,v=b.sin(k),l=b.cos(k),k=0;k<=f;k++){var h=2*k*b.PI/f,j=b.sin(h),h=b.cos(h)*v,m=l,j=j*v;c.push(h,m,j);e.push(a*h,a*m,a*j)}a=[];f+=1;for(d=0;d<g;d++)for(k=0;k<f;k++)v=d*f+k%f,l=v+f,a.push(v),a.push(l),a.push(v+1),k<f-1&&(a.push(l),a.push(l+1),a.push(v+1));this.storeData(e,c,a)};c.Sphere.prototype=new c._Mesh})(ChemDoodle.structures.d3,Math);
(function(c,b,a,g){function f(a,e,b,f){this.entire=a;this.name=e;this.indexes=b;this.pi=f}var e=function(a,e){a.bindBuffer(a.ARRAY_BUFFER,e.vertexPositionBuffer);a.vertexAttribPointer(a.shader.vertexPositionAttribute,e.vertexPositionBuffer.itemSize,a.FLOAT,!1,0,0);a.bindBuffer(a.ARRAY_BUFFER,e.vertexNormalBuffer);a.vertexAttribPointer(a.shader.vertexNormalAttribute,e.vertexNormalBuffer.itemSize,a.FLOAT,!1,0,0);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,e.vertexIndexBuffer)},o=f.prototype;o.getColor=function(a){return a.macro_colorByChain?
this.chainColor:this.name?this.getResidueColor(c[this.name]?this.name:"*",a):this.helix?this.entire.front?a.proteins_ribbonCartoonHelixPrimaryColor:a.proteins_ribbonCartoonHelixSecondaryColor:this.sheet?a.proteins_ribbonCartoonSheetColor:this.entire.front?a.proteins_primaryColor:a.proteins_secondaryColor};o.getResidueColor=function(a,e){var b=c[a];return e.proteins_useShapelyColors?b.shapelyColor:e.proteins_useAminoColors?b.aminoColor:e.proteins_usePolarityColors&&b.polar?"#C10000":"#FFFFFF"};o.render=
function(a,b){this.entire.partitions&&this.pi!==this.entire.partitions.lastRender&&(e(a,this.entire.partitions[this.pi]),this.entire.partitions.lastRender=this.pi);this.vertexIndexBuffer||(this.vertexIndexBuffer=a.createBuffer(),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer),a.bufferData(a.ELEMENT_ARRAY_BUFFER,new Uint16Array(this.indexes),a.STATIC_DRAW),this.vertexIndexBuffer.itemSize=1,this.vertexIndexBuffer.numItems=this.indexes.length);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,this.vertexIndexBuffer);
a.material.setDiffuseColor(this.getColor(b));a.drawElements(a.TRIANGLES,this.vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0)};b.Ribbon=function(d,e,b){var c=d[0].lineSegments.length,h=d[0].lineSegments[0].length;this.partitions=[];this.partitions.lastRender=0;var j;this.front=0<e;for(var o=0,t=d.length-1;o<t;o++){if(!j||65E3<j.positionData.length)0<this.partitions.length&&o--,j={count:0,positionData:[],normalData:[],indexData:[]},this.partitions.push(j);var n=d[o];j.count++;for(var u=0;u<c;u++)for(var q=
b?n.lineSegmentsCartoon[u]:n.lineSegments[u],r=0===u,w=!1,p=0;p<h;p++){var y=q[p],z=o,x=p+1;o===d.length-2&&p===h-1?x--:p===h-1&&(z++,x=0);var x=b?d[z].lineSegmentsCartoon[u][x]:d[z].lineSegments[u][x],z=!1,A=u+1;u===c-1&&(A-=2,z=!0);var A=b?n.lineSegmentsCartoon[A][p]:n.lineSegments[A][p],x=[x.x-y.x,x.y-y.y,x.z-y.z],A=[A.x-y.x,A.y-y.y,A.z-y.z],C=g.cross(x,A,[]);0===p&&(g.normalize(x),g.scale(x,-1),j.normalData.push(x[0],x[1],x[2]),j.positionData.push(y.x,y.y,y.z));r||w?(g.normalize(A),g.scale(A,
-1),j.normalData.push(A[0],A[1],A[2]),j.positionData.push(y.x,y.y,y.z),r&&p===h-1&&(r=!1,p=-1)):(g.normalize(C),(z&&!this.front||!z&&this.front)&&g.scale(C,-1),j.normalData.push(C[0],C[1],C[2]),g.scale(C,a.abs(e)),j.positionData.push(y.x+C[0],y.y+C[1],y.z+C[2]),u===c-1&&p===h-1&&(w=!0,p=-1));if(-1===p||p===h-1)g.normalize(x),j.normalData.push(x[0],x[1],x[2]),j.positionData.push(y.x,y.y,y.z)}}c+=2;h+=2;b&&(this.cartoonSegments=[]);this.segments=[];e=0;for(n=this.partitions.length;e<n;e++){j=this.partitions[e];
var F;b&&(F=[]);o=0;for(t=j.count-1;o<t;o++){q=o;for(u=0;u<e;u++)q+=this.partitions[u].count-1;u=d[q];0<o&&(b&&u.split)&&(p=new f(this,void 0,F,e),u.helix&&(p.helix=!0),u.sheet&&(p.sheet=!0),this.cartoonSegments.push(p),F=[]);r=o*c*h;w=[];u=0;for(y=c-1;u<y;u++){z=r+u*h;for(p=0;p<h;p++){x=1;o===j.count-1?x=0:p===h-1&&(x=c*h-p);x=[z+p,z+h+p,z+h+p+x,z+p,z+p+x,z+h+p+x];if(p!==h-1)for(A=0;6>A;A++)w.push(x[A]);p===h-2&&o<j.count-1&&(A=c*h-p,x[2]+=A,x[4]+=A,x[5]+=A);for(A=0;6>A;A++)j.indexData.push(x[A]);
if(b)for(A=0;6>A;A++)F.push(x[A])}}this.segments.push(new f(this,d[q+1].name,w,e))}if(b){p=new f(this,void 0,F,e);q=j.count-1;for(u=0;u<e;u++)q+=this.partitions[u].count-1;u=d[q];u.helix&&(p.helix=!0);u.sheet&&(p.sheet=!0);this.cartoonSegments.push(p)}}this.storeData(this.partitions[0].positionData,this.partitions[0].normalData,this.partitions[0].indexData);1===this.partitions.length&&(this.partitions=void 0)};(b.Ribbon.prototype=new b._Mesh).render=function(a,b){this.bindBuffers(a);var f=b.macro_colorByChain?
this.chainColor:void 0;f||(f=this.front?b.proteins_primaryColor:b.proteins_secondaryColor);a.material.setDiffuseColor(f);a.drawElements(a.TRIANGLES,this.vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0);if(this.partitions)for(var f=1,g=this.partitions.length;f<g;f++){var c=this.partitions[f];e(a,c);a.drawElements(a.TRIANGLES,c.vertexIndexBuffer.numItems,a.UNSIGNED_SHORT,0)}}})(ChemDoodle.RESIDUE,ChemDoodle.structures.d3,Math,vec3);
(function(c,b,a){b.Light=function(a,b,e){this.diffuseRGB=c.getRGB(a,1);this.specularRGB=c.getRGB(b,1);this.direction=e};b.Light.prototype.lightScene=function(b){b.uniform3f(b.getUniformLocation(b.program,"u_light.diffuse_color"),this.diffuseRGB[0],this.diffuseRGB[1],this.diffuseRGB[2]);b.uniform3f(b.getUniformLocation(b.program,"u_light.specular_color"),this.specularRGB[0],this.specularRGB[1],this.specularRGB[2]);var f=a.create(this.direction);a.normalize(f);a.negate(f);b.uniform3f(b.getUniformLocation(b.program,
"u_light.direction"),f[0],f[1],f[2]);var e=[0,0,0],f=[e[0]+f[0],e[1]+f[1],e[2]+f[2]],e=a.length(f);0===e?f=[0,0,1]:a.scale(1/e);b.uniform3f(b.getUniformLocation(b.program,"u_light.half_vector"),f[0],f[1],f[2])}})(ChemDoodle.math,ChemDoodle.structures.d3,vec3);(function(c){c.Line=function(){this.storeData([0,0,0,0,1,0],[0,0,0,0,0,0])};c.Line.prototype=new c._Mesh})(ChemDoodle.structures.d3);
(function(c,b){b.Material=function(a){this.gl=a;this.aUL=a.getUniformLocation(a.program,"u_material.ambient_color");this.dUL=a.getUniformLocation(a.program,"u_material.diffuse_color");this.sUL=a.getUniformLocation(a.program,"u_material.specular_color");this.snUL=a.getUniformLocation(a.program,"u_material.shininess");this.alUL=a.getUniformLocation(a.program,"u_material.alpha")};var a=b.Material.prototype;a.setTempColors=function(a,b,e,o){if(!this.aCache||this.aCache!==a)this.aCache=a,a=c.getRGB(a,
1),this.gl.uniform3f(this.aUL,a[0],a[1],a[2]);if(b&&(!this.dCache||this.dCache!==b))this.dCache=b,a=c.getRGB(b,1),this.gl.uniform3f(this.dUL,a[0],a[1],a[2]);if(!this.sCache||this.sCache!==e)this.sCache=e,a=c.getRGB(e,1),this.gl.uniform3f(this.sUL,a[0],a[1],a[2]);if(!this.snCache||this.snCache!==o)this.snCache=o,this.gl.uniform1f(this.snUL,o);this.alCache=1;this.gl.uniform1f(this.alUL,1)};a.setDiffuseColor=function(a){if(!this.dCache||this.dCache!==a)this.dCache=a,a=c.getRGB(a,1),this.gl.uniform3f(this.dUL,
a[0],a[1],a[2])};a.setAlpha=function(a){if(!this.alCache||this.alCache!==a)this.alCache=a,this.gl.uniform1f(this.alUL,a)}})(ChemDoodle.math,ChemDoodle.structures.d3);
(function(c,b,a,g){b.MolecularSurface=function(b,e,o,d,k){function v(a,d,b,e){var f=a.index;if(a.contained)for(var f=-1,g=Infinity,c=0,h=d.length;c<h;c++)for(var j=d[c],k=0,o=j.length;k<o;k++){var l=j[k];if(!l.contained&&l.index!==b&&l.index!==e){var m=l.distance3D(a);m<g&&(f=l.index,g=m)}}return f}for(var l=[],h=[],j=[],m=[],t=0;t<=e;t++)for(var n=t*g.PI/e,u=g.sin(n),q=g.cos(n),n=0;n<=o;n++){var r=2*n*g.PI/o;m.push(g.cos(r)*u,q,g.sin(r)*u)}u=[];t=0;for(n=b.atoms.length;t<n;t++){for(var q=[],w=b.atoms[t],
p=a[w.label][k]+d,y=[],r=0,z=b.atoms.length;r<z;r++)if(r!==t){var x=b.atoms[r];x.index=r;w.distance3D(x)<p+a[x.label][k]+d&&y.push(x)}r=0;for(z=m.length;r<z;r+=3){for(var A=new c.Atom("C",w.x+p*m[r],w.y+p*m[r+1],w.z+p*m[r+2]),C=0,F=y.length;C<F;C++)if(x=y[C],A.distance3D(x)<a[x.label][k]+d){A.contained=!0;break}q.push(A)}u.push(q)}b=[];o++;for(t=0;t<e;t++)for(n=0;n<o;n++)k=t*o+n%o,d=k+o,b.push(k),b.push(d),b.push(k+1),n<o-1&&(b.push(d),b.push(d+1),b.push(k+1));t=C=0;for(n=u.length;t<n;t++){q=u[t];
r=0;for(z=q.length;r<z;r++)A=q[r],A.contained||(A.index=C,C++,l.push(A.x,A.y,A.z),h.push(m[3*r],m[3*r+1],m[3*r+2]));r=0;for(z=b.length;r<z;r+=3)k=q[b[r]],d=q[b[r+1]],A=q[b[r+2]],!k.contained&&(!d.contained&&!A.contained)&&j.push(k.index,d.index,A.index)}m=[];t=0;for(n=u.length;t<n;t++){q=u[t];r=0;for(z=b.length;r<z;r+=3){k=q[b[r]];d=q[b[r+1]];A=q[b[r+2]];y=[];C=0;for(F=u.length;C<F;C++)C!==t&&y.push(u[C]);if((!k.contained||!d.contained||!A.contained)&&(k.contained||d.contained||A.contained))if(e=
v(k,y,-1,-1),o=v(d,y,e,-1),y=v(A,y,e,o),-1!==e&&-1!==o&&-1!==y){d=!1;C=0;for(F=m.length;C<F;C+=3)if(k=m[C],A=m[C+1],w=m[C+2],p=o===k||o===A||o===w,x=y===k||y===A||y===w,(e===k||e===A||e===w)&&p&&x){d=!0;break}d||m.push(e,o,y)}}}j=j.concat(m);this.storeData(l,h,j)};b.MolecularSurface.prototype=new b._Mesh})(ChemDoodle.structures,ChemDoodle.structures.d3,ChemDoodle.ELEMENT,Math);
(function(c,b){c.Shader=function(){};var a=c.Shader.prototype;a.init=function(a){var b=this.getShader(a,"vertex-shader");b||(b=this.loadDefaultVertexShader(a));var e=this.getShader(a,"fragment-shader");e||(e=this.loadDefaultFragmentShader(a));a.attachShader(a.program,b);a.attachShader(a.program,e);a.linkProgram(a.program);a.getProgramParameter(a.program,a.LINK_STATUS)||alert("Could not initialize shaders: "+a.getProgramInfoLog(program));a.useProgram(a.program);this.vertexPositionAttribute=a.getAttribLocation(a.program,
"a_vertex_position");a.enableVertexAttribArray(this.vertexPositionAttribute);this.vertexNormalAttribute=a.getAttribLocation(a.program,"a_vertex_normal");a.enableVertexAttribArray(this.vertexNormalAttribute)};a.getShader=function(a,f){var e=b.getElementById(f);if(e){for(var c=[],d=e.firstChild;d;)3===d.nodeType&&c.push(d.textContent),d=d.nextSibling;if("x-shader/x-fragment"===e.type)d=a.createShader(a.FRAGMENT_SHADER);else if("x-shader/x-vertex"===e.type)d=a.createShader(a.VERTEX_SHADER);else return;
a.shaderSource(d,c.join(""));a.compileShader(d);if(a.getShaderParameter(d,a.COMPILE_STATUS))return d;alert(e.type+" "+a.getShaderInfoLog(d))}};a.loadDefaultVertexShader=function(a){var b=[];b.push("struct Light");b.push("{");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");b.push("vec3 direction;");b.push("vec3 half_vector;");b.push("};");b.push("struct Material");b.push("{");b.push("vec3 ambient_color;");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");b.push("float shininess;");
b.push("float alpha;");b.push("};");b.push("attribute vec3 a_vertex_position;");b.push("attribute vec3 a_vertex_normal;");b.push("uniform Light u_light;");b.push("uniform Material u_material;");b.push("uniform mat4 u_model_view_matrix;");b.push("uniform mat4 u_projection_matrix;");b.push("uniform mat3 u_normal_matrix;");b.push("varying vec4 v_diffuse;");b.push("varying vec4 v_ambient;");b.push("varying vec3 v_normal;");b.push("varying vec3 v_light_direction;");b.push("void main(void)");b.push("{");
b.push("if(length(a_vertex_normal)\x3d\x3d0.0){");b.push("v_normal \x3d a_vertex_normal;");b.push("}else{");b.push("v_normal \x3d normalize(u_normal_matrix * a_vertex_normal);");b.push("}");b.push("vec4 diffuse \x3d vec4(u_light.diffuse_color, 1.0);");b.push("v_light_direction \x3d u_light.direction;");b.push("v_ambient \x3d vec4(u_material.ambient_color, 1.0);");b.push("v_diffuse \x3d vec4(u_material.diffuse_color, 1.0) * diffuse;");b.push("gl_Position \x3d u_projection_matrix * u_model_view_matrix * vec4(a_vertex_position, 1.0);");
b.push("}");var e=a.createShader(a.VERTEX_SHADER);a.shaderSource(e,b.join(""));a.compileShader(e);if(a.getShaderParameter(e,a.COMPILE_STATUS))return e;alert("Vertex shader failed to compile: "+a.getShaderInfoLog(e))};a.loadDefaultFragmentShader=function(a){var b=[];b.push("precision mediump float;\n");b.push("struct Light");b.push("{");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");b.push("vec3 direction;");b.push("vec3 half_vector;");b.push("};");b.push("struct Material");b.push("{");
b.push("vec3 ambient_color;");b.push("vec3 diffuse_color;");b.push("vec3 specular_color;");b.push("float shininess;");b.push("float alpha;");b.push("};");b.push("uniform Light u_light;");b.push("uniform Material u_material;");b.push("varying vec4 v_diffuse;");b.push("varying vec4 v_ambient;");b.push("varying vec3 v_normal;");b.push("varying vec3 v_light_direction;");b.push("void main(void)");b.push("{");b.push("if(length(v_normal)\x3d\x3d0.0){");b.push("gl_FragColor \x3d vec4(v_diffuse.rgba);");b.push("}else{");
b.push("float nDotL \x3d max(dot(v_normal, v_light_direction), 0.0);");b.push("vec4 color \x3d vec4(v_diffuse.rgb*nDotL, v_diffuse.a);");b.push("float nDotHV \x3d max(dot(v_normal, u_light.half_vector), 0.0);");b.push("vec4 specular \x3d vec4(u_material.specular_color * u_light.specular_color, 1.0);");b.push("color+\x3dvec4(specular.rgb * pow(nDotHV, u_material.shininess), specular.a);");b.push("gl_FragColor \x3d color+v_ambient;");b.push("gl_FragColor.a*\x3du_material.alpha;");b.push("}");b.push("}");
var e=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(e,b.join(""));a.compileShader(e);if(a.getShaderParameter(e,a.COMPILE_STATUS))return e;alert("Fragment shader failed to compile: "+a.getShaderInfoLog(e))}})(ChemDoodle.structures.d3,document);
(function(c,b,a){b.Shape=function(b,f){for(var e=b.length,o=[],d=[],k=new c.Point,v=0,l=e;v<l;v++){var h=v+1;v===l-1&&(h=0);for(var j=b[v],h=b[h],m=a.cross([0,0,1],[h.x-j.x,h.y-j.y,0]),t=0;2>t;t++)o.push(j.x,j.y,f/2),o.push(j.x,j.y,-f/2),o.push(h.x,h.y,f/2),o.push(h.x,h.y,-f/2);for(t=0;4>t;t++)d.push(m[0],m[1],m[2]);d.push(0,0,1);d.push(0,0,-1);d.push(0,0,1);d.push(0,0,-1);k.add(j)}k.x/=e;k.y/=e;d.push(0,0,1);o.push(k.x,k.y,f/2);d.push(0,0,-1);o.push(k.x,k.y,-f/2);k=[];j=8*e;v=0;for(l=e;v<l;v++)e=
8*v,k.push(e),k.push(e+1),k.push(e+3),k.push(e),k.push(e+2),k.push(e+3),k.push(e+4),k.push(e+6),k.push(j),k.push(e+5),k.push(e+7),k.push(j+1);this.storeData(o,d,k)};b.Shape.prototype=new b._Mesh})(ChemDoodle.structures,ChemDoodle.structures.d3,vec3);
(function(c,b,a){c.Star=function(){for(var b=[0.8944,0.4472,0,0.2764,0.4472,0.8506,0.2764,0.4472,-0.8506,-0.7236,0.4472,0.5257,-0.7236,0.4472,-0.5257,-0.3416,0.4472,0,-0.1056,0.4472,0.3249,-0.1056,0.4472,-0.3249,0.2764,0.4472,0.2008,0.2764,0.4472,-0.2008,-0.8944,-0.4472,0,-0.2764,-0.4472,0.8506,-0.2764,-0.4472,-0.8506,0.7236,-0.4472,0.5257,0.7236,-0.4472,-0.5257,0.3416,-0.4472,0,0.1056,-0.4472,0.3249,0.1056,-0.4472,-0.3249,-0.2764,-0.4472,0.2008,-0.2764,-0.4472,-0.2008,-0.5527,0.1058,0,-0.1708,0.1058,
0.5527,-0.1708,0.1058,-0.5527,0.4471,0.1058,0.3249,0.4471,0.1058,-0.3249,0.5527,-0.1058,0,0.1708,-0.1058,0.5527,0.1708,-0.1058,-0.5527,-0.4471,-0.1058,0.3249,-0.4471,-0.1058,-0.3249,0,1,0,0,-1,0],f=[0,9,8,2,7,9,4,5,7,3,6,5,1,8,6,0,8,23,30,6,8,3,21,6,11,26,21,13,23,26,2,9,24,30,8,9,1,23,8,13,25,23,14,24,25,4,7,22,30,9,7,0,24,9,14,27,24,12,22,27,3,5,20,30,7,5,2,22,7,12,29,22,10,20,29,1,6,21,30,5,6,4,20,5,10,28,20,11,21,28,10,19,18,12,17,19,14,15,17,13,16,15,11,18,16,31,19,17,14,17,27,2,27,22,4,22,29,
10,29,19,31,18,19,12,19,29,4,29,20,3,20,28,11,28,18,31,16,18,10,18,28,3,28,21,1,21,26,13,26,16,31,15,16,11,16,26,1,26,23,0,23,25,14,25,15,31,17,15,13,15,25,0,25,24,2,24,27,12,27,17],e=[],c=[],d=[],k=0,v=f.length;k<v;k+=3){var l=3*f[k],h=3*f[k+1],j=3*f[k+2],l=[b[l],b[l+1],b[l+2]],h=[b[h],b[h+1],b[h+2]],j=[b[j],b[j+1],b[j+2]],m=a.cross([j[0]-h[0],j[1]-h[1],j[2]-h[2]],[l[0]-h[0],l[1]-h[1],l[2]-h[2]],[]);a.normalize(m);e.push(l[0],l[1],l[2],h[0],h[1],h[2],j[0],j[1],j[2]);c.push(m[0],m[1],m[2],m[0],m[1],
m[2],m[0],m[1],m[2]);d.push(k,k+1,k+2)}this.storeData(e,c,d)};c.Star.prototype=new c._Mesh})(ChemDoodle.structures.d3,Math,vec3);
(function(c,b){c.TextImage=function(){this.ctx=b.createElement("canvas").getContext("2d");this.data=[];this.text="";this.charHeight=0};var a=c.TextImage.prototype;a.charData=function(a){a=this.text.indexOf(a);return 0<=a?this.data[a]:null};a.updateFont=function(a){var b=this.ctx,e=this.ctx.canvas,c=[],d="",k=a.getFontString(a.atoms_font_size_2D,a.atoms_font_families_2D,a.atoms_font_bold_2D,a.atoms_font_italic_2D);b.font=k;b.save();for(var v=0,l=1.5*a.atoms_font_size_2D,h=32,j=127;h<j;h++){var m=String.fromCharCode(h),
t=b.measureText(m).width;c.push({text:m,width:t,height:l});v+=2*t}h=Math.sqrt(v*l);h=Math.ceil(h/l);v=Math.ceil(v/(h-1));e.width=v;e.height=h*l;b.font=k;b.textAlign="left";b.textBaseline="middle";b.strokeStyle="#000";b.lineWidth=1.4;b.fillStyle="#fff";h=k=e=0;for(j=c.length;h<j;h++){var m=c[h],t=2*m.width,l=m.height,n=m.text;k+t>v&&(e++,k=0);var u=e*l;a.labels_font_stroke_3D&&b.strokeText(n,k,u+l/2);b.fillText(n,k,u+l/2);m.x=k;m.y=u;d+=n;k+=t}this.text=d;this.data=c;this.charHeight=l;return this};
a.pushVertexData=function(a,b,e,c){var d=a.toString().split(""),k=this.getHeight(),v=this.getWidth();a=-this.textWidth(a)/2;for(var l=-this.charHeight/2,h=0,j=d.length;h<j;h++){var m=this.charData(d[h]),t=m.width,n=m.x/v,u=n+1.8*m.width/v,q=m.y/k,m=q+m.height/k,r=a+1.8*t,w=this.charHeight/2;c.position.push(b[0],b[1],b[2],b[0],b[1],b[2],b[0],b[1],b[2],b[0],b[1],b[2],b[0],b[1],b[2],b[0],b[1],b[2]);c.texCoord.push(n,q,u,q,u,m,n,q,n,m,u,m);c.translation.push(a,w,r,w,r,l,a,w,a,l,r,l);c.zDepth.push(e,e,
e,e,e,e);a=r+t-1.8*t}};a.getCanvas=function(){return this.ctx.canvas};a.getHeight=function(){return this.getCanvas().height};a.getWidth=function(){return this.getCanvas().width};a.textWidth=function(a){return this.ctx.measureText(a).width};a.test=function(){b.body.appendChild(this.getCanvas())}})(ChemDoodle.structures.d3,document);
(function(c){c.TextMesh=function(){};c=c.TextMesh.prototype;c.initialize=function(b){this.vertexPositionBuffer=b.createBuffer();this.vertexTexCoordBuffer=b.createBuffer();this.vertexTranslationBuffer=b.createBuffer();this.vertexZDepthBuffer=b.createBuffer()};c.setVertexData=function(b,a,c,f){b.bindBuffer(b.ARRAY_BUFFER,a);b.bufferData(b.ARRAY_BUFFER,new Float32Array(c),b.STATIC_DRAW);a.itemSize=f;a.numItems=c.length/f};c.storeData=function(b,a,c,f,e){this.setVertexData(b,this.vertexPositionBuffer,
a,3);this.setVertexData(b,this.vertexTexCoordBuffer,c,2);this.setVertexData(b,this.vertexTranslationBuffer,f,2);this.setVertexData(b,this.vertexZDepthBuffer,e,1)};c.bindBuffers=function(b){var a=b.programLabel;b.bindBuffer(b.ARRAY_BUFFER,this.vertexPositionBuffer);b.vertexAttribPointer(a.vertexPositionAttribute,this.vertexPositionBuffer.itemSize,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.vertexTexCoordBuffer);b.vertexAttribPointer(a.vertexTexCoordAttribute,this.vertexTexCoordBuffer.itemSize,
b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.vertexTranslationBuffer);b.vertexAttribPointer(a.vertexTranslationAttribute,this.vertexTranslationBuffer.itemSize,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,this.vertexZDepthBuffer);b.vertexAttribPointer(a.vertexZDepthAttribute,this.vertexZDepthBuffer.itemSize,b.FLOAT,!1,0,0)};c.render=function(b){var a=this.vertexPositionBuffer.numItems;a&&(this.bindBuffers(b),b.drawArrays(b.TRIANGLES,0,a))}})(ChemDoodle.structures.d3,Math);
(function(c,b,a,g,f,e,o){var d=function(a,b,d){var c=f.sqrt(b[1]*b[1]+b[2]*b[2]),g=[1,0,0,0,0,b[2]/c,-b[1]/c,0,0,b[1]/c,b[2]/c,0,0,0,0,1],o=[1,0,0,0,0,b[2]/c,b[1]/c,0,0,-b[1]/c,b[2]/c,0,0,0,0,1],t=[c,0,-b[0],0,0,1,0,0,b[0],0,c,0,0,0,0,1];b=[c,0,b[0],0,0,1,0,0,-b[0],0,c,0,0,0,0,1];d=[f.cos(d),-f.sin(d),0,0,f.sin(d),f.cos(d),0,0,0,0,1,0,0,0,0,1];var n=e.multiply(g,e.multiply(t,e.multiply(d,e.multiply(b,o,[]))));this.rotate=function(){return e.multiplyVec3(n,a)}};g.Tube=function(g,v,l){var h=g[0].lineSegments[0].length;
this.partitions=[];var j;this.ends=[];this.ends.push(g[0].lineSegments[0][0]);this.ends.push(g[g.length-2].lineSegments[0][0]);for(var m=[1,0,0],t=0,n=g.length-1;t<n;t++){if(!j||65E3<j.positionData.length)0<this.partitions.length&&t--,j={count:0,positionData:[],normalData:[],indexData:[]},this.partitions.push(j);var u=g[t];j.count++;for(var q=Infinity,r=new a.Atom("",g[t+1].cp1.x,g[t+1].cp1.y,g[t+1].cp1.z),w=0;w<h;w++){var p=u.lineSegments[0][w],y;y=w===h-1?t===g.length-2?u.lineSegments[0][w-1]:g[t+
1].lineSegments[0][0]:u.lineSegments[0][w+1];y=[y.x-p.x,y.y-p.y,y.z-p.z];o.normalize(y);t===g.length-2&&w===h-1&&o.scale(y,-1);var z=vec3.cross(y,m,[]);o.normalize(z);o.scale(z,v/2);z=new d(z,y,2*Math.PI/l);y=0;for(var x=l;y<x;y++){var A=z.rotate();y===f.floor(l/4)&&(m=[A[0],A[1],A[2]]);j.normalData.push(A[0],A[1],A[2]);j.positionData.push(p.x+A[0],p.y+A[1],p.z+A[2])}r&&(y=p.distance3D(r),y<q&&(q=y,g[t+1].pPoint=p))}}m=0;for(u=this.partitions.length;m<u;m++){j=this.partitions[m];t=0;for(n=j.count-
1;t<n;t++){q=t*h*l;w=0;for(r=h;w<r;w++){p=q+w*l;for(y=0;y<l;y++)z=p+y,j.indexData.push(z),j.indexData.push(z+l),j.indexData.push(z+l+1),j.indexData.push(z),j.indexData.push(z+1),j.indexData.push(z+l+1)}}}this.storeData(this.partitions[0].positionData,this.partitions[0].normalData,this.partitions[0].indexData);l=[new a.Point(2,0)];for(t=0;60>t;t++)h=t/60*f.PI,l.push(new a.Point(2*f.cos(h),-2*f.sin(h)));l.push(new a.Point(-2,0),new a.Point(-2,4),new a.Point(2,4));var C=new a.d3.Shape(l,1);this.render=
function(d,h){this.bindBuffers(d);d.material.setDiffuseColor(h.macro_colorByChain?this.chainColor:h.nucleics_tubeColor);d.drawElements(d.TRIANGLES,this.vertexIndexBuffer.numItems,d.UNSIGNED_SHORT,0);if(this.partitions)for(var j=1,l=this.partitions.length;j<l;j++){var m=this.partitions[j],n=d,u=m;n.bindBuffer(n.ARRAY_BUFFER,u.vertexPositionBuffer);n.vertexAttribPointer(n.shader.vertexPositionAttribute,u.vertexPositionBuffer.itemSize,n.FLOAT,!1,0,0);n.bindBuffer(n.ARRAY_BUFFER,u.vertexNormalBuffer);
n.vertexAttribPointer(n.shader.vertexNormalAttribute,u.vertexNormalBuffer.itemSize,n.FLOAT,!1,0,0);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,u.vertexIndexBuffer);d.drawElements(d.TRIANGLES,m.vertexIndexBuffer.numItems,d.UNSIGNED_SHORT,0)}d.sphereBuffer.bindBuffers(d);for(j=0;2>j;j++)m=this.ends[j],m=e.translate(d.modelViewMatrix,[m.x,m.y,m.z],[]),l=v/2,e.scale(m,[l,l,l]),d.setMatrixUniforms(m),d.drawElements(d.TRIANGLES,d.sphereBuffer.vertexIndexBuffer.numItems,d.UNSIGNED_SHORT,0);d.cylinderBuffer.bindBuffers(d);
j=1;for(l=g.length-1;j<l;j++){var u=g[j],q=u.pPoint,r=new a.Atom("",u.cp2.x,u.cp2.y,u.cp2.z),m=1.001*q.distance3D(r),u=[v/4,m,v/4],m=e.translate(d.modelViewMatrix,[q.x,q.y,q.z],[]),t=[0,1,0],p=0,n=[r.x-q.x,r.y-q.y,r.z-q.z];q.x===r.x&&q.z===r.z?(t=[0,0,1],q.y<q.y&&(p=f.PI)):(p=c.vec3AngleFrom(t,n),t=o.cross(t,n,[]));0!==p&&e.rotate(m,p,t);e.scale(m,u);d.setMatrixUniforms(m);d.drawArrays(d.TRIANGLE_STRIP,0,d.cylinderBuffer.vertexPositionBuffer.numItems)}C.bindBuffers(d);!h.nucleics_useShapelyColors&&
!h.macro_colorByChain&&d.material.setDiffuseColor(h.nucleics_baseColor);j=1;for(l=g.length-1;j<l;j++)u=g[j],r=u.cp2,m=e.translate(d.modelViewMatrix,[r.x,r.y,r.z],[]),t=[0,1,0],p=0,q=u.cp3,n=[q.x-r.x,q.y-r.y,q.z-r.z],r.x===q.x&&r.z===q.z?(t=[0,0,1],r.y<r.y&&(p=f.PI)):(p=c.vec3AngleFrom(t,n),t=o.cross(t,n,[])),0!==p&&e.rotate(m,p,t),r=[1,0,0],p=e.rotate(e.identity([]),p,t),e.multiplyVec3(p,r),p=u.cp4,q=u.cp5,p.y===q.y&&p.z===q.z||(p=[q.x-p.x,q.y-p.y,q.z-p.z],q=c.vec3AngleFrom(r,p),0>o.dot(n,o.cross(r,
p))&&(q*=-1),e.rotateY(m,q)),h.nucleics_useShapelyColors&&!h.macro_colorByChain&&(b[u.name]?d.material.setDiffuseColor(b[u.name].shapelyColor):d.material.setDiffuseColor(b["*"].shapelyColor)),d.setMatrixUniforms(m),d.drawElements(d.TRIANGLES,C.vertexIndexBuffer.numItems,d.UNSIGNED_SHORT,0)}};g.Tube.prototype=new g._Mesh})(ChemDoodle.extensions,ChemDoodle.RESIDUE,ChemDoodle.structures,ChemDoodle.structures.d3,Math,mat4,vec3);
(function(c){c.UnitCell=function(b){var a=[],c=[],f=function(b,d,e,f){a.push(b[0],b[1],b[2]);a.push(d[0],d[1],d[2]);a.push(e[0],e[1],e[2]);a.push(f[0],f[1],f[2]);for(b=0;4>b;b++)c.push(0,0,0)};f(b.o,b.x,b.xy,b.y);f(b.o,b.y,b.yz,b.z);f(b.o,b.z,b.xz,b.x);f(b.yz,b.y,b.xy,b.xyz);f(b.xyz,b.xz,b.z,b.yz);f(b.xy,b.x,b.xz,b.xyz);b=[];for(f=0;6>f;f++){var e=4*f;b.push(e,e+1,e+1,e+2,e+2,e+3,e+3,e)}this.storeData(a,c,b)};c.UnitCell.prototype=new c._Mesh})(ChemDoodle.structures.d3,vec3);
(function(c,b,a){c.Plate=function(a){this.lanes=Array(a);i=0;for(ii=a;i<ii;i++)this.lanes[i]=[]};var g=c.Plate.prototype;g.sort=function(){i=0;for(ii=this.lanes.length;i<ii;i++)this.lanes[i].sort(function(a,b){return a-b})};g.draw=function(f){var e=f.canvas.width,c=f.canvas.height;this.origin=9*c/10;this.front=c/10;this.laneLength=this.origin-this.front;f.strokeStyle="#000000";f.beginPath();f.moveTo(0,this.front);b.contextHashTo(f,0,this.front,e,this.front,3,3);f.closePath();f.stroke();f.beginPath();
f.moveTo(0,this.origin);f.lineTo(e,this.origin);f.closePath();f.stroke();i=0;for(ii=this.lanes.length;i<ii;i++){c=(i+1)*e/(ii+1);f.beginPath();f.moveTo(c,this.origin);f.lineTo(c,this.origin+3);f.closePath();f.stroke();s=0;for(ss=this.lanes[i].length;s<ss;s++){var d=this.origin-this.laneLength*this.lanes[i][s].rf;switch(this.lanes[i][s].type){case "compact":f.beginPath();f.arc(c,d,3,0,2*a.PI,!1);f.closePath();break;case "expanded":f.beginPath();f.arc(c,d,7,0,2*a.PI,!1);f.closePath();break;case "widened":b.contextOval(f,
c-18,d-10,36,10);break;case "cresent":f.beginPath(),f.arc(c,d,9,0,a.PI,!0),f.closePath()}switch(this.lanes[i][s].style){case "solid":f.fillStyle="#000000";f.fill();break;case "transparent":f.stroke()}}}};c.Plate.Spot=function(a,b,c){this.type=a;this.rf=b;this.style=c?c:"solid"}})(ChemDoodle.structures,ChemDoodle.extensions,Math);
(function(c,b,a){c.default_backgroundColor="#FFFFFF";c.default_scale=1;c.default_rotateAngle=0;c.default_bondLength_2D=20;c.default_angstromsPerBondLength=1.25;c.default_lightDirection_3D=[-0.1,-0.1,-1];c.default_lightDiffuseColor_3D="#FFFFFF";c.default_lightSpecularColor_3D="#FFFFFF";c.default_projectionPerspective_3D=!0;c.default_projectionPerspectiveVerticalFieldOfView_3D=45;c.default_projectionOrthoWidth_3D=40;c.default_projectionWidthHeightRatio_3D=void 0;c.default_projectionFrontCulling_3D=
0.1;c.default_projectionBackCulling_3D=1E4;c.default_atoms_display=!0;c.default_atoms_color="#000000";c.default_atoms_font_size_2D=12;c.default_atoms_font_families_2D=["Helvetica","Arial","Dialog"];c.default_atoms_font_bold_2D=!1;c.default_atoms_font_italic_2D=!1;c.default_atoms_circles_2D=!1;c.default_atoms_circleDiameter_2D=10;c.default_atoms_circleBorderWidth_2D=1;c.default_atoms_lonePairDistance_2D=8;c.default_atoms_lonePairSpread_2D=4;c.default_atoms_lonePairDiameter_2D=1;c.default_atoms_useJMOLColors=
!1;c.default_atoms_usePYMOLColors=!1;c.default_atoms_resolution_3D=60;c.default_atoms_sphereDiameter_3D=0.8;c.default_atoms_useVDWDiameters_3D=!1;c.default_atoms_vdwMultiplier_3D=1;c.default_atoms_materialAmbientColor_3D="#000000";c.default_atoms_materialSpecularColor_3D="#555555";c.default_atoms_materialShininess_3D=32;c.default_atoms_implicitHydrogens_2D=!0;c.default_atoms_displayTerminalCarbonLabels_2D=!1;c.default_atoms_showHiddenCarbons_2D=!0;c.default_atoms_displayAllCarbonLabels_2D=!1;c.default_atoms_nonBondedAsStars_3D=
!1;c.default_atoms_displayLabels_3D=!1;c.default_bonds_display=!0;c.default_bonds_color="#000000";c.default_bonds_width_2D=1;c.default_bonds_saturationWidth_2D=0.2;c.default_bonds_ends_2D="round";c.default_bonds_useJMOLColors=!1;c.default_bonds_usePYMOLColors=!1;c.default_bonds_colorGradient=!1;c.default_bonds_saturationAngle_2D=a.PI/3;c.default_bonds_symmetrical_2D=!1;c.default_bonds_clearOverlaps_2D=!1;c.default_bonds_overlapClearWidth_2D=0.5;c.default_bonds_atomLabelBuffer_2D=1;c.default_bonds_wedgeThickness_2D=
0.22;c.default_bonds_hashWidth_2D=1;c.default_bonds_hashSpacing_2D=2.5;c.default_bonds_dotSize_2D=2;c.default_bonds_showBondOrders_3D=!1;c.default_bonds_resolution_3D=60;c.default_bonds_renderAsLines_3D=!1;c.default_bonds_cylinderDiameter_3D=0.3;c.default_bonds_materialAmbientColor_3D="#222222";c.default_bonds_materialSpecularColor_3D="#555555";c.default_bonds_materialShininess_3D=32;c.default_proteins_displayRibbon=!0;c.default_proteins_displayBackbone=!1;c.default_proteins_backboneThickness=1.5;
c.default_proteins_backboneColor="#CCCCCC";c.default_proteins_ribbonCartoonize=!1;c.default_proteins_useShapelyColors=!1;c.default_proteins_useAminoColors=!1;c.default_proteins_usePolarityColors=!1;c.default_proteins_primaryColor="#FF0D0D";c.default_proteins_secondaryColor="#FFFF30";c.default_proteins_ribbonCartoonHelixPrimaryColor="#00E740";c.default_proteins_ribbonCartoonHelixSecondaryColor="#9905FF";c.default_proteins_ribbonCartoonSheetColor="#E8BB99";c.default_proteins_ribbonThickness=0.2;c.default_proteins_verticalResolution=
10;c.default_proteins_horizontalResolution=9;c.default_proteins_materialAmbientColor_3D="#222222";c.default_proteins_materialSpecularColor_3D="#555555";c.default_proteins_materialShininess_3D=32;c.default_nucleics_display=!0;c.default_nucleics_tubeColor="#CCCCCC";c.default_nucleics_baseColor="#C10000";c.default_nucleics_useShapelyColors=!0;c.default_nucleics_tubeThickness=1.5;c.default_nucleics_tubeResolution_3D=60;c.default_nucleics_verticalResolution=10;c.default_nucleics_materialAmbientColor_3D=
"#222222";c.default_nucleics_materialSpecularColor_3D="#555555";c.default_nucleics_materialShininess_3D=32;c.default_macro_displayAtoms=!1;c.default_macro_displayBonds=!1;c.default_macro_atomToLigandDistance=-1;c.default_macro_showWater=!1;c.default_macro_colorByChain=!1;c.default_surfaces_display=!0;c.default_surfaces_style="Dot";c.default_surfaces_color="#E9B862";c.default_surfaces_materialAmbientColor_3D="#000000";c.default_surfaces_materialSpecularColor_3D="#000000";c.default_surfaces_materialShininess_3D=
32;c.default_crystals_displayUnitCell=!0;c.default_crystals_unitCellColor="green";c.default_crystals_unitCellLineWidth=1;c.default_plots_color="#000000";c.default_plots_width=1;c.default_plots_showIntegration=!1;c.default_plots_integrationColor="#c10000";c.default_plots_integrationLineWidth=1;c.default_plots_showGrid=!1;c.default_plots_gridColor="gray";c.default_plots_gridLineWidth=0.5;c.default_plots_showYAxis=!0;c.default_plots_flipXAxis=!1;c.default_text_font_size=12;c.default_text_font_families=
["Helvetica","Arial","Dialog"];c.default_text_color="#000000";c.default_shapes_color="#000000";c.default_shapes_lineWidth_2D=1;c.default_shapes_arrowLength_2D=8;c.default_pusher_showElectron_2D=!0;c.default_labels_font_stroke_3D=!0;b.VisualSpecifications=function(){this.backgroundColor=c.default_backgroundColor;this.scale=c.default_scale;this.rotateAngle=c.default_rotateAngle;this.bondLength=c.default_bondLength_2D;this.angstromsPerBondLength=c.default_angstromsPerBondLength;this.lightDirection_3D=
c.default_lightDirection_3D;this.lightDiffuseColor_3D=c.default_lightDiffuseColor_3D;this.lightSpecularColor_3D=c.default_lightSpecularColor_3D;this.projectionPerspective_3D=c.default_projectionPerspective_3D;this.projectionPerspectiveVerticalFieldOfView_3D=c.default_projectionPerspectiveVerticalFieldOfView_3D;this.projectionOrthoWidth_3D=c.default_projectionOrthoWidth_3D;this.projectionWidthHeightRatio_3D=c.default_projectionWidthHeightRatio_3D;this.projectionFrontCulling_3D=c.default_projectionFrontCulling_3D;
this.projectionBackCulling_3D=c.default_projectionBackCulling_3D;this.atoms_display=c.default_atoms_display;this.atoms_color=c.default_atoms_color;this.atoms_font_size_2D=c.default_atoms_font_size_2D;this.atoms_font_families_2D=[];for(var a=0,b=c.default_atoms_font_families_2D.length;a<b;a++)this.atoms_font_families_2D[a]=c.default_atoms_font_families_2D[a];this.atoms_font_bold_2D=c.default_atoms_font_bold_2D;this.atoms_font_italic_2D=c.default_atoms_font_italic_2D;this.atoms_circles_2D=c.default_atoms_circles_2D;
this.atoms_circleDiameter_2D=c.default_atoms_circleDiameter_2D;this.atoms_circleBorderWidth_2D=c.default_atoms_circleBorderWidth_2D;this.atoms_lonePairDistance_2D=c.default_atoms_lonePairDistance_2D;this.atoms_lonePairSpread_2D=c.default_atoms_lonePairSpread_2D;this.atoms_lonePairDiameter_2D=c.default_atoms_lonePairDiameter_2D;this.atoms_useJMOLColors=c.default_atoms_useJMOLColors;this.atoms_usePYMOLColors=c.default_atoms_usePYMOLColors;this.atoms_resolution_3D=c.default_atoms_resolution_3D;this.atoms_sphereDiameter_3D=
c.default_atoms_sphereDiameter_3D;this.atoms_useVDWDiameters_3D=c.default_atoms_useVDWDiameters_3D;this.atoms_vdwMultiplier_3D=c.default_atoms_vdwMultiplier_3D;this.atoms_materialAmbientColor_3D=c.default_atoms_materialAmbientColor_3D;this.atoms_materialSpecularColor_3D=c.default_atoms_materialSpecularColor_3D;this.atoms_materialShininess_3D=c.default_atoms_materialShininess_3D;this.atoms_implicitHydrogens_2D=c.default_atoms_implicitHydrogens_2D;this.atoms_displayTerminalCarbonLabels_2D=c.default_atoms_displayTerminalCarbonLabels_2D;
this.atoms_showHiddenCarbons_2D=c.default_atoms_showHiddenCarbons_2D;this.atoms_displayAllCarbonLabels_2D=c.default_atoms_displayAllCarbonLabels_2D;this.atoms_nonBondedAsStars_3D=c.default_atoms_nonBondedAsStars_3D;this.atoms_displayLabels_3D=c.default_atoms_displayLabels_3D;this.bonds_display=c.default_bonds_display;this.bonds_color=c.default_bonds_color;this.bonds_width_2D=c.default_bonds_width_2D;this.bonds_saturationWidth_2D=c.default_bonds_saturationWidth_2D;this.bonds_ends_2D=c.default_bonds_ends_2D;
this.bonds_useJMOLColors=c.default_bonds_useJMOLColors;this.bonds_usePYMOLColors=c.default_bonds_usePYMOLColors;this.bonds_colorGradient=c.default_bonds_colorGradient;this.bonds_saturationAngle_2D=c.default_bonds_saturationAngle_2D;this.bonds_symmetrical_2D=c.default_bonds_symmetrical_2D;this.bonds_clearOverlaps_2D=c.default_bonds_clearOverlaps_2D;this.bonds_overlapClearWidth_2D=c.default_bonds_overlapClearWidth_2D;this.bonds_atomLabelBuffer_2D=c.default_bonds_atomLabelBuffer_2D;this.bonds_wedgeThickness_2D=
c.default_bonds_wedgeThickness_2D;this.bonds_hashWidth_2D=c.default_bonds_hashWidth_2D;this.bonds_hashSpacing_2D=c.default_bonds_hashSpacing_2D;this.bonds_dotSize_2D=c.default_bonds_dotSize_2D;this.bonds_showBondOrders_3D=c.default_bonds_showBondOrders_3D;this.bonds_resolution_3D=c.default_bonds_resolution_3D;this.bonds_renderAsLines_3D=c.default_bonds_renderAsLines_3D;this.bonds_cylinderDiameter_3D=c.default_bonds_cylinderDiameter_3D;this.bonds_materialAmbientColor_3D=c.default_bonds_materialAmbientColor_3D;
this.bonds_materialSpecularColor_3D=c.default_bonds_materialSpecularColor_3D;this.bonds_materialShininess_3D=c.default_bonds_materialShininess_3D;this.proteins_displayRibbon=c.default_proteins_displayRibbon;this.proteins_displayBackbone=c.default_proteins_displayBackbone;this.proteins_backboneThickness=c.default_proteins_backboneThickness;this.proteins_backboneColor=c.default_proteins_backboneColor;this.proteins_ribbonCartoonize=c.default_proteins_ribbonCartoonize;this.proteins_useShapelyColors=c.default_proteins_useShapelyColors;
this.proteins_useAminoColors=c.default_proteins_useAminoColors;this.proteins_usePolarityColors=c.default_proteins_usePolarityColors;this.proteins_primaryColor=c.default_proteins_primaryColor;this.proteins_secondaryColor=c.default_proteins_secondaryColor;this.proteins_ribbonCartoonHelixPrimaryColor=c.default_proteins_ribbonCartoonHelixPrimaryColor;this.proteins_ribbonCartoonHelixSecondaryColor=c.default_proteins_ribbonCartoonHelixSecondaryColor;this.proteins_ribbonCartoonSheetColor=c.default_proteins_ribbonCartoonSheetColor;
this.proteins_ribbonThickness=c.default_proteins_ribbonThickness;this.proteins_verticalResolution=c.default_proteins_verticalResolution;this.proteins_horizontalResolution=c.default_proteins_horizontalResolution;this.proteins_materialAmbientColor_3D=c.default_proteins_materialAmbientColor_3D;this.proteins_materialSpecularColor_3D=c.default_proteins_materialSpecularColor_3D;this.proteins_materialShininess_3D=c.default_proteins_materialShininess_3D;this.macro_displayAtoms=c.default_macro_displayAtoms;
this.macro_displayBonds=c.default_macro_displayBonds;this.macro_atomToLigandDistance=c.default_macro_atomToLigandDistance;this.nucleics_display=c.default_nucleics_display;this.nucleics_tubeColor=c.default_nucleics_tubeColor;this.nucleics_baseColor=c.default_nucleics_baseColor;this.nucleics_useShapelyColors=c.default_nucleics_useShapelyColors;this.nucleics_tubeThickness=c.default_nucleics_tubeThickness;this.nucleics_tubeResolution_3D=c.default_nucleics_tubeResolution_3D;this.nucleics_verticalResolution=
c.default_nucleics_verticalResolution;this.nucleics_materialAmbientColor_3D=c.default_nucleics_materialAmbientColor_3D;this.nucleics_materialSpecularColor_3D=c.default_nucleics_materialSpecularColor_3D;this.nucleics_materialShininess_3D=c.default_nucleics_materialShininess_3D;this.macro_showWater=c.default_macro_showWater;this.macro_colorByChain=c.default_macro_colorByChain;this.surfaces_display=c.default_surfaces_display;this.surfaces_style=c.default_surfaces_style;this.surfaces_color=c.default_surfaces_color;
this.surfaces_materialAmbientColor_3D=c.default_surfaces_materialAmbientColor_3D;this.surfaces_materialSpecularColor_3D=c.default_surfaces_materialSpecularColor_3D;this.surfaces_materialShininess_3D=c.default_surfaces_materialShininess_3D;this.crystals_displayUnitCell=c.default_crystals_displayUnitCell;this.crystals_unitCellColor=c.default_crystals_unitCellColor;this.crystals_unitCellLineWidth=c.default_crystals_unitCellLineWidth;this.plots_color=c.default_plots_color;this.plots_width=c.default_plots_width;
this.plots_showIntegration=c.default_plots_showIntegration;this.plots_integrationColor=c.default_plots_integrationColor;this.plots_integrationLineWidth=c.default_plots_integrationLineWidth;this.plots_showGrid=c.default_plots_showGrid;this.plots_gridColor=c.default_plots_gridColor;this.plots_gridLineWidth=c.default_plots_gridLineWidth;this.plots_showYAxis=c.default_plots_showYAxis;this.plots_flipXAxis=c.default_plots_flipXAxis;this.text_font_size=c.default_text_font_size;this.text_font_families=[];
a=0;for(b=c.default_text_font_families.length;a<b;a++)this.text_font_families[a]=c.default_text_font_families[a];this.text_color=c.default_text_color;this.shapes_color=c.default_shapes_color;this.shapes_lineWidth_2D=c.default_shapes_lineWidth_2D;this.shapes_arrowLength_2D=c.default_shapes_arrowLength_2D;this.pusher_showElectron_2D=c.default_pusher_showElectron_2D;this.labels_font_stroke_3D=c.default_labels_font_stroke_3D};b=b.VisualSpecifications.prototype;b.set3DRepresentation=function(a){this.bonds_display=
this.atoms_display=!0;this.bonds_color="#777777";this.bonds_showBondOrders_3D=this.bonds_useJMOLColors=this.atoms_useJMOLColors=this.atoms_useVDWDiameters_3D=!0;this.bonds_renderAsLines_3D=!1;"Ball and Stick"===a?(this.atoms_vdwMultiplier_3D=0.3,this.bonds_useJMOLColors=!1,this.bonds_cylinderDiameter_3D=0.3,this.bonds_materialAmbientColor_3D=c.default_atoms_materialAmbientColor_3D):"van der Waals Spheres"===a?(this.bonds_display=!1,this.atoms_vdwMultiplier_3D=1):"Stick"===a?(this.bonds_showBondOrders_3D=
this.atoms_useVDWDiameters_3D=!1,this.bonds_cylinderDiameter_3D=this.atoms_sphereDiameter_3D=0.8,this.bonds_materialAmbientColor_3D=this.atoms_materialAmbientColor_3D):"Wireframe"===a?(this.atoms_useVDWDiameters_3D=!1,this.bonds_cylinderDiameter_3D=0.05,this.atoms_sphereDiameter_3D=0.15,this.bonds_materialAmbientColor_3D=c.default_atoms_materialAmbientColor_3D):"Line"===a?(this.atoms_display=!1,this.bonds_renderAsLines_3D=!0,this.bonds_width_2D=1,this.bonds_cylinderDiameter_3D=0.05):alert('"'+a+'" is not recognized. Use one of the following strings:\n\n1. Ball and Stick\n2. van der Waals Spheres\n3. Stick\n4. Wireframe\n5. Line\n')};
b.getFontString=function(a,b,e,c){var d=[];e&&d.push("bold ");c&&d.push("italic ");d.push(a+"px ");a=0;for(e=b.length;a<e;a++)c=b[a],-1!==c.indexOf(" ")&&(c='"'+c+'"'),d.push((0!==a?",":"")+c);return d.join("")}})(ChemDoodle,ChemDoodle.structures,Math);
(function(c,b,a,g){a.getPointsPerAngstrom=function(){return c.default_bondLength_2D/c.default_angstromsPerBondLength};a.BondDeducer=function(){};var f=a.BondDeducer.prototype;f.margin=1.1;f.deduceCovalentBonds=function(e,c){var d=a.getPointsPerAngstrom();c&&(d=c);for(var f=0,v=e.atoms.length;f<v;f++)for(var l=f+1;l<v;l++){var h=e.atoms[f],j=e.atoms[l];h.distance3D(j)<(b[h.label].covalentRadius+b[j.label].covalentRadius)*d*this.margin&&e.bonds.push(new g.Bond(h,j,1))}}})(ChemDoodle,ChemDoodle.ELEMENT,
ChemDoodle.informatics,ChemDoodle.structures);(function(c){c.HydrogenDeducer=function(){};c.HydrogenDeducer.prototype.removeHydrogens=function(b){for(var a=[],c=[],f=0,e=b.bonds.length;f<e;f++)"H"!==b.bonds[f].a1.label&&"H"!==b.bonds[f].a2.label&&c.push(b.bonds[f]);f=0;for(e=b.atoms.length;f<e;f++)"H"!==b.atoms[f].label&&a.push(b.atoms[f]);b.atoms=a;b.bonds=c}})(ChemDoodle.informatics);
(function(c,b,a){b.MolecularSurfaceGenerator=function(){};b.MolecularSurfaceGenerator.prototype.generateSurface=function(b,c,e,o,d){return new a.MolecularSurface(b,c,e,o,d)}})(ChemDoodle,ChemDoodle.informatics,ChemDoodle.structures.d3);
(function(c,b){c.Splitter=function(){};c.Splitter.prototype.split=function(a){for(var c=[],f=0,e=a.atoms.length;f<e;f++)a.atoms[f].visited=!1;f=0;for(e=a.bonds.length;f<e;f++)a.bonds[f].visited=!1;f=0;for(e=a.atoms.length;f<e;f++){var o=a.atoms[f];if(!o.visited){var d=new b.Molecule;d.atoms.push(o);o.visited=!0;var k=new b.Queue;for(k.enqueue(o);!k.isEmpty();)for(var o=k.dequeue(),v=0,l=a.bonds.length;v<l;v++){var h=a.bonds[v];h.contains(o)&&!h.visited&&(h.visited=!0,d.bonds.push(h),h=h.getNeighbor(o),
h.visited||(h.visited=!0,d.atoms.push(h),k.enqueue(h)))}c.push(d)}}return c}})(ChemDoodle.informatics,ChemDoodle.structures);
(function(c,b){c.StructureBuilder=function(){};c.StructureBuilder.prototype.copy=function(a){for(var c=0,f=a.atoms.length;c<f;c++)a.atoms[c].metaID=c;for(var e=new b.Molecule,c=0,f=a.atoms.length;c<f;c++)e.atoms[c]=new b.Atom(a.atoms[c].label,a.atoms[c].x,a.atoms[c].y,a.atoms[c].z);c=0;for(f=a.bonds.length;c<f;c++)e.bonds[c]=new b.Bond(e.atoms[a.bonds[c].a1.metaID],e.atoms[a.bonds[c].a2.metaID],a.bonds[c].bondOrder);return e}})(ChemDoodle.informatics,ChemDoodle.structures);
(function(c){c._Counter=function(){};c=c._Counter.prototype;c.value=0;c.molecule=void 0;c.setMolecule=function(b){this.value=0;this.molecule=b;this.innerCalculate&&this.innerCalculate()}})(ChemDoodle.informatics);(function(c){c.FrerejacqueNumberCounter=function(b){this.setMolecule(b)};(c.FrerejacqueNumberCounter.prototype=new c._Counter).innerCalculate=function(){this.value=this.molecule.bonds.length-this.molecule.atoms.length+(new c.NumberOfMoleculesCounter(this.molecule)).value}})(ChemDoodle.informatics);
(function(c,b){b.NumberOfMoleculesCounter=function(a){this.setMolecule(a)};(b.NumberOfMoleculesCounter.prototype=new b._Counter).innerCalculate=function(){for(var a=0,b=this.molecule.atoms.length;a<b;a++)this.molecule.atoms[a].visited=!1;a=0;for(b=this.molecule.atoms.length;a<b;a++)if(!this.molecule.atoms[a].visited){this.value++;var f=new c.Queue;this.molecule.atoms[a].visited=!0;for(f.enqueue(this.molecule.atoms[a]);!f.isEmpty();)for(var e=f.dequeue(),o=0,d=this.molecule.bonds.length;o<d;o++){var k=
this.molecule.bonds[o];k.contains(e)&&(k=k.getNeighbor(e),k.visited||(k.visited=!0,f.enqueue(k)))}}}})(ChemDoodle.structures,ChemDoodle.informatics);
(function(c){c._RingFinder=function(){};c=c._RingFinder.prototype;c.atoms=void 0;c.bonds=void 0;c.rings=void 0;c.reduce=function(b){for(var a=0,c=b.atoms.length;a<c;a++)b.atoms[a].visited=!1;a=0;for(c=b.bonds.length;a<c;a++)b.bonds[a].visited=!1;for(var f=!0;f;){f=!1;a=0;for(c=b.atoms.length;a<c;a++){for(var e=0,o,d=0,k=b.bonds.length;d<k;d++)if(b.bonds[d].contains(b.atoms[a])&&!b.bonds[d].visited){e++;if(2===e)break;o=b.bonds[d]}1===e&&(f=!0,o.visited=!0,b.atoms[a].visited=!0)}}a=0;for(c=b.atoms.length;a<
c;a++)b.atoms[a].visited||this.atoms.push(b.atoms[a]);a=0;for(c=b.bonds.length;a<c;a++)b.bonds[a].visited||this.bonds.push(b.bonds[a]);0===this.bonds.length&&0!==this.atoms.length&&(this.atoms=[])};c.setMolecule=function(b){this.atoms=[];this.bonds=[];this.rings=[];this.reduce(b);2<this.atoms.length&&this.innerGetRings&&this.innerGetRings()};c.fuse=function(){for(var b=0,a=this.rings.length;b<a;b++)for(var c=0,f=this.bonds.length;c<f;c++)-1!==this.rings[b].atoms.indexOf(this.bonds[c].a1)&&-1!==this.rings[b].atoms.indexOf(this.bonds[c].a2)&&
this.rings[b].bonds.push(this.bonds[c])}})(ChemDoodle.informatics);
(function(c,b){function a(a,b){this.atoms=[];if(b)for(var c=0,d=b.atoms.length;c<d;c++)this.atoms[c]=b.atoms[c];this.atoms.push(a)}var g=a.prototype;g.grow=function(b,e){for(var c=this.atoms[this.atoms.length-1],d=[],g=0,v=b.length;g<v;g++)if(b[g].contains(c)){var l=b[g].getNeighbor(c);-1===e.indexOf(l)&&d.push(l)}c=[];g=0;for(v=d.length;g<v;g++)c.push(new a(d[g],this));return c};g.check=function(a,e,c){for(var d=0,g=e.atoms.length-1;d<g;d++)if(-1!==this.atoms.indexOf(e.atoms[d]))return;var v;if(e.atoms[e.atoms.length-
1]===this.atoms[this.atoms.length-1]){v=new b.Ring;v.atoms[0]=c;d=0;for(g=this.atoms.length;d<g;d++)v.atoms.push(this.atoms[d]);for(d=e.atoms.length-2;0<=d;d--)v.atoms.push(e.atoms[d])}else{for(var l=[],d=0,g=a.length;d<g;d++)a[d].contains(e.atoms[e.atoms.length-1])&&l.push(a[d]);d=0;for(g=l.length;d<g;d++)if((1===e.atoms.length||!l[d].contains(e.atoms[e.atoms.length-2]))&&l[d].contains(this.atoms[this.atoms.length-1])){v=new b.Ring;v.atoms[0]=c;a=0;for(c=this.atoms.length;a<c;a++)v.atoms.push(this.atoms[a]);
for(a=e.atoms.length-1;0<=a;a--)v.atoms.push(e.atoms[a]);break}}return v};c.EulerFacetRingFinder=function(a){this.setMolecule(a)};g=c.EulerFacetRingFinder.prototype=new c._RingFinder;g.fingerBreak=5;g.innerGetRings=function(){for(var b=0,e=this.atoms.length;b<e;b++){for(var c=[],d=0,g=this.bonds.length;d<g;d++)this.bonds[d].contains(this.atoms[b])&&c.push(this.bonds[d].getNeighbor(this.atoms[b]));d=0;for(g=c.length;d<g;d++)for(var v=d+1;v<c.length;v++){var l=[];l[0]=new a(c[d]);l[1]=new a(c[v]);var h=
[];h[0]=this.atoms[b];for(var j=0,m=c.length;j<m;j++)j!==d&&j!==v&&h.push(c[j]);var t=[];for((j=l[0].check(this.bonds,l[1],this.atoms[b]))&&(t[0]=j);0===t.length&&0<l.length&&l[0].atoms.length<this.fingerBreak;){for(var n=[],j=0,m=l.length;j<m;j++)for(var u=l[j].grow(this.bonds,h),q=0,r=u.length;q<r;q++)n.push(u[q]);l=n;j=0;for(m=l.length;j<m;j++)for(q=j+1;q<m;q++)(r=l[j].check(this.bonds,l[q],this.atoms[b]))&&t.push(r);if(0===t.length){n=[];j=0;for(m=h.length;j<m;j++){q=0;for(r=this.bonds.length;q<
r;q++)this.bonds[q].contains(h[j])&&(c=this.bonds[q].getNeighbor(h[j]),-1===h.indexOf(c)&&-1===n.indexOf(c)&&n.push(c))}j=0;for(m=n.length;j<m;j++)h.push(n[j])}}if(0<t.length){l=void 0;j=0;for(m=t.length;j<m;j++)if(!l||l.atoms.length>t[j].atoms.length)l=t[j];t=!1;j=0;for(m=this.rings.length;j<m;j++){h=!0;q=0;for(r=l.atoms.length;q<r;q++)if(-1===this.rings[j].atoms.indexOf(l.atoms[q])){h=!1;break}if(h){t=!0;break}}t||this.rings.push(l)}}}this.fuse()}})(ChemDoodle.informatics,ChemDoodle.structures);
(function(c){c.SSSRFinder=function(b){this.rings=[];if(0<b.atoms.length){var a=(new c.FrerejacqueNumberCounter(b)).value,g=(new c.EulerFacetRingFinder(b)).rings;g.sort(function(a,b){return a.atoms.length-b.atoms.length});for(var f=0,e=b.bonds.length;f<e;f++)b.bonds[f].visited=!1;f=0;for(e=g.length;f<e;f++){b=!1;for(var o=0,d=g[f].bonds.length;o<d;o++)if(!g[f].bonds[o].visited){b=!0;break}if(b){o=0;for(d=g[f].bonds.length;o<d;o++)g[f].bonds[o].visited=!0;this.rings.push(g[f])}if(this.rings.length===
a)break}}}})(ChemDoodle.informatics);(function(c){c._Interpreter=function(){};c._Interpreter.prototype.fit=function(b,a,c){for(var f=b.length,e=[],o=0;o<a-f;o++)e.push(" ");return c?b+e.join(""):e.join("")+b}})(ChemDoodle.io);
(function(c,b,a,g,f,e){var o=/\s+/g,d=/\(|\)|\s+/g,k=/\'|\s+/g,v=/,|\'|\s+/g,l=/^\s+/,h=/[0-9]/g,j=/[0-9]|\+|\-/g,m=function(a){return 0!==a.length},t={P:[],A:[[0,0.5,0.5]],B:[[0.5,0,0.5]],C:[[0.5,0.5,0]],I:[[0.5,0.5,0.5]],R:[[2/3,1/3,1/3],[1/3,2/3,2/3]],S:[[1/3,1/3,2/3],[2/3,2/3,1/3]],T:[[1/3,2/3,1/3],[2/3,1/3,2/3]],F:[[0,0.5,0.5],[0.5,0,0.5],[0.5,0.5,0]]},n=function(a){var b=0,d=0,e=0,c=0,f=a.indexOf("x"),g=a.indexOf("y"),j=a.indexOf("z");-1!==f&&(d++,0<f&&"+"!==a.charAt(f-1)&&(d*=-1));-1!==g&&
(e++,0<g&&"+"!==a.charAt(g-1)&&(e*=-1));-1!==j&&(c++,0<j&&"+"!==a.charAt(j-1)&&(c*=-1));if(2<a.length){f="+";g=0;for(j=a.length;g<j;g++){var k=a.charAt(g);if(("-"===k||"/"===k)&&(g===a.length-1||a.charAt(g+1).match(h)))f=k;k.match(h)&&("+"===f?b+=parseInt(k):"-"===f?b-=parseInt(k):"/"===f&&(b/=parseInt(k)))}}return[b,d,e,c]};a.CIFInterpreter=function(){};(a.CIFInterpreter.prototype=new a._Interpreter).read=function(a,h,u,p){h=h?h:1;u=u?u:1;p=p?p:1;var y=new g.Molecule;if(!a)return y;for(var z=a.split("\n"),
x=0,A=0,C=0,F=a=0,D=0,E="P",I,G,L,B,H=!0;0<z.length;)if(H?B=z.shift():H=!0,0<B.length)if(b.stringStartsWith(B,"_cell_length_a"))x=parseFloat(B.split(d)[1]);else if(b.stringStartsWith(B,"_cell_length_b"))A=parseFloat(B.split(d)[1]);else if(b.stringStartsWith(B,"_cell_length_c"))C=parseFloat(B.split(d)[1]);else if(b.stringStartsWith(B,"_cell_angle_alpha"))a=f.PI*parseFloat(B.split(d)[1])/180;else if(b.stringStartsWith(B,"_cell_angle_beta"))F=f.PI*parseFloat(B.split(d)[1])/180;else if(b.stringStartsWith(B,
"_cell_angle_gamma"))D=f.PI*parseFloat(B.split(d)[1])/180;else if(b.stringStartsWith(B,"_symmetry_space_group_name_H-M"))E=B.split(k)[1];else if(b.stringStartsWith(B,"loop_")){for(var J={fields:[],lines:[]},M=!1;void 0!==(B=z.shift())&&!b.stringStartsWith(B=B.replace(l,""),"loop_")&&0<B.length;)if(b.stringStartsWith(B,"_")){if(M)break;J.fields=J.fields.concat(B.split(o).filter(m))}else M=!0,J.lines.push(B);if(0!==z.length&&(b.stringStartsWith(B,"loop_")||b.stringStartsWith(B,"_")))H=!1;-1!==J.fields.indexOf("_symmetry_equiv_pos_as_xyz")||
-1!==J.fields.indexOf("_space_group_symop_operation_xyz")?I=J:-1!==J.fields.indexOf("_atom_site_label")?G=J:-1!==J.fields.indexOf("_geom_bond_atom_site_label_1")&&(L=J)}B=x;a=(f.cos(a)-f.cos(D)*f.cos(F))/f.sin(D);a=[B,0,0,0,A*f.cos(D),A*f.sin(D),0,0,C*f.cos(F),C*a,C*f.sqrt(1-f.pow(f.cos(F),2)-a*a),0,0,0,0,1];if(G){J=H=x=z=C=-1;D=0;for(F=G.fields.length;D<F;D++)B=G.fields[D],"_atom_site_type_symbol"===B?C=D:"_atom_site_label"===B?z=D:"_atom_site_fract_x"===B?x=D:"_atom_site_fract_y"===B?H=D:"_atom_site_fract_z"===
B&&(J=D);D=0;for(F=G.lines.length;D<F;D++)B=G.lines[D],A=B.split(o).filter(m),B=new g.Atom(A[-1===C?z:C].split(j)[0],parseFloat(A[x]),parseFloat(A[H]),parseFloat(A[J])),y.atoms.push(B),-1!==z&&(B.cifId=A[z],B.cifPart=0)}if(I&&!L){D=A=0;for(F=I.fields.length;D<F;D++)if(B=I.fields[D],"_symmetry_equiv_pos_as_xyz"===B||"_space_group_symop_operation_xyz"===B)A=D;H=t[E];z=[];D=0;for(F=I.lines.length;D<F;D++){B=I.lines[D].split(v).filter(m);for(var J=n(B[A]),M=n(B[A+1]),N=n(B[A+2]),E=0,x=y.atoms.length;E<
x;E++){B=y.atoms[E];var Q=B.x*J[1]+B.y*J[2]+B.z*J[3]+J[0],K=B.x*M[1]+B.y*M[2]+B.z*M[3]+M[0],P=B.x*N[1]+B.y*N[2]+B.z*N[3]+N[0];G=new g.Atom(B.label,Q,K,P);z.push(G);void 0!==B.cifId&&(G.cifId=B.cifId,G.cifPart=D+1);if(H){G=0;for(C=H.length;G<C;G++){var O=H[G],O=new g.Atom(B.label,Q+O[0],K+O[1],P+O[2]);z.push(O);void 0!==B.cifId&&(O.cifId=B.cifId,O.cifPart=D+1)}}}}D=0;for(F=z.length;D<F;D++){for(B=z[D];1<=B.x;)B.x--;for(;0>B.x;)B.x++;for(;1<=B.y;)B.y--;for(;0>B.y;)B.y++;for(;1<=B.z;)B.z--;for(;0>B.z;)B.z++}G=
[];D=0;for(F=z.length;D<F;D++){C=!1;B=z[D];E=0;for(x=y.atoms.length;E<x;E++)if(1E-4>y.atoms[E].distance3D(B)){C=!0;break}if(!C){E=0;for(x=G.length;E<x;E++)if(1E-4>G[E].distance3D(B)){C=!0;break}C||G.push(B)}}y.atoms=y.atoms.concat(G)}F=[];for(D=0;D<h;D++)for(E=0;E<u;E++)for(G=0;G<p;G++)if(!(0===D&&0===E&&0===G)){C=0;for(A=y.atoms.length;C<A;C++)B=y.atoms[C],z=new g.Atom(B.label,B.x+D,B.y+E,B.z+G),F.push(z),void 0!==B.cifId&&(z.cifId=B.cifId,z.cifPart=B.cifPart+(I?I.lines.length:0)+D+10*E+100*G)}y.atoms=
y.atoms.concat(F);D=0;for(F=y.atoms.length;D<F;D++)B=y.atoms[D],I=e.multiplyVec3(a,[B.x,B.y,B.z]),B.x=I[0],B.y=I[1],B.z=I[2];if(L){z=I=-1;D=0;for(F=L.fields.length;D<F;D++)B=L.fields[D],"_geom_bond_atom_site_label_1"===B?I=D:"_geom_bond_atom_site_label_2"===B&&(z=D);G=0;for(C=L.lines.length;G<C;G++){A=L.lines[G].split(o).filter(m);B=A[I];A=A[z];D=0;for(F=y.atoms.length;D<F;D++)for(E=D+1;E<F;E++){x=y.atoms[D];H=y.atoms[E];if(x.cifPart!==H.cifPart)break;(x.cifId===B&&H.cifId===A||x.cifId===A&&H.cifId===
B)&&y.bonds.push(new g.Bond(x,H))}}}else(new c.informatics.BondDeducer).deduceCovalentBonds(y,1);h=[-h/2,-u/2,-p/2];y.unitCellVectors={o:e.multiplyVec3(a,h,[]),x:e.multiplyVec3(a,[h[0]+1,h[1],h[2]]),y:e.multiplyVec3(a,[h[0],h[1]+1,h[2]]),z:e.multiplyVec3(a,[h[0],h[1],h[2]+1]),xy:e.multiplyVec3(a,[h[0]+1,h[1]+1,h[2]]),xz:e.multiplyVec3(a,[h[0]+1,h[1],h[2]+1]),yz:e.multiplyVec3(a,[h[0],h[1]+1,h[2]+1]),xyz:e.multiplyVec3(a,[h[0]+1,h[1]+1,h[2]+1])};return y};var u=new a.CIFInterpreter;c.readCIF=function(a,
b,d,e){return u.read(a,b,d,e)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,Math,mat4,vec3);
(function(c,b,a,g){a.MOLInterpreter=function(){};var f=a.MOLInterpreter.prototype=new a._Interpreter;f.read=function(a,d){d||(d=c.default_bondLength_2D);var e=new g.Molecule;if(!a)return e;for(var f=a.split("\n"),l=f[3],h=parseInt(l.substring(0,3)),l=parseInt(l.substring(3,6)),j=0;j<h;j++){var m=f[4+j];e.atoms[j]=new g.Atom(m.substring(31,34),parseFloat(m.substring(0,10))*d,(1===d?1:-1)*parseFloat(m.substring(10,20))*d,parseFloat(m.substring(20,30))*d);var t=parseInt(m.substring(34,36));0!==t&&b[e.atoms[j].label]&&
(e.atoms[j].mass=b[e.atoms[j].label].mass+t);switch(parseInt(m.substring(36,39))){case 1:e.atoms[j].charge=3;break;case 2:e.atoms[j].charge=2;break;case 3:e.atoms[j].charge=1;break;case 5:e.atoms[j].charge=-1;break;case 6:e.atoms[j].charge=-2;break;case 7:e.atoms[j].charge=-3}}for(j=0;j<l;j++){var m=f[4+h+j],n=parseInt(m.substring(6,9)),t=parseInt(m.substring(9,12));if(3<n)switch(n){case 4:n=1.5;break;default:n=1}m=new g.Bond(e.atoms[parseInt(m.substring(0,3))-1],e.atoms[parseInt(m.substring(3,6))-
1],n);switch(t){case 3:m.stereo=g.Bond.STEREO_AMBIGUOUS;break;case 1:m.stereo=g.Bond.STEREO_PROTRUDING;break;case 6:m.stereo=g.Bond.STEREO_RECESSED}e.bonds[j]=m}return e};f.write=function(a){var d=[];d.push("Molecule from ChemDoodle Web Components\n\nhttp://www.ichemlabs.com\n");d.push(this.fit(a.atoms.length.toString(),3));d.push(this.fit(a.bonds.length.toString(),3));d.push("  0  0  0  0            999 v2000\n");for(var e=a.getCenter(),f=0,l=a.atoms.length;f<l;f++){var h=a.atoms[f],j=" 0";if(-1!==
h.mass&&b[h.label]){var m=h.mass-b[h.label].mass;5>m&&-4<m&&(j=(-1<m?" ":"")+m)}m="  0";if(0!==h.charge)switch(h.charge){case 3:m="  1";break;case 2:m="  2";break;case 1:m="  3";break;case -1:m="  5";break;case -2:m="  6";break;case -3:m="  7"}d.push(this.fit(((h.x-e.x)/c.default_bondLength_2D).toFixed(4),10));d.push(this.fit((-(h.y-e.y)/c.default_bondLength_2D).toFixed(4),10));d.push(this.fit((h.z/c.default_bondLength_2D).toFixed(4),10));d.push(" ");d.push(this.fit(h.label,3,!0));d.push(j);d.push(m);
d.push("  0  0  0  0\n")}f=0;for(l=a.bonds.length;f<l;f++)e=a.bonds[f],h=0,e.stereo===g.Bond.STEREO_AMBIGUOUS?h=3:e.stereo===g.Bond.STEREO_PROTRUDING?h=1:e.stereo===g.Bond.STEREO_RECESSED&&(h=6),d.push(this.fit((a.atoms.indexOf(e.a1)+1).toString(),3)),d.push(this.fit((a.atoms.indexOf(e.a2)+1).toString(),3)),d.push(this.fit(e.bondOrder.toString(),3)),d.push("  "),d.push(h),d.push("     0  0\n");d.push("M  END");return d.join("")};var e=new a.MOLInterpreter;c.readMOL=function(a,b){return e.read(a,b)};
c.writeMOL=function(a){return e.write(a)}})(ChemDoodle,ChemDoodle.ELEMENT,ChemDoodle.io,ChemDoodle.structures);
(function(c,b,a,g,f,e,o){function d(a,b,d,e,c){for(var f=0,g=b.length;f<g;f++){var k=b[f];if(k.id===d&&e>=k.start&&e<=k.end){c?a.helix=!0:a.sheet=!0;e+1===k.end&&(a.arrow=!0);break}}}a.PDBInterpreter=function(){};var k=a.PDBInterpreter.prototype=new a._Interpreter;k.calculateRibbonDistances=!1;k.deduceResidueBonds=!1;k.read=function(a,h){var j=new g.Molecule;j.chains=[];if(!a)return j;var k=a.split("\n");h||(h=1);for(var t=[],n=[],u,q=[],r=[],v=[],p=0,y=k.length;p<y;p++){var z=k[p];if(b.stringStartsWith(z,
"HELIX"))t.push({id:z.substring(19,20),start:parseInt(z.substring(21,25)),end:parseInt(z.substring(33,37))});else if(b.stringStartsWith(z,"SHEET"))n.push({id:z.substring(21,22),start:parseInt(z.substring(22,26)),end:parseInt(z.substring(33,37))});else if(b.stringStartsWith(z,"ATOM")){var x=z.substring(16,17);if(" "===x||"A"===x){x=e(z.substring(76,78));if(0===x.length){var A=e(z.substring(12,14));"HD"===A?x="H":0<A.length&&(x=1<A.length?A.charAt(0)+A.substring(1).toLowerCase():A)}A=new g.Atom(x,parseFloat(z.substring(30,
38))*h,parseFloat(z.substring(38,46))*h,parseFloat(z.substring(46,54))*h);A.hetatm=!1;r.push(A);var C=parseInt(z.substring(22,26));if(0===q.length)for(x=0;2>x;x++){var F=new g.Residue(-1);F.cp1=A;F.cp2=A;q.push(F)}C!==Number.NaN&&q[q.length-1].resSeq!==C&&(x=new g.Residue(C),x.name=e(z.substring(17,20)),3===x.name.length?x.name=x.name.substring(0,1)+x.name.substring(1).toLowerCase():2===x.name.length&&"D"===x.name.charAt(0)&&(x.name=x.name.substring(1)),q.push(x),F=z.substring(21,22),d(x,t,F,C,!0),
d(x,n,F,C,!1));z=e(z.substring(12,16));x=q[q.length-1];if("CA"===z||"P"===z||"O5'"===z)x.cp1||(x.cp1=A);else if("N3"===z&&("C"===x.name||"U"===x.name||"T"===x.name)||"N1"===z&&("A"===x.name||"G"===x.name))x.cp3=A;else if("C2"===z)x.cp4=A;else if("C4"===z&&("C"===x.name||"U"===x.name||"T"===x.name)||"C6"===z&&("A"===x.name||"G"===x.name))x.cp5=A;else if("O"===z||"C6"===z&&("C"===x.name||"U"===x.name||"T"===x.name)||"N9"===z){if(!q[q.length-1].cp2){if("C6"===z||"N9"===z)u=A;x.cp2=A}}else"C"===z&&(u=
A)}}else if(b.stringStartsWith(z,"HETATM"))x=e(z.substring(76,78)),0===x.length&&(x=e(z.substring(12,16))),1<x.length&&(x=x.substring(0,1)+x.substring(1).toLowerCase()),x=new g.Atom(x,parseFloat(z.substring(30,38))*h,parseFloat(z.substring(38,46))*h,parseFloat(z.substring(46,54))*h),x.hetatm=!0,"HOH"===e(z.substring(17,20))&&(x.isWater=!0),j.atoms.push(x),v[parseInt(e(z.substring(6,11)))]=x;else if(b.stringStartsWith(z,"CONECT")){if(x=parseInt(e(z.substring(6,11))),v[x]){A=v[x];for(C=0;4>C;C++)if(x=
e(z.substring(11+5*C,16+5*C)),0!==x.length&&(x=parseInt(x),v[x])){for(var F=v[x],D=!1,x=0,E=j.bonds.length;x<E;x++){var I=j.bonds[x];if(I.a1===A&&I.a2===F||I.a1===F&&I.a2===A){D=!0;break}}D||j.bonds.push(new g.Bond(A,F))}}}else if(b.stringStartsWith(z,"TER"))this.endChain(j,q,u,r),q=[];else if(b.stringStartsWith(z,"ENDMDL"))break}this.endChain(j,q,u,r);0===j.bonds.size&&(new c.informatics.BondDeducer).deduceCovalentBonds(j,h);if(this.deduceResidueBonds){p=0;for(y=r.length;p<y;p++){k=o.min(y,p+20);
for(x=p+1;x<k;x++)t=r[p],n=r[x],t.distance3D(n)<1.1*(f[t.label].covalentRadius+f[n.label].covalentRadius)&&j.bonds.push(new g.Bond(t,n,1))}}j.atoms=j.atoms.concat(r);this.calculateRibbonDistances&&this.calculateDistances(j,r);return j};k.endChain=function(a,b,d,e){if(0<b.length){var c=b[b.length-1];c.cp1||(c.cp1=e[e.length-2]);c.cp2||(c.cp2=e[e.length-1]);for(e=0;4>e;e++)c=new g.Residue(-1),c.cp1=d,c.cp2=b[b.length-1].cp2,b.push(c);a.chains.push(b)}};k.calculateDistances=function(a,b){for(var d=[],
e=0,c=a.atoms.length;e<c;e++){var f=a.atoms[e];f.hetatm&&(f.isWater||d.push(f))}e=0;for(c=b.length;e<c;e++)if(f=b[e],f.closestDistance=Number.POSITIVE_INFINITY,0===d.length)f.closestDistance=0;else for(var g=0,k=d.length;g<k;g++)f.closestDistance=Math.min(f.closestDistance,f.distance3D(d[g]))};var v=new a.PDBInterpreter;c.readPDB=function(a,b){return v.read(a,b)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,ChemDoodle.ELEMENT,jQuery.trim,Math);
(function(c,b,a,g,f,e){var o={"@":0,A:1,B:2,C:3,D:4,E:5,F:6,G:7,H:8,I:9,a:-1,b:-2,c:-3,d:-4,e:-5,f:-6,g:-7,h:-8,i:-9},d={"%":0,J:1,K:2,L:3,M:4,N:5,O:6,P:7,Q:8,R:9,j:-1,k:-2,l:-3,m:-4,n:-5,o:-6,p:-7,q:-8,r:-9},k={S:1,T:2,U:3,V:4,W:5,X:6,Y:7,Z:8,s:9};a.JCAMPInterpreter=function(){};f=a.JCAMPInterpreter.prototype=new a._Interpreter;f.convertHZ2PPM=!1;f.read=function(a){this.isBreak=function(a){return void 0!==o[a]||void 0!==d[a]||void 0!==k[a]||" "===a||"-"===a||"+"===a};this.getValue=function(a,b){var e=
a.charAt(0),c=a.substring(1);return void 0!==o[e]?parseFloat(o[e]+c):void 0!==d[e]?parseFloat(d[e]+c)+b:parseFloat(c)};var c=new g.Spectrum;if(void 0===a||0===a.length)return c;a=a.split("\n");for(var f=[],m,t,n,u,q=1,r=1,v=1,p=-1,y=-1,z=-1,x=!0,A=!1,C=0,F=a.length;C<F;C++){var D=e(a[C]),E=D.indexOf("$$");-1!==E&&(D=D.substring(0,E));if(0===f.length||!b.stringStartsWith(a[C],"##"))0!==f.length&&f.push("\n"),f.push(e(D));else if(E=f.join(""),x&&100>E.length&&c.metadata.push(E),f=[D],b.stringStartsWith(E,
"##TITLE\x3d"))c.title=e(E.substring(8));else if(b.stringStartsWith(E,"##XUNITS\x3d"))c.xUnit=e(E.substring(9)),this.convertHZ2PPM&&"HZ"===c.xUnit.toUpperCase()&&(c.xUnit="PPM",A=!0);else if(b.stringStartsWith(E,"##YUNITS\x3d"))c.yUnit=e(E.substring(9));else if(!b.stringStartsWith(E,"##XYPAIRS\x3d"))if(b.stringStartsWith(E,"##FIRSTX\x3d"))t=parseFloat(e(E.substring(9)));else if(b.stringStartsWith(E,"##LASTX\x3d"))m=parseFloat(e(E.substring(8)));else if(b.stringStartsWith(E,"##FIRSTY\x3d"))n=parseFloat(e(E.substring(9)));
else if(b.stringStartsWith(E,"##NPOINTS\x3d"))u=parseFloat(e(E.substring(10)));else if(b.stringStartsWith(E,"##XFACTOR\x3d"))q=parseFloat(e(E.substring(10)));else if(b.stringStartsWith(E,"##YFACTOR\x3d"))r=parseFloat(e(E.substring(10)));else if(b.stringStartsWith(E,"##DELTAX\x3d"))p=parseFloat(e(E.substring(9)));else if(b.stringStartsWith(E,"##.OBSERVE FREQUENCY\x3d"))this.convertHZ2PPM&&(v=parseFloat(e(E.substring(21))));else if(b.stringStartsWith(E,"##.SHIFT REFERENCE\x3d"))this.convertHZ2PPM&&
(z=E.substring(19).split(","),y=parseInt(e(z[2])),z=parseFloat(e(z[3])));else if(b.stringStartsWith(E,"##XYDATA\x3d")){A||(v=1);var D=x=!1,E=E.split("\n"),I=(m-t)/(u-1);if(-1!==p)for(var G=1,L=E.length;G<L;G++)if("|"===E[G].charAt(0)){I=p;break}for(var B=t-I,H=n,J=0,M,G=1,L=E.length;G<L;G++){for(var N=[],B=e(E[G]),f=[],Q=!1,K=0,P=B.length;K<P;K++)this.isBreak(B.charAt(K))?(0<f.length&&!(1===f.length&&" "===f[0])&&N.push(f.join("")),f=[B.charAt(K)]):"|"===B.charAt(K)?Q=!0:f.push(B.charAt(K));N.push(f.join(""));
B=parseFloat(N[0])*q-I;K=1;for(P=N.length;K<P;K++)if(H=N[K],void 0!==k[H.charAt(0)])for(var O=parseInt(k[H.charAt(0)]+H.substring(1))-1,S=0;S<O;S++)B+=I,J=this.getValue(M,J),H=J*r,R++,c.data[c.data.length-1]=new g.Point(B/v,H);else void 0!==o[H.charAt(0)]&&D?(H=this.getValue(H,J)*r,Q&&(B+=I,c.data.push(new g.Point(B/v,H)))):(D=void 0!==d[H.charAt(0)],M=H,B+=I,J=this.getValue(H,J),H=J*r,R++,c.data.push(new g.Point(B/v,H)))}if(-1!==y){D=z-c.data[y-1].x;C=0;for(F=c.data.length;C<F;C++)c.data[C].x+=D}}else if(b.stringStartsWith(E,
"##PEAK TABLE\x3d")){x=!1;c.continuous=!1;for(var E=E.split("\n"),R=0,G=1,L=E.length;G<L;G++){D=E[G].split(/[\s,]+/);R+=D.length/2;K=0;for(P=D.length;K+1<P;K+=2)c.data.push(new g.Point(parseFloat(e(D[K])),parseFloat(e(D[K+1]))))}}}c.setup();return c};var v=new a.JCAMPInterpreter;v.convertHZ2PPM=!0;c.readJCAMP=function(a){return v.read(a)}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.io,ChemDoodle.structures,jQuery,jQuery.trim);
(function(c,b,a){c.JSONInterpreter=function(){};c=c.JSONInterpreter.prototype;c.contentTo=function(a,b){for(var e=0,c=0,d=0,k=a.length;d<k;d++){for(var v=a[d],l=0,h=v.atoms.length;l<h;l++)v.atoms[l].tmpid="a"+e++;l=0;for(h=v.bonds.length;l<h;l++)v.bonds[l].tmpid="b"+c++}d=e=0;for(k=b.length;d<k;d++)b[d].tmpid="s"+e++;e={};if(a&&0<a.length){e.m=[];d=0;for(k=a.length;d<k;d++)e.m.push(this.molTo(a[d]))}if(b&&0<b.length){e.s=[];d=0;for(k=b.length;d<k;d++)e.s.push(this.shapeTo(b[d]))}d=0;for(k=a.length;d<
k;d++){v=a[d];l=0;for(h=v.atoms.length;l<h;l++)v.atoms[l].tmpid=void 0;l=0;for(h=v.bonds.length;l<h;l++)v.bonds[l].tmpid=void 0}d=0;for(k=b.length;d<k;d++)b[d].tmpid=void 0;return e};c.contentFrom=function(a){var b={molecules:[],shapes:[]};if(a.m)for(var e=0,c=a.m.length;e<c;e++)b.molecules.push(this.molFrom(a.m[e]));if(a.s){e=0;for(c=a.s.length;e<c;e++)b.shapes.push(this.shapeFrom(a.s[e],b.molecules))}e=0;for(c=b.molecules.length;e<c;e++){a=b.molecules[e];for(var d=0,k=a.atoms.length;d<k;d++)a.atoms[d].tmpid=
void 0;d=0;for(k=a.bonds.length;d<k;d++)a.bonds[d].tmpid=void 0}e=0;for(c=b.shapes.length;e<c;e++)b.shapes[e].tmpid=void 0;return b};c.molTo=function(a){for(var c={a:[],b:[]},e=0,o=a.atoms.length;e<o;e++){var d=a.atoms[e],k={x:d.x,y:d.y};d.tmpid&&(k.i=d.tmpid);"C"!==d.label&&(k.l=d.label);0!==d.z&&(k.z=d.z);0!==d.charge&&(k.c=d.charge);-1!==d.mass&&(k.m=d.mass);0!==d.numRadical&&(k.r=d.numRadical);0!==d.numLonePair&&(k.p=d.numLonePair);d.any&&(k.q=!0);-1!==d.rgroup&&(k.rg=d.rgroup);c.a.push(k)}e=
0;for(o=a.bonds.length;e<o;e++)d=a.bonds[e],k={b:a.atoms.indexOf(d.a1),e:a.atoms.indexOf(d.a2)},d.tmpid&&(k.i=d.tmpid),1!==d.bondOrder&&(k.o=d.bondOrder),d.stereo!==b.Bond.STEREO_NONE&&(k.s=d.stereo),c.b.push(k);return c};c.molFrom=function(a){for(var c=new b.Molecule,e=0,o=a.a.length;e<o;e++){var d=a.a[e],k=new b.Atom(d.l?d.l:"C",d.x,d.y);d.i&&(k.tmpid=d.i);d.z&&(k.z=d.z);d.c&&(k.charge=d.c);d.m&&(k.mass=d.m);d.r&&(k.numRadical=d.r);d.p&&(k.numLonePair=d.p);d.q&&(k.any=!0);d.rg&&(k.rgroup=d.rg);
void 0!==d.p_h&&(k.hetatm=d.p_h);void 0!==d.p_w&&(k.isWater=d.p_w);void 0!==d.p_d&&(k.closestDistance=d.p_d);c.atoms.push(k)}e=0;for(o=a.b.length;e<o;e++)d=a.b[e],k=new b.Bond(c.atoms[d.b],c.atoms[d.e],d.o?d.o:1),d.i&&(k.tmpid=d.i),d.s&&(k.stereo=d.s),c.bonds.push(k);return c};c.shapeTo=function(b){var c={};b.tmpid&&(c.i=b.tmpid);b instanceof a.Line?(c.t="Line",c.x1=b.p1.x,c.y1=b.p1.y,c.x2=b.p2.x,c.y2=b.p2.y,c.a=b.arrowType):b instanceof a.Pusher?(c.t="Pusher",c.o1=b.o1.tmpid,c.o2=b.o2.tmpid,1!==
b.numElectron&&(c.e=b.numElectron)):b instanceof a.Bracket&&(c.t="Bracket",c.x1=b.p1.x,c.y1=b.p1.y,c.x2=b.p2.x,c.y2=b.p2.y,0!==b.charge&&(c.c=b.charge),0!==b.mult&&(c.m=b.mult),0!==b.repeat&&(c.r=b.repeat));return c};c.shapeFrom=function(c,f){var e;if("Line"===c.t)e=new a.Line(new b.Point(c.x1,c.y1),new b.Point(c.x2,c.y2)),e.arrowType=c.a;else if("Pusher"===c.t){var o,d;e=0;for(var k=f.length;e<k;e++){for(var v=f[e],l=0,h=v.atoms.length;l<h;l++){var j=v.atoms[l];j.tmpid===c.o1?o=j:j.tmpid===c.o2&&
(d=j)}l=0;for(h=v.bonds.length;l<h;l++)j=v.bonds[l],j.tmpid===c.o1?o=j:j.tmpid===c.o2&&(d=j)}e=new a.Pusher(o,d);c.e&&(e.numElectron=c.e)}else"Bracket"===c.t&&(e=new a.Bracket(new b.Point(c.x1,c.y1),new b.Point(c.x2,c.y2)),void 0!==c.c&&(e.charge=c.c),void 0!==c.m&&(e.mult=c.m),void 0!==c.r&&(e.repeat=c.r));return e};c.pdbFrom=function(a){var b=this.molFrom(a.mol);b.findRings=!1;b.fromJSON=!0;b.chains=this.chainsFrom(a.ribbons);return b};c.chainsFrom=function(a){for(var c=[],e=0,o=a.cs.length;e<o;e++){for(var d=
a.cs[e],k=[],v=0,l=d.length;v<l;v++){var h=d[v],j=new b.Residue;j.name=h.n;j.cp1=new b.Atom("",h.x1,h.y1,h.z1);j.cp2=new b.Atom("",h.x2,h.y2,h.z2);h.x3&&(j.cp3=new b.Atom("",h.x3,h.y3,h.z3),j.cp4=new b.Atom("",h.x4,h.y4,h.z4),j.cp5=new b.Atom("",h.x5,h.y5,h.z5));j.helix=h.h;j.sheet=h.s;j.arrow=h.a;k.push(j)}c.push(k)}return c}})(ChemDoodle.io,ChemDoodle.structures,ChemDoodle.structures.d2);
(function(c,b,a){b.RXNInterpreter=function(){};var g=b.RXNInterpreter.prototype=new b._Interpreter;g.read=function(b,f){f||(f=c.default_bondLength_2D);var d=[],g;if(b){g=b.split("$MOL\n");for(var v=g[0].split("\n")[4],l=parseInt(v.substring(0,3)),v=parseInt(v.substring(3,6)),h=1,j=0,m=0,t=l+v;m<t;m++){d[m]=c.readMOL(g[h],f);var n=d[m].getBounds(),n=n.maxX-n.minX,j=j-(n+40);h++}m=0;for(t=l;m<t;m++){var n=d[m].getBounds(),n=n.maxX-n.minX,h=d[m].getCenter(),u=0;for(g=d[m].atoms.length;u<g;u++){var q=
d[m].atoms[u];q.x+=j+n/2-h.x;q.y-=h.y}j+=n+40}g=new a.d2.Line(new a.Point(j,0),new a.Point(j+40,0));j+=80;m=l;for(t=l+v;m<t;m++){n=d[m].getBounds();n=n.maxX-n.minX;h=d[m].getCenter();for(u=0;u<d[m].atoms.length;u++)q=d[m].atoms[u],q.x+=j+n/2-h.x,q.y-=h.y;j+=n+40}}else d.push(new a.Molecule),g=new a.d2.Line(new a.Point(-20,0),new a.Point(20,0));g.arrowType=a.d2.Line.ARROW_SYNTHETIC;return{molecules:d,shapes:[g]}};g.write=function(b,f){var d=[[],[]],g=void 0;if(b&&f){v=0;for(l=f.length;v<l;v++)if(f[v]instanceof
a.d2.Line){g=f[v].getPoints();break}if(!g)return"";for(var v=0,l=b.length;v<l;v++)b[v].getCenter().x<g[0].x?d[0].push(b[v]):d[1].push(b[v]);g=[];g.push("$RXN\nReaction from ChemDoodle Web Components\n\nhttp://www.ichemlabs.com\n");g.push(this.fit(d[0].length.toString(),3));g.push(this.fit(d[1].length.toString(),3));g.push("\n");for(v=0;2>v;v++)for(var l=0,h=d[v].length;l<h;l++)g.push("$MOL\n"),g.push(c.writeMOL(d[v][l])),g.push("\n");return g.join("")}};var f=new b.RXNInterpreter;c.readRXN=function(a,
b){return f.read(a,b)};c.writeRXN=function(a,b){return f.write(a,b)}})(ChemDoodle,ChemDoodle.io,ChemDoodle.structures);
(function(c,b,a,g,f,e){g.XYZInterpreter=function(){};b=g.XYZInterpreter.prototype=new g._Interpreter;b.deduceCovalentBonds=!0;b.read=function(b){var g=new f.Molecule;if(!b)return g;b=b.split("\n");for(var o=parseInt(e(b[0])),l=0;l<o;l++){var h=b[l+2].split(/\s+/g);g.atoms[l]=new f.Atom(isNaN(h[0])?h[0]:a[parseInt(h[0])-1],parseFloat(h[1]),parseFloat(h[2]),parseFloat(h[3]))}this.deduceCovalentBonds&&(new c.informatics.BondDeducer).deduceCovalentBonds(g,1);return g};var o=new g.XYZInterpreter;c.readXYZ=
function(a){return o.read(a)}})(ChemDoodle,ChemDoodle.ELEMENT,ChemDoodle.SYMBOLS,ChemDoodle.io,ChemDoodle.structures,jQuery.trim);
ChemDoodle.monitor=function(c,b,a){var g={CANVAS_DRAGGING:void 0,CANVAS_OVER:void 0,ALT:!1,SHIFT:!1,META:!1};c.supports_touch()||b(a).ready(function(){b(a).mousemove(function(a){g.CANVAS_DRAGGING&&g.CANVAS_DRAGGING.drag&&(g.CANVAS_DRAGGING.prehandleEvent(a),g.CANVAS_DRAGGING.drag(a))});b(a).mouseup(function(a){g.CANVAS_DRAGGING&&g.CANVAS_DRAGGING!==g.CANVAS_OVER&&g.CANVAS_DRAGGING.mouseup&&(g.CANVAS_DRAGGING.prehandleEvent(a),g.CANVAS_DRAGGING.mouseup(a));g.CANVAS_DRAGGING=void 0});b(a).keydown(function(a){g.SHIFT=
a.shiftKey;g.ALT=a.altKey;g.META=a.metaKey||a.ctrlKey;var b=g.CANVAS_OVER;g.CANVAS_DRAGGING&&(b=g.CANVAS_DRAGGING);b&&b.keydown&&(b.prehandleEvent(a),b.keydown(a))});b(a).keypress(function(a){var b=g.CANVAS_OVER;g.CANVAS_DRAGGING&&(b=g.CANVAS_DRAGGING);b&&b.keypress&&(b.prehandleEvent(a),b.keypress(a))});b(a).keyup(function(a){g.SHIFT=a.shiftKey;g.ALT=a.altKey;g.META=a.metaKey||a.ctrlKey;var b=g.CANVAS_OVER;g.CANVAS_DRAGGING&&(b=g.CANVAS_DRAGGING);b&&b.keyup&&(b.prehandleEvent(a),b.keyup(a))})});
return g}(ChemDoodle.featureDetection,jQuery,document);
(function(c,b,a,g,f,e,o,d,k,v){c._Canvas=function(){};var l=c._Canvas.prototype;l.molecules=void 0;l.shapes=void 0;l.emptyMessage=void 0;l.image=void 0;l.repaint=function(){if(!this.test){var a=k.getElementById(this.id);if(a.getContext){var b=a.getContext("2d");1!==this.pixelRatio&&a.width===this.width&&(a.width=this.width*this.pixelRatio,a.height=this.height*this.pixelRatio,b.scale(this.pixelRatio,this.pixelRatio));this.image?b.drawImage(this.image,0,0):(this.specs.backgroundColor&&this.bgCache!==
a.style.backgroundColor&&(a.style.backgroundColor=this.specs.backgroundColor,this.bgCache=a.style.backgroundColor),b.fillStyle=this.specs.backgroundColor,b.fillRect(0,0,this.width,this.height));if(this.innerRepaint)this.innerRepaint(b);else if(0!==this.molecules.length||0!==this.shapes.length){b.save();b.translate(this.width/2,this.height/2);b.rotate(this.specs.rotateAngle);b.scale(this.specs.scale,this.specs.scale);b.translate(-this.width/2,-this.height/2);for(var a=0,d=this.molecules.length;a<d;a++)this.molecules[a].check(!0),
this.molecules[a].draw(b,this.specs);a=0;for(d=this.shapes.length;a<d;a++)this.shapes[a].draw(b,this.specs);b.restore()}else this.emptyMessage&&(b.fillStyle="#737683",b.textAlign="center",b.textBaseline="middle",b.font="18px Helvetica, Verdana, Arial, Sans-serif",b.fillText(this.emptyMessage,this.width/2,this.height/2));this.drawChildExtras&&this.drawChildExtras(b)}}};l.resize=function(a,b){var d=e("#"+this.id);d.attr({width:a,height:b});d.css("width",a);d.css("height",b);this.width=a;this.height=
b;if(c._Canvas3D&&this instanceof c._Canvas3D)this.gl.viewport(0,0,a,b),this.setupScene();else if(0<this.molecules.length){this.center();for(var d=0,f=this.molecules.length;d<f;d++)this.molecules[d].check()}this.repaint()};l.setBackgroundImage=function(a){this.image=new Image;var b=this;this.image.onload=function(){b.repaint()};this.image.src=a};l.loadMolecule=function(a){this.clear();this.molecules.push(a);this.center();c._Canvas3D&&this instanceof c._Canvas3D||a.check();this.afterLoadContent&&this.afterLoadContent();
this.repaint()};l.loadContent=function(a,b){this.molecules=a;this.shapes=b;this.center();if(!(c._Canvas3D&&this instanceof c._Canvas3D))for(var d=0,e=this.molecules.length;d<e;d++)this.molecules[d].check();this.afterLoadContent&&this.afterLoadContent();this.repaint()};l.addMolecule=function(a){this.molecules.push(a);c._Canvas3D&&this instanceof c._Canvas3D||a.check();this.repaint()};l.removeMolecule=function(a){this.molecules=e.grep(this.molecules,function(b){return b!==a});this.repaint()};l.getMolecule=
function(){return 0<this.molecules.length?this.molecules[0]:void 0};l.getMolecules=function(){return this.molecules};l.addShape=function(a){this.shapes.push(a);this.repaint()};l.removeShape=function(a){this.shapes=e.grep(this.shapes,function(b){return b!==a});this.repaint()};l.getShapes=function(){return this.shapes};l.clear=function(){this.molecules=[];this.shapes=[];this.specs.scale=1;this.repaint()};l.center=function(){for(var a=this.getContentBounds(),b=new f.Point((this.width-a.minX-a.maxX)/
2,(this.height-a.minY-a.maxY)/2),e=0,c=this.molecules.length;e<c;e++)for(var g=this.molecules[e],k=0,l=g.atoms.length;k<l;k++)g.atoms[k].add(b);e=0;for(c=this.shapes.length;e<c;e++){g=this.shapes[e].getPoints();k=0;for(l=g.length;k<l;k++)g[k].add(b)}this.specs.scale=1;b=a.maxX-a.minX;a=a.maxY-a.minY;if(b>this.width||a>this.height)this.specs.scale=0.85*d.min(this.width/b,this.height/a)};l.bondExists=function(a,b){for(var d=0,e=this.molecules.length;d<e;d++)for(var c=this.molecules[d],f=0,g=c.bonds.length;f<
g;f++){var k=c.bonds[f];if(k.contains(a)&&k.contains(b))return!0}return!1};l.getBond=function(a,b){for(var d=0,e=this.molecules.length;d<e;d++)for(var c=this.molecules[d],f=0,g=c.bonds.length;f<g;f++){var k=c.bonds[f];if(k.contains(a)&&k.contains(b))return k}};l.getMoleculeByAtom=function(a){for(var b=0,d=this.molecules.length;b<d;b++){var e=this.molecules[b];if(-1!==e.atoms.indexOf(a))return e}};l.getAllAtoms=function(){for(var a=[],b=0,d=this.molecules.length;b<d;b++)a=a.concat(this.molecules[b].atoms);
return a};l.getAllPoints=function(){for(var a=[],b=0,d=this.molecules.length;b<d;b++)a=a.concat(this.molecules[b].atoms);b=0;for(d=this.shapes.length;b<d;b++)a=a.concat(this.shapes[b].getPoints());return a};l.getContentBounds=function(){for(var b=new a.Bounds,d=0,e=this.molecules.length;d<e;d++)b.expand(this.molecules[d].getBounds());d=0;for(e=this.shapes.length;d<e;d++)b.expand(this.shapes[d].getBounds());return b};l.create=function(a,j,l){this.id=a;this.width=j;this.height=l;this.molecules=[];this.shapes=
[];if(k.getElementById(a)){var t=e("#"+a);j?t.attr("width",j):this.width=t.attr("width");l?t.attr("height",l):this.height=t.attr("height");t.attr("class","ChemDoodleWebComponent")}else{if(!c.featureDetection.supports_canvas_text()&&o.msie&&"6"<=o.version){k.writeln('\x3cdiv style\x3d"border: 1px solid black;" width\x3d"'+j+'" height\x3d"'+l+'"\x3ePlease install \x3ca href\x3d"http://code.google.com/chrome/chromeframe/"\x3eGoogle Chrome Frame\x3c/a\x3e, then restart Internet Explorer.\x3c/div\x3e');
return}k.writeln('\x3ccanvas class\x3d"ChemDoodleWebComponent" id\x3d"'+a+'" width\x3d"'+j+'" height\x3d"'+l+'" alt\x3d"ChemDoodle Web Component"\x3eThis browser does not support HTML5/Canvas.\x3c/canvas\x3e')}a=e("#"+a);a.css("width",this.width);a.css("height",this.height);this.pixelRatio=v.devicePixelRatio?v.devicePixelRatio:1;this.specs=new f.VisualSpecifications;var n=this;b.supports_touch()?(a.bind("touchstart",function(a){var d=(new Date).getTime();if(!b.supports_gesture()&&2===a.originalEvent.touches.length){var e=
a.originalEvent.touches,c=new f.Point(e[0].pageX,e[0].pageY),e=new f.Point(e[1].pageX,e[1].pageY);n.implementedGestureDist=c.distance(e);n.implementedGestureAngle=c.angle(e);n.gesturestart&&(n.prehandleEvent(a),n.gesturestart(a))}n.lastTouch&&1===a.originalEvent.touches.length&&500>d-n.lastTouch?n.dbltap?(n.prehandleEvent(a),n.dbltap(a)):n.dblclick?(n.prehandleEvent(a),n.dblclick(a)):n.touchstart?(n.prehandleEvent(a),n.touchstart(a)):n.mousedown&&(n.prehandleEvent(a),n.mousedown(a)):n.touchstart?
(n.prehandleEvent(a),n.touchstart(a),this.hold&&clearTimeout(this.hold),this.touchhold&&(this.hold=setTimeout(function(){n.touchhold(a)},1E3))):n.mousedown&&(n.prehandleEvent(a),n.mousedown(a));n.lastTouch=d}),a.bind("touchmove",function(a){this.hold&&(clearTimeout(this.hold),this.hold=void 0);if(!b.supports_gesture()&&2===a.originalEvent.touches.length&&n.gesturechange){var e=a.originalEvent.touches,c=new f.Point(e[0].pageX,e[0].pageY),g=new f.Point(e[1].pageX,e[1].pageY),e=c.distance(g),c=c.angle(g);
a.originalEvent.scale=e/n.implementedGestureDist;a.originalEvent.rotation=180*(n.implementedGestureAngle-c)/d.PI;n.prehandleEvent(a);n.gesturechange(a)}if(1<a.originalEvent.touches.length&&n.multitouchmove){c=a.originalEvent.touches.length;n.prehandleEvent(a);e=new f.Point(-a.offset.left*c,-a.offset.top*c);for(g=0;g<c;g++)e.x+=a.originalEvent.changedTouches[g].pageX,e.y+=a.originalEvent.changedTouches[g].pageY;e.x/=c;e.y/=c;a.p=e;n.multitouchmove(a,c)}else n.touchmove?(n.prehandleEvent(a),n.touchmove(a)):
n.drag&&(n.prehandleEvent(a),n.drag(a))}),a.bind("touchend",function(a){this.hold&&(clearTimeout(this.hold),this.hold=void 0);!b.supports_gesture()&&n.implementedGestureDist&&(n.implementedGestureDist=void 0,n.implementedGestureAngle=void 0,n.gestureend&&(n.prehandleEvent(a),n.gestureend(a)));n.touchend?(n.prehandleEvent(a),n.touchend(a)):n.mouseup&&(n.prehandleEvent(a),n.mouseup(a));250>(new Date).getTime()-n.lastTouch&&(n.tap?(n.prehandleEvent(a),n.tap(a)):n.click&&(n.prehandleEvent(a),n.click(a)))}),
a.bind("gesturestart",function(a){n.gesturestart&&(n.prehandleEvent(a),n.gesturestart(a))}),a.bind("gesturechange",function(a){n.gesturechange&&(n.prehandleEvent(a),n.gesturechange(a))}),a.bind("gestureend",function(a){n.gestureend&&(n.prehandleEvent(a),n.gestureend(a))})):(a.click(function(a){switch(a.which){case 1:n.click&&(n.prehandleEvent(a),n.click(a));break;case 2:n.middleclick&&(n.prehandleEvent(a),n.middleclick(a));break;case 3:n.rightclick&&(n.prehandleEvent(a),n.rightclick(a))}}),a.dblclick(function(a){n.dblclick&&
(n.prehandleEvent(a),n.dblclick(a))}),a.mousedown(function(a){switch(a.which){case 1:g.CANVAS_DRAGGING=n;n.mousedown&&(n.prehandleEvent(a),n.mousedown(a));break;case 2:n.middlemousedown&&(n.prehandleEvent(a),n.middlemousedown(a));break;case 3:n.rightmousedown&&(n.prehandleEvent(a),n.rightmousedown(a))}}),a.mousemove(function(a){!g.CANVAS_DRAGGING&&n.mousemove&&(n.prehandleEvent(a),n.mousemove(a))}),a.mouseout(function(a){g.CANVAS_OVER=void 0;n.mouseout&&(n.prehandleEvent(a),n.mouseout(a))}),a.mouseover(function(a){g.CANVAS_OVER=
n;n.mouseover&&(n.prehandleEvent(a),n.mouseover(a))}),a.mouseup(function(a){switch(a.which){case 1:n.mouseup&&(n.prehandleEvent(a),n.mouseup(a));break;case 2:n.middlemouseup&&(n.prehandleEvent(a),n.middlemouseup(a));break;case 3:n.rightmouseup&&(n.prehandleEvent(a),n.rightmouseup(a))}}),a.mousewheel(function(a,b){n.mousewheel&&(n.prehandleEvent(a),n.mousewheel(a,b))}));this.subCreate&&this.subCreate()};l.prehandleEvent=function(a){a.originalEvent.changedTouches&&(a.pageX=a.originalEvent.changedTouches[0].pageX,
a.pageY=a.originalEvent.changedTouches[0].pageY);a.preventDefault();a.offset=e("#"+this.id).offset();a.p=new f.Point(a.pageX-a.offset.left,a.pageY-a.offset.top)}})(ChemDoodle,ChemDoodle.featureDetection,ChemDoodle.math,ChemDoodle.monitor,ChemDoodle.structures,jQuery,jQuery.browser,Math,document,window);
(function(c){c._AnimatorCanvas=function(b,a,c){b&&this.create(b,a,c)};c=c._AnimatorCanvas.prototype=new c._Canvas;c.timeout=33;c.startAnimation=function(){this.stopAnimation();this.lastTime=(new Date).getTime();var b=this;this.nextFrame&&(this.handle=setInterval(function(){var a=(new Date).getTime();b.nextFrame(a-b.lastTime);b.repaint();b.lastTime=a},this.timeout))};c.stopAnimation=function(){this.handle&&(clearInterval(this.handle),this.handle=void 0)};c.isRunning=function(){return void 0!==this.handle}})(ChemDoodle);
(function(c,b){c.FileCanvas=function(a,c,f,e){a&&this.create(a,c,f);b.writeln('\x3cbr\x3e\x3cform name\x3d"FileForm" enctype\x3d"multipart/form-data" method\x3d"POST" action\x3d"'+e+'" target\x3d"HiddenFileFrame"\x3e\x3cinput type\x3d"file" name\x3d"f" /\x3e\x3cinput type\x3d"submit" name\x3d"submitbutton" value\x3d"Show File" /\x3e\x3c/form\x3e\x3ciframe id\x3d"HFF-'+a+'" name\x3d"HiddenFileFrame" height\x3d"0" width\x3d"0" style\x3d"display:none;" onLoad\x3d"GetMolFromFrame(\'HFF-'+a+"', "+a+')"\x3e\x3c/iframe\x3e');
this.emptyMessage="Click below to load file";this.repaint()};c.FileCanvas.prototype=new c._Canvas})(ChemDoodle,document);
(function(c){c.HyperlinkCanvas=function(b,a,c,f,e,o){b&&this.create(b,a,c);this.urlOrFunction=f;this.color=e?e:"blue";this.size=o?o:2};c=c.HyperlinkCanvas.prototype=new c._Canvas;c.openInNewWindow=!0;c.hoverImage=void 0;c.drawChildExtras=function(b){this.e&&(this.hoverImage?b.drawImage(this.hoverImage,0,0):(b.strokeStyle=this.color,b.lineWidth=2*this.size,b.strokeRect(0,0,this.width,this.height)))};c.setHoverImage=function(b){this.hoverImage=new Image;this.hoverImage.src=b};c.click=function(){this.e=
void 0;this.repaint();this.urlOrFunction instanceof Function?this.urlOrFunction():this.openInNewWindow?window.open(this.urlOrFunction):location.href=this.urlOrFunction};c.mouseout=function(){this.e=void 0;this.repaint()};c.mouseover=function(b){this.e=b;this.repaint()}})(ChemDoodle);
(function(c,b,a,g){c.MolGrabberCanvas=function(b,e,c){b&&this.create(b,e,c);e=[];e.push('\x3cbr\x3e\x3cinput type\x3d"text" id\x3d"');e.push(b);e.push('_query" size\x3d"32" value\x3d"" /\x3e');e.push("\x3cbr\x3e\x3cnobr\x3e");e.push('\x3cselect id\x3d"');e.push(b);e.push('_select"\x3e');e.push('\x3coption value\x3d"chemexper"\x3eChemExper');e.push('\x3coption value\x3d"chemspider"\x3eChemSpider');e.push('\x3coption value\x3d"pubchem" selected\x3ePubChem');e.push("\x3c/select\x3e");e.push('\x3cbutton id\x3d"');
e.push(b);e.push('_submit"\x3eShow Molecule\x3c/button\x3e');e.push("\x3c/nobr\x3e");g.getElementById(b);a("#"+b).after(e.join(""));var d=this;a("#"+b+"_submit").click(function(){d.search()});a("#"+b+"_query").keypress(function(a){13===a.which&&d.search()});this.emptyMessage="Enter search term below";this.repaint()};c=c.MolGrabberCanvas.prototype=new c._Canvas;c.setSearchTerm=function(b){a("#"+this.id+"_query").val(b);this.search()};c.search=function(){this.emptyMessage="Searching...";this.clear();
var c=this;b.getMoleculeFromDatabase(a("#"+this.id+"_query").val(),{database:a("#"+this.id+"_select").val()},function(a){c.loadMolecule(a)})}})(ChemDoodle,ChemDoodle.iChemLabs,jQuery,document);
(function(c,b,a){var g=[],f=[1,0,0],e=[0,1,0],o=[0,0,1];c.RotatorCanvas=function(a,b,e,c){a&&this.create(a,b,e);this.rotate3D=c};c=c.RotatorCanvas.prototype=new c._AnimatorCanvas;b=b.PI/15;c.xIncrement=b;c.yIncrement=b;c.zIncrement=b;c.nextFrame=function(b){if(0===this.molecules.length&&0===this.shapes.length)this.stopAnimation();else if(b/=1E3,this.rotate3D){a.identity(g);a.rotate(g,this.xIncrement*b,f);a.rotate(g,this.yIncrement*b,e);a.rotate(g,this.zIncrement*b,o);b=0;for(var c=this.molecules.length;b<
c;b++){for(var v=this.molecules[b],l=0,h=v.atoms.length;l<h;l++){var j=v.atoms[l],m=[j.x-this.width/2,j.y-this.height/2,j.z];a.multiplyVec3(g,m);j.x=m[0]+this.width/2;j.y=m[1]+this.height/2;j.z=m[2]}l=0;for(h=v.rings.length;l<h;l++)v.rings[l].center=v.rings[l].getCenter();this.specs.atoms_display&&this.specs.atoms_circles_2D&&v.sortAtomsByZ();this.specs.bonds_display&&this.specs.bonds_clearOverlaps_2D&&v.sortBondsByZ()}b=0;for(c=this.shapes.length;b<c;b++){v=this.shapes[b].getPoints();l=0;for(h=v.length;l<
h;l++)j=v[l],m=[j.x-this.width/2,j.y-this.height/2,0],a.multiplyVec3(g,m),j.x=m[0]+this.width/2,j.y=m[1]+this.height/2}}else this.specs.rotateAngle+=this.zIncrement*b};c.dblclick=function(){this.isRunning()?this.stopAnimation():this.startAnimation()}})(ChemDoodle,Math,mat4);
(function(c,b){c.SlideshowCanvas=function(a,b,e){a&&this.create(a,b,e)};var a=c.SlideshowCanvas.prototype=new c._AnimatorCanvas;a.frames=[];a.curIndex=0;a.timeout=5E3;a.alpha=0;a.innerHandle=void 0;a.phase=0;a.drawChildExtras=function(a){var c=b.getRGB(this.specs.backgroundColor,255);a.fillStyle="rgba("+c[0]+", "+c[1]+", "+c[2]+", "+this.alpha+")";a.fillRect(0,0,this.width,this.height)};a.nextFrame=function(){if(0===this.frames.length)this.stopAnimation();else{this.phase=0;var a=this,b=1;this.innerHandle=
setInterval(function(){a.alpha=b/15;a.repaint();15===b&&a.breakInnerHandle();b++},33)}};a.breakInnerHandle=function(){this.innerHandle&&(clearInterval(this.innerHandle),this.innerHandle=void 0);if(0===this.phase){this.curIndex++;this.curIndex>this.frames.length-1&&(this.curIndex=0);this.alpha=1;var a=this.frames[this.curIndex];this.loadContent(a.mols,a.shapes);this.phase=1;var b=this,e=1;this.innerHandle=setInterval(function(){b.alpha=(15-e)/15;b.repaint();15===e&&b.breakInnerHandle();e++},33)}else 1===
this.phase&&(this.alpha=0,this.repaint())};a.addFrame=function(a,b){0===this.frames.length&&this.loadContent(a,b);this.frames.push({mols:a,shapes:b})}})(ChemDoodle,ChemDoodle.math);
(function(c,b,a,g,f){c.TransformCanvas=function(a,b,d,c){a&&this.create(a,b,d);this.rotate3D=c};c=c.TransformCanvas.prototype=new c._Canvas;c.lastPoint=void 0;c.rotationMultMod=1.3;c.lastPinchScale=1;c.lastGestureRotate=0;c.mousedown=function(a){this.lastPoint=a.p};c.dblclick=function(){this.center();this.repaint()};c.drag=function(e){if(!this.lastPoint.multi){if(b.ALT){var c=new a.Point(e.p.x,e.p.y);c.sub(this.lastPoint);for(var d=0,k=this.molecules.length;d<k;d++){for(var v=this.molecules[d],l=
0,h=v.atoms.length;l<h;l++)v.atoms[l].add(c);v.check()}d=0;for(k=this.shapes.length;d<k;d++){v=this.shapes[d].getPoints();l=0;for(h=v.length;l<h;l++)v[l].add(c)}this.lastPoint=e.p}else if(!0===this.rotate3D){h=g.max(this.width/4,this.height/4);l=(e.p.x-this.lastPoint.x)/h*this.rotationMultMod;h=-(e.p.y-this.lastPoint.y)/h*this.rotationMultMod;c=[];f.identity(c);f.rotate(c,h,[1,0,0]);f.rotate(c,l,[0,1,0]);d=0;for(k=this.molecules.length;d<k;d++){v=this.molecules[d];l=0;for(h=v.atoms.length;l<h;l++)d=
v.atoms[l],k=[d.x-this.width/2,d.y-this.height/2,d.z],f.multiplyVec3(c,k),d.x=k[0]+this.width/2,d.y=k[1]+this.height/2,d.z=k[2];d=0;for(k=v.rings.length;d<k;d++)v.rings[d].center=v.rings[d].getCenter();this.lastPoint=e.p;this.specs.atoms_display&&this.specs.atoms_circles_2D&&v.sortAtomsByZ();this.specs.bonds_display&&this.specs.bonds_clearOverlaps_2D&&v.sortBondsByZ()}}else h=new a.Point(this.width/2,this.height/2),l=h.angle(this.lastPoint),h=h.angle(e.p),this.specs.rotateAngle-=h-l,this.lastPoint=
e.p;this.repaint()}};c.mousewheel=function(a,b){this.specs.scale+=b/10;0.01>this.specs.scale&&(this.specs.scale=0.01);this.repaint()};c.multitouchmove=function(b,c){if(2===c)if(this.lastPoint.multi){var d=new a.Point(b.p.x,b.p.y);d.sub(this.lastPoint);for(var f=0,g=this.molecules.length;f<g;f++){for(var l=this.molecules[f],h=0,j=l.atoms.length;h<j;h++)l.atoms[h].add(d);l.check()}f=0;for(g=this.shapes.length;f<g;f++){l=this.shapes[f].getPoints();h=0;for(j=l.length;h<j;h++)l[h].add(d)}this.lastPoint=
b.p;this.lastPoint.multi=!0;this.repaint()}else this.lastPoint=b.p,this.lastPoint.multi=!0};c.gesturechange=function(b){0!==b.originalEvent.scale-this.lastPinchScale&&(this.specs.scale*=b.originalEvent.scale/this.lastPinchScale,0.01>this.specs.scale&&(this.specs.scale=0.01),this.lastPinchScale=b.originalEvent.scale);if(0!==this.lastGestureRotate-b.originalEvent.rotation){for(var c=(this.lastGestureRotate-b.originalEvent.rotation)/180*l.PI,d=new a.Point(this.width/2,this.height/2),f=0,g=this.molecules.length;f<
g;f++){for(var l=this.molecules[f],h=0,j=l.atoms.length;h<j;h++){var m=l.atoms[h],t=d.distance(m),n=d.angle(m)+c;m.x=d.x+t*l.cos(n);m.y=d.y-t*l.sin(n)}l.check()}this.lastGestureRotate=b.originalEvent.rotation}this.repaint()};c.gestureend=function(){this.lastPinchScale=1;this.lastGestureRotate=0}})(ChemDoodle,ChemDoodle.monitor,ChemDoodle.structures,Math,mat4);(function(c){c.ViewerCanvas=function(b,a,c){b&&this.create(b,a,c)};c.ViewerCanvas.prototype=new c._Canvas})(ChemDoodle);
(function(c){c._SpectrumCanvas=function(b,a,c){b&&this.create(b,a,c)};c=c._SpectrumCanvas.prototype=new c._Canvas;c.spectrum=void 0;c.emptyMessage="No Spectrum Loaded or Recognized";c.loadMolecule=void 0;c.getMolecule=void 0;c.innerRepaint=function(b){this.spectrum&&0<this.spectrum.data.length?this.spectrum.draw(b,this.specs,this.width,this.height):this.emptyMessage&&(b.fillStyle="#737683",b.textAlign="center",b.textBaseline="middle",b.font="18px Helvetica, Verdana, Arial, Sans-serif",b.fillText(this.emptyMessage,
this.width/2,this.height/2))};c.loadSpectrum=function(b){this.spectrum=b;this.repaint()};c.getSpectrum=function(){return this.spectrum};c.getSpectrumCoordinates=function(b,a){return spectrum.getInternalCoordinates(b,a,this.width,this.height)}})(ChemDoodle,document);(function(c){c.ObserverCanvas=function(b,a,c){b&&this.create(b,a,c)};c.ObserverCanvas.prototype=new c._SpectrumCanvas})(ChemDoodle);
(function(c){c.OverlayCanvas=function(b,a,c){b&&this.create(b,a,c)};c=c.OverlayCanvas.prototype=new c._SpectrumCanvas;c.overlaySpectra=[];c.superRepaint=c.innerRepaint;c.innerRepaint=function(b){this.superRepaint(b);if(this.spectrum&&0<this.spectrum.data.length)for(var a=0,c=this.overlaySpectra.length;a<c;a++){var f=this.overlaySpectra[a];f&&0<f.data.length&&(f.minX=this.spectrum.minX,f.maxX=this.spectrum.maxX,f.drawPlot(b,this.specs,this.width,this.height,this.spectrum.memory.offsetTop,this.spectrum.memory.offsetLeft,
this.spectrum.memory.offsetBottom))}};c.addSpectrum=function(b){this.spectrum?this.overlaySpectra.push(b):this.spectrum=b}})(ChemDoodle);
(function(c,b,a){c.PerspectiveCanvas=function(a,b,c){a&&this.create(a,b,c)};var g=c.PerspectiveCanvas.prototype=new c._SpectrumCanvas;g.dragRange=void 0;g.rescaleYAxisOnZoom=!0;g.lastPinchScale=1;g.mousedown=function(a){this.dragRange=new c.structures.Point(a.p.x,a.p.x)};g.mouseup=function(a){this.dragRange&&this.dragRange.x!==this.dragRange.y&&(this.dragRange.multi||(a=this.spectrum.zoom(this.dragRange.x,a.p.x,this.width,this.rescaleYAxisOnZoom),this.rescaleYAxisOnZoom&&(this.specs.scale=a)),this.dragRange=
void 0,this.repaint())};g.drag=function(a){this.dragRange&&(this.dragRange.multi?this.dragRange=void 0:(b.SHIFT&&(this.spectrum.translate(a.p.x-this.dragRange.x,this.width),this.dragRange.x=a.p.x),this.dragRange.y=a.p.x),this.repaint())};g.drawChildExtras=function(b){if(this.dragRange){var c=a.min(this.dragRange.x,this.dragRange.y),g=a.max(this.dragRange.x,this.dragRange.y);b.strokeStyle="gray";b.lineStyle=1;b.beginPath();for(b.moveTo(c,this.height/2);c<=g;c++)5>c%10?b.lineTo(c,a.round(this.height/
2)):b.moveTo(c,a.round(this.height/2));b.stroke()}};g.mousewheel=function(a,b){this.specs.scale+=b/10;0.01>this.specs.scale&&(this.specs.scale=0.01);this.repaint()};g.dblclick=function(){this.spectrum.setup();this.specs.scale=1;this.repaint()};g.multitouchmove=function(a,b){2===b&&(!this.dragRange||!this.dragRange.multi?(this.dragRange=new c.structures.Point(a.p.x,a.p.x),this.dragRange.multi=!0):(this.spectrum.translate(a.p.x-this.dragRange.x,this.width),this.dragRange.x=a.p.x,this.dragRange.y=a.p.x,
this.repaint()))};g.gesturechange=function(a){this.specs.scale*=a.originalEvent.scale/this.lastPinchScale;0.01>this.specs.scale&&(this.specs.scale=0.01);this.lastPinchScale=a.originalEvent.scale;this.repaint()};g.gestureend=function(){this.lastPinchScale=1}})(ChemDoodle,ChemDoodle.monitor,Math);
(function(c,b){c.SeekerCanvas=function(a,b,c,o){a&&this.create(a,b,c);this.seekType=o};var a=c.SeekerCanvas.prototype=new c._SpectrumCanvas;a.superRepaint=a.innerRepaint;a.innerRepaint=function(a){this.superRepaint(a);if(this.spectrum&&0<this.spectrum.data.length&&this.p){var f,e;if(this.seekType===c.SeekerCanvas.SEEK_POINTER)f=this.p,e=this.spectrum.getInternalCoordinates(f.x,f.y);else if(this.seekType===c.SeekerCanvas.SEEK_PLOT||this.seekType===c.SeekerCanvas.SEEK_PEAK){e=this.seekType===c.SeekerCanvas.SEEK_PLOT?
this.spectrum.getClosestPlotInternalCoordinates(this.p.x):this.spectrum.getClosestPeakInternalCoordinates(this.p.x);if(!e)return;f={x:this.spectrum.getTransformedX(e.x,this.specs,this.width,this.spectrum.memory.offsetLeft),y:this.spectrum.getTransformedY(e.y/100,this.specs,this.height,this.spectrum.memory.offsetBottom,this.spectrum.memory.offsetTop)}}a.fillStyle="white";a.strokeStyle=this.specs.plots_color;a.lineWidth=this.specs.plots_width;a.beginPath();a.arc(f.x,f.y,3,0,2*b.PI,!1);a.fill();a.stroke();
a.font=this.specs.getFontString(this.specs.text_font_size,this.specs.text_font_families);a.textAlign="left";a.textBaseline="bottom";e="x:"+e.x.toFixed(3)+", y:"+e.y.toFixed(3);var o=f.x+3,d=a.measureText(e).width;o+d>this.width-2&&(o-=6+d);f=f.y;0>f-this.specs.text_font_size-2&&(f+=this.specs.text_font_size);a.fillRect(o,f-this.specs.text_font_size,d,this.specs.text_font_size);a.fillStyle="black";a.fillText(e,o,f)}};a.mouseout=function(){this.p=void 0;this.repaint()};a.mousemove=function(a){this.p=
{x:a.p.x-2,y:a.p.y-3};this.repaint()};a.touchstart=function(a){this.mousemove(a)};a.touchmove=function(a){this.mousemove(a)};a.touchend=function(a){this.mouseout(a)};c.SeekerCanvas.SEEK_POINTER="pointer";c.SeekerCanvas.SEEK_PLOT="plot";c.SeekerCanvas.SEEK_PEAK="peak"})(ChemDoodle,Math);
(function(c,b,a,g,f,e,o,d,k,v,l){c._Canvas3D=function(a,b,d){a&&this.create(a,b,d)};var h=c._Canvas3D.prototype=new c._Canvas;h.rotationMatrix=k.identity([]);h.translationMatrix=k.identity([]);h.lastPoint=void 0;h.emptyMessage="WebGL is Unavailable!";h.afterLoadContent=function(){for(var b=new a.Bounds,d=0,c=this.molecules.length;d<c;d++)b.expand(this.molecules[d].getBounds());this.maxDimension=o.max(b.maxX-b.minX,b.maxY-b.minY);this.translationMatrix=k.translate(k.identity([]),[0,0,-this.maxDimension-
10]);this.setupScene()};h.setViewDistance=function(a){this.translationMatrix=k.translate(k.identity([]),[0,0,-a])};h.repaint=function(){if(this.gl){this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT);this.gl.modelViewMatrix=k.multiply(this.translationMatrix,this.rotationMatrix,[]);this.gl.rotationMatrix=this.rotationMatrix;for(var a=0,b=this.molecules.length;a<b;a++)this.molecules[a].render(this.gl,this.specs);a=0;for(b=this.shapes.length;a<b;a++)this.shapes[a].render(this.gl,this.specs);
this.specs.atoms_displayLabels_3D&&this.label3D.render(this.gl,this.specs,this.getMolecules());this.gl.flush()}};h.center=function(){d.getElementById(this.id);for(var a=new g.Atom,b=0,c=this.molecules.length;b<c;b++){var e=this.molecules[b];a.add3D(e.getCenter3D())}a.x/=this.molecules.length;a.y/=this.molecules.length;b=0;for(c=this.molecules.length;b<c;b++){for(var e=this.molecules[b],f=0,h=e.atoms.length;f<h;f++)e.atoms[f].sub3D(a);if(e.chains&&e.fromJSON){f=0;for(h=e.chains.length;f<h;f++)for(var k=
e.chains[f],l=0,o=k.length;l<o;l++){var v=k[l];v.cp1.sub3D(a);v.cp2.sub3D(a);v.cp3&&(v.cp3.sub3D(a),v.cp4.sub3D(a),v.cp5.sub3D(a))}}}};h.subCreate=function(){try{var a=d.getElementById(this.id);this.gl=a.getContext("webgl");this.gl||(this.gl=a.getContext("experimental-webgl"))}catch(b){}this.gl?(this.gl.viewport(0,0,this.width,this.height),this.gl.program=this.gl.createProgram(),this.gl.shader=new f.Shader,this.gl.shader.init(this.gl),this.setupScene()):this.displayMessage()};c._Canvas.prototype.displayMessage=
function(){var a=d.getElementById(this.id);a.getContext&&(a=a.getContext("2d"),this.specs.backgroundColor&&(a.fillStyle=this.specs.backgroundColor,a.fillRect(0,0,this.width,this.height)),this.emptyMessage&&(a.fillStyle="#737683",a.textAlign="center",a.textBaseline="middle",a.font="18px Helvetica, Verdana, Arial, Sans-serif",a.fillText(this.emptyMessage,this.width/2,this.height/2)))};h.setupScene=function(){if(this.gl){var d=a.getRGB(this.specs.backgroundColor,1);this.gl.clearColor(d[0],d[1],d[2],
1);this.gl.clearDepth(1);this.gl.enable(this.gl.DEPTH_TEST);this.gl.depthFunc(this.gl.LEQUAL);this.gl.sphereBuffer=new f.Sphere(1,this.specs.atoms_resolution_3D,this.specs.atoms_resolution_3D);this.gl.starBuffer=new f.Star;this.gl.cylinderBuffer=new f.Cylinder(1,1,this.specs.bonds_resolution_3D);this.gl.lineBuffer=new f.Line;for(var d=0,c=this.molecules.length;d<c;d++){var g=this.molecules[d];g.unitCellVectors&&(g.unitCell=new f.UnitCell(g.unitCellVectors));if(g.chains){g.ribbons=[];g.cartoons=[];
g.tubes=[];for(var h=0,u=g.chains.length;h<u;h++){var q=g.chains[h],r=2<q.length&&e[q[2].name]&&"#BEA06E"===e[q[2].name].aminoColor;if(0<q.length&&!q[0].lineSegments){for(var w=0,p=q.length-1;w<p;w++)q[w].setup(q[w+1].cp1,r?1:this.specs.proteins_horizontalResolution);if(!r){w=1;for(p=q.length-1;w<p;w++)b.vec3AngleFrom(q[w-1].D,q[w].D)>o.PI/2&&(q[w].guidePointsSmall.reverse(),q[w].guidePointsLarge.reverse(),l.scale(q[w].D,-1))}w=1;for(p=q.length-3;w<p;w++)q[w].computeLineSegments(q[w-1],q[w+1],q[w+
2],!r,r?this.specs.nucleics_verticalResolution:this.specs.proteins_verticalResolution);q.pop();q.pop();q.pop();q.shift()}var y=a.hsl2rgb(1===u?0.5:h/u,1,0.5),y="rgb("+y[0]+","+y[1]+","+y[2]+")";q.chainColor=y;if(r)q=new f.Tube(q,this.specs.nucleics_tubeThickness,this.specs.nucleics_tubeResolution_3D),q.chainColor=y,g.tubes.push(q);else{r={front:new f.Ribbon(q,this.specs.proteins_ribbonThickness,!1),back:new f.Ribbon(q,-this.specs.proteins_ribbonThickness,!1)};r.front.chainColor=y;r.back.chainColor=
y;w=0;for(p=r.front.segments.length;w<p;w++)r.front.segments[w].chainColor=y;w=0;for(p=r.back.segments.length;w<p;w++)r.back.segments[w].chainColor=y;g.ribbons.push(r);q={front:new f.Ribbon(q,this.specs.proteins_ribbonThickness,!0),back:new f.Ribbon(q,-this.specs.proteins_ribbonThickness,!0)};q.front.chainColor=y;q.back.chainColor=y;w=0;for(p=q.front.segments.length;w<p;w++)q.front.segments[w].chainColor=y;w=0;for(p=q.back.segments.length;w<p;w++)q.back.segments[w].chainColor=y;w=0;for(p=q.front.cartoonSegments.length;w<
p;w++)q.front.cartoonSegments[w].chainColor=y;w=0;for(p=q.back.cartoonSegments.length;w<p;w++)q.back.cartoonSegments[w].chainColor=y;g.cartoons.push(q)}}}}this.label3D=new f.Label;this.label3D.initialize(this.gl);this.label3D.bindMoleculeLabel(this.gl,this.getMolecules());this.label3D.changeFontTexture(this.gl,this.specs);this.label3D.updateVerticesBuffer(this.gl,this.getMolecules(),this.specs);this.gl.lighting=new f.Light(this.specs.lightDiffuseColor_3D,this.specs.lightSpecularColor_3D,this.specs.lightDirection_3D);
this.gl.lighting.lightScene(this.gl);this.gl.material=new f.Material(this.gl);d=this.width/this.height;this.specs.projectionWidthHeightRatio_3D&&(d=this.specs.projectionWidthHeightRatio_3D);this.gl.projectionMatrix=this.specs.projectionPerspective_3D?k.perspective(this.specs.projectionPerspectiveVerticalFieldOfView_3D,d,this.specs.projectionFrontCulling_3D,this.specs.projectionBackCulling_3D):k.ortho(-this.specs.projectionOrthoWidth_3D/2,this.specs.projectionOrthoWidth_3D/2,-this.specs.projectionOrthoWidth_3D/
2/d,this.specs.projectionOrthoWidth_3D/2/d,this.specs.projectionFrontCulling_3D,this.specs.projectionBackCulling_3D);d=this.gl.getUniformLocation(this.gl.program,"u_projection_matrix");this.gl.uniformMatrix4fv(d,!1,this.gl.projectionMatrix);var z=this.gl.getUniformLocation(this.gl.program,"u_model_view_matrix"),x=this.gl.getUniformLocation(this.gl.program,"u_normal_matrix");this.gl.setMatrixUniforms=function(a){this.uniformMatrix4fv(z,!1,a);a=v.transpose(k.toInverseMat3(a,[]));this.uniformMatrix3fv(x,
!1,a)}}};h.mousedown=function(a){this.lastPoint=a.p};h.rightmousedown=function(a){this.lastPoint=a.p};h.drag=function(a){if(c.monitor.ALT){var b=new g.Point(a.p.x,a.p.y);b.sub(this.lastPoint);k.translate(this.translationMatrix,[b.x/20,-b.y/20,0])}else{var d=a.p.x-this.lastPoint.x,b=a.p.y-this.lastPoint.y,d=k.rotate(k.identity([]),d*o.PI/180,[0,1,0]);k.rotate(d,b*o.PI/180,[1,0,0]);this.rotationMatrix=k.multiply(d,this.rotationMatrix)}this.lastPoint=a.p;this.repaint()};h.mousewheel=function(a,b){var d=
b*this.maxDimension/8;this.specs.projectionPerspective_3D?k.translate(this.translationMatrix,[0,0,d]):(this.specs.projectionOrthoWidth_3D-=d,this.setupScene());this.repaint()}})(ChemDoodle,ChemDoodle.extensions,ChemDoodle.math,ChemDoodle.structures,ChemDoodle.structures.d3,ChemDoodle.RESIDUE,Math,document,mat4,mat3,vec3,window);
(function(c,b,a,g){c.MolGrabberCanvas3D=function(b,c,o){b&&this.create(b,c,o);c=[];c.push('\x3cbr\x3e\x3cinput type\x3d"text" id\x3d"');c.push(b);c.push('_query" size\x3d"32" value\x3d"" /\x3e');c.push("\x3cbr\x3e\x3cnobr\x3e");c.push('\x3cselect id\x3d"');c.push(b);c.push('_select"\x3e');c.push('\x3coption value\x3d"pubchem" selected\x3ePubChem');c.push("\x3c/select\x3e");c.push('\x3cbutton id\x3d"');c.push(b);c.push('_submit"\x3eShow Molecule\x3c/button\x3e');c.push("\x3c/nobr\x3e");g.writeln(c.join(""));
var d=this;a("#"+b+"_submit").click(function(){d.search()});a("#"+b+"_query").keypress(function(a){13===a.which&&d.search()})};c=c.MolGrabberCanvas3D.prototype=new c._Canvas3D;c.setSearchTerm=function(b){a("#"+this.id+"_query").val(b);this.search()};c.search=function(){var c=this;b.getMoleculeFromDatabase(a("#"+this.id+"_query").val(),{database:a("#"+this.id+"_select").val(),dimension:3},function(a){c.loadMolecule(a)})}})(ChemDoodle,ChemDoodle.iChemLabs,jQuery,document);
(function(c,b){c.MovieCanvas3D=function(a,b,c){a&&this.create(a,b,c)};c.MovieCanvas3D.PLAY_ONCE=0;c.MovieCanvas3D.PLAY_LOOP=1;c.MovieCanvas3D.PLAY_SPRING=2;var a=c.MovieCanvas3D.prototype=new c._Canvas3D;a.timeout=50;a.frames=[];a.frameNumber=0;a.playMode=2;a.reverse=!1;a.startAnimation=c._AnimatorCanvas.prototype.startAnimation;a.stopAnimation=c._AnimatorCanvas.prototype.stopAnimation;a.isRunning=c._AnimatorCanvas.prototype.isRunning;a.dblclick=c.RotatorCanvas.prototype.dblclick;a.nextFrame=function(){var a=
this.frames[this.frameNumber];this.molecules=a.mols;this.shapes=a.shapes;2===this.playMode&&this.reverse?(this.frameNumber--,0>this.frameNumber&&(this.frameNumber=1,this.reverse=!1)):(this.frameNumber++,this.frameNumber>=this.frames.length&&(2===this.playMode?(this.frameNumber-=2,this.reverse=!0):(this.frameNumber=0,0===this.playMode&&this.stopAnimation())))};a.center=function(){for(var a=new b.Atom,c=this.frames[0],e=0,o=c.mols.length;e<o;e++)a.add3D(c.mols[e].getCenter3D());a.x/=c.mols.length;a.y/=
c.mols.length;c=new b.Atom;c.sub3D(a);for(var a=0,d=this.frames.length;a<d;a++)for(var k=this.frames[a],e=0,o=k.mols.length;e<o;e++)for(var v=k.mols[e],l=0,h=v.atoms.length;l<h;l++)v.atoms[l].add3D(c)};a.addFrame=function(a,b){this.frames.push({mols:a,shapes:b})}})(ChemDoodle,ChemDoodle.structures);
(function(c,b,a){var g=[],f=[1,0,0],e=[0,1,0],o=[0,0,1];c.RotatorCanvas3D=function(a,b,d){a&&this.create(a,b,d)};var d=c.RotatorCanvas3D.prototype=new c._Canvas3D;d.timeout=33;b=b.PI/15;d.xIncrement=b;d.yIncrement=b;d.zIncrement=b;d.startAnimation=c._AnimatorCanvas.prototype.startAnimation;d.stopAnimation=c._AnimatorCanvas.prototype.stopAnimation;d.isRunning=c._AnimatorCanvas.prototype.isRunning;d.dblclick=c.RotatorCanvas.prototype.dblclick;d.mousedown=void 0;d.rightmousedown=void 0;d.drag=void 0;
d.mousewheel=void 0;d.nextFrame=function(b){0===this.molecules.length&&0===this.shapes.length?this.stopAnimation():(a.identity(g),b/=1E3,a.rotate(g,this.xIncrement*b,f),a.rotate(g,this.yIncrement*b,e),a.rotate(g,this.zIncrement*b,o),a.multiply(this.rotationMatrix,g))}})(ChemDoodle,Math,mat4);(function(c){c.TransformCanvas3D=function(b,a,c){b&&this.create(b,a,c)};c.TransformCanvas3D.prototype=new c._Canvas3D})(ChemDoodle);
(function(c){c.ViewerCanvas3D=function(b,a,c){b&&this.create(b,a,c)};c=c.ViewerCanvas3D.prototype=new c._Canvas3D;c.mousedown=void 0;c.rightmousedown=void 0;c.drag=void 0;c.mousewheel=void 0})(ChemDoodle);
(function(c,b,a){function g(a,b,d,c){this.element=a;this.x=b;this.y=d;this.dimension=c}c.PeriodicTableCanvas=function(a,b){this.padding=5;a&&this.create(a,18*b+2*this.padding,10*b+2*this.padding);this.cellDimension=b?b:20;this.setupTable();this.repaint()};var f=c.PeriodicTableCanvas.prototype=new c._Canvas;f.loadMolecule=void 0;f.getMolecule=void 0;f.getHoveredElement=function(){if(this.hovered)return this.hovered.element};f.innerRepaint=function(a){for(var b=0,d=this.cells.length;b<d;b++)this.drawCell(a,
this.specs,this.cells[b]);this.hovered&&this.drawCell(a,this.specs,this.hovered);this.selected&&this.drawCell(a,this.specs,this.selected)};f.setupTable=function(){this.cells=[];for(var a=this.padding,b=this.padding,d=0,f=0,v=c.SYMBOLS.length;f<v;f++){18===d&&(d=0,b+=this.cellDimension,a=this.padding);var l=c.ELEMENT[c.SYMBOLS[f]];if(2===l.atomicNumber)a+=16*this.cellDimension,d+=16;else if(5===l.atomicNumber||13===l.atomicNumber)a+=10*this.cellDimension,d+=10;if((58>l.atomicNumber||71<l.atomicNumber&&
90>l.atomicNumber||103<l.atomicNumber)&&113>l.atomicNumber)this.cells.push(new g(l,a,b,this.cellDimension)),a+=this.cellDimension,d++}b+=2*this.cellDimension;a=3*this.cellDimension+this.padding;for(f=57;104>f;f++)if(l=c.ELEMENT[c.SYMBOLS[f]],90===l.atomicNumber&&(b+=this.cellDimension,a=3*this.cellDimension+this.padding),58<=l.atomicNumber&&71>=l.atomicNumber||90<=l.atomicNumber&&103>=l.atomicNumber)this.cells.push(new g(l,a,b,this.cellDimension)),a+=this.cellDimension};f.drawCell=function(a,c,d){var f=
a.createRadialGradient(d.x+d.dimension/3,d.y+d.dimension/3,1.5*d.dimension,d.x+d.dimension/3,d.y+d.dimension/3,d.dimension/10);f.addColorStop(0,"#000000");f.addColorStop(0.7,d.element.jmolColor);f.addColorStop(1,"#FFFFFF");a.fillStyle=f;b.contextRoundRect(a,d.x,d.y,d.dimension,d.dimension,d.dimension/8);if(d===this.hovered||d===this.selected)a.lineWidth=2,a.strokeStyle="#c10000",a.stroke(),a.fillStyle="white";a.fill();a.font=c.getFontString(c.text_font_size,c.text_font_families);a.fillStyle=c.text_color;
a.textAlign="center";a.textBaseline="middle";a.fillText(d.element.symbol,d.x+d.dimension/2,d.y+d.dimension/2)};f.click=function(){this.hovered&&(this.selected=this.hovered,this.repaint())};f.mousemove=function(b){var c=b.p.x;b=b.p.y;this.hovered=void 0;for(var d=0,f=this.cells.length;d<f;d++){var g=this.cells[d];if(a.isBetween(c,g.x,g.x+g.dimension)&&a.isBetween(b,g.y,g.y+g.dimension)){this.hovered=g;break}}this.repaint()};f.mouseout=function(){this.hovered=void 0;this.repaint()}})(ChemDoodle,ChemDoodle.extensions,
ChemDoodle.math,document);(function(c,b,a){c.png={};c.png.create=function(c){a.open(b.getElementById(c.id).toDataURL("image/png"))}})(ChemDoodle.io,document,window);(function(c,b){c.file={};c.file.content=function(a,c){b.get(a,"",c)}})(ChemDoodle.io,jQuery);
(function(c,b,a,g,f){b.SERVER_URL="http://ichemlabs.cloud.chemdoodle.com/icl_cdc_v050000/WebHQ";b.inRelay=!1;b.asynchronous=!0;b.INFO={userAgent:navigator.userAgent,v_cwc:c.getVersion(),v_jQuery:f.version,v_jQuery_ui:f.ui?f.ui.version:"N/A"};var e=new a.JSONInterpreter;b._contactServer=function(a,d,c,e,g){this.inRelay?alert("Already connecting to the server, please wait for the first request to finish."):(b.inRelay=!0,f.ajax({dataType:"text",type:"POST",data:JSON.stringify({call:a,content:d,options:c,
info:b.INFO}),url:this.SERVER_URL,success:function(a){b.inRelay=!1;a=JSON.parse(a);a.message&&alert(a.message);e&&(a.content&&!a.stop)&&e(a.content);a.stop&&g&&g()},error:function(){b.inRelay=!1;alert("Call failed. Please try again. If you continue to see this message, please contact iChemLabs customer support.");g&&g()},xhrFields:{withCredentials:!0},async:b.asynchronous}))};b.authenticate=function(a,b,c,e){this._contactServer("authenticate",{credential:a},b,function(a){c(a)},e)};b.calculate=function(a,
b,c,f){this._contactServer("calculate",{mol:e.molTo(a)},b,function(a){c(a)},f)};b.generateImage=function(a,b,c,f){this._contactServer("generateImage",{mol:e.molTo(a)},b,function(a){c(a.link)},f)};b.getAd=function(a,b){this._contactServer("getAd",{},{},function(b){a(b.image_url,b.target_url)},b)};b.getMoleculeFromContent=function(a,b,c,f){this._contactServer("getMoleculeFromContent",{content:a},b,function(a){for(var b=!1,d=0,f=a.mol.a.length;d<f;d++)if(0!==a.mol.a[d].z){b=!0;break}if(b){d=0;for(f=
a.mol.a.length;d<f;d++)a.mol.a[d].x/=20,a.mol.a[d].y/=20,a.mol.a[d].z/=20}c(e.molFrom(a.mol))},f)};b.getMoleculeFromDatabase=function(a,b,c,f){this._contactServer("getMoleculeFromDatabase",{query:a},b,function(a){if(3===b.dimension)for(var f=0,g=a.mol.a.length;f<g;f++)a.mol.a[f].x/=20,a.mol.a[f].y/=-20,a.mol.a[f].z/=20;c(e.molFrom(a.mol))},f)};b.getOptimizedPDBStructure=function(a,b,c,f){this._contactServer("getOptimizedPDBStructure",{id:a},b,function(a){var b;b=a.mol?e.molFrom(a.mol):new g.Molecule;
b.chains=e.chainsFrom(a.ribbons);b.fromJSON=!0;c(b)},f)};b.getZeoliteFromIZA=function(a,b,c,e){this._contactServer("getZeoliteFromIZA",{query:a},b,function(a){c(ChemDoodle.readCIF(a.cif,b.xSuper,b.ySuper,b.zSuper))},e)};b.isGraphIsomorphism=function(a,b,c,f,g){this._contactServer("isGraphIsomorphism",{arrow:e.molTo(a),target:e.molTo(b)},c,function(a){f(a.value)},g)};b.isSubgraphIsomorphism=function(a,b,c,f,g){this._contactServer("isSubgraphIsomorphism",{arrow:e.molTo(a),target:e.molTo(b)},c,function(a){f(a.value)},
g)};b.kekulize=function(a,b,c,f){this._contactServer("kekulize",{mol:e.molTo(a)},b,function(a){c(e.molFrom(a.mol))},f)};b.optimize=function(a,b,c,f){this._contactServer("optimize",{mol:e.molTo(a)},b,function(f){f=e.molFrom(f.mol);if(2===b.dimension){for(var g=0,j=f.atoms.length;g<j;g++)a.atoms[g].x=f.atoms[g].x,a.atoms[g].y=f.atoms[g].y;c()}else if(3===b.dimension){g=0;for(j=f.atoms.length;g<j;g++)f.atoms[g].x/=20,f.atoms[g].y/=-20,f.atoms[g].z/=20;c(f)}},f)};b.readIUPACName=function(a,b,c,f){this._contactServer("readIUPACName",
{iupac:a},b,function(a){c(e.molFrom(a.mol))},f)};b.readSMILES=function(a,b,c,f){this._contactServer("readSMILES",{smiles:a},b,function(a){c(e.molFrom(a.mol))},f)};b.saveFile=function(a,b,c,f){this._contactServer("saveFile",{mol:e.molTo(a)},b,function(a){c(a.link)},f)};b.simulate13CNMR=function(a,b,f,g){b.nucleus="C";b.isotope=13;this._contactServer("simulateNMR",{mol:e.molTo(a)},b,function(a){f(c.readJCAMP(a.jcamp))},g)};b.simulate1HNMR=function(a,b,f,g){b.nucleus="H";b.isotope=1;this._contactServer("simulateNMR",
{mol:e.molTo(a)},b,function(a){f(c.readJCAMP(a.jcamp))},g)};b.simulateMassParentPeak=function(a,b,f,g){this._contactServer("simulateMassParentPeak",{mol:e.molTo(a)},b,function(a){f(c.readJCAMP(a.jcamp))},g)};b.writeSMILES=function(a,b,c,f){this._contactServer("writeSMILES",{mol:e.molTo(a)},b,function(a){c(a.smiles)},f)}})(ChemDoodle,ChemDoodle.iChemLabs,ChemDoodle.io,ChemDoodle.structures,jQuery);