Files
cdnjs/ajax/libs/processing.js/1.2.1/processing-api.min.js
T

340 lines
173 KiB
JavaScript

(function(Q,B,j,ec,p){function Ja(d,j){if(d in Q)return Q[d];return typeof Q[j]==="function"?Q[j]:function(d){if(d instanceof Array)return d;else if(typeof d==="number"){var j=[];j.length=d;return j}}}function yb(d){if(d.constructor===String){for(var x=0,Ka=0;Ka<d.length;++Ka)x=x*31+d.charCodeAt(Ka)&4294967295;return x}else if(typeof d!=="object")return d&4294967295;else if(d.hashCode instanceof Function)return d.hashCode();else{if(d.$id===p)d.$id=j.floor(j.random()*65536)-32768<<16|j.floor(j.random()*
65536);return d.$id}}function qa(d,j){return d===null||j===null?d===null&&j===null:d.constructor===String?d===j:typeof d!=="object"?d===j:d.equals instanceof Function?d.equals(j):d===j}function Jb(){}var La=function(){return"console"in Q?function(d){Q.console.log("Processing.js: "+d)}:ec()}(),fc=function(d){var j=new XMLHttpRequest;j.open("GET",d,!1);j.overrideMimeType&&j.overrideMimeType("text/plain");j.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");j.send(null);if(j.status!==
200&&j.status!==0)throw"XMLHttpRequest failed, status code "+j.status;return j.responseText},va="document"in this&&!("fake"in this.document);(function(){try{if(!("createImageData"in CanvasRenderingContext2D.prototype))CanvasRenderingContext2D.prototype.createImageData=function(d,j){return new ImageData(d,j)}}catch(d){}})();var G=Ja("Float32Array","WebGLFloatArray"),td=Ja("Int32Array","WebGLIntArray"),ud=Ja("Uint16Array","WebGLUnsignedShortArray"),Ic=Ja("Uint8Array","WebGLUnsignedByteArray"),d={X:0,
Y:1,Z:2,R:3,G:4,B:5,A:6,U:7,V:8,NX:9,NY:10,NZ:11,EDGE:12,SR:13,SG:14,SB:15,SA:16,SW:17,TX:18,TY:19,TZ:20,VX:21,VY:22,VZ:23,VW:24,AR:25,AG:26,AB:27,DR:3,DG:4,DB:5,DA:6,SPR:28,SPG:29,SPB:30,SHINE:31,ER:32,EG:33,EB:34,BEEN_LIT:35,VERTEX_FIELD_COUNT:36,P2D:1,JAVA2D:1,WEBGL:2,P3D:2,OPENGL:2,PDF:0,DXF:0,OTHER:0,WINDOWS:1,MAXOSX:2,LINUX:3,EPSILON:1.0E-4,MAX_FLOAT:3.4028235E38,MIN_FLOAT:-3.4028235E38,MAX_INT:2147483647,MIN_INT:-2147483648,PI:j.PI,TWO_PI:2*j.PI,HALF_PI:j.PI/2,THIRD_PI:j.PI/3,QUARTER_PI:j.PI/
4,DEG_TO_RAD:j.PI/180,RAD_TO_DEG:180/j.PI,WHITESPACE:" \t\n\r\u000c\u00a0",RGB:1,ARGB:2,HSB:3,ALPHA:4,CMYK:5,TIFF:0,TARGA:1,JPEG:2,GIF:3,BLUR:11,GRAY:12,INVERT:13,OPAQUE:14,POSTERIZE:15,THRESHOLD:16,ERODE:17,DILATE:18,REPLACE:0,BLEND:1,ADD:2,SUBTRACT:4,LIGHTEST:8,DARKEST:16,DIFFERENCE:32,EXCLUSION:64,MULTIPLY:128,SCREEN:256,OVERLAY:512,HARD_LIGHT:1024,SOFT_LIGHT:2048,DODGE:4096,BURN:8192,ALPHA_MASK:4278190080,RED_MASK:16711680,GREEN_MASK:65280,BLUE_MASK:255,CUSTOM:0,ORTHOGRAPHIC:2,PERSPECTIVE:3,POINT:2,
POINTS:2,LINE:4,LINES:4,TRIANGLE:8,TRIANGLES:9,TRIANGLE_STRIP:10,TRIANGLE_FAN:11,QUAD:16,QUADS:16,QUAD_STRIP:17,POLYGON:20,PATH:21,RECT:30,ELLIPSE:31,ARC:32,SPHERE:40,BOX:41,GROUP:0,PRIMITIVE:1,GEOMETRY:3,VERTEX:0,BEZIER_VERTEX:1,CURVE_VERTEX:2,BREAK:3,CLOSESHAPE:4,OPEN:1,CLOSE:2,CORNER:0,CORNERS:1,RADIUS:2,CENTER_RADIUS:2,CENTER:3,DIAMETER:3,CENTER_DIAMETER:3,BASELINE:0,TOP:101,BOTTOM:102,NORMAL:1,NORMALIZED:1,IMAGE:2,MODEL:4,SHAPE:5,SQUARE:"butt",ROUND:"round",PROJECT:"square",MITER:"miter",BEVEL:"bevel",
AMBIENT:0,DIRECTIONAL:1,SPOT:3,BACKSPACE:8,TAB:9,ENTER:10,RETURN:13,ESC:27,DELETE:127,CODED:65535,SHIFT:16,CONTROL:17,ALT:18,CAPSLK:20,PGUP:33,PGDN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLK:144,META:157,INSERT:155,ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",NOCURSOR:"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto",
DISABLE_OPENGL_2X_SMOOTH:1,ENABLE_OPENGL_2X_SMOOTH:-1,ENABLE_OPENGL_4X_SMOOTH:2,ENABLE_NATIVE_FONTS:3,DISABLE_DEPTH_TEST:4,ENABLE_DEPTH_TEST:-4,ENABLE_DEPTH_SORT:5,DISABLE_DEPTH_SORT:-5,DISABLE_OPENGL_ERROR_REPORT:6,ENABLE_OPENGL_ERROR_REPORT:-6,ENABLE_ACCURATE_TEXTURES:7,DISABLE_ACCURATE_TEXTURES:-7,HINT_COUNT:10,SINCOS_LENGTH:parseInt(720,10),PRECISIONB:15,PRECISIONF:32768,PREC_MAXVAL:32767,PREC_ALPHA_SHIFT:9,PREC_RED_SHIFT:1,NORMAL_MODE_AUTO:0,NORMAL_MODE_SHAPE:1,NORMAL_MODE_VERTEX:2,MAX_LIGHTS:8},
Ma=function(d){if(d.iterator instanceof Function)return d.iterator();else if(d instanceof Array){var j=-1;this.hasNext=function(){return++j<d.length};this.next=function(){return d[j]}}else throw"Unable to iterate: "+d;},gc=function(){function d(j){var q=0;this.hasNext=function(){return q<j.length};this.next=function(){return j[q++]};this.remove=function(){j.splice(q,1)}}function j(){var p;arguments.length===0?p=[]:arguments.length>0&&typeof arguments[0]!=="number"?p=arguments[0]:(p=[],p.length=0|
arguments[0]);this.get=function(d){return p[d]};this.contains=function(d){return this.indexOf(d)>-1};this.indexOf=function(d){for(var j=0,q=p.length;j<q;++j)if(qa(d,p[j]))return j;return-1};this.add=function(){if(arguments.length===1)p.push(arguments[0]);else if(arguments.length===2){var d=arguments[0];if(typeof d==="number")if(d>=0&&d<=p.length)p.splice(d,0,arguments[1]);else throw d+" is not a valid index";else throw typeof d+" is not a number";}else throw"Please use the proper number of parameters.";
};this.addAll=function(d,j){var q;if(typeof d==="number"){if(d<0||d>p.length)throw"Index out of bounds for addAll: "+d+" greater or equal than "+p.length;for(q=new Ma(j);q.hasNext();)p.splice(d++,0,q.next())}else for(q=new Ma(d);q.hasNext();)p.push(q.next())};this.set=function(){if(arguments.length===2){var d=arguments[0];if(typeof d==="number")if(d>=0&&d<p.length)p.splice(d,1,arguments[1]);else throw d+" is not a valid index.";else throw typeof d+" is not a number";}else throw"Please use the proper number of parameters.";
};this.size=function(){return p.length};this.clear=function(){p.length=0};this.remove=function(d){if(typeof d==="number")return p.splice(d,1)[0];else{d=this.indexOf(d);if(d>-1)return p.splice(d,1),!0;return!1}};this.isEmpty=function(){return!p.length};this.clone=function(){return new j(p.slice(0))};this.toArray=function(){return p.slice(0)};this.iterator=function(){return new d(p)}}return j}(),hc=function(){function d(){function j(d){d=yb(d)%E.length;return d<0?E.length+d:d}function y(){if(!(B<=J*
E.length)){for(var d=[],q=0;q<E.length;++q)E[q]!==p&&(d=d.concat(E[q]));q=E.length*2;E=[];E.length=q;for(q=0;q<d.length;++q){var u=j(d[q].key),ha=E[u];ha===p&&(E[u]=ha=[]);ha.push(d[q])}}}function t(d,j){function q(){for(;!t;)if(++x,u>=E.length)t=!0;else if(E[u]===p||x>=E[u].length)x=-1,++u;else break}var u=0,x=-1,t=!1;this.hasNext=function(){return!t};this.next=function(){var j=d(E[u][x]);q();return j};this.remove=function(){j(this.next());--x};q()}function H(d,j,q){this.clear=function(){G.clear()};
this.contains=function(d){return j(d)};this.containsAll=function(d){for(d=d.iterator();d.hasNext();)if(!this.contains(d.next()))return!1;return!0};this.isEmpty=function(){return G.isEmpty()};this.iterator=function(){return new t(d,q)};this.remove=function(d){if(this.contains(d))return q(d),!0;return!1};this.removeAll=function(d){for(d=d.iterator();d.hasNext();){var j=d.next();this.contains(j)&&q(j)}return!0};this.retainAll=function(d){for(var j=this.iterator(),p=[];j.hasNext();){var u=j.next();d.contains(u)||
p.push(u)}for(d=0;d<p.length;++d)q(p[d]);return p.length>0};this.size=function(){return G.size()};this.toArray=function(){for(var d=[],j=this.iterator();j.hasNext();)d.push(j.next());return d}}function u(d){this._isIn=function(j){return j===G&&d.removed===p};this.equals=function(j){return qa(d.key,j.getKey())};this.getKey=function(){return d.key};this.getValue=function(){return d.value};this.hashCode=function(){return yb(d.key)};this.setValue=function(j){var q=d.value;d.value=j;return q}}if(arguments.length===
1&&arguments[0].constructor===d)return arguments[0].clone();var X=arguments.length>0?arguments[0]:16,J=arguments.length>1?arguments[1]:0.75,E=[];E.length=X;var B=0,G=this;this.clear=function(){B=0;E=[];E.length=X};this.clone=function(){var j=new d;j.putAll(this);return j};this.containsKey=function(d){var q=j(d),q=E[q];if(q===p)return!1;for(var u=0;u<q.length;++u)if(qa(q[u].key,d))return!0;return!1};this.containsValue=function(d){for(var j=0;j<E.length;++j){var q=E[j];if(q!==p)for(var u=0;u<q.length;++u)if(qa(q[u].value,
d))return!0}return!1};this.entrySet=function(){return new H(function(d){return new u(d)},function(d){return d.constructor===u&&d._isIn(G)},function(d){return G.remove(d.getKey())})};this.get=function(d){var q=j(d),q=E[q];if(q===p)return null;for(var u=0;u<q.length;++u)if(qa(q[u].key,d))return q[u].value;return null};this.isEmpty=function(){return B===0};this.keySet=function(){return new H(function(d){return d.key},function(d){return G.containsKey(d)},function(d){return G.remove(d)})};this.put=function(d,
q){var u=j(d),t=E[u];if(t===p)return++B,E[u]=[{key:d,value:q}],y(),null;for(u=0;u<t.length;++u)if(qa(t[u].key,d)){var J=t[u].value;t[u].value=q;return J}++B;t.push({key:d,value:q});y();return null};this.putAll=function(d){for(d=d.entrySet().iterator();d.hasNext();){var j=d.next();this.put(j.getKey(),j.getValue())}};this.remove=function(d){var q=j(d),u=E[q];if(u===p)return null;for(var t=0;t<u.length;++t)if(qa(u[t].key,d))return--B,d=u[t].value,u[t].removed=!0,u.length>1?u.splice(t,1):E[q]=p,d;return null};
this.size=function(){return B};this.values=function(){for(var d=[],j=this.entrySet().iterator();j.hasNext();){var q=j.next();d.push(q.getValue())}return d}}return d}(),V=function(){function d(j,q,p){this.x=j||0;this.y=q||0;this.z=p||0}function p(d){return function(j,q){var p=j.get();p[d](q);return p}}function y(d){return function(j,q){return j[d](q)}}var t="dist dot cross".split(" "),H=t.length;d.angleBetween=function(d,q){return j.acos(d.dot(q)/(d.mag()*q.mag()))};for(d.prototype={set:function(d,
j,q){arguments.length===1?this.set(d.x||d[0],d.y||d[1],d.z||d[2]):(this.x=d,this.y=j,this.z=q)},get:function(){return new d(this.x,this.y,this.z)},mag:function(){return j.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},add:function(d,j,q){arguments.length===3?(this.x+=d,this.y+=j,this.z+=q):arguments.length===1&&(this.x+=d.x,this.y+=d.y,this.z+=d.z)},sub:function(d,j,q){arguments.length===3?(this.x-=d,this.y-=j,this.z-=q):arguments.length===1&&(this.x-=d.x,this.y-=d.y,this.z-=d.z)},mult:function(d){typeof d===
"number"?(this.x*=d,this.y*=d,this.z*=d):typeof d==="object"&&(this.x*=d.x,this.y*=d.y,this.z*=d.z)},div:function(d){typeof d==="number"?(this.x/=d,this.y/=d,this.z/=d):typeof d==="object"&&(this.x/=d.x,this.y/=d.y,this.z/=d.z)},dist:function(d){var q=this.x-d.x,p=this.y-d.y,d=this.z-d.z;return j.sqrt(q*q+p*p+d*d)},dot:function(d,j,q){if(arguments.length===3)return this.x*d+this.y*j+this.z*q;else if(arguments.length===1)return this.x*d.x+this.y*d.y+this.z*d.z},cross:function(j){return new d(this.y*
j.z-j.y*this.z,this.z*j.x-j.z*this.x,this.x*j.y-j.x*this.y)},normalize:function(){var d=this.mag();d>0&&this.div(d)},limit:function(d){this.mag()>d&&(this.normalize(),this.mult(d))},heading2D:function(){return-j.atan2(-this.y,this.x)},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};H--;)d[t[H]]=y(t[H]);for(H in d.prototype)d.prototype.hasOwnProperty(H)&&!d.hasOwnProperty(H)&&(d[H]=p(H));return d}();Jb.prototype=d;var Na=new Jb;Na.ArrayList=
gc;Na.HashMap=hc;Na.PVector=V;Na.ObjectIterator=Ma;var Kb={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"},ib=[],Lb={},y=this.Processing=function(q,x){function Ka(a){y.debug("Unimplemented - "+a)}function t(a,b,f,c){var e=xa.locations[a];e===p&&(e=h.getUniformLocation(b,f),xa.locations[a]=e);e!==-1&&
(c.length===4?h.uniform4fv(e,c):c.length===3?h.uniform3fv(e,c):c.length===2?h.uniform2fv(e,c):h.uniform1f(e,c))}function H(a,b,f,c){var e=xa.locations[a];e===p&&(e=h.getUniformLocation(b,f),xa.locations[a]=e);e!==-1&&(c.length===4?h.uniform4iv(e,c):c.length===3?h.uniform3iv(e,c):c.length===2?h.uniform2iv(e,c):h.uniform1i(e,c))}function u(a,b,f,c,e){var d=xa.attributes[a];d===p&&(d=h.getAttribLocation(b,f),xa.attributes[a]=d);d!==-1&&(h.bindBuffer(h.ARRAY_BUFFER,e),h.vertexAttribPointer(d,c,h.FLOAT,
!1,0,0),h.enableVertexAttribArray(d))}function X(a,b,f){var c=xa.attributes[a];c===p&&(c=h.getAttribLocation(b,f),xa.attributes[a]=c);c!==-1&&h.disableVertexAttribArray(c)}function J(a,b,f,c,e){var d=xa.locations[a];d===p&&(d=h.getUniformLocation(b,f),xa.locations[a]=d);d!==-1&&(e.length===16?h.uniformMatrix4fv(d,c,e):e.length===9?h.uniformMatrix3fv(d,c,e):h.uniformMatrix2fv(d,c,e))}function E(a,b,f,m){ya===d.HSB?(f=c.color.toRGB(a,b,f),a=f[0],b=f[1],f=f[2]):(a=j.round(255*(a/ca)),b=j.round(255*(b/
ra)),f=j.round(255*(f/ia)));m=j.round(255*(m/ja));return(m>255?255:m)<<24&d.ALPHA_MASK|(a>255?255:a)<<16&d.RED_MASK|(b>255?255:b)<<8&d.GREEN_MASK|(f>255?255:f)&d.BLUE_MASK}function Ab(){h.restore();Oa=Mb=!0}function Kc(a,b){var f=1;f<<=b-1;for(var c="",e=0;e<b;e++)c+=f&a?"1":"0",f>>>=1;return c}function zb(a,b,f,c,e,d){b=a<0?f:b;f=e===0;e=e===p||e<0?0:e;a=j.abs(a);if(f){e=1;for(a*=10;j.abs(j.round(a)-a)>1.0E-6&&e<7;)++e,a*=10}else e!==0&&(a*=j.pow(10,e));f=a*2;j.floor(a)===a?f=a:j.floor(f)===f?(a=
j.floor(a),f=a+a%2):f=j.round(a);a="";for(c+=e;c>0||f>0;)c--,a=""+f%10+a,f=j.floor(f/10);if(d!==p)for(c=a.length-3-e;c>0;)a=a.substring(0,c)+d+a.substring(c),c-=3;return e>0?b+a.substring(0,a.length-e)+"."+a.substring(a.length-e,a.length):b+a}function wa(a,b,f,c,e,d){if(a instanceof Array){for(var i=[],k=0,l=a.length;k<l;k++)i.push(zb(a[k],b,f,c,e,d));return i}else return zb(a,b,f,c,e,d)}function qa(a){a=parseInt("0x"+a,16);a>2147483647&&(a-=4294967296);return a}function ha(a){return Array.prototype.slice.call(a,
1)}function Aa(a){if(typeof a==="number")return a!==0;else if(typeof a==="boolean")return a;else if(typeof a==="string")return a.toLowerCase()==="true";else if(a instanceof ka)return a.code===49||a.code===84||a.code===116}function va(a){if(typeof a==="number")return a;else if(typeof a==="boolean")return a?1:0;else if(typeof a==="string")return parseFloat(a);else if(a instanceof ka)return a.code}function Jc(a,b){if(typeof a==="number")return a&4294967295;else if(typeof a==="boolean")return a?1:0;else if(typeof a===
"string")return parseInt(a,b||10)&4294967295;else if(a instanceof ka)return a.code}function Pa(a,b){var f=a||362436069,c=b||521288629,e=function(){f=36969*(f&65535)+(f>>>16)&4294967295;c=18E3*(c&65535)+(c>>>16)&4294967295;return((f&65535)<<16|c&65535)&4294967295};this.nextDouble=function(){var a=e()/4294967296;return a<0?1+a:a};this.nextInt=e}function vd(a){function b(a,b,f,c){a&=15;var m=a<8?b:f,b=a<4?f:a===12||a===14?b:c;return((a&1)===0?m:-m)+((a&2)===0?b:-b)}function f(a,b,f){b=(a&1)===0?b:f;
return(a&2)===0?-b:b}function c(a,b,f){return b+a*(f-b)}var a=a!==p?new Pa(a):Pa.createRandomized(),e,d,i=new Ic(512);for(e=0;e<256;++e)i[e]=e;for(e=0;e<256;++e){var k=i[d=a.nextInt()&255];i[d]=i[e];i[e]=k}for(e=0;e<256;++e)i[e+256]=i[e];this.noise3d=function(a,f,e){var d=j.floor(a)&255,g=j.floor(f)&255,k=j.floor(e)&255;a-=j.floor(a);f-=j.floor(f);e-=j.floor(e);var h=(3-2*a)*a*a,o=(3-2*f)*f*f,r=i[d]+g,q=i[r]+k,r=i[r+1]+k,g=i[d+1]+g,d=i[g]+k,k=i[g+1]+k;return c((3-2*e)*e*e,c(o,c(h,b(i[q],a,f,e),b(i[d],
a-1,f,e)),c(h,b(i[r],a,f-1,e),b(i[k],a-1,f-1,e))),c(o,c(h,b(i[q+1],a,f,e-1),b(i[d+1],a-1,f,e-1)),c(h,b(i[r+1],a,f-1,e-1),b(i[k+1],a-1,f-1,e-1))))};this.noise2d=function(a,b){var e=j.floor(a)&255,d=j.floor(b)&255;a-=j.floor(a);b-=j.floor(b);var g=(3-2*a)*a*a,k=i[e]+d,e=i[e+1]+d;return c((3-2*b)*b*b,c(g,f(i[k],a,b),f(i[e],a-1,b)),c(g,f(i[k+1],a,b-1),f(i[e+1],a-1,b-1)))};this.noise1d=function(a){var b=j.floor(a)&255;a-=j.floor(a);return c((3-2*a)*a*a,(i[b]&1)===0?-a:a,(i[b+1]&1)===0?-(a-1):a-1)}}function S(){if(P){if(Oa)h.fillStyle=
c.color.toString(Qa),Oa=!1;h.fill()}}function da(){if(L){if(Mb)h.strokeStyle=c.color.toString(Y),Mb=!1;h.stroke()}}function Wa(a,b,f){f=0|f*((b&d.ALPHA_MASK)>>>24);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.mix(a&d.RED_MASK,b&d.RED_MASK,f)&d.RED_MASK|c.mix(a&d.GREEN_MASK,b&d.GREEN_MASK,f)&d.GREEN_MASK|c.mix(a&d.BLUE_MASK,b&d.BLUE_MASK,f)}function Z(a,b,f){var c=Lc.shift();if(c===p)c={},c.canvas=B.createElement("canvas"),c.context=c.canvas.getContext("2d");Lc.push(c);var e=c.canvas,d=c.context,
b=b||a.width,f=f||a.height;e.width=b;e.height=f;a?"data"in a?d.putImageData(a,0,0):(d.clearRect(0,0,b,f),d.drawImage(a,0,0,b,f)):d.clearRect(0,0,b,f);return c}function Ba(){Bb&&(h=Mc,Bb=!1,c.updatePixels())}function wd(){function a(a,b){a[b]=function(){Ba();h[b].apply(h,arguments)}}function b(a,b){c.defineProperty(a,b,{get:function(){Ba();return h[b]},set:function(a){Ba();h[b]=a}})}for(var f in h)typeof h[f]==="function"?a(this,f):b(this,f)}function Ra(a){this.name="sans-serif";if(a!==p)switch(a){case "sans-serif":case "serif":case "monospace":case "fantasy":case "cursive":this.name=
a;break;default:this.name='"'+a+'", sans-serif'}this.origName=a}function Ca(a){return a instanceof String?a:typeof a==="number"?a===(0|a)?a.toString():c.nf(a,0,3):a===null||a===p?"":a.toString()}function Nc(a,b,f,c){this.canvas=B.createElement("canvas");this.canvas.setAttribute("width",b+"px");this.canvas.setAttribute("height",b+"px");this.ctx=this.canvas.getContext("2d");this.ctx.font=b+"pt "+a;this.ctx.fillStyle="black";this.ctx.fillRect(0,0,b,b);this.ctx.fillStyle="white";this.ctx.fillText(c,0,
f);this.imageData=this.ctx.getImageData(0,0,b,b);this.get=function(a,b){return this.imageData.data[b*this.imageData.width*4+a*4]}}function Oc(a,b,f,c){var e;a.indexOf("\n")<0?(a=[a],e=1):(a=a.split(/\r?\n/g),e=a.length);var g;g=jb===d.TOP?(1-Nb)*Xa:jb===d.CENTER?(1-Nb-e/2)*Xa:jb===d.BOTTOM?(1-Nb-e)*Xa:0;for(var i=0;i<e;++i)$.text$line(a[i],b,f+g,c,kb),g+=Xa}function Pc(a,b,f,c,e,g){if(!(a.length===0||c===0||e===0)&&!(N>e)){var i=-1,k=0,l=0,j=0;h.font=N+"px "+W.name;for(var o=[],q=0,n=a.length;q<n;q++){var p=
a[q],s=p===" ",x=h.measureText(p).width;if(p!=="\n"&&l+x<c)s&&(i=q),l+=x;else{if(i+1===k)if(q>0)i=q;else return;p==="\n"?(o.push({text:a.substring(k,q),width:l,offset:j}),k=q+1):(o.push({text:a.substring(k,i),width:l,offset:j}),k=i+1);j+=Xa;l=0;q=k-1}}k<n&&o.push({text:a.substring(k),width:l,offset:j});a=0;kb===d.CENTER?a=c/2:kb===d.RIGHT&&(a=c);c=(1-Nb)*N;i=0;jb===d.BOTTOM?i=e-o.length*Xa:jb===d.CENTER&&(i=(e-o.length*Xa)/2);k=0;for(l=o.length;k<l;k++)if(j=o[k],!(j.offset+i<0)){if(j.offset+i+N>e)break;
$.text$line(j.text,b+a,f+j.offset+c+i,g,kb)}}}function lb(a){$=a==="3D"?new F:a==="2D"?new w:new A;for(var b in A.prototype)A.prototype.hasOwnProperty(b)&&b.indexOf("$")<0&&(c[b]=$[b]);$.$init()}function D(a){return function(){lb("2D");return $[a].apply(this,arguments)}}function ic(a,b){function f(f){c.defineProperty(a,f,{get:function(){return b[f]},set:function(a){b[f]=a},enumerable:!0})}var m=[],e;for(e in b)typeof b[e]==="function"?a.hasOwnProperty(e)||(a[e]=b[e]):e.charAt(0)!=="$"&&!(e in a)&&
m.push(e);for(;m.length>0;)f(m.shift())}function U(a,b,f){a.addEventListener?a.addEventListener(b,f,!1):a.attachEvent("on"+b,f);Sa.push([a,b,f])}function Ja(a,b,f){a.removeEventListener?a.removeEventListener(b,f,!1):a.detachEvent&&a.detachEvent("on"+b,f)}function La(a){var b=a,f=0,m=0;c.pmouseX=c.mouseX;c.pmouseY=c.mouseY;if(b.offsetParent){do f+=b.offsetLeft,m+=b.offsetTop;while(b=b.offsetParent)}b=a;do f-=b.scrollLeft||0,m-=b.scrollTop||0;while(b=b.parentNode);f+=Qc;m+=Rc;f+=Sc;m+=Tc;f+=Q.pageXOffset;
m+=Q.pageYOffset;return{X:f,Y:m}}function Ob(a,b){var f=La(a,b);c.mouseX=b.pageX-f.X;c.mouseY=b.pageY-f.Y}function Pb(a){var b=La(a.changedTouches[0].target,a.changedTouches[0]),f;for(f=0;f<a.touches.length;f++){var c=a.touches[f];c.offsetX=c.pageX-b.X;c.offsetY=c.pageY-b.Y}for(f=0;f<a.targetTouches.length;f++)c=a.targetTouches[f],c.offsetX=c.pageX-b.X,c.offsetY=c.pageY-b.Y;for(f=0;f<a.changedTouches.length;f++)c=a.changedTouches[f],c.offsetX=c.pageX-b.X,c.offsetY=c.pageY-b.Y;return a}function Ma(a){a=
a.which||a.keyCode;switch(a){case 13:return 10;case 91:case 93:case 224:return 157;case 57392:return 17;case 46:return 127;case 45:return 155}return a}function xb(a){typeof a.preventDefault==="function"?a.preventDefault():typeof a.stopPropagation==="function"&&a.stopPropagation();return!1}function pa(){for(var a in Ya)if(Ya.hasOwnProperty(a)){c.__keyPressed=!0;return}c.__keyPressed=!1}function yb(a,b){Ya[a]=b;ab=null;c.key=b;c.keyCode=a;c.keyPressed();c.keyCode=0;c.keyTyped();pa()}function Jb(a){var b=
Ma(a);if(b===d.DELETE)yb(b,new ka(127));else if(xd.indexOf(b)<0)ab=b;else{var f=new ka(d.CODED);c.key=f;c.keyCode=b;Ya[b]=f;c.keyPressed();ab=null;pa();return xb(a)}}function gc(a){if(ab!==null){var b=ab,f;f=a.which||a.keyCode;var c=a.shiftKey||a.ctrlKey||a.altKey||a.metaKey;switch(f){case 13:f=c?13:10;break;case 8:f=c?127:8}f=new ka(f);yb(b,f);return xb(a)}}function hc(a){var a=Ma(a),b=Ya[a];if(b!==p)c.key=b,c.keyCode=a,c.keyReleased(),delete Ya[a],pa()}if(!(this instanceof y))throw"called Processing constructor as if it were a function: missing 'new'.";
var c=this,mb=arguments.length===0;if(mb)q=B.createElement("canvas"),c.canvas=q;c.externals={canvas:q,context:p,sketch:p};c.name="Processing.js Instance";c.use3DContext=!1;c.focused=!1;c.breakShape=!1;c.glyphTable={};c.pmouseX=0;c.pmouseY=0;c.mouseX=0;c.mouseY=0;c.mouseButton=0;c.mouseScroll=0;c.mouseClicked=p;c.mouseDragged=p;c.mouseMoved=p;c.mousePressed=p;c.mouseReleased=p;c.mouseScrolled=p;c.mouseOver=p;c.mouseOut=p;c.touchStart=p;c.touchEnd=p;c.touchMove=p;c.touchCancel=p;c.key=p;c.keyCode=p;
c.keyPressed=function(){};c.keyReleased=function(){};c.keyTyped=function(){};c.draw=p;c.setup=p;c.__mousePressed=!1;c.__keyPressed=!1;c.__frameRate=60;c.frameCount=0;c.width=100;c.height=100;c.defineProperty=function(a,b,f){"defineProperty"in Object?Object.defineProperty(a,b,f):(f.hasOwnProperty("get")&&a.__defineGetter__(b,f.get),f.hasOwnProperty("set")&&a.__defineSetter__(b,f.set))};var h,T,$,P=!0,ma=[1,1,1,1],Qa=4294967295,Oa=!0,L=!0,la=[0.8,0.8,0.8,1],Y=4294835709,Mb=!0,aa=1,Qb=!1,bb=!0,Rb=0,
cb=d.CORNER,Za=d.CENTER,jc=0,kc=0,lc=0,Sb=d.NORMAL_MODE_AUTO,mc=60,Uc=1E3/mc,yd=q.style.cursor,R=d.POLYGON,nc=0,oc=20,Vc=!1,Cb=-3355444,pc=20,ja=255,ca=255,ra=255,ia=255,ya=d.RGB,db=null,N=12,W={name:'"Arial", sans-serif',origName:"Arial"},Xa=14,Wc=(new Date).getTime(),qc=Wc,Tb=0,sa,Db,Ub,nb,ob,rc,sc,xa={attributes:{},locations:{}},s,v,na,tc,uc,vc,Vb,wc,Eb,xc,Xc,yc,Yc,Wb,Zc,$c,ad,Xb={width:0,height:0},bd=d.IMAGE,oa=!1,zc,Ac,Bc,kb=d.LEFT,jb=d.BASELINE,Nb=0.2,Cc=d.MODEL,Mc,Dc=null,Bb=!1,cd,dd=1E3,Ya=
[],ab=null,xd=[d.SHIFT,d.CONTROL,d.ALT,d.CAPSLK,d.PGUP,d.PGDN,d.END,d.HOME,d.LEFT,d.UP,d.RIGHT,d.DOWN,d.NUMLK,d.INSERT,d.F1,d.F2,d.F3,d.F4,d.F5,d.F6,d.F7,d.F8,d.F9,d.F10,d.F11,d.F12,d.META],Qc,Rc,Sc,Tc;B.defaultView&&B.defaultView.getComputedStyle&&(Qc=parseInt(B.defaultView.getComputedStyle(q,null).paddingLeft,10)||0,Rc=parseInt(B.defaultView.getComputedStyle(q,null).paddingTop,10)||0,Sc=parseInt(B.defaultView.getComputedStyle(q,null).borderLeftWidth,10)||0,Tc=parseInt(B.defaultView.getComputedStyle(q,
null).borderTopWidth,10)||0);var I=0,Yb=0,eb=0,Da=[],Ea=[],Fa=[],pb=new G(d.SINCOS_LENGTH),qb=new G(d.SINCOS_LENGTH),K,fb,Ga,ea,fa,O,Ha,rb,sb,Fb,za,Zb=!1,$b=60*(j.PI/180),Ec=c.width/2,gb=c.height/2,hb=gb/j.tan($b/2),ed=hb/10,fd=hb*10,gd=c.width/c.height,o=[],ga=[],ba=0,tb=!1,ub=!1,vb=!0,Gb=d.CORNER,hd=[],id=new G([0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,0.5,
0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5]),jd=new G([0.5,0.5,0.5,0.5,-0.5,0.5,0.5,0.5,-0.5,0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,
0.5,0.5,0.5,0.5,0.5,0.5,-0.5,0.5,0.5,-0.5,-0.5,0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,-0.5,0.5,-0.5,-0.5,0.5,0.5,-0.5,0.5]),zd=new G([0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0]),Fc=new G([0,0,0,0,1,0,1,1,0,1,0,0]),Ad=new G([0,0,1,0,0,1,0,0,1,0,0,1]),Bd="varying vec4 frontColor;attribute vec3 Vertex;attribute vec3 Normal;attribute vec4 aColor;attribute vec2 aTexture;varying vec2 vTexture;uniform vec4 color;uniform bool usingMat;uniform vec3 specular;uniform vec3 mat_emissive;uniform vec3 mat_ambient;uniform vec3 mat_specular;uniform float shininess;uniform mat4 model;uniform mat4 view;uniform mat4 projection;uniform mat4 normalTransform;uniform int lightCount;uniform vec3 falloff;struct Light { int type; vec3 color; vec3 position; vec3 direction; float angle; vec3 halfVector; float concentration;};uniform Light lights0;uniform Light lights1;uniform Light lights2;uniform Light lights3;uniform Light lights4;uniform Light lights5;uniform Light lights6;uniform Light lights7;Light getLight(int index){ if(index == 0) return lights0; if(index == 1) return lights1; if(index == 2) return lights2; if(index == 3) return lights3; if(index == 4) return lights4; if(index == 5) return lights5; if(index == 6) return lights6; return lights7;}void AmbientLight( inout vec3 totalAmbient, in vec3 ecPos, in Light light ) { float d = length( light.position - ecPos ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d )); totalAmbient += light.color * attenuation;}void DirectionalLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerfactor = 0.0; float nDotVP = max(0.0, dot( vertNormal, normalize(-light.position) )); float nDotVH = max(0.0, dot( vertNormal, normalize(-light.position-normalize(ecPos) ))); if( nDotVP != 0.0 ){ powerfactor = pow( nDotVH, shininess ); } col += light.color * nDotVP; spec += specular * powerfactor;}void PointLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerfactor; vec3 VP = light.position - ecPos; float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d )); float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0) { powerfactor = 0.0; } else{ powerfactor = pow( nDotHV, shininess ); } spec += specular * powerfactor * attenuation; col += light.color * nDotVP * attenuation;}void SpotLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float spotAttenuation; float powerfactor; vec3 VP = light.position - ecPos; vec3 ldir = normalize( -light.direction ); float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( falloff[0] + ( falloff[1] * d ) + ( falloff[2] * d * d ) ); float spotDot = dot( VP, ldir );"+
(/Windows/.test(navigator.userAgent)?" spotAttenuation = 1.0; ":" if( spotDot > cos( light.angle ) ) { spotAttenuation = pow( spotDot, light.concentration ); } else{ spotAttenuation = 0.0; } attenuation *= spotAttenuation;")+" float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0 ) { powerfactor = 0.0; } else { powerfactor = pow( nDotHV, shininess ); } spec += specular * powerfactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0, 0.0, 0.0 ); vec3 finalDiffuse = vec3( 0.0, 0.0, 0.0 ); vec3 finalSpecular = vec3( 0.0, 0.0, 0.0 ); vec4 col = color; if(color[0] == -1.0){ col = aColor; } vec3 norm = normalize(vec3( normalTransform * vec4( Normal, 0.0 ) )); vec4 ecPos4 = view * model * vec4(Vertex,1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( lightCount == 0 ) { frontColor = col + vec4(mat_specular,1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= lightCount ){ break; } if( l.type == 0 ) { AmbientLight( finalAmbient, ecPos, l ); } else if( l.type == 1 ) { DirectionalLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else if( l.type == 2 ) { PointLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } else { SpotLight( finalDiffuse, finalSpecular, norm, ecPos, l ); } } if( usingMat == false ) { frontColor = vec4( vec3(col) * finalAmbient + vec3(col) * finalDiffuse + vec3(col) * finalSpecular, col[3] ); } else{ frontColor = vec4( mat_emissive + (vec3(col) * mat_ambient * finalAmbient) + (vec3(col) * finalDiffuse) + (mat_specular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = projection * view * model * vec4( Vertex, 1.0 );}",
kd=function(a,b,f,c){return{x:a,y:b,w:f,h:c}},ac=kd,Cd=function(a,b,f,c,e){return{x:a,y:b,w:e?f:f-a,h:e?c:c-b}},Dd=function(a,b,f,c){return{x:a-f/2,y:b-c/2,w:f,h:c}},Gc=function(a,b,f){var c=a.createShader(a.VERTEX_SHADER);a.shaderSource(c,b);a.compileShader(c);if(!a.getShaderParameter(c,a.COMPILE_STATUS))throw a.getShaderInfoLog(c);b=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(b,f);a.compileShader(b);if(!a.getShaderParameter(b,a.COMPILE_STATUS))throw a.getShaderInfoLog(b);f=a.createProgram();
a.attachShader(f,c);a.attachShader(f,b);a.linkProgram(f);if(!a.getProgramParameter(f,a.LINK_STATUS))throw"Error linking shaders.";return f},C=function(){},w=function(){},F=function(){},A=function(){};w.prototype=new C;w.prototype.constructor=w;F.prototype=new C;F.prototype.constructor=F;A.prototype=new C;A.prototype.constructor=A;C.prototype.a3DOnlyFunction=function(){};var Hc={},ka=c.Character=function(a){this.code=typeof a==="string"&&a.length===1?a.charCodeAt(0):typeof a==="number"?a:a instanceof
ka?a:NaN;return Hc[this.code]===p?Hc[this.code]=this:Hc[this.code]};ka.prototype.toString=function(){return String.fromCharCode(this.code)};ka.prototype.valueOf=function(){return this.code};var Hb=c.PShape=function(a){this.family=a||d.GROUP;this.style=this.visible=!0;this.children=[];this.nameTable=[];this.params=[];this.name="";this.parent=this.height=this.width=this.close=this.kind=this.matrix=this.image=null};Hb.prototype={isVisible:function(){return this.visible},setVisible:function(a){this.visible=
a},disableStyle:function(){this.style=!1;for(var a=0,b=this.children.length;a<b;a++)this.children[a].disableStyle()},enableStyle:function(){this.style=!0;for(var a=0,b=this.children.length;a<b;a++)this.children[a].enableStyle()},getFamily:function(){return this.family},getWidth:function(){return this.width},getHeight:function(){return this.height},setName:function(a){this.name=a},getName:function(){return this.name},draw:function(){this.visible&&(this.pre(),this.drawImpl(),this.post())},drawImpl:function(){this.family===
d.GROUP?this.drawGroup():this.family===d.PRIMITIVE?this.drawPrimitive():this.family===d.GEOMETRY?this.drawGeometry():this.family===d.PATH&&this.drawPath()},drawPath:function(){var a,b;if(this.vertices.length!==0){c.beginShape();if(this.vertexCodes.length===0)if(this.vertices[0].length===2){a=0;for(b=this.vertices.length;a<b;a++)c.vertex(this.vertices[a][0],this.vertices[a][1])}else{a=0;for(b=this.vertices.length;a<b;a++)c.vertex(this.vertices[a][0],this.vertices[a][1],this.vertices[a][2])}else{var f=
0;if(this.vertices[0].length===2){a=0;for(b=this.vertexCodes.length;a<b;a++)if(this.vertexCodes[a]===d.VERTEX)c.vertex(this.vertices[f][0],this.vertices[f][1]),this.vertices[f].moveTo===!0?o[o.length-1].moveTo=!0:this.vertices[f].moveTo===!1&&(o[o.length-1].moveTo=!1),c.breakShape=!1,f++;else if(this.vertexCodes[a]===d.BEZIER_VERTEX)c.bezierVertex(this.vertices[f+0][0],this.vertices[f+0][1],this.vertices[f+1][0],this.vertices[f+1][1],this.vertices[f+2][0],this.vertices[f+2][1]),f+=3;else if(this.vertexCodes[a]===
d.CURVE_VERTEX)c.curveVertex(this.vertices[f][0],this.vertices[f][1]),f++;else if(this.vertexCodes[a]===d.BREAK)c.breakShape=!0}else{a=0;for(b=this.vertexCodes.length;a<b;a++)if(this.vertexCodes[a]===d.VERTEX)c.vertex(this.vertices[f][0],this.vertices[f][1],this.vertices[f][2]),this.vertices[f].moveTo===!0?o[o.length-1].moveTo=!0:this.vertices[f].moveTo===!1&&(o[o.length-1].moveTo=!1),c.breakShape=!1;else if(this.vertexCodes[a]===d.BEZIER_VERTEX)c.bezierVertex(this.vertices[f+0][0],this.vertices[f+
0][1],this.vertices[f+0][2],this.vertices[f+1][0],this.vertices[f+1][1],this.vertices[f+1][2],this.vertices[f+2][0],this.vertices[f+2][1],this.vertices[f+2][2]),f+=3;else if(this.vertexCodes[a]===d.CURVE_VERTEX)c.curveVertex(this.vertices[f][0],this.vertices[f][1],this.vertices[f][2]),f++;else if(this.vertexCodes[a]===d.BREAK)c.breakShape=!0}}c.endShape(this.close?d.CLOSE:d.OPEN)}},drawGeometry:function(){var a,b;c.beginShape(this.kind);if(this.style){a=0;for(b=this.vertices.length;a<b;a++)c.vertex(this.vertices[a])}else{a=
0;for(b=this.vertices.length;a<b;a++){var f=this.vertices[a];f[2]===0?c.vertex(f[0],f[1]):c.vertex(f[0],f[1],f[2])}}c.endShape()},drawGroup:function(){for(var a=0,b=this.children.length;a<b;a++)this.children[a].draw()},drawPrimitive:function(){this.kind===d.POINT?c.point(this.params[0],this.params[1]):this.kind===d.LINE?this.params.length===4?c.line(this.params[0],this.params[1],this.params[2],this.params[3]):c.line(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]):
this.kind===d.TRIANGLE?c.triangle(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]):this.kind===d.QUAD?c.quad(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5],this.params[6],this.params[7]):this.kind===d.RECT?this.image!==null?(c.imageMode(d.CORNER),c.image(this.image,this.params[0],this.params[1],this.params[2],this.params[3])):(c.rectMode(d.CORNER),c.rect(this.params[0],this.params[1],this.params[2],this.params[3])):
this.kind===d.ELLIPSE?(c.ellipseMode(d.CORNER),c.ellipse(this.params[0],this.params[1],this.params[2],this.params[3])):this.kind===d.ARC?(c.ellipseMode(d.CORNER),c.arc(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5])):this.kind===d.BOX?this.params.length===1?c.box(this.params[0]):c.box(this.params[0],this.params[1],this.params[2]):this.kind===d.SPHERE&&c.sphere(this.params[0])},pre:function(){this.matrix&&(c.pushMatrix(),h.transform(this.matrix.elements[0],
this.matrix.elements[3],this.matrix.elements[1],this.matrix.elements[4],this.matrix.elements[2],this.matrix.elements[5]));this.style&&(c.pushStyle(),this.styles())},post:function(){this.matrix&&c.popMatrix();this.style&&c.popStyle()},styles:function(){this.stroke?(c.stroke(this.strokeColor),c.strokeWeight(this.strokeWeight),c.strokeCap(this.strokeCap),c.strokeJoin(this.strokeJoin)):c.noStroke();this.fill?c.fill(this.fillColor):c.noFill()},getChild:function(a){var b,f;if(typeof a==="number")return this.children[a];
else{var c;if(a===""||this.name===a)return this;else{if(this.nameTable.length>0){b=0;for(f=this.nameTable.length;b<f||c;b++)this.nameTable[b].getName===a&&(c=this.nameTable[b]);if(c)return c}b=0;for(f=this.children.length;b<f;b++)if(c=this.children[b].getChild(a))return c}return null}},getChildCount:function(){return this.children.length},addChild:function(a){this.children.push(a);a.parent=this;a.getName()!==null&&this.addName(a.getName(),a)},addName:function(a,b){this.parent!==null?this.parent.addName(a,
b):this.nameTable.push([a,b])},translate:function(){arguments.length===2?(this.checkMatrix(2),this.matrix.translate(arguments[0],arguments[1])):(this.checkMatrix(3),this.matrix.translate(arguments[0],arguments[1],0))},checkMatrix:function(a){if(this.matrix===null)this.matrix=a===2?new c.PMatrix2D:new c.PMatrix3D;else if(a===3&&this.matrix instanceof c.PMatrix2D)this.matrix=new c.PMatrix3D},rotateX:function(a){this.rotate(a,1,0,0)},rotateY:function(a){this.rotate(a,0,1,0)},rotateZ:function(a){this.rotate(a,
0,0,1)},rotate:function(){arguments.length===1?(this.checkMatrix(2),this.matrix.rotate(arguments[0])):(this.checkMatrix(3),this.matrix.rotate(arguments[0],arguments[1],arguments[2],arguments[3]))},scale:function(){arguments.length===2?(this.checkMatrix(2),this.matrix.scale(arguments[0],arguments[1])):arguments.length===3?(this.checkMatrix(2),this.matrix.scale(arguments[0],arguments[1],arguments[2])):(this.checkMatrix(2),this.matrix.scale(arguments[0]))},resetMatrix:function(){this.checkMatrix(2);
this.matrix.reset()},applyMatrix:function(a){arguments.length===1?this.applyMatrix(a.elements[0],a.elements[1],0,a.elements[2],a.elements[3],a.elements[4],0,a.elements[5],0,0,1,0,0,0,0,1):arguments.length===6?(this.checkMatrix(2),this.matrix.apply(arguments[0],arguments[1],arguments[2],0,arguments[3],arguments[4],arguments[5],0,0,0,1,0,0,0,0,1)):arguments.length===16&&(this.checkMatrix(3),this.matrix.apply(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],
arguments[7],arguments[8],arguments[9],arguments[10],arguments[11],arguments[12],arguments[13],arguments[14],arguments[15]))}};var M=c.PShapeSVG=function(){c.PShape.call(this);if(arguments.length===1){if(this.element=arguments[0],this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=d.ALPHA_MASK,this.strokeWeight=1,this.strokeCap=d.SQUARE,this.strokeJoin=d.MITER,this.strokeName=this.strokeGradientPaint=this.strokeGradient=null,this.strokeOpacity=1,this.fill=!0,this.fillColor=
d.ALPHA_MASK,this.fillName=this.fillGradientPaint=this.fillGradient=null,this.fillOpacity=1,this.element.getName()!=="svg")throw"root is not <svg>, it's <"+this.element.getName()+">";}else if(arguments.length===2)if(typeof arguments[1]==="string"){if(arguments[1].indexOf(".svg")>-1)this.element=new c.XMLElement(null,arguments[1]),this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=d.ALPHA_MASK,this.strokeWeight=1,this.strokeCap=d.SQUARE,this.strokeJoin=d.MITER,this.strokeName=
this.strokeGradientPaint=this.strokeGradient="",this.strokeOpacity=1,this.fill=!0,this.fillColor=d.ALPHA_MASK,this.fillGradientPaint=this.fillGradient=null,this.fillOpacity=1}else if(arguments[0])this.element=arguments[1],this.vertexCodes=arguments[0].vertexCodes.slice(),this.vertices=arguments[0].vertices.slice(),this.stroke=arguments[0].stroke,this.strokeColor=arguments[0].strokeColor,this.strokeWeight=arguments[0].strokeWeight,this.strokeCap=arguments[0].strokeCap,this.strokeJoin=arguments[0].strokeJoin,
this.strokeGradient=arguments[0].strokeGradient,this.strokeGradientPaint=arguments[0].strokeGradientPaint,this.strokeName=arguments[0].strokeName,this.fill=arguments[0].fill,this.fillColor=arguments[0].fillColor,this.fillGradient=arguments[0].fillGradient,this.fillGradientPaint=arguments[0].fillGradientPaint,this.fillName=arguments[0].fillName,this.strokeOpacity=arguments[0].strokeOpacity,this.fillOpacity=arguments[0].fillOpacity,this.opacity=arguments[0].opacity;this.name=this.element.getStringAttribute("id");
this.visible=this.element.getStringAttribute("display","inline")!=="none";var a=this.element.getAttribute("transform");if(a)this.matrix=this.parseMatrix(a);a=this.element.getStringAttribute("viewBox");if(a!==null)a=a.split(" "),this.width=a[2],this.height=a[3];var a=this.element.getStringAttribute("width"),b=this.element.getStringAttribute("height");if(a!==null)this.width=this.parseUnitSize(a),this.height=this.parseUnitSize(b);else if(this.width===0||this.height===0)throw this.height=this.width=1,
"The width and/or height is not readable in the <svg> tag of this file.";this.parseColors(this.element);this.parseChildren(this.element)};M.prototype=new Hb;M.prototype.parseMatrix=function(){function a(a){a.replace(/\((.*?)\)/,function(){return function(a,b){b.replace(/,+/g," ").split(/\s+/)}}())}return function(b){this.checkMatrix(2);var f=[];b.replace(/\s*(\w+)\((.*?)\)/g,function(a){f.push(c.trim(a))});if(f.length===0)return null;for(var b=0,m=f.length;b<m;b++){var e=a(f[b]);if(f[b].indexOf("matrix")!==
-1)this.matrix.set(e[0],e[2],e[4],e[1],e[3],e[5]);else if(f[b].indexOf("translate")!==-1)this.matrix.translate(e[0],e.length===2?e[1]:0);else if(f[b].indexOf("scale")!==-1)this.matrix.scale(e[0],e.length===2?e[1]:e[0]);else if(f[b].indexOf("rotate")!==-1){var d=e[0];e.length===1?this.matrix.rotate(c.radians(d)):e.length===3&&(this.matrix.translate(e[1],e[2]),this.matrix.rotate(c.radians(e[0])),this.matrix.translate(-e[1],-e[2]))}else f[b].indexOf("skewX")!==-1?this.matrix.skewX(parseFloat(e[0])):
f[b].indexOf("skewY")!==-1&&this.matrix.skewY(e[0])}return this.matrix}}();M.prototype.parseChildren=function(a){for(var a=a.getChildren(),b=new c.PShape,f=0,m=a.length;f<m;f++){var e=this.parseChild(a[f]);e&&b.addChild(e)}this.children.push(b)};M.prototype.getName=function(){return this.name};M.prototype.parseChild=function(a){var b=a.getName(),f;b==="g"?f=new M(this,a):b==="defs"?f=new M(this,a):b==="line"?(f=new M(this,a),f.parseLine()):b==="circle"?(f=new M(this,a),f.parseEllipse(!0)):b==="ellipse"?
(f=new M(this,a),f.parseEllipse(!1)):b==="rect"?(f=new M(this,a),f.parseRect()):b==="polygon"?(f=new M(this,a),f.parsePoly(!0)):b==="polyline"?(f=new M(this,a),f.parsePoly(!1)):b==="path"?(f=new M(this,a),f.parsePath()):b==="radialGradient"?Ka("PShapeSVG.prototype.parseChild, name = radialGradient"):b==="linearGradient"?Ka("PShapeSVG.prototype.parseChild, name = linearGradient"):b==="text"?Ka("PShapeSVG.prototype.parseChild, name = text"):b==="filter"?Ka("PShapeSVG.prototype.parseChild, name = filter"):
b==="mask"?Ka("PShapeSVG.prototype.parseChild, name = mask"):ec();return f};M.prototype.parsePath=function(){this.family=d.PATH;this.kind=0;var a=c.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g," "));if(a!==null)for(var a=c.__toCharArray(a),b=0,f=0,m=0,e=0,g=e=m=0,i=0,k=0,l=0,h=l=e=k=m=0,j=0,o="",n=[],q=!1,p,s,r;h<a.length;)if(j=a[h].valueOf(),j>=65&&j<=90||j>=97&&j<=122){r=h;h++;if(h<a.length){n=[];for(j=a[h].valueOf();!(j>=65&&j<=90||j>=97&&j<=100||j>=102&&j<=122)&&q===!1;)j===32?
o!==""&&(n.push(parseFloat(o)),o=""):j===45?a[h-1].valueOf()===101?o+=a[h].toString():(o!==""&&n.push(parseFloat(o)),o=a[h].toString()):o+=a[h].toString(),h++,h===a.length?q=!0:j=a[h].valueOf()}o!==""&&(n.push(parseFloat(o)),o="");s=a[r];j=s.valueOf();if(j===77){if(n.length>=2&&n.length%2===0&&(b=n[0],f=n[1],this.parsePathMoveto(b,f),n.length>2)){r=2;for(j=n.length;r<j;r+=2)b=n[r],f=n[r+1],this.parsePathLineto(b,f)}}else if(j===109){if(n.length>=2&&n.length%2===0&&(this.parsePathMoveto(b,f),n.length>
2)){r=2;for(j=n.length;r<j;r+=2)b+=n[r],f+=n[r+1],this.parsePathLineto(b,f)}}else if(j===76){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)b=n[r],f=n[r+1],this.parsePathLineto(b,f)}}else if(j===108){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)b+=n[r],f+=n[r+1],this.parsePathLineto(b,f)}}else if(j===72){r=0;for(j=n.length;r<j;r++)b=n[r],this.parsePathLineto(b,f)}else if(j===104){r=0;for(j=n.length;r<j;r++)b+=n[r],this.parsePathLineto(b,f)}else if(j===86){r=0;for(j=n.length;r<
j;r++)f=n[r],this.parsePathLineto(b,f)}else if(j===118){r=0;for(j=n.length;r<j;r++)f+=n[r],this.parsePathLineto(b,f)}else if(j===67){if(n.length>=6&&n.length%6===0){r=0;for(j=n.length;r<j;r+=6)m=n[r],g=n[r+1],e=n[r+2],i=n[r+3],k=n[r+4],l=n[r+5],this.parsePathCurveto(m,g,e,i,k,l),b=k,f=l}}else if(j===99){if(n.length>=6&&n.length%6===0){r=0;for(j=n.length;r<j;r+=6)m=b+n[r],g=f+n[r+1],e=b+n[r+2],i=f+n[r+3],k=b+n[r+4],l=f+n[r+5],this.parsePathCurveto(m,g,e,i,k,l),b=k,f=l}}else if(j===83){if(n.length>=
4&&n.length%4===0){r=0;for(j=n.length;r<j;r+=4)p.toLowerCase()==="c"||p.toLowerCase()==="s"?(m=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-1][0],l=this.vertices[this.vertices.length-1][1],m=e+(e-m),g=l+(l-k)):(m=this.vertices[this.vertices.length-1][0],g=this.vertices[this.vertices.length-1][1]),e=n[r],i=n[r+1],k=n[r+2],l=n[r+3],this.parsePathCurveto(m,g,e,i,k,l),b=k,f=l}}else if(j===115){if(n.length>=4&&n.length%4===0){r=
0;for(j=n.length;r<j;r+=4)p.toLowerCase()==="c"||p.toLowerCase()==="s"?(m=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-1][0],l=this.vertices[this.vertices.length-1][1],m=e+(e-m),g=l+(l-k)):(m=this.vertices[this.vertices.length-1][0],g=this.vertices[this.vertices.length-1][1]),e=b+n[r],i=f+n[r+1],k=b+n[r+2],l=f+n[r+3],this.parsePathCurveto(m,g,e,i,k,l),b=k,f=l}}else if(j===81){if(n.length>=4&&n.length%4===0){r=0;for(j=n.length;r<
j;r+=4)m=n[r],e=n[r+1],k=n[r+2],l=n[r+3],this.parsePathQuadto(b,f,m,e,k,l),b=k,f=l}}else if(j===113){if(n.length>=4&&n.length%4===0){r=0;for(j=n.length;r<j;r+=4)m=b+n[r],e=f+n[r+1],k=b+n[r+2],l=f+n[r+3],this.parsePathQuadto(b,f,m,e,k,l),b=k,f=l}}else if(j===84){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)p.toLowerCase()==="q"||p.toLowerCase()==="t"?(m=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-1][0],l=this.vertices[this.vertices.length-
1][1],m=e+(e-m),e=l+(l-k)):(m=b,e=f),k=n[r],l=n[r+1],this.parsePathQuadto(b,f,m,e,k,l),b=k,f=l}}else if(j===116){if(n.length>=2&&n.length%2===0){r=0;for(j=n.length;r<j;r+=2)p.toLowerCase()==="q"||p.toLowerCase()==="t"?(m=this.vertices[this.vertices.length-2][0],k=this.vertices[this.vertices.length-2][1],e=this.vertices[this.vertices.length-1][0],l=this.vertices[this.vertices.length-1][1],m=e+(e-m),e=l+(l-k)):(m=b,e=f),k=b+n[r],l=f+n[r+1],this.parsePathQuadto(b,f,m,e,k,l),b=k,f=l}}else if(j===90)ec();
else if(j===122)this.close=!0;p=s.toString()}else h++};M.prototype.parsePathQuadto=function(a,b,f,c,e,g){if(this.vertices.length>0)this.parsePathCode(d.BEZIER_VERTEX),this.parsePathVertex(a+(f-a)*2/3,b+(c-b)*2/3),this.parsePathVertex(e+(f-e)*2/3,g+(c-g)*2/3),this.parsePathVertex(e,g);else throw"Path must start with M/m";};M.prototype.parsePathCurveto=function(a,b,f,c,e,g){if(this.vertices.length>0)this.parsePathCode(d.BEZIER_VERTEX),this.parsePathVertex(a,b),this.parsePathVertex(f,c),this.parsePathVertex(e,
g);else throw"Path must start with M/m";};M.prototype.parsePathLineto=function(a,b){if(this.vertices.length>0)this.parsePathCode(d.VERTEX),this.parsePathVertex(a,b),this.vertices[this.vertices.length-1].moveTo=!1;else throw"Path must start with M/m";};M.prototype.parsePathMoveto=function(a,b){this.vertices.length>0&&this.parsePathCode(d.BREAK);this.parsePathCode(d.VERTEX);this.parsePathVertex(a,b);this.vertices[this.vertices.length-1].moveTo=!0};M.prototype.parsePathVertex=function(a,b){var f=[];
f[0]=a;f[1]=b;this.vertices.push(f)};M.prototype.parsePathCode=function(a){this.vertexCodes.push(a)};M.prototype.parsePoly=function(a){this.family=d.PATH;this.close=a;a=c.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(a!==null)if(a=a.split(" "),a.length%2===0)for(var b=0,f=a.length;b<f;b++){var m=[];m[0]=a[b];m[1]=a[++b];this.vertices.push(m)}else throw"Error parsing polygon points: odd number of coordinates provided";};M.prototype.parseRect=function(){this.kind=d.RECT;
this.family=d.PRIMITIVE;this.params=[];this.params[0]=this.element.getFloatAttribute("x");this.params[1]=this.element.getFloatAttribute("y");this.params[2]=this.element.getFloatAttribute("width");this.params[3]=this.element.getFloatAttribute("height")};M.prototype.parseEllipse=function(a){this.kind=d.ELLIPSE;this.family=d.PRIMITIVE;this.params=[];this.params[0]=this.element.getFloatAttribute("cx");this.params[1]=this.element.getFloatAttribute("cy");var b;a?a=b=this.element.getFloatAttribute("r"):
(a=this.element.getFloatAttribute("rx"),b=this.element.getFloatAttribute("ry"));this.params[0]-=a;this.params[1]-=b;this.params[2]=a*2;this.params[3]=b*2};M.prototype.parseLine=function(){this.kind=d.LINE;this.family=d.PRIMITIVE;this.params=[];this.params[0]=this.element.getFloatAttribute("x1");this.params[1]=this.element.getFloatAttribute("y1");this.params[2]=this.element.getFloatAttribute("x2");this.params[3]=this.element.getFloatAttribute("y2")};M.prototype.parseColors=function(a){a.hasAttribute("opacity")&&
this.setOpacity(a.getAttribute("opacity"));a.hasAttribute("stroke")&&this.setStroke(a.getAttribute("stroke"));a.hasAttribute("stroke-width")&&this.setStrokeWeight(a.getAttribute("stroke-width"));a.hasAttribute("stroke-linejoin")&&this.setStrokeJoin(a.getAttribute("stroke-linejoin"));a.hasAttribute("stroke-linecap")&&this.setStrokeCap(a.getStringAttribute("stroke-linecap"));a.hasAttribute("fill")&&this.setFill(a.getStringAttribute("fill"));if(a.hasAttribute("style"))for(var a=a.getStringAttribute("style").toString().split(";"),
b=0,f=a.length;b<f;b++){var m=c.trim(a[b].split(":"));m[0]==="fill"?this.setFill(m[1]):m[0]==="fill-opacity"?this.setFillOpacity(m[1]):m[0]==="stroke"?this.setStroke(m[1]):m[0]==="stroke-width"?this.setStrokeWeight(m[1]):m[0]==="stroke-linecap"?this.setStrokeCap(m[1]):m[0]==="stroke-linejoin"?this.setStrokeJoin(m[1]):m[0]==="stroke-opacity"?this.setStrokeOpacity(m[1]):m[0]==="opacity"&&this.setOpacity(m[1])}};M.prototype.setFillOpacity=function(a){this.fillOpacity=parseFloat(a);this.fillColor=this.fillOpacity*
255<<24|this.fillColor&16777215};M.prototype.setFill=function(a){var b=this.fillColor&4278190080;if(a==="none")this.fill=!1;else if(a.indexOf("#")===0)this.fill=!0,this.fillColor=b|parseInt(a.substring(1),16)&16777215;else if(a.indexOf("rgb")===0)this.fill=!0,this.fillColor=b|this.parseRGB(a);else if(a.indexOf("url(#")===0)this.fillName=a.substring(5,a.length-1);else if(Kb[a])this.fill=!0,this.fillColor=b|parseInt(Kb[a].substring(1),16)&16777215};M.prototype.setOpacity=function(a){this.strokeColor=
parseFloat(a)*255<<24|this.strokeColor&16777215;this.fillColor=parseFloat(a)*255<<24|this.fillColor&16777215};M.prototype.setStroke=function(a){var b=this.strokeColor&4278190080;if(a==="none")this.stroke=!1;else if(a.charAt(0)==="#")this.stroke=!0,this.strokeColor=b|parseInt(a.substring(1),16)&16777215;else if(a.indexOf("rgb")===0)this.stroke=!0,this.strokeColor=b|this.parseRGB(a);else if(a.indexOf("url(#")===0)this.strokeName=a.substring(5,a.length-1);else if(Kb[a])this.stroke=!0,this.strokeColor=
b|parseInt(Kb[a].substring(1),16)&16777215};M.prototype.setStrokeWeight=function(a){this.strokeWeight=this.parseUnitSize(a)};M.prototype.setStrokeJoin=function(a){if(a==="miter")this.strokeJoin=d.MITER;else if(a==="round")this.strokeJoin=d.ROUND;else if(a==="bevel")this.strokeJoin=d.BEVEL};M.prototype.setStrokeCap=function(a){if(a==="butt")this.strokeCap=d.SQUARE;else if(a==="round")this.strokeCap=d.ROUND;else if(a==="square")this.strokeCap=d.PROJECT};M.prototype.setStrokeOpacity=function(a){this.strokeOpacity=
parseFloat(a);this.strokeColor=this.strokeOpacity*255<<24|this.strokeColor&16777215};M.prototype.parseRGB=function(a){a=a.substring(a.indexOf("(")+1,a.indexOf(")")).split(", ");return a[0]<<16|a[1]<<8|a[2]};M.prototype.parseUnitSize=function(a){var b=a.length-2;if(b<0)return a;return a.indexOf("pt")===b?parseFloat(a.substring(0,b))*1.25:a.indexOf("pc")===b?parseFloat(a.substring(0,b))*15:a.indexOf("mm")===b?parseFloat(a.substring(0,b))*3.543307:a.indexOf("cm")===b?parseFloat(a.substring(0,b))*35.43307:
a.indexOf("in")===b?parseFloat(a.substring(0,b))*90:a.indexOf("px")===b?parseFloat(a.substring(0,b)):parseFloat(a)};c.shape=function(a,b,f,m,e){arguments.length>=1&&arguments[0]!==null&&a.isVisible()&&(c.pushMatrix(),Gb===d.CENTER?arguments.length===5?(c.translate(b-m/2,f-e/2),c.scale(m/a.getWidth(),e/a.getHeight())):arguments.length===3?c.translate(b-a.getWidth()/2,-a.getHeight()/2):c.translate(-a.getWidth()/2,-a.getHeight()/2):Gb===d.CORNER?arguments.length===5?(c.translate(b,f),c.scale(m/a.getWidth(),
e/a.getHeight())):arguments.length===3&&c.translate(b,f):Gb===d.CORNERS&&(arguments.length===5?(m-=b,e-=f,c.translate(b,f),c.scale(m/a.getWidth(),e/a.getHeight())):arguments.length===3&&c.translate(b,f)),a.draw(),(arguments.length===1&&Gb===d.CENTER||arguments.length>1)&&c.popMatrix())};c.shapeMode=function(a){Gb=a};c.loadShape=function(a){if(arguments.length===1&&a.indexOf(".svg")>-1)return new M(null,a);return null};var bc=function(a,b,f,c,e){this.fullName=a||"";this.name=b||"";this.namespace=f||
"";this.value=c;this.type=e};bc.prototype={getName:function(){return this.name},getFullName:function(){return this.fullName},getNamespace:function(){return this.namespace},getValue:function(){return this.value},getType:function(){return this.type},setValue:function(a){this.value=a}};var $a=c.XMLElement=function(){this.attributes=[];this.children=[];this.name=this.fullName=null;this.namespace="";this.parent=this.content=null;this.systemID=this.lineNr="";this.type="ELEMENT";if(arguments.length===4){this.fullName=
arguments[0]||"";if(arguments[1])this.name=arguments[1];else{var a=this.fullName.indexOf(":");this.name=a>=0?this.fullName.substring(a+1):this.fullName}this.namespace=arguments[1];this.lineNr=arguments[3];this.systemID=arguments[2]}else arguments.length===2&&arguments[1].indexOf(".")>-1?this.parse(arguments[arguments.length-1]):arguments.length===1&&typeof arguments[0]==="string"&&this.parse(arguments[0])};$a.prototype={parse:function(a){var b;try{if(a.indexOf(".xml")>-1||a.indexOf(".svg")>-1)a=fc(a);
b=(new DOMParser).parseFromString(a,"text/xml");var f=b.documentElement;if(f)this.parseChildrenRecursive(null,f);else throw"Error loading document";return this}catch(c){throw c;}},parseChildrenRecursive:function(a,b){var f,c,e,d;a?(f=new $a(b.localName,b.nodeName,"",""),f.parent=a):(this.fullName=b.localName,this.name=b.nodeName,f=this);if(b.nodeType===3&&b.textContent!=="")return this.createPCDataElement(b.textContent);e=0;for(d=b.attributes.length;e<d;e++)c=b.attributes[e],c=new bc(c.getname,c.nodeName,
c.namespaceURI,c.nodeValue,c.nodeType),f.attributes.push(c);e=0;for(d=b.childNodes.length;e<d;e++)if(c=b.childNodes[e],c.nodeType===1||c.nodeType===3)c=f.parseChildrenRecursive(f,c),c!==null&&f.children.push(c);return f},createElement:function(){return arguments.length===2?new $a(arguments[0],arguments[1],null,null):new $a(arguments[0],arguments[1],arguments[2],arguments[3])},createPCDataElement:function(a){if(a.replace(/^\s+$/g,"")==="")return null;var b=new $a;b.content=a;b.type="TEXT";return b},
hasAttribute:function(){if(arguments.length===1)return this.getAttribute(arguments[0])!==null;else if(arguments.length===2)return this.getAttribute(arguments[0],arguments[1])!==null},equals:function(a){if(!(a instanceof $a))return!1;var b,f;if(this.name!==a.getLocalName())return!1;if(this.attributes.length!==a.getAttributeCount())return!1;if(this.attributes.length!==a.attributes.length)return!1;var c,e;b=0;for(f=this.attributes.length;b<f;b++){c=this.attributes[b].getName();e=this.attributes[b].getNamespace();
c=a.findAttribute(c,e);if(c===null)return!1;if(this.attributes[b].getValue()!==c.getValue())return!1;if(this.attributes[b].getType()!==c.getType())return!1}if(this.children.length!==a.getChildCount())return!1;if(this.children.length>0){b=0;for(f=this.children.length;b<f;b++)if(c=this.getChild(b),e=a.getChild(b),!c.equals(e))return!1;return!0}else return this.content===a.content},getContent:function(){if(this.type==="TEXT")return this.content;else if(this.children.length===1&&this.children[0].type===
"TEXT")return this.children[0].content;return null},getAttribute:function(){var a;if(arguments.length===2)return(a=this.findAttribute(arguments[0]))?a.getValue():arguments[1];else if(arguments.length===1)return(a=this.findAttribute(arguments[0]))?a.getValue():null;else if(arguments.length===3)return(a=this.findAttribute(arguments[0],arguments[1]))?a.getValue():arguments[2]},getStringAttribute:function(){return arguments.length===1?this.getAttribute(arguments[0]):arguments.length===2?this.getAttribute(arguments[0],
arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getString:function(a){return this.getStringAttribute(a)},getFloatAttribute:function(){return arguments.length===1?parseFloat(this.getAttribute(arguments[0],0)):arguments.length===2?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getFloat:function(a){return this.getFloatAttribute(a)},getIntAttribute:function(){return arguments.length===1?this.getAttribute(arguments[0],0):
arguments.length===2?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getInt:function(a){return this.getIntAttribute(a)},hasChildren:function(){return this.children.length>0},addChild:function(a){if(a!==null)a.parent=this,this.children.push(a)},insertChild:function(a,b){if(a){if(a.getLocalName()===null&&!this.hasChildren()){var f=this.children[this.children.length-1];if(f.getLocalName()===null){f.setContent(f.getContent()+a.getContent());return}}a.parent=
this;this.children.splice(b,0,a)}},getChild:function(a){if(typeof a==="number")return this.children[a];else if(a.indexOf("/")!==-1)this.getChildRecursive(a.split("/"),0);else{for(var b,f,c=0,e=this.getChildCount();c<e;c++)if(b=this.getChild(c),f=b.getName(),f!==null&&f===a)return b;return null}},getChildren:function(){if(arguments.length===1)if(typeof arguments[0]==="number")return this.getChild(arguments[0]);else if(arguments[0].indexOf("/")!==-1)return this.getChildrenRecursive(arguments[0].split("/"),
0);else{for(var a=[],b,f,c=0,e=this.getChildCount();c<e;c++)b=this.getChild(c),f=b.getName(),f!==null&&f===arguments[0]&&a.push(b);return a}else return this.children},getChildCount:function(){return this.children.length},getChildRecursive:function(a,b){for(var f,c,e=0,d=this.getChildCount();e<d;e++)if(f=this.getChild(e),c=f.getName(),c!==null&&c===a[b])return b===a.length-1?f:(b+=1,f.getChildRecursive(a,b));return null},getChildrenRecursive:function(a,b){if(b===a.length-1)return this.getChildren(a[b]);
for(var f=this.getChildren(a[b]),c=[],e=0;e<f.length;e++)c=c.concat(f[e].getChildrenRecursive(a,b+1));return c},isLeaf:function(){return!this.hasChildren()},listChildren:function(){for(var a=[],b=0,f=this.children.length;b<f;b++)a.push(this.getChild(b).getName());return a},removeAttribute:function(a,b){this.namespace=b||"";for(var f=0,c=this.attributes.length;f<c;f++)if(this.attributes[f].getName()===a&&this.attributes[f].getNamespace()===this.namespace){this.attributes.splice(f,1);break}},removeChild:function(a){if(a)for(var b=
0,f=this.children.length;b<f;b++)if(this.children[b].equals(a)){this.children.splice(b,1);break}},removeChildAtIndex:function(a){this.children.length>a&&this.children.splice(a,1)},findAttribute:function(a,b){this.namespace=b||"";for(var f=0,c=this.attributes.length;f<c;f++)if(this.attributes[f].getName()===a&&this.attributes[f].getNamespace()===this.namespace)return this.attributes[f];return null},setAttribute:function(){var a;if(arguments.length===3){a=arguments[0].indexOf(":");var b=arguments[0].substring(a+
1);(a=this.findAttribute(b,arguments[1]))?a.setValue(arguments[2]):(a=new bc(arguments[0],b,arguments[1],arguments[2],"CDATA"),this.attributes.push(a))}else(a=this.findAttribute(arguments[0]))?a.setValue(arguments[1]):(a=new bc(arguments[0],arguments[0],null,arguments[1],"CDATA"),this.attributes.push(a))},setString:function(a,b){this.setAttribute(a,b)},setInt:function(a,b){this.setAttribute(a,b)},setFloat:function(a,b){this.setAttribute(a,b)},setContent:function(a){this.children.length>0&&y.debug("Tried to set content for XMLElement with children");
this.content=a},setName:function(){if(arguments.length===1)this.name=arguments[0],this.fullName=arguments[0],this.namespace=null;else{var a=arguments[0].indexOf(":");this.name=arguments[1]===null||a<0?arguments[0]:arguments[0].substring(a+1);this.fullName=arguments[0];this.namespace=arguments[1]}},getName:function(){return this.fullName},getLocalName:function(){return this.name},getAttributeCount:function(){return this.attributes.length},toString:function(){if(this.type==="TEXT")return this.content;
var a=(this.namespace!==""&&this.namespace!==this.name?this.namespace+":":"")+this.name,b="<"+a,f;for(f=0;f<this.attributes.length;f++){var c=this.attributes[f];b+=" "+c.getName()+'="'+c.getValue()+'"'}if(this.children.length===0)b+=this.content===""?"/>":">"+this.content+"</"+a+">";else{b+=">";for(f=0;f<this.children.length;f++)b+=this.children[f].toString();b+="</"+a+">"}return b}};$a.parse=function(a){var b=new $a;b.parse(a);return b};var ld=function(a){for(var b=0,f=0;f<a.length;f++)b=f!==0?j.max(b,
j.abs(a[f])):j.abs(a[f]);a=(b+"").indexOf(".");if(a===0)a=1;else if(a===-1)a=(b+"").length;return a},Ta=c.PMatrix2D=function(){arguments.length===0?this.reset():arguments.length===1&&arguments[0]instanceof Ta?this.set(arguments[0].array()):arguments.length===6&&this.set(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])};Ta.prototype={set:function(){if(arguments.length===6){var a=arguments;this.set([a[0],a[1],a[2],a[3],a[4],a[5]])}else if(arguments.length===1&&arguments[0]instanceof
Ta)this.elements=arguments[0].array();else if(arguments.length===1&&arguments[0]instanceof Array)this.elements=arguments[0].slice()},get:function(){var a=new Ta;a.set(this.elements);return a},reset:function(){this.set([1,0,0,0,1,0])},array:function(){return this.elements.slice()},translate:function(a,b){this.elements[2]=a*this.elements[0]+b*this.elements[1]+this.elements[2];this.elements[5]=a*this.elements[3]+b*this.elements[4]+this.elements[5]},invTranslate:function(a,b){this.translate(-a,-b)},transpose:function(){},
mult:function(a,b){var f,c;a instanceof V?(f=a.x,c=a.y,b||(b=new V)):a instanceof Array&&(f=a[0],c=a[1],b||(b=[]));if(b instanceof Array)b[0]=this.elements[0]*f+this.elements[1]*c+this.elements[2],b[1]=this.elements[3]*f+this.elements[4]*c+this.elements[5];else if(b instanceof V)b.x=this.elements[0]*f+this.elements[1]*c+this.elements[2],b.y=this.elements[3]*f+this.elements[4]*c+this.elements[5],b.z=0;return b},multX:function(a,b){return a*this.elements[0]+b*this.elements[1]+this.elements[2]},multY:function(a,
b){return a*this.elements[3]+b*this.elements[4]+this.elements[5]},skewX:function(a){this.apply(1,0,1,a,0,0)},skewY:function(a){this.apply(1,0,1,0,a,0)},determinant:function(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]},invert:function(){var a=this.determinant();if(j.abs(a)>d.MIN_INT){var b=this.elements[0],f=this.elements[1],c=this.elements[2],e=this.elements[3],g=this.elements[4],i=this.elements[5];this.elements[0]=g/a;this.elements[3]=-e/a;this.elements[1]=-f/a;this.elements[4]=
b/a;this.elements[2]=(f*i-g*c)/a;this.elements[5]=(e*c-b*i)/a;return!0}return!1},scale:function(a,b){a&&!b&&(b=a);a&&b&&(this.elements[0]*=a,this.elements[1]*=b,this.elements[3]*=a,this.elements[4]*=b)},invScale:function(a,b){a&&!b&&(b=a);this.scale(1/a,1/b)},apply:function(){var a;arguments.length===1&&arguments[0]instanceof Ta?a=arguments[0].array():arguments.length===6?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,this.elements[2],
0,0,this.elements[5]],f=0,c=0;c<2;c++)for(var e=0;e<3;e++,f++)b[f]+=this.elements[c*3+0]*a[e+0]+this.elements[c*3+1]*a[e+3];this.elements=b.slice()},preApply:function(){var a;arguments.length===1&&arguments[0]instanceof Ta?a=arguments[0].array():arguments.length===6?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);var b=[0,0,a[2],0,0,a[5]];b[2]=a[2]+this.elements[2]*a[0]+this.elements[5]*a[1];b[5]=a[5]+this.elements[2]*a[3]+this.elements[5]*
a[4];b[0]=this.elements[0]*a[0]+this.elements[3]*a[1];b[3]=this.elements[0]*a[3]+this.elements[3]*a[4];b[1]=this.elements[1]*a[0]+this.elements[4]*a[1];b[4]=this.elements[1]*a[3]+this.elements[4]*a[4];this.elements=b.slice()},rotate:function(a){var b=j.cos(a),a=j.sin(a),f=this.elements[0],c=this.elements[1];this.elements[0]=b*f+a*c;this.elements[1]=-a*f+b*c;f=this.elements[3];c=this.elements[4];this.elements[3]=b*f+a*c;this.elements[4]=-a*f+b*c},rotateZ:function(a){this.rotate(a)},invRotateZ:function(a){this.rotateZ(a-
j.PI)},print:function(){var a=ld(this.elements),a=""+c.nfs(this.elements[0],a,4)+" "+c.nfs(this.elements[1],a,4)+" "+c.nfs(this.elements[2],a,4)+"\n"+c.nfs(this.elements[3],a,4)+" "+c.nfs(this.elements[4],a,4)+" "+c.nfs(this.elements[5],a,4)+"\n\n";c.println(a)}};var z=c.PMatrix3D=function(){this.reset()};z.prototype={set:function(){if(arguments.length===16)this.elements=Array.prototype.slice.call(arguments);else if(arguments.length===1&&arguments[0]instanceof z)this.elements=arguments[0].array();
else if(arguments.length===1&&arguments[0]instanceof Array)this.elements=arguments[0].slice()},get:function(){var a=new z;a.set(this.elements);return a},reset:function(){this.set([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])},array:function(){return this.elements.slice()},translate:function(a,b,f){f===p&&(f=0);this.elements[3]+=a*this.elements[0]+b*this.elements[1]+f*this.elements[2];this.elements[7]+=a*this.elements[4]+b*this.elements[5]+f*this.elements[6];this.elements[11]+=a*this.elements[8]+b*this.elements[9]+
f*this.elements[10];this.elements[15]+=a*this.elements[12]+b*this.elements[13]+f*this.elements[14]},transpose:function(){var a=this.elements.slice();this.elements[0]=a[0];this.elements[1]=a[4];this.elements[2]=a[8];this.elements[3]=a[12];this.elements[4]=a[1];this.elements[5]=a[5];this.elements[6]=a[9];this.elements[7]=a[13];this.elements[8]=a[2];this.elements[9]=a[6];this.elements[10]=a[10];this.elements[11]=a[14];this.elements[12]=a[3];this.elements[13]=a[7];this.elements[14]=a[11];this.elements[15]=
a[15]},mult:function(a,b){var f,c,e,d;if(a instanceof V)f=a.x,c=a.y,e=a.z,d=1,b||(b=new V);else if(a instanceof Array&&(f=a[0],c=a[1],e=a[2],d=a[3]||1,!b||b.length!==3&&b.length!==4))b=[0,0,0];b instanceof Array&&(b.length===3?(b[0]=this.elements[0]*f+this.elements[1]*c+this.elements[2]*e+this.elements[3],b[1]=this.elements[4]*f+this.elements[5]*c+this.elements[6]*e+this.elements[7],b[2]=this.elements[8]*f+this.elements[9]*c+this.elements[10]*e+this.elements[11]):b.length===4&&(b[0]=this.elements[0]*
f+this.elements[1]*c+this.elements[2]*e+this.elements[3]*d,b[1]=this.elements[4]*f+this.elements[5]*c+this.elements[6]*e+this.elements[7]*d,b[2]=this.elements[8]*f+this.elements[9]*c+this.elements[10]*e+this.elements[11]*d,b[3]=this.elements[12]*f+this.elements[13]*c+this.elements[14]*e+this.elements[15]*d));if(b instanceof V)b.x=this.elements[0]*f+this.elements[1]*c+this.elements[2]*e+this.elements[3],b.y=this.elements[4]*f+this.elements[5]*c+this.elements[6]*e+this.elements[7],b.z=this.elements[8]*
f+this.elements[9]*c+this.elements[10]*e+this.elements[11];return b},preApply:function(){var a;arguments.length===1&&arguments[0]instanceof z?a=arguments[0].array():arguments.length===16?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,c=0;c<4;c++)for(var e=0;e<4;e++,f++)b[f]+=this.elements[e+0]*a[c*4+0]+this.elements[e+4]*a[c*4+1]+this.elements[e+8]*a[c*4+2]+this.elements[e+12]*a[c*4+3];this.elements=
b.slice()},apply:function(){var a;arguments.length===1&&arguments[0]instanceof z?a=arguments[0].array():arguments.length===16?a=Array.prototype.slice.call(arguments):arguments.length===1&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=0,c=0;c<4;c++)for(var e=0;e<4;e++,f++)b[f]+=this.elements[c*4+0]*a[e+0]+this.elements[c*4+1]*a[e+4]+this.elements[c*4+2]*a[e+8]+this.elements[c*4+3]*a[e+12];this.elements=b.slice()},rotate:function(a,b,f,d){if(f){var e=c.cos(a),
a=c.sin(a),g=1-e;this.apply(g*b*b+e,g*b*f-a*d,g*b*d+a*f,0,g*b*f+a*d,g*f*f+e,g*f*d-a*b,0,g*b*d-a*f,g*f*d+a*b,g*d*d+e,0,0,0,0,1)}else this.rotateZ(a)},invApply:function(){Fb===p&&(Fb=new z);var a=arguments;Fb.set(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]);if(!Fb.invert())return!1;this.preApply(Fb);return!0},rotateX:function(a){var b=c.cos(a),a=c.sin(a);this.apply([1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1])},rotateY:function(a){var b=c.cos(a),a=c.sin(a);this.apply([b,
0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1])},rotateZ:function(a){var b=j.cos(a),a=j.sin(a);this.apply([b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1])},scale:function(a,b,f){a&&!b&&!f?b=f=a:a&&b&&!f&&(f=1);a&&b&&f&&(this.elements[0]*=a,this.elements[1]*=b,this.elements[2]*=f,this.elements[4]*=a,this.elements[5]*=b,this.elements[6]*=f,this.elements[8]*=a,this.elements[9]*=b,this.elements[10]*=f,this.elements[12]*=a,this.elements[13]*=b,this.elements[14]*=f)},skewX:function(a){this.apply(1,j.tan(a),0,0,0,1,0,0,0,0,1,0,0,0,
0,1)},skewY:function(a){this.apply(1,0,0,0,j.tan(a),1,0,0,0,0,1,0,0,0,0,1)},multX:function(a,b,f,c){return f?c?this.elements[0]*a+this.elements[1]*b+this.elements[2]*f+this.elements[3]*c:this.elements[0]*a+this.elements[1]*b+this.elements[2]*f+this.elements[3]:this.elements[0]*a+this.elements[1]*b+this.elements[3]},multY:function(a,b,f,c){return f?c?this.elements[4]*a+this.elements[5]*b+this.elements[6]*f+this.elements[7]*c:this.elements[4]*a+this.elements[5]*b+this.elements[6]*f+this.elements[7]:
this.elements[4]*a+this.elements[5]*b+this.elements[7]},multZ:function(a,b,f,c){return c?this.elements[8]*a+this.elements[9]*b+this.elements[10]*f+this.elements[11]*c:this.elements[8]*a+this.elements[9]*b+this.elements[10]*f+this.elements[11]},multW:function(a,b,f,c){return c?this.elements[12]*a+this.elements[13]*b+this.elements[14]*f+this.elements[15]*c:this.elements[12]*a+this.elements[13]*b+this.elements[14]*f+this.elements[15]},invert:function(){var a=this.elements[0]*this.elements[5]-this.elements[1]*
this.elements[4],b=this.elements[0]*this.elements[6]-this.elements[2]*this.elements[4],f=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4],c=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5],e=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5],d=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6],i=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12],k=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12],
l=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12],h=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13],o=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13],q=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14],n=a*q-b*o+f*h+c*l-e*k+d*i;if(j.abs(n)<=1.0E-9)return!1;var p=[];p[0]=+this.elements[5]*q-this.elements[6]*o+this.elements[7]*h;p[4]=-this.elements[4]*q+this.elements[6]*l-this.elements[7]*k;p[8]=+this.elements[4]*
o-this.elements[5]*l+this.elements[7]*i;p[12]=-this.elements[4]*h+this.elements[5]*k-this.elements[6]*i;p[1]=-this.elements[1]*q+this.elements[2]*o-this.elements[3]*h;p[5]=+this.elements[0]*q-this.elements[2]*l+this.elements[3]*k;p[9]=-this.elements[0]*o+this.elements[1]*l-this.elements[3]*i;p[13]=+this.elements[0]*h-this.elements[1]*k+this.elements[2]*i;p[2]=+this.elements[13]*d-this.elements[14]*e+this.elements[15]*c;p[6]=-this.elements[12]*d+this.elements[14]*f-this.elements[15]*b;p[10]=+this.elements[12]*
e-this.elements[13]*f+this.elements[15]*a;p[14]=-this.elements[12]*c+this.elements[13]*b-this.elements[14]*a;p[3]=-this.elements[9]*d+this.elements[10]*e-this.elements[11]*c;p[7]=+this.elements[8]*d-this.elements[10]*f+this.elements[11]*b;p[11]=-this.elements[8]*e+this.elements[9]*f-this.elements[11]*a;p[15]=+this.elements[8]*c-this.elements[9]*b+this.elements[10]*a;a=1/n;p[0]*=a;p[1]*=a;p[2]*=a;p[3]*=a;p[4]*=a;p[5]*=a;p[6]*=a;p[7]*=a;p[8]*=a;p[9]*=a;p[10]*=a;p[11]*=a;p[12]*=a;p[13]*=a;p[14]*=a;p[15]*=
a;this.elements=p.slice();return!0},toString:function(){for(var a="",b=0;b<15;b++)a+=this.elements[b]+", ";a+=this.elements[15];return a},print:function(){var a=ld(this.elements),a=""+c.nfs(this.elements[0],a,4)+" "+c.nfs(this.elements[1],a,4)+" "+c.nfs(this.elements[2],a,4)+" "+c.nfs(this.elements[3],a,4)+"\n"+c.nfs(this.elements[4],a,4)+" "+c.nfs(this.elements[5],a,4)+" "+c.nfs(this.elements[6],a,4)+" "+c.nfs(this.elements[7],a,4)+"\n"+c.nfs(this.elements[8],a,4)+" "+c.nfs(this.elements[9],a,4)+
" "+c.nfs(this.elements[10],a,4)+" "+c.nfs(this.elements[11],a,4)+"\n"+c.nfs(this.elements[12],a,4)+" "+c.nfs(this.elements[13],a,4)+" "+c.nfs(this.elements[14],a,4)+" "+c.nfs(this.elements[15],a,4)+"\n\n";c.println(a)},invTranslate:function(a,b,f){this.preApply(1,0,0,-a,0,1,0,-b,0,0,1,-f,0,0,0,1)},invRotateX:function(a){var b=j.cos(-a),a=j.sin(-a);this.preApply([1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1])},invRotateY:function(a){var b=j.cos(-a),a=j.sin(-a);this.preApply([b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1])},
invRotateZ:function(a){var b=j.cos(-a),a=j.sin(-a);this.preApply([b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1])},invScale:function(a,b,f){this.preApply([1/a,0,0,0,0,1/b,0,0,0,0,1/f,0,0,0,0,1])}};var Ua=c.PMatrixStack=function(){this.matrixStack=[]};Ua.prototype.load=function(){var a=$.$newPMatrix();arguments.length===1?a.set(arguments[0]):a.set(arguments);this.matrixStack.push(a)};w.prototype.$newPMatrix=function(){return new Ta};F.prototype.$newPMatrix=function(){return new z};Ua.prototype.push=function(){this.matrixStack.push(this.peek())};
Ua.prototype.pop=function(){return this.matrixStack.pop()};Ua.prototype.peek=function(){var a=$.$newPMatrix();a.set(this.matrixStack[this.matrixStack.length-1]);return a};Ua.prototype.mult=function(a){this.matrixStack[this.matrixStack.length-1].apply(a)};c.split=function(a,b){return a.split(b)};c.splitTokens=function(a,b){arguments.length===1&&(b="\n\t\r\u000c ");for(var b="["+b+"]",f=[],c=0,e=a.search(b);e>=0;)e===0?a=a.substring(1):(f[c]=a.substring(0,e),c++,a=a.substring(e)),e=a.search(b);a.length>
0&&(f[c]=a);f.length===0&&(f=p);return f};c.append=function(a,b){a[a.length]=b;return a};c.concat=function(a,b){return a.concat(b)};c.sort=function(a,b){var f=[];if(a.length>0){for(var c=b>0?b:a.length,e=0;e<c;e++)f.push(a[e]);typeof a[0]==="string"?f.sort():f.sort(function(a,b){return a-b});if(b>0)for(c=f.length;c<a.length;c++)f.push(a[c])}return f};c.splice=function(a,b,f){if(b.length===0)return a;if(b instanceof Array)for(var c=0;c<b.length;f++,c++)a.splice(f,0,b[c]);else a.splice(f,0,b);return a};
c.subset=function(a,b,f){if(arguments.length===2)return a.slice(b,a.length);else if(arguments.length===3)return a.slice(b,b+f)};c.join=function(a,b){return a.join(b)};c.shorten=function(a){for(var b=[],f=a.length,c=0;c<f;c++)b[c]=a[c];b.pop();return b};c.expand=function(a,b){var c=a.slice(0);if(arguments.length===1)return c.length=a.length*2,c;else if(arguments.length===2)return c.length=b,c};c.arrayCopy=function(){var a,b=0,c,d=0,e;arguments.length===2?(a=arguments[0],c=arguments[1],e=a.length):
arguments.length===3?(a=arguments[0],c=arguments[1],e=arguments[2]):arguments.length===5&&(a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[3],e=arguments[4]);for(var g=b;g<e+b;g++,d++)if(c[d]!==p)c[d]=a[g];else throw"array index out of bounds exception";};c.reverse=function(a){return a.reverse()};c.mix=function(a,b,c){return a+((b-a)*c>>8)};c.peg=function(a){return a<0?0:a>255?255:a};c.modes={replace:function(a,b){return b},blend:function(a,b){var f=(b&d.ALPHA_MASK)>>>24;return j.min(((a&
d.ALPHA_MASK)>>>24)+f,255)<<24|c.mix(a&d.RED_MASK,b&d.RED_MASK,f)&d.RED_MASK|c.mix(a&d.GREEN_MASK,b&d.GREEN_MASK,f)&d.GREEN_MASK|c.mix(a&d.BLUE_MASK,b&d.BLUE_MASK,f)},add:function(a,b){var c=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>>24)+c,255)<<24|j.min((a&d.RED_MASK)+((b&d.RED_MASK)>>8)*c,d.RED_MASK)&d.RED_MASK|j.min((a&d.GREEN_MASK)+((b&d.GREEN_MASK)>>8)*c,d.GREEN_MASK)&d.GREEN_MASK|j.min((a&d.BLUE_MASK)+((b&d.BLUE_MASK)*c>>8),d.BLUE_MASK)},subtract:function(a,b){var c=(b&d.ALPHA_MASK)>>>
24;return j.min(((a&d.ALPHA_MASK)>>>24)+c,255)<<24|j.max((a&d.RED_MASK)-((b&d.RED_MASK)>>8)*c,d.GREEN_MASK)&d.RED_MASK|j.max((a&d.GREEN_MASK)-((b&d.GREEN_MASK)>>8)*c,d.BLUE_MASK)&d.GREEN_MASK|j.max((a&d.BLUE_MASK)-((b&d.BLUE_MASK)*c>>8),0)},lightest:function(a,b){var c=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>>24)+c,255)<<24|j.max(a&d.RED_MASK,((b&d.RED_MASK)>>8)*c)&d.RED_MASK|j.max(a&d.GREEN_MASK,((b&d.GREEN_MASK)>>8)*c)&d.GREEN_MASK|j.max(a&d.BLUE_MASK,(b&d.BLUE_MASK)*c>>8)},darkest:function(a,
b){var f=(b&d.ALPHA_MASK)>>>24;return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.mix(a&d.RED_MASK,j.min(a&d.RED_MASK,((b&d.RED_MASK)>>8)*f),f)&d.RED_MASK|c.mix(a&d.GREEN_MASK,j.min(a&d.GREEN_MASK,((b&d.GREEN_MASK)>>8)*f),f)&d.GREEN_MASK|c.mix(a&d.BLUE_MASK,j.min(a&d.BLUE_MASK,(b&d.BLUE_MASK)*f>>8),f)},difference:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,l=b&d.BLUE_MASK,i=m>i?m-i:i-m,k=e>k?e-k:k-e,
l=g>l?g-l:l-g;return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},exclusion:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,l=b&d.BLUE_MASK,i=m+i-(m*i>>7),k=e+k-(e*k>>7),l=g+l-(g*l>>7);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},multiply:function(a,b){var f=
(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=m*((b&d.RED_MASK)>>16)>>8,k=e*((b&d.GREEN_MASK)>>8)>>8,l=g*(b&d.BLUE_MASK)>>8;return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},screen:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=255-((255-m)*(255-((b&d.RED_MASK)>>16))>>8),k=255-((255-e)*(255-((b&d.GREEN_MASK)>>8))>>8),l=255-((255-g)*(255-
(b&d.BLUE_MASK))>>8);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},hard_light:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,l=b&d.BLUE_MASK,i=i<128?m*i>>7:255-((255-m)*(255-i)>>7),k=k<128?e*k>>7:255-((255-e)*(255-k)>>7),l=l<128?g*l>>7:255-((255-g)*(255-l)>>7);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<
16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},soft_light:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,l=b&d.BLUE_MASK,i=(m*i>>7)+(m*m>>8)-(m*m*i>>15),k=(e*k>>7)+(e*e>>8)-(e*e*k>>15),l=(g*l>>7)+(g*g>>8)-(g*g*l>>15);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},overlay:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>
16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,l=b&d.BLUE_MASK,i=m<128?m*i>>7:255-((255-m)*(255-i)>>7),k=e<128?e*k>>7:255-((255-e)*(255-k)>>7),l=g<128?g*l>>7:255-((255-g)*(255-l)>>7);return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},dodge:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,l=b&d.BLUE_MASK,
i=i===255?255:c.peg((m<<8)/(255-i)),k=k===255?255:c.peg((e<<8)/(255-k)),l=l===255?255:c.peg((g<<8)/(255-l));return j.min(((a&d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))},burn:function(a,b){var f=(b&d.ALPHA_MASK)>>>24,m=(a&d.RED_MASK)>>16,e=(a&d.GREEN_MASK)>>8,g=a&d.BLUE_MASK,i=(b&d.RED_MASK)>>16,k=(b&d.GREEN_MASK)>>8,l=b&d.BLUE_MASK,i=i===0?0:255-c.peg((255-m<<8)/i),k=k===0?0:255-c.peg((255-e<<8)/k),l=l===0?0:255-c.peg((255-g<<8)/l);return j.min(((a&
d.ALPHA_MASK)>>>24)+f,255)<<24|c.peg(m+((i-m)*f>>8))<<16|c.peg(e+((k-e)*f>>8))<<8|c.peg(g+((l-g)*f>>8))}};c.color=function(a,b,c,m){if(a!==p&&b!==p&&c!==p&&m!==p)return E(a,b,c,m);if(a!==p&&b!==p&&c!==p)return E(a,b,c,ja);if(a!==p&&b!==p){var e;a&d.ALPHA_MASK?(b=j.round(255*(b/ja)),e=a-(a&d.ALPHA_MASK)+((b>255?255:b)<<24&d.ALPHA_MASK)):ya===d.RGB?e=E(a,a,a,b):ya===d.HSB&&(e=E(0,0,a/ca*ia,b));return e}if(typeof a==="number"){var g;a<=ca&&a>=0?ya===d.RGB?g=E(a,a,a,ja):ya===d.HSB&&(g=E(0,0,a/ca*ia,ja)):
a&&(g=a);return g}return E(ca,ra,ia,ja)};c.color.toString=function(a){return"rgba("+((a&d.RED_MASK)>>>16)+","+((a&d.GREEN_MASK)>>>8)+","+(a&d.BLUE_MASK)+","+((a&d.ALPHA_MASK)>>>24)/255+")"};c.color.toInt=function(a,b,c,m){return m<<24&d.ALPHA_MASK|a<<16&d.RED_MASK|b<<8&d.GREEN_MASK|c&d.BLUE_MASK};c.color.toArray=function(a){return[(a&d.RED_MASK)>>>16,(a&d.GREEN_MASK)>>>8,a&d.BLUE_MASK,(a&d.ALPHA_MASK)>>>24]};c.color.toGLArray=function(a){return[((a&d.RED_MASK)>>>16)/255,((a&d.GREEN_MASK)>>>8)/255,
(a&d.BLUE_MASK)/255,((a&d.ALPHA_MASK)>>>24)/255]};c.color.toRGB=function(a,b,c){var a=a>ca?ca:a,b=b>ra?ra:b,c=c>ia?ia:c,a=a/ca*360,b=b/ra*100,c=c/ia*100,d=j.round(c/100*255);if(b===0)return[d,d,d];else{a%=360;var e=a%60,g=j.round(c*(100-b)/1E4*255),i=j.round(c*(6E3-b*e)/6E5*255),b=j.round(c*(6E3-b*(60-e))/6E5*255);switch(j.floor(a/60)){case 0:return[d,b,g];case 1:return[i,d,g];case 2:return[g,d,b];case 3:return[g,i,d];case 4:return[b,g,d];case 5:return[d,g,i]}}};c.color.toHSB=function(a){var b,f,
m;b=((a&d.RED_MASK)>>>16)/255;f=((a&d.GREEN_MASK)>>>8)/255;m=(a&d.BLUE_MASK)/255;var a=c.max(c.max(b,f),m),e=c.min(c.min(b,f),m);if(e===a)return[0,0,a];else b=b===a?(f-m)/(a-e):f===a?2+(m-b)/(a-e):4+(b-f)/(a-e),b/=6,b<0?b+=1:b>1&&(b-=1);return[b*ca,(a-e)/a*ra,a*ia]};c.brightness=function(a){return c.color.toHSB(a)[2]};c.saturation=function(a){return c.color.toHSB(a)[1]};c.hue=function(a){return c.color.toHSB(a)[0]};c.red=function(a){return((a&d.RED_MASK)>>>16)/255*ca};c.green=function(a){return((a&
d.GREEN_MASK)>>>8)/255*ra};c.blue=function(a){return(a&d.BLUE_MASK)/255*ia};c.alpha=function(a){return((a&d.ALPHA_MASK)>>>24)/255*ja};c.lerpColor=function(a,b,f){var m=c.color(a),e=(m&d.RED_MASK)>>>16,g=(m&d.GREEN_MASK)>>>8,a=m&d.BLUE_MASK,m=((m&d.ALPHA_MASK)>>>24)/ja,i=c.color(b),k=(i&d.GREEN_MASK)>>>8,l=i&d.BLUE_MASK,b=((i&d.ALPHA_MASK)>>>24)/ja,e=parseInt(c.lerp(e,(i&d.RED_MASK)>>>16,f),10),g=parseInt(c.lerp(g,k,f),10),a=parseInt(c.lerp(a,l,f),10),f=parseFloat(c.lerp(m,b,f)*ja);return c.color.toInt(e,
g,a,f)};c.defaultColor=function(a,b,f){var m=ya;ya=d.RGB;a=c.color(a/255*ca,b/255*ra,f/255*ia);ya=m;return a};c.colorMode=function(){ya=arguments[0];arguments.length>1&&(ca=arguments[1],ra=arguments[2]||arguments[1],ia=arguments[3]||arguments[1],ja=arguments[4]||arguments[1])};c.blendColor=function(a,b,f){var m=0;switch(f){case d.REPLACE:m=c.modes.replace(a,b);break;case d.BLEND:m=c.modes.blend(a,b);break;case d.ADD:m=c.modes.add(a,b);break;case d.SUBTRACT:m=c.modes.subtract(a,b);break;case d.LIGHTEST:m=
c.modes.lightest(a,b);break;case d.DARKEST:m=c.modes.darkest(a,b);break;case d.DIFFERENCE:m=c.modes.difference(a,b);break;case d.EXCLUSION:m=c.modes.exclusion(a,b);break;case d.MULTIPLY:m=c.modes.multiply(a,b);break;case d.SCREEN:m=c.modes.screen(a,b);break;case d.HARD_LIGHT:m=c.modes.hard_light(a,b);break;case d.SOFT_LIGHT:m=c.modes.soft_light(a,b);break;case d.OVERLAY:m=c.modes.overlay(a,b);break;case d.DODGE:m=c.modes.dodge(a,b);break;case d.BURN:m=c.modes.burn(a,b)}return m};c.printMatrix=function(){O.print()};
w.prototype.translate=function(a,b){ea.translate(a,b);fa.invTranslate(a,b);h.translate(a,b)};F.prototype.translate=function(a,b,c){ea.translate(a,b,c);fa.invTranslate(a,b,c)};w.prototype.scale=function(a,b){ea.scale(a,b);fa.invScale(a,b);h.scale(a,b||a)};F.prototype.scale=function(a,b,c){ea.scale(a,b,c);fa.invScale(a,b,c)};w.prototype.pushMatrix=function(){rb.load(O);sb.load(Ha);h.save()};F.prototype.pushMatrix=function(){rb.load(O);sb.load(Ha)};w.prototype.popMatrix=function(){O.set(rb.pop());Ha.set(sb.pop());
Ab()};F.prototype.popMatrix=function(){O.set(rb.pop());Ha.set(sb.pop())};w.prototype.resetMatrix=function(){ea.reset();fa.reset();h.setTransform(1,0,0,1,0,0)};F.prototype.resetMatrix=function(){ea.reset();fa.reset()};C.prototype.applyMatrix=function(){var a=arguments;ea.apply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]);fa.invApply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])};w.prototype.applyMatrix=function(){for(var a=
arguments,b=a.length;b<16;b++)a[b]=0;a[10]=a[15]=1;C.prototype.applyMatrix.apply(this,a)};c.rotateX=function(a){ea.rotateX(a);fa.invRotateX(a)};c.rotateZ=function(a){ea.rotateZ(a);fa.invRotateZ(a);c.use3DContext||h.rotate(a)};c.rotateY=function(a){ea.rotateY(a);fa.invRotateY(a)};w.prototype.rotate=function(a){c.rotateZ(a)};F.prototype.rotate=function(a){c.rotateZ(a)};c.pushStyle=function(){h.save();c.pushMatrix();hd.push({doFill:P,currentFillColor:Qa,doStroke:L,currentStrokeColor:Y,curTint:db,curRectMode:cb,
curColorMode:ya,colorModeX:ca,colorModeZ:ia,colorModeY:ra,colorModeA:ja,curTextFont:W,curTextSize:N})};c.popStyle=function(){var a=hd.pop();if(a)Ab(),c.popMatrix(),P=a.doFill,Qa=a.currentFillColor,L=a.doStroke,Y=a.currentStrokeColor,db=a.curTint,cb=a.curRectmode,ya=a.curColorMode,ca=a.colorModeX,ia=a.colorModeZ,ra=a.colorModeY,ja=a.colorModeA,W=a.curTextFont,N=a.curTextSize;else throw"Too many popStyle() without enough pushStyle()";};c.year=function(){return(new Date).getFullYear()};c.month=function(){return(new Date).getMonth()+
1};c.day=function(){return(new Date).getDate()};c.hour=function(){return(new Date).getHours()};c.minute=function(){return(new Date).getMinutes()};c.second=function(){return(new Date).getSeconds()};c.millis=function(){return(new Date).getTime()-Wc};C.prototype.redraw=function(){var a=((new Date).getTime()-qc)/1E3;Tb++;var b=Tb/a;if(a>0.5)qc=(new Date).getTime(),Tb=0,c.__frameRate=b;c.frameCount++};w.prototype.redraw=function(){C.prototype.redraw.apply(this,arguments);h.lineWidth=aa;h.save();c.draw();
Ab()};F.prototype.redraw=function(){C.prototype.redraw.apply(this,arguments);h.clear(h.DEPTH_BUFFER_BIT);xa={attributes:{},locations:{}};c.noLights();c.lightFalloff(1,0,0);c.shininess(1);c.ambient(255,255,255);c.specular(0,0,0);c.emissive(0,0,0);c.camera();c.draw()};c.noLoop=function(){Qb=bb=!1;clearInterval(Rb)};c.loop=function(){Qb||(qc=(new Date).getTime(),Tb=0,Rb=Q.setInterval(function(){try{c.redraw()}catch(a){throw Q.clearInterval(Rb),a;}},Uc),Qb=bb=!0)};c.frameRate=function(a){mc=a;Uc=1E3/
mc;bb&&(c.noLoop(),c.loop())};var Sa=[];c.exit=function(){Q.clearInterval(Rb);var a=c.externals.canvas.id;ib.splice(Lb[a],1);delete Lb[a];for(var b in y.lib)y.lib.hasOwnProperty(b)&&y.lib[b].hasOwnProperty("detach")&&y.lib[b].detach(c);a=0;for(b=Sa.length;a<b;a++){var f=Sa[a][0],d=Sa[a][1],e=Sa[a][2];f.removeEventListener?f.removeEventListener(d,e,!1):f.detachEvent&&f.detachEvent("on"+d,e)}};c.cursor=function(){if(arguments.length>1||arguments.length===1&&arguments[0]instanceof c.PImage){var a=arguments[0],
b,f;if(arguments.length>=3){if(b=arguments[1],f=arguments[2],b<0||f<0||f>=a.height||b>=a.width)throw"x and y must be non-negative and less than the dimensions of the image";}else b=a.width>>>1,f=a.height>>>1;a='url("'+a.toDataURL()+'") '+b+" "+f+", default";q.style.cursor=a}else q.style.cursor=arguments.length===1?arguments[0]:yd};c.noCursor=function(){q.style.cursor=d.NOCURSOR};c.link=function(a,b){b!==p?Q.open(a,b):Q.location=a};c.beginDraw=function(){};c.endDraw=function(){};c.Import=function(){};
var md=function(a){a.preventDefault();a.stopPropagation()};c.disableContextMenu=function(){q.addEventListener("contextmenu",md,!1)};c.enableContextMenu=function(){q.removeEventListener("contextmenu",md,!1)};c.status=function(a){Q.status=a};c.binary=function(a,b){var c=32;if(typeof a==="number")return b&&(c=b),Kc(a,c);a instanceof ka&&(a=a.toString().charCodeAt(0),c=b?32:16);c=Kc(a,c);b&&(c=c.substr(-b));return c};c.unbinary=function(a){var b=/^[0|1]{8}$/,f=0;if(a instanceof Array){f=[];for(b=0;b<
a.length;b++)f[b]=c.unbinary(a[b]);return f}else if(isNaN(a))throw"NaN_Err";else if(arguments.length===1||a.length===8)if(b.test(a)){for(b=0;b<8;b++)f+=j.pow(2,b)*parseInt(a.charAt(7-b),10);return f+""}else throw"notBinary: the value passed into unbinary was not an 8 bit binary number";else throw"longErr";};c.nf=function(a,b,c){return wa(a,"","-",b,c)};c.nfs=function(a,b,c){return wa(a," ","-",b,c)};c.nfp=function(a,b,c){return wa(a,"+","-",b,c)};c.nfc=function(a,b,c){return wa(a,"","-",b,c,",")};
c.hex=function(a,b){arguments.length===1&&(b=a instanceof ka?4:8);var c=a,d=b,d=d===p||d===null?d=8:d;c<0&&(c=4294967295+c+1);for(c=Number(c).toString(16).toUpperCase();c.length<d;)c="0"+c;c.length>=d&&(c=c.substring(c.length-d,c.length));return c};c.unhex=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(qa(a[c]));return b}else return qa(a)};c.loadStrings=function(a){if(localStorage[a])return localStorage[a].split("\n");a=fc(a);if(typeof a!=="string"||a==="")return[];a=a.replace(/(\r\n?)/g,
"\n").replace(/\n$/,"");return a.split("\n")};c.saveStrings=function(a,b){localStorage[a]=b.join("\n")};c.loadBytes=function(a){for(var a=fc(a),b=[],c=0;c<a.length;c++)b.push(a.charCodeAt(c));return b};c.matchAll=function(a,b){for(var c=[],d,e=RegExp(b,"g");(d=e.exec(a))!==null;)c.push(d),d[0].length===0&&++e.lastIndex;return c.length>0?c:null};c.__contains=function(a,b){if(typeof a!=="string")return a.contains.apply(a,ha(arguments));return a!==null&&b!==null&&typeof b==="string"&&a.indexOf(b)>-1};
c.__replaceAll=function(a,b,c){if(typeof a!=="string")return a.replaceAll.apply(a,ha(arguments));return a.replace(RegExp(b,"g"),c)};c.__replaceFirst=function(a,b,c){if(typeof a!=="string")return a.replaceFirst.apply(a,ha(arguments));return a.replace(RegExp(b,""),c)};c.__replace=function(a,b,c){if(typeof a!=="string")return a.replace.apply(a,ha(arguments));if(b instanceof RegExp)return a.replace(b,c);typeof b!=="string"&&(b=b.toString());if(b==="")return a;var d=a.indexOf(b);if(d<0)return a;var e=
0,g="";do g+=a.substring(e,d)+c,e=d+b.length;while((d=a.indexOf(b,e))>=0);return g+a.substring(e)};c.__equals=function(a,b){if(a.equals instanceof Function)return a.equals.apply(a,ha(arguments));return a.valueOf()===b.valueOf()};c.__toCharArray=function(a){if(typeof a!=="string")return a.toCharArray.apply(a,ha(arguments));for(var b=[],c=0,d=a.length;c<d;++c)b[c]=new ka(a.charAt(c));return b};c.__split=function(a,b,c){b=RegExp(b);if(c===p||c<1)return a.split(b);for(var d=[],e;(e=a.search(b))!==-1&&
d.length<c-1;){var g=b.exec(a).toString();d.push(a.substring(0,e));a=a.substring(e+g.length)}(e!==-1||a!=="")&&d.push(a);return d};c.match=function(a,b){return a.match(b)};c.__hashCode=function(a){if(a.hashCode instanceof Function)return a.hashCode.apply(a,ha(arguments));return 0|a};c.__printStackTrace=function(a){c.println("Exception: "+a.toString())};var cc=[];c.console=Q.console||y.logger;c.println=function(a){var b=cc.length;if(b)y.logger.log(cc.join("")),cc.length=0;arguments.length===0&&b===
0?y.logger.log(""):arguments.length!==0&&y.logger.log(a)};c.print=function(a){cc.push(a)};c.str=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(a[c].toString()+"");return b}else return a.toString()+""};c.trim=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(a[c].replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,""));return b}else return a.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,"")};c.parseBoolean=function(a){if(a instanceof Array){for(var b=
[],c=0;c<a.length;c++)b.push(Aa(a[c]));return b}else return Aa(a)};c.parseByte=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(0-(a[c]&128)|a[c]&127);return b}else return 0-(a&128)|a&127};c.parseChar=function(a){if(typeof a==="number")return new ka(String.fromCharCode(a&65535));else if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(new ka(String.fromCharCode(a[c]&65535)));return b}else throw"char() may receive only one argument of type int, byte, int[], or byte[].";
};c.parseFloat=function(a){if(a instanceof Array){for(var b=[],c=0;c<a.length;c++)b.push(va(a[c]));return b}else return va(a)};c.parseInt=function(a,b){if(a instanceof Array){for(var c=[],d=0;d<a.length;d++)typeof a[d]==="string"&&!/^\s*[+\-]?\d+\s*$/.test(a[d])?c.push(0):c.push(Jc(a[d],b));return c}else return Jc(a,b)};c.__int_cast=function(a){return 0|a};c.__instanceof=function(a,b){if(typeof b!=="function")throw"Function is expected as type argument for instanceof operator";if(typeof a==="string")return b===
Object||b===String;if(a instanceof b)return!0;if(typeof a!=="object"||a===null)return!1;var c=a.constructor;if(b.$isInterface){for(var d=[];c;)c.$interfaces&&(d=d.concat(c.$interfaces)),c=c.$base;for(;d.length>0;){c=d.shift();if(c===b)return!0;c.$interfaces&&(d=d.concat(c.$interfaces))}return!1}for(;c.hasOwnProperty("$base");)if(c=c.$base,c===b)return!0;return!1};c.abs=j.abs;c.ceil=j.ceil;c.constrain=function(a,b,c){return a>c?c:a<b?b:a};c.dist=function(){var a,b,c;if(arguments.length===4)return a=
arguments[0]-arguments[2],b=arguments[1]-arguments[3],j.sqrt(a*a+b*b);else if(arguments.length===6)return a=arguments[0]-arguments[3],b=arguments[1]-arguments[4],c=arguments[2]-arguments[5],j.sqrt(a*a+b*b+c*c)};c.exp=j.exp;c.floor=j.floor;c.lerp=function(a,b,c){return(b-a)*c+a};c.log=j.log;c.mag=function(a,b,c){if(arguments.length===2)return j.sqrt(a*a+b*b);else if(arguments.length===3)return j.sqrt(a*a+b*b+c*c)};c.map=function(a,b,c,d,e){return d+(e-d)*((a-b)/(c-b))};c.max=function(){if(arguments.length===
2)return arguments[0]<arguments[1]?arguments[1]:arguments[0];else{var a=arguments.length===1?arguments[0]:arguments;if(!("length"in a&&a.length>0))throw"Non-empty array is expected";for(var b=a[0],c=a.length,d=1;d<c;++d)b<a[d]&&(b=a[d]);return b}};c.min=function(){if(arguments.length===2)return arguments[0]<arguments[1]?arguments[0]:arguments[1];else{var a=arguments.length===1?arguments[0]:arguments;if(!("length"in a&&a.length>0))throw"Non-empty array is expected";for(var b=a[0],c=a.length,d=1;d<
c;++d)b>a[d]&&(b=a[d]);return b}};c.norm=function(a,b,c){return(a-b)/(c-b)};c.pow=j.pow;c.round=j.round;c.sq=function(a){return a*a};c.sqrt=j.sqrt;c.acos=j.acos;c.asin=j.asin;c.atan=j.atan;c.atan2=j.atan2;c.cos=j.cos;c.degrees=function(a){return a*180/j.PI};c.radians=function(a){return a/180*j.PI};c.sin=j.sin;c.tan=j.tan;var dc=j.random;c.random=function(){if(arguments.length===0)return dc();else if(arguments.length===1)return dc()*arguments[0];else{var a=arguments[0],b=arguments[1];return dc()*(b-
a)+a}};Pa.createRandomized=function(){var a=new Date;return new Pa(a/6E4&4294967295,a&4294967295)};c.randomSeed=function(a){dc=(new Pa(a)).nextDouble};c.Random=function(a){var b=!1,c,d;this.nextGaussian=function(){if(b)return b=!1,c;else{var a,g,i;do a=2*d()-1,g=2*d()-1,i=a*a+g*g;while(i>=1||i===0);i=j.sqrt(-2*j.log(i)/i);c=g*i;b=!0;return a*i}};d=a===p?j.random:(new Pa(a)).nextDouble};var Ia={generator:p,octaves:4,fallout:0.5,seed:p};c.noise=function(a,b,c){if(Ia.generator===p)Ia.generator=new vd(Ia.seed);
for(var d=Ia.generator,e=1,g=1,i=0,k=0;k<Ia.octaves;++k){e*=Ia.fallout;switch(arguments.length){case 1:i+=e*(1+d.noise1d(g*a))/2;break;case 2:i+=e*(1+d.noise2d(g*a,g*b))/2;break;case 3:i+=e*(1+d.noise3d(g*a,g*b,g*c))/2}g*=2}return i};c.noiseDetail=function(a,b){Ia.octaves=a;if(b!==p)Ia.fallout=b};c.noiseSeed=function(a){Ia.seed=a;Ia.generator=p};C.prototype.size=function(a,b){c.stroke(0);c.fill(255);var f={fillStyle:h.fillStyle,strokeStyle:h.strokeStyle,lineCap:h.lineCap,lineJoin:h.lineJoin};q.style.length>
0&&(q.style.removeProperty("width"),q.style.removeProperty("height"));q.width=c.width=a||100;q.height=c.height=b||100;for(var m in f)f.hasOwnProperty(m)&&(h[m]=f[m]);c.textSize(N);c.background();dd=j.max(1E3,a*b*0.05);c.externals.context=h;for(f=0;f<d.SINCOS_LENGTH;f++)pb[f]=c.sin(f*(d.PI/180)*0.5),qb[f]=c.cos(f*(d.PI/180)*0.5)};w.prototype.size=function(){h===p&&(h=q.getContext("2d"),rb=new Ua,sb=new Ua,ea=new Ta,fa=new Ta,O=ea,Ha=fa);C.prototype.size.apply(this,arguments)};F.prototype.size=function(){var a=
!1;return function(b,f){function d(a){for(var b=["experimental-webgl","webgl","webkit-3d"],c,f=0,e=b.length;f<e;f++)if(c=a.getContext(b[f]))break;return c}if(a)throw"Multiple calls to size() for 3D renders are not allowed.";a=!0;try{if(q.width!==b||q.height!==f)q.setAttribute("width",b),q.setAttribute("height",f);h=d(q);$c=h.createTexture();ad=h.createTexture()}catch(e){y.debug(e)}if(!h)throw"WebGL context is not supported on this browser.";h.viewport(0,0,q.width,q.height);h.enable(h.DEPTH_TEST);
h.enable(h.BLEND);h.blendFunc(h.SRC_ALPHA,h.ONE_MINUS_SRC_ALPHA);v=Gc(h,"varying vec4 frontColor;attribute vec3 Vertex;attribute vec2 aTextureCoord;uniform vec4 color;uniform mat4 model;uniform mat4 view;uniform mat4 projection;uniform float pointSize;varying vec2 vTextureCoord;void main(void) { gl_PointSize = pointSize; frontColor = color; gl_Position = projection * view * model * vec4(Vertex, 1.0); vTextureCoord = aTextureCoord;}","#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform int picktype;void main(void){ if(picktype == 0){ gl_FragColor = frontColor; } else if(picktype == 1){ float alpha = texture2D(uSampler, vTextureCoord).a; gl_FragColor = vec4(frontColor.rgb*alpha, alpha);\n }}");
h.useProgram(v);c.strokeWeight(1);s=Gc(h,Bd,"#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;uniform sampler2D sampler;uniform bool usingTexture;varying vec2 vTexture;void main(void){ if(usingTexture){ gl_FragColor = vec4(texture2D(sampler, vTexture.xy)); } else{ gl_FragColor = frontColor; }}");na=Gc(h,"varying vec4 frontColor;attribute vec3 aVertex;attribute vec4 aColor;uniform mat4 uView;uniform mat4 uProjection;void main(void) { frontColor = aColor; gl_Position = uProjection * uView * vec4(aVertex, 1.0);}",
"#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 frontColor;void main(void){ gl_FragColor = frontColor;}");h.useProgram(s);H("usingTexture3d",s,"usingTexture",oa);c.lightFalloff(1,0,0);c.shininess(1);c.ambient(255,255,255);c.specular(0,0,0);c.emissive(0,0,0);tc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,tc);h.bufferData(h.ARRAY_BUFFER,id,h.STATIC_DRAW);uc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,uc);h.bufferData(h.ARRAY_BUFFER,zd,h.STATIC_DRAW);vc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,
vc);h.bufferData(h.ARRAY_BUFFER,jd,h.STATIC_DRAW);Vb=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,Vb);h.bufferData(h.ARRAY_BUFFER,Fc,h.STATIC_DRAW);wc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,wc);h.bufferData(h.ARRAY_BUFFER,Ad,h.STATIC_DRAW);Eb=h.createBuffer();xc=h.createBuffer();Xc=h.createBuffer();yc=h.createBuffer();Yc=h.createBuffer();Zc=h.createBuffer();Wb=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,Wb);h.bufferData(h.ARRAY_BUFFER,new G([0,0,0]),h.STATIC_DRAW);zc=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,
zc);h.bufferData(h.ARRAY_BUFFER,new G([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),h.STATIC_DRAW);Ac=h.createBuffer();h.bindBuffer(h.ARRAY_BUFFER,Ac);h.bufferData(h.ARRAY_BUFFER,new G([0,0,1,0,1,1,0,1]),h.STATIC_DRAW);Bc=h.createBuffer();h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,Bc);h.bufferData(h.ELEMENT_ARRAY_BUFFER,new ud([0,1,2,2,3,0]),h.STATIC_DRAW);fb=new z;Ga=new z;O=new z;Ha=new z;za=new z;c.camera();c.perspective();ea=O;fa=Ha;rb=new Ua;sb=new Ua;Db=new z;Ub=new z;nb=new z;ob=new z;rc=new z;sc=new z;sc.set(-1,
3,-3,1,3,-6,3,0,-3,3,0,0,1,0,0,0);C.prototype.size.apply(this,arguments)}}();w.prototype.ambientLight=C.prototype.a3DOnlyFunction;F.prototype.ambientLight=function(a,b,c,m,e,g){if(I===d.MAX_LIGHTS)throw"can only create "+d.MAX_LIGHTS+" lights";m=new V(m,e,g);e=new z;e.scale(1,-1,1);e.apply(O.array());e.mult(m,m);h.useProgram(s);t("lights.color.3d."+I,s,"lights"+I+".color",[a/255,b/255,c/255]);t("lights.position.3d."+I,s,"lights"+I+".position",m.array());H("lights.type.3d."+I,s,"lights"+I+".type",
0);H("lightCount3d",s,"lightCount",++I)};w.prototype.directionalLight=C.prototype.a3DOnlyFunction;F.prototype.directionalLight=function(a,b,c,m,e,g){if(I===d.MAX_LIGHTS)throw"can only create "+d.MAX_LIGHTS+" lights";h.useProgram(s);var i=new z;i.scale(1,-1,1);i.apply(O.array());i=i.array();m=[i[0]*m+i[4]*e+i[8]*g,i[1]*m+i[5]*e+i[9]*g,i[2]*m+i[6]*e+i[10]*g];t("lights.color.3d."+I,s,"lights"+I+".color",[a/255,b/255,c/255]);t("lights.position.3d."+I,s,"lights"+I+".position",m);H("lights.type.3d."+I,
s,"lights"+I+".type",1);H("lightCount3d",s,"lightCount",++I)};w.prototype.lightFalloff=C.prototype.a3DOnlyFunction;F.prototype.lightFalloff=function(a,b,c){h.useProgram(s);t("falloff3d",s,"falloff",[a,b,c])};w.prototype.lightSpecular=C.prototype.a3DOnlyFunction;F.prototype.lightSpecular=function(a,b,c){h.useProgram(s);t("specular3d",s,"specular",[a/255,b/255,c/255])};c.lights=function(){c.ambientLight(128,128,128);c.directionalLight(128,128,128,0,0,-1);c.lightFalloff(1,0,0);c.lightSpecular(0,0,0)};
w.prototype.pointLight=C.prototype.a3DOnlyFunction;F.prototype.pointLight=function(a,b,c,m,e,g){if(I===d.MAX_LIGHTS)throw"can only create "+d.MAX_LIGHTS+" lights";m=new V(m,e,g);e=new z;e.scale(1,-1,1);e.apply(O.array());e.mult(m,m);h.useProgram(s);t("lights.color.3d."+I,s,"lights"+I+".color",[a/255,b/255,c/255]);t("lights.position.3d."+I,s,"lights"+I+".position",m.array());H("lights.type.3d."+I,s,"lights"+I+".type",2);H("lightCount3d",s,"lightCount",++I)};w.prototype.noLights=C.prototype.a3DOnlyFunction;
F.prototype.noLights=function(){I=0;h.useProgram(s);H("lightCount3d",s,"lightCount",I)};w.prototype.spotLight=C.prototype.a3DOnlyFunction;F.prototype.spotLight=function(a,b,c,m,e,g,i,k,l,j,o){if(I===d.MAX_LIGHTS)throw"can only create "+d.MAX_LIGHTS+" lights";h.useProgram(s);m=new V(m,e,g);e=new z;e.scale(1,-1,1);e.apply(O.array());e.mult(m,m);e=e.array();i=[e[0]*i+e[4]*k+e[8]*l,e[1]*i+e[5]*k+e[9]*l,e[2]*i+e[6]*k+e[10]*l];t("lights.color.3d."+I,s,"lights"+I+".color",[a/255,b/255,c/255]);t("lights.position.3d."+
I,s,"lights"+I+".position",m.array());t("lights.direction.3d."+I,s,"lights"+I+".direction",i);t("lights.concentration.3d."+I,s,"lights"+I+".concentration",o);t("lights.angle.3d."+I,s,"lights"+I+".angle",j);H("lights.type.3d."+I,s,"lights"+I+".type",3);H("lightCount3d",s,"lightCount",++I)};c.beginCamera=function(){if(Zb)throw"You cannot call beginCamera() again before calling endCamera()";else Zb=!0,ea=Ga,fa=fb};c.endCamera=function(){if(Zb)O.set(fb),Ha.set(Ga),ea=O,fa=Ha,Zb=!1;else throw"You cannot call endCamera() before calling beginCamera()";
};c.camera=function(a,b,c,d,e,g,i,k,l){arguments.length===0&&(Ec=q.width/2,gb=q.height/2,hb=gb/j.tan($b/2),a=Ec,b=gb,c=hb,d=Ec,e=gb,i=g=0,k=1,l=0);var h=new V(a-d,b-e,c-g),o=new V(i,k,l);h.normalize();var p=V.cross(o,h),o=V.cross(h,p);p.normalize();o.normalize();fb.set(p.x,p.y,p.z,0,o.x,o.y,o.z,0,h.x,h.y,h.z,0,0,0,0,1);fb.translate(-a,-b,-c);Ga.reset();Ga.invApply(p.x,p.y,p.z,0,o.x,o.y,o.z,0,h.x,h.y,h.z,0,0,0,0,1);Ga.translate(a,b,c);O.set(fb);Ha.set(Ga)};c.perspective=function(a,b,f,d){arguments.length===
0&&(gb=q.height/2,hb=gb/j.tan($b/2),ed=hb/10,fd=hb*10,gd=q.width/q.height,a=$b,b=gd,f=ed,d=fd);var e,g;e=f*j.tan(a/2);g=-e;c.frustum(g*b,e*b,g,e,f,d)};c.frustum=function(a,b,c,d,e,g){za=new z;za.set(2*e/(b-a),0,(b+a)/(b-a),0,0,2*e/(d-c),(d+c)/(d-c),0,0,0,-(g+e)/(g-e),-(2*g*e)/(g-e),0,0,-1,0);a=new z;a.set(za);a.transpose();h.useProgram(v);J("projection2d",v,"projection",!1,a.array());h.useProgram(s);J("projection3d",s,"projection",!1,a.array());h.useProgram(na);J("uProjectionUS",na,"uProjection",
!1,a.array())};c.ortho=function(a,b,f,d,e,g){if(arguments.length===0)a=0,b=c.width,f=0,d=c.height,e=-10,g=10;var i=2/(b-a),k=2/(d-f),l=-2/(g-e),j=-(b+a)/(b-a),o=-(d+f)/(d-f),p=-(g+e)/(g-e);za=new z;za.set(i,0,0,j,0,k,0,o,0,0,l,p,0,0,0,1);i=new z;i.set(za);i.transpose();h.useProgram(v);J("projection2d",v,"projection",!1,i.array());h.useProgram(s);J("projection3d",s,"projection",!1,i.array());h.useProgram(na);J("uProjectionUS",na,"uProjection",!1,i.array())};c.printProjection=function(){za.print()};
c.printCamera=function(){fb.print()};w.prototype.box=C.prototype.a3DOnlyFunction;F.prototype.box=function(a,b,c){if(!b||!c)b=c=a;var d=new z;d.scale(a,b,c);a=new z;a.scale(1,-1,1);a.apply(O.array());a.transpose();P&&(h.useProgram(s),J("model3d",s,"model",!1,d.array()),J("view3d",s,"view",!1,a.array()),h.enable(h.POLYGON_OFFSET_FILL),h.polygonOffset(1,1),t("color3d",s,"color",ma),I>0?(b=new z,b.set(a),c=new z,c.set(d),b.mult(c),c=new z,c.set(b),c.invert(),c.transpose(),J("normalTransform3d",s,"normalTransform",
!1,c.array()),u("normal3d",s,"Normal",3,uc)):X("normal3d",s,"Normal"),u("vertex3d",s,"Vertex",3,tc),X("aColor3d",s,"aColor"),X("aTexture3d",s,"aTexture"),h.drawArrays(h.TRIANGLES,0,id.length/3),h.disable(h.POLYGON_OFFSET_FILL));aa>0&&L&&(h.useProgram(v),J("model2d",v,"model",!1,d.array()),J("view2d",v,"view",!1,a.array()),t("color2d",v,"color",la),H("picktype2d",v,"picktype",0),u("vertex2d",v,"Vertex",3,vc),X("aTextureCoord2d",v,"aTextureCoord"),h.lineWidth(aa),h.drawArrays(h.LINES,0,jd.length/3))};
c.sphereDetail=function(a,b){var c;arguments.length===1&&(a=b=arguments[0]);a<3&&(a=3);b<2&&(b=2);if(!(a===eb&&b===Yb)){var m=d.SINCOS_LENGTH/a,e=new G(a),g=new G(a);for(c=0;c<a;c++)e[c]=qb[parseInt(c*m%d.SINCOS_LENGTH,10)],g[c]=pb[parseInt(c*m%d.SINCOS_LENGTH,10)];c=a*(b-1)+2;m=0;Da=new G(c);Ea=new G(c);Fa=new G(c);var i=d.SINCOS_LENGTH*0.5/b,k=i;for(c=1;c<b;c++){for(var l=pb[parseInt(k%d.SINCOS_LENGTH,10)],j=-qb[parseInt(k%d.SINCOS_LENGTH,10)],o=0;o<a;o++)Da[m]=e[o]*l,Ea[m]=j,Fa[m++]=g[o]*l;k+=
i}eb=a;Yb=b;K=[];for(e=0;e<eb;e++)K.push(0),K.push(-1),K.push(0),K.push(Da[e]),K.push(Ea[e]),K.push(Fa[e]);K.push(0);K.push(-1);K.push(0);K.push(Da[0]);K.push(Ea[0]);K.push(Fa[0]);i=0;for(e=2;e<Yb;e++){g=c=i;i+=eb;m=i;for(k=0;k<eb;k++)K.push(parseFloat(Da[g])),K.push(parseFloat(Ea[g])),K.push(parseFloat(Fa[g++])),K.push(parseFloat(Da[m])),K.push(parseFloat(Ea[m])),K.push(parseFloat(Fa[m++]));g=c;m=i;K.push(parseFloat(Da[g]));K.push(parseFloat(Ea[g]));K.push(parseFloat(Fa[g]));K.push(parseFloat(Da[m]));
K.push(parseFloat(Ea[m]));K.push(parseFloat(Fa[m]))}for(e=0;e<eb;e++)m=i+e,K.push(parseFloat(Da[m])),K.push(parseFloat(Ea[m])),K.push(parseFloat(Fa[m])),K.push(0),K.push(1),K.push(0);K.push(parseFloat(Da[i]));K.push(parseFloat(Ea[i]));K.push(parseFloat(Fa[i]));K.push(0);K.push(1);K.push(0);h.bindBuffer(h.ARRAY_BUFFER,Eb);h.bufferData(h.ARRAY_BUFFER,new G(K),h.STATIC_DRAW)}};w.prototype.sphere=C.prototype.a3DOnlyFunction;F.prototype.sphere=function(a){(eb<3||Yb<2)&&c.sphereDetail(30);var b=new z;b.scale(a,
a,a);a=new z;a.scale(1,-1,1);a.apply(O.array());a.transpose();if(P){if(I>0){var f=new z;f.set(a);var d=new z;d.set(b);f.mult(d);d=new z;d.set(f);d.invert();d.transpose();J("normalTransform3d",s,"normalTransform",!1,d.array());u("normal3d",s,"Normal",3,Eb)}else X("normal3d",s,"Normal");h.useProgram(s);X("aTexture3d",s,"aTexture");J("model3d",s,"model",!1,b.array());J("view3d",s,"view",!1,a.array());u("vertex3d",s,"Vertex",3,Eb);X("aColor3d",s,"aColor");h.enable(h.POLYGON_OFFSET_FILL);h.polygonOffset(1,
1);t("color3d",s,"color",ma);h.drawArrays(h.TRIANGLE_STRIP,0,K.length/3);h.disable(h.POLYGON_OFFSET_FILL)}aa>0&&L&&(h.useProgram(v),J("model2d",v,"model",!1,b.array()),J("view2d",v,"view",!1,a.array()),u("vertex2d",v,"Vertex",3,Eb),X("aTextureCoord2d",v,"aTextureCoord"),t("color2d",v,"color",la),H("picktype2d",v,"picktype",0),h.lineWidth(aa),h.drawArrays(h.LINE_STRIP,0,K.length/3))};c.modelX=function(a,b,c){var d=O.array(),e=Ga.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],k=d[8]*
a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[0]*g+e[1]*i+e[2]*k+e[3]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]*b;return e!==0?a/e:a};c.modelY=function(a,b,c){var d=O.array(),e=Ga.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],k=d[8]*a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[4]*g+e[5]*i+e[6]*k+e[7]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]*b;return e!==0?a/e:a};c.modelZ=function(a,b,c){var d=O.array(),e=Ga.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],
k=d[8]*a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[8]*g+e[9]*i+e[10]*k+e[11]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]*b;return e!==0?a/e:a};w.prototype.ambient=C.prototype.a3DOnlyFunction;F.prototype.ambient=function(){var a=arguments;h.useProgram(s);H("usingMat3d",s,"usingMat",!0);a.length===1?typeof a[0]==="string"?(a=a[0].slice(5,-1).split(","),t("mat_ambient3d",s,"mat_ambient",[a[0]/255,a[1]/255,a[2]/255])):t("mat_ambient3d",s,"mat_ambient",[a[0]/255,a[0]/255,a[0]/255]):t("mat_ambient3d",
s,"mat_ambient",[a[0]/255,a[1]/255,a[2]/255])};w.prototype.emissive=C.prototype.a3DOnlyFunction;F.prototype.emissive=function(){var a=arguments;h.useProgram(s);H("usingMat3d",s,"usingMat",!0);a.length===1?typeof a[0]==="string"?(a=a[0].slice(5,-1).split(","),t("mat_emissive3d",s,"mat_emissive",[a[0]/255,a[1]/255,a[2]/255])):t("mat_emissive3d",s,"mat_emissive",[a[0]/255,a[0]/255,a[0]/255]):t("mat_emissive3d",s,"mat_emissive",[a[0]/255,a[1]/255,a[2]/255])};w.prototype.shininess=C.prototype.a3DOnlyFunction;
F.prototype.shininess=function(a){h.useProgram(s);H("usingMat3d",s,"usingMat",!0);t("shininess3d",s,"shininess",a)};w.prototype.specular=C.prototype.a3DOnlyFunction;F.prototype.specular=function(){var a=c.color.apply(this,arguments);h.useProgram(s);H("usingMat3d",s,"usingMat",!0);t("mat_specular3d",s,"mat_specular",c.color.toGLArray(a).slice(0,3))};c.screenX=function(a,b,f){var d=O.array();if(d.length===16){var e=d[0]*a+d[1]*b+d[2]*f+d[3],g=d[4]*a+d[5]*b+d[6]*f+d[7],i=d[8]*a+d[9]*b+d[10]*f+d[11],
b=d[12]*a+d[13]*b+d[14]*f+d[15],f=za.array(),a=f[0]*e+f[1]*g+f[2]*i+f[3]*b,e=f[12]*e+f[13]*g+f[14]*i+f[15]*b;e!==0&&(a/=e);return c.width*(1+a)/2}else return O.multX(a,b)};c.screenY=function(a,b,f){var d=O.array();if(d.length===16){var e=d[0]*a+d[1]*b+d[2]*f+d[3],g=d[4]*a+d[5]*b+d[6]*f+d[7],i=d[8]*a+d[9]*b+d[10]*f+d[11],b=d[12]*a+d[13]*b+d[14]*f+d[15],f=za.array(),a=f[4]*e+f[5]*g+f[6]*i+f[7]*b,e=f[12]*e+f[13]*g+f[14]*i+f[15]*b;e!==0&&(a/=e);return c.height*(1+a)/2}else return O.multY(a,b)};c.screenZ=
function(a,b,c){var d=O.array();if(d.length!==16)return 0;var e=za.array(),g=d[0]*a+d[1]*b+d[2]*c+d[3],i=d[4]*a+d[5]*b+d[6]*c+d[7],k=d[8]*a+d[9]*b+d[10]*c+d[11],b=d[12]*a+d[13]*b+d[14]*c+d[15],a=e[8]*g+e[9]*i+e[10]*k+e[11]*b,e=e[12]*g+e[13]*i+e[14]*k+e[15]*b;e!==0&&(a/=e);return(a+1)/2};C.prototype.fill=function(a,b,f,d){a=c.color(a,b,f,d);a===Qa&&P||(P=!0,Qa=a)};w.prototype.fill=function(){C.prototype.fill.apply(this,arguments);Oa=!0};F.prototype.fill=function(){C.prototype.fill.apply(this,arguments);
ma=c.color.toGLArray(Qa)};c.noFill=function(){P=!1};C.prototype.stroke=function(a,b,f,d){a=c.color(a,b,f,d);a===Y&&L||(L=!0,Y=a)};w.prototype.stroke=function(){C.prototype.stroke.apply(this,arguments);Mb=!0};F.prototype.stroke=function(){C.prototype.stroke.apply(this,arguments);la=c.color.toGLArray(Y)};c.noStroke=function(){L=!1};C.prototype.strokeWeight=function(a){aa=a};w.prototype.strokeWeight=function(a){C.prototype.strokeWeight.apply(this,arguments);h.lineWidth=a};F.prototype.strokeWeight=function(a){C.prototype.strokeWeight.apply(this,
arguments);h.useProgram(v);t("pointSize2d",v,"pointSize",a)};c.strokeCap=function(a){$.$ensureContext().lineCap=a};c.strokeJoin=function(a){$.$ensureContext().lineJoin=a};C.prototype.smooth=function(){q.style.setProperty("image-rendering","optimizeQuality","important")};w.prototype.smooth=function(){C.prototype.smooth.apply(this,arguments);if("mozImageSmoothingEnabled"in h)h.mozImageSmoothingEnabled=!0};C.prototype.noSmooth=function(){q.style.setProperty("image-rendering","optimizeSpeed","important")};
w.prototype.noSmooth=function(){C.prototype.noSmooth.apply(this,arguments);if("mozImageSmoothingEnabled"in h)h.mozImageSmoothingEnabled=!1};w.prototype.point=function(a,b){if(L)if(T.options.crispLines){var f=j.PI/4,m=c.get(a,b);c.set(a,b,Wa(m,Y,f))}else aa>1?(h.fillStyle=c.color.toString(Y),Oa=!0,h.beginPath(),h.arc(a,b,aa/2,0,d.TWO_PI,!1),h.fill(),h.closePath()):(h.fillStyle=c.color.toString(Y),h.fillRect(j.round(a),j.round(b),1,1),Oa=!0)};F.prototype.point=function(a,b,c){var d=new z;d.translate(a,
b,c||0);d.transpose();a=new z;a.scale(1,-1,1);a.apply(O.array());a.transpose();h.useProgram(v);J("model2d",v,"model",!1,d.array());J("view2d",v,"view",!1,a.array());aa>0&&L&&(t("color2d",v,"color",la),H("picktype2d",v,"picktype",0),u("vertex2d",v,"Vertex",3,Wb),X("aTextureCoord2d",v,"aTextureCoord"),h.drawArrays(h.POINTS,0,1))};c.beginShape=function(a){R=a;o=[]};C.prototype.vertex=function(){var a=[];vb&&(vb=!1);arguments.length===4?(a[0]=arguments[0],a[1]=arguments[1],a[2]=0,a[3]=arguments[2],a[4]=
arguments[3]):(a[0]=arguments[0],a[1]=arguments[1],a[2]=arguments[2]||0,a[3]=arguments[3]||0,a[4]=arguments[4]||0);a.isVert=!0;return a};w.prototype.vertex=function(){var a=C.prototype.vertex.apply(this,arguments);a[5]=Qa;a[6]=Y;o.push(a)};F.prototype.vertex=function(){var a=C.prototype.vertex.apply(this,arguments);a[5]=ma[0];a[6]=ma[1];a[7]=ma[2];a[8]=ma[3];a[9]=la[0];a[10]=la[1];a[11]=la[2];a[12]=la[3];a[13]=jc;a[14]=kc;a[15]=lc;o.push(a)};var nd=function(a,b){var c=new z;c.scale(1,-1,1);c.apply(O.array());
c.transpose();h.useProgram(na);J("uViewUS",na,"uView",!1,c.array());u("aVertexUS",na,"aVertex",3,Wb);h.bufferData(h.ARRAY_BUFFER,new G(a),h.STREAM_DRAW);u("aColorUS",na,"aColor",4,yc);h.bufferData(h.ARRAY_BUFFER,new G(b),h.STREAM_DRAW);h.drawArrays(h.POINTS,0,a.length/3)},ta=function(a,b,c){var b=b==="LINES"?h.LINES:b==="LINE_LOOP"?h.LINE_LOOP:h.LINE_STRIP,d=new z;d.scale(1,-1,1);d.apply(O.array());d.transpose();h.useProgram(na);J("uViewUS",na,"uView",!1,d.array());u("aVertexUS",na,"aVertex",3,xc);
h.bufferData(h.ARRAY_BUFFER,new G(a),h.STREAM_DRAW);u("aColorUS",na,"aColor",4,Yc);h.bufferData(h.ARRAY_BUFFER,new G(c),h.STREAM_DRAW);h.lineWidth(aa);h.drawArrays(b,0,a.length/3)},Va=function(a,b,c,m){var b=b==="TRIANGLES"?h.TRIANGLES:b==="TRIANGLE_FAN"?h.TRIANGLE_FAN:h.TRIANGLE_STRIP,e=new z;e.scale(1,-1,1);e.apply(O.array());e.transpose();h.useProgram(s);J("model3d",s,"model",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);J("view3d",s,"view",!1,e.array());h.enable(h.POLYGON_OFFSET_FILL);h.polygonOffset(1,
1);t("color3d",s,"color",[-1,0,0,0]);u("vertex3d",s,"Vertex",3,Xc);h.bufferData(h.ARRAY_BUFFER,new G(a),h.STREAM_DRAW);u("aColor3d",s,"aColor",4,yc);h.bufferData(h.ARRAY_BUFFER,new G(c),h.STREAM_DRAW);X("normal3d",s,"Normal");if(oa){if(bd===d.IMAGE)for(c=0;c<m.length;c+=2)m[c]/=Xb.width,m[c+1]/=Xb.height;for(c=0;c<m.length;c+=2)m[c+0]>1&&(m[c+0]-=m[c+0]-1),m[c+1]>1&&(m[c+1]-=m[c+1]-1);H("usingTexture3d",s,"usingTexture",oa);u("aTexture3d",s,"aTexture",2,Zc);h.bufferData(h.ARRAY_BUFFER,new G(m),h.STREAM_DRAW)}h.drawArrays(b,
0,a.length/3);h.disable(h.POLYGON_OFFSET_FILL)};w.prototype.endShape=function(a){if(o.length!==0){var a=a===d.CLOSE,b=[],f=[],m=[],e=[],g;vb=!0;var i,k,l=o.length;for(i=0;i<l;i++){g=o[i];for(k=0;k<3;k++)b.push(g[k])}for(i=0;i<l;i++){g=o[i];for(k=5;k<9;k++)f.push(g[k])}for(i=0;i<l;i++){g=o[i];for(k=9;k<13;k++)m.push(g[k])}for(i=0;i<l;i++)g=o[i],e.push(g[3]),e.push(g[4]);if(a){b.push(o[0][0]);b.push(o[0][1]);b.push(o[0][2]);for(i=5;i<9;i++)f.push(o[0][i]);for(i=9;i<13;i++)m.push(o[0][i]);e.push(o[0][3]);
e.push(o[0][4])}if(tb&&(R===d.POLYGON||R===p)){if(l>3){b=[];f=1-nc;h.beginPath();h.moveTo(o[1][0],o[1][1]);for(i=1;i+2<l;i++)g=o[i],b[0]=[g[0],g[1]],b[1]=[g[0]+(f*o[i+1][0]-f*o[i-1][0])/6,g[1]+(f*o[i+1][1]-f*o[i-1][1])/6],b[2]=[o[i+1][0]+(f*o[i][0]-f*o[i+2][0])/6,o[i+1][1]+(f*o[i][1]-f*o[i+2][1])/6],b[3]=[o[i+1][0],o[i+1][1]],h.bezierCurveTo(b[1][0],b[1][1],b[2][0],b[2][1],b[3][0],b[3][1]);a&&h.lineTo(o[0][0],o[0][1]);S();da();h.closePath()}}else if(ub&&(R===d.POLYGON||R===p)){h.beginPath();for(i=
0;i<l;i++)g=o[i],o[i].isVert?o[i].moveTo?h.moveTo(g[0],g[1]):h.lineTo(g[0],g[1]):h.bezierCurveTo(o[i][0],o[i][1],o[i][2],o[i][3],o[i][4],o[i][5]);a&&h.lineTo(o[0][0],o[0][1]);S();da();h.closePath()}else if(R===d.POINTS)for(i=0;i<l;i++)g=o[i],L&&c.stroke(g[6]),c.point(g[0],g[1]);else if(R===d.LINES)for(i=0;i+1<l;i+=2)g=o[i],L&&c.stroke(o[i+1][6]),c.line(g[0],g[1],o[i+1][0],o[i+1][1]);else if(R===d.TRIANGLES)for(i=0;i+2<l;i+=3)g=o[i],h.beginPath(),h.moveTo(g[0],g[1]),h.lineTo(o[i+1][0],o[i+1][1]),h.lineTo(o[i+
2][0],o[i+2][1]),h.lineTo(g[0],g[1]),P&&(c.fill(o[i+2][5]),S()),L&&(c.stroke(o[i+2][6]),da()),h.closePath();else if(R===d.TRIANGLE_STRIP)for(i=0;i+1<l;i++)g=o[i],h.beginPath(),h.moveTo(o[i+1][0],o[i+1][1]),h.lineTo(g[0],g[1]),L&&c.stroke(o[i+1][6]),P&&c.fill(o[i+1][5]),i+2<l&&(h.lineTo(o[i+2][0],o[i+2][1]),L&&c.stroke(o[i+2][6]),P&&c.fill(o[i+2][5])),S(),da(),h.closePath();else if(R===d.TRIANGLE_FAN){if(l>2){h.beginPath();h.moveTo(o[0][0],o[0][1]);h.lineTo(o[1][0],o[1][1]);h.lineTo(o[2][0],o[2][1]);
P&&(c.fill(o[2][5]),S());L&&(c.stroke(o[2][6]),da());h.closePath();for(i=3;i<l;i++)g=o[i],h.beginPath(),h.moveTo(o[0][0],o[0][1]),h.lineTo(o[i-1][0],o[i-1][1]),h.lineTo(g[0],g[1]),P&&(c.fill(g[5]),S()),L&&(c.stroke(g[6]),da()),h.closePath()}}else if(R===d.QUADS)for(i=0;i+3<l;i+=4){g=o[i];h.beginPath();h.moveTo(g[0],g[1]);for(k=1;k<4;k++)h.lineTo(o[i+k][0],o[i+k][1]);h.lineTo(g[0],g[1]);P&&(c.fill(o[i+3][5]),S());L&&(c.stroke(o[i+3][6]),da());h.closePath()}else if(R===d.QUAD_STRIP){if(l>3)for(i=0;i+
1<l;i+=2)g=o[i],h.beginPath(),i+3<l?(h.moveTo(o[i+2][0],o[i+2][1]),h.lineTo(g[0],g[1]),h.lineTo(o[i+1][0],o[i+1][1]),h.lineTo(o[i+3][0],o[i+3][1]),P&&c.fill(o[i+3][5]),L&&c.stroke(o[i+3][6])):(h.moveTo(g[0],g[1]),h.lineTo(o[i+1][0],o[i+1][1])),S(),da(),h.closePath()}else{h.beginPath();h.moveTo(o[0][0],o[0][1]);for(i=1;i<l;i++)g=o[i],g.isVert&&(g.moveTo?h.moveTo(g[0],g[1]):h.lineTo(g[0],g[1]));a&&h.lineTo(o[0][0],o[0][1]);S();da();h.closePath()}ub=tb=!1;ga=[];ba=0}};F.prototype.endShape=function(a){if(o.length!==
0){var b=a===d.CLOSE,a=[],c=[],m=[],e=[],g=[],i;vb=!0;var k,l,j=o.length;for(k=0;k<j;k++){i=o[k];for(l=0;l<3;l++)c.push(i[l])}for(k=0;k<j;k++){i=o[k];for(l=5;l<9;l++)m.push(i[l])}for(k=0;k<j;k++){i=o[k];for(l=9;l<13;l++)e.push(i[l])}for(k=0;k<j;k++)i=o[k],g.push(i[3]),g.push(i[4]);if(b){c.push(o[0][0]);c.push(o[0][1]);c.push(o[0][2]);for(k=5;k<9;k++)m.push(o[0][k]);for(k=9;k<13;k++)e.push(o[0][k]);g.push(o[0][3]);g.push(o[0][4])}if(tb&&(R===d.POLYGON||R===p))L&&ta(c,null,e),P&&Va(c,null,m);else if(ub&&
(R===d.POLYGON||R===p))a=c,a.splice(a.length-3),e.splice(e.length-4),L&&ta(a,null,e),P&&Va(c,"TRIANGLES",m);else{if(R===d.POINTS){for(k=0;k<j;k++){i=o[k];for(l=0;l<3;l++)a.push(i[l])}nd(a,e)}else if(R===d.LINES){for(k=0;k<j;k++){i=o[k];for(l=0;l<3;l++)a.push(i[l])}for(k=0;k<j;k++){i=o[k];for(l=5;l<9;l++)m.push(i[l])}ta(a,"LINES",e)}else if(R===d.TRIANGLES){if(j>2)for(k=0;k+2<j;k+=3){c=[];g=[];a=[];m=[];e=[];for(l=0;l<3;l++)for(b=0;b<3;b++)a.push(o[k+l][b]),c.push(o[k+l][b]);for(l=0;l<3;l++)for(b=
3;b<5;b++)g.push(o[k+l][b]);for(l=0;l<3;l++)for(b=5;b<9;b++)m.push(o[k+l][b]),e.push(o[k+l][b+4]);L&&ta(a,"LINE_LOOP",e);(P||oa)&&Va(c,"TRIANGLES",m,g)}}else if(R===d.TRIANGLE_STRIP){if(j>2)for(k=0;k+2<j;k++){a=[];c=[];e=[];m=[];g=[];for(l=0;l<3;l++)for(b=0;b<3;b++)a.push(o[k+l][b]),c.push(o[k+l][b]);for(l=0;l<3;l++)for(b=3;b<5;b++)g.push(o[k+l][b]);for(l=0;l<3;l++)for(b=5;b<9;b++)e.push(o[k+l][b+4]),m.push(o[k+l][b]);(P||oa)&&Va(c,"TRIANGLE_STRIP",m,g);L&&ta(a,"LINE_LOOP",e)}}else if(R===d.TRIANGLE_FAN){if(j>
2){for(k=0;k<3;k++){i=o[k];for(l=0;l<3;l++)a.push(i[l])}for(k=0;k<3;k++){i=o[k];for(l=9;l<13;l++)e.push(i[l])}L&&ta(a,"LINE_LOOP",e);for(k=2;k+1<j;k++){a=[];e=[];a.push(o[0][0]);a.push(o[0][1]);a.push(o[0][2]);e.push(o[0][9]);e.push(o[0][10]);e.push(o[0][11]);e.push(o[0][12]);for(l=0;l<2;l++)for(b=0;b<3;b++)a.push(o[k+l][b]);for(l=0;l<2;l++)for(b=9;b<13;b++)e.push(o[k+l][b]);L&&ta(a,"LINE_STRIP",e)}(P||oa)&&Va(c,"TRIANGLE_FAN",m,g)}}else if(R===d.QUADS)for(k=0;k+3<j;k+=4){a=[];for(l=0;l<4;l++){i=
o[k+l];for(b=0;b<3;b++)a.push(i[b])}L&&ta(a,"LINE_LOOP",e);if(P){c=[];m=[];g=[];for(l=0;l<3;l++)c.push(o[k][l]);for(l=5;l<9;l++)m.push(o[k][l]);for(l=0;l<3;l++)c.push(o[k+1][l]);for(l=5;l<9;l++)m.push(o[k+1][l]);for(l=0;l<3;l++)c.push(o[k+3][l]);for(l=5;l<9;l++)m.push(o[k+3][l]);for(l=0;l<3;l++)c.push(o[k+2][l]);for(l=5;l<9;l++)m.push(o[k+2][l]);oa&&(g.push(o[k+0][3]),g.push(o[k+0][4]),g.push(o[k+1][3]),g.push(o[k+1][4]),g.push(o[k+3][3]),g.push(o[k+3][4]),g.push(o[k+2][3]),g.push(o[k+2][4]));Va(c,
"TRIANGLE_STRIP",m,g)}}else if(R===d.QUAD_STRIP){if(j>3){for(k=0;k<2;k++){i=o[k];for(l=0;l<3;l++)a.push(i[l])}for(k=0;k<2;k++){i=o[k];for(l=9;l<13;l++)e.push(i[l])}ta(a,"LINE_STRIP",e);j>4&&j%2>0&&(c.splice(c.length-3),o.pop());for(k=0;k+3<j;k+=2){a=[];e=[];for(l=0;l<3;l++)a.push(o[k+1][l]);for(l=0;l<3;l++)a.push(o[k+3][l]);for(l=0;l<3;l++)a.push(o[k+2][l]);for(l=0;l<3;l++)a.push(o[k+0][l]);for(l=9;l<13;l++)e.push(o[k+1][l]);for(l=9;l<13;l++)e.push(o[k+3][l]);for(l=9;l<13;l++)e.push(o[k+2][l]);for(l=
9;l<13;l++)e.push(o[k+0][l]);L&&ta(a,"LINE_STRIP",e)}(P||oa)&&Va(c,"TRIANGLE_LIST",m,g)}}else if(j===1){for(l=0;l<3;l++)a.push(o[0][l]);for(l=9;l<13;l++)e.push(o[0][l]);nd(a,e)}else{for(k=0;k<j;k++){i=o[k];for(l=0;l<3;l++)a.push(i[l]);for(l=5;l<9;l++)e.push(i[l])}L&&b?ta(a,"LINE_LOOP",e):L&&!b&&ta(a,"LINE_STRIP",e);(P||oa)&&Va(c,"TRIANGLE_FAN",m,g)}oa=!1;h.useProgram(s);H("usingTexture3d",s,"usingTexture",oa)}ub=tb=!1;ga=[];ba=0}};var od=function(a,b){var c=1/a,d=c*c,e=d*c;b.set(0,0,0,1,e,d,c,0,6*
e,2*d,0,0,6*e,0,0,0)},pd=function(){nb||(Db=new z,nb=new z,Vc=!0);var a=nc;Db.set((a-1)/2,(a+3)/2,(-3-a)/2,(1-a)/2,1-a,(-5-a)/2,a+2,(a-1)/2,(a-1)/2,0,(1-a)/2,0,0,1,0,0);od(oc,nb);rc||(Ub=new z);Ub.set(Db);Ub.preApply(rc);nb.apply(Db)};w.prototype.bezierVertex=function(){ub=!0;var a=[];if(vb)throw"vertex() must be used at least once before calling bezierVertex()";for(var b=0;b<arguments.length;b++)a[b]=arguments[b];o.push(a);o[o.length-1].isVert=!1};F.prototype.bezierVertex=function(){ub=!0;if(vb)throw"vertex() must be used at least once before calling bezierVertex()";
if(arguments.length===9){ob===p&&(ob=new z);var a=o.length-1;od(pc,ob);ob.apply(sc);for(var b=ob.array(),d=o[a][0],m=o[a][1],a=o[a][2],e=b[4]*d+b[5]*arguments[0]+b[6]*arguments[3]+b[7]*arguments[6],g=b[8]*d+b[9]*arguments[0]+b[10]*arguments[3]+b[11]*arguments[6],i=b[12]*d+b[13]*arguments[0]+b[14]*arguments[3]+b[15]*arguments[6],k=b[4]*m+b[5]*arguments[1]+b[6]*arguments[4]+b[7]*arguments[7],l=b[8]*m+b[9]*arguments[1]+b[10]*arguments[4]+b[11]*arguments[7],h=b[12]*m+b[13]*arguments[1]+b[14]*arguments[4]+
b[15]*arguments[7],j=b[4]*a+b[5]*arguments[2]+b[6]*arguments[5]+b[7]*arguments[8],q=b[8]*a+b[9]*arguments[2]+b[10]*arguments[5]+b[11]*arguments[8],b=b[12]*a+b[13]*arguments[2]+b[14]*arguments[5]+b[15]*arguments[8],n=0;n<pc;n++)d+=e,e+=g,g+=i,m+=k,k+=l,l+=h,a+=j,j+=q,q+=b,c.vertex(d,m,a);c.vertex(arguments[6],arguments[7],arguments[8])}};var wb=function(){var a=B.createElement("canvas");try{h.texImage2D(h.TEXTURE_2D,0,h.RGBA,h.RGBA,h.UNSIGNED_BYTE,a),wb=function(a){h.texImage2D(h.TEXTURE_2D,0,h.RGBA,
h.RGBA,h.UNSIGNED_BYTE,a)}}catch(b){wb=function(a){h.texImage2D(h.TEXTURE_2D,0,a,!1)}}wb.apply(this,arguments)};c.texture=function(a){var b=$.$ensureContext();if(a.localName==="canvas")b.bindTexture(b.TEXTURE_2D,$c),wb(a),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR),b.generateMipmap(b.TEXTURE_2D);else if(a.__texture)b.bindTexture(b.TEXTURE_2D,a.__texture);else{var c=b.createTexture();a.__texture=c;var c=B.createElement("canvas"),
d;if(a.width&a.width-1===0)c.width=a.width;else{for(d=1;d<a.width;)d*=2;c.width=d}if(a.height&a.height-1===0)c.height=a.height;else{for(d=1;d<a.height;)d*=2;c.height=d}d=c.getContext("2d");for(var e=d.createImageData(c.width,c.height),g=a.toImageData(),i=0;i<c.width;i+=1)for(var k=0;k<c.height;k+=1){var l=(k*c.width+i)*4;e.data[l+0]=g.data[l+0];e.data[l+1]=g.data[l+1];e.data[l+2]=g.data[l+2];e.data[l+3]=255}d.putImageData(e,0,0);a.__cvs=c;b.bindTexture(b.TEXTURE_2D,a.__texture);b.texParameteri(b.TEXTURE_2D,
b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);wb(a.__cvs);b.generateMipmap(b.TEXTURE_2D)}Xb.width=a.width;Xb.height=a.height;oa=!0;b.useProgram(s);H("usingTexture3d",s,"usingTexture",oa)};c.textureMode=function(a){bd=a};w.prototype.curveVertex=function(a,b){tb=!0;c.vertex(a,b)};F.prototype.curveVertex=function(a,b,
d){tb=!0;Vc||pd();var m=[];m[0]=a;m[1]=b;m[2]=d;ga.push(m);ba++;if(ba>3){var e=ga[ba-4][0],g=ga[ba-4][1],i=ga[ba-4][2],k=ga[ba-3][0],l=ga[ba-3][1],h=ga[ba-3][2],j=ga[ba-2][0],o=ga[ba-2][1],n=ga[ba-2][2],p=ga[ba-1][0],q=ga[ba-1][1],s=ga[ba-1][2],a=k,b=l,d=h,r=nb.array(),m=r[4]*e+r[5]*k+r[6]*j+r[7]*p,x=r[8]*e+r[9]*k+r[10]*j+r[11]*p,e=r[12]*e+r[13]*k+r[14]*j+r[15]*p,k=r[4]*g+r[5]*l+r[6]*o+r[7]*q,j=r[8]*g+r[9]*l+r[10]*o+r[11]*q,g=r[12]*g+r[13]*l+r[14]*o+r[15]*q,l=r[4]*i+r[5]*h+r[6]*n+r[7]*s,o=r[8]*i+
r[9]*h+r[10]*n+r[11]*s,i=r[12]*i+r[13]*h+r[14]*n+r[15]*s;c.vertex(a,b,d);for(h=0;h<oc;h++)a+=m,m+=x,x+=e,b+=k,k+=j,j+=g,d+=l,l+=o,o+=i,c.vertex(a,b,d)}};w.prototype.curve=function(){arguments.length===8&&(c.beginShape(),c.curveVertex(arguments[0],arguments[1]),c.curveVertex(arguments[2],arguments[3]),c.curveVertex(arguments[4],arguments[5]),c.curveVertex(arguments[6],arguments[7]),c.endShape())};F.prototype.curve=function(){arguments.length===12&&(c.beginShape(),c.curveVertex(arguments[0],arguments[1],
arguments[2]),c.curveVertex(arguments[3],arguments[4],arguments[5]),c.curveVertex(arguments[6],arguments[7],arguments[8]),c.curveVertex(arguments[9],arguments[10],arguments[11]),c.endShape())};c.curveTightness=function(a){nc=a};c.curveDetail=function(a){oc=a;pd()};c.rectMode=function(a){cb=a};c.imageMode=function(a){switch(a){case d.CORNER:ac=kd;break;case d.CORNERS:ac=Cd;break;case d.CENTER:ac=Dd;break;default:throw"Invalid imageMode";}};c.ellipseMode=function(a){Za=a};c.arc=function(a,b,f,m,e,g){if(!(f<=
0||g<e)){Za===d.CORNERS?(f-=a,m-=b):Za===d.RADIUS?(a-=f,b-=m,f*=2,m*=2):Za===d.CENTER&&(a-=f/2,b-=m/2);for(;e<0;)e+=d.TWO_PI,g+=d.TWO_PI;if(g-e>d.TWO_PI)e=0,g=d.TWO_PI;f/=2;m/=2;a+=f;b+=m;var e=0|-0.5+e/d.TWO_PI*d.SINCOS_LENGTH,g=0|0.5+g/d.TWO_PI*d.SINCOS_LENGTH,i,k;if(P){var l=L;L=!1;c.beginShape();c.vertex(a,b);for(k=i=e;i<g;i++,k++)k>=d.SINCOS_LENGTH&&(k-=d.SINCOS_LENGTH),c.vertex(a+qb[k]*f,b+pb[k]*m);c.endShape(d.CLOSE);L=l}if(L){l=P;P=!1;c.beginShape();for(k=i=e;i<g;i++,k++)k>=d.SINCOS_LENGTH&&
(k-=d.SINCOS_LENGTH),c.vertex(a+qb[k]*f,b+pb[k]*m);k=g%d.SINCOS_LENGTH;c.vertex(a+qb[k]*f,b+pb[k]*m);c.endShape();P=l}}};w.prototype.line=function(a,b,d,m){if(a===d&&b===m)c.point(a,b);else if((a===d||b===m)&&aa<=1&&L&&T.options.crispLines){var e;if(a===d){b>m&&(e=b,b=m,m=e);for(;b<=m;++b)c.set(a,b,Y)}else{a>d&&(e=a,a=d,d=e);for(;a<=d;++a)c.set(a,b,Y)}}else L&&(h.beginPath(),h.moveTo(a||0,b||0),h.lineTo(d||0,m||0),da(),h.closePath())};F.prototype.line=function(){var a,b,d,m,e,g;arguments.length===
6?(a=arguments[0],b=arguments[1],d=arguments[2],m=arguments[3],e=arguments[4],g=arguments[5]):arguments.length===4&&(a=arguments[0],b=arguments[1],d=0,m=arguments[2],e=arguments[3],g=0);a===m&&b===e&&d===g?c.point(a,b,d):(a=[a,b,d,m,e,g],b=new z,b.scale(1,-1,1),b.apply(O.array()),b.transpose(),aa>0&&L&&(h.useProgram(v),J("model2d",v,"model",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),J("view2d",v,"view",!1,b.array()),t("color2d",v,"color",la),H("picktype2d",v,"picktype",0),h.lineWidth(aa),u("vertex2d",
v,"Vertex",3,xc),X("aTextureCoord2d",v,"aTextureCoord"),h.bufferData(h.ARRAY_BUFFER,new G(a),h.STREAM_DRAW),h.drawArrays(h.LINES,0,2)))};w.prototype.bezier=function(){if(arguments.length!==8)throw"You must use 8 parameters for bezier() in 2D mode";c.beginShape();c.vertex(arguments[0],arguments[1]);c.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);c.endShape()};F.prototype.bezier=function(){if(arguments.length!==12)throw"You must use 12 parameters for bezier() in 3D mode";
c.beginShape();c.vertex(arguments[0],arguments[1],arguments[2]);c.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]);c.endShape()};c.bezierDetail=function(a){pc=a};c.bezierPoint=function(a,b,c,d,e){return(1-e)*(1-e)*(1-e)*a+3*(1-e)*(1-e)*e*b+3*(1-e)*e*e*c+e*e*e*d};c.bezierTangent=function(a,b,c,d,e){return 3*e*e*(-a+3*b-3*c+d)+6*e*(a-2*b+c)+3*(-a+b)};c.curvePoint=function(a,b,c,d,e){return 0.5*(2*b+(-a+c)*e+(2*a-5*b+
4*c-d)*e*e+(-a+3*b-3*c+d)*e*e*e)};c.curveTangent=function(a,b,c,d,e){return 0.5*(-a+c+2*(2*a-5*b+4*c-d)*e+3*(-a+3*b-3*c+d)*e*e)};c.triangle=function(a,b,f,m,e,g){c.beginShape(d.TRIANGLES);c.vertex(a,b,0);c.vertex(f,m,0);c.vertex(e,g,0);c.endShape()};c.quad=function(a,b,f,m,e,g,i,k){c.beginShape(d.QUADS);c.vertex(a,b,0);c.vertex(f,m,0);c.vertex(e,g,0);c.vertex(i,k,0);c.endShape()};w.prototype.rect=function(a,b,f,m){if(f||m)if(L&&!P&&aa<=1&&T.options.crispLines){var e,g=a+f-1,i=b+m-1;for(e=0;e<f;++e)c.set(a+
e,b,Y),c.set(a+e,i,Y);for(e=0;e<m;++e)c.set(a,b+e,Y),c.set(g,b+e,Y)}else{h.beginPath();cb===d.CORNERS&&(f-=a,m-=b);cb===d.RADIUS&&(f*=2,m*=2);if(cb===d.CENTER||cb===d.RADIUS)a-=f/2,b-=m/2;h.rect(j.round(a)-0,j.round(b)-0,j.round(f)+0,j.round(m)+0);S();da();h.closePath()}};F.prototype.rect=function(a,b,c,d){var e=new z;e.translate(a,b,0);e.scale(c,d,1);e.transpose();b=new z;b.scale(1,-1,1);b.apply(O.array());b.transpose();aa>0&&L&&(h.useProgram(v),J("model2d",v,"model",!1,e.array()),J("view2d",v,"view",
!1,b.array()),t("color2d",v,"color",la),H("picktype2d",v,"picktype",0),u("vertex2d",v,"Vertex",3,Vb),X("aTextureCoord2d",v,"aTextureCoord"),h.lineWidth(aa),h.drawArrays(h.LINE_LOOP,0,Fc.length/3));P&&(h.useProgram(s),J("model3d",s,"model",!1,e.array()),J("view3d",s,"view",!1,b.array()),h.enable(h.POLYGON_OFFSET_FILL),h.polygonOffset(1,1),t("color3d",s,"color",ma),I>0?(a=new z,a.set(b),b=new z,b.set(e),a.mult(b),e=new z,e.set(a),e.invert(),e.transpose(),J("normalTransform3d",s,"normalTransform",!1,
e.array()),u("normal3d",s,"Normal",3,wc)):X("normal3d",s,"Normal"),u("vertex3d",s,"Vertex",3,Vb),h.drawArrays(h.TRIANGLE_FAN,0,Fc.length/3),h.disable(h.POLYGON_OFFSET_FILL))};C.prototype.ellipse=function(a,b,c,m){a=a||0;b=b||0;if(!(c<=0&&m<=0)){Za===d.RADIUS&&(c*=2,m*=2);Za===d.CORNERS&&(c-=a,m-=b);if(Za===d.CORNER||Za===d.CORNERS)a+=c/2,b+=m/2;return{x:a,y:b,width:c,height:m}}};w.prototype.ellipse=function(a,b,f,m){var e=C.prototype.ellipse.apply(this,arguments);if(e)if(a=e.x,b=e.y,f=e.width,m=e.height,
f===m)h.beginPath(),h.arc(a-0,b-0,f/2,0,d.TWO_PI,!1),S(),da(),h.closePath();else{var e=f/2,g=m/2,i=0.5522847498307933*e,k=0.5522847498307933*g;c.beginShape();c.vertex(a+e,b);c.bezierVertex(a+e,b-k,a+i,b-g,a,b-g);c.bezierVertex(a-i,b-g,a-e,b-k,a-e,b);c.bezierVertex(a-e,b+k,a-i,b+g,a,b+g);c.bezierVertex(a+i,b+g,a+e,b+k,a+e,b);c.endShape()}};F.prototype.ellipse=function(a,b,d,m){var e=C.prototype.ellipse.apply(this,arguments);if(e){var a=e.x,b=e.y,d=e.width,m=e.height,e=d/2,g=m/2,i=0.5522847498307933*
e,k=0.5522847498307933*g;c.beginShape();c.vertex(a+e,b);c.bezierVertex(a+e,b-k,0,a+i,b-g,0,a,b-g,0);c.bezierVertex(a-i,b-g,0,a-e,b-k,0,a-e,b,0);c.bezierVertex(a-e,b+k,0,a-i,b+g,0,a,b+g,0);c.bezierVertex(a+i,b+g,0,a+e,b+k,0,a+e,b,0);c.endShape();if(P){var k=i=0,l;for(l=0;l<o.length;l++)i+=o[l][0],k+=o[l][1];i/=o.length;k/=o.length;l=[];e=[];g=[];l[0]=i;l[1]=k;l[2]=0;l[3]=0;l[4]=0;l[5]=ma[0];l[6]=ma[1];l[7]=ma[2];l[8]=ma[3];l[9]=la[0];l[10]=la[1];l[11]=la[2];l[12]=la[3];l[13]=jc;l[14]=kc;l[15]=lc;o.unshift(l);
for(l=0;l<o.length;l++){for(i=0;i<3;i++)e.push(o[l][i]);for(i=5;i<9;i++)g.push(o[l][i])}Va(e,"TRIANGLE_FAN",g)}}};c.normal=function(a,b,c){if(arguments.length!==3||!(typeof a==="number"&&typeof b==="number"&&typeof c==="number"))throw"normal() requires three numeric arguments.";jc=a;kc=b;lc=c;if(R!==0)if(Sb===d.NORMAL_MODE_AUTO)Sb=d.NORMAL_MODE_SHAPE;else if(Sb===d.NORMAL_MODE_SHAPE)Sb=d.NORMAL_MODE_VERTEX};c.save=function(a,b){return b!==p?Q.open(b.toDataURL(),"_blank"):Q.open(c.externals.canvas.toDataURL(),
"_blank")};var Ed=0;c.saveFrame=function(a){a===p&&(a="screen-####.png");a=a.replace(/#+/,function(a){for(var c=""+Ed++;c.length<a.length;)c="0"+c;return c});c.save(a)};var qd=B.createElement("canvas").getContext("2d"),Lc=[p,p,p],ua=function(a,b,f){this.get=function(a,b,d,f){if(arguments.length)if(arguments.length===2)return c.get(a,b,this);else{if(arguments.length===4)return c.get(a,b,d,f,this)}else return c.get(this)};this.set=function(a,b,d){c.set(a,b,d,this)};this.blend=function(a,b,d,f,e,g,m,
h,j,o){arguments.length===9?c.blend(this,a,b,d,f,e,g,m,h,j,this):arguments.length===10&&c.blend(a,b,d,f,e,g,m,h,j,o,this);delete this.sourceImg};this.copy=function(a,b,f,e,g,m,h,j,o){arguments.length===8?c.blend(this,a,b,f,e,g,m,h,j,d.REPLACE,this):arguments.length===9&&c.blend(a,b,f,e,g,m,h,j,o,d.REPLACE,this);delete this.sourceImg};this.filter=function(a,b){arguments.length===2?c.filter(a,b,this):arguments.length===1&&c.filter(a,null,this);delete this.sourceImg};this.save=function(a){c.save(a,this)};
this.resize=function(a,b){if(this.isRemote)throw"Image is loaded remotely. Cannot resize.";else if(this.width!==0||this.height!==0){a===0&&b!==0?a=j.floor(this.width/this.height*b):b===0&&a!==0&&(b=j.floor(this.height/this.width*a));var c=Z(this.imageData).canvas;this.fromImageData(Z(c,a,b).context.getImageData(0,0,a,b))}};this.mask=function(a){this.__mask=p;if(a instanceof ua)if(a.width===this.width&&a.height===this.height)this.__mask=a;else throw"mask must have the same dimensions as PImage.";else if(a instanceof
Array)if(this.pixels.length===a.length)this.__mask=a;else throw"mask array must be the same length as PImage pixels array.";};this.pixels={getLength:function(a){if(a.isRemote)throw"Image is loaded remotely. Cannot get length.";else return function(){return a.imageData.data.length?a.imageData.data.length/4:0}}(this),getPixel:function(a){if(a.isRemote)throw"Image is loaded remotely. Cannot get pixels.";else return function(b){b*=4;return c.color.toInt(a.imageData.data[b],a.imageData.data[b+1],a.imageData.data[b+
2],a.imageData.data[b+3])}}(this),setPixel:function(a){if(a.isRemote)throw"Image is loaded remotely. Cannot set pixel.";else return function(b,c){var f=b*4;a.imageData.data[f+0]=(c&d.RED_MASK)>>>16;a.imageData.data[f+1]=(c&d.GREEN_MASK)>>>8;a.imageData.data[f+2]=c&d.BLUE_MASK;a.imageData.data[f+3]=(c&d.ALPHA_MASK)>>>24}}(this),set:function(a){if(this.isRemote)throw"Image is loaded remotely. Cannot set pixels.";else for(var b=0,c=a.length;b<c;b++)this.setPixel(b,a[b])}};this.loadPixels=function(){};
this.updatePixels=function(){};this.toImageData=function(){return this.isRemote?this.sourceImg:Z(this.imageData).context.getImageData(0,0,this.width,this.height)};this.toDataURL=function(){if(this.isRemote)throw"Image is loaded remotely. Cannot create dataURI.";else return Z(this.imageData).canvas.toDataURL()};this.fromImageData=function(a){this.width=a.width;this.height=a.height;this.imageData=a;this.format=d.ARGB};this.fromHTMLImageData=function(a){var b=Z(a);try{this.fromImageData(b.context.getImageData(0,
0,a.width,a.height))}catch(c){if(a.width&&a.height)this.isRemote=!0,this.width=a.width,this.height=a.height}this.sourceImg=a};if(arguments.length===1)this.fromHTMLImageData(arguments[0]);else if(arguments.length===2||arguments.length===3){if(this.width=a||1,this.height=b||1,this.imageData=qd.createImageData(this.width,this.height),this.format=f===d.ARGB||f===d.ALPHA?f:d.RGB,this.format===d.RGB)for(var m=3,e=this.imageData.data,g=e.length;m<g;m+=4)e[m]=255}else this.height=this.width=0,this.imageData=
qd.createImageData(1,1),this.format=d.ARGB};c.PImage=ua;c.createImage=function(a,b,c){return new ua(a,b,c)};c.loadImage=function(a,b,c){b&&(a=a+"."+b);if(T.imageCache.images[a])b=new ua(T.imageCache.images[a]),b.loaded=!0;else{var b=new ua,d=B.createElement("img");b.sourceImg=d;d.onload=function(a,b,c){return function(){b.fromHTMLImageData(a);b.loaded=!0;c&&c()}}(d,b,c);d.src=a}return b};c.requestImage=c.loadImage;c.get=function(a,b,f,m,e){if(arguments.length===2){var g;if(a<c.width&&a>=0&&b>=0&&
b<c.height)if(Bb){var i=((0|a)+c.width*(0|b))*4;g=c.imageData.data;g=c.color.toInt(g[i],g[i+1],g[i+2],g[i+3])}else g=h.getImageData(0|a,0|b,1,1).data,g=c.color.toInt(g[0],g[1],g[2],g[3]);else g=0;return g}else if(arguments.length===0)return g=new ua(c.width,c.height,d.RGB),g.fromImageData(h.getImageData(0,0,c.width,c.height)),g;else if(arguments.length===5){if(e.isRemote)throw"Image is loaded remotely. Cannot get x,y,w,h.";else{g=new ua(f,m,d.RGB);for(var i=g.imageData.data,k=e.width,l=e.height,o=
e.imageData.data,p=j.max(0,-b),q=j.max(0,-a),l=j.min(m,l-b),n=j.min(f,k-a);p<l;++p)for(var s=((b+p)*k+(a+q))*4,x=(p*f+q)*4,t=q;t<n;++t)i[x++]=o[s++],i[x++]=o[s++],i[x++]=o[s++],i[x++]=o[s++]}return g}else if(arguments.length===4)return g=new ua(f,m,d.RGB),g.fromImageData(h.getImageData(a,b,f,m)),g;else if(arguments.length===3){if(f.isRemote)throw"Image is loaded remotely. Cannot get x,y.";else g=b*f.width*4+a*4,g=c.color.toInt(f.imageData.data[g],f.imageData.data[g+1],f.imageData.data[g+2],f.imageData.data[g+
3]);return g}else if(arguments.length===1)return a};c.createGraphics=function(a,b,c){var d=new y;d.size(a,b,c);return d};c.set=function(a,b,d,m){if(arguments.length===3)typeof d==="number"?a<c.width&&a>=0&&b>=0&&b<c.height&&(Bb||(c.loadPixels(),Dc===null&&(Mc=h,Dc=new wd),Bb=!0,h=Dc,cd=0),c.pixels.setPixel((0|a)+c.width*(0|b),d),++cd>dd&&Ba()):d instanceof ua&&c.image(d,a,b);else if(arguments.length===4)if(m.isRemote)throw"Image is loaded remotely. Cannot set x,y.";else{var e=c.color.toArray(d),g=
b*m.width*4+a*4,i=m.imageData.data;i[g]=e[0];i[g+1]=e[1];i[g+2]=e[2];i[g+3]=e[3]}};c.imageData={};c.pixels={getLength:function(){return c.imageData.data.length?c.imageData.data.length/4:0},getPixel:function(a){a*=4;return c.imageData.data[a+3]<<24&4278190080|c.imageData.data[a+0]<<16&16711680|c.imageData.data[a+1]<<8&65280|c.imageData.data[a+2]&255},setPixel:function(a,b){var d=a*4;c.imageData.data[d+0]=(b&16711680)>>>16;c.imageData.data[d+1]=(b&65280)>>>8;c.imageData.data[d+2]=b&255;c.imageData.data[d+
3]=(b&4278190080)>>>24},set:function(a){for(var b=0,c=a.length;b<c;b++)this.setPixel(b,a[b])}};c.loadPixels=function(){c.imageData=$.$ensureContext().getImageData(0,0,c.width,c.height)};c.updatePixels=function(){c.imageData&&$.$ensureContext().putImageData(c.imageData,0,0)};c.hint=function(a){var b=$.$ensureContext();a===d.DISABLE_DEPTH_TEST?(b.disable(b.DEPTH_TEST),b.depthMask(!1),b.clear(b.DEPTH_BUFFER_BIT)):a===d.ENABLE_DEPTH_TEST&&(b.enable(b.DEPTH_TEST),b.depthMask(!0))};C.prototype.background=
function(){var a;if(arguments[0]instanceof ua)if(a=arguments[0],a.loaded){if(a.width!==c.width||a.height!==c.height)throw"Background image must be the same dimensions as the canvas.";}else throw"Error using image in background(): PImage not loaded.";else a=c.color.apply(this,arguments),T.options.isTransparent||(a|=d.ALPHA_MASK);Cb=a};w.prototype.background=function(){arguments.length>0&&C.prototype.background.apply(this,arguments);Cb instanceof ua?(h.save(),h.setTransform(1,0,0,1,0,0),c.image(Cb,
0,0)):(h.save(),h.setTransform(1,0,0,1,0,0),T.options.isTransparent&&h.clearRect(0,0,c.width,c.height),h.fillStyle=c.color.toString(Cb),h.fillRect(0,0,c.width,c.height),Oa=!0);Ab()};F.prototype.background=function(){arguments.length>0&&C.prototype.background.apply(this,arguments);var a=c.color.toGLArray(Cb);h.clearColor(a[0],a[1],a[2],a[3]);h.clear(h.COLOR_BUFFER_BIT|h.DEPTH_BUFFER_BIT)};w.prototype.image=function(a,b,c,d,e){if(a.width>0){var g=ac(b||0,c||0,d||a.width,e||a.height,arguments.length<
4);if(a.sourceImg&&db===null&&!a.__mask){var i=a.sourceImg;h.drawImage(i,0,0,i.width,i.height,g.x,g.y,g.w,g.h)}else{i=a.toImageData();if(a.__mask){var k,l;if(a.__mask instanceof ua){var j=a.__mask.toImageData();k=2;for(l=a.width*a.height*4;k<l;k+=4)i.data[k+1]=j.data[k]}else{k=0;for(l=a.__mask.length;k<l;++k)i.data[(k<<2)+3]=a.__mask[k]}}db!==null&&db(i);h.drawImage(Z(i).canvas,0,0,a.width,a.height,g.x,g.y,g.w,g.h)}}};F.prototype.image=function(a,b,d,m,e){a.width>0&&(m=m||a.width,e=e||a.height,c.beginShape(c.QUADS),
c.texture(a.externals.canvas),c.vertex(b,d,0,0,0),c.vertex(b,d+e,0,0,e),c.vertex(b+m,d+e,0,m,e),c.vertex(b+m,d,0,m,0),c.endShape())};c.tint=function(){var a=c.color.apply(this,arguments),b=c.red(a)/ca,d=c.green(a)/ra,m=c.blue(a)/ia,e=c.alpha(a)/ja;db=function(a){for(var c=a.data,a=4*a.width*a.height,k=0;k<a;)c[k++]*=b,c[k++]*=d,c[k++]*=m,c[k++]*=e}};c.noTint=function(){db=null};c.copy=function(a,b,f,m,e,g,i,k,h){arguments.length===8&&(h=k,k=i,i=g,g=e,e=m,m=f,f=b,b=a,a=c);c.blend(a,b,f,m,e,g,i,k,h,
d.REPLACE)};c.blend=function(a,b,d,m,e,g,i,k,h,j,o){arguments.length===9&&(j=h,h=k,k=i,i=g,g=e,e=m,m=d,d=b,b=a,a=c);var p=b+m,n=d+e,q=g+k,s=i+h,x;if(a.isRemote)throw"Image is loaded remotely. Cannot blend image.";else arguments.length===10||arguments.length===9?(c.loadPixels(),x=c):arguments.length===11&&o&&o.imageData&&(x=o),a===c?c.intersect(b,d,p,n,g,i,q,s)?c.blit_resize(c.get(b,d,p-b,n-d),0,0,p-b-1,n-d-1,x.imageData.data,x.width,x.height,g,i,q,s,j):c.blit_resize(a,b,d,p,n,x.imageData.data,x.width,
x.height,g,i,q,s,j):(a.loadPixels(),c.blit_resize(a,b,d,p,n,x.imageData.data,x.width,x.height,g,i,q,s,j)),arguments.length===10&&c.updatePixels()};var rd=function(a,b){var c=0,d=b.pixels.getLength(),e=new td(d),g,i,k,h,j,o,p,n,q,s,x,r;if(a)for(;c<d;){g=c;for(i=c+b.width;c<i;)k=h=b.pixels.getPixel(c),o=c-1,j=c+1,p=c-b.width,n=c+b.width,o<g&&(o=c),j>=i&&(j=c),p<0&&(p=0),n>=d&&(n=c),p=b.pixels.getPixel(p),o=b.pixels.getPixel(o),n=b.pixels.getPixel(n),j=b.pixels.getPixel(j),k=77*(k>>16&255)+151*(k>>8&
255)+28*(k&255),s=77*(o>>16&255)+151*(o>>8&255)+28*(o&255),q=77*(j>>16&255)+151*(j>>8&255)+28*(j&255),x=77*(p>>16&255)+151*(p>>8&255)+28*(p&255),r=77*(n>>16&255)+151*(n>>8&255)+28*(n&255),s<k&&(h=o,k=s),q<k&&(h=j,k=q),x<k&&(h=p,k=x),r<k&&(h=n),e[c++]=h}else for(;c<d;){g=c;for(i=c+b.width;c<i;)k=h=b.pixels.getPixel(c),o=c-1,j=c+1,p=c-b.width,n=c+b.width,o<g&&(o=c),j>=i&&(j=c),p<0&&(p=0),n>=d&&(n=c),p=b.pixels.getPixel(p),o=b.pixels.getPixel(o),n=b.pixels.getPixel(n),j=b.pixels.getPixel(j),k=77*(k>>
16&255)+151*(k>>8&255)+28*(k&255),s=77*(o>>16&255)+151*(o>>8&255)+28*(o&255),q=77*(j>>16&255)+151*(j>>8&255)+28*(j&255),x=77*(p>>16&255)+151*(p>>8&255)+28*(p&255),r=77*(n>>16&255)+151*(n>>8&255)+28*(n&255),s>k&&(h=o,k=s),q>k&&(h=j,k=q),x>k&&(h=p,k=x),r>k&&(h=n),e[c++]=h}b.pixels.set(e)};c.filter=function(a,b,f){var h,e,g,i;arguments.length===3?(f.loadPixels(),h=f):(c.loadPixels(),h=c);b===p&&(b=null);if(h.isRemote)throw"Image is loaded remotely. Cannot filter image.";else{var k=h.pixels.getLength();
switch(a){case d.BLUR:var l=b||1,j=h,o,q,n,s,x,t,r,u,y;g=j.pixels.getLength();i=new G(g);k=new G(g);e=new G(g);g=new G(g);var z=0,v,A,D,l=c.floor(l*3.5),w,l=l<1?1:l<248?l:248;if(c.shared.blurRadius!==l){c.shared.blurRadius=l;c.shared.blurKernelSize=1+(c.shared.blurRadius<<1);c.shared.blurKernel=new G(c.shared.blurKernelSize);var C=c.shared.blurKernel,H=c.shared.blurKernelSize;for(w=0;w<H;w++)C[w]=0;H=(l-1)*(l-1);for(w=1;w<l;w++)C[l+w]=C[void 0]=H;C[l]=l*l}l=j.height;w=j.width;C=c.shared.blurKernelSize;
u=c.shared.blurRadius;var H=c.shared.blurKernel,B=j.imageData.data;for(A=0;A<l;A++){for(v=0;v<w;v++){n=q=o=s=j=0;t=v-u;if(t<0)x=-t,t=0;else{if(t>=w)break;x=0}for(D=x;D<C;D++){if(t>=w)break;r=(t+z)*4;x=H[D];s+=x*B[r+3];o+=x*B[r];q+=x*B[r+1];n+=x*B[r+2];j+=x;t++}r=z+v;g[r]=s/j;i[r]=o/j;k[r]=q/j;e[r]=n/j}z+=w}z=0;u=-u;y=u*w;for(A=0;A<l;A++){for(v=0;v<w;v++){n=q=o=s=j=0;if(u<0)x=r=-u,t=v;else{if(u>=l)break;x=0;r=u;t=v+y}for(D=x;D<C;D++){if(r>=l)break;x=H[D];s+=x*g[t];o+=x*i[t];q+=x*k[t];n+=x*e[t];j+=
x;r++;t+=w}r=(v+z)*4;B[r]=o/j;B[r+1]=q/j;B[r+2]=n/j;B[r+3]=s/j}z+=w;y+=w;u++}break;case d.GRAY:if(h.format===d.ALPHA){for(i=0;i<k;i++)e=255-h.pixels.getPixel(i),h.pixels.setPixel(i,4278190080|e<<16|e<<8|e);h.format=d.RGB}else for(i=0;i<k;i++)e=h.pixels.getPixel(i),g=77*(e>>16&255)+151*(e>>8&255)+28*(e&255)>>8,h.pixels.setPixel(i,e&d.ALPHA_MASK|g<<16|g<<8|g);break;case d.INVERT:for(i=0;i<k;i++)h.pixels.setPixel(i,h.pixels.getPixel(i)^16777215);break;case d.POSTERIZE:if(b===null)throw"Use filter(POSTERIZE, int levels) instead of filter(POSTERIZE)";
e=c.floor(b);if(e<2||e>255)throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)";g=e-1;for(i=0;i<k;i++)z=h.pixels.getPixel(i)>>16&255,l=h.pixels.getPixel(i)>>8&255,w=h.pixels.getPixel(i)&255,z=(z*e>>8)*255/g,l=(l*e>>8)*255/g,w=(w*e>>8)*255/g,h.pixels.setPixel(i,4278190080&h.pixels.getPixel(i)|z<<16|l<<8|w);break;case d.OPAQUE:for(i=0;i<k;i++)h.pixels.setPixel(i,h.pixels.getPixel(i)|4278190080);h.format=d.RGB;break;case d.THRESHOLD:b===null&&(b=0.5);if(b<0||b>1)throw"Level must be between 0 and 1 for filter(THRESHOLD, level)";
e=c.floor(b*255);for(i=0;i<k;i++)g=c.max((h.pixels.getPixel(i)&d.RED_MASK)>>16,c.max((h.pixels.getPixel(i)&d.GREEN_MASK)>>8,h.pixels.getPixel(i)&d.BLUE_MASK)),h.pixels.setPixel(i,h.pixels.getPixel(i)&d.ALPHA_MASK|(g<e?0:16777215));break;case d.ERODE:rd(!0,h);break;case d.DILATE:rd(!1,h)}h.updatePixels()}};c.shared={fracU:0,ifU:0,fracV:0,ifV:0,u1:0,u2:0,v1:0,v2:0,sX:0,sY:0,iw:0,iw1:0,ih1:0,ul:0,ll:0,ur:0,lr:0,cUL:0,cLL:0,cUR:0,cLR:0,srcXOffset:0,srcYOffset:0,r:0,g:0,b:0,a:0,srcBuffer:null,blurRadius:0,
blurKernelSize:0,blurKernel:null};c.intersect=function(a,b,c,d,e,g,i,k){c=c-a+1;d=d-b+1;i=i-e+1;k=k-g+1;e<a?(i+=e-a,i>c&&(i=c)):(a=c+a-e,i>a&&(i=a));g<b?(k+=g-b,k>d&&(k=d)):(b=d+b-g,k>b&&(k=b));return!(i<=0||k<=0)};c.filter_new_scanline=function(){c.shared.sX=c.shared.srcXOffset;c.shared.fracV=c.shared.srcYOffset&d.PREC_MAXVAL;c.shared.ifV=d.PREC_MAXVAL-c.shared.fracV;c.shared.v1=(c.shared.srcYOffset>>d.PRECISIONB)*c.shared.iw;c.shared.v2=j.min((c.shared.srcYOffset>>d.PRECISIONB)+1,c.shared.ih1)*
c.shared.iw};c.filter_bilinear=function(){c.shared.fracU=c.shared.sX&d.PREC_MAXVAL;c.shared.ifU=d.PREC_MAXVAL-c.shared.fracU;c.shared.ul=c.shared.ifU*c.shared.ifV>>d.PRECISIONB;c.shared.ll=c.shared.ifU*c.shared.fracV>>d.PRECISIONB;c.shared.ur=c.shared.fracU*c.shared.ifV>>d.PRECISIONB;c.shared.lr=c.shared.fracU*c.shared.fracV>>d.PRECISIONB;c.shared.u1=c.shared.sX>>d.PRECISIONB;c.shared.u2=j.min(c.shared.u1+1,c.shared.iw1);var a=(c.shared.v1+c.shared.u1)*4,b=(c.shared.v1+c.shared.u2)*4,f=(c.shared.v2+
c.shared.u1)*4,h=(c.shared.v2+c.shared.u2)*4;c.shared.cUL=c.color.toInt(c.shared.srcBuffer[a],c.shared.srcBuffer[a+1],c.shared.srcBuffer[a+2],c.shared.srcBuffer[a+3]);c.shared.cUR=c.color.toInt(c.shared.srcBuffer[b],c.shared.srcBuffer[b+1],c.shared.srcBuffer[b+2],c.shared.srcBuffer[b+3]);c.shared.cLL=c.color.toInt(c.shared.srcBuffer[f],c.shared.srcBuffer[f+1],c.shared.srcBuffer[f+2],c.shared.srcBuffer[f+3]);c.shared.cLR=c.color.toInt(c.shared.srcBuffer[h],c.shared.srcBuffer[h+1],c.shared.srcBuffer[h+
2],c.shared.srcBuffer[h+3]);c.shared.r=c.shared.ul*((c.shared.cUL&d.RED_MASK)>>16)+c.shared.ll*((c.shared.cLL&d.RED_MASK)>>16)+c.shared.ur*((c.shared.cUR&d.RED_MASK)>>16)+c.shared.lr*((c.shared.cLR&d.RED_MASK)>>16)<<d.PREC_RED_SHIFT&d.RED_MASK;c.shared.g=c.shared.ul*(c.shared.cUL&d.GREEN_MASK)+c.shared.ll*(c.shared.cLL&d.GREEN_MASK)+c.shared.ur*(c.shared.cUR&d.GREEN_MASK)+c.shared.lr*(c.shared.cLR&d.GREEN_MASK)>>>d.PRECISIONB&d.GREEN_MASK;c.shared.b=c.shared.ul*(c.shared.cUL&d.BLUE_MASK)+c.shared.ll*
(c.shared.cLL&d.BLUE_MASK)+c.shared.ur*(c.shared.cUR&d.BLUE_MASK)+c.shared.lr*(c.shared.cLR&d.BLUE_MASK)>>>d.PRECISIONB;c.shared.a=c.shared.ul*((c.shared.cUL&d.ALPHA_MASK)>>>24)+c.shared.ll*((c.shared.cLL&d.ALPHA_MASK)>>>24)+c.shared.ur*((c.shared.cUR&d.ALPHA_MASK)>>>24)+c.shared.lr*((c.shared.cLR&d.ALPHA_MASK)>>>24)<<d.PREC_ALPHA_SHIFT&d.ALPHA_MASK;return c.shared.a|c.shared.r|c.shared.g|c.shared.b};c.blit_resize=function(a,b,f,h,e,g,i,k,l,o,p,q,n){b<0&&(b=0);f<0&&(f=0);h>=a.width&&(h=a.width-1);
e>=a.height&&(e=a.height-1);h-=b;e-=f;p-=l;q-=o;if(!(p<=0||q<=0||h<=0||e<=0||l>=i||o>=k||b>=a.width||f>=a.height))switch(h=j.floor(h/p*d.PRECISIONF),e=j.floor(e/q*d.PRECISIONF),c.shared.srcXOffset=j.floor(l<0?-l*h:b*d.PRECISIONF),c.shared.srcYOffset=j.floor(o<0?-o*e:f*d.PRECISIONF),l<0&&(p+=l,l=0),o<0&&(q+=o,o=0),p=j.min(p,i-l),q=j.min(q,k-o),b=o*i+l,c.shared.srcBuffer=a.imageData.data,c.shared.iw=a.width,c.shared.iw1=a.width-1,c.shared.ih1=a.height-1,n){case d.BLEND:for(f=0;f<q;f++){c.filter_new_scanline();
for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.blend(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.ADD:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.add(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+
n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.SUBTRACT:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.subtract(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.LIGHTEST:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*
4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.lightest(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.DARKEST:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.darkest(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=
e}break;case d.REPLACE:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=a.format!==d.RGB&&g[(b+n)*4]!==255?c.color.toArray(c.modes.blend(k,c.filter_bilinear())):c.color.toArray(c.filter_bilinear()),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.DIFFERENCE:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+
n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.difference(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.EXCLUSION:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.exclusion(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;
b+=i;c.shared.srcYOffset+=e}break;case d.MULTIPLY:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.multiply(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.SCREEN:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.screen(k,
c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.OVERLAY:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.overlay(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.HARD_LIGHT:for(f=0;f<q;f++){c.filter_new_scanline();
for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.hard_light(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.SOFT_LIGHT:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.soft_light(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+
n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.DODGE:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.dodge(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}break;case d.BURN:for(f=0;f<q;f++){c.filter_new_scanline();for(n=0;n<p;n++)k=c.color.toInt(g[(b+n)*4],g[(b+n)*4+1],
g[(b+n)*4+2],g[(b+n)*4+3]),k=c.color.toArray(c.modes.burn(k,c.filter_bilinear())),g[(b+n)*4]=k[0],g[(b+n)*4+1]=k[1],g[(b+n)*4+2]=k[2],g[(b+n)*4+3]=k[3],c.shared.sX+=h;b+=i;c.shared.srcYOffset+=e}}};Ra.prototype.width=function(a){return"measureText"in h?h.measureText(typeof a==="number"?String.fromCharCode(a):a).width/N:0};Ra.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]};c.PFont=Ra;c.loadFont=function(a){if(a===p||a.indexOf(".svg")===-1)return new Ra(a);else{var b=c.loadGlyphs(a);
return{name:a,glyph:!0,units_per_em:b.units_per_em,horiz_adv_x:1/b.units_per_em*b.horiz_adv_x,ascent:b.ascent,descent:b.descent,width:function(b){for(var d=0,e=b.length,g=0;g<e;g++)try{d+=parseFloat(c.glyphLook(c.glyphTable[a],b[g]).horiz_adv_x)}catch(i){y.debug(i)}return d/c.glyphTable[a].units_per_em}}}};c.createFont=function(a,b){if(arguments.length===2)return c.textSize(b),c.loadFont(a);else if(arguments.length===3)return c.textSize(b),c.loadFont(a);else if(arguments.length===4)return c.textSize(b),
c.loadFont(a);else throw"incorrent number of parameters for createFont";};c.textFont=function(a,b){W=a;b?c.textSize(b):$.$ensureContext().font=N+"px "+W.name};c.textSize=function(a){if(a)N=a,$.$ensureContext().font=N+"px "+W.name};c.textAlign=function(){arguments.length===1?kb=arguments[0]:arguments.length===2&&(kb=arguments[0],jb=arguments[1])};w.prototype.textWidth=function(a){var a=Ca(a).split(/\r?\n/g),b=0,c,d=a.length;h.font=N+"px "+W.name;for(c=0;c<d;++c)b=j.max(b,h.measureText(a[c]).width);
return b};F.prototype.textWidth=function(a){var a=Ca(a).split(/\r?\n/g),b=0,c,d=a.length;sa===p&&(sa=B.createElement("canvas"));var e=sa.getContext("2d");e.font=N+"px "+W.name;for(c=0;c<d;++c)b=j.max(b,e.measureText(a[c]).width);return b};c.textLeading=function(a){Xa=a};c.textAscent=function(){var a=p,b=p,d=p,h=p;return function(){if(b!==W||a!==N){b=W;a=N;var e=!1,g=c.color(0),i=0,k=N,l=N/2;for(h=new Nc(W.name,N,N,"k");l!==k;){for(var o=0;o<N;o++)h.get(o,l)!==g&&(e=!0,o=N);e?(k=l,e=!1):i=l;l=j.ceil((k+
i)/2)}d=N-1-l+1}return d}}();c.textDescent=function(){var a=p,b=p,d=p,h=p;return function(){if(b!==W||a!==N){b=W;a=N;var e=!1,g=c.color(0),i=0,k=N,l=N/2;for(h=new Nc(W.name,N,0,"p");l!==k;){for(var o=0;o<N;o++)h.get(o,l)!==g&&(e=!0,o=N);e?(i=l,e=!1):k=l;l=j.ceil((k+i)/2)}d=l+1}return d}}();c.glyphLook=function(a,b){try{switch(b){case "1":return a.one;case "2":return a.two;case "3":return a.three;case "4":return a.four;case "5":return a.five;case "6":return a.six;case "7":return a.seven;case "8":return a.eight;
case "9":return a.nine;case "0":return a.zero;case " ":return a.space;case "$":return a.dollar;case "!":return a.exclam;case '"':return a.quotedbl;case "#":return a.numbersign;case "%":return a.percent;case "&":return a.ampersand;case "'":return a.quotesingle;case "(":return a.parenleft;case ")":return a.parenright;case "*":return a.asterisk;case "+":return a.plus;case ",":return a.comma;case "-":return a.hyphen;case ".":return a.period;case "/":return a.slash;case "_":return a.underscore;case ":":return a.colon;
case ";":return a.semicolon;case "<":return a.less;case "=":return a.equal;case ">":return a.greater;case "?":return a.question;case "@":return a.at;case "[":return a.bracketleft;case "\\":return a.backslash;case "]":return a.bracketright;case "^":return a.asciicircum;case "`":return a.grave;case "{":return a.braceleft;case "|":return a.bar;case "}":return a.braceright;case "~":return a.asciitilde;default:return a[b]}}catch(c){y.debug(c)}};w.prototype.text$line=function(a,b,f,j,e){j=j=0;if(W.glyph){j=
c.glyphTable[W.name];h.save();h.translate(b,f+N);(e===d.RIGHT||e===d.CENTER)&&j.width(a);b=1/j.units_per_em*N;h.scale(b,b);b=0;for(f=a.length;b<f;b++)try{c.glyphLook(j,a[b]).draw()}catch(g){y.debug(g)}Ab()}else if(a&&"fillText"in h){if(Oa)h.fillStyle=c.color.toString(Qa),Oa=!1;if(e===d.RIGHT||e===d.CENTER)j=h.measureText(a).width,j=e===d.RIGHT?-j:-j/2;h.fillText(a,b+j,f)}};F.prototype.text$line=function(a,b,c,j,e){sa===p&&(sa=B.createElement("canvas"));var g=h;h=sa.getContext("2d");h.font=N+"px "+
W.name;var i=h.measureText(a).width;sa.width=i;sa.height=N;h=sa.getContext("2d");h.font=N+"px "+W.name;h.textBaseline="top";w.prototype.text$line(a,0,0,0,d.LEFT);a=sa.width/sa.height;h=g;h.bindTexture(h.TEXTURE_2D,ad);wb(sa);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);g=0;e===d.RIGHT?g=-i:e===d.CENTER&&
(g=-i/2);e=new z;i=N*0.5;e.translate(b+g-i/2,c-i,j);e.scale(-a*i,-i,i);e.translate(-1,-1,-1);e.transpose();b=new z;b.scale(1,-1,1);b.apply(O.array());b.transpose();h.useProgram(v);u("vertex2d",v,"Vertex",3,zc);u("aTextureCoord2d",v,"aTextureCoord",2,Ac);H("uSampler2d",v,"uSampler",[0]);H("picktype2d",v,"picktype",1);J("model2d",v,"model",!1,e.array());J("view2d",v,"view",!1,b.array());t("color2d",v,"color",ma);h.bindBuffer(h.ELEMENT_ARRAY_BUFFER,Bc);h.drawElements(h.TRIANGLES,6,h.UNSIGNED_SHORT,0)};
c.text=function(){if(Cc===d.SCREEN){c.pushMatrix();c.resetMatrix();var a=c.textAscent(),b=c.textDescent(),f=c.textWidth(arguments[0]),h=a+b,b=c.loadFont(W.origName),f=c.createGraphics(f,h);f.beginDraw();f.fill(Qa);f.opaque=!1;f.background(0,0,0,0);f.textFont(b);f.textSize(N);f.text(arguments[0],0,a);f.endDraw();arguments.length===5||arguments.length===6?c.image(f,arguments[1],arguments[2]-a,arguments[3],arguments[4]):c.image(f,arguments[1],arguments[2]-a);c.popMatrix()}else Cc!==d.SHAPE&&(arguments.length===
3?Oc(Ca(arguments[0]),arguments[1],arguments[2],0):arguments.length===4?Oc(Ca(arguments[0]),arguments[1],arguments[2],arguments[3]):arguments.length===5?Pc(Ca(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0):arguments.length===6&&Pc(Ca(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))};c.textMode=function(a){Cc=a};c.loadGlyphs=function(a){var b,d,h,e,g,i,k,l,o,q,s,n,x=function(a,b){var c=0,d=[],f,e=RegExp(a,"g");for(f=d[c]=e.exec(b);f;)c++,f=d[c]=
e.exec(b);return d},t=function(t){var r=t.getElementsByTagName("font");c.glyphTable[a].horiz_adv_x=r[0].getAttribute("horiz-adv-x");r=t.getElementsByTagName("font-face")[0];c.glyphTable[a].units_per_em=parseFloat(r.getAttribute("units-per-em"));c.glyphTable[a].ascent=parseFloat(r.getAttribute("ascent"));c.glyphTable[a].descent=parseFloat(r.getAttribute("descent"));for(var t=t.getElementsByTagName("glyph"),r=t.length,u=0;u<r;u++){var w=t[u].getAttribute("unicode"),z=t[u].getAttribute("glyph-name");
s=t[u].getAttribute("horiz-adv-x");if(s===null)s=c.glyphTable[a].horiz_adv_x;k=t[u].getAttribute("d");if(k!==p){var v=k,D=x("[A-Za-z][0-9\\- ]+|Z",v);n="var path={draw:function(){saveContext();curContext.beginPath();";l=i=g=e=h=d=b=0;o="";q=D.length-1;for(var y=0;y<q;y++){var A=D[y][0],v=x("[0-9\\-]+",A);switch(A[0]){case "M":b=parseFloat(v[0][0]);d=parseFloat(v[1][0]);n+="curContext.moveTo("+b+","+-d+");";break;case "L":b=parseFloat(v[0][0]);d=parseFloat(v[1][0]);n+="curContext.lineTo("+b+","+-d+
");";break;case "H":b=parseFloat(v[0][0]);n+="curContext.lineTo("+b+","+-d+");";break;case "V":d=parseFloat(v[0][0]);n+="curContext.lineTo("+b+","+-d+");";break;case "T":g=parseFloat(v[0][0]);i=parseFloat(v[1][0]);o==="Q"||o==="T"?(v=j.sqrt(j.pow(b-h,2)+j.pow(e-d,2)),l=j.PI+j.atan2(h-b,e-d),h=b+j.sin(l)*v,e=d+j.cos(l)*v):(h=b,e=d);n+="curContext.quadraticCurveTo("+h+","+-e+","+g+","+-i+");";b=g;d=i;break;case "Q":h=parseFloat(v[0][0]);e=parseFloat(v[1][0]);g=parseFloat(v[2][0]);i=parseFloat(v[3][0]);
n+="curContext.quadraticCurveTo("+h+","+-e+","+g+","+-i+");";b=g;d=i;break;case "Z":n+="curContext.closePath();"}o=A[0]}n+="executeContextFill();executeContextStroke();";n+="restoreContext();";n+="curContext.translate("+s+",0);";n+="}}";eval(n);c.glyphTable[a][z]={name:z,unicode:w,horiz_adv_x:s,draw:n.draw}}}};c.glyphTable[a]={};(function(){var b;try{b=B.implementation.createDocument("","",null)}catch(c){y.debug(c.message);return}try{b.async=!1,b.load(a),t(b.getElementsByTagName("svg")[0])}catch(d){y.debug(d);
try{var f=new Q.XMLHttpRequest;f.open("GET",a,!1);f.send(null);t(f.responseXML.documentElement)}catch(e){y.debug(d)}}})(a);return c.glyphTable[a]};c.param=function(a){var b="data-processing-"+a;if(q.hasAttribute(b))return q.getAttribute(b);for(var b=0,c=q.childNodes.length;b<c;++b){var d=q.childNodes.item(b);if(!(d.nodeType!==1||d.tagName.toLowerCase()!=="param")&&d.getAttribute("name")===a)return d.getAttribute("value")}if(T.params.hasOwnProperty(a))return T.params[a];return null};A.prototype.translate=
D("translate");A.prototype.scale=D("scale");A.prototype.pushMatrix=D("pushMatrix");A.prototype.popMatrix=D("popMatrix");A.prototype.resetMatrix=D("resetMatrix");A.prototype.applyMatrix=D("applyMatrix");A.prototype.rotate=D("rotate");A.prototype.redraw=D("redraw");A.prototype.ambientLight=D("ambientLight");A.prototype.directionalLight=D("directionalLight");A.prototype.lightFalloff=D("lightFalloff");A.prototype.lightSpecular=D("lightSpecular");A.prototype.pointLight=D("pointLight");A.prototype.noLights=
D("noLights");A.prototype.spotLight=D("spotLight");A.prototype.box=D("box");A.prototype.sphere=D("sphere");A.prototype.ambient=D("ambient");A.prototype.emissive=D("emissive");A.prototype.shininess=D("shininess");A.prototype.specular=D("specular");A.prototype.fill=D("fill");A.prototype.stroke=D("stroke");A.prototype.strokeWeight=D("strokeWeight");A.prototype.smooth=D("smooth");A.prototype.noSmooth=D("noSmooth");A.prototype.point=D("point");A.prototype.vertex=D("vertex");A.prototype.endShape=D("endShape");
A.prototype.bezierVertex=D("bezierVertex");A.prototype.curveVertex=D("curveVertex");A.prototype.curve=D("curve");A.prototype.line=D("line");A.prototype.bezier=D("bezier");A.prototype.rect=D("rect");A.prototype.ellipse=D("ellipse");A.prototype.background=D("background");A.prototype.image=D("image");A.prototype.textWidth=D("textWidth");A.prototype.text$line=D("text$line");A.prototype.$ensureContext=D("$ensureContext");A.prototype.$newPMatrix=D("$newPMatrix");A.prototype.size=function(a,b,f){lb(f===
d.WEBGL?"3D":"2D");c.size(a,b,f)};A.prototype.$init=function(){};w.prototype.$init=function(){c.size(c.width,c.height);h.translate(0.5,0.5);h.lineCap="round";c.noSmooth();c.disableContextMenu()};F.prototype.$init=function(){c.use3DContext=!0};C.prototype.$ensureContext=function(){return h};c.extendClassChain=function(a){for(var b=[a],c=a.$upcast;c;c=c.$upcast)ic(c,a),b.push(c),a=c;for(;b.length>0;)b.pop().$self=a};c.extendStaticMembers=function(a,b){ic(a,b)};c.extendInterfaceMembers=function(a,b){ic(a,
b)};c.addMethod=function(a,b,c){if(a[b]){var d=c.length,e=a[b];a[b]=function(){return arguments.length===d?c.apply(this,arguments):e.apply(this,arguments)}}else a[b]=c};c.createJavaArray=function(a,b){var d=null;if(typeof b[0]==="number"){var h=0|b[0];if(b.length<=1){d=[];d.length=h;for(var e=0;e<h;++e)d[e]=0}else for(var d=[],e=b.slice(1),g=0;g<h;++g)d.push(c.createJavaArray(a,e))}return d};U(q,"touchstart",function(a){q.setAttribute("style","-webkit-user-select: none");q.setAttribute("onclick",
"void(0)");q.setAttribute("style","-webkit-tap-highlight-color:rgba(0,0,0,0)");for(var b=0,f=Sa.length;b<f;b++){var h=Sa[b][0],e=Sa[b][1],g=Sa[b][2];(e==="mouseout"||e==="mousemove"||e==="mousedown"||e==="mouseup"||e==="DOMMouseScroll"||e==="mousewheel"||e==="touchstart")&&Ja(h,e,g)}c.touchStart!==p||c.touchMove!==p||c.touchEnd!==p||c.touchCancel!==p?(U(q,"touchstart",function(a){c.touchStart!==p&&(a=Pb(a),c.touchStart(a))}),U(q,"touchmove",function(a){c.touchMove!==p&&(a.preventDefault(),a=Pb(a),
c.touchMove(a))}),U(q,"touchend",function(a){c.touchEnd!==p&&(a=Pb(a),c.touchEnd(a))}),U(q,"touchcancel",function(a){c.touchCancel!==p&&(a=Pb(a),c.touchCancel(a))})):(U(q,"touchstart",function(a){Ob(q,a.touches[0]);c.__mousePressed=!0;c.mouseDragging=!1;c.mouseButton=d.LEFT;typeof c.mousePressed==="function"&&c.mousePressed()}),U(q,"touchmove",function(a){a.preventDefault();Ob(q,a.touches[0]);typeof c.mouseMoved==="function"&&!c.__mousePressed&&c.mouseMoved();if(typeof c.mouseDragged==="function"&&
c.__mousePressed)c.mouseDragged(),c.mouseDragging=!0}),U(q,"touchend",function(){c.__mousePressed=!1;typeof c.mouseClicked==="function"&&!c.mouseDragging&&c.mouseClicked();typeof c.mouseReleased==="function"&&c.mouseReleased()}));q.dispatchEvent(a)});U(q,"mousemove",function(a){Ob(q,a);typeof c.mouseMoved==="function"&&!c.__mousePressed&&c.mouseMoved();if(typeof c.mouseDragged==="function"&&c.__mousePressed)c.mouseDragged(),c.mouseDragging=!0});U(q,"mouseout",function(){typeof c.mouseOut==="function"&&
c.mouseOut()});U(q,"mouseover",function(a){Ob(q,a);typeof c.mouseOver==="function"&&c.mouseOver()});U(q,"mousedown",function(a){c.__mousePressed=!0;c.mouseDragging=!1;switch(a.which){case 1:c.mouseButton=d.LEFT;break;case 2:c.mouseButton=d.CENTER;break;case 3:c.mouseButton=d.RIGHT}typeof c.mousePressed==="function"&&c.mousePressed()});U(q,"mouseup",function(){c.__mousePressed=!1;typeof c.mouseClicked==="function"&&!c.mouseDragging&&c.mouseClicked();typeof c.mouseReleased==="function"&&c.mouseReleased()});
Hb=function(a){var b=0;a.wheelDelta?(b=a.wheelDelta/120,Q.opera&&(b=-b)):a.detail&&(b=-a.detail/3);(c.mouseScroll=b)&&typeof c.mouseScrolled==="function"&&c.mouseScrolled()};U(B,"DOMMouseScroll",Hb);U(B,"mousewheel",Hb);typeof q==="string"&&(q=B.getElementById(q));q.getAttribute("tabindex")||q.setAttribute("tabindex",0);if(mb)T=new y.Sketch,T.options.isTransparent=!0,lb(),c.size=function(a,b,f){f&&f===d.WEBGL?lb("3D"):lb("2D");c.toImageData=f===d.WEBGL?function(){var a=B.createElement("canvas").getContext("2d").createImageData(this.width,
this.height),b=new Ic(this.width*this.height*4);h.readPixels(0,0,this.width,this.height,h.RGBA,h.UNSIGNED_BYTE,b);for(var c=0,d=b.length,f=this.height,l=this.width,o=a.data;c<d;c++)o[c]=b[(f-1-j.floor(c/4/l))*l*4+c%(l*4)];return a}:function(){return h.getImageData(0,0,this.width,this.height)};c.size(a,b,f)};else{if(x instanceof y.Sketch)T=x;else if(typeof x==="function")T=new y.Sketch(x);else if(x)throw"PJS compile is not supported";else T=new y.Sketch(function(){});c.externals.sketch=T;lb();if("mozOpaque"in
q)q.mozOpaque=!T.options.isTransparent;q.onfocus=function(){c.focused=!0};q.onblur=function(){c.focused=!1;if(!T.options.globalKeyEvents)c.__keyPressed=!1,Ya=[],ab=null};T.options.pauseOnBlur&&(U(Q,"focus",function(){bb&&c.loop()}),U(Q,"blur",function(){bb&&Qb&&(c.noLoop(),bb=!0);c.__keyPressed=!1;Ya=[];ab=null}));mb=T.options.globalKeyEvents?Q:q;U(mb,"keydown",Jb);U(mb,"keypress",gc);U(mb,"keyup",hc);for(var Ib in y.lib)y.lib.hasOwnProperty(Ib)&&(y.lib[Ib].hasOwnProperty("attach")?y.lib[Ib].attach(c):
y.lib[Ib]instanceof Function&&y.lib[Ib].call(this));var sd=function(a){!T.imageCache.pending&&T.fonts.pending()?(T.attach(a,Na),a.setup&&(a.setup(),h&&!c.use3DContext&&h.setTransform(1,0,0,1,0,0)),Ba(),a.draw&&(bb?a.loop():a.redraw())):Q.setTimeout(function(){sd(a)},10)};if(this.externals.canvas.id===p||!this.externals.canvas.id.length)this.externals.canvas.id="__processing"+ib.length;Lb[this.externals.canvas.id]=ib.length;ib.push(this);sd(c)}};y.debug=La;y.prototype=Na;La=function(){var d={};typeof tinylog!==
"undefined"&&typeof tinylog.log==="function"?d.log=tinylog.log:typeof B!=="undefined"&&!B.fake?function(){var j=B,p={zIndex:1E4,position:"fixed",bottom:"0px",width:"100%",height:"15%",fontFamily:"sans-serif",color:"#ccc",backgroundColor:"black"},t={position:"relative",fontFamily:"monospace",overflow:"auto",height:"100%",paddingTop:"5px"},y={height:"5px",marginTop:"-5px",cursor:"n-resize",backgroundColor:"darkgrey"},u={position:"absolute",top:"5px",right:"20px",color:"#111",MozBorderRadius:"4px",webkitBorderRadius:"4px",
borderRadius:"4px",cursor:"pointer",fontWeight:"normal",textAlign:"center",padding:"3px 5px",backgroundColor:"#333",fontSize:"12px"},G={minHeight:"16px"},J={fontSize:"12px",margin:"0 8px 0 8px",maxWidth:"100%",whiteSpace:"pre-wrap",overflow:"auto"},E=j.defaultView,Q=j.documentElement,V=Q.style,zb=function(){for(var d=arguments.length,j,p,q;d--;)for(q in p=arguments[d--],j=arguments[d].style,p)p.hasOwnProperty(q)&&(j[q]=p[q])},wa=function(d,j,p){d.addEventListener?d.addEventListener(j,p,!1):d.attachEvent&&
d.attachEvent("on"+j,p);return[d,j,p]},qa=function(d,j,p){d.removeEventListener?d.removeEventListener(j,p,!1):d.detachEvent&&d.detachEvent("on"+j,p)},ha=function(d){for(var j=d.childNodes,p=j.length;p--;)d.removeChild(j.item(0))},Aa=function(d,j){return d.appendChild(j)},va=d.log=function(B){var Pa,Na=V.paddingBottom,S=j.createElement("div"),da=S.style,Wa=Aa(S,j.createElement("div")),Z=Aa(S,j.createElement("div")),Ba=Aa(S,j.createElement("div")),pa=!1,Ra=!1,Ca=!1,Ja=0,La=function(d){var j=E.innerHeight,
p=Wa.clientHeight;d<0?d=0:d+p>j&&(d=j-p);da.height=d/j*100+"%";V.paddingBottom=S.clientHeight+"px"},Ma=[wa(j,"mousemove",function(d){if(pa)La(E.innerHeight-d.clientY),Z.scrollTop=Ca}),wa(j,"mouseup",function(){pa&&(pa=Ca=!1)}),wa(Wa,"dblclick",function(d){d.preventDefault();Ra?(La(Ra),Ra=!1):(Ra=S.clientHeight,da.height="0px")}),wa(Wa,"mousedown",function(d){d.preventDefault();pa=!0;Ca=Z.scrollTop}),wa(Wa,"contextmenu",function(){pa=!1}),wa(Ba,"click",function(){Pa()})];Pa=function(){for(var j=Ma.length;j--;)qa.apply(d,
Ma[j]);Q.removeChild(S);V.paddingBottom=Na;ha(Z);ha(S);d.log=va};zb(S,p,Z,t,Wa,y,Ba,u);Ba.title="Close Log";Aa(Ba,j.createTextNode("\u2716"));Wa.title="Double-click to toggle log minimization";Q.insertBefore(S,Q.firstChild);d.log=function(d){Ja===512?Z.removeChild(Z.firstChild):Ja++;var p=Aa(Z,j.createElement("div")),q=Aa(p,j.createElement("div"));p.title=(new Date).toLocaleTimeString();zb(p,G,q,J);Aa(q,j.createTextNode(d));Z.scrollTop=Z.scrollHeight};d.log(B);V.paddingBottom=S.clientHeight+"px"}}():
typeof print==="function"&&(d.log=print);return d}();y.logger=La;y.version="1.2.1";y.lib={};y.registerLibrary=function(d,j){y.lib[d]=j;j.hasOwnProperty("init")&&j.init(Na)};y.instances=ib;y.getInstanceById=function(d){return ib[Lb[d]]};y.Sketch=function(d){this.attachFunction=d;this.options={isTransparent:!1,crispLines:!1,pauseOnBlur:!1,globalKeyEvents:!1};this.params={};this.imageCache={pending:0,images:{},add:function(d){if(va){var j=new Image;j.onload=function(d){return function(){d.pending--}}(this);
this.pending++;this.images[d]=j;j.src=d}else this.images[d]=null}};this.fonts={template:function(){if(!va)return null;var d=B.createElement("p");d.style.fontFamily="serif";d.style.fontSize="72px";d.style.visibility="hidden";d.innerHTML="abcmmmmmmmmmmlll";B.getElementsByTagName("body")[0].appendChild(d);return d}(),attempt:0,pending:function(){for(var d=!0,j=0;j<this.fontList.length;j++)this.fontList[j].offsetWidth===this.template.offsetWidth&&this.fontList[j].offsetHeight===this.template.offsetHeight?
(d=!1,this.attempt++):(B.getElementsByTagName("body")[0].removeChild(this.fontList[j]),this.fontList.splice(j--,1),this.attempt=0);if(this.attempt>=30){d=!0;for(j=0;j<this.fontList.length;j++)B.getElementsByTagName("body")[0].removeChild(this.fontList[j]),this.fontList.splice(j--,1)}d&&B.getElementsByTagName("body")[0].removeChild(this.template);return d},fontList:[],fontFamily:"",style:va?B.createElement("style"):null,add:function(d){var j=typeof d==="object"?d.fontFace:d;this.fontFamily+="@font-face{\n font-family: '"+
j+"';\n src: url('"+(typeof d==="object"?d.url:d)+"');\n}\n";this.style.innerHTML=this.fontFamily;B.getElementsByTagName("head")[0].appendChild(this.style);d=B.createElement("p");d.style.fontFamily="'"+j+"', serif";d.style.fontSize="72px";d.style.visibility="hidden";d.innerHTML="abcmmmmmmmmmmlll";B.getElementsByTagName("body")[0].appendChild(d);this.fontList.push(d)}};this.sourceCode=void 0;this.attach=function(d){if(typeof this.attachFunction==="function")this.attachFunction(d);else if(this.sourceCode){var j=
eval(this.sourceCode);j(d);this.attachFunction=j}else throw"Unable to attach sketch to the processing instance";}};var xb=function(d,j){function p(d,j){var q=new XMLHttpRequest;q.onreadystatechange=function(){if(q.readyState===4){var d;q.status!==200&&q.status!==0?d="Invalid XHR status "+q.status:q.responseText===""&&(d="No content");j(q.responseText,d)}};q.open("GET",d,!0);q.overrideMimeType&&q.overrideMimeType("application/json");q.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");
q.send(null)}function t(j,t){p(t,function(p,x){B[j]=p;++J;x&&u.push(" "+t+" ==> "+x);if(J===G)if(u.length===0)try{return new y(d,B.join("\n"))}catch(E){y.logger.log("Unable to execute pjs sketch: "+E)}else y.logger.log("Unable to load pjs sketch files:\n"+u.join("\n"))})}for(var B=[],u=[],G=j.length,J=0,E=0;E<G;++E)t(E,j[E])},pa=function(){for(var d=B.getElementsByTagName("canvas"),j=0,p=d.length;j<p;j++){var t=d[j].getAttribute("data-processing-sources");t===null&&(t=d[j].getAttribute("data-src"),
t===null&&(t=d[j].getAttribute("datasrc")));if(t){for(var t=t.split(" "),y=0;y<t.length;)t[y]?y++:t.splice(y,1);xb(d[j],t)}}};y.loadSketchFromSources=xb;y.disableInit=function(){va&&B.removeEventListener("DOMContentLoaded",pa,!1)};y.loadSketchFromSources=xb;y.disableInit=function(){va&&B.removeEventListener("DOMContentLoaded",pa,!1)};va?(Q.Processing=y,B.addEventListener("DOMContentLoaded",pa,!1)):this.Processing=y})(window,window.document,Math,function(){});