/*** P R O C E S S I N G . J S - 1.3.6-API a port of the Processing visualization language Processing.js is licensed under the MIT License, see LICENSE. For a list of copyright holders, please refer to AUTHORS. http://processingjs.org ***/ (function(l,u,o,c){var h=function(){};var s=function(){if("console" in l){return function(G){l.console.log("Processing.js: "+G)}}return h()}();var r=function(G){var H=new XMLHttpRequest;H.open("GET",G,false);if(H.overrideMimeType){H.overrideMimeType("text/plain")}H.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");H.send(null);if(H.status!==200&&H.status!==0){throw"XMLHttpRequest failed, status code "+H.status}return H.responseText};var F="document" in this&&!("fake" in this.document);u.head=u.head||u.getElementsByTagName("head")[0];function i(G,H){if(G in l){return l[G]}if(typeof l[H]==="function"){return l[H]}return function(J){if(J instanceof Array){return J}if(typeof J==="number"){var I=[];I.length=J;return I}}}var d=i("Float32Array","WebGLFloatArray"),m=i("Int32Array","WebGLIntArray"),w=i("Uint16Array","WebGLUnsignedShortArray"),q=i("Uint8Array","WebGLUnsignedByteArray");var j={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:0.0001,MAX_FLOAT:3.4028235e+38,MIN_FLOAT:-3.4028235e+38,MAX_INT:2147483647,MIN_INT:-2147483648,PI:o.PI,TWO_PI:2*o.PI,HALF_PI:o.PI/2,THIRD_PI:o.PI/3,QUARTER_PI:o.PI/4,DEG_TO_RAD:o.PI/180,RAD_TO_DEG:180/o.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<<0,ADD:1<<1,SUBTRACT:1<<2,LIGHTEST:1<<3,DARKEST:1<<4,DIFFERENCE:1<<5,EXCLUSION:1<<6,MULTIPLY:1<<7,SCREEN:1<<8,OVERLAY:1<<9,HARD_LIGHT:1<<10,SOFT_LIGHT:1<<11,DODGE:1<<12,BURN:1<<13,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:720,PRECISIONB:15,PRECISIONF:1<<15,PREC_MAXVAL:(1<<15)-1,PREC_ALPHA_SHIFT:24-15,PREC_RED_SHIFT:16-15,NORMAL_MODE_AUTO:0,NORMAL_MODE_SHAPE:1,NORMAL_MODE_VERTEX:2,MAX_LIGHTS:8};function a(I){if(typeof I==="string"){var H=0;for(var G=0;G0&&typeof arguments[0]!=="number"){I=arguments[0].toArray()}else{I=[];I.length=0|arguments[0]}}this.get=function(J){return I[J]};this.contains=function(J){return this.indexOf(J)>-1};this.indexOf=function(L){for(var K=0,J=I.length;K=0&&J<=I.length){I.splice(J,0,arguments[1])}else{throw J+" is not a valid index"}}else{throw typeof J+" is not a number"}}else{throw"Please use the proper number of parameters."}}};this.addAll=function(K,J){var L;if(typeof K==="number"){if(K<0||K>I.length){throw"Index out of bounds for addAll: "+K+" greater or equal than "+I.length}L=new e(J);while(L.hasNext()){I.splice(K++,0,L.next())}}else{L=new e(K);while(L.hasNext()){I.push(L.next())}}};this.set=function(){if(arguments.length===2){var J=arguments[0];if(typeof J==="number"){if(J>=0&&J-1){I.splice(J,1);return true}return false};this.isEmpty=function(){return !I.length};this.clone=function(){return new G(this)};this.toArray=function(){return I.slice(0)};this.iterator=function(){return new H(I)}}return G}();var C=function(){function G(){if(arguments.length===1&&arguments[0] instanceof G){return arguments[0].clone()}var P=arguments.length>0?arguments[0]:16;var Q=arguments.length>1?arguments[1]:0.75;var J=[];J.length=P;var L=0;var H=this;function N(S){var R=a(S)%J.length;return R<0?J.length+R:R}function K(){if(L<=Q*J.length){return}var U=[];for(var T=0;T=J.length){T=true}else{if(J[R]===c||U>=J[R].length){U=-1;++R}else{return}}}}this.hasNext=function(){return !T};this.next=function(){var X=V(J[R][U]);S();return X};this.remove=function(){W(this.next());--U};S()}function O(R,S,T){this.clear=function(){H.clear()};this.contains=function(U){return S(U)};this.containsAll=function(V){var U=V.iterator();while(U.hasNext()){if(!this.contains(U.next())){return false}}return true};this.isEmpty=function(){return H.isEmpty()};this.iterator=function(){return new I(R,T)};this.remove=function(U){if(this.contains(U)){T(U);return true}return false};this.removeAll=function(X){var U=X.iterator();var W=false;while(U.hasNext()){var V=U.next();if(this.contains(V)){T(V);W=true}}return true};this.retainAll=function(Y){var W=this.iterator();var V=[];while(W.hasNext()){var X=W.next();if(!Y.contains(X)){V.push(X)}}for(var U=0;U0};this.size=function(){return H.size()};this.toArray=function(){var U=[];var V=this.iterator();while(V.hasNext()){U.push(V.next())}return U}}function M(R){this._isIn=function(S){return S===H&&R.removed===c};this.equals=function(S){return t(R.key,S.getKey())};this.getKey=function(){return R.key};this.getValue=function(){return R.value};this.hashCode=function(S){return a(R.key)};this.setValue=function(T){var S=R.value;R.value=T;return S}}this.clear=function(){L=0;J=[];J.length=P};this.clone=function(){var R=new G;R.putAll(this);return R};this.containsKey=function(T){var R=N(T);var U=J[R];if(U===c){return false}for(var S=0;S1){V.splice(S,1)}else{J[R]=c}return U}}return null};this.removeByValue=function(T){var V,S,R,U;for(V in J){if(J.hasOwnProperty(V)){for(S=0,R=J[V].length;S0){this.div(J)}},limit:function(J){if(this.mag()>J){this.normalize();this.mult(J)}},heading2D:function(){return -o.atan2(-this.y,this.x)},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};function H(J){return function(M,L){var K=M.get();K[J](L);return K}}for(var I in G.prototype){if(G.prototype.hasOwnProperty(I)&&!G.hasOwnProperty(I)){G[I]=H(I)}}return G}();function A(){}A.prototype=j;var b=new A;b.ArrayList=n;b.HashMap=C;b.PVector=k;b.ObjectIterator=e;b.PConstants=j;b.defineProperty=function(H,G,I){if("defineProperty" in Object){Object.defineProperty(H,G,I)}else{if(I.hasOwnProperty("get")){H.__defineGetter__(G,I.get)}if(I.hasOwnProperty("set")){H.__defineSetter__(G,I.set)}}};function x(J,I){function K(L){b.defineProperty(J,L,{get:function(){return I[L]},set:function(M){I[L]=M},enumerable:true})}var H=[];for(var G in I){if(typeof I[G]==="function"){if(!J.hasOwnProperty(G)){J[G]=I[G]}}else{if(G.charAt(0)!=="$"&&!(G in J)){H.push(G)}}}while(H.length>0){K(H.shift())}}b.extendClassChain=function(H){var I=[H];for(var G=H.$upcast;G;G=G.$upcast){x(G,H);I.push(G);H=G}while(I.length>0){I.pop().$self=H}};b.extendStaticMembers=function(G,H){x(G,H)};b.extendInterfaceMembers=function(G,H){x(G,H)};b.addMethod=function(J,I,L,K){if(J[I]){var H=L.length,G=J[I];J[I]=function(){if(arguments.length===H){return L.apply(this,arguments)}return G.apply(this,arguments)}}else{J[I]=L}};b.createJavaArray=function(K,L){var H=null;if(typeof L[0]==="number"){var G=0|L[0];if(L.length<=1){H=[];H.length=G;for(var J=0;J"+V;u.body.appendChild(M);var N=G.width,U=G.height,O=U/2;R.fillStyle="white";R.fillRect(0,0,N,U);R.fillStyle="black";R.fillText(V,0,O);var I=R.getImageData(0,0,N,U).data;var S=0,L=N*4,T=I.length;while(++S0&&I[S]===255){h()}var W=o.round(S/L);Q.ascent=X*(O-K);Q.descent=X*(W-O);if(u.defaultView.getComputedStyle){var H=u.defaultView.getComputedStyle(M,null).getPropertyValue("height");H=X*H.replace("px","");if(H>=Q.size*2){Q.leading=o.round(H/2)}}u.body.removeChild(M)}function f(G,H){if(G===c){G=""}this.name=G;if(H===c){H=0}this.size=H;this.glyph=false;this.ascent=0;this.descent=0;this.leading=1.2*H;var K=G.indexOf(" Italic Bold");if(K!==-1){G=G.substring(0,K)}this.style="normal";var J=G.indexOf(" Italic");if(J!==-1){G=G.substring(0,J);this.style="italic"}this.weight="normal";var I=G.indexOf(" Bold");if(I!==-1){G=G.substring(0,I);this.weight="bold"}this.family="sans-serif";if(G!==c){switch(G){case"sans-serif":case"serif":case"monospace":case"fantasy":case"cursive":this.family=G;break;default:this.family='"'+G+'", sans-serif';break}}this.context2d=null;y(this);this.css=this.getCSSDefinition();this.context2d.font=this.css}f.prototype.getCSSDefinition=function(I,G){if(I===c){I=this.size+"px"}if(G===c){G=this.leading+"px"}var H=[this.style,"normal",this.weight,I+"/"+G,this.family];return H.join(" ")};f.prototype.measureTextWidth=function(G){return this.context2d.measureText(G).width};f.PFontCache={};f.get=function(I,J){var H=f.PFontCache;var G=I+"/"+J;if(!H[G]){H[G]=new f(I,J)}return H[G]};f.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]};f.preloading={template:{},initialized:false,initialize:function(){var I=function(){var K="#E3KAI2wAgT1MvMg7Eo3VmNtYX7ABi3CxnbHlm7Abw3kaGVhZ7ACs3OGhoZWE7A53CRobXR47AY3AGbG9jYQ7G03Bm1heH7ABC3CBuYW1l7Ae3AgcG9zd7AI3AE#B3AQ2kgTY18PPPUACwAg3ALSRoo3#yld0xg32QAB77#E777773B#E3C#I#Q77773E#Q7777777772CMAIw7AB77732B#M#Q3wAB#g3B#E#E2BB//82BB////w#B7#gAEg3E77x2B32B#E#Q#MTcBAQ32gAe#M#QQJ#E32M#QQJ#I#g32Q77#";var J=function(L){return"AAAAAAAA".substr(~~L?7-L:6)};return K.replace(/[#237]/g,J)};var G=u.createElement("style");G.setAttribute("type","text/css");G.innerHTML='@font-face {\n font-family: "PjsEmptyFont";\n src: url(\'data:application/x-font-ttf;base64,'+I()+"')\n format('truetype');\n}";u.head.appendChild(G);var H=u.createElement("span");H.style.cssText='position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;';H.innerHTML="AAAAAAAA";u.body.appendChild(H);this.template=H;this.initialized=true},getElementWidth:function(G){return u.defaultView.getComputedStyle(G,"").getPropertyValue("width")},timeAttempted:0,pending:function(K){if(!this.initialized){this.initialize()}var I,G,J=this.getElementWidth(this.template);for(var H=0;H 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 );}";var bC="#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)) * frontColor; } else{ gl_FragColor = frontColor; }}";function dT(d4,d3,d6,d5){var d2=du.locations[d4];if(d2===c){d2=dZ.getUniformLocation(d3,d6);du.locations[d4]=d2}if(d2!==null){if(d5.length===4){dZ.uniform4fv(d2,d5)}else{if(d5.length===3){dZ.uniform3fv(d2,d5)}else{if(d5.length===2){dZ.uniform2fv(d2,d5)}else{dZ.uniform1f(d2,d5)}}}}}function dQ(d4,d3,d6,d5){var d2=du.locations[d4];if(d2===c){d2=dZ.getUniformLocation(d3,d6);du.locations[d4]=d2}if(d2!==null){if(d5.length===4){dZ.uniform4iv(d2,d5)}else{if(d5.length===3){dZ.uniform3iv(d2,d5)}else{if(d5.length===2){dZ.uniform2iv(d2,d5)}else{dZ.uniform1i(d2,d5)}}}}}function a0(d6,d4,d7,d5,d3){var d2=du.locations[d6];if(d2===c){d2=dZ.getUniformLocation(d4,d7);du.locations[d6]=d2}if(d2!==-1){if(d3.length===16){dZ.uniformMatrix4fv(d2,d5,d3)}else{if(d3.length===9){dZ.uniformMatrix3fv(d2,d5,d3)}else{dZ.uniformMatrix2fv(d2,d5,d3)}}}}function c6(d6,d4,d7,d3,d5){var d2=du.attributes[d6];if(d2===c){d2=dZ.getAttribLocation(d4,d7);du.attributes[d6]=d2}if(d2!==-1){dZ.bindBuffer(dZ.ARRAY_BUFFER,d5);dZ.vertexAttribPointer(d2,d3,dZ.FLOAT,false,0,0);dZ.enableVertexAttribArray(d2)}}function ca(d4,d3,d5){var d2=du.attributes[d4];if(d2===c){d2=dZ.getAttribLocation(d3,d5);du.attributes[d4]=d2}if(d2!==-1){dZ.disableVertexAttribArray(d2)}}var bx=function(d4,d6,d3){var d7=d4.createShader(d4.VERTEX_SHADER);d4.shaderSource(d7,d6);d4.compileShader(d7);if(!d4.getShaderParameter(d7,d4.COMPILE_STATUS)){throw d4.getShaderInfoLog(d7)}var d5=d4.createShader(d4.FRAGMENT_SHADER);d4.shaderSource(d5,d3);d4.compileShader(d5);if(!d4.getShaderParameter(d5,d4.COMPILE_STATUS)){throw d4.getShaderInfoLog(d5)}var d2=d4.createProgram();d4.attachShader(d2,d7);d4.attachShader(d2,d5);d4.linkProgram(d2);if(!d4.getProgramParameter(d2,d4.LINK_STATUS)){throw"Error linking shaders."}return d2};var aQ=function(d2,d6,d3,d5,d4){return{x:d2,y:d6,w:d3,h:d5}};var bc=aQ;var bV=function(d2,d6,d3,d5,d4){return{x:d2,y:d6,w:d4?d3:d3-d2,h:d4?d5:d5-d6}};var aG=function(d2,d6,d3,d5,d4){return{x:d2-d3/2,y:d6-d5/2,w:d3,h:d5}};var dj=function(){};var bJ=function(){};var bt=function(){};var b4=function(){};bJ.prototype=new dj;bJ.prototype.constructor=bJ;bt.prototype=new dj;bt.prototype.constructor=bt;b4.prototype=new dj;b4.prototype.constructor=b4;dj.prototype.a3DOnlyFunction=h;var cf={};var bI=cQ.Character=function(d2){if(typeof d2==="string"&&d2.length===1){this.code=d2.charCodeAt(0)}else{if(typeof d2==="number"){this.code=d2}else{if(d2 instanceof bI){this.code=d2}else{this.code=NaN}}}return cf[this.code]===c?cf[this.code]=this:cf[this.code]};bI.prototype.toString=function(){return String.fromCharCode(this.code)};bI.prototype.valueOf=function(){return this.code};var H=cQ.PShape=function(d2){this.family=d2||0;this.visible=true;this.style=true;this.children=[];this.nameTable=[];this.params=[];this.name="";this.image=null;this.matrix=null;this.kind=null;this.close=null;this.width=null;this.height=null;this.parent=null};H.prototype={isVisible:function(){return this.visible},setVisible:function(d2){this.visible=d2},disableStyle:function(){this.style=false;for(var d3=0,d2=this.children.length;d30){for(d3=0,d2=this.nameTable.length;d3, it's <"+this.element.getName()+">"}}else{if(arguments.length===2){if(typeof arguments[1]==="string"){if(arguments[1].indexOf(".svg")>-1){this.element=new cQ.XMLElement(null,arguments[1]);this.vertexCodes=[];this.vertices=[];this.opacity=1;this.stroke=false;this.strokeColor=4278190080;this.strokeWeight=1;this.strokeCap="butt";this.strokeJoin="miter";this.strokeGradient="";this.strokeGradientPaint="";this.strokeName="";this.strokeOpacity=1;this.fill=true;this.fillColor=4278190080;this.fillGradient=null;this.fillGradientPaint=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");var d2=this.element.getStringAttribute("display","inline");this.visible=d2!=="none";var d7=this.element.getAttribute("transform");if(d7){this.matrix=this.parseMatrix(d7)}var d4=this.element.getStringAttribute("viewBox");if(d4!==null){var d6=d4.split(" ");this.width=d6[2];this.height=d6[3]}var d3=this.element.getStringAttribute("width");var d5=this.element.getStringAttribute("height");if(d3!==null){this.width=this.parseUnitSize(d3);this.height=this.parseUnitSize(d5)}else{if(this.width===0||this.height===0){this.width=1;this.height=1;throw"The width and/or height is not readable in the tag of this file."}}this.parseColors(this.element);this.parseChildren(this.element)};cl.prototype=new H;cl.prototype.parseMatrix=function(){function d2(d4){var d3=[];d4.replace(/\((.*?)\)/,function(){return function(d5,d6){d3=d6.replace(/,+/g," ").split(/\s+/)}}());return d3}return function(ea){this.checkMatrix(2);var d3=[];ea.replace(/\s*(\w+)\((.*?)\)/g,function(ed){d3.push(cQ.trim(ed))});if(d3.length===0){return null}for(var d8=0,d6=d3.length;d8=65&&el<=90||el>=97&&el<=122){em=ep;ep++;if(ep=65&&el<=90||el>=97&&el<=100||el>=102&&el<=122)&&eo===false){if(el===32){if(ej!==""){en.push(parseFloat(ej));ej=""}ep++}else{if(el===45){if(eq[ep-1].valueOf()===101){ej+=eq[ep].toString();ep++}else{if(ej!==""){en.push(parseFloat(ej))}ej=eq[ep].toString();ep++}}else{ej+=eq[ep].toString();ep++}}if(ep===eq.length){eo=true}else{el=eq[ep].valueOf()}}}if(ej!==""){en.push(parseFloat(ej));ej=""}d6=eq[em];el=d6.valueOf();if(el===77){if(en.length>=2&&en.length%2===0){d5=en[0];d4=en[1];this.parsePathMoveto(d5,d4);if(en.length>2){for(em=2,ek=en.length;em=2&&en.length%2===0){d5+=en[0];d4+=en[1];this.parsePathMoveto(d5,d4);if(en.length>2){for(em=2,ek=en.length;em=2&&en.length%2===0){for(em=0,ek=en.length;em=2&&en.length%2===0){for(em=0,ek=en.length;em=6&&en.length%6===0){for(em=0,ek=en.length;em=6&&en.length%6===0){for(em=0,ek=en.length;em=4&&en.length%4===0){for(em=0,ek=en.length;em=4&&en.length%4===0){for(em=0,ek=en.length;em=4&&en.length%4===0){for(em=0,ek=en.length;em=4&&en.length%4===0){for(em=0,ek=en.length;em=2&&en.length%2===0){for(em=0,ek=en.length;em=2&&en.length%2===0){for(em=0,ek=en.length;em0){this.parsePathCode(1);this.parsePathVertex(d4+(d2-d4)*2/3,d6+(d7-d6)*2/3);this.parsePathVertex(d3+(d2-d3)*2/3,d5+(d7-d5)*2/3);this.parsePathVertex(d3,d5)}else{throw"Path must start with M/m"}};cl.prototype.parsePathCurveto=function(d5,d7,d3,d6,d2,d4){if(this.vertices.length>0){this.parsePathCode(1);this.parsePathVertex(d5,d7);this.parsePathVertex(d3,d6);this.parsePathVertex(d2,d4)}else{throw"Path must start with M/m"}};cl.prototype.parsePathLineto=function(d3,d2){if(this.vertices.length>0){this.parsePathCode(0);this.parsePathVertex(d3,d2);this.vertices[this.vertices.length-1]["moveTo"]=false}else{throw"Path must start with M/m"}};cl.prototype.parsePathMoveto=function(d3,d2){if(this.vertices.length>0){this.parsePathCode(3)}this.parsePathCode(0);this.parsePathVertex(d3,d2);this.vertices[this.vertices.length-1]["moveTo"]=true};cl.prototype.parsePathVertex=function(d2,d4){var d3=[];d3[0]=d2;d3[1]=d4;this.vertices.push(d3)};cl.prototype.parsePathCode=function(d2){this.vertexCodes.push(d2)};cl.prototype.parsePoly=function(d6){this.family=21;this.close=d6;var d3=cQ.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(d3!==null){var d2=d3.split(" ");if(d2.length%2===0){for(var d5=0,d4=d2.length;d5"}};cl.prototype.parseEllipse=function(d4){this.kind=31;this.family=1;this.params=[];this.params[0]=this.element.getFloatAttribute("cx")|0;this.params[1]=this.element.getFloatAttribute("cy")|0;var d3,d2;if(d4){d3=d2=this.element.getFloatAttribute("r");if(d3<0){throw"svg error: negative radius found while parsing "}}else{d3=this.element.getFloatAttribute("rx");d2=this.element.getFloatAttribute("ry");if(d3<0||d2<0){throw"svg error: negative x-axis radius or y-axis radius found while parsing "}}this.params[0]-=d3;this.params[1]-=d2;this.params[2]=d3*2;this.params[3]=d2*2};cl.prototype.parseLine=function(){this.kind=4;this.family=1;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")};cl.prototype.parseColors=function(d4){if(d4.hasAttribute("opacity")){this.setOpacity(d4.getAttribute("opacity"))}if(d4.hasAttribute("stroke")){this.setStroke(d4.getAttribute("stroke"))}if(d4.hasAttribute("stroke-width")){this.setStrokeWeight(d4.getAttribute("stroke-width"))}if(d4.hasAttribute("stroke-linejoin")){this.setStrokeJoin(d4.getAttribute("stroke-linejoin"))}if(d4.hasAttribute("stroke-linecap")){this.setStrokeCap(d4.getStringAttribute("stroke-linecap"))}if(d4.hasAttribute("fill")){this.setFill(d4.getStringAttribute("fill"))}if(d4.hasAttribute("style")){var d7=d4.getStringAttribute("style");var d5=d7.toString().split(";");for(var d3=0,d2=d5.length;d3=1&&arguments[0]!==null){if(d4.isVisible()){cQ.pushMatrix();if(L===3){if(arguments.length===5){cQ.translate(d3-d5/2,d6-d2/2);cQ.scale(d5/d4.getWidth(),d2/d4.getHeight())}else{if(arguments.length===3){cQ.translate(d3-d4.getWidth()/2,-d4.getHeight()/2)}else{cQ.translate(-d4.getWidth()/2,-d4.getHeight()/2)}}}else{if(L===0){if(arguments.length===5){cQ.translate(d3,d6);cQ.scale(d5/d4.getWidth(),d2/d4.getHeight())}else{if(arguments.length===3){cQ.translate(d3,d6)}}}else{if(L===1){if(arguments.length===5){d5-=d3;d2-=d6;cQ.translate(d3,d6);cQ.scale(d5/d4.getWidth(),d2/d4.getHeight())}else{if(arguments.length===3){cQ.translate(d3,d6)}}}}}d4.draw();if(arguments.length===1&&L===3||arguments.length>1){cQ.popMatrix()}}}};cQ.shapeMode=function(d2){L=d2};cQ.loadShape=function(d2){if(arguments.length===1){if(d2.indexOf(".svg")>-1){return new cl(null,d2)}}return null};var cN=function(d6,d5,d2,d3,d4){this.fullName=d6||"";this.name=d5||"";this.namespace=d2||"";this.value=d3;this.type=d4};cN.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(d2){this.value=d2}};var b3=cQ.XMLElement=function(){this.attributes=[];this.children=[];this.fullName=null;this.name=null;this.namespace="";this.content=null;this.parent=null;this.lineNr="";this.systemID="";this.type="ELEMENT";if(arguments.length===4){this.fullName=arguments[0]||"";if(arguments[1]){this.name=arguments[1]}else{var d2=this.fullName.indexOf(":");if(d2>=0){this.name=this.fullName.substring(d2+1)}else{this.name=this.fullName}}this.namespace=arguments[1];this.lineNr=arguments[3];this.systemID=arguments[2]}else{if(arguments.length===2&&arguments[1].indexOf(".")>-1){this.parse(arguments[arguments.length-1])}else{if(arguments.length===1&&typeof arguments[0]==="string"){this.parse(arguments[0])}}}};b3.prototype={parse:function(d2){var d4;try{var d6=d2.substring(d2.length-4);if(d6===".xml"||d6===".svg"){d2=r(d2)}d4=(new DOMParser).parseFromString(d2,"text/xml");var d3=d4.documentElement;if(d3){this.parseChildrenRecursive(null,d3)}else{throw"Error loading document"}return this}catch(d5){throw d5}},parseChildrenRecursive:function(ea,d8){var d7,d3,d9,d6,d5,d2;if(!ea){this.fullName=d8.localName;this.name=d8.nodeName;d7=this}else{d7=new b3(d8.localName,d8.nodeName,"","");d7.parent=ea}if(d8.nodeType===3&&d8.textContent!==""){return this.createPCDataElement(d8.textContent)}for(d6=0,d5=d8.attributes.length;d60){var d6,d5;for(d4=0,d3=this.children.length;d40},addChild:function(d2){if(d2!==null){d2.parent=this;this.children.push(d2)}},insertChild:function(d4,d2){if(d4){if(d4.getLocalName()===null&&!this.hasChildren()){var d3=this.children[this.children.length-1];if(d3.getLocalName()===null){d3.setContent(d3.getContent()+d4.getContent());return}}d4.parent=this;this.children.splice(d2,0,d4)}},getChild:function(){if(typeof arguments[0]==="number"){return this.children[arguments[0]]}if(arguments[0].indexOf("/")!==-1){this.getChildRecursive(arguments[0].split("/"),0);return null}var d2,d5;for(var d4=0,d3=this.getChildCount();d4d2){this.children.splice(d2,1)}},findAttribute:function(d3,d5){this.namespace=d5||"";for(var d4=0,d2=this.attributes.length;d40){B.debug("Tried to set content for XMLElement with children")}this.content=d2},setName:function(){if(arguments.length===1){this.name=arguments[0];this.fullName=arguments[0];this.namespace=null}else{var d2=arguments[0].indexOf(":");if(arguments[1]===null||d2<0){this.name=arguments[0]}else{this.name=arguments[0].substring(d2+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 d4=(this.namespace!==""&&this.namespace!==this.name?this.namespace+":":"")+this.name;var d5="<"+d4;var d3,d6;for(d3=0;d3"}else{d5+=">"+this.content+""}}else{d5+=">";for(d6=0;d6"}return d5}};b3.parse=function(d3){var d2=new b3;d2.parse(d3);return d2};var cg=function(d5){var d2=0;for(var d3=0;d3-2147483648){var d3=this.elements[0];var d8=this.elements[1];var d6=this.elements[2];var d5=this.elements[3];var d4=this.elements[4];var d2=this.elements[5];this.elements[0]=d4/d7;this.elements[3]=-d5/d7;this.elements[1]=-d8/d7;this.elements[4]=d3/d7;this.elements[2]=(d8*d2-d4*d6)/d7;this.elements[5]=(d5*d6-d3*d2)/d7;return true}return false},scale:function(d3,d2){if(d3&&!d2){d2=d3}if(d3&&d2){this.elements[0]*=d3;this.elements[1]*=d2;this.elements[3]*=d3;this.elements[4]*=d2}},invScale:function(d3,d2){if(d3&&!d2){d2=d3}this.scale(1/d3,1/d2)},apply:function(){var d4;if(arguments.length===1&&arguments[0] instanceof aO){d4=arguments[0].array()}else{if(arguments.length===6){d4=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d4=arguments[0]}}}var d2=[0,0,this.elements[2],0,0,this.elements[5]];var d5=0;for(var d6=0;d6<2;d6++){for(var d3=0;d3<3;d3++,d5++){d2[d5]+=this.elements[d6*3+0]*d4[d3+0]+this.elements[d6*3+1]*d4[d3+3]}}this.elements=d2.slice()},preApply:function(){var d3;if(arguments.length===1&&arguments[0] instanceof aO){d3=arguments[0].array()}else{if(arguments.length===6){d3=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d3=arguments[0]}}}var d2=[0,0,d3[2],0,0,d3[5]];d2[2]=d3[2]+this.elements[2]*d3[0]+this.elements[5]*d3[1];d2[5]=d3[5]+this.elements[2]*d3[3]+this.elements[5]*d3[4];d2[0]=this.elements[0]*d3[0]+this.elements[3]*d3[1];d2[3]=this.elements[0]*d3[3]+this.elements[3]*d3[4];d2[1]=this.elements[1]*d3[0]+this.elements[4]*d3[1];d2[4]=this.elements[1]*d3[3]+this.elements[4]*d3[4];this.elements=d2.slice()},rotate:function(d4){var d6=o.cos(d4);var d2=o.sin(d4);var d5=this.elements[0];var d3=this.elements[1];this.elements[0]=d6*d5+d2*d3;this.elements[1]=-d2*d5+d6*d3;d5=this.elements[3];d3=this.elements[4];this.elements[3]=d6*d5+d2*d3;this.elements[4]=-d2*d5+d6*d3},rotateZ:function(d2){this.rotate(d2)},invRotateZ:function(d2){this.rotateZ(d2-o.PI)},print:function(){var d3=cg(this.elements);var d2=""+cQ.nfs(this.elements[0],d3,4)+" "+cQ.nfs(this.elements[1],d3,4)+" "+cQ.nfs(this.elements[2],d3,4)+"\n"+cQ.nfs(this.elements[3],d3,4)+" "+cQ.nfs(this.elements[4],d3,4)+" "+cQ.nfs(this.elements[5],d3,4)+"\n\n";cQ.println(d2)}};var aH=cQ.PMatrix3D=function(){this.reset()};aH.prototype={set:function(){if(arguments.length===16){this.elements=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof aH){this.elements=arguments[0].array()}else{if(arguments.length===1&&arguments[0] instanceof Array){this.elements=arguments[0].slice()}}}},get:function(){var d2=new aH;d2.set(this.elements);return d2},reset:function(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},array:function ay(){return this.elements.slice()},translate:function(d3,d2,d4){if(d4===c){d4=0}this.elements[3]+=d3*this.elements[0]+d2*this.elements[1]+d4*this.elements[2];this.elements[7]+=d3*this.elements[4]+d2*this.elements[5]+d4*this.elements[6];this.elements[11]+=d3*this.elements[8]+d2*this.elements[9]+d4*this.elements[10];this.elements[15]+=d3*this.elements[12]+d2*this.elements[13]+d4*this.elements[14]},transpose:function(){var d2=this.elements[4];this.elements[4]=this.elements[1];this.elements[1]=d2;d2=this.elements[8];this.elements[8]=this.elements[2];this.elements[2]=d2;d2=this.elements[6];this.elements[6]=this.elements[9];this.elements[9]=d2;d2=this.elements[3];this.elements[3]=this.elements[12];this.elements[12]=d2;d2=this.elements[7];this.elements[7]=this.elements[13];this.elements[13]=d2;d2=this.elements[11];this.elements[11]=this.elements[14];this.elements[14]=d2},mult:function(d4,d5){var d2,d7,d6,d3;if(d4 instanceof k){d2=d4.x;d7=d4.y;d6=d4.z;d3=1;if(!d5){d5=new k}}else{if(d4 instanceof Array){d2=d4[0];d7=d4[1];d6=d4[2];d3=d4[3]||1;if(!d5||d5.length!==3&&d5.length!==4){d5=[0,0,0]}}}if(d5 instanceof Array){if(d5.length===3){d5[0]=this.elements[0]*d2+this.elements[1]*d7+this.elements[2]*d6+this.elements[3];d5[1]=this.elements[4]*d2+this.elements[5]*d7+this.elements[6]*d6+this.elements[7];d5[2]=this.elements[8]*d2+this.elements[9]*d7+this.elements[10]*d6+this.elements[11]}else{if(d5.length===4){d5[0]=this.elements[0]*d2+this.elements[1]*d7+this.elements[2]*d6+this.elements[3]*d3;d5[1]=this.elements[4]*d2+this.elements[5]*d7+this.elements[6]*d6+this.elements[7]*d3;d5[2]=this.elements[8]*d2+this.elements[9]*d7+this.elements[10]*d6+this.elements[11]*d3;d5[3]=this.elements[12]*d2+this.elements[13]*d7+this.elements[14]*d6+this.elements[15]*d3}}}if(d5 instanceof k){d5.x=this.elements[0]*d2+this.elements[1]*d7+this.elements[2]*d6+this.elements[3];d5.y=this.elements[4]*d2+this.elements[5]*d7+this.elements[6]*d6+this.elements[7];d5.z=this.elements[8]*d2+this.elements[9]*d7+this.elements[10]*d6+this.elements[11]}return d5},preApply:function(){var d4;if(arguments.length===1&&arguments[0] instanceof aH){d4=arguments[0].array()}else{if(arguments.length===16){d4=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d4=arguments[0]}}}var d2=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var d5=0;for(var d6=0;d6<4;d6++){for(var d3=0;d3<4;d3++,d5++){d2[d5]+=this.elements[d3+0]*d4[d6*4+0]+this.elements[d3+4]*d4[d6*4+1]+this.elements[d3+8]*d4[d6*4+2]+this.elements[d3+12]*d4[d6*4+3]}}this.elements=d2.slice()},apply:function(){var d4;if(arguments.length===1&&arguments[0] instanceof aH){d4=arguments[0].array()}else{if(arguments.length===16){d4=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){d4=arguments[0]}}}var d2=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var d5=0;for(var d6=0;d6<4;d6++){for(var d3=0;d3<4;d3++,d5++){d2[d5]+=this.elements[d6*4+0]*d4[d3+0]+this.elements[d6*4+1]*d4[d3+4]+this.elements[d6*4+2]*d4[d3+8]+this.elements[d6*4+3]*d4[d3+12]}}this.elements=d2.slice()},rotate:function(d6,d2,d8,d5){if(!d8){this.rotateZ(d6)}else{var d7=cQ.cos(d6);var d4=cQ.sin(d6);var d3=1-d7;this.apply(d3*d2*d2+d7,d3*d2*d8-d4*d5,d3*d2*d5+d4*d8,0,d3*d2*d8+d4*d5,d3*d8*d8+d7,d3*d8*d5-d4*d2,0,d3*d2*d5-d4*d8,d3*d8*d5+d4*d2,d3*d5*d5+d7,0,0,0,0,1)}},invApply:function(){if(U===c){U=new aH}var d2=arguments;U.set(d2[0],d2[1],d2[2],d2[3],d2[4],d2[5],d2[6],d2[7],d2[8],d2[9],d2[10],d2[11],d2[12],d2[13],d2[14],d2[15]);if(!U.invert()){return false}this.preApply(U);return true},rotateX:function(d3){var d4=cQ.cos(d3);var d2=cQ.sin(d3);this.apply([1,0,0,0,0,d4,-d2,0,0,d2,d4,0,0,0,0,1])},rotateY:function(d3){var d4=cQ.cos(d3);var d2=cQ.sin(d3);this.apply([d4,0,d2,0,0,1,0,0,-d2,0,d4,0,0,0,0,1])},rotateZ:function(d3){var d4=o.cos(d3);var d2=o.sin(d3);this.apply([d4,-d2,0,0,d2,d4,0,0,0,0,1,0,0,0,0,1])},scale:function(d4,d3,d2){if(d4&&!d3&&!d2){d3=d2=d4}else{if(d4&&d3&&!d2){d2=1}}if(d4&&d3&&d2){this.elements[0]*=d4;this.elements[1]*=d3;this.elements[2]*=d2;this.elements[4]*=d4;this.elements[5]*=d3;this.elements[6]*=d2;this.elements[8]*=d4;this.elements[9]*=d3;this.elements[10]*=d2;this.elements[12]*=d4;this.elements[13]*=d3;this.elements[14]*=d2}},skewX:function(d3){var d2=o.tan(d3);this.apply(1,d2,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},skewY:function(d3){var d2=o.tan(d3);this.apply(1,0,0,0,d2,1,0,0,0,0,1,0,0,0,0,1)},multX:function(d2,d5,d4,d3){if(!d4){return this.elements[0]*d2+this.elements[1]*d5+this.elements[3]}if(!d3){return this.elements[0]*d2+this.elements[1]*d5+this.elements[2]*d4+this.elements[3]}return this.elements[0]*d2+this.elements[1]*d5+this.elements[2]*d4+this.elements[3]*d3},multY:function(d2,d5,d4,d3){if(!d4){return this.elements[4]*d2+this.elements[5]*d5+this.elements[7]}if(!d3){return this.elements[4]*d2+this.elements[5]*d5+this.elements[6]*d4+this.elements[7]}return this.elements[4]*d2+this.elements[5]*d5+this.elements[6]*d4+this.elements[7]*d3},multZ:function(d2,d5,d4,d3){if(!d3){return this.elements[8]*d2+this.elements[9]*d5+this.elements[10]*d4+this.elements[11]}return this.elements[8]*d2+this.elements[9]*d5+this.elements[10]*d4+this.elements[11]*d3},multW:function(d2,d5,d4,d3){if(!d3){return this.elements[12]*d2+this.elements[13]*d5+this.elements[14]*d4+this.elements[15]}return this.elements[12]*d2+this.elements[13]*d5+this.elements[14]*d4+this.elements[15]*d3},invert:function(){var eb=this.elements[0]*this.elements[5]-this.elements[1]*this.elements[4];var ea=this.elements[0]*this.elements[6]-this.elements[2]*this.elements[4];var d9=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4];var d8=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5];var d7=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5];var d6=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6];var d5=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12];var d4=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12];var d3=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12];var eg=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13];var ee=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13];var ed=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14];var ef=eb*ed-ea*ee+d9*eg+d8*d3-d7*d4+d6*d5;if(o.abs(ef)<=1e-9){return false}var ec=[];ec[0]=+this.elements[5]*ed-this.elements[6]*ee+this.elements[7]*eg;ec[4]=-this.elements[4]*ed+this.elements[6]*d3-this.elements[7]*d4;ec[8]=+this.elements[4]*ee-this.elements[5]*d3+this.elements[7]*d5;ec[12]=-this.elements[4]*eg+this.elements[5]*d4-this.elements[6]*d5;ec[1]=-this.elements[1]*ed+this.elements[2]*ee-this.elements[3]*eg;ec[5]=+this.elements[0]*ed-this.elements[2]*d3+this.elements[3]*d4;ec[9]=-this.elements[0]*ee+this.elements[1]*d3-this.elements[3]*d5;ec[13]=+this.elements[0]*eg-this.elements[1]*d4+this.elements[2]*d5;ec[2]=+this.elements[13]*d6-this.elements[14]*d7+this.elements[15]*d8;ec[6]=-this.elements[12]*d6+this.elements[14]*d9-this.elements[15]*ea;ec[10]=+this.elements[12]*d7-this.elements[13]*d9+this.elements[15]*eb;ec[14]=-this.elements[12]*d8+this.elements[13]*ea-this.elements[14]*eb;ec[3]=-this.elements[9]*d6+this.elements[10]*d7-this.elements[11]*d8;ec[7]=+this.elements[8]*d6-this.elements[10]*d9+this.elements[11]*ea;ec[11]=-this.elements[8]*d7+this.elements[9]*d9-this.elements[11]*eb;ec[15]=+this.elements[8]*d8-this.elements[9]*ea+this.elements[10]*eb;var d2=1/ef;ec[0]*=d2;ec[1]*=d2;ec[2]*=d2;ec[3]*=d2;ec[4]*=d2;ec[5]*=d2;ec[6]*=d2;ec[7]*=d2;ec[8]*=d2;ec[9]*=d2;ec[10]*=d2;ec[11]*=d2;ec[12]*=d2;ec[13]*=d2;ec[14]*=d2;ec[15]*=d2;this.elements=ec.slice();return true},toString:function(){var d3="";for(var d2=0;d2<15;d2++){d3+=this.elements[d2]+", "}d3+=this.elements[15];return d3},print:function(){var d3=cg(this.elements);var d2=""+cQ.nfs(this.elements[0],d3,4)+" "+cQ.nfs(this.elements[1],d3,4)+" "+cQ.nfs(this.elements[2],d3,4)+" "+cQ.nfs(this.elements[3],d3,4)+"\n"+cQ.nfs(this.elements[4],d3,4)+" "+cQ.nfs(this.elements[5],d3,4)+" "+cQ.nfs(this.elements[6],d3,4)+" "+cQ.nfs(this.elements[7],d3,4)+"\n"+cQ.nfs(this.elements[8],d3,4)+" "+cQ.nfs(this.elements[9],d3,4)+" "+cQ.nfs(this.elements[10],d3,4)+" "+cQ.nfs(this.elements[11],d3,4)+"\n"+cQ.nfs(this.elements[12],d3,4)+" "+cQ.nfs(this.elements[13],d3,4)+" "+cQ.nfs(this.elements[14],d3,4)+" "+cQ.nfs(this.elements[15],d3,4)+"\n\n";cQ.println(d2)},invTranslate:function(d3,d2,d4){this.preApply(1,0,0,-d3,0,1,0,-d2,0,0,1,-d4,0,0,0,1)},invRotateX:function(d3){var d4=o.cos(-d3);var d2=o.sin(-d3);this.preApply([1,0,0,0,0,d4,-d2,0,0,d2,d4,0,0,0,0,1])},invRotateY:function(d3){var d4=o.cos(-d3);var d2=o.sin(-d3);this.preApply([d4,0,d2,0,0,1,0,0,-d2,0,d4,0,0,0,0,1])},invRotateZ:function(d3){var d4=o.cos(-d3);var d2=o.sin(-d3);this.preApply([d4,-d2,0,0,d2,d4,0,0,0,0,1,0,0,0,0,1])},invScale:function(d2,d4,d3){this.preApply([1/d2,0,0,0,0,1/d4,0,0,0,0,1/d3,0,0,0,0,1])}};var O=cQ.PMatrixStack=function(){this.matrixStack=[]};O.prototype.load=function(){var d2=dP.$newPMatrix();if(arguments.length===1){d2.set(arguments[0])}else{d2.set(arguments)}this.matrixStack.push(d2)};bJ.prototype.$newPMatrix=function(){return new aO};bt.prototype.$newPMatrix=function(){return new aH};O.prototype.push=function(){this.matrixStack.push(this.peek())};O.prototype.pop=function(){return this.matrixStack.pop()};O.prototype.peek=function(){var d2=dP.$newPMatrix();d2.set(this.matrixStack[this.matrixStack.length-1]);return d2};O.prototype.mult=function(d2){this.matrixStack[this.matrixStack.length-1].apply(d2)};cQ.split=function(d3,d2){return d3.split(d2)};cQ.splitTokens=function(d5,d4){if(arguments.length===1){d4="\n\t\r\u000c "}d4="["+d4+"]";var d3=[];var d2=0;var d6=d5.search(d4);while(d6>=0){if(d6===0){d5=d5.substring(1)}else{d3[d2]=d5.substring(0,d6);d2++;d5=d5.substring(d6)}d6=d5.search(d4)}if(d5.length>0){d3[d2]=d5}if(d3.length===0){d3=c}return d3};cQ.append=function(d3,d2){d3[d3.length]=d2;return d3};cQ.concat=function(d3,d2){return d3.concat(d2)};cQ.sort=function(d7,d5){var d3=[];if(d7.length>0){var d6=d5>0?d5:d7.length;for(var d4=0;d40){for(var d2=d3.length;d2>8)};cQ.peg=function(d2){return d2<0?0:d2>255?255:d2};cQ.modes=function(){var d7=4278190080,d4=16711680,d3=65280,d6=255,d5=o.min,d2=o.max;function d8(ed,eg,ec,el,en,em,ee,ei,eh,ea,eb){var ek=d5(((ed&4278190080)>>>24)+eg,255)<<24;var d9=ec+((eh-ec)*eg>>8);d9=(d9<0?0:d9>255?255:d9)<<16;var ef=el+((ea-el)*eg>>8);ef=(ef<0?0:ef>255?255:ef)<<8;var ej=en+((eb-en)*eg>>8);ej=ej<0?0:ej>255?255:ej;return ek|d9|ef|ej}return{replace:function(ea,d9){return d9},blend:function(eb,ea){var ed=(ea&d7)>>>24,d9=eb&d4,ef=eb&d3,eh=eb&d6,eg=ea&d4,ec=ea&d3,ee=ea&d6;return d5(((eb&d7)>>>24)+ed,255)<<24|d9+((eg-d9)*ed>>8)&d4|ef+((ec-ef)*ed>>8)&d3|eh+((ee-eh)*ed>>8)&d6},add:function(ea,d9){var eb=(d9&d7)>>>24;return d5(((ea&d7)>>>24)+eb,255)<<24|d5((ea&d4)+((d9&d4)>>8)*eb,d4)&d4|d5((ea&d3)+((d9&d3)>>8)*eb,d3)&d3|d5((ea&d6)+((d9&d6)*eb>>8),d6)},subtract:function(ea,d9){var eb=(d9&d7)>>>24;return d5(((ea&d7)>>>24)+eb,255)<<24|d2((ea&d4)-((d9&d4)>>8)*eb,d3)&d4|d2((ea&d3)-((d9&d3)>>8)*eb,d6)&d3|d2((ea&d6)-((d9&d6)*eb>>8),0)},lightest:function(ea,d9){var eb=(d9&d7)>>>24;return d5(((ea&d7)>>>24)+eb,255)<<24|d2(ea&d4,((d9&d4)>>8)*eb)&d4|d2(ea&d3,((d9&d3)>>8)*eb)&d3|d2(ea&d6,(d9&d6)*eb>>8)},darkest:function(eb,ea){var ed=(ea&d7)>>>24,d9=eb&d4,ef=eb&d3,eh=eb&d6,eg=d5(eb&d4,((ea&d4)>>8)*ed),ec=d5(eb&d3,((ea&d3)>>8)*ed),ee=d5(eb&d6,(ea&d6)*ed>>8);return d5(((eb&d7)>>>24)+ed,255)<<24|d9+((eg-d9)*ed>>8)&d4|ef+((ec-ef)*ed>>8)&d3|eh+((ee-eh)*ed>>8)&d6},difference:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6,eg=eb>ej?eb-ej:ej-eb,d9=ei>ee?ei-ee:ee-ei,ea=ek>eh?ek-eh:eh-ek;return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},exclusion:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6,eg=eb+ej-(eb*ej>>7),d9=ei+ee-(ei*ee>>7),ea=ek+eh-(ek*eh>>7);return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},multiply:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6,eg=eb*ej>>8,d9=ei*ee>>8,ea=ek*eh>>8;return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},screen:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6,eg=255-((255-eb)*(255-ej)>>8),d9=255-((255-ei)*(255-ee)>>8),ea=255-((255-ek)*(255-eh)>>8);return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},hard_light:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6,eg=ej<128?eb*ej>>7:255-((255-eb)*(255-ej)>>7),d9=ee<128?ei*ee>>7:255-((255-ei)*(255-ee)>>7),ea=eh<128?ek*eh>>7:255-((255-ek)*(255-eh)>>7);return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},soft_light:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6,eg=(eb*ej>>7)+(eb*eb>>8)-(eb*eb*ej>>15),d9=(ei*ee>>7)+(ei*ei>>8)-(ei*ei*ee>>15),ea=(ek*eh>>7)+(ek*ek>>8)-(ek*ek*eh>>15);return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},overlay:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6,eg=eb<128?eb*ej>>7:255-((255-eb)*(255-ej)>>7),d9=ei<128?ei*ee>>7:255-((255-ei)*(255-ee)>>7),ea=ek<128?ek*eh>>7:255-((255-ek)*(255-eh)>>7);return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},dodge:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6;var eg=255;if(ej!==255){eg=(eb<<8)/(255-ej);eg=eg<0?0:eg>255?255:eg}var d9=255;if(ee!==255){d9=(ei<<8)/(255-ee);d9=d9<0?0:d9>255?255:d9}var ea=255;if(eh!==255){ea=(ek<<8)/(255-eh);ea=ea<0?0:ea>255?255:ea}return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)},burn:function(ed,ec){var ef=(ec&d7)>>>24,eb=(ed&d4)>>16,ei=(ed&d3)>>8,ek=ed&d6,ej=(ec&d4)>>16,ee=(ec&d3)>>8,eh=ec&d6;var eg=0;if(ej!==0){eg=(255-eb<<8)/ej;eg=255-(eg<0?0:eg>255?255:eg)}var d9=0;if(ee!==0){d9=(255-ei<<8)/ee;d9=255-(d9<0?0:d9>255?255:d9)}var ea=0;if(eh!==0){ea=(255-ek<<8)/eh;ea=255-(ea<0?0:ea>255?255:ea)}return d8(ed,ef,eb,ei,ek,ej,ee,eh,eg,d9,ea)}}}();function dy(d7,d6,d4,d3){var d2,d5,d9,ea;if(cS===3){var d8=cQ.color.toRGB(d7,d6,d4);d2=d8[0];d5=d8[1];d9=d8[2]}else{d2=o.round(255*(d7/bB));d5=o.round(255*(d6/bA));d9=o.round(255*(d4/by))}ea=o.round(255*(d3/bM));d2=d2<0?0:d2;d5=d5<0?0:d5;d9=d9<0?0:d9;ea=ea<0?0:ea;d2=d2>255?255:d2;d5=d5>255?255:d5;d9=d9>255?255:d9;ea=ea>255?255:ea;return ea<<24&4278190080|d2<<16&16711680|d5<<8&65280|d9&255}function dB(d2,d4){var d3;if(d2&4278190080){d3=o.round(255*(d4/bM));d3=d3>255?255:d3;d3=d3<0?0:d3;return d2-(d2&4278190080)+(d3<<24&4278190080)}if(cS===1){return dy(d2,d2,d2,d4)}if(cS===3){return dy(0,0,d2/bB*by,d4)}}function dD(d2){if(d2<=bB&&d2>=0){if(cS===1){return dy(d2,d2,d2,bM)}if(cS===3){return dy(0,0,d2/bB*by,bM)}}if(d2){if(d2>2147483647){d2-=4294967296}return d2}}cQ.color=function(d2,d5,d4,d3){if(d2!==c&&d5!==c&&d4!==c&&d3!==c){return dy(d2,d5,d4,d3)}if(d2!==c&&d5!==c&&d4!==c){return dy(d2,d5,d4,bM)}if(d2!==c&&d5!==c){return dB(d2,d5)}if(typeof d2==="number"){return dD(d2)}return dy(bB,bA,by,bM)};cQ.color.toString=function(d2){return"rgba("+(d2>>16&255)+","+(d2>>8&255)+","+(d2&255)+","+(d2>>24&255)/255+")"};cQ.color.toInt=function(d5,d4,d2,d3){return d3<<24&4278190080|d5<<16&16711680|d4<<8&65280|d2&255};cQ.color.toArray=function(d2){return[d2>>16&255,d2>>8&255,d2&255,d2>>24&255]};cQ.color.toGLArray=function(d2){return[(d2>>16&255)/255,(d2>>8&255)/255,(d2&255)/255,(d2>>24&255)/255]};cQ.color.toRGB=function(d4,ea,d7){d4=d4>bB?bB:d4;ea=ea>bA?bA:ea;d7=d7>by?by:d7;d4=d4/bB*360;ea=ea/bA*100;d7=d7/by*100;var d9=o.round(d7/100*255);if(ea===0){return[d9,d9,d9]}var d5=d4%360;var d6=d5%60;var d3=o.round(d7*(100-ea)/10000*255);var d2=o.round(d7*(6000-ea*d6)/600000*255);var d8=o.round(d7*(6000-ea*(60-d6))/600000*255);switch(o.floor(d5/60)){case 0:return[d9,d8,d3];case 1:return[d2,d9,d3];case 2:return[d3,d9,d8];case 3:return[d3,d2,d9];case 4:return[d8,d3,d9];case 5:return[d9,d3,d2]}};function aK(d9){var d8,d7,d3;d8=(d9>>16&255)/255;d7=(d9>>8&255)/255;d3=(d9&255)/255;var d2=cQ.max(cQ.max(d8,d7),d3),d5=cQ.min(cQ.min(d8,d7),d3),d4,d6;if(d5===d2){return[0,0,d2*by]}d6=(d2-d5)/d2;if(d8===d2){d4=(d7-d3)/(d2-d5)}else{if(d7===d2){d4=2+(d3-d8)/(d2-d5)}else{d4=4+(d8-d7)/(d2-d5)}}d4/=6;if(d4<0){d4+=1}else{if(d4>1){d4-=1}}return[d4*bB,d6*bA,d2*by]}cQ.brightness=function(d2){return aK(d2)[2]};cQ.saturation=function(d2){return aK(d2)[1]};cQ.hue=function(d2){return aK(d2)[0]};cQ.red=function(d2){return(d2>>16&255)/255*bB};cQ.green=function(d2){return(d2>>8&255)/255*bA};cQ.blue=function(d2){return(d2&255)/255*by};cQ.alpha=function(d2){return(d2>>24&255)/255*bM};cQ.lerpColor=function(ee,ed,d7){var ec,ei,ej,ek,eg,d2,d8,em,ef,en,d6,el;var ea,d9,d3,eh,eb;var d5=cQ.color(ee);var d4=cQ.color(ed);if(cS===3){ea=aK(d5);em=(d5>>24&255)/bM;d9=aK(d4);el=(d4>>24&255)/bM;eh=cQ.lerp(ea[0],d9[0],d7);eb=cQ.lerp(ea[1],d9[1],d7);ej=cQ.lerp(ea[2],d9[2],d7);d3=cQ.color.toRGB(eh,eb,ej);ek=cQ.lerp(em,el,d7)*bM;return ek<<24&4278190080|(d3[0]&255)<<16|(d3[1]&255)<<8|d3[2]&255}eg=d5>>16&255;d2=d5>>8&255;d8=d5&255;em=(d5>>24&255)/bM;ef=d4>>16&255;en=d4>>8&255;d6=d4&255;el=(d4>>24&255)/bM;ec=cQ.lerp(eg,ef,d7)|0;ei=cQ.lerp(d2,en,d7)|0;ej=cQ.lerp(d8,d6,d7)|0;ek=cQ.lerp(em,el,d7)*bM;return ek<<24&4278190080|ec<<16&16711680|ei<<8&65280|ej&255};cQ.colorMode=function(){cS=arguments[0];if(arguments.length>1){bB=arguments[1];bA=arguments[2]||arguments[1];by=arguments[3]||arguments[1];bM=arguments[4]||arguments[1]}};cQ.blendColor=function(d3,d2,d4){if(d4===0){return cQ.modes.replace(d3,d2)}else{if(d4===1){return cQ.modes.blend(d3,d2)}else{if(d4===2){return cQ.modes.add(d3,d2)}else{if(d4===4){return cQ.modes.subtract(d3,d2)}else{if(d4===8){return cQ.modes.lightest(d3,d2)}else{if(d4===16){return cQ.modes.darkest(d3,d2)}else{if(d4===32){return cQ.modes.difference(d3,d2)}else{if(d4===64){return cQ.modes.exclusion(d3,d2)}else{if(d4===128){return cQ.modes.multiply(d3,d2)}else{if(d4===256){return cQ.modes.screen(d3,d2)}else{if(d4===1024){return cQ.modes.hard_light(d3,d2)}else{if(d4===2048){return cQ.modes.soft_light(d3,d2)}else{if(d4===512){return cQ.modes.overlay(d3,d2)}else{if(d4===4096){return cQ.modes.dodge(d3,d2)}else{if(d4===8192){return cQ.modes.burn(d3,d2)}}}}}}}}}}}}}}}};function ax(){dZ.save()}function cJ(){dZ.restore();bX=true;ak=true}cQ.printMatrix=function(){dA.print()};bJ.prototype.translate=function(d2,d3){dA.translate(d2,d3);aL.invTranslate(d2,d3);dZ.translate(d2,d3)};bt.prototype.translate=function(d2,d4,d3){dA.translate(d2,d4,d3);aL.invTranslate(d2,d4,d3)};bJ.prototype.scale=function(d2,d3){dA.scale(d2,d3);aL.invScale(d2,d3);dZ.scale(d2,d3||d2)};bt.prototype.scale=function(d2,d4,d3){dA.scale(d2,d4,d3);aL.invScale(d2,d4,d3)};bJ.prototype.pushMatrix=function(){ag.load(dA);c4.load(aL);ax()};bt.prototype.pushMatrix=function(){ag.load(dA);c4.load(aL)};bJ.prototype.popMatrix=function(){dA.set(ag.pop());aL.set(c4.pop());cJ()};bt.prototype.popMatrix=function(){dA.set(ag.pop());aL.set(c4.pop())};bJ.prototype.resetMatrix=function(){dA.reset();aL.reset();dZ.setTransform(1,0,0,1,0,0)};bt.prototype.resetMatrix=function(){dA.reset();aL.reset()};dj.prototype.applyMatrix=function(){var d2=arguments;dA.apply(d2[0],d2[1],d2[2],d2[3],d2[4],d2[5],d2[6],d2[7],d2[8],d2[9],d2[10],d2[11],d2[12],d2[13],d2[14],d2[15]);aL.invApply(d2[0],d2[1],d2[2],d2[3],d2[4],d2[5],d2[6],d2[7],d2[8],d2[9],d2[10],d2[11],d2[12],d2[13],d2[14],d2[15])};bJ.prototype.applyMatrix=function(){var d2=arguments;for(var d3=d2.length;d3<16;d3++){d2[d3]=0}d2[10]=d2[15]=1;dj.prototype.applyMatrix.apply(this,d2)};cQ.rotateX=function(d2){dA.rotateX(d2);aL.invRotateX(d2)};bJ.prototype.rotateZ=function(){throw"rotateZ() is not supported in 2D mode. Use rotate(float) instead."};bt.prototype.rotateZ=function(d2){dA.rotateZ(d2);aL.invRotateZ(d2)};cQ.rotateY=function(d2){dA.rotateY(d2);aL.invRotateY(d2)};bJ.prototype.rotate=function(d2){dA.rotateZ(d2);aL.invRotateZ(d2);dZ.rotate(d2)};bt.prototype.rotate=function(d2){cQ.rotateZ(d2)};cQ.pushStyle=function(){ax();cQ.pushMatrix();var d2={doFill:aA,currentFillColor:aS,doStroke:b8,currentStrokeColor:cp,curTint:a6,curRectMode:bD,curColorMode:cS,colorModeX:bB,colorModeZ:by,colorModeY:bA,colorModeA:bM,curTextFont:P,horizontalTextAlignment:G,verticalTextAlignment:cV,textMode:cC,curFontName:R,curTextSize:dR,curTextAscent:aU,curTextDescent:ds,curTextLeading:dY};be.push(d2)};cQ.popStyle=function(){var d2=be.pop();if(d2){cJ();cQ.popMatrix();aA=d2.doFill;aS=d2.currentFillColor;b8=d2.doStroke;cp=d2.currentStrokeColor;a6=d2.curTint;bD=d2.curRectmode;cS=d2.curColorMode;bB=d2.colorModeX;by=d2.colorModeZ;bA=d2.colorModeY;bM=d2.colorModeA;P=d2.curTextFont;R=d2.curFontName;dR=d2.curTextSize;G=d2.horizontalTextAlignment;cV=d2.verticalTextAlignment;cC=d2.textMode;aU=d2.curTextAscent;ds=d2.curTextDescent;dY=d2.curTextLeading}else{throw"Too many popStyle() without enough pushStyle()"}};cQ.year=function(){return(new Date).getFullYear()};cQ.month=function(){return(new Date).getMonth()+1};cQ.day=function(){return(new Date).getDate()};cQ.hour=function(){return(new Date).getHours()};cQ.minute=function(){return(new Date).getMinutes()};cQ.second=function(){return(new Date).getSeconds()};cQ.millis=function(){return Date.now()-dh};function cn(){var d2=(Date.now()-dk)/1000;I++;var d3=I/d2;if(d2>0.5){dk=Date.now();I=0;cQ.__frameRate=d3}cQ.frameCount++}bJ.prototype.redraw=function(){cn();dZ.lineWidth=dN;var d2=cQ.pmouseX,d3=cQ.pmouseY;cQ.pmouseX=dE;cQ.pmouseY=dW;ax();cQ.draw();cJ();dE=cQ.mouseX;dW=cQ.mouseY;cQ.pmouseX=d2;cQ.pmouseY=d3};bt.prototype.redraw=function(){cn();var d2=cQ.pmouseX,d3=cQ.pmouseY;cQ.pmouseX=dE;cQ.pmouseY=dW;dZ.clear(dZ.DEPTH_BUFFER_BIT);du={attributes:{},locations:{}};cQ.noLights();cQ.lightFalloff(1,0,0);cQ.shininess(1);cQ.ambient(255,255,255);cQ.specular(0,0,0);cQ.emissive(0,0,0);cQ.camera();cQ.draw();dE=cQ.mouseX;dW=cQ.mouseY;cQ.pmouseX=d2;cQ.pmouseY=d3};cQ.noLoop=function(){aw=false;aq=false;clearInterval(bY);cK.onPause()};cQ.loop=function(){if(aq){return}dk=Date.now();I=0;bY=l.setInterval(function(){try{cK.onFrameStart();cQ.redraw();cK.onFrameEnd()}catch(d2){l.clearInterval(bY);throw d2}},at);aw=true;aq=true;cK.onLoop()};cQ.frameRate=function(d2){dL=d2;at=1000/dL;if(aw){cQ.noLoop();cQ.loop()}};var an=[];function bH(d4,d3,d2){if(d4.addEventListener){d4.addEventListener(d3,d2,false)}else{d4.attachEvent("on"+d3,d2)}an.push({elem:d4,type:d3,fn:d2})}function c8(d2){var d5=d2.elem,d4=d2.type,d3=d2.fn;if(d5.removeEventListener){d5.removeEventListener(d4,d3,false)}else{if(d5.detachEvent){d5.detachEvent("on"+d4,d3)}}}cQ.exit=function(){l.clearInterval(bY);D(cQ.externals.canvas.id);for(var d3 in B.lib){if(B.lib.hasOwnProperty(d3)){if(B.lib[d3].hasOwnProperty("detach")){B.lib[d3].detach(cQ)}}}var d2=an.length;while(d2--){c8(an[d2])}cK.onExit()};cQ.cursor=function(){if(arguments.length>1||arguments.length===1&&arguments[0] instanceof cQ.PImage){var d5=arguments[0],d2,d7;if(arguments.length>=3){d2=arguments[1];d7=arguments[2];if(d2<0||d7<0||d7>=d5.height||d2>=d5.width){throw"x and y must be non-negative and less than the dimensions of the image"}}else{d2=d5.width>>>1;d7=d5.height>>>1}var d3=d5.toDataURL();var d4='url("'+d3+'") '+d2+" "+d7+", default";S=X.style.cursor=d4}else{if(arguments.length===1){var d6=arguments[0];S=X.style.cursor=d6}else{S=X.style.cursor=ce}}};cQ.noCursor=function(){S=X.style.cursor=j.NOCURSOR};cQ.link=function(d2,d3){if(d3!==c){l.open(d2,d3)}else{l.location=d2}};cQ.beginDraw=h;cQ.endDraw=h;bJ.prototype.toImageData=function(d2,d5,d3,d4){d2=d2!==c?d2:0;d5=d5!==c?d5:0;d3=d3!==c?d3:cQ.width;d4=d4!==c?d4:cQ.height;return dZ.getImageData(d2,d5,d3,d4)};bt.prototype.toImageData=function(ea,d9,eb,d6){ea=ea!==c?ea:0;d9=d9!==c?d9:0;eb=eb!==c?eb:cQ.width;d6=d6!==c?d6:cQ.height;var d8=u.createElement("canvas"),ec=d8.getContext("2d"),d5=ec.createImageData(eb,d6),d3=new q(eb*d6*4);dZ.readPixels(ea,d9,eb,d6,dZ.RGBA,dZ.UNSIGNED_BYTE,d3);for(var d4=0,d7=d3.length,d2=d5.data;d40){d5=d4}else{if(d3 instanceof bI){d5=16;d3|=0}else{d5=32;while(d5>1&&!(d3>>>d5-1&1)){d5--}}}var d2="";while(d5>0){d2+=d3>>>--d5&1?"1":"0"}return d2};cQ.unbinary=function(d3){var d5=d3.length-1,d4=1,d2=0;while(d5>=0){var d6=d3[d5--];if(d6!=="0"&&d6!=="1"){throw"the value passed into unbinary was not an 8 bit binary number"}if(d6==="1"){d2+=d4}d4<<=1}return d2};function cR(ee,ec,d6,eh,d8,ef){var d4=ee<0?d6:ec;var d3=d8===0;var ed=d8===c||d8<0?0:d8;var eb=o.abs(ee);if(d3){ed=1;eb*=10;while(o.abs(o.round(eb)-eb)>0.000001&&ed<7){++ed;eb*=10}}else{if(ed!==0){eb*=o.pow(10,ed)}}var d5,ea=eb*2;if(o.floor(eb)===eb){d5=eb}else{if(o.floor(ea)===ea){var d2=o.floor(eb);d5=d2+d2%2}else{d5=o.round(eb)}}var d7="";var eg=eh+ed;while(eg>0||d5>0){eg--;d7=""+d5%10+d7;d5=o.floor(d5/10)}if(ef!==c){var d9=d7.length-3-ed;while(d9>0){d7=d7.substring(0,d9)+ef+d7.substring(d9);d9-=3}}if(ed>0){return d4+d7.substring(0,d7.length-ed)+"."+d7.substring(d7.length-ed,d7.length)}return d4+d7}function ai(d8,d7,d2,ea,d3,d9){if(d8 instanceof Array){var d5=[];for(var d4=0,d6=d8.length;d4=d3){d2=d2.substring(d2.length-d3,d2.length)}return d2};cQ.hex=function(d3,d2){if(arguments.length===1){if(d3 instanceof bI){d2=4}else{d2=8}}return aF(d3,d2)};function dw(d2){var d3=parseInt("0x"+d2,16);if(d3>2147483647){d3-=4294967296}return d3}cQ.unhex=function(d4){if(d4 instanceof Array){var d2=[];for(var d3=0;d30?d5:null};cQ.__contains=function(d3,d2){if(typeof d3!=="string"){return d3.contains.apply(d3,a3(arguments))}return d3!==null&&d2!==null&&typeof d2==="string"&&d3.indexOf(d2)>-1};cQ.__replaceAll=function(d2,d4,d3){if(typeof d2!=="string"){return d2.replaceAll.apply(d2,a3(arguments))}return d2.replace(new RegExp(d4,"g"),d3)};cQ.__replaceFirst=function(d2,d4,d3){if(typeof d2!=="string"){return d2.replaceFirst.apply(d2,a3(arguments))}return d2.replace(new RegExp(d4,""),d3)};cQ.__replace=function(d5,d7,d6){if(typeof d5!=="string"){return d5.replace.apply(d5,a3(arguments))}if(d7 instanceof RegExp){return d5.replace(d7,d6)}if(typeof d7!=="string"){d7=d7.toString()}if(d7===""){return d5}var d4=d5.indexOf(d7);if(d4<0){return d5}var d3=0,d2="";do{d2+=d5.substring(d3,d4)+d6;d3=d4+d7.length}while((d4=d5.indexOf(d7,d3))>=0);return d2+d5.substring(d3)};cQ.__equals=function(d3,d2){if(d3.equals instanceof Function){return d3.equals.apply(d3,a3(arguments))}return d3.valueOf()===d2.valueOf()};cQ.__equalsIgnoreCase=function(d3,d2){if(typeof d3!=="string"){return d3.equalsIgnoreCase.apply(d3,a3(arguments))}return d3.toLowerCase()===d2.toLowerCase()};cQ.__toCharArray=function(d4){if(typeof d4!=="string"){return d4.toCharArray.apply(d4,a3(arguments))}var d5=[];for(var d3=0,d2=d4.length;d3d2.length){return false}return d4===""||d4===d2?true:d2.indexOf(d4)===d3};cQ.__endsWith=function(d3,d4){if(typeof d3!=="string"){return d3.endsWith.apply(d3,a3(arguments))}var d2=d4?d4.length:0;return d4===""||d4===d3?true:d3.indexOf(d4)===d3.length-d2};cQ.__hashCode=function(d2){if(d2.hashCode instanceof Function){return d2.hashCode.apply(d2,a3(arguments))}return a(d2)};cQ.__printStackTrace=function(d2){cQ.println("Exception: "+d2.toString())};var d1=[];cQ.println=function(d2){var d3=d1.length;if(d3){B.logger.log(d1.join(""));d1.length=0}if(arguments.length===0&&d3===0){B.logger.log("")}else{if(arguments.length!==0){B.logger.log(d2)}}};cQ.print=function(d2){d1.push(d2)};cQ.str=function(d4){if(d4 instanceof Array){var d2=[];for(var d3=0;d30){var d2=d5.shift();if(d2===d3){return true}if(d2.$interfaces){d5=d5.concat(d2.$interfaces)}}return false}while(d6.hasOwnProperty("$base")){d6=d6.$base;if(d6===d3){return true}}return false};cQ.abs=o.abs;cQ.ceil=o.ceil;cQ.constrain=function(d3,d4,d2){return d3>d2?d2:d30)){throw"Non-empty array is expected"}var d2=d3[0],d5=d3.length;for(var d4=1;d40)){throw"Non-empty array is expected"}var d4=d2[0],d5=d2.length;for(var d3=1;d3d2[d3]){d4=d2[d3]}}return d4};cQ.norm=function(d3,d2,d4){return(d3-d2)/(d4-d2)};cQ.pow=o.pow;cQ.round=o.round;cQ.sq=function(d2){return d2*d2};cQ.sqrt=o.sqrt;cQ.acos=o.acos;cQ.asin=o.asin;cQ.atan=o.atan;cQ.atan2=o.atan2;cQ.cos=o.cos;cQ.degrees=function(d2){return d2*180/o.PI};cQ.radians=function(d2){return d2/180*o.PI};cQ.sin=o.sin;cQ.tan=o.tan;var bR=o.random;cQ.random=function(){if(arguments.length===0){return bR()}if(arguments.length===1){return bR()*arguments[0]}var d3=arguments[0],d2=arguments[1];return bR()*(d2-d3)+d3};function ci(d4,d3){var d6=d4||362436069,d2=d3||521288629;var d5=function(){d6=36969*(d6&65535)+(d6>>>16)&4294967295;d2=18000*(d2&65535)+(d2>>>16)&4294967295;return((d6&65535)<<16|d2&65535)&4294967295};this.nextDouble=function(){var d7=d5()/4294967296;return d7<0?1+d7:d7};this.nextInt=d5}ci.createRandomized=function(){var d2=new Date;return new ci(d2/60000&4294967295,d2&4294967295)};cQ.randomSeed=function(d2){bR=(new ci(d2)).nextDouble};cQ.Random=function(d2){var d5=false,d3,d4;this.nextGaussian=function(){if(d5){d5=false;return d3}var d9,d7,d6;do{d9=2*d4()-1;d7=2*d4()-1;d6=d9*d9+d7*d7}while(d6>=1||d6===0);var d8=o.sqrt(-2*o.log(d6)/d6);d3=d7*d8;d5=true;return d9*d8};d4=d2===c?o.random:(new ci(d2)).nextDouble};function dr(d9){var d3=d9!==c?new ci(d9):ci.createRandomized();var d8,d6;var d5=new q(512);for(d8=0;d8<256;++d8){d5[d8]=d8}for(d8=0;d8<256;++d8){var eb=d5[d6=d3.nextInt()&255];d5[d6]=d5[d8];d5[d8]=eb}for(d8=0;d8<256;++d8){d5[d8+256]=d5[d8]}function d2(ef,ec,ei,eh){var eg=ef&15;var ee=eg<8?ec:ei,ed=eg<4?ei:eg===12||eg===14?ec:eh;return((eg&1)===0?ee:-ee)+((eg&2)===0?ed:-ed)}function d7(ee,ec,ef){var ed=(ee&1)===0?ec:ef;return(ee&2)===0?-ed:ed}function ea(ed,ec){return(ed&1)===0?-ec:ec}function d4(ee,ed,ec){return ed+ee*(ec-ed)}this.noise3d=function(eo,en,em){var ef=o.floor(eo)&255,ed=o.floor(en)&255,ec=o.floor(em)&255;eo-=o.floor(eo);en-=o.floor(en);em-=o.floor(em);var ej=(3-2*eo)*eo*eo,ei=(3-2*en)*en*en,eh=(3-2*em)*em*em;var eq=d5[ef]+ed,el=d5[eq]+ec,ek=d5[eq+1]+ec,ep=d5[ef+1]+ed,eg=d5[ep]+ec,ee=d5[ep+1]+ec;return d4(eh,d4(ei,d4(ej,d2(d5[el],eo,en,em),d2(d5[eg],eo-1,en,em)),d4(ej,d2(d5[ek],eo,en-1,em),d2(d5[ee],eo-1,en-1,em))),d4(ei,d4(ej,d2(d5[el+1],eo,en,em-1),d2(d5[eg+1],eo-1,en,em-1)),d4(ej,d2(d5[ek+1],eo,en-1,em-1),d2(d5[ee+1],eo-1,en-1,em-1))))};this.noise2d=function(ec,ej){var ei=o.floor(ec)&255,eg=o.floor(ej)&255;ec-=o.floor(ec);ej-=o.floor(ej);var ee=(3-2*ec)*ec*ec,ed=(3-2*ej)*ej*ej;var eh=d5[ei]+eg,ef=d5[ei+1]+eg;return d4(ed,d4(ee,d7(d5[eh],ec,ej),d7(d5[ef],ec-1,ej)),d4(ee,d7(d5[eh+1],ec,ej-1),d7(d5[ef+1],ec-1,ej-1)))};this.noise1d=function(ec){var ee=o.floor(ec)&255;ec-=o.floor(ec);var ed=(3-2*ec)*ec*ec;return d4(ed,ea(d5[ee],ec),ea(d5[ee+1],ec-1))}}var bP={generator:c,octaves:4,fallout:0.5,seed:c};cQ.noise=function(d2,d9,d8){if(bP.generator===c){bP.generator=new dr(bP.seed)}var d7=bP.generator;var d6=1,d3=1,d5=0;for(var d4=0;d40){X.style.removeProperty("width");X.style.removeProperty("height")}X.width=cQ.width=d3||100;X.height=cQ.height=d6||100;for(var d7 in d4){if(d4.hasOwnProperty(d7)){dZ[d7]=d4[d7]}}cQ.textFont(P);cQ.background();bT=o.max(1000,d3*d6*0.05);cQ.externals.context=dZ;for(var d2=0;d2<720;d2++){ab[d2]=cQ.sin(d2*(o.PI/180)*0.5);bd[d2]=cQ.cos(d2*(o.PI/180)*0.5)}};bJ.prototype.size=function(d2,d4,d3){if(dZ===c){dZ=X.getContext("2d");ag=new O;c4=new O;dA=new aO;aL=new aO}dj.prototype.size.apply(this,arguments)};bt.prototype.size=function(){var d3=false;return function d2(d5,d7,d6){if(d3){throw"Multiple calls to size() for 3D renders are not allowed."}d3=true;function d8(ea){var ed=["experimental-webgl","webgl","webkit-3d"],ec;for(var eb=0,d9=ed.length;eb>16&255)/255,(d3>>8&255)/255,(d3&255)/255];dZ.useProgram(dp);dT("lights.color.3d."+dC,dp,"lights"+dC+".color",d4);dT("lights.position.3d."+dC,dp,"lights"+dC+".position",d8.array());dQ("lights.type.3d."+dC,dp,"lights"+dC+".type",0);dQ("lightCount3d",dp,"lightCount",++dC)};bJ.prototype.directionalLight=dj.prototype.a3DOnlyFunction;bt.prototype.directionalLight=function(d2,d8,ea,d9,d7,d6){if(dC===8){throw"can only create "+8+" lights"}dZ.useProgram(dp);var eb=new aH;eb.scale(1,-1,1);eb.apply(dA.array());eb=eb.array();var d4=[eb[0]*d9+eb[4]*d7+eb[8]*d6,eb[1]*d9+eb[5]*d7+eb[9]*d6,eb[2]*d9+eb[6]*d7+eb[10]*d6];var d3=dy(d2,d8,ea,0);var d5=[(d3>>16&255)/255,(d3>>8&255)/255,(d3&255)/255];dT("lights.color.3d."+dC,dp,"lights"+dC+".color",d5);dT("lights.position.3d."+dC,dp,"lights"+dC+".position",d4);dQ("lights.type.3d."+dC,dp,"lights"+dC+".type",1);dQ("lightCount3d",dp,"lightCount",++dC)};bJ.prototype.lightFalloff=dj.prototype.a3DOnlyFunction;bt.prototype.lightFalloff=function(d3,d2,d4){dZ.useProgram(dp);dT("falloff3d",dp,"falloff",[d3,d2,d4])};bJ.prototype.lightSpecular=dj.prototype.a3DOnlyFunction;bt.prototype.lightSpecular=function(d6,d5,d2){var d3=dy(d6,d5,d2,0);var d4=[(d3>>16&255)/255,(d3>>8&255)/255,(d3&255)/255];dZ.useProgram(dp);dT("specular3d",dp,"specular",d4)};cQ.lights=function(){cQ.ambientLight(128,128,128);cQ.directionalLight(128,128,128,0,0,-1);cQ.lightFalloff(1,0,0);cQ.lightSpecular(0,0,0)};bJ.prototype.pointLight=dj.prototype.a3DOnlyFunction;bt.prototype.pointLight=function(d2,d5,ea,eb,d7,d6){if(dC===8){throw"can only create "+8+" lights"}var d8=new k(eb,d7,d6);var d9=new aH;d9.scale(1,-1,1);d9.apply(dA.array());d9.mult(d8,d8);var d3=dy(d2,d5,ea,0);var d4=[(d3>>16&255)/255,(d3>>8&255)/255,(d3&255)/255];dZ.useProgram(dp);dT("lights.color.3d."+dC,dp,"lights"+dC+".color",d4);dT("lights.position.3d."+dC,dp,"lights"+dC+".position",d8.array());dQ("lights.type.3d."+dC,dp,"lights"+dC+".type",2);dQ("lightCount3d",dp,"lightCount",++dC)};bJ.prototype.noLights=dj.prototype.a3DOnlyFunction;bt.prototype.noLights=function(){dC=0;dZ.useProgram(dp);dQ("lightCount3d",dp,"lightCount",dC)};bJ.prototype.spotLight=dj.prototype.a3DOnlyFunction;bt.prototype.spotLight=function(d2,ea,ef,eg,ee,ec,eb,d9,d7,d6,d8){if(dC===8){throw"can only create "+8+" lights"}dZ.useProgram(dp);var ed=new k(eg,ee,ec);var eh=new aH;eh.scale(1,-1,1);eh.apply(dA.array());eh.mult(ed,ed);eh=eh.array();var d4=[eh[0]*eb+eh[4]*d9+eh[8]*d7,eh[1]*eb+eh[5]*d9+eh[9]*d7,eh[2]*eb+eh[6]*d9+eh[10]*d7];var d3=dy(d2,ea,ef,0);var d5=[(d3>>16&255)/255,(d3>>8&255)/255,(d3&255)/255];dT("lights.color.3d."+dC,dp,"lights"+dC+".color",d5);dT("lights.position.3d."+dC,dp,"lights"+dC+".position",ed.array());dT("lights.direction.3d."+dC,dp,"lights"+dC+".direction",d4);dT("lights.concentration.3d."+dC,dp,"lights"+dC+".concentration",d8);dT("lights.angle.3d."+dC,dp,"lights"+dC+".angle",d6);dQ("lights.type.3d."+dC,dp,"lights"+dC+".type",3);dQ("lightCount3d",dp,"lightCount",++dC)};bJ.prototype.beginCamera=function(){throw"beginCamera() is not available in 2D mode"};bt.prototype.beginCamera=function(){if(aj){throw"You cannot call beginCamera() again before calling endCamera()"}aj=true;dA=cb;aL=bO};bJ.prototype.endCamera=function(){throw"endCamera() is not available in 2D mode"};bt.prototype.endCamera=function(){if(!aj){throw"You cannot call endCamera() before calling beginCamera()"}dA.set(bO);aL.set(cb);aj=false};cQ.camera=function(ed,ec,ea,d8,d6,d5,el,ej,eh){if(ed===c){de=cQ.width/2;dc=cQ.height/2;db=dc/o.tan(cE/2);ed=de;ec=dc;ea=db;d8=de;d6=dc;d5=0;el=0;ej=1;eh=0}var d7=new k(ed-d8,ec-d6,ea-d5);var d9=new k(el,ej,eh);d7.normalize();var eb=k.cross(d9,d7);d9=k.cross(d7,eb);eb.normalize();d9.normalize();var em=eb.x,ek=eb.y,ei=eb.z;var d4=d9.x,d3=d9.y,d2=d9.z;var eg=d7.x,ef=d7.y,ee=d7.z;bO.set(em,ek,ei,0,d4,d3,d2,0,eg,ef,ee,0,0,0,0,1);bO.translate(-ed,-ec,-ea);cb.reset();cb.invApply(em,ek,ei,0,d4,d3,d2,0,eg,ef,ee,0,0,0,0,1);cb.translate(ed,ec,ea);dA.set(bO);aL.set(cb)};cQ.perspective=function(d6,d4,d7,d3){if(arguments.length===0){dc=X.height/2;db=dc/o.tan(cE/2);aR=db/10;ao=db*10;bZ=cQ.width/cQ.height;d6=cE;d4=bZ;d7=aR;d3=ao}var d8,d2,d9,d5;d8=d7*o.tan(d6/2);d2=-d8;d9=d8*d4;d5=d2*d4;cQ.frustum(d5,d9,d2,d8,d7,d3)};bJ.prototype.frustum=function(){throw"Processing.js: frustum() is not supported in 2D mode"};bt.prototype.frustum=function(d8,d4,d3,d7,d6,d2){cc=true;c5=new aH;c5.set(2*d6/(d4-d8),0,(d4+d8)/(d4-d8),0,0,2*d6/(d7-d3),(d7+d3)/(d7-d3),0,0,0,-(d2+d6)/(d2-d6),-(2*d2*d6)/(d2-d6),0,0,-1,0);var d5=new aH;d5.set(c5);d5.transpose();dZ.useProgram(dH);a0("projection2d",dH,"projection",false,d5.array());dZ.useProgram(dp);a0("projection3d",dp,"projection",false,d5.array());dZ.useProgram(bL);a0("uProjectionUS",bL,"uProjection",false,d5.array())};cQ.ortho=function(d3,ee,d2,ec,d9,d8){if(arguments.length===0){d3=0;ee=cQ.width;d2=0;ec=cQ.height;d9=-10;d8=10}var ed=2/(ee-d3);var eb=2/(ec-d2);var ea=-2/(d8-d9);var d7=-(ee+d3)/(ee-d3);var d6=-(ec+d2)/(ec-d2);var d5=-(d8+d9)/(d8-d9);c5=new aH;c5.set(ed,0,0,d7,0,eb,0,d6,0,0,ea,d5,0,0,0,1);var d4=new aH;d4.set(c5);d4.transpose();dZ.useProgram(dH);a0("projection2d",dH,"projection",false,d4.array());dZ.useProgram(dp);a0("projection3d",dp,"projection",false,d4.array());dZ.useProgram(bL);a0("uProjectionUS",bL,"uProjection",false,d4.array());cc=false};cQ.printProjection=function(){c5.print()};cQ.printCamera=function(){bO.print()};bJ.prototype.box=dj.prototype.a3DOnlyFunction;bt.prototype.box=function(d4,d7,d9){if(!d7||!d9){d7=d9=d4}var d6=new aH;d6.scale(d4,d7,d9);var d3=new aH;d3.scale(1,-1,1);d3.apply(dA.array());d3.transpose();if(aA){dZ.useProgram(dp);a0("model3d",dp,"model",false,d6.array());a0("view3d",dp,"view",false,d3.array());dZ.enable(dZ.POLYGON_OFFSET_FILL);dZ.polygonOffset(1,1);dT("color3d",dp,"color",bg);if(dC>0){var d5=new aH;d5.set(d3);var d2=new aH;d2.set(d6);d5.mult(d2);var d8=new aH;d8.set(d5);d8.invert();d8.transpose();a0("normalTransform3d",dp,"normalTransform",false,d8.array());c6("normal3d",dp,"Normal",3,cD)}else{ca("normal3d",dp,"Normal")}c6("vertex3d",dp,"Vertex",3,a8);ca("aColor3d",dp,"aColor");ca("aTexture3d",dp,"aTexture");dZ.drawArrays(dZ.TRIANGLES,0,da.length/3);dZ.disable(dZ.POLYGON_OFFSET_FILL)}if(dN>0&&b8){dZ.useProgram(dH);a0("model2d",dH,"model",false,d6.array());a0("view2d",dH,"view",false,d3.array());dT("color2d",dH,"color",cU);dQ("picktype2d",dH,"picktype",0);c6("vertex2d",dH,"Vertex",3,dd);ca("aTextureCoord2d",dH,"aTextureCoord");dZ.drawArrays(dZ.LINES,0,bz.length/3)}};var cx=function(){var d3;cz=[];for(d3=0;d30){var d4=new aH;d4.set(d3);var d2=new aH;d2.set(d5);d4.mult(d2);var d7=new aH;d7.set(d4);d7.invert();d7.transpose();a0("normalTransform3d",dp,"normalTransform",false,d7.array());c6("normal3d",dp,"Normal",3,a7)}else{ca("normal3d",dp,"Normal")}dZ.useProgram(dp);ca("aTexture3d",dp,"aTexture");a0("model3d",dp,"model",false,d5.array());a0("view3d",dp,"view",false,d3.array());c6("vertex3d",dp,"Vertex",3,a7);ca("aColor3d",dp,"aColor");dZ.enable(dZ.POLYGON_OFFSET_FILL);dZ.polygonOffset(1,1);dT("color3d",dp,"color",bg);dZ.drawArrays(dZ.TRIANGLE_STRIP,0,cz.length/3);dZ.disable(dZ.POLYGON_OFFSET_FILL)}if(dN>0&&b8){dZ.useProgram(dH);a0("model2d",dH,"model",false,d5.array());a0("view2d",dH,"view",false,d3.array());c6("vertex2d",dH,"Vertex",3,a7);ca("aTextureCoord2d",dH,"aTextureCoord");dT("color2d",dH,"color",cU);dQ("picktype2d",dH,"picktype",0);dZ.drawArrays(dZ.LINE_STRIP,0,cz.length/3)}};cQ.modelX=function(d8,d7,d6){var ea=dA.array();var ec=cb.array();var d2=ea[0]*d8+ea[1]*d7+ea[2]*d6+ea[3];var eb=ea[4]*d8+ea[5]*d7+ea[6]*d6+ea[7];var d9=ea[8]*d8+ea[9]*d7+ea[10]*d6+ea[11];var d3=ea[12]*d8+ea[13]*d7+ea[14]*d6+ea[15];var d4=ec[0]*d2+ec[1]*eb+ec[2]*d9+ec[3]*d3;var d5=ec[12]*d2+ec[13]*eb+ec[14]*d9+ec[15]*d3;return d5!==0?d4/d5:d4};cQ.modelY=function(d8,d7,d6){var ea=dA.array();var ec=cb.array();var d2=ea[0]*d8+ea[1]*d7+ea[2]*d6+ea[3];var eb=ea[4]*d8+ea[5]*d7+ea[6]*d6+ea[7];var d9=ea[8]*d8+ea[9]*d7+ea[10]*d6+ea[11];var d3=ea[12]*d8+ea[13]*d7+ea[14]*d6+ea[15];var d4=ec[4]*d2+ec[5]*eb+ec[6]*d9+ec[7]*d3;var d5=ec[12]*d2+ec[13]*eb+ec[14]*d9+ec[15]*d3;return d5!==0?d4/d5:d4};cQ.modelZ=function(d8,d7,d6){var ea=dA.array();var ec=cb.array();var d2=ea[0]*d8+ea[1]*d7+ea[2]*d6+ea[3];var eb=ea[4]*d8+ea[5]*d7+ea[6]*d6+ea[7];var d9=ea[8]*d8+ea[9]*d7+ea[10]*d6+ea[11];var d4=ea[12]*d8+ea[13]*d7+ea[14]*d6+ea[15];var d3=ec[8]*d2+ec[9]*eb+ec[10]*d9+ec[11]*d4;var d5=ec[12]*d2+ec[13]*eb+ec[14]*d9+ec[15]*d4;return d5!==0?d3/d5:d3};bJ.prototype.ambient=dj.prototype.a3DOnlyFunction;bt.prototype.ambient=function(d5,d4,d3){dZ.useProgram(dp);dQ("usingMat3d",dp,"usingMat",true);var d2=cQ.color(d5,d4,d3);dT("mat_ambient3d",dp,"mat_ambient",cQ.color.toGLArray(d2).slice(0,3))};bJ.prototype.emissive=dj.prototype.a3DOnlyFunction;bt.prototype.emissive=function(d5,d4,d3){dZ.useProgram(dp);dQ("usingMat3d",dp,"usingMat",true);var d2=cQ.color(d5,d4,d3);dT("mat_emissive3d",dp,"mat_emissive",cQ.color.toGLArray(d2).slice(0,3))};bJ.prototype.shininess=dj.prototype.a3DOnlyFunction;bt.prototype.shininess=function(d2){dZ.useProgram(dp);dQ("usingMat3d",dp,"usingMat",true);dT("shininess3d",dp,"shininess",d2)};bJ.prototype.specular=dj.prototype.a3DOnlyFunction;bt.prototype.specular=function(d5,d4,d3){dZ.useProgram(dp);dQ("usingMat3d",dp,"usingMat",true);var d2=cQ.color(d5,d4,d3);dT("mat_specular3d",dp,"mat_specular",cQ.color.toGLArray(d2).slice(0,3))};cQ.screenX=function(d9,d8,d7){var eb=dA.array();if(eb.length===16){var d2=eb[0]*d9+eb[1]*d8+eb[2]*d7+eb[3];var ec=eb[4]*d9+eb[5]*d8+eb[6]*d7+eb[7];var ea=eb[8]*d9+eb[9]*d8+eb[10]*d7+eb[11];var d3=eb[12]*d9+eb[13]*d8+eb[14]*d7+eb[15];var d6=c5.array();var d4=d6[0]*d2+d6[1]*ec+d6[2]*ea+d6[3]*d3;var d5=d6[12]*d2+d6[13]*ec+d6[14]*ea+d6[15]*d3;if(d5!==0){d4/=d5}return cQ.width*(1+d4)/2}return dA.multX(d9,d8)};cQ.screenY=function au(d9,d8,d7){var eb=dA.array();if(eb.length===16){var d2=eb[0]*d9+eb[1]*d8+eb[2]*d7+eb[3];var ec=eb[4]*d9+eb[5]*d8+eb[6]*d7+eb[7];var ea=eb[8]*d9+eb[9]*d8+eb[10]*d7+eb[11];var d3=eb[12]*d9+eb[13]*d8+eb[14]*d7+eb[15];var d6=c5.array();var d4=d6[4]*d2+d6[5]*ec+d6[6]*ea+d6[7]*d3;var d5=d6[12]*d2+d6[13]*ec+d6[14]*ea+d6[15]*d3;if(d5!==0){d4/=d5}return cQ.height*(1+d4)/2}return dA.multY(d9,d8)};cQ.screenZ=function ar(d9,d8,d7){var eb=dA.array();if(eb.length!==16){return 0}var d6=c5.array();var d2=eb[0]*d9+eb[1]*d8+eb[2]*d7+eb[3];var ec=eb[4]*d9+eb[5]*d8+eb[6]*d7+eb[7];var ea=eb[8]*d9+eb[9]*d8+eb[10]*d7+eb[11];var d4=eb[12]*d9+eb[13]*d8+eb[14]*d7+eb[15];var d3=d6[8]*d2+d6[9]*ec+d6[10]*ea+d6[11]*d4;var d5=d6[12]*d2+d6[13]*ec+d6[14]*ea+d6[15]*d4;if(d5!==0){d3/=d5}return(d3+1)/2};dj.prototype.fill=function(){var d2=cQ.color(arguments[0],arguments[1],arguments[2],arguments[3]);if(d2===aS&&aA){return}aA=true;aS=d2};bJ.prototype.fill=function(){dj.prototype.fill.apply(this,arguments);ak=true};bt.prototype.fill=function(){dj.prototype.fill.apply(this,arguments);bg=cQ.color.toGLArray(aS)};function bf(){if(aA){if(ak){dZ.fillStyle=cQ.color.toString(aS);ak=false}dZ.fill()}}cQ.noFill=function(){aA=false};dj.prototype.stroke=function(){var d2=cQ.color(arguments[0],arguments[1],arguments[2],arguments[3]);if(d2===cp&&b8){return}b8=true;cp=d2};bJ.prototype.stroke=function(){dj.prototype.stroke.apply(this,arguments);bX=true};bt.prototype.stroke=function(){dj.prototype.stroke.apply(this,arguments);cU=cQ.color.toGLArray(cp)};function c7(){if(b8){if(bX){dZ.strokeStyle=cQ.color.toString(cp);bX=false}dZ.stroke()}}cQ.noStroke=function(){b8=false};dj.prototype.strokeWeight=function(d2){dN=d2};bJ.prototype.strokeWeight=function(d2){dj.prototype.strokeWeight.apply(this,arguments);dZ.lineWidth=d2};bt.prototype.strokeWeight=function(d2){dj.prototype.strokeWeight.apply(this,arguments);dZ.useProgram(dH);dT("pointSize2d",dH,"pointSize",d2);dZ.useProgram(bL);dT("pointSizeUnlitShape",bL,"pointSize",d2);dZ.lineWidth(d2)};cQ.strokeCap=function(d2){dP.$ensureContext().lineCap=d2};cQ.strokeJoin=function(d2){dP.$ensureContext().lineJoin=d2};bJ.prototype.smooth=function(){dF=true;var d2=X.style;d2.setProperty("image-rendering","optimizeQuality","important");d2.setProperty("-ms-interpolation-mode","bicubic","important");if(dZ.hasOwnProperty("mozImageSmoothingEnabled")){dZ.mozImageSmoothingEnabled=true}};bt.prototype.smooth=h;bJ.prototype.noSmooth=function(){dF=false;var d2=X.style;d2.setProperty("image-rendering","optimizeSpeed","important");d2.setProperty("image-rendering","-moz-crisp-edges","important");d2.setProperty("image-rendering","-webkit-optimize-contrast","important");d2.setProperty("image-rendering","optimize-contrast","important");d2.setProperty("-ms-interpolation-mode","nearest-neighbor","important");if(dZ.hasOwnProperty("mozImageSmoothingEnabled")){dZ.mozImageSmoothingEnabled=false}};bt.prototype.noSmooth=h;bJ.prototype.point=function(d2,d3){if(!b8){return}d2=o.round(d2);d3=o.round(d3);dZ.fillStyle=cQ.color.toString(cp);ak=true;if(dN>1){dZ.beginPath();dZ.arc(d2,d3,dN/2,0,6.283185307179586,false);dZ.fill()}else{dZ.fillRect(d2,d3,1,1)}};bt.prototype.point=function(d2,d6,d5){var d4=new aH;d4.translate(d2,d6,d5||0);d4.transpose();var d3=new aH;d3.scale(1,-1,1);d3.apply(dA.array());d3.transpose();dZ.useProgram(dH);a0("model2d",dH,"model",false,d4.array());a0("view2d",dH,"view",false,d3.array());if(dN>0&&b8){dT("color2d",dH,"color",cU);dQ("picktype2d",dH,"picktype",0);c6("vertex2d",dH,"Vertex",3,ap);ca("aTextureCoord2d",dH,"aTextureCoord");dZ.drawArrays(dZ.POINTS,0,1)}};cQ.beginShape=function(d2){dI=d2;dX=[];a2=[]};bJ.prototype.vertex=function(d2,d6,d5,d4){var d3=[];if(dl){dl=false}d3.isVert=true;d3[0]=d2;d3[1]=d6;d3[2]=0;d3[3]=d5;d3[4]=d4;d3[5]=aS;d3[6]=cp;a2.push(d3)};bt.prototype.vertex=function(d2,d7,d6,d5,d4){var d3=[];if(dl){dl=false}d3.isVert=true;if(d4===c&&dK){d4=d5;d5=d6;d6=0}if(d5!==c&&d4!==c){if(dV===2){d5/=cm.width;d4/=cm.height}d5=d5>1?1:d5;d5=d5<0?0:d5;d4=d4>1?1:d4;d4=d4<0?0:d4}d3[0]=d2;d3[1]=d7;d3[2]=d6||0;d3[3]=d5||0;d3[4]=d4||0;d3[5]=bg[0];d3[6]=bg[1];d3[7]=bg[2];d3[8]=bg[3];d3[9]=cU[0];d3[10]=cU[1];d3[11]=cU[2];d3[12]=cU[3];d3[13]=aZ;d3[14]=aY;d3[15]=aX;a2.push(d3)};var dS=function(d4,d3){var d2=new aH;d2.scale(1,-1,1);d2.apply(dA.array());d2.transpose();dZ.useProgram(bL);a0("uViewUS",bL,"uView",false,d2.array());c6("aVertexUS",bL,"aVertex",3,ap);dZ.bufferData(dZ.ARRAY_BUFFER,new d(d4),dZ.STREAM_DRAW);c6("aColorUS",bL,"aColor",4,az);dZ.bufferData(dZ.ARRAY_BUFFER,new d(d3),dZ.STREAM_DRAW);dZ.drawArrays(dZ.POINTS,0,d4.length/3)};var bb=function(d6,d5,d4){var d3;if(d5==="LINES"){d3=dZ.LINES}else{if(d5==="LINE_LOOP"){d3=dZ.LINE_LOOP}else{d3=dZ.LINE_STRIP}}var d2=new aH;d2.scale(1,-1,1);d2.apply(dA.array());d2.transpose();dZ.useProgram(bL);a0("uViewUS",bL,"uView",false,d2.array());c6("aVertexUS",bL,"aVertex",3,b2);dZ.bufferData(dZ.ARRAY_BUFFER,new d(d6),dZ.STREAM_DRAW);c6("aColorUS",bL,"aColor",4,bu);dZ.bufferData(dZ.ARRAY_BUFFER,new d(d4),dZ.STREAM_DRAW);dZ.drawArrays(d3,0,d6.length/3)};var df=function(d7,d6,d5,d4){var d3;if(d6==="TRIANGLES"){d3=dZ.TRIANGLES}else{if(d6==="TRIANGLE_FAN"){d3=dZ.TRIANGLE_FAN}else{d3=dZ.TRIANGLE_STRIP}}var d2=new aH;d2.scale(1,-1,1);d2.apply(dA.array());d2.transpose();dZ.useProgram(dp);a0("model3d",dp,"model",false,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);a0("view3d",dp,"view",false,d2.array());dZ.enable(dZ.POLYGON_OFFSET_FILL);dZ.polygonOffset(1,1);dT("color3d",dp,"color",[-1,0,0,0]);c6("vertex3d",dp,"Vertex",3,am);dZ.bufferData(dZ.ARRAY_BUFFER,new d(d7),dZ.STREAM_DRAW);if(dK&&a6!==null){bo(d5)}c6("aColor3d",dp,"aColor",4,az);dZ.bufferData(dZ.ARRAY_BUFFER,new d(d5),dZ.STREAM_DRAW);ca("normal3d",dp,"Normal");if(dK){dQ("usingTexture3d",dp,"usingTexture",dK);c6("aTexture3d",dp,"aTexture",2,Z);dZ.bufferData(dZ.ARRAY_BUFFER,new d(d4),dZ.STREAM_DRAW)}dZ.drawArrays(d3,0,d7.length/3);dZ.disable(dZ.POLYGON_OFFSET_FILL)};function cM(){bf();c7();dZ.closePath()}bJ.prototype.endShape=function(d9){if(a2.length===0){return}var d5=d9===2;if(d5){a2.push(a2[0])}var d4=[];var d2=[];var eb=[];var ee=[];var d7=[];var ea;dl=true;var d8,d6,d3;var ed=a2.length;for(d8=0;d83){var ec=[],ef=1-aC;dZ.beginPath();dZ.moveTo(a2[1][0],a2[1][1]);for(d8=1;d8+22){dZ.beginPath();dZ.moveTo(a2[0][0],a2[0][1]);dZ.lineTo(a2[1][0],a2[1][1]);dZ.lineTo(a2[2][0],a2[2][1]);if(aA){cQ.fill(a2[2][5]);bf()}if(b8){cQ.stroke(a2[2][6]);c7()}dZ.closePath();for(d8=3;d83){for(d8=0;d8+12){for(d8=0;d8+22){for(d8=0;d8+22){for(d8=0;d8<3;d8++){ea=a2[d8];for(d6=0;d6<3;d6++){d4.push(ea[d6])}}for(d8=0;d8<3;d8++){ea=a2[d8];for(d6=9;d6<13;d6++){ee.push(ea[d6])}}if(b8){bb(d4,"LINE_LOOP",ee)}for(d8=2;d8+13){for(d8=0;d8<2;d8++){ea=a2[d8];for(d6=0;d6<3;d6++){d4.push(ea[d6])}}for(d8=0;d8<2;d8++){ea=a2[d8];for(d6=9;d6<13;d6++){ee.push(ea[d6])}}bb(d4,"LINE_STRIP",ee);if(ed>4&&ed%2>0){ec=d2.splice(d2.length-3);a2.pop()}for(d8=0;d8+33){al(b5[cW-4][0],b5[cW-4][1],b5[cW-4][2],b5[cW-3][0],b5[cW-3][1],b5[cW-3][2],b5[cW-2][0],b5[cW-2][1],b5[cW-2][2],b5[cW-1][0],b5[cW-1][1],b5[cW-1][2])}};bJ.prototype.curve=function(){if(arguments.length===8){cQ.beginShape();cQ.curveVertex(arguments[0],arguments[1]);cQ.curveVertex(arguments[2],arguments[3]);cQ.curveVertex(arguments[4],arguments[5]);cQ.curveVertex(arguments[6],arguments[7]);cQ.endShape()}};bt.prototype.curve=function(){if(arguments.length===12){cQ.beginShape();cQ.curveVertex(arguments[0],arguments[1],arguments[2]);cQ.curveVertex(arguments[3],arguments[4],arguments[5]);cQ.curveVertex(arguments[6],arguments[7],arguments[8]);cQ.curveVertex(arguments[9],arguments[10],arguments[11]);cQ.endShape()}};cQ.curveTightness=function(d2){aC=d2};cQ.curveDetail=function(d2){J=d2;di()};cQ.rectMode=function(d2){bD=d2};cQ.imageMode=function(d2){switch(d2){case 0:bc=aQ;break;case 1:bc=bV;break;case 3:bc=aG;break;default:throw"Invalid imageMode"}};cQ.ellipseMode=function(d2){cH=d2};cQ.arc=function(ee,ec,d5,eg,d4,ed){if(d5<=0||ed6.283185307179586){d4=0;ed=6.283185307179586}var ef=d5/2;var eh=eg/2;var d9=ee+ef;var d7=ec+eh;var d3=0|-0.5+d4*cQ.RAD_TO_DEG*2;var eb=0|0.5+ed*cQ.RAD_TO_DEG*2;var ea,d8;if(aA){var d6=b8;b8=false;cQ.beginShape();cQ.vertex(d9,d7);for(ea=d3;ea<=eb;ea++){d8=ea%720;cQ.vertex(d9+bd[d8]*ef,d7+ab[d8]*eh)}cQ.endShape(2);b8=d6}if(b8){var d2=aA;aA=false;cQ.beginShape();for(ea=d3;ea<=eb;ea++){d8=ea%720;cQ.vertex(d9+bd[d8]*ef,d7+ab[d8]*eh)}cQ.endShape();aA=d2}};bJ.prototype.line=function(d3,ea,d2,d8){if(!b8){return}d3=o.round(d3);d2=o.round(d2);ea=o.round(ea);d8=o.round(d8);if(d3===d2&&ea===d8){cQ.point(d3,ea);return}var d4=c,eb=c,d7=true,d9=dA.array(),d5=[1,0,0,0,1,0];for(var d6=0;d6<6&&d7;d6++){d7=d9[d6]===d5[d6]}if(d7){if(d3===d2){if(ea>d8){d4=ea;ea=d8;d8=d4}d8++;if(dN%2===1){dZ.translate(0.5,0)}}else{if(ea===d8){if(d3>d2){d4=d3;d3=d2;d2=d4}d2++;if(dN%2===1){dZ.translate(0,0.5)}}}if(dN===1){eb=dZ.lineCap;dZ.lineCap="butt"}}dZ.beginPath();dZ.moveTo(d3||0,ea||0);dZ.lineTo(d2||0,d8||0);c7();if(d7){if(d3===d2&&dN%2===1){dZ.translate(-0.5,0)}else{if(ea===d8&&dN%2===1){dZ.translate(0,-0.5)}}if(dN===1){dZ.lineCap=eb}}};bt.prototype.line=function(d4,d7,d9,d3,d5,d8){if(d5===c||d8===c){d8=0;d5=d3;d3=d9;d9=0}if(d4===d3&&d7===d5&&d9===d8){cQ.point(d4,d7,d9);return}var d6=[d4,d7,d9,d3,d5,d8];var d2=new aH;d2.scale(1,-1,1);d2.apply(dA.array());d2.transpose();if(dN>0&&b8){dZ.useProgram(dH);a0("model2d",dH,"model",false,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);a0("view2d",dH,"view",false,d2.array());dT("color2d",dH,"color",cU);dQ("picktype2d",dH,"picktype",0);c6("vertex2d",dH,"Vertex",3,b2);ca("aTextureCoord2d",dH,"aTextureCoord");dZ.bufferData(dZ.ARRAY_BUFFER,new d(d6),dZ.STREAM_DRAW);dZ.drawArrays(dZ.LINES,0,2)}};bJ.prototype.bezier=function(){if(arguments.length!==8){throw"You must use 8 parameters for bezier() in 2D mode"}cQ.beginShape();cQ.vertex(arguments[0],arguments[1]);cQ.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);cQ.endShape()};bt.prototype.bezier=function(){if(arguments.length!==12){throw"You must use 12 parameters for bezier() in 3D mode"}cQ.beginShape();cQ.vertex(arguments[0],arguments[1],arguments[2]);cQ.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]);cQ.endShape()};cQ.bezierDetail=function(d2){cs=d2};cQ.bezierPoint=function(d3,d2,d6,d5,d4){return(1-d4)*(1-d4)*(1-d4)*d3+3*(1-d4)*(1-d4)*d4*d2+3*(1-d4)*d4*d4*d6+d4*d4*d4*d5};cQ.bezierTangent=function(d3,d2,d6,d5,d4){return 3*d4*d4*(-d3+3*d2-3*d6+d5)+6*d4*(d3-2*d2+d6)+3*(-d3+d2)};cQ.curvePoint=function(d3,d2,d6,d5,d4){return 0.5*(2*d2+(-d3+d6)*d4+(2*d3-5*d2+4*d6-d5)*d4*d4+(-d3+3*d2-3*d6+d5)*d4*d4*d4)};cQ.curveTangent=function(d3,d2,d6,d5,d4){return 0.5*(-d3+d6+2*(2*d3-5*d2+4*d6-d5)*d4+3*(-d3+3*d2-3*d6+d5)*d4*d4)};cQ.triangle=function(d5,d7,d3,d6,d2,d4){cQ.beginShape(9);cQ.vertex(d5,d7,0);cQ.vertex(d3,d6,0);cQ.vertex(d2,d4,0);cQ.endShape()};cQ.quad=function(d7,d9,d5,d8,d3,d6,d2,d4){cQ.beginShape(16);cQ.vertex(d7,d9,0);cQ.vertex(d5,d8,0);cQ.vertex(d3,d6,0);cQ.vertex(d2,d4,0);cQ.endShape()};var bG=function(d8,d7,d2,d9,eb,d6,ea,d3){if(d3===c){d6=eb;ea=eb;d3=eb}var d4=d2/2,d5=d9/2;if(eb>d4||eb>d5){eb=o.min(d4,d5)}if(d6>d4||d6>d5){d6=o.min(d4,d5)}if(ea>d4||ea>d5){ea=o.min(d4,d5)}if(d3>d4||d3>d5){d3=o.min(d4,d5)}if(!aA||b8){dZ.translate(0.5,0.5)}dZ.beginPath();dZ.moveTo(d8+eb,d7);dZ.lineTo(d8+d2-d6,d7);dZ.quadraticCurveTo(d8+d2,d7,d8+d2,d7+d6);dZ.lineTo(d8+d2,d7+d9-ea);dZ.quadraticCurveTo(d8+d2,d7+d9,d8+d2-ea,d7+d9);dZ.lineTo(d8+d3,d7+d9);dZ.quadraticCurveTo(d8,d7+d9,d8,d7+d9-d3);dZ.lineTo(d8,d7+eb);dZ.quadraticCurveTo(d8,d7,d8+eb,d7);if(!aA||b8){dZ.translate(-0.5,-0.5)}bf();c7()};bJ.prototype.rect=function(d3,d9,d6,d2,d4,d7,d5,d8){if(!d6&&!d2){return}if(bD===1){d6-=d3;d2-=d9}else{if(bD===2){d6*=2;d2*=2;d3-=d6/2;d9-=d2/2}else{if(bD===3){d3-=d6/2;d9-=d2/2}}}d3=o.round(d3);d9=o.round(d9);d6=o.round(d6);d2=o.round(d2);if(d4!==c){bG(d3,d9,d6,d2,d4,d7,d5,d8);return}if(b8&&dN%2===1){dZ.translate(0.5,0.5)}dZ.beginPath();dZ.rect(d3,d9,d6,d2);bf();c7();if(b8&&dN%2===1){dZ.translate(-0.5,-0.5)}};bt.prototype.rect=function(ea,d9,d2,ec,ee,d7,ed,d3){if(ee!==c){throw"rect() with rounded corners is not supported in 3D mode"}if(bD===1){d2-=ea;ec-=d9}else{if(bD===2){d2*=2;ec*=2;ea-=d2/2;d9-=ec/2}else{if(bD===3){ea-=d2/2;d9-=ec/2}}}var d6=new aH;d6.translate(ea,d9,0);d6.scale(d2,ec,1);d6.transpose();var d8=new aH;d8.scale(1,-1,1);d8.apply(dA.array());d8.transpose();if(dN>0&&b8){dZ.useProgram(dH);a0("model2d",dH,"model",false,d6.array());a0("view2d",dH,"view",false,d8.array());dT("color2d",dH,"color",cU);dQ("picktype2d",dH,"picktype",0);c6("vertex2d",dH,"Vertex",3,av);ca("aTextureCoord2d",dH,"aTextureCoord");dZ.drawArrays(dZ.LINE_LOOP,0,ae.length/3)}if(aA){dZ.useProgram(dp);a0("model3d",dp,"model",false,d6.array());a0("view3d",dp,"view",false,d8.array());dZ.enable(dZ.POLYGON_OFFSET_FILL);dZ.polygonOffset(1,1);dT("color3d",dp,"color",bg);if(dC>0){var eb=new aH;eb.set(d8);var d4=new aH;d4.set(d6);eb.mult(d4);var d5=new aH;d5.set(eb);d5.invert();d5.transpose();a0("normalTransform3d",dp,"normalTransform",false,d5.array());c6("normal3d",dp,"Normal",3,bW)}else{ca("normal3d",dp,"Normal")}c6("vertex3d",dp,"Vertex",3,av);dZ.drawArrays(dZ.TRIANGLE_FAN,0,ae.length/3);dZ.disable(dZ.POLYGON_OFFSET_FILL)}};bJ.prototype.ellipse=function(d8,d7,d3,ea){d8=d8||0;d7=d7||0;if(d3<=0&&ea<=0){return}if(cH===2){d3*=2;ea*=2}else{if(cH===1){d3=d3-d8;ea=ea-d7;d8+=d3/2;d7+=ea/2}else{if(cH===0){d8+=d3/2;d7+=ea/2}}}if(d3===ea){dZ.beginPath();dZ.arc(d8,d7,d3/2,0,6.283185307179586,false);bf();c7()}else{var d9=d3/2,d6=ea/2,d2=0.5522847498307933,d5=d2*d9,d4=d2*d6;cQ.beginShape();cQ.vertex(d8+d9,d7);cQ.bezierVertex(d8+d9,d7-d4,d8+d5,d7-d6,d8,d7-d6);cQ.bezierVertex(d8-d5,d7-d6,d8-d9,d7-d4,d8-d9,d7);cQ.bezierVertex(d8-d9,d7+d4,d8-d5,d7+d6,d8,d7+d6);cQ.bezierVertex(d8+d5,d7+d6,d8+d9,d7+d4,d8+d9,d7);cQ.endShape()}};bt.prototype.ellipse=function(ef,ee,d4,eh){ef=ef||0;ee=ee||0;if(d4<=0&&eh<=0){return}if(cH===2){d4*=2;eh*=2}else{if(cH===1){d4=d4-ef;eh=eh-ee;ef+=d4/2;ee+=eh/2}else{if(cH===0){ef+=d4/2;ee+=eh/2}}}var eg=d4/2,eb=eh/2,d2=0.5522847498307933,d6=d2*eg,d5=d2*eb;cQ.beginShape();cQ.vertex(ef+eg,ee);cQ.bezierVertex(ef+eg,ee-d5,0,ef+d6,ee-eb,0,ef,ee-eb,0);cQ.bezierVertex(ef-d6,ee-eb,0,ef-eg,ee-d5,0,ef-eg,ee,0);cQ.bezierVertex(ef-eg,ee+d5,0,ef-d6,ee+eb,0,ef,ee+eb,0);cQ.bezierVertex(ef+d6,ee+eb,0,ef+eg,ee+d5,0,ef+eg,ee,0);cQ.endShape();if(aA){var d7=0,ec=0,d9,d8;for(d9=0;d9>16&255;d5[d6+1]=d7>>8&255;d5[d6+2]=d7&255;d5[d6+3]=d7>>24&255;d3.__isDirty=true}}(d2),toArray:function(d3){return function(){var d4=[],d7=d3.imageData.data,d6=d3.width*d3.height;if(d3.isRemote){throw"Image is loaded remotely. Cannot get pixels."}for(var d5=0,d8=0;d5>16&255;d7[d8+1]=d9>>8&255;d7[d8+2]=d9&255;d7[d8+3]=d9>>24&255}d3.__isDirty=true}}(d2)}}var cA=function(d5,d8,d6){this.__isDirty=false;if(d5 instanceof HTMLImageElement){this.fromHTMLImageData(d5)}else{if(d8||d6){this.width=d5||1;this.height=d8||1;var d3=this.sourceImg=u.createElement("canvas");d3.width=this.width;d3.height=this.height;var d9=this.imageData=d3.getContext("2d").createImageData(this.width,this.height);this.format=d6===2||d6===4?d6:1;if(this.format===1){for(var d4=3,d7=this.imageData.data,d2=d7.length;d4=cQ.width||d2<0||d5<0||d5>=cQ.height){return 0}if(dM){var d4=((0|d2)+cQ.width*(0|d5))*4;d3=cQ.imageData.data;return(d3[d4+3]&255)<<24|(d3[d4]&255)<<16|(d3[d4+1]&255)<<8|d3[d4+2]&255}d3=cQ.toImageData(0|d2,0|d5,1,1).data;return(d3[3]&255)<<24|(d3[0]&255)<<16|(d3[1]&255)<<8|d3[2]&255}function c2(d2,d6,d3){if(d3.isRemote){throw"Image is loaded remotely. Cannot get x,y."}var d5=d6*d3.width*4+d2*4,d4=d3.imageData.data;return(d4[d5+3]&255)<<24|(d4[d5]&255)<<16|(d4[d5+1]&255)<<8|d4[d5+2]&255}function c0(d2,d6,d3,d4){var d5=new cA(d3,d4,2);d5.fromImageData(cQ.toImageData(d2,d6,d3,d4));return d5}function cZ(d7,d6,d8,ed,ej){if(ej.isRemote){throw"Image is loaded remotely. Cannot get x,y,w,h."}var eh=new cA(d8,ed,2),d4=eh.imageData.data,d5=ej.width,ee=ej.height,eg=ej.imageData.data;var d2=o.max(0,-d6),d3=o.max(0,-d7),d9=o.min(ed,ee-d6),ea=o.min(d8,d5-d7);for(var ec=d2;ec=0&&d4>=0&&d4bT){M()}}}function bn(d2,d8,d5,d3){if(d3.isRemote){throw"Image is loaded remotely. Cannot set x,y."}var d7=cQ.color.toArray(d5);var d6=d8*d3.width*4+d2*4;var d4=d3.imageData.data;d4[d6]=d7[0];d4[d6+1]=d7[1];d4[d6+2]=d7[2];d4[d6+3]=d7[3]}cQ.set=function(d2,d7,d5,d4){var d3,d6;if(arguments.length===3){if(typeof d5==="number"){bp(d2,d7,d5)}else{if(d5 instanceof cA||d5.__isPImage){cQ.image(d5,d2,d7)}}}else{if(arguments.length===4){bn(d2,d7,d5,d4)}}};cQ.imageData={};cQ.pixels={getLength:function(){return cQ.imageData.data.length?cQ.imageData.data.length/4:0},getPixel:function(d2){var d4=d2*4,d3=cQ.imageData.data;return d3[d4+3]<<24&4278190080|d3[d4+0]<<16&16711680|d3[d4+1]<<8&65280|d3[d4+2]&255},setPixel:function(d2,d5){var d4=d2*4,d3=cQ.imageData.data;d3[d4+0]=(d5&16711680)>>>16;d3[d4+1]=(d5&65280)>>>8;d3[d4+2]=d5&255;d3[d4+3]=(d5&4278190080)>>>24},toArray:function(){var d2=[],d4=cQ.imageData.width*cQ.imageData.height,d5=cQ.imageData.data;for(var d3=0,d6=0;d30){bw(d5,d4,d3,d2)}var d6=cQ.color.toGLArray(aV);dZ.clearColor(d6[0],d6[1],d6[2],d6[3]);dZ.clear(dZ.COLOR_BUFFER_BIT|dZ.DEPTH_BUFFER_BIT)};bJ.prototype.image=function(d5,ea,d8,eb,d6){ea=o.round(ea);d8=o.round(d8);if(d5.width>0){var ec=eb||d5.width;var d9=d6||d5.height;var d2=bc(ea||0,d8||0,eb||d5.width,d6||d5.height,arguments.length<4);var d7=!!d5.sourceImg&&a6===null;if(d7){var d3=d5.sourceImg;if(d5.__isDirty){d5.updatePixels()}dZ.drawImage(d3,0,0,d3.width,d3.height,d2.x,d2.y,d2.w,d2.h)}else{var d4=d5.toImageData();if(a6!==null){a6(d4);d5.__isDirty=true}dZ.drawImage(bq(d4).canvas,0,0,d5.width,d5.height,d2.x,d2.y,d2.w,d2.h)}}};bt.prototype.image=function(d4,d2,d6,d3,d5){if(d4.width>0){d2=o.round(d2);d6=o.round(d6);d3=d3||d4.width;d5=d5||d4.height;cQ.beginShape(cQ.QUADS);cQ.texture(d4);cQ.vertex(d2,d6,0,0,0);cQ.vertex(d2,d6+d5,0,0,d5);cQ.vertex(d2+d3,d6+d5,0,d3,d5);cQ.vertex(d2+d3,d6,0,d3,0);cQ.endShape()}};cQ.tint=function(d5,d4,d2,ea){var d7=cQ.color(d5,d4,d2,ea);var d3=cQ.red(d7)/bB;var d6=cQ.green(d7)/bA;var d8=cQ.blue(d7)/by;var d9=cQ.alpha(d7)/bM;a6=function(ee){var ed=ee.data,ec=4*ee.width*ee.height;for(var eb=0;eb=d2){break}eh=0}for(ep=eh;ep=d2){break}d6=(en+et)*4;ek=d8[ep];ej+=ek*d5[d6+3];d7+=ek*d5[d6];ed+=ek*d5[d6+1];ei+=ek*d5[d6+2];d4+=ek;en++}ef=et+ec;eu[ef]=ej/d4;em[ef]=d7/d4;ev[ef]=ed/d4;d9[ef]=ei/d4}et+=d2}et=0;er=-ee;eq=er*d2;for(eb=0;eb=d3){break}eh=0;ef=er;en=ec+eq}for(ep=eh;ep=d3){break}ek=d8[ep];ej+=ek*eu[en];d7+=ek*em[en];ed+=ek*ev[en];ei+=ek*d9[en];d4+=ek;ef++;en+=d2}d6=(ec+et)*4;d5[d6]=d7/d4;d5[d6+1]=ed/d4;d5[d6+2]=ei/d4;d5[d6+3]=ej/d4}et+=d2;eq+=d2;er++}};var b9=function(ej,ed){var d9=0;var en=ed.pixels.getLength();var ee=new m(en);var eh,d3,ec,eb,d5;var ei,d6,d8,ea,d4,ef,em,d2,ek,d7,el,eg;if(!ej){while(d9=d3){ei=d9}if(d8<0){d8=0}if(ea>=en){ea=d9}em=ed.pixels.getPixel(d8);ef=ed.pixels.getPixel(d6);d2=ed.pixels.getPixel(ea);d4=ed.pixels.getPixel(ei);d5=77*(ec>>16&255)+151*(ec>>8&255)+28*(ec&255);d7=77*(ef>>16&255)+151*(ef>>8&255)+28*(ef&255);ek=77*(d4>>16&255)+151*(d4>>8&255)+28*(d4&255);el=77*(em>>16&255)+151*(em>>8&255)+28*(em&255);eg=77*(d2>>16&255)+151*(d2>>8&255)+28*(d2&255);if(d7>d5){eb=ef;d5=d7}if(ek>d5){eb=d4;d5=ek}if(el>d5){eb=em;d5=el}if(eg>d5){eb=d2;d5=eg}ee[d9++]=eb}}}else{while(d9=d3){ei=d9}if(d8<0){d8=0}if(ea>=en){ea=d9}em=ed.pixels.getPixel(d8);ef=ed.pixels.getPixel(d6);d2=ed.pixels.getPixel(ea);d4=ed.pixels.getPixel(ei);d5=77*(ec>>16&255)+151*(ec>>8&255)+28*(ec&255);d7=77*(ef>>16&255)+151*(ef>>8&255)+28*(ef&255);ek=77*(d4>>16&255)+151*(d4>>8&255)+28*(d4&255);el=77*(em>>16&255)+151*(em>>8&255)+28*(em&255);eg=77*(d2>>16&255)+151*(d2>>8&255)+28*(d2&255);if(d7>16&255)+151*(d7>>8&255)+28*(d7&255)>>8;ec.pixels.setPixel(eb,d7&4278190080|d3<<16|d3<<8|d3)}}break;case 13:for(eb=0;eb255){throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)"}var ea=eh-1;for(eb=0;eb>16&255;var ef=ec.pixels.getPixel(eb)>>8&255;var d4=ec.pixels.getPixel(eb)&255;d2=(d2*eh>>8)*255/ea;ef=(ef*eh>>8)*255/ea;d4=(d4*eh>>8)*255/ea;ec.pixels.setPixel(eb,4278190080&ec.pixels.getPixel(eb)|d2<<16|ef<<8|d4)}break;case 14:for(eb=0;eb1){throw"Level must be between 0 and 1 for filter(THRESHOLD, level)"}var d6=cQ.floor(d8*255);for(eb=0;eb>16,cQ.max((ec.pixels.getPixel(eb)&65280)>>8,ec.pixels.getPixel(eb)&255));ec.pixels.setPixel(eb,ec.pixels.getPixel(eb)&4278190080|(eged){d2=ed}}else{var ec=ed+d4-ef;if(d2>ec){d2=ec}}if(d8d6){d9=d6}}else{var d5=d6+eb-d8;if(d9>d5){d9=d5}}return !(d2<=0||d9<=0)};var dJ={};dJ[1]=cQ.modes.blend;dJ[2]=cQ.modes.add;dJ[4]=cQ.modes.subtract;dJ[8]=cQ.modes.lightest;dJ[16]=cQ.modes.darkest;dJ[0]=cQ.modes.replace;dJ[32]=cQ.modes.difference;dJ[64]=cQ.modes.exclusion;dJ[128]=cQ.modes.multiply;dJ[256]=cQ.modes.screen;dJ[512]=cQ.modes.overlay;dJ[1024]=cQ.modes.hard_light;dJ[2048]=cQ.modes.soft_light;dJ[4096]=cQ.modes.dodge;dJ[8192]=cQ.modes.burn;cQ.blit_resize=function(ef,er,el,eq,ek,ew,eb,ej,ep,eg,eo,ee,eh){var eu,et;if(er<0){er=0}if(el<0){el=0}if(eq>=ef.width){eq=ef.width-1}if(ek>=ef.height){ek=ef.height-1}var eA=eq-er;var eF=ek-el;var d2=eo-ep;var ec=ee-eg;if(d2<=0||ec<=0||eA<=0||eF<=0||ep>=eb||eg>=ej||er>=ef.width||el>=ef.height){return}var d9=o.floor(eA/d2*32768);var d6=o.floor(eF/ec*32768);var ey=cQ.shared;ey.srcXOffset=o.floor(ep<0?-ep*d9:er*32768);ey.srcYOffset=o.floor(eg<0?-eg*d6:el*32768);if(ep<0){d2+=ep;ep=0}if(eg<0){ec+=eg;eg=0}d2=o.min(d2,eb-ep);ec=o.min(ec,ej-eg);var em=eg*eb+ep;var eI;ey.srcBuffer=ef.imageData.data;ey.iw=ef.width;ey.iw1=ef.width-1;ey.ih1=ef.height-1;var en=cQ.filter_bilinear,eC=cQ.filter_new_scanline,ea=dJ[eh],ez,eE,ex,eB,d4,d5,d3=4278190080,eD=16711680,es=65280,d8=255,eH=32767,ev=15,ed=1,ei=9,d7=ey.srcBuffer,eG=o.min;for(et=0;et>ev)*ey.iw;ey.v2=eG((ey.srcYOffset>>ev)+1,ey.ih1)*ey.iw;for(eu=0;eu>ev;ey.ll=ey.ifU*ey.fracV>>ev;ey.ur=ey.fracU*ey.ifV>>ev;ey.lr=ey.fracU*ey.fracV>>ev;ey.u1=ey.sX>>ev;ey.u2=eG(ey.u1+1,ey.iw1);ex=(ey.v1+ey.u1)*4;eB=(ey.v1+ey.u2)*4;d4=(ey.v2+ey.u1)*4;d5=(ey.v2+ey.u2)*4;ey.cUL=d7[ex+3]<<24&d3|d7[ex]<<16&eD|d7[ex+1]<<8&es|d7[ex+2]&d8;ey.cUR=d7[eB+3]<<24&d3|d7[eB]<<16&eD|d7[eB+1]<<8&es|d7[eB+2]&d8;ey.cLL=d7[d4+3]<<24&d3|d7[d4]<<16&eD|d7[d4+1]<<8&es|d7[d4+2]&d8;ey.cLR=d7[d5+3]<<24&d3|d7[d5]<<16&eD|d7[d5+1]<<8&es|d7[d5+2]&d8;ey.r=ey.ul*((ey.cUL&eD)>>16)+ey.ll*((ey.cLL&eD)>>16)+ey.ur*((ey.cUR&eD)>>16)+ey.lr*((ey.cLR&eD)>>16)<>>ev&es;ey.b=ey.ul*(ey.cUL&d8)+ey.ll*(ey.cLL&d8)+ey.ur*(ey.cUR&d8)+ey.lr*(ey.cLR&d8)>>>ev;ey.a=ey.ul*((ey.cUL&d3)>>>24)+ey.ll*((ey.cLL&d3)>>>24)+ey.ur*((ey.cUR&d3)>>>24)+ey.lr*((ey.cLR&d3)>>>24)<>>16;ew[eE+1]=(ez&es)>>>8;ew[eE+2]=ez&d8;ew[eE+3]=(ez&d3)>>>24;ey.sX+=d9}em+=eb;ey.srcYOffset+=d6}};cQ.loadFont=function(d3,d4){if(d3===c){throw"font name required in loadFont."}if(d3.indexOf(".svg")===-1){if(d4===c){d4=P.size}return f.get(d3,d4)}var d2=cQ.loadGlyphs(d3);return{name:d3,css:"12px sans-serif",glyph:true,units_per_em:d2.units_per_em,horiz_adv_x:1/d2.units_per_em*d2.horiz_adv_x,ascent:d2.ascent,descent:d2.descent,width:function(d9){var d7=0;var d5=d9.length;for(var d6=0;d6":return d2.greater;case"?":return d2.question;case"@":return d2.at;case"[":return d2.bracketleft;case"\\":return d2.backslash;case"]":return d2.bracketright;case"^":return d2.asciicircum;case"`":return d2.grave;case"{":return d2.braceleft;case"|":return d2.bar;case"}":return d2.braceright;case"~":return d2.asciitilde;default:return d2[d3]}}catch(d4){B.debug(d4)}};bJ.prototype.text$line=function(ea,ed,ec,eb,d7){var d9=0,d8=0;if(!P.glyph){if(ea&&"fillText" in dZ){if(ak){dZ.fillStyle=cQ.color.toString(aS);ak=false}if(d7===39||d7===3){d9=P.measureTextWidth(ea);if(d7===39){d8=-d9}else{d8=-d9/2}}dZ.fillText(ea,ed+d8,ec)}}else{var d2=cQ.glyphTable[R];ax();dZ.translate(ed,ec+dR);if(d7===39||d7===3){d9=d2.width(ea);if(d7===39){d8=-d9}else{d8=-d9/2}}var ee=d2.units_per_em,d6=1/ee*dR;dZ.scale(d6,d6);for(var d3=0,d4=ea.length;d3ef){return}var ee=-1;var d6=0;var d2=0;var d8=[];for(var d7=0,ek=ei.length;d70){ee=d7}else{return}}if(d9==="\n"){d8.push({text:ei.substring(d6,d7),width:d2});d6=d7+1}else{d8.push({text:ei.substring(d6,ee+1),width:d2});d6=ee+1}d2=0;d7=d6-1}}if(d6ef-ds){break}d5=d8[d4];dP.text$line(d5.text,ed+em,ec+ea+el,eb,G)}}cQ.text=function(){if(cC===5){return}if(arguments.length===3){a9(bm(arguments[0]),arguments[1],arguments[2],0)}else{if(arguments.length===4){a9(bm(arguments[0]),arguments[1],arguments[2],arguments[3])}else{if(arguments.length===5){a4(bm(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0)}else{if(arguments.length===6){a4(bm(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}}}}};cQ.textMode=function(d2){cC=d2};cQ.loadGlyphs=function(d8){var ea,d9,d6,d4,eh,eg,ef,ei,ec,ej,ed,ee="[0-9\\-]+",eb;var d7=function(ep,eo){var em=0,el=[],ek,en=new RegExp(ep,"g");ek=el[em]=en.exec(eo);while(ek){em++;ek=el[em]=en.exec(eo)}return el};var d3=function(ep){var eq=d7("[A-Za-z][0-9\\- ]+|Z",ep);var eo=function(){ax();return dP.$ensureContext()};var em=function(){bf();c7();cJ()};eb="return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();";ea=0;d9=0;d6=0;d4=0;eh=0;eg=0;ep=0;ei=0;ec="";ej=eq.length-1;for(var el=0;elaz){ay=az-aA}}au.height=ay/az*100+"%";ai()},ar=[ac(ah,"mousemove",function(ay){if(aw){at(W.innerHeight-ay.clientY);am.scrollTop=aj}}),ac(ah,"mouseup",function(){if(aw){aw=aj=G}}),ac(av,"dblclick",function(ay){ay.preventDefault();if(an){at(an);an=G}else{an=ak.clientHeight;au.height="0px"}}),ac(av,"mousedown",function(ay){ay.preventDefault();aw=L;aj=am.scrollTop}),ac(av,"contextmenu",function(){aw=G}),ac(al,"click",function(){ao()})];ao=function(){var ay=ar.length;while(ay--){O.apply(M,ar[ay])}ae.removeChild(ak);N.paddingBottom=ap;T(am);T(ak);M[I]=Q};P(ak,U,am,X,av,ab,al,ag);al[Z]="Close Log";ad(al,S("\u2716"));av[Z]="Double-click to toggle log minimization";ae.insertBefore(ak,ae.firstChild);M[I]=function(aA){if(aq===H){am.removeChild(am.firstChild)}else{aq++}var az=ad(am,aa(af)),ay=ad(az,aa(af));az[Z]=(new Date).toLocaleTimeString();P(az,R,ay,Y);ad(ay,S(aA));am.scrollTop=am.scrollHeight};M[I](ax);ai()}})()}else{if(typeof print===K){M[I]=print}}}return M}();B.logger=E;B.version="1.3.6-API";B.lib={};B.registerLibrary=function(G,H){B.lib[G]=H;if(H.hasOwnProperty("init")){H.init(b)}};B.instances=z;B.getInstanceById=function(G){return z[g[G]]};B.Sketch=function(G){this.attachFunction=G;this.options={pauseOnBlur:false,globalKeyEvents:false};this.onLoad=h;this.onSetup=h;this.onPause=h;this.onLoop=h;this.onFrameStart=h;this.onFrameEnd=h;this.onExit=h;this.params={};this.imageCache={pending:0,images:{},operaCache:{},add:function(I,H){if(this.images[I]){return}if(!F){this.images[I]=null}if(!H){H=new Image;H.onload=function(K){return function(){K.pending--}}(this);this.pending++;H.src=I}this.images[I]=H;if(l.opera){var J=u.createElement("div");J.appendChild(H);J.style.position="absolute";J.style.opacity=0;J.style.width="1px";J.style.height="1px";if(!this.operaCache[I]){u.body.appendChild(J);this.operaCache[I]=J}}}};this.sourceCode=undefined;this.attach=function(I){if(typeof this.attachFunction==="function"){this.attachFunction(I)}else{if(this.sourceCode){var H=(new Function("return ("+this.sourceCode+");"))();H(I);this.attachFunction=H}else{throw"Unable to attach sketch to the processing instance"}}}};if(F){l.Processing=B}else{this.Processing=B}})(window,window.document,Math);