/***
P R O C E S S I N G . J S - 1.4.1
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(D,d,q,t){var G=function(){};var s=function(){if("console" in D){return function(N){D.console.log("Processing.js: "+N)}}return G}();var w=function(N){var O=new XMLHttpRequest;O.open("GET",N,false);if(O.overrideMimeType){O.overrideMimeType("text/plain")}O.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");O.send(null);if(O.status!==200&&O.status!==0){throw"XMLHttpRequest failed, status code "+O.status}return O.responseText};var n="document" in this&&!("fake" in this.document);d.head=d.head||d.getElementsByTagName("head")[0];function C(N,O){if(N in D){return D[N]}if(typeof D[O]==="function"){return D[O]}return function(Q){if(Q instanceof Array){return Q}if(typeof Q==="number"){var P=[];P.length=Q;return P}}}if(d.documentMode>=9&&!d.doctype){throw"The doctype directive is missing. The recommended doctype in Internet Explorer is the HTML5 doctype: "}var e=C("Float32Array","WebGLFloatArray"),K=C("Int32Array","WebGLIntArray"),y=C("Uint16Array","WebGLUnsignedShortArray"),b=C("Uint8Array","WebGLUnsignedByteArray");var B={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:q.PI,TWO_PI:2*q.PI,HALF_PI:q.PI/2,THIRD_PI:q.PI/3,QUARTER_PI:q.PI/4,DEG_TO_RAD:q.PI/180,RAD_TO_DEG:180/q.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 h(P){if(typeof P==="string"){var O=0;for(var N=0;N
0?P:0}}this.get=function(R){return Q[R]};this.contains=function(R){return this.indexOf(R)>-1};this.indexOf=function(T){for(var S=0,R=Q.length;S=0;--R){if(r(S,Q[R])){return R}}return -1};this.add=function(){if(arguments.length===1){Q.push(arguments[0])}else{if(arguments.length===2){var R=arguments[0];if(typeof R==="number"){if(R>=0&&R<=Q.length){Q.splice(R,0,arguments[1])}else{throw R+" is not a valid index"}}else{throw typeof R+" is not a number"}}else{throw"Please use the proper number of parameters."}}};this.addAll=function(S,R){var T;if(typeof S==="number"){if(S<0||S>Q.length){throw"Index out of bounds for addAll: "+S+" greater or equal than "+Q.length}T=new o(R);while(T.hasNext()){Q.splice(S++,0,T.next())}}else{T=new o(S);while(T.hasNext()){Q.push(T.next())}}};this.set=function(){if(arguments.length===2){var R=arguments[0];if(typeof R==="number"){if(R>=0&&R-1){Q.splice(R,1);return true}return false};this.removeAll=function(V){var S,R,U,T=new N;T.addAll(this);this.clear();for(S=0,R=0;S0?arguments[0]:16;var X=arguments.length>1?arguments[1]:0.75;var Q=[];Q.length=W;var S=0;var O=this;function U(Z){var Y=h(Z)%Q.length;return Y<0?Q.length+Y:Y}function R(){if(S<=X*Q.length){return}var ab=[];for(var aa=0;aa=Q.length){ab=true}else{if(Q[Y]===t||ac>=Q[Y].length){ac=-1;++Y}else{return}}}}this.hasNext=function(){return !ab};this.next=function(){aa=ad(Q[Y][ac]);Z();return aa};this.remove=function(){if(aa!==t){ae(aa);--ac;Z()}};Z()}function V(Y,Z,aa){this.clear=function(){O.clear()};this.contains=function(ab){return Z(ab)};this.containsAll=function(ac){var ab=ac.iterator();while(ab.hasNext()){if(!this.contains(ab.next())){return false}}return true};this.isEmpty=function(){return O.isEmpty()};this.iterator=function(){return new P(Y,aa)};this.remove=function(ab){if(this.contains(ab)){aa(ab);return true}return false};this.removeAll=function(ae){var ab=ae.iterator();var ad=false;while(ab.hasNext()){var ac=ab.next();if(this.contains(ac)){aa(ac);ad=true}}return true};this.retainAll=function(af){var ad=this.iterator();var ac=[];while(ad.hasNext()){var ae=ad.next();if(!af.contains(ae)){ac.push(ae)}}for(var ab=0;ab0};this.size=function(){return O.size()};this.toArray=function(){var ab=[];var ac=this.iterator();while(ac.hasNext()){ab.push(ac.next())}return ab}}function T(Y){this._isIn=function(Z){return Z===O&&Y.removed===t};this.equals=function(Z){return r(Y.key,Z.getKey())};this.getKey=function(){return Y.key};this.getValue=function(){return Y.value};this.hashCode=function(Z){return h(Y.key)};this.setValue=function(aa){var Z=Y.value;Y.value=aa;return Z}}this.clear=function(){S=0;Q=[];Q.length=W};this.clone=function(){var Y=new N;Y.putAll(this);return Y};this.containsKey=function(aa){var Y=U(aa);var ab=Q[Y];if(ab===t){return false}for(var Z=0;Z1){ac.splice(Z,1)}else{Q[Y]=t}return ab}}return null};this.removeByValue=function(aa){var ac,Z,Y,ab;for(ac in Q){if(Q.hasOwnProperty(ac)){for(Z=0,Y=Q[ac].length;Z0){this.div(Q)}},limit:function(Q){if(this.mag()>Q){this.normalize();this.mult(Q)}},heading2D:function(){return -q.atan2(-this.y,this.x)},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};function O(Q){return function(T,S){var R=T.get();R[Q](S);return R}}for(var P in N.prototype){if(N.prototype.hasOwnProperty(P)&&!N.hasOwnProperty(P)){N[P]=O(P)}}return N}();function M(){}M.prototype=B;var g=new M;g.ArrayList=f;g.HashMap=x;g.PVector=A;g.ObjectIterator=o;g.PConstants=B;g.defineProperty=function(O,N,P){if("defineProperty" in Object){Object.defineProperty(O,N,P)}else{if(P.hasOwnProperty("get")){O.__defineGetter__(N,P.get)}if(P.hasOwnProperty("set")){O.__defineSetter__(N,P.set)}}};function m(O,N,R){if(!O.hasOwnProperty(N)||typeof O[N]!=="function"){O[N]=R;return}var Q=O[N];if("$overloads" in Q){Q.$defaultOverload=R;return}if(!("$overloads" in R)&&Q.length===R.length){return}var T,P;if("$overloads" in R){T=R.$overloads.slice(0);T[Q.length]=Q;P=R.$defaultOverload}else{T=[];T[R.length]=R;T[Q.length]=Q;P=Q}var S=function(){var U=S.$overloads[arguments.length]||("$methodArgsIndex" in S&&arguments.length>S.$methodArgsIndex?S.$overloads[S.$methodArgsIndex]:null)||S.$defaultOverload;return U.apply(this,arguments)};S.$overloads=T;if("$methodArgsIndex" in R){S.$methodArgsIndex=R.$methodArgsIndex}S.$defaultOverload=P;S.name=N;O[N]=S}function i(Q,P){function R(S){g.defineProperty(Q,S,{get:function(){return P[S]},set:function(T){P[S]=T},enumerable:true})}var O=[];for(var N in P){if(typeof P[N]==="function"){m(Q,N,P[N])}else{if(N.charAt(0)!=="$"&&!(N in Q)){O.push(N)}}}while(O.length>0){R(O.shift())}Q.$super=P}g.extendClassChain=function(O){var P=[O];for(var N=O.$upcast;N;N=N.$upcast){i(N,O);P.push(N);O=N}while(P.length>0){P.pop().$self=O}};g.extendStaticMembers=function(N,O){i(N,O)};g.extendInterfaceMembers=function(N,O){i(N,O)};g.addMethod=function(Q,P,S,R){var N=Q[P];if(N||R){var O=S.length;if("$overloads" in N){N.$overloads[O]=S}else{var T=function(){var V=T.$overloads[arguments.length]||("$methodArgsIndex" in T&&arguments.length>T.$methodArgsIndex?T.$overloads[T.$methodArgsIndex]:null)||T.$defaultOverload;return V.apply(this,arguments)};var U=[];if(N){U[N.length]=N}U[O]=S;T.$overloads=U;T.$defaultOverload=N||S;if(R){T.$methodArgsIndex=O}T.name=P;Q[P]=T}}else{Q[P]=S}};function l(N){if(typeof N!=="string"){return false}return["byte","int","char","color","float","long","double"].indexOf(N)!==-1}g.createJavaArray=function(S,T){var O=null,P=null;if(typeof S==="string"){if(S==="boolean"){P=false}else{if(l(S)){P=0}}}if(typeof T[0]==="number"){var N=0|T[0];if(T.length<=1){O=[];O.length=N;for(var R=0;R"+ac;d.body.appendChild(T);var U=N.width,ab=N.height,V=ab/2;Y.fillStyle="white";Y.fillRect(0,0,U,ab);Y.fillStyle="black";Y.fillText(ac,0,V);var P=Y.getImageData(0,0,U,ab).data;var Z=0,S=U*4,aa=P.length;while(++Z0&&P[Z]===255){G()}var ad=q.round(Z/S);X.ascent=ae*(V-R);X.descent=ae*(ad-V);if(d.defaultView.getComputedStyle){var O=d.defaultView.getComputedStyle(T,null).getPropertyValue("height");O=ae*O.replace("px","");if(O>=X.size*2){X.leading=q.round(O/2)}}d.body.removeChild(T);if(X.caching){return Y}}function H(N,O){if(N===t){N=""}this.name=N;if(O===t){O=0}this.size=O;this.glyph=false;this.ascent=0;this.descent=0;this.leading=1.2*O;var R=N.indexOf(" Italic Bold");if(R!==-1){N=N.substring(0,R)}this.style="normal";var Q=N.indexOf(" Italic");if(Q!==-1){N=N.substring(0,Q);this.style="italic"}this.weight="normal";var P=N.indexOf(" Bold");if(P!==-1){N=N.substring(0,P);this.weight="bold"}this.family="sans-serif";if(N!==t){switch(N){case"sans-serif":case"serif":case"monospace":case"fantasy":case"cursive":this.family=N;break;default:this.family='"'+N+'", sans-serif';break}}this.context2d=p(this);this.css=this.getCSSDefinition();if(this.context2d){this.context2d.font=this.css}}H.prototype.caching=true;H.prototype.getCSSDefinition=function(P,N){if(P===t){P=this.size+"px"}if(N===t){N=this.leading+"px"}var O=[this.style,"normal",this.weight,P+"/"+N,this.family];return O.join(" ")};H.prototype.measureTextWidth=function(N){return this.context2d.measureText(N).width};H.prototype.measureTextWidthFallback=function(P){var O=d.createElement("canvas"),N=O.getContext("2d");N.font=this.css;return N.measureText(P).width};H.PFontCache={length:0};H.get=function(Q,R){R=(R*10+0.5|0)/10;var O=H.PFontCache,N=Q+"/"+R;if(!O[N]){O[N]=new H(Q,R);O.length++;if(O.length===50){H.prototype.measureTextWidth=H.prototype.measureTextWidthFallback;H.prototype.caching=false;var P;for(P in O){if(P!=="length"){O[P].context2d=null}}return new H(Q,R)}if(O.length===400){H.PFontCache={};H.get=H.getFallback;return new H(Q,R)}}return O[N]};H.getFallback=function(N,O){return new H(N,O)};H.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]};H.preloading={template:{},initialized:false,initialize:function(){var P=function(){var R="#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 Q=function(S){return"AAAAAAAA".substr(~~S?7-S:6)};return R.replace(/[#237]/g,Q)};var N=d.createElement("style");N.setAttribute("type","text/css");N.innerHTML='@font-face {\n font-family: "PjsEmptyFont";\n src: url(\'data:application/x-font-ttf;base64,'+P()+"')\n format('truetype');\n}";d.head.appendChild(N);var O=d.createElement("span");O.style.cssText='position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;';O.innerHTML="AAAAAAAA";d.body.appendChild(O);this.template=O;this.initialized=true},getElementWidth:function(N){return d.defaultView.getComputedStyle(N,"").getPropertyValue("width")},timeAttempted:0,pending:function(R){if(!this.initialized){this.initialize()}var P,N,Q=this.getElementWidth(this.template);for(var O=0;O 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 = pow( nDotHV, uShininess ); } spec += uSpecular * powerFactor * attenuation; col += light.color * nDotVP * attenuation;}void main(void) { vec3 finalAmbient = vec3( 0.0 ); vec3 finalDiffuse = vec3( 0.0 ); vec3 finalSpecular = vec3( 0.0 ); vec4 col = uColor; if ( uColor[0] == -1.0 ){ col = aColor; } vec3 norm = normalize(vec3( uNormalTransform * vec4( aNormal, 0.0 ) )); vec4 ecPos4 = uView * uModel * vec4(aVertex, 1.0); vec3 ecPos = (vec3(ecPos4))/ecPos4.w; if( uLightCount == 0 ) { vFrontColor = col + vec4(uMaterialSpecular, 1.0); } else { for( int i = 0; i < 8; i++ ) { Light l = getLight(i); if( i >= uLightCount ){ 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( uUsingMat == false ) { vFrontColor = vec4( vec3( col ) * finalAmbient + vec3( col ) * finalDiffuse + vec3( col ) * finalSpecular, col[3] ); } else{ vFrontColor = vec4( uMaterialEmissive + (vec3(col) * uMaterialAmbient * finalAmbient ) + (vec3(col) * finalDiffuse) + (uMaterialSpecular * finalSpecular), col[3] ); } } vTexture.xy = aTexture.xy; gl_Position = uProjection * uView * uModel * vec4( aVertex, 1.0 );}";var aF="#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform sampler2D uSampler;uniform bool uUsingTexture;varying vec2 vTexture;void main(void){ if( uUsingTexture ){ gl_FragColor = vec4(texture2D(uSampler, vTexture.xy)) * vFrontColor; } else{ gl_FragColor = vFrontColor; }}";function d2(ec,eb,ee,ed){var ea=dC.locations[ec];if(ea===t){ea=d8.getUniformLocation(eb,ee);dC.locations[ec]=ea}if(ea!==null){if(ed.length===4){d8.uniform4fv(ea,ed)}else{if(ed.length===3){d8.uniform3fv(ea,ed)}else{if(ed.length===2){d8.uniform2fv(ea,ed)}else{d8.uniform1f(ea,ed)}}}}}function dZ(ec,eb,ee,ed){var ea=dC.locations[ec];if(ea===t){ea=d8.getUniformLocation(eb,ee);dC.locations[ec]=ea}if(ea!==null){if(ed.length===4){d8.uniform4iv(ea,ed)}else{if(ed.length===3){d8.uniform3iv(ea,ed)}else{if(ed.length===2){d8.uniform2iv(ea,ed)}else{d8.uniform1i(ea,ed)}}}}}function a9(ee,ec,ef,ed,eb){var ea=dC.locations[ee];if(ea===t){ea=d8.getUniformLocation(ec,ef);dC.locations[ee]=ea}if(ea!==-1){if(eb.length===16){d8.uniformMatrix4fv(ea,ed,eb)}else{if(eb.length===9){d8.uniformMatrix3fv(ea,ed,eb)}else{d8.uniformMatrix2fv(ea,ed,eb)}}}}function dc(ee,ec,ef,eb,ed){var ea=dC.attributes[ee];if(ea===t){ea=d8.getAttribLocation(ec,ef);dC.attributes[ee]=ea}if(ea!==-1){d8.bindBuffer(d8.ARRAY_BUFFER,ed);d8.vertexAttribPointer(ea,eb,d8.FLOAT,false,0,0);d8.enableVertexAttribArray(ea)}}function cg(ec,eb,ed){var ea=dC.attributes[ec];if(ea===t){ea=d8.getAttribLocation(eb,ed);dC.attributes[ec]=ea}if(ea!==-1){d8.disableVertexAttribArray(ea)}}var bF=function(ec,ee,eb){var ef=ec.createShader(ec.VERTEX_SHADER);ec.shaderSource(ef,ee);ec.compileShader(ef);if(!ec.getShaderParameter(ef,ec.COMPILE_STATUS)){throw ec.getShaderInfoLog(ef)}var ed=ec.createShader(ec.FRAGMENT_SHADER);ec.shaderSource(ed,eb);ec.compileShader(ed);if(!ec.getShaderParameter(ed,ec.COMPILE_STATUS)){throw ec.getShaderInfoLog(ed)}var ea=ec.createProgram();ec.attachShader(ea,ef);ec.attachShader(ea,ed);ec.linkProgram(ea);if(!ec.getProgramParameter(ea,ec.LINK_STATUS)){throw"Error linking shaders."}return ea};var aZ=function(ea,ee,eb,ed,ec){return{x:ea,y:ee,w:eb,h:ed}};var bk=aZ;var b1=function(ea,ee,eb,ed,ec){return{x:ea,y:ee,w:ec?eb:eb-ea,h:ec?ed:ed-ee}};var aN=function(ea,ee,eb,ed,ec){return{x:ea-eb/2,y:ee-ed/2,w:eb,h:ed}};var ds=function(){};var bR=function(){};var bB=function(){};var ca=function(){};bR.prototype=new ds;bR.prototype.constructor=bR;bB.prototype=new ds;bB.prototype.constructor=bB;ca.prototype=new ds;ca.prototype.constructor=ca;ds.prototype.a3DOnlyFunction=G;var cl={};var bP=cW.Character=function(ea){if(typeof ea==="string"&&ea.length===1){this.code=ea.charCodeAt(0)}else{if(typeof ea==="number"){this.code=ea}else{if(ea instanceof bP){this.code=ea}else{this.code=NaN}}}return cl[this.code]===t?cl[this.code]=this:cl[this.code]};bP.prototype.toString=function(){return String.fromCharCode(this.code)};bP.prototype.valueOf=function(){return this.code};var O=cW.PShape=function(ea){this.family=ea||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};O.prototype={isVisible:function(){return this.visible},setVisible:function(ea){this.visible=ea},disableStyle:function(){this.style=false;for(var eb=0,ea=this.children.length;eb0){for(eb=0,ea=this.nameTable.length;eb, it's <"+this.element.getName()+">"}}else{if(arguments.length===2){if(typeof arguments[1]==="string"){if(arguments[1].indexOf(".svg")>-1){this.element=new cW.XMLElement(cW,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 ea=this.element.getStringAttribute("display","inline");this.visible=ea!=="none";var ef=this.element.getAttribute("transform");if(ef){this.matrix=this.parseMatrix(ef)}var ec=this.element.getStringAttribute("viewBox");if(ec!==null){var ee=ec.split(" ");this.width=ee[2];this.height=ee[3]}var eb=this.element.getStringAttribute("width");var ed=this.element.getStringAttribute("height");if(eb!==null){this.width=this.parseUnitSize(eb);this.height=this.parseUnitSize(ed)}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)};cr.prototype=new O;cr.prototype.parseMatrix=function(){function ea(ec){var eb=[];ec.replace(/\((.*?)\)/,function(){return function(ed,ee){eb=ee.replace(/,+/g," ").split(/\s+/)}}());return eb}return function(ei){this.checkMatrix(2);var eb=[];ei.replace(/\s*(\w+)\((.*?)\)/g,function(el){eb.push(cW.trim(el))});if(eb.length===0){return null}for(var eg=0,ee=eb.length;eg=65&&et<=90||et>=97&&et<=122){eu=ex;ex++;if(ex=65&&et<=90||et>=97&&et<=100||et>=102&&et<=122)&&ew===false){if(et===32){if(er!==""){ev.push(parseFloat(er));er=""}ex++}else{if(et===45){if(ey[ex-1].valueOf()===101){er+=ey[ex].toString();ex++}else{if(er!==""){ev.push(parseFloat(er))}er=ey[ex].toString();ex++}}else{er+=ey[ex].toString();ex++}}if(ex===ey.length){ew=true}else{et=ey[ex].valueOf()}}}if(er!==""){ev.push(parseFloat(er));er=""}ee=ey[eu];et=ee.valueOf();if(et===77){if(ev.length>=2&&ev.length%2===0){ed=ev[0];ec=ev[1];this.parsePathMoveto(ed,ec);if(ev.length>2){for(eu=2,es=ev.length;eu=2&&ev.length%2===0){ed+=ev[0];ec+=ev[1];this.parsePathMoveto(ed,ec);if(ev.length>2){for(eu=2,es=ev.length;eu=2&&ev.length%2===0){for(eu=0,es=ev.length;eu=2&&ev.length%2===0){for(eu=0,es=ev.length;eu=6&&ev.length%6===0){for(eu=0,es=ev.length;eu=6&&ev.length%6===0){for(eu=0,es=ev.length;eu=4&&ev.length%4===0){for(eu=0,es=ev.length;eu=4&&ev.length%4===0){for(eu=0,es=ev.length;eu=4&&ev.length%4===0){for(eu=0,es=ev.length;eu=4&&ev.length%4===0){for(eu=0,es=ev.length;eu=2&&ev.length%2===0){for(eu=0,es=ev.length;eu=2&&ev.length%2===0){for(eu=0,es=ev.length;eu0){this.parsePathCode(1);this.parsePathVertex(ec+(ea-ec)*2/3,ee+(ef-ee)*2/3);this.parsePathVertex(eb+(ea-eb)*2/3,ed+(ef-ed)*2/3);this.parsePathVertex(eb,ed)}else{throw"Path must start with M/m"}};cr.prototype.parsePathCurveto=function(ed,ef,eb,ee,ea,ec){if(this.vertices.length>0){this.parsePathCode(1);this.parsePathVertex(ed,ef);this.parsePathVertex(eb,ee);this.parsePathVertex(ea,ec)}else{throw"Path must start with M/m"}};cr.prototype.parsePathLineto=function(eb,ea){if(this.vertices.length>0){this.parsePathCode(0);this.parsePathVertex(eb,ea);this.vertices[this.vertices.length-1]["moveTo"]=false}else{throw"Path must start with M/m"}};cr.prototype.parsePathMoveto=function(eb,ea){if(this.vertices.length>0){this.parsePathCode(3)}this.parsePathCode(0);this.parsePathVertex(eb,ea);this.vertices[this.vertices.length-1]["moveTo"]=true};cr.prototype.parsePathVertex=function(ea,ec){var eb=[];eb[0]=ea;eb[1]=ec;this.vertices.push(eb)};cr.prototype.parsePathCode=function(ea){this.vertexCodes.push(ea)};cr.prototype.parsePoly=function(ee){this.family=21;this.close=ee;var eb=cW.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(eb!==null){var ea=eb.split(" ");if(ea.length%2===0){for(var ed=0,ec=ea.length;ed"}};cr.prototype.parseEllipse=function(ec){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 eb,ea;if(ec){eb=ea=this.element.getFloatAttribute("r");if(eb<0){throw"svg error: negative radius found while parsing "}}else{eb=this.element.getFloatAttribute("rx");ea=this.element.getFloatAttribute("ry");if(eb<0||ea<0){throw"svg error: negative x-axis radius or y-axis radius found while parsing "}}this.params[0]-=eb;this.params[1]-=ea;this.params[2]=eb*2;this.params[3]=ea*2};cr.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")};cr.prototype.parseColors=function(ec){if(ec.hasAttribute("opacity")){this.setOpacity(ec.getAttribute("opacity"))}if(ec.hasAttribute("stroke")){this.setStroke(ec.getAttribute("stroke"))}if(ec.hasAttribute("stroke-width")){this.setStrokeWeight(ec.getAttribute("stroke-width"))}if(ec.hasAttribute("stroke-linejoin")){this.setStrokeJoin(ec.getAttribute("stroke-linejoin"))}if(ec.hasAttribute("stroke-linecap")){this.setStrokeCap(ec.getStringAttribute("stroke-linecap"))}if(ec.hasAttribute("fill")){this.setFill(ec.getStringAttribute("fill"))}if(ec.hasAttribute("style")){var ef=ec.getStringAttribute("style");var ed=ef.toString().split(";");for(var eb=0,ea=ed.length;eb=1&&arguments[0]!==null){if(ec.isVisible()){cW.pushMatrix();if(S===3){if(arguments.length===5){cW.translate(eb-ed/2,ee-ea/2);cW.scale(ed/ec.getWidth(),ea/ec.getHeight())}else{if(arguments.length===3){cW.translate(eb-ec.getWidth()/2,-ec.getHeight()/2)}else{cW.translate(-ec.getWidth()/2,-ec.getHeight()/2)}}}else{if(S===0){if(arguments.length===5){cW.translate(eb,ee);cW.scale(ed/ec.getWidth(),ea/ec.getHeight())}else{if(arguments.length===3){cW.translate(eb,ee)}}}else{if(S===1){if(arguments.length===5){ed-=eb;ea-=ee;cW.translate(eb,ee);cW.scale(ed/ec.getWidth(),ea/ec.getHeight())}else{if(arguments.length===3){cW.translate(eb,ee)}}}}}ec.draw(cW);if(arguments.length===1&&S===3||arguments.length>1){cW.popMatrix()}}}};cW.shapeMode=function(ea){S=ea};cW.loadShape=function(ea){if(arguments.length===1){if(ea.indexOf(".svg")>-1){return new cr(null,ea)}}return null};var cT=function(ee,ed,ea,eb,ec){this.fullName=ee||"";this.name=ed||"";this.namespace=ea||"";this.value=eb;this.type=ec};cT.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(ea){this.value=ea}};var b9=cW.XMLElement=function(ea,ec,ed,eb){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(ea){if(typeof ea==="string"){if(ec===t&&ea.indexOf("<")>-1){this.parse(ea)}else{this.fullName=ea;this.namespace=ec;this.systemId=ed;this.lineNr=eb}}else{this.parse(ec)}}};b9.prototype={parse:function(ea){var ec;try{var ee=ea.substring(ea.length-4);if(ee===".xml"||ee===".svg"){ea=w(ea)}ec=(new DOMParser).parseFromString(ea,"text/xml");var eb=ec.documentElement;if(eb){this.parseChildrenRecursive(null,eb)}else{throw"Error loading document"}return this}catch(ed){throw ed}},parseChildrenRecursive:function(ei,eg){var ef,eb,eh,ee,ed,ea;if(!ei){this.fullName=eg.localName;this.name=eg.nodeName;ef=this}else{ef=new b9(eg.nodeName);ef.parent=ei}if(eg.nodeType===3&&eg.textContent!==""){return this.createPCDataElement(eg.textContent)}if(eg.nodeType===4){return this.createCDataElement(eg.textContent)}if(eg.attributes){for(ee=0,ed=eg.attributes.length;ee":">","'":"'",'"':"""},ea;for(ea in eb){if(!Object.hasOwnProperty(eb,ea)){ec=ec.replace(new RegExp(ea,"g"),eb[ea])}}ed.cdata=ec;return ed},hasAttribute:function(){if(arguments.length===1){return this.getAttribute(arguments[0])!==null}if(arguments.length===2){return this.getAttribute(arguments[0],arguments[1])!==null}},equals:function(ef){if(!(ef instanceof b9)){return false}var ec,eb;if(this.fullName!==ef.fullName){return false}if(this.attributes.length!==ef.getAttributeCount()){return false}if(this.attributes.length!==ef.attributes.length){return false}var ej,eh,ea,eg,ei;for(ec=0,eb=this.attributes.length;ec0){var ee,ed;for(ec=0,eb=this.children.length;ec0},addChild:function(ea){if(ea!==null){ea.parent=this;this.children.push(ea)}},insertChild:function(ec,ea){if(ec){if(ec.getLocalName()===null&&!this.hasChildren()){var eb=this.children[this.children.length-1];if(eb.getLocalName()===null){eb.setContent(eb.getContent()+ec.getContent());return}}ec.parent=this;this.children.splice(ea,0,ec)}},getChild:function(eb){if(typeof eb==="number"){return this.children[eb]}if(eb.indexOf("/")!==-1){return this.getChildRecursive(eb.split("/"),0)}var ea,ee;for(var ed=0,ec=this.getChildCount();edea){this.children.splice(ea,1)}},findAttribute:function(eb,ed){this.namespace=ed||"";for(var ec=0,ea=this.attributes.length;ec0){F.debug("Tried to set content for XMLElement with children")}this.content=ea},setName:function(){if(arguments.length===1){this.name=arguments[0];this.fullName=arguments[0];this.namespace=null}else{var ea=arguments[0].indexOf(":");if(arguments[1]===null||ea<0){this.name=arguments[0]}else{this.name=arguments[0].substring(ea+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}if(this.type==="CDATA"){return this.cdata}var ec=this.fullName;var ed="<"+ec;var eb,ee;for(eb=0;eb "}else{ed+=">"+this.content+""+ec+">"}}else{ed+=">";for(ee=0;ee"}return ed}};b9.parse=function(eb){var ea=new b9;ea.parse(eb);return ea};var dg=cW.XML=cW.XMLElement;cW.loadXML=function(ea){return new dg(cW,ea)};var cm=function(ed){var ea=0;for(var eb=0;eb-2147483648){var eb=this.elements[0];var eg=this.elements[1];var ee=this.elements[2];var ed=this.elements[3];var ec=this.elements[4];var ea=this.elements[5];this.elements[0]=ec/ef;this.elements[3]=-ed/ef;this.elements[1]=-eg/ef;this.elements[4]=eb/ef;this.elements[2]=(eg*ea-ec*ee)/ef;this.elements[5]=(ed*ee-eb*ea)/ef;return true}return false},scale:function(eb,ea){if(eb&&!ea){ea=eb}if(eb&&ea){this.elements[0]*=eb;this.elements[1]*=ea;this.elements[3]*=eb;this.elements[4]*=ea}},invScale:function(eb,ea){if(eb&&!ea){ea=eb}this.scale(1/eb,1/ea)},apply:function(){var ec;if(arguments.length===1&&arguments[0] instanceof aX){ec=arguments[0].array()}else{if(arguments.length===6){ec=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){ec=arguments[0]}}}var ea=[0,0,this.elements[2],0,0,this.elements[5]];var ed=0;for(var ee=0;ee<2;ee++){for(var eb=0;eb<3;eb++,ed++){ea[ed]+=this.elements[ee*3+0]*ec[eb+0]+this.elements[ee*3+1]*ec[eb+3]}}this.elements=ea.slice()},preApply:function(){var eb;if(arguments.length===1&&arguments[0] instanceof aX){eb=arguments[0].array()}else{if(arguments.length===6){eb=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){eb=arguments[0]}}}var ea=[0,0,eb[2],0,0,eb[5]];ea[2]=eb[2]+this.elements[2]*eb[0]+this.elements[5]*eb[1];ea[5]=eb[5]+this.elements[2]*eb[3]+this.elements[5]*eb[4];ea[0]=this.elements[0]*eb[0]+this.elements[3]*eb[1];ea[3]=this.elements[0]*eb[3]+this.elements[3]*eb[4];ea[1]=this.elements[1]*eb[0]+this.elements[4]*eb[1];ea[4]=this.elements[1]*eb[3]+this.elements[4]*eb[4];this.elements=ea.slice()},rotate:function(ec){var ee=q.cos(ec);var ea=q.sin(ec);var ed=this.elements[0];var eb=this.elements[1];this.elements[0]=ee*ed+ea*eb;this.elements[1]=-ea*ed+ee*eb;ed=this.elements[3];eb=this.elements[4];this.elements[3]=ee*ed+ea*eb;this.elements[4]=-ea*ed+ee*eb},rotateZ:function(ea){this.rotate(ea)},invRotateZ:function(ea){this.rotateZ(ea-q.PI)},print:function(){var eb=cm(this.elements);var ea=""+cW.nfs(this.elements[0],eb,4)+" "+cW.nfs(this.elements[1],eb,4)+" "+cW.nfs(this.elements[2],eb,4)+"\n"+cW.nfs(this.elements[3],eb,4)+" "+cW.nfs(this.elements[4],eb,4)+" "+cW.nfs(this.elements[5],eb,4)+"\n\n";cW.println(ea)}};var aP=cW.PMatrix3D=function(){this.reset()};aP.prototype={set:function(){if(arguments.length===16){this.elements=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof aP){this.elements=arguments[0].array()}else{if(arguments.length===1&&arguments[0] instanceof Array){this.elements=arguments[0].slice()}}}},get:function(){var ea=new aP;ea.set(this.elements);return ea},reset:function(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},array:function aE(){return this.elements.slice()},translate:function(eb,ea,ec){if(ec===t){ec=0}this.elements[3]+=eb*this.elements[0]+ea*this.elements[1]+ec*this.elements[2];this.elements[7]+=eb*this.elements[4]+ea*this.elements[5]+ec*this.elements[6];this.elements[11]+=eb*this.elements[8]+ea*this.elements[9]+ec*this.elements[10];this.elements[15]+=eb*this.elements[12]+ea*this.elements[13]+ec*this.elements[14]},transpose:function(){var ea=this.elements[4];this.elements[4]=this.elements[1];this.elements[1]=ea;ea=this.elements[8];this.elements[8]=this.elements[2];this.elements[2]=ea;ea=this.elements[6];this.elements[6]=this.elements[9];this.elements[9]=ea;ea=this.elements[3];this.elements[3]=this.elements[12];this.elements[12]=ea;ea=this.elements[7];this.elements[7]=this.elements[13];this.elements[13]=ea;ea=this.elements[11];this.elements[11]=this.elements[14];this.elements[14]=ea},mult:function(ec,ed){var ea,ef,ee,eb;if(ec instanceof A){ea=ec.x;ef=ec.y;ee=ec.z;eb=1;if(!ed){ed=new A}}else{if(ec instanceof Array){ea=ec[0];ef=ec[1];ee=ec[2];eb=ec[3]||1;if(!ed||ed.length!==3&&ed.length!==4){ed=[0,0,0]}}}if(ed instanceof Array){if(ed.length===3){ed[0]=this.elements[0]*ea+this.elements[1]*ef+this.elements[2]*ee+this.elements[3];ed[1]=this.elements[4]*ea+this.elements[5]*ef+this.elements[6]*ee+this.elements[7];ed[2]=this.elements[8]*ea+this.elements[9]*ef+this.elements[10]*ee+this.elements[11]}else{if(ed.length===4){ed[0]=this.elements[0]*ea+this.elements[1]*ef+this.elements[2]*ee+this.elements[3]*eb;ed[1]=this.elements[4]*ea+this.elements[5]*ef+this.elements[6]*ee+this.elements[7]*eb;ed[2]=this.elements[8]*ea+this.elements[9]*ef+this.elements[10]*ee+this.elements[11]*eb;ed[3]=this.elements[12]*ea+this.elements[13]*ef+this.elements[14]*ee+this.elements[15]*eb}}}if(ed instanceof A){ed.x=this.elements[0]*ea+this.elements[1]*ef+this.elements[2]*ee+this.elements[3];ed.y=this.elements[4]*ea+this.elements[5]*ef+this.elements[6]*ee+this.elements[7];ed.z=this.elements[8]*ea+this.elements[9]*ef+this.elements[10]*ee+this.elements[11]}return ed},preApply:function(){var ec;if(arguments.length===1&&arguments[0] instanceof aP){ec=arguments[0].array()}else{if(arguments.length===16){ec=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){ec=arguments[0]}}}var ea=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var ed=0;for(var ee=0;ee<4;ee++){for(var eb=0;eb<4;eb++,ed++){ea[ed]+=this.elements[eb+0]*ec[ee*4+0]+this.elements[eb+4]*ec[ee*4+1]+this.elements[eb+8]*ec[ee*4+2]+this.elements[eb+12]*ec[ee*4+3]}}this.elements=ea.slice()},apply:function(){var ec;if(arguments.length===1&&arguments[0] instanceof aP){ec=arguments[0].array()}else{if(arguments.length===16){ec=Array.prototype.slice.call(arguments)}else{if(arguments.length===1&&arguments[0] instanceof Array){ec=arguments[0]}}}var ea=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];var ed=0;for(var ee=0;ee<4;ee++){for(var eb=0;eb<4;eb++,ed++){ea[ed]+=this.elements[ee*4+0]*ec[eb+0]+this.elements[ee*4+1]*ec[eb+4]+this.elements[ee*4+2]*ec[eb+8]+this.elements[ee*4+3]*ec[eb+12]}}this.elements=ea.slice()},rotate:function(ee,ea,eg,ed){if(!eg){this.rotateZ(ee)}else{var ef=cW.cos(ee);var ec=cW.sin(ee);var eb=1-ef;this.apply(eb*ea*ea+ef,eb*ea*eg-ec*ed,eb*ea*ed+ec*eg,0,eb*ea*eg+ec*ed,eb*eg*eg+ef,eb*eg*ed-ec*ea,0,eb*ea*ed-ec*eg,eb*eg*ed+ec*ea,eb*ed*ed+ef,0,0,0,0,1)}},invApply:function(){if(ab===t){ab=new aP}var ea=arguments;ab.set(ea[0],ea[1],ea[2],ea[3],ea[4],ea[5],ea[6],ea[7],ea[8],ea[9],ea[10],ea[11],ea[12],ea[13],ea[14],ea[15]);if(!ab.invert()){return false}this.preApply(ab);return true},rotateX:function(eb){var ec=cW.cos(eb);var ea=cW.sin(eb);this.apply([1,0,0,0,0,ec,-ea,0,0,ea,ec,0,0,0,0,1])},rotateY:function(eb){var ec=cW.cos(eb);var ea=cW.sin(eb);this.apply([ec,0,ea,0,0,1,0,0,-ea,0,ec,0,0,0,0,1])},rotateZ:function(eb){var ec=q.cos(eb);var ea=q.sin(eb);this.apply([ec,-ea,0,0,ea,ec,0,0,0,0,1,0,0,0,0,1])},scale:function(ec,eb,ea){if(ec&&!eb&&!ea){eb=ea=ec}else{if(ec&&eb&&!ea){ea=1}}if(ec&&eb&&ea){this.elements[0]*=ec;this.elements[1]*=eb;this.elements[2]*=ea;this.elements[4]*=ec;this.elements[5]*=eb;this.elements[6]*=ea;this.elements[8]*=ec;this.elements[9]*=eb;this.elements[10]*=ea;this.elements[12]*=ec;this.elements[13]*=eb;this.elements[14]*=ea}},skewX:function(eb){var ea=q.tan(eb);this.apply(1,ea,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},skewY:function(eb){var ea=q.tan(eb);this.apply(1,0,0,0,ea,1,0,0,0,0,1,0,0,0,0,1)},shearX:function(eb){var ea=q.tan(eb);this.apply(1,ea,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},shearY:function(eb){var ea=q.tan(eb);this.apply(1,0,0,0,ea,1,0,0,0,0,1,0,0,0,0,1)},multX:function(ea,ed,ec,eb){if(!ec){return this.elements[0]*ea+this.elements[1]*ed+this.elements[3]}if(!eb){return this.elements[0]*ea+this.elements[1]*ed+this.elements[2]*ec+this.elements[3]}return this.elements[0]*ea+this.elements[1]*ed+this.elements[2]*ec+this.elements[3]*eb},multY:function(ea,ed,ec,eb){if(!ec){return this.elements[4]*ea+this.elements[5]*ed+this.elements[7]}if(!eb){return this.elements[4]*ea+this.elements[5]*ed+this.elements[6]*ec+this.elements[7]}return this.elements[4]*ea+this.elements[5]*ed+this.elements[6]*ec+this.elements[7]*eb},multZ:function(ea,ed,ec,eb){if(!eb){return this.elements[8]*ea+this.elements[9]*ed+this.elements[10]*ec+this.elements[11]}return this.elements[8]*ea+this.elements[9]*ed+this.elements[10]*ec+this.elements[11]*eb},multW:function(ea,ed,ec,eb){if(!eb){return this.elements[12]*ea+this.elements[13]*ed+this.elements[14]*ec+this.elements[15]}return this.elements[12]*ea+this.elements[13]*ed+this.elements[14]*ec+this.elements[15]*eb},invert:function(){var ej=this.elements[0]*this.elements[5]-this.elements[1]*this.elements[4];var ei=this.elements[0]*this.elements[6]-this.elements[2]*this.elements[4];var eh=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4];var eg=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5];var ef=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5];var ee=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6];var ed=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12];var ec=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12];var eb=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12];var eo=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13];var em=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13];var el=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14];var en=ej*el-ei*em+eh*eo+eg*eb-ef*ec+ee*ed;if(q.abs(en)<=1e-9){return false}var ek=[];ek[0]=+this.elements[5]*el-this.elements[6]*em+this.elements[7]*eo;ek[4]=-this.elements[4]*el+this.elements[6]*eb-this.elements[7]*ec;ek[8]=+this.elements[4]*em-this.elements[5]*eb+this.elements[7]*ed;ek[12]=-this.elements[4]*eo+this.elements[5]*ec-this.elements[6]*ed;ek[1]=-this.elements[1]*el+this.elements[2]*em-this.elements[3]*eo;ek[5]=+this.elements[0]*el-this.elements[2]*eb+this.elements[3]*ec;ek[9]=-this.elements[0]*em+this.elements[1]*eb-this.elements[3]*ed;ek[13]=+this.elements[0]*eo-this.elements[1]*ec+this.elements[2]*ed;ek[2]=+this.elements[13]*ee-this.elements[14]*ef+this.elements[15]*eg;ek[6]=-this.elements[12]*ee+this.elements[14]*eh-this.elements[15]*ei;ek[10]=+this.elements[12]*ef-this.elements[13]*eh+this.elements[15]*ej;ek[14]=-this.elements[12]*eg+this.elements[13]*ei-this.elements[14]*ej;ek[3]=-this.elements[9]*ee+this.elements[10]*ef-this.elements[11]*eg;ek[7]=+this.elements[8]*ee-this.elements[10]*eh+this.elements[11]*ei;ek[11]=-this.elements[8]*ef+this.elements[9]*eh-this.elements[11]*ej;ek[15]=+this.elements[8]*eg-this.elements[9]*ei+this.elements[10]*ej;var ea=1/en;ek[0]*=ea;ek[1]*=ea;ek[2]*=ea;ek[3]*=ea;ek[4]*=ea;ek[5]*=ea;ek[6]*=ea;ek[7]*=ea;ek[8]*=ea;ek[9]*=ea;ek[10]*=ea;ek[11]*=ea;ek[12]*=ea;ek[13]*=ea;ek[14]*=ea;ek[15]*=ea;this.elements=ek.slice();return true},toString:function(){var eb="";for(var ea=0;ea<15;ea++){eb+=this.elements[ea]+", "}eb+=this.elements[15];return eb},print:function(){var eb=cm(this.elements);var ea=""+cW.nfs(this.elements[0],eb,4)+" "+cW.nfs(this.elements[1],eb,4)+" "+cW.nfs(this.elements[2],eb,4)+" "+cW.nfs(this.elements[3],eb,4)+"\n"+cW.nfs(this.elements[4],eb,4)+" "+cW.nfs(this.elements[5],eb,4)+" "+cW.nfs(this.elements[6],eb,4)+" "+cW.nfs(this.elements[7],eb,4)+"\n"+cW.nfs(this.elements[8],eb,4)+" "+cW.nfs(this.elements[9],eb,4)+" "+cW.nfs(this.elements[10],eb,4)+" "+cW.nfs(this.elements[11],eb,4)+"\n"+cW.nfs(this.elements[12],eb,4)+" "+cW.nfs(this.elements[13],eb,4)+" "+cW.nfs(this.elements[14],eb,4)+" "+cW.nfs(this.elements[15],eb,4)+"\n\n";cW.println(ea)},invTranslate:function(eb,ea,ec){this.preApply(1,0,0,-eb,0,1,0,-ea,0,0,1,-ec,0,0,0,1)},invRotateX:function(eb){var ec=q.cos(-eb);var ea=q.sin(-eb);this.preApply([1,0,0,0,0,ec,-ea,0,0,ea,ec,0,0,0,0,1])},invRotateY:function(eb){var ec=q.cos(-eb);var ea=q.sin(-eb);this.preApply([ec,0,ea,0,0,1,0,0,-ea,0,ec,0,0,0,0,1])},invRotateZ:function(eb){var ec=q.cos(-eb);var ea=q.sin(-eb);this.preApply([ec,-ea,0,0,ea,ec,0,0,0,0,1,0,0,0,0,1])},invScale:function(ea,ec,eb){this.preApply([1/ea,0,0,0,0,1/ec,0,0,0,0,1/eb,0,0,0,0,1])}};var V=cW.PMatrixStack=function(){this.matrixStack=[]};V.prototype.load=function(){var ea=dY.$newPMatrix();if(arguments.length===1){ea.set(arguments[0])}else{ea.set(arguments)}this.matrixStack.push(ea)};bR.prototype.$newPMatrix=function(){return new aX};bB.prototype.$newPMatrix=function(){return new aP};V.prototype.push=function(){this.matrixStack.push(this.peek())};V.prototype.pop=function(){return this.matrixStack.pop()};V.prototype.peek=function(){var ea=dY.$newPMatrix();ea.set(this.matrixStack[this.matrixStack.length-1]);return ea};V.prototype.mult=function(ea){this.matrixStack[this.matrixStack.length-1].apply(ea)};cW.split=function(eb,ea){return eb.split(ea)};cW.splitTokens=function(eg,ef){if(ef===t){return eg.split(/\s+/g)}var ed=ef.split(/()/g),eb="",ea=eg.length,ec,eh,ee=[];for(ec=0;ec-1){if(eb!==""){ee.push(eb)}eb=""}else{eb+=eh}}if(eb!==""){ee.push(eb)}return ee};cW.append=function(eb,ea){eb[eb.length]=ea;return eb};cW.concat=function(eb,ea){return eb.concat(ea)};cW.sort=function(ef,ed){var eb=[];if(ef.length>0){var ee=ed>0?ed:ef.length;for(var ec=0;ec0){for(var ea=eb.length;ea>8)};cW.peg=function(ea){return ea<0?0:ea>255?255:ea};cW.modes=function(){var ef=4278190080,ec=16711680,eb=65280,ee=255,ed=q.min,ea=q.max;function eg(el,eo,ek,et,ev,eu,em,eq,ep,ei,ej){var es=ed(((el&4278190080)>>>24)+eo,255)<<24;var eh=ek+((ep-ek)*eo>>8);eh=(eh<0?0:eh>255?255:eh)<<16;var en=et+((ei-et)*eo>>8);en=(en<0?0:en>255?255:en)<<8;var er=ev+((ej-ev)*eo>>8);er=er<0?0:er>255?255:er;return es|eh|en|er}return{replace:function(ei,eh){return eh},blend:function(ej,ei){var el=(ei&ef)>>>24,eh=ej&ec,en=ej&eb,ep=ej&ee,eo=ei&ec,ek=ei&eb,em=eiⅇreturn ed(((ej&ef)>>>24)+el,255)<<24|eh+((eo-eh)*el>>8)&ec|en+((ek-en)*el>>8)&eb|ep+((em-ep)*el>>8)&ee},add:function(ei,eh){var ej=(eh&ef)>>>24;return ed(((ei&ef)>>>24)+ej,255)<<24|ed((ei&ec)+((eh&ec)>>8)*ej,ec)&ec|ed((ei&eb)+((eh&eb)>>8)*ej,eb)&eb|ed((ei&ee)+((eh&ee)*ej>>8),ee)},subtract:function(ei,eh){var ej=(eh&ef)>>>24;return ed(((ei&ef)>>>24)+ej,255)<<24|ea((ei&ec)-((eh&ec)>>8)*ej,eb)&ec|ea((ei&eb)-((eh&eb)>>8)*ej,ee)&eb|ea((ei&ee)-((eh&ee)*ej>>8),0)},lightest:function(ei,eh){var ej=(eh&ef)>>>24;return ed(((ei&ef)>>>24)+ej,255)<<24|ea(ei&ec,((eh&ec)>>8)*ej)&ec|ea(ei&eb,((eh&eb)>>8)*ej)&eb|ea(ei&ee,(eh&ee)*ej>>8)},darkest:function(ej,ei){var el=(ei&ef)>>>24,eh=ej&ec,en=ej&eb,ep=ej&ee,eo=ed(ej&ec,((ei&ec)>>8)*el),ek=ed(ej&eb,((ei&eb)>>8)*el),em=ed(ej&ee,(ei&ee)*el>>8);return ed(((ej&ef)>>>24)+el,255)<<24|eh+((eo-eh)*el>>8)&ec|en+((ek-en)*el>>8)&eb|ep+((em-ep)*el>>8)&ee},difference:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ek&ee,eo=ej>er?ej-er:er-ej,eh=eq>em?eq-em:em-eq,ei=es>ep?es-ep:ep-es;return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},exclusion:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ek&ee,eo=ej+er-(ej*er>>7),eh=eq+em-(eq*em>>7),ei=es+ep-(es*ep>>7);return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},multiply:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ek&ee,eo=ej*er>>8,eh=eq*em>>8,ei=es*ep>>8;return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},screen:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ek&ee,eo=255-((255-ej)*(255-er)>>8),eh=255-((255-eq)*(255-em)>>8),ei=255-((255-es)*(255-ep)>>8);return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},hard_light:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ek&ee,eo=er<128?ej*er>>7:255-((255-ej)*(255-er)>>7),eh=em<128?eq*em>>7:255-((255-eq)*(255-em)>>7),ei=ep<128?es*ep>>7:255-((255-es)*(255-ep)>>7);return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},soft_light:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ek&ee,eo=(ej*er>>7)+(ej*ej>>8)-(ej*ej*er>>15),eh=(eq*em>>7)+(eq*eq>>8)-(eq*eq*em>>15),ei=(es*ep>>7)+(es*es>>8)-(es*es*ep>>15);return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},overlay:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ek&ee,eo=ej<128?ej*er>>7:255-((255-ej)*(255-er)>>7),eh=eq<128?eq*em>>7:255-((255-eq)*(255-em)>>7),ei=es<128?es*ep>>7:255-((255-es)*(255-ep)>>7);return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},dodge:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ekⅇvar eo=255;if(er!==255){eo=(ej<<8)/(255-er);eo=eo<0?0:eo>255?255:eo}var eh=255;if(em!==255){eh=(eq<<8)/(255-em);eh=eh<0?0:eh>255?255:eh}var ei=255;if(ep!==255){ei=(es<<8)/(255-ep);ei=ei<0?0:ei>255?255:ei}return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)},burn:function(el,ek){var en=(ek&ef)>>>24,ej=(el&ec)>>16,eq=(el&eb)>>8,es=el&ee,er=(ek&ec)>>16,em=(ek&eb)>>8,ep=ekⅇvar eo=0;if(er!==0){eo=(255-ej<<8)/er;eo=255-(eo<0?0:eo>255?255:eo)}var eh=0;if(em!==0){eh=(255-eq<<8)/em;eh=255-(eh<0?0:eh>255?255:eh)}var ei=0;if(ep!==0){ei=(255-es<<8)/ep;ei=255-(ei<0?0:ei>255?255:ei)}return eg(el,en,ej,eq,es,er,em,ep,eo,eh,ei)}}}();function dH(ef,ee,ec,eb){var ea,ed,eh,ei;if(cY===3){var eg=cW.color.toRGB(ef,ee,ec);ea=eg[0];ed=eg[1];eh=eg[2]}else{ea=q.round(255*(ef/bJ));ed=q.round(255*(ee/bI));eh=q.round(255*(ec/bG))}ei=q.round(255*(eb/bU));ea=ea<0?0:ea;ed=ed<0?0:ed;eh=eh<0?0:eh;ei=ei<0?0:ei;ea=ea>255?255:ea;ed=ed>255?255:ed;eh=eh>255?255:eh;ei=ei>255?255:ei;return ei<<24&4278190080|ea<<16&16711680|ed<<8&65280|eh&255}function dK(ea,ec){var eb;if(ea&4278190080){eb=q.round(255*(ec/bU));eb=eb>255?255:eb;eb=eb<0?0:eb;return ea-(ea&4278190080)+(eb<<24&4278190080)}if(cY===1){return dH(ea,ea,ea,ec)}if(cY===3){return dH(0,0,ea/bJ*bG,ec)}}function dM(ea){if(ea<=bJ&&ea>=0){if(cY===1){return dH(ea,ea,ea,bU)}if(cY===3){return dH(0,0,ea/bJ*bG,bU)}}if(ea){if(ea>2147483647){ea-=4294967296}return ea}}cW.color=function(ea,ed,ec,eb){if(ea!==t&&ed!==t&&ec!==t&&eb!==t){return dH(ea,ed,ec,eb)}if(ea!==t&&ed!==t&&ec!==t){return dH(ea,ed,ec,bU)}if(ea!==t&&ed!==t){return dK(ea,ed)}if(typeof ea==="number"){return dM(ea)}return dH(bJ,bI,bG,bU)};cW.color.toString=function(ea){return"rgba("+((ea>>16)&255)+","+((ea>>8)&255)+","+(ea&255)+","+((ea>>24)&255)/255+")"};cW.color.toInt=function(ed,ec,ea,eb){return eb<<24&4278190080|ed<<16&16711680|ec<<8&65280|ea&255};cW.color.toArray=function(ea){return[(ea>>16)&255,(ea>>8)&255,ea&255,(ea>>24)&255]};cW.color.toGLArray=function(ea){return[((ea&16711680)>>>16)/255,((ea>>8)&255)/255,(ea&255)/255,((ea>>24)&255)/255]};cW.color.toRGB=function(ec,ei,ef){ec=ec>bJ?bJ:ec;ei=ei>bI?bI:ei;ef=ef>bG?bG:ef;ec=ec/bJ*360;ei=ei/bI*100;ef=ef/bG*100;var eh=q.round(ef/100*255);if(ei===0){return[eh,eh,eh]}var ed=ec%360;var ee=ed%60;var eb=q.round(ef*(100-ei)/10000*255);var ea=q.round(ef*(6000-ei*ee)/600000*255);var eg=q.round(ef*(6000-ei*(60-ee))/600000*255);switch(q.floor(ed/60)){case 0:return[eh,eg,eb];case 1:return[ea,eh,eb];case 2:return[eb,eh,eg];case 3:return[eb,ea,eh];case 4:return[eg,eb,eh];case 5:return[eh,eb,ea]}};function aS(eh){var eg,ef,eb;eg=((eh>>16)&255)/255;ef=((eh>>8)&255)/255;eb=(eh&255)/255;var ea=cW.max(cW.max(eg,ef),eb),ed=cW.min(cW.min(eg,ef),eb),ec,ee;if(ed===ea){return[0,0,ea*bG]}ee=(ea-ed)/ea;if(eg===ea){ec=(ef-eb)/(ea-ed)}else{if(ef===ea){ec=2+(eb-eg)/(ea-ed)}else{ec=4+(eg-ef)/(ea-ed)}}ec/=6;if(ec<0){ec+=1}else{if(ec>1){ec-=1}}return[ec*bJ,ee*bI,ea*bG]}cW.brightness=function(ea){return aS(ea)[2]};cW.saturation=function(ea){return aS(ea)[1]};cW.hue=function(ea){return aS(ea)[0]};cW.red=function(ea){return((ea>>16)&255)/255*bJ};cW.green=function(ea){return((ea&65280)>>>8)/255*bI};cW.blue=function(ea){return(ea&255)/255*bG};cW.alpha=function(ea){return((ea>>24)&255)/255*bU};cW.lerpColor=function(em,el,ef){var ek,eq,er,es,eo,ea,eg,eu,en,ev,ee,et;var ei,eh,eb,ep,ej;var ed=cW.color(em);var ec=cW.color(el);if(cY===3){ei=aS(ed);eu=((ed>>24)&255)/bU;eh=aS(ec);et=((ec&4278190080)>>>24)/bU;ep=cW.lerp(ei[0],eh[0],ef);ej=cW.lerp(ei[1],eh[1],ef);er=cW.lerp(ei[2],eh[2],ef);eb=cW.color.toRGB(ep,ej,er);es=cW.lerp(eu,et,ef)*bU;return es<<24&4278190080|(eb[0]&255)<<16|(eb[1]&255)<<8|eb[2]&255}eo=(ed>>16)&255;ea=(ed>>8)&255;eg=ed&255;eu=((ed>>24)&255)/bU;en=(ec&16711680)>>>16;ev=(ec>>8)&255;ee=ec&255;et=((ec>>24)&255)/bU;ek=cW.lerp(eo,en,ef)|0;eq=cW.lerp(ea,ev,ef)|0;er=cW.lerp(eg,ee,ef)|0;es=cW.lerp(eu,et,ef)*bU;return es<<24&4278190080|ek<<16&16711680|eq<<8&65280|er&255};cW.colorMode=function(){cY=arguments[0];if(arguments.length>1){bJ=arguments[1];bI=arguments[2]||arguments[1];bG=arguments[3]||arguments[1];bU=arguments[4]||arguments[1]}};cW.blendColor=function(eb,ea,ec){if(ec===0){return cW.modes.replace(eb,ea)}else{if(ec===1){return cW.modes.blend(eb,ea)}else{if(ec===2){return cW.modes.add(eb,ea)}else{if(ec===4){return cW.modes.subtract(eb,ea)}else{if(ec===8){return cW.modes.lightest(eb,ea)}else{if(ec===16){return cW.modes.darkest(eb,ea)}else{if(ec===32){return cW.modes.difference(eb,ea)}else{if(ec===64){return cW.modes.exclusion(eb,ea)}else{if(ec===128){return cW.modes.multiply(eb,ea)}else{if(ec===256){return cW.modes.screen(eb,ea)}else{if(ec===1024){return cW.modes.hard_light(eb,ea)}else{if(ec===2048){return cW.modes.soft_light(eb,ea)}else{if(ec===512){return cW.modes.overlay(eb,ea)}else{if(ec===4096){return cW.modes.dodge(eb,ea)}else{if(ec===8192){return cW.modes.burn(eb,ea)}}}}}}}}}}}}}}}};function aD(){d8.save()}function cP(){d8.restore();b3=true;aq=true}cW.printMatrix=function(){dJ.print()};bR.prototype.translate=function(ea,eb){dJ.translate(ea,eb);aT.invTranslate(ea,eb);d8.translate(ea,eb)};bB.prototype.translate=function(ea,ec,eb){dJ.translate(ea,ec,eb);aT.invTranslate(ea,ec,eb)};bR.prototype.scale=function(ea,eb){dJ.scale(ea,eb);aT.invScale(ea,eb);d8.scale(ea,eb||ea)};bB.prototype.scale=function(ea,ec,eb){dJ.scale(ea,ec,eb);aT.invScale(ea,ec,eb)};bR.prototype.transform=function(eb){var ea=eb.array();d8.transform(ea[0],ea[3],ea[1],ea[4],ea[2],ea[5])};bB.prototype.transformm=function(ea){throw"p.transform is currently not supported in 3D mode"};bR.prototype.pushMatrix=function(){am.load(dJ);da.load(aT);aD()};bB.prototype.pushMatrix=function(){am.load(dJ);da.load(aT)};bR.prototype.popMatrix=function(){dJ.set(am.pop());aT.set(da.pop());cP()};bB.prototype.popMatrix=function(){dJ.set(am.pop());aT.set(da.pop())};bR.prototype.resetMatrix=function(){dJ.reset();aT.reset();d8.setTransform(1,0,0,1,0,0)};bB.prototype.resetMatrix=function(){dJ.reset();aT.reset()};ds.prototype.applyMatrix=function(){var ea=arguments;dJ.apply(ea[0],ea[1],ea[2],ea[3],ea[4],ea[5],ea[6],ea[7],ea[8],ea[9],ea[10],ea[11],ea[12],ea[13],ea[14],ea[15]);aT.invApply(ea[0],ea[1],ea[2],ea[3],ea[4],ea[5],ea[6],ea[7],ea[8],ea[9],ea[10],ea[11],ea[12],ea[13],ea[14],ea[15])};bR.prototype.applyMatrix=function(){var ea=arguments;for(var eb=ea.length;eb<16;eb++){ea[eb]=0}ea[10]=ea[15]=1;ds.prototype.applyMatrix.apply(this,ea)};cW.rotateX=function(ea){dJ.rotateX(ea);aT.invRotateX(ea)};bR.prototype.rotateZ=function(){throw"rotateZ() is not supported in 2D mode. Use rotate(float) instead."};bB.prototype.rotateZ=function(ea){dJ.rotateZ(ea);aT.invRotateZ(ea)};cW.rotateY=function(ea){dJ.rotateY(ea);aT.invRotateY(ea)};bR.prototype.rotate=function(ea){dJ.rotateZ(ea);aT.invRotateZ(ea);d8.rotate(ea)};bB.prototype.rotate=function(ea){cW.rotateZ(ea)};bR.prototype.shearX=function(ea){dJ.shearX(ea);d8.transform(1,0,ea,1,0,0)};bB.prototype.shearX=function(ea){dJ.shearX(ea)};bR.prototype.shearY=function(ea){dJ.shearY(ea);d8.transform(1,ea,0,1,0,0)};bB.prototype.shearY=function(ea){dJ.shearY(ea)};cW.pushStyle=function(){aD();cW.pushMatrix();var ea={doFill:aH,currentFillColor:a1,doStroke:ce,currentStrokeColor:cv,curTint:bf,curRectMode:bK,curColorMode:cY,colorModeX:bJ,colorModeZ:bG,colorModeY:bI,colorModeA:bU,curTextFont:W,horizontalTextAlignment:N,verticalTextAlignment:c1,textMode:cI,curFontName:Y,curTextSize:d0,curTextAscent:a3,curTextDescent:dA,curTextLeading:d7};bm.push(ea)};cW.popStyle=function(){var ea=bm.pop();if(ea){cP();cW.popMatrix();aH=ea.doFill;a1=ea.currentFillColor;ce=ea.doStroke;cv=ea.currentStrokeColor;bf=ea.curTint;bK=ea.curRectMode;cY=ea.curColorMode;bJ=ea.colorModeX;bG=ea.colorModeZ;bI=ea.colorModeY;bU=ea.colorModeA;W=ea.curTextFont;Y=ea.curFontName;d0=ea.curTextSize;N=ea.horizontalTextAlignment;c1=ea.verticalTextAlignment;cI=ea.textMode;a3=ea.curTextAscent;dA=ea.curTextDescent;d7=ea.curTextLeading}else{throw"Too many popStyle() without enough pushStyle()"}};cW.year=function(){return(new Date).getFullYear()};cW.month=function(){return(new Date).getMonth()+1};cW.day=function(){return(new Date).getDate()};cW.hour=function(){return(new Date).getHours()};cW.minute=function(){return(new Date).getMinutes()};cW.second=function(){return(new Date).getSeconds()};cW.millis=function(){return Date.now()-dq};function ct(){var ea=(Date.now()-dt)/1000;P++;var eb=P/ea;if(ea>0.5){dt=Date.now();P=0;cW.__frameRate=eb}cW.frameCount++}bR.prototype.redraw=function(){ct();d8.lineWidth=dW;var ea=cW.pmouseX,eb=cW.pmouseY;cW.pmouseX=dN;cW.pmouseY=d5;aD();cW.draw();cP();dN=cW.mouseX;d5=cW.mouseY;cW.pmouseX=ea;cW.pmouseY=eb};bB.prototype.redraw=function(){ct();var ea=cW.pmouseX,eb=cW.pmouseY;cW.pmouseX=dN;cW.pmouseY=d5;d8.clear(d8.DEPTH_BUFFER_BIT);dC={attributes:{},locations:{}};cW.noLights();cW.lightFalloff(1,0,0);cW.shininess(1);cW.ambient(255,255,255);cW.specular(0,0,0);cW.emissive(0,0,0);cW.camera();cW.draw();dN=cW.mouseX;d5=cW.mouseY;cW.pmouseX=ea;cW.pmouseY=eb};cW.noLoop=function(){aC=false;ax=false;clearInterval(b4);cQ.onPause()};cW.loop=function(){if(ax){return}dt=Date.now();P=0;b4=D.setInterval(function(){try{cQ.onFrameStart();cW.redraw();cQ.onFrameEnd()}catch(ea){D.clearInterval(b4);throw ea}},az);aC=true;ax=true;cQ.onLoop()};cW.frameRate=function(ea){dU=ea;az=1000/dU;if(aC){cW.noLoop();cW.loop()}};var au=[];function bO(ec,eb,ea){if(ec.addEventListener){ec.addEventListener(eb,ea,false)}else{ec.attachEvent("on"+eb,ea)}au.push({elem:ec,type:eb,fn:ea})}function de(ea){var ed=ea.elem,ec=ea.type,eb=ea.fn;if(ed.removeEventListener){ed.removeEventListener(ec,eb,false)}else{if(ed.detachEvent){ed.detachEvent("on"+ec,eb)}}}cW.exit=function(){D.clearInterval(b4);L(cW.externals.canvas.id);delete ae.onmousedown;for(var eb in F.lib){if(F.lib.hasOwnProperty(eb)){if(F.lib[eb].hasOwnProperty("detach")){F.lib[eb].detach(cW)}}}var ea=au.length;while(ea--){de(au[ea])}cQ.onExit()};cW.cursor=function(){if(arguments.length>1||arguments.length===1&&arguments[0] instanceof cW.PImage){var ed=arguments[0],ea,ef;if(arguments.length>=3){ea=arguments[1];ef=arguments[2];if(ea<0||ef<0||ef>=ed.height||ea>=ed.width){throw"x and y must be non-negative and less than the dimensions of the image"}}else{ea=ed.width>>>1;ef=ed.height>>>1}var eb=ed.toDataURL();var ec='url("'+eb+'") '+ea+" "+ef+", default";Z=ae.style.cursor=ec}else{if(arguments.length===1){var ee=arguments[0];Z=ae.style.cursor=ee}else{Z=ae.style.cursor=ck}}};cW.noCursor=function(){Z=ae.style.cursor=B.NOCURSOR};cW.link=function(ea,eb){if(eb!==t){D.open(ea,eb)}else{D.location=ea}};cW.beginDraw=G;cW.endDraw=G;bR.prototype.toImageData=function(ea,ed,eb,ec){ea=ea!==t?ea:0;ed=ed!==t?ed:0;eb=eb!==t?eb:cW.width;ec=ec!==t?ec:cW.height;return d8.getImageData(ea,ed,eb,ec)};bB.prototype.toImageData=function(ei,eh,ej,ee){ei=ei!==t?ei:0;eh=eh!==t?eh:0;ej=ej!==t?ej:cW.width;ee=ee!==t?ee:cW.height;var eg=d.createElement("canvas"),ek=eg.getContext("2d"),ed=ek.createImageData(ej,ee),eb=new b(ej*ee*4);d8.readPixels(ei,eh,ej,ee,d8.RGBA,d8.UNSIGNED_BYTE,eb);for(var ec=0,ef=eb.length,ea=ed.data;ec0){ed=ec}else{if(eb instanceof bP){ed=16;eb|=0}else{ed=32;while(ed>1&&!(eb>>>ed-1&1)){ed--}}}var ea="";while(ed>0){ea+=eb>>>--ed&1?"1":"0"}return ea};cW.unbinary=function(eb){var ed=eb.length-1,ec=1,ea=0;while(ed>=0){var ee=eb[ed--];if(ee!=="0"&&ee!=="1"){throw"the value passed into unbinary was not an 8 bit binary number"}if(ee==="1"){ea+=ec}ec<<=1}return ea};function cX(em,ek,ee,ep,eg,en){var ec=em<0?ee:ek;var eb=eg===0;var el=eg===t||eg<0?0:eg;var ej=q.abs(em);if(eb){el=1;ej*=10;while(q.abs(q.round(ej)-ej)>0.000001&&el<7){++el;ej*=10}}else{if(el!==0){ej*=q.pow(10,el)}}var ed,ei=ej*2;if(q.floor(ej)===ej){ed=ej}else{if(q.floor(ei)===ei){var ea=q.floor(ej);ed=ea+ea%2}else{ed=q.round(ej)}}var ef="";var eo=ep+el;while(eo>0||ed>0){eo--;ef=""+ed%10+ef;ed=q.floor(ed/10)}if(en!==t){var eh=ef.length-3-el;while(eh>0){ef=ef.substring(0,eh)+en+ef.substring(eh);eh-=3}}if(el>0){return ec+ef.substring(0,ef.length-el)+"."+ef.substring(ef.length-el,ef.length)}return ec+ef}function ao(eg,ef,ea,ei,eb,eh){if(eg instanceof Array){var ed=[];for(var ec=0,ee=eg.length;ec=eb){ea=ea.substring(ea.length-eb,ea.length)}return ea};cW.hex=function(eb,ea){if(arguments.length===1){if(eb instanceof bP){ea=4}else{ea=8}}return aM(eb,ea)};function dF(ea){var eb=parseInt("0x"+ea,16);if(eb>2147483647){eb-=4294967296}return eb}cW.unhex=function(ec){if(ec instanceof Array){var ea=[];for(var eb=0;eb0?ed:null};cW.__contains=function(eb,ea){if(typeof eb!=="string"){return eb.contains.apply(eb,bc(arguments))}return eb!==null&&ea!==null&&typeof ea==="string"&&eb.indexOf(ea)>-1};cW.__replaceAll=function(ea,ec,eb){if(typeof ea!=="string"){return ea.replaceAll.apply(ea,bc(arguments))}return ea.replace(new RegExp(ec,"g"),eb)};cW.__replaceFirst=function(ea,ec,eb){if(typeof ea!=="string"){return ea.replaceFirst.apply(ea,bc(arguments))}return ea.replace(new RegExp(ec,""),eb)};cW.__replace=function(ed,ef,ee){if(typeof ed!=="string"){return ed.replace.apply(ed,bc(arguments))}if(ef instanceof RegExp){return ed.replace(ef,ee)}if(typeof ef!=="string"){ef=ef.toString()}if(ef===""){return ed}var ec=ed.indexOf(ef);if(ec<0){return ed}var eb=0,ea="";do{ea+=ed.substring(eb,ec)+ee;eb=ec+ef.length}while((ec=ed.indexOf(ef,eb))>=0);return ea+ed.substring(eb)};cW.__equals=function(eb,ea){if(eb.equals instanceof Function){return eb.equals.apply(eb,bc(arguments))}return eb.valueOf()===ea.valueOf()};cW.__equalsIgnoreCase=function(eb,ea){if(typeof eb!=="string"){return eb.equalsIgnoreCase.apply(eb,bc(arguments))}return eb.toLowerCase()===ea.toLowerCase()};cW.__toCharArray=function(ec){if(typeof ec!=="string"){return ec.toCharArray.apply(ec,bc(arguments))}var ed=[];for(var eb=0,ea=ec.length;ebea.length){return false}return ec===""||ec===ea?true:ea.indexOf(ec)===eb};cW.__endsWith=function(eb,ec){if(typeof eb!=="string"){return eb.endsWith.apply(eb,bc(arguments))}var ea=ec?ec.length:0;return ec===""||ec===eb?true:eb.indexOf(ec)===eb.length-ea};cW.__hashCode=function(ea){if(ea.hashCode instanceof Function){return ea.hashCode.apply(ea,bc(arguments))}return h(ea)};cW.__printStackTrace=function(ea){cW.println("Exception: "+ea.toString())};var d9=[];cW.println=function(ea){var eb=d9.length;if(eb){F.logger.log(d9.join(""));d9.length=0}if(arguments.length===0&&eb===0){F.logger.log("")}else{if(arguments.length!==0){F.logger.log(ea)}}};cW.print=function(ea){d9.push(ea)};cW.str=function(ec){if(ec instanceof Array){var ea=[];for(var eb=0;eb0){var ea=ed.shift();if(ea===eb){return true}if(ea.$interfaces){ed=ed.concat(ea.$interfaces)}}return false}while(ee.hasOwnProperty("$base")){ee=ee.$base;if(ee===eb){return true}}return false};cW.abs=q.abs;cW.ceil=q.ceil;cW.constrain=function(eb,ec,ea){return eb>ea?ea:eb0)){throw"Non-empty array is expected"}var ea=eb[0],ed=eb.length;for(var ec=1;ec0)){throw"Non-empty array is expected"}var ec=ea[0],ed=ea.length;for(var eb=1;ebea[eb]){ec=ea[eb]}}return ec};cW.norm=function(eb,ea,ec){return(eb-ea)/(ec-ea)};cW.pow=q.pow;cW.round=q.round;cW.sq=function(ea){return ea*ea};cW.sqrt=q.sqrt;cW.acos=q.acos;cW.asin=q.asin;cW.atan=q.atan;cW.atan2=q.atan2;cW.cos=q.cos;cW.degrees=function(ea){return ea*180/q.PI};cW.radians=function(ea){return ea/180*q.PI};cW.sin=q.sin;cW.tan=q.tan;var bY=q.random;cW.random=function(){if(arguments.length===0){return bY()}if(arguments.length===1){return bY()*arguments[0]}var eb=arguments[0],ea=arguments[1];return bY()*(ea-eb)+eb};function co(ec,eb){var ee=ec||362436069,ea=eb||521288629;var ed=function(){ee=36969*(ee&65535)+(ee>>>16)&4294967295;ea=18000*(ea&65535)+(ea>>>16)&4294967295;return((ee&65535)<<16|ea&65535)&4294967295};this.nextDouble=function(){var ef=ed()/4294967296;return ef<0?1+ef:ef};this.nextInt=ed}co.createRandomized=function(){var ea=new Date;return new co(ea/60000&4294967295,ea&4294967295)};cW.randomSeed=function(ea){bY=(new co(ea)).nextDouble};cW.Random=function(ea){var ed=false,eb,ec;this.nextGaussian=function(){if(ed){ed=false;return eb}var eh,ef,ee;do{eh=2*ec()-1;ef=2*ec()-1;ee=eh*eh+ef*ef}while(ee>=1||ee===0);var eg=q.sqrt(-2*q.log(ee)/ee);eb=ef*eg;ed=true;return eh*eg};ec=ea===t?q.random:(new co(ea)).nextDouble};function dz(eh){var eb=eh!==t?new co(eh):co.createRandomized();var eg,ee;var ed=new b(512);for(eg=0;eg<256;++eg){ed[eg]=eg}for(eg=0;eg<256;++eg){var ej=ed[ee=eb.nextInt()&255];ed[ee]=ed[eg];ed[eg]=ej}for(eg=0;eg<256;++eg){ed[eg+256]=ed[eg]}function ea(en,ek,eq,ep){var eo=en&15;var em=eo<8?ek:eq,el=eo<4?eq:eo===12||eo===14?ek:ep;return((eo&1)===0?em:-em)+((eo&2)===0?el:-el)}function ef(em,ek,en){var el=(em&1)===0?ek:en;return(em&2)===0?-el:el}function ei(el,ek){return(el&1)===0?-ek:ek}function ec(em,el,ek){return el+em*(ek-el)}this.noise3d=function(ew,ev,eu){var en=q.floor(ew)&255,el=q.floor(ev)&255,ek=q.floor(eu)&255;ew-=q.floor(ew);ev-=q.floor(ev);eu-=q.floor(eu);var er=(3-2*ew)*ew*ew,eq=(3-2*ev)*ev*ev,ep=(3-2*eu)*eu*eu;var ey=ed[en]+el,et=ed[ey]+ek,es=ed[ey+1]+ek,ex=ed[en+1]+el,eo=ed[ex]+ek,em=ed[ex+1]+ek;return ec(ep,ec(eq,ec(er,ea(ed[et],ew,ev,eu),ea(ed[eo],ew-1,ev,eu)),ec(er,ea(ed[es],ew,ev-1,eu),ea(ed[em],ew-1,ev-1,eu))),ec(eq,ec(er,ea(ed[et+1],ew,ev,eu-1),ea(ed[eo+1],ew-1,ev,eu-1)),ec(er,ea(ed[es+1],ew,ev-1,eu-1),ea(ed[em+1],ew-1,ev-1,eu-1))))};this.noise2d=function(ek,er){var eq=q.floor(ek)&255,eo=q.floor(er)&255;ek-=q.floor(ek);er-=q.floor(er);var em=(3-2*ek)*ek*ek,el=(3-2*er)*er*er;var ep=ed[eq]+eo,en=ed[eq+1]+eo;return ec(el,ec(em,ef(ed[ep],ek,er),ef(ed[en],ek-1,er)),ec(em,ef(ed[ep+1],ek,er-1),ef(ed[en+1],ek-1,er-1)))};this.noise1d=function(ek){var em=q.floor(ek)&255;ek-=q.floor(ek);var el=(3-2*ek)*ek*ek;return ec(el,ei(ed[em],ek),ei(ed[em+1],ek-1))}}var bW={generator:t,octaves:4,fallout:0.5,seed:t};cW.noise=function(ea,eh,eg){if(bW.generator===t){bW.generator=new dz(bW.seed)}var ef=bW.generator;var ee=1,eb=1,ed=0;for(var ec=0;ec0){ae.style.removeProperty("width");ae.style.removeProperty("height")}ae.width=cW.width=eb||100;ae.height=cW.height=ee||100;for(var ef in ec){if(ec.hasOwnProperty(ef)){d8[ef]=ec[ef]}}cW.textFont(W);cW.background();bZ=q.max(1000,eb*ee*0.05);cW.externals.context=d8;for(var ea=0;ea<720;ea++){ah[ea]=cW.sin(ea*(q.PI/180)*0.5);bl[ea]=cW.cos(ea*(q.PI/180)*0.5)}};bR.prototype.size=function(ea,ec,eb){if(d8===t){d8=ae.getContext("2d");am=new V;da=new V;dJ=new aX;aT=new aX}ds.prototype.size.apply(this,arguments)};bB.prototype.size=function(){var eb=false;return function ea(ed,ef,ee){if(eb){throw"Multiple calls to size() for 3D renders are not allowed."}eb=true;function eg(ei){var el=["experimental-webgl","webgl","webkit-3d"],ek;for(var ej=0,eh=el.length;ej>16)&255)/255,((eb>>8)&255)/255,(eb&255)/255];d8.useProgram(dx);d2("uLights.color.3d."+dL,dx,"uLights"+dL+".color",ec);d2("uLights.position.3d."+dL,dx,"uLights"+dL+".position",eg.array());dZ("uLights.type.3d."+dL,dx,"uLights"+dL+".type",0);dZ("uLightCount3d",dx,"uLightCount",++dL)};bR.prototype.directionalLight=ds.prototype.a3DOnlyFunction;bB.prototype.directionalLight=function(ea,eg,ei,eh,ef,ee){if(dL===8){throw"can only create "+8+" lights"}d8.useProgram(dx);var ej=new aP;ej.scale(1,-1,1);ej.apply(dJ.array());ej=ej.array();var ec=[ej[0]*eh+ej[4]*ef+ej[8]*ee,ej[1]*eh+ej[5]*ef+ej[9]*ee,ej[2]*eh+ej[6]*ef+ej[10]*ee];var eb=dH(ea,eg,ei,0);var ed=[((eb>>16)&255)/255,((eb>>8)&255)/255,(eb&255)/255];d2("uLights.color.3d."+dL,dx,"uLights"+dL+".color",ed);d2("uLights.position.3d."+dL,dx,"uLights"+dL+".position",ec);dZ("uLights.type.3d."+dL,dx,"uLights"+dL+".type",1);dZ("uLightCount3d",dx,"uLightCount",++dL)};bR.prototype.lightFalloff=ds.prototype.a3DOnlyFunction;bB.prototype.lightFalloff=function(eb,ea,ec){d8.useProgram(dx);d2("uFalloff3d",dx,"uFalloff",[eb,ea,ec])};bR.prototype.lightSpecular=ds.prototype.a3DOnlyFunction;bB.prototype.lightSpecular=function(ee,ed,ea){var eb=dH(ee,ed,ea,0);var ec=[((eb>>16)&255)/255,((eb>>8)&255)/255,(eb&255)/255];d8.useProgram(dx);d2("uSpecular3d",dx,"uSpecular",ec)};cW.lights=function(){cW.ambientLight(128,128,128);cW.directionalLight(128,128,128,0,0,-1);cW.lightFalloff(1,0,0);cW.lightSpecular(0,0,0)};bR.prototype.pointLight=ds.prototype.a3DOnlyFunction;bB.prototype.pointLight=function(ea,ed,ei,ej,ef,ee){if(dL===8){throw"can only create "+8+" lights"}var eg=new A(ej,ef,ee);var eh=new aP;eh.scale(1,-1,1);eh.apply(dJ.array());eh.mult(eg,eg);var eb=dH(ea,ed,ei,0);var ec=[((eb>>16)&255)/255,((eb>>8)&255)/255,(eb&255)/255];d8.useProgram(dx);d2("uLights.color.3d."+dL,dx,"uLights"+dL+".color",ec);d2("uLights.position.3d."+dL,dx,"uLights"+dL+".position",eg.array());dZ("uLights.type.3d."+dL,dx,"uLights"+dL+".type",2);dZ("uLightCount3d",dx,"uLightCount",++dL)};bR.prototype.noLights=ds.prototype.a3DOnlyFunction;bB.prototype.noLights=function(){dL=0;d8.useProgram(dx);dZ("uLightCount3d",dx,"uLightCount",dL)};bR.prototype.spotLight=ds.prototype.a3DOnlyFunction;bB.prototype.spotLight=function(ea,ei,en,eo,em,ek,ej,eh,ef,ee,eg){if(dL===8){throw"can only create "+8+" lights"}d8.useProgram(dx);var el=new A(eo,em,ek);var ep=new aP;ep.scale(1,-1,1);ep.apply(dJ.array());ep.mult(el,el);ep=ep.array();var ec=[ep[0]*ej+ep[4]*eh+ep[8]*ef,ep[1]*ej+ep[5]*eh+ep[9]*ef,ep[2]*ej+ep[6]*eh+ep[10]*ef];var eb=dH(ea,ei,en,0);var ed=[((eb>>16)&255)/255,((eb>>8)&255)/255,(eb&255)/255];d2("uLights.color.3d."+dL,dx,"uLights"+dL+".color",ed);d2("uLights.position.3d."+dL,dx,"uLights"+dL+".position",el.array());d2("uLights.direction.3d."+dL,dx,"uLights"+dL+".direction",ec);d2("uLights.concentration.3d."+dL,dx,"uLights"+dL+".concentration",eg);d2("uLights.angle.3d."+dL,dx,"uLights"+dL+".angle",ee);dZ("uLights.type.3d."+dL,dx,"uLights"+dL+".type",3);dZ("uLightCount3d",dx,"uLightCount",++dL)};bR.prototype.beginCamera=function(){throw"beginCamera() is not available in 2D mode"};bB.prototype.beginCamera=function(){if(ap){throw"You cannot call beginCamera() again before calling endCamera()"}ap=true;dJ=ch;aT=bV};bR.prototype.endCamera=function(){throw"endCamera() is not available in 2D mode"};bB.prototype.endCamera=function(){if(!ap){throw"You cannot call endCamera() before calling beginCamera()"}dJ.set(bV);aT.set(ch);ap=false};cW.camera=function(el,ek,ei,eg,ee,ed,et,er,ep){if(el===t){dl=cW.width/2;dj=cW.height/2;di=dj/q.tan(cK/2);el=dl;ek=dj;ei=di;eg=dl;ee=dj;ed=0;et=0;er=1;ep=0}var ef=new A(el-eg,ek-ee,ei-ed);var eh=new A(et,er,ep);ef.normalize();var ej=A.cross(eh,ef);eh=A.cross(ef,ej);ej.normalize();eh.normalize();var eu=ej.x,es=ej.y,eq=ej.z;var ec=eh.x,eb=eh.y,ea=eh.z;var eo=ef.x,en=ef.y,em=ef.z;bV.set(eu,es,eq,0,ec,eb,ea,0,eo,en,em,0,0,0,0,1);bV.translate(-el,-ek,-ei);ch.reset();ch.invApply(eu,es,eq,0,ec,eb,ea,0,eo,en,em,0,0,0,0,1);ch.translate(el,ek,ei);dJ.set(bV);aT.set(ch)};cW.perspective=function(ee,ec,ef,eb){if(arguments.length===0){dj=ae.height/2;di=dj/q.tan(cK/2);a0=di/10;av=di*10;b5=cW.width/cW.height;ee=cK;ec=b5;ef=a0;eb=av}var eg,ea,eh,ed;eg=ef*q.tan(ee/2);ea=-eg;eh=eg*ec;ed=ea*ec;cW.frustum(ed,eh,ea,eg,ef,eb)};bR.prototype.frustum=function(){throw"Processing.js: frustum() is not supported in 2D mode"};bB.prototype.frustum=function(eg,ec,eb,ef,ee,ea){ci=true;db=new aP;db.set(2*ee/(ec-eg),0,(ec+eg)/(ec-eg),0,0,2*ee/(ef-eb),(ef+eb)/(ef-eb),0,0,0,-(ea+ee)/(ea-ee),-(2*ea*ee)/(ea-ee),0,0,-1,0);var ed=new aP;ed.set(db);ed.transpose();d8.useProgram(dQ);a9("projection2d",dQ,"uProjection",false,ed.array());d8.useProgram(dx);a9("projection3d",dx,"uProjection",false,ed.array());d8.useProgram(bT);a9("uProjectionUS",bT,"uProjection",false,ed.array())};cW.ortho=function(eb,em,ea,ek,eh,eg){if(arguments.length===0){eb=0;em=cW.width;ea=0;ek=cW.height;eh=-10;eg=10}var el=2/(em-eb);var ej=2/(ek-ea);var ei=-2/(eg-eh);var ef=-(em+eb)/(em-eb);var ee=-(ek+ea)/(ek-ea);var ed=-(eg+eh)/(eg-eh);db=new aP;db.set(el,0,0,ef,0,ej,0,ee,0,0,ei,ed,0,0,0,1);var ec=new aP;ec.set(db);ec.transpose();d8.useProgram(dQ);a9("projection2d",dQ,"uProjection",false,ec.array());d8.useProgram(dx);a9("projection3d",dx,"uProjection",false,ec.array());d8.useProgram(bT);a9("uProjectionUS",bT,"uProjection",false,ec.array());ci=false};cW.printProjection=function(){db.print()};cW.printCamera=function(){bV.print()};bR.prototype.box=ds.prototype.a3DOnlyFunction;bB.prototype.box=function(ec,ef,eh){if(!ef||!eh){ef=eh=ec}var ee=new aP;ee.scale(ec,ef,eh);var eb=new aP;eb.scale(1,-1,1);eb.apply(dJ.array());eb.transpose();if(aH){d8.useProgram(dx);a9("model3d",dx,"uModel",false,ee.array());a9("view3d",dx,"uView",false,eb.array());d8.enable(d8.POLYGON_OFFSET_FILL);d8.polygonOffset(1,1);d2("color3d",dx,"uColor",bo);if(dL>0){var ed=new aP;ed.set(eb);var ea=new aP;ea.set(ee);ed.mult(ea);var eg=new aP;eg.set(ed);eg.invert();eg.transpose();a9("uNormalTransform3d",dx,"uNormalTransform",false,eg.array());dc("aNormal3d",dx,"aNormal",3,cJ)}else{cg("aNormal3d",dx,"aNormal")}dc("aVertex3d",dx,"aVertex",3,bh);cg("aColor3d",dx,"aColor");cg("aTexture3d",dx,"aTexture");d8.drawArrays(d8.TRIANGLES,0,dh.length/3);d8.disable(d8.POLYGON_OFFSET_FILL)}if(dW>0&&ce){d8.useProgram(dQ);a9("uModel2d",dQ,"uModel",false,ee.array());a9("uView2d",dQ,"uView",false,eb.array());d2("uColor2d",dQ,"uColor",c0);dZ("uIsDrawingText2d",dQ,"uIsDrawingText",false);dc("vertex2d",dQ,"aVertex",3,dk);cg("aTextureCoord2d",dQ,"aTextureCoord");d8.drawArrays(d8.LINES,0,bH.length/3)}};var cD=function(){var eb;cF=[];for(eb=0;eb0){var ec=new aP;ec.set(eb);var ea=new aP;ea.set(ed);ec.mult(ea);var ef=new aP;ef.set(ec);ef.invert();ef.transpose();a9("uNormalTransform3d",dx,"uNormalTransform",false,ef.array());dc("aNormal3d",dx,"aNormal",3,bg)}else{cg("aNormal3d",dx,"aNormal")}d8.useProgram(dx);cg("aTexture3d",dx,"aTexture");a9("uModel3d",dx,"uModel",false,ed.array());a9("uView3d",dx,"uView",false,eb.array());dc("aVertex3d",dx,"aVertex",3,bg);cg("aColor3d",dx,"aColor");d8.enable(d8.POLYGON_OFFSET_FILL);d8.polygonOffset(1,1);d2("uColor3d",dx,"uColor",bo);d8.drawArrays(d8.TRIANGLE_STRIP,0,cF.length/3);d8.disable(d8.POLYGON_OFFSET_FILL)}if(dW>0&&ce){d8.useProgram(dQ);a9("uModel2d",dQ,"uModel",false,ed.array());a9("uView2d",dQ,"uView",false,eb.array());dc("aVertex2d",dQ,"aVertex",3,bg);cg("aTextureCoord2d",dQ,"aTextureCoord");d2("uColor2d",dQ,"uColor",c0);dZ("uIsDrawingText",dQ,"uIsDrawingText",false);d8.drawArrays(d8.LINE_STRIP,0,cF.length/3)}};cW.modelX=function(eg,ef,ee){var ei=dJ.array();var ek=ch.array();var ea=ei[0]*eg+ei[1]*ef+ei[2]*ee+ei[3];var ej=ei[4]*eg+ei[5]*ef+ei[6]*ee+ei[7];var eh=ei[8]*eg+ei[9]*ef+ei[10]*ee+ei[11];var eb=ei[12]*eg+ei[13]*ef+ei[14]*ee+ei[15];var ec=ek[0]*ea+ek[1]*ej+ek[2]*eh+ek[3]*eb;var ed=ek[12]*ea+ek[13]*ej+ek[14]*eh+ek[15]*eb;return ed!==0?ec/ed:ec};cW.modelY=function(eg,ef,ee){var ei=dJ.array();var ek=ch.array();var ea=ei[0]*eg+ei[1]*ef+ei[2]*ee+ei[3];var ej=ei[4]*eg+ei[5]*ef+ei[6]*ee+ei[7];var eh=ei[8]*eg+ei[9]*ef+ei[10]*ee+ei[11];var eb=ei[12]*eg+ei[13]*ef+ei[14]*ee+ei[15];var ec=ek[4]*ea+ek[5]*ej+ek[6]*eh+ek[7]*eb;var ed=ek[12]*ea+ek[13]*ej+ek[14]*eh+ek[15]*eb;return ed!==0?ec/ed:ec};cW.modelZ=function(eg,ef,ee){var ei=dJ.array();var ek=ch.array();var ea=ei[0]*eg+ei[1]*ef+ei[2]*ee+ei[3];var ej=ei[4]*eg+ei[5]*ef+ei[6]*ee+ei[7];var eh=ei[8]*eg+ei[9]*ef+ei[10]*ee+ei[11];var ec=ei[12]*eg+ei[13]*ef+ei[14]*ee+ei[15];var eb=ek[8]*ea+ek[9]*ej+ek[10]*eh+ek[11]*ec;var ed=ek[12]*ea+ek[13]*ej+ek[14]*eh+ek[15]*ec;return ed!==0?eb/ed:eb};bR.prototype.ambient=ds.prototype.a3DOnlyFunction;bB.prototype.ambient=function(ed,ec,eb){d8.useProgram(dx);dZ("uUsingMat3d",dx,"uUsingMat",true);var ea=cW.color(ed,ec,eb);d2("uMaterialAmbient3d",dx,"uMaterialAmbient",cW.color.toGLArray(ea).slice(0,3))};bR.prototype.emissive=ds.prototype.a3DOnlyFunction;bB.prototype.emissive=function(ed,ec,eb){d8.useProgram(dx);dZ("uUsingMat3d",dx,"uUsingMat",true);var ea=cW.color(ed,ec,eb);d2("uMaterialEmissive3d",dx,"uMaterialEmissive",cW.color.toGLArray(ea).slice(0,3))};bR.prototype.shininess=ds.prototype.a3DOnlyFunction;bB.prototype.shininess=function(ea){d8.useProgram(dx);dZ("uUsingMat3d",dx,"uUsingMat",true);d2("uShininess3d",dx,"uShininess",ea)};bR.prototype.specular=ds.prototype.a3DOnlyFunction;bB.prototype.specular=function(ed,ec,eb){d8.useProgram(dx);dZ("uUsingMat3d",dx,"uUsingMat",true);var ea=cW.color(ed,ec,eb);d2("uMaterialSpecular3d",dx,"uMaterialSpecular",cW.color.toGLArray(ea).slice(0,3))};cW.screenX=function(eh,eg,ef){var ej=dJ.array();if(ej.length===16){var ea=ej[0]*eh+ej[1]*eg+ej[2]*ef+ej[3];var ek=ej[4]*eh+ej[5]*eg+ej[6]*ef+ej[7];var ei=ej[8]*eh+ej[9]*eg+ej[10]*ef+ej[11];var eb=ej[12]*eh+ej[13]*eg+ej[14]*ef+ej[15];var ee=db.array();var ec=ee[0]*ea+ee[1]*ek+ee[2]*ei+ee[3]*eb;var ed=ee[12]*ea+ee[13]*ek+ee[14]*ei+ee[15]*eb;if(ed!==0){ec/=ed}return cW.width*(1+ec)/2}return dJ.multX(eh,eg)};cW.screenY=function aA(eh,eg,ef){var ej=dJ.array();if(ej.length===16){var ea=ej[0]*eh+ej[1]*eg+ej[2]*ef+ej[3];var ek=ej[4]*eh+ej[5]*eg+ej[6]*ef+ej[7];var ei=ej[8]*eh+ej[9]*eg+ej[10]*ef+ej[11];var eb=ej[12]*eh+ej[13]*eg+ej[14]*ef+ej[15];var ee=db.array();var ec=ee[4]*ea+ee[5]*ek+ee[6]*ei+ee[7]*eb;var ed=ee[12]*ea+ee[13]*ek+ee[14]*ei+ee[15]*eb;if(ed!==0){ec/=ed}return cW.height*(1+ec)/2}return dJ.multY(eh,eg)};cW.screenZ=function ay(eh,eg,ef){var ej=dJ.array();if(ej.length!==16){return 0}var ee=db.array();var ea=ej[0]*eh+ej[1]*eg+ej[2]*ef+ej[3];var ek=ej[4]*eh+ej[5]*eg+ej[6]*ef+ej[7];var ei=ej[8]*eh+ej[9]*eg+ej[10]*ef+ej[11];var ec=ej[12]*eh+ej[13]*eg+ej[14]*ef+ej[15];var eb=ee[8]*ea+ee[9]*ek+ee[10]*ei+ee[11]*ec;var ed=ee[12]*ea+ee[13]*ek+ee[14]*ei+ee[15]*ec;if(ed!==0){eb/=ed}return(eb+1)/2};ds.prototype.fill=function(){var ea=cW.color(arguments[0],arguments[1],arguments[2],arguments[3]);if(ea===a1&&aH){return}aH=true;a1=ea};bR.prototype.fill=function(){ds.prototype.fill.apply(this,arguments);aq=true};bB.prototype.fill=function(){ds.prototype.fill.apply(this,arguments);bo=cW.color.toGLArray(a1)};function bn(){if(aH){if(aq){d8.fillStyle=cW.color.toString(a1);aq=false}d8.fill()}}cW.noFill=function(){aH=false};ds.prototype.stroke=function(){var ea=cW.color(arguments[0],arguments[1],arguments[2],arguments[3]);if(ea===cv&&ce){return}ce=true;cv=ea};bR.prototype.stroke=function(){ds.prototype.stroke.apply(this,arguments);b3=true};bB.prototype.stroke=function(){ds.prototype.stroke.apply(this,arguments);c0=cW.color.toGLArray(cv)};function dd(){if(ce){if(b3){d8.strokeStyle=cW.color.toString(cv);b3=false}d8.stroke()}}cW.noStroke=function(){ce=false};ds.prototype.strokeWeight=function(ea){dW=ea};bR.prototype.strokeWeight=function(ea){ds.prototype.strokeWeight.apply(this,arguments);d8.lineWidth=ea};bB.prototype.strokeWeight=function(ea){ds.prototype.strokeWeight.apply(this,arguments);d8.useProgram(dQ);d2("pointSize2d",dQ,"uPointSize",ea);d8.useProgram(bT);d2("pointSizeUnlitShape",bT,"uPointSize",ea);d8.lineWidth(ea)};cW.strokeCap=function(ea){dY.$ensureContext().lineCap=ea};cW.strokeJoin=function(ea){dY.$ensureContext().lineJoin=ea};bR.prototype.smooth=function(){dO=true;var ea=ae.style;ea.setProperty("image-rendering","optimizeQuality","important");ea.setProperty("-ms-interpolation-mode","bicubic","important");if(d8.hasOwnProperty("mozImageSmoothingEnabled")){d8.mozImageSmoothingEnabled=true}};bB.prototype.smooth=function(){dO=true};bR.prototype.noSmooth=function(){dO=false;var ea=ae.style;ea.setProperty("image-rendering","optimizeSpeed","important");ea.setProperty("image-rendering","-moz-crisp-edges","important");ea.setProperty("image-rendering","-webkit-optimize-contrast","important");ea.setProperty("image-rendering","optimize-contrast","important");ea.setProperty("-ms-interpolation-mode","nearest-neighbor","important");if(d8.hasOwnProperty("mozImageSmoothingEnabled")){d8.mozImageSmoothingEnabled=false}};bB.prototype.noSmooth=function(){dO=false};bR.prototype.point=function(ea,eb){if(!ce){return}ea=q.round(ea);eb=q.round(eb);d8.fillStyle=cW.color.toString(cv);aq=true;if(dW>1){d8.beginPath();d8.arc(ea,eb,dW/2,0,6.283185307179586,false);d8.fill()}else{d8.fillRect(ea,eb,1,1)}};bB.prototype.point=function(ea,ee,ed){var ec=new aP;ec.translate(ea,ee,ed||0);ec.transpose();var eb=new aP;eb.scale(1,-1,1);eb.apply(dJ.array());eb.transpose();d8.useProgram(dQ);a9("uModel2d",dQ,"uModel",false,ec.array());a9("uView2d",dQ,"uView",false,eb.array());if(dW>0&&ce){d2("uColor2d",dQ,"uColor",c0);dZ("uIsDrawingText2d",dQ,"uIsDrawingText",false);dZ("uSmooth2d",dQ,"uSmooth",dO);dc("aVertex2d",dQ,"aVertex",3,aw);cg("aTextureCoord2d",dQ,"aTextureCoord");d8.drawArrays(d8.POINTS,0,1)}};cW.beginShape=function(ea){dR=ea;d6=[];bb=[]};bR.prototype.vertex=function(eb,ed,ea){var ec=[];if(du){du=false}ec.isVert=true;ec[0]=eb;ec[1]=ed;ec[2]=0;ec[3]=0;ec[4]=0;ec[5]=a1;ec[6]=cv;bb.push(ec);if(ea){bb[bb.length-1]["moveTo"]=ea}};bB.prototype.vertex=function(ea,ef,ee,ed,ec){var eb=[];if(du){du=false}eb.isVert=true;if(ec===t&&dT){ec=ed;ed=ee;ee=0}if(ed!==t&&ec!==t){if(d4===2){ed/=cs.width;ec/=cs.height}ed=ed>1?1:ed;ed=ed<0?0:ed;ec=ec>1?1:ec;ec=ec<0?0:ec}eb[0]=ea;eb[1]=ef;eb[2]=ee||0;eb[3]=ed||0;eb[4]=ec||0;eb[5]=bo[0];eb[6]=bo[1];eb[7]=bo[2];eb[8]=bo[3];eb[9]=c0[0];eb[10]=c0[1];eb[11]=c0[2];eb[12]=c0[3];eb[13]=a8;eb[14]=a7;eb[15]=a6;bb.push(eb)};var d1=function(ec,eb){var ea=new aP;ea.scale(1,-1,1);ea.apply(dJ.array());ea.transpose();d8.useProgram(bT);a9("uViewUS",bT,"uView",false,ea.array());dZ("uSmoothUS",bT,"uSmooth",dO);dc("aVertexUS",bT,"aVertex",3,aw);d8.bufferData(d8.ARRAY_BUFFER,new e(ec),d8.STREAM_DRAW);dc("aColorUS",bT,"aColor",4,aG);d8.bufferData(d8.ARRAY_BUFFER,new e(eb),d8.STREAM_DRAW);d8.drawArrays(d8.POINTS,0,ec.length/3)};var bj=function(ee,ed,ec){var eb;if(ed==="LINES"){eb=d8.LINES}else{if(ed==="LINE_LOOP"){eb=d8.LINE_LOOP}else{eb=d8.LINE_STRIP}}var ea=new aP;ea.scale(1,-1,1);ea.apply(dJ.array());ea.transpose();d8.useProgram(bT);a9("uViewUS",bT,"uView",false,ea.array());dc("aVertexUS",bT,"aVertex",3,b8);d8.bufferData(d8.ARRAY_BUFFER,new e(ee),d8.STREAM_DRAW);dc("aColorUS",bT,"aColor",4,bC);d8.bufferData(d8.ARRAY_BUFFER,new e(ec),d8.STREAM_DRAW);d8.drawArrays(eb,0,ee.length/3)};var dm=function(ef,ee,ed,ec){var eb;if(ee==="TRIANGLES"){eb=d8.TRIANGLES}else{if(ee==="TRIANGLE_FAN"){eb=d8.TRIANGLE_FAN}else{eb=d8.TRIANGLE_STRIP}}var ea=new aP;ea.scale(1,-1,1);ea.apply(dJ.array());ea.transpose();d8.useProgram(dx);a9("model3d",dx,"uModel",false,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);a9("view3d",dx,"uView",false,ea.array());d8.enable(d8.POLYGON_OFFSET_FILL);d8.polygonOffset(1,1);d2("color3d",dx,"uColor",[-1,0,0,0]);dc("vertex3d",dx,"aVertex",3,at);d8.bufferData(d8.ARRAY_BUFFER,new e(ef),d8.STREAM_DRAW);if(dT&&bf!==null){bw(ed)}dc("aColor3d",dx,"aColor",4,aG);d8.bufferData(d8.ARRAY_BUFFER,new e(ed),d8.STREAM_DRAW);cg("aNormal3d",dx,"aNormal");if(dT){dZ("uUsingTexture3d",dx,"uUsingTexture",dT);dc("aTexture3d",dx,"aTexture",2,af);d8.bufferData(d8.ARRAY_BUFFER,new e(ec),d8.STREAM_DRAW)}d8.drawArrays(eb,0,ef.length/3);d8.disable(d8.POLYGON_OFFSET_FILL)};function cS(){bn();dd();d8.closePath()}bR.prototype.endShape=function(eh){if(bb.length===0){return}var ed=eh===2;if(ed){bb.push(bb[0])}var ec=[];var ea=[];var ej=[];var em=[];var ef=[];var ei;du=true;var eg,ee,eb;var el=bb.length;for(eg=0;eg3){var ek=[],en=1-aJ;d8.beginPath();d8.moveTo(bb[1][0],bb[1][1]);for(eg=1;eg+22){d8.beginPath();d8.moveTo(bb[0][0],bb[0][1]);d8.lineTo(bb[1][0],bb[1][1]);d8.lineTo(bb[2][0],bb[2][1]);if(aH){cW.fill(bb[2][5]);bn()}if(ce){cW.stroke(bb[2][6]);dd()}d8.closePath();for(eg=3;eg3){for(eg=0;eg+12){for(eg=0;eg+22){for(eg=0;eg+22){for(eg=0;eg<3;eg++){ei=bb[eg];for(ee=0;ee<3;ee++){ec.push(ei[ee])}}for(eg=0;eg<3;eg++){ei=bb[eg];for(ee=9;ee<13;ee++){em.push(ei[ee])}}if(ce){bj(ec,"LINE_LOOP",em)}for(eg=2;eg+13){for(eg=0;eg<2;eg++){ei=bb[eg];for(ee=0;ee<3;ee++){ec.push(ei[ee])}}for(eg=0;eg<2;eg++){ei=bb[eg];for(ee=9;ee<13;ee++){em.push(ei[ee])}}bj(ec,"LINE_STRIP",em);if(el>4&&el%2>0){ek=ea.splice(ea.length-3);bb.pop()}for(eg=0;eg+33){ar(cb[c2-4][0],cb[c2-4][1],cb[c2-4][2],cb[c2-3][0],cb[c2-3][1],cb[c2-3][2],cb[c2-2][0],cb[c2-2][1],cb[c2-2][2],cb[c2-1][0],cb[c2-1][1],cb[c2-1][2])}};bR.prototype.curve=function(ef,eh,ed,eg,eb,ee,ea,ec){cW.beginShape();cW.curveVertex(ef,eh);cW.curveVertex(ed,eg);cW.curveVertex(eb,ee);cW.curveVertex(ea,ec);cW.endShape()};bB.prototype.curve=function(ec,ek,eg,eb,ej,ef,ea,ei,ee,el,eh,ed){if(ed!==t){cW.beginShape();cW.curveVertex(ec,ek,eg);cW.curveVertex(eb,ej,ef);cW.curveVertex(ea,ei,ee);cW.curveVertex(el,eh,ed);cW.endShape();return}cW.beginShape();cW.curveVertex(ec,ek);cW.curveVertex(eg,eb);cW.curveVertex(ej,ef);cW.curveVertex(ea,ei);cW.endShape()};cW.curveTightness=function(ea){aJ=ea};cW.curveDetail=function(ea){Q=ea;dr()};cW.rectMode=function(ea){bK=ea};cW.imageMode=function(ea){switch(ea){case 0:bk=aZ;break;case 1:bk=b1;break;case 3:bk=aN;break;default:throw"Invalid imageMode"}};cW.ellipseMode=function(ea){cN=ea};cW.arc=function(em,ek,ed,eo,ec,el){if(ed<=0||el6.283185307179586){ec=0;el=6.283185307179586}var en=ed/2,ep=eo/2,eh=em+en,ef=ek+ep,eb=0|0.5+ec*cW.RAD_TO_DEG*2,ej=0|0.5+el*cW.RAD_TO_DEG*2,ei,eg;if(aH){var ee=ce;ce=false;cW.beginShape();cW.vertex(eh,ef);for(ei=eb;ei<=ej;ei++){eg=ei%720;cW.vertex(eh+bl[eg]*en,ef+ah[eg]*ep)}cW.endShape(2);ce=ee}if(ce){var ea=aH;aH=false;cW.beginShape();for(ei=eb;ei<=ej;ei++){eg=ei%720;cW.vertex(eh+bl[eg]*en,ef+ah[eg]*ep)}cW.endShape();aH=ea}};bR.prototype.line=function(eb,ei,ea,eg){if(!ce){return}eb=q.round(eb);ea=q.round(ea);ei=q.round(ei);eg=q.round(eg);if(eb===ea&&ei===eg){cW.point(eb,ei);return}var ec=t,ej=t,ef=true,eh=dJ.array(),ed=[1,0,0,0,1,0];for(var ee=0;ee<6&&ef;ee++){ef=eh[ee]===ed[ee]}if(ef){if(eb===ea){if(ei>eg){ec=ei;ei=eg;eg=ec}eg++;if(dW%2===1){d8.translate(0.5,0)}}else{if(ei===eg){if(eb>ea){ec=eb;eb=ea;ea=ec}ea++;if(dW%2===1){d8.translate(0,0.5)}}}if(dW===1){ej=d8.lineCap;d8.lineCap="butt"}}d8.beginPath();d8.moveTo(eb||0,ei||0);d8.lineTo(ea||0,eg||0);dd();if(ef){if(eb===ea&&dW%2===1){d8.translate(-0.5,0)}else{if(ei===eg&&dW%2===1){d8.translate(0,-0.5)}}if(dW===1){d8.lineCap=ej}}};bB.prototype.line=function(ec,ef,eh,eb,ed,eg){if(ed===t||eg===t){eg=0;ed=eb;eb=eh;eh=0}if(ec===eb&&ef===ed&&eh===eg){cW.point(ec,ef,eh);return}var ee=[ec,ef,eh,eb,ed,eg];var ea=new aP;ea.scale(1,-1,1);ea.apply(dJ.array());ea.transpose();if(dW>0&&ce){d8.useProgram(dQ);a9("uModel2d",dQ,"uModel",false,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]);a9("uView2d",dQ,"uView",false,ea.array());d2("uColor2d",dQ,"uColor",c0);dZ("uIsDrawingText",dQ,"uIsDrawingText",false);dc("aVertex2d",dQ,"aVertex",3,b8);cg("aTextureCoord2d",dQ,"aTextureCoord");d8.bufferData(d8.ARRAY_BUFFER,new e(ee),d8.STREAM_DRAW);d8.drawArrays(d8.LINES,0,2)}};bR.prototype.bezier=function(){if(arguments.length!==8){throw"You must use 8 parameters for bezier() in 2D mode"}cW.beginShape();cW.vertex(arguments[0],arguments[1]);cW.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]);cW.endShape()};bB.prototype.bezier=function(){if(arguments.length!==12){throw"You must use 12 parameters for bezier() in 3D mode"}cW.beginShape();cW.vertex(arguments[0],arguments[1],arguments[2]);cW.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]);cW.endShape()};cW.bezierDetail=function(ea){cy=ea};cW.bezierPoint=function(eb,ea,ee,ed,ec){return(1-ec)*(1-ec)*(1-ec)*eb+3*(1-ec)*(1-ec)*ec*ea+3*(1-ec)*ec*ec*ee+ec*ec*ec*ed};cW.bezierTangent=function(eb,ea,ee,ed,ec){return 3*ec*ec*(-eb+3*ea-3*ee+ed)+6*ec*(eb-2*ea+ee)+3*(-eb+ea)};cW.curvePoint=function(eb,ea,ee,ed,ec){return 0.5*(2*ea+(-eb+ee)*ec+(2*eb-5*ea+4*ee-ed)*ec*ec+(-eb+3*ea-3*ee+ed)*ec*ec*ec)};cW.curveTangent=function(eb,ea,ee,ed,ec){return 0.5*(-eb+ee+2*(2*eb-5*ea+4*ee-ed)*ec+3*(-eb+3*ea-3*ee+ed)*ec*ec)};cW.triangle=function(ed,ef,eb,ee,ea,ec){cW.beginShape(9);cW.vertex(ed,ef,0);cW.vertex(eb,ee,0);cW.vertex(ea,ec,0);cW.endShape()};cW.quad=function(ef,eh,ed,eg,eb,ee,ea,ec){cW.beginShape(16);cW.vertex(ef,eh,0);cW.vertex(ed,eg,0);cW.vertex(eb,ee,0);cW.vertex(ea,ec,0);cW.endShape()};var bN=function(eg,ef,ea,eh,ej,ee,ei,eb){if(eb===t){ee=ej;ei=ej;eb=ej}var ec=ea/2,ed=eh/2;if(ej>ec||ej>ed){ej=q.min(ec,ed)}if(ee>ec||ee>ed){ee=q.min(ec,ed)}if(ei>ec||ei>ed){ei=q.min(ec,ed)}if(eb>ec||eb>ed){eb=q.min(ec,ed)}if(!aH||ce){d8.translate(0.5,0.5)}d8.beginPath();d8.moveTo(eg+ej,ef);d8.lineTo(eg+ea-ee,ef);d8.quadraticCurveTo(eg+ea,ef,eg+ea,ef+ee);d8.lineTo(eg+ea,ef+eh-ei);d8.quadraticCurveTo(eg+ea,ef+eh,eg+ea-ei,ef+eh);d8.lineTo(eg+eb,ef+eh);d8.quadraticCurveTo(eg,ef+eh,eg,ef+eh-eb);d8.lineTo(eg,ef+ej);d8.quadraticCurveTo(eg,ef,eg+ej,ef);if(!aH||ce){d8.translate(-0.5,-0.5)}bn();dd()};bR.prototype.rect=function(eb,eh,ee,ea,ec,ef,ed,eg){if(!ee&&!ea){return}if(bK===1){ee-=eb;ea-=eh}else{if(bK===2){ee*=2;ea*=2;eb-=ee/2;eh-=ea/2}else{if(bK===3){eb-=ee/2;eh-=ea/2}}}eb=q.round(eb);eh=q.round(eh);ee=q.round(ee);ea=q.round(ea);if(ec!==t){bN(eb,eh,ee,ea,ec,ef,ed,eg);return}if(ce&&dW%2===1){d8.translate(0.5,0.5)}d8.beginPath();d8.rect(eb,eh,ee,ea);bn();dd();if(ce&&dW%2===1){d8.translate(-0.5,-0.5)}};bB.prototype.rect=function(ei,eh,ea,ek,em,ef,el,eb){if(em!==t){throw"rect() with rounded corners is not supported in 3D mode"}if(bK===1){ea-=ei;ek-=eh}else{if(bK===2){ea*=2;ek*=2;ei-=ea/2;eh-=ek/2}else{if(bK===3){ei-=ea/2;eh-=ek/2}}}var ee=new aP;ee.translate(ei,eh,0);ee.scale(ea,ek,1);ee.transpose();var eg=new aP;eg.scale(1,-1,1);eg.apply(dJ.array());eg.transpose();if(dW>0&&ce){d8.useProgram(dQ);a9("uModel2d",dQ,"uModel",false,ee.array());a9("uView2d",dQ,"uView",false,eg.array());d2("uColor2d",dQ,"uColor",c0);dZ("uIsDrawingText2d",dQ,"uIsDrawingText",false);dc("aVertex2d",dQ,"aVertex",3,aB);cg("aTextureCoord2d",dQ,"aTextureCoord");d8.drawArrays(d8.LINE_LOOP,0,ak.length/3)}if(aH){d8.useProgram(dx);a9("uModel3d",dx,"uModel",false,ee.array());a9("uView3d",dx,"uView",false,eg.array());d8.enable(d8.POLYGON_OFFSET_FILL);d8.polygonOffset(1,1);d2("color3d",dx,"uColor",bo);if(dL>0){var ej=new aP;ej.set(eg);var ec=new aP;ec.set(ee);ej.mult(ec);var ed=new aP;ed.set(ej);ed.invert();ed.transpose();a9("uNormalTransform3d",dx,"uNormalTransform",false,ed.array());dc("aNormal3d",dx,"aNormal",3,b2)}else{cg("normal3d",dx,"aNormal")}dc("vertex3d",dx,"aVertex",3,aB);d8.drawArrays(d8.TRIANGLE_FAN,0,ak.length/3);d8.disable(d8.POLYGON_OFFSET_FILL)}};bR.prototype.ellipse=function(eg,ef,eb,ei){eg=eg||0;ef=ef||0;if(eb<=0&&ei<=0){return}if(cN===2){eb*=2;ei*=2}else{if(cN===1){eb=eb-eg;ei=ei-ef;eg+=eb/2;ef+=ei/2}else{if(cN===0){eg+=eb/2;ef+=ei/2}}}if(eb===ei){d8.beginPath();d8.arc(eg,ef,eb/2,0,6.283185307179586,false);bn();dd()}else{var eh=eb/2,ee=ei/2,ea=0.5522847498307933,ed=ea*eh,ec=ea*ee;cW.beginShape();cW.vertex(eg+eh,ef);cW.bezierVertex(eg+eh,ef-ec,eg+ed,ef-ee,eg,ef-ee);cW.bezierVertex(eg-ed,ef-ee,eg-eh,ef-ec,eg-eh,ef);cW.bezierVertex(eg-eh,ef+ec,eg-ed,ef+ee,eg,ef+ee);cW.bezierVertex(eg+ed,ef+ee,eg+eh,ef+ec,eg+eh,ef);cW.endShape()}};bB.prototype.ellipse=function(en,em,ec,ep){en=en||0;em=em||0;if(ec<=0&&ep<=0){return}if(cN===2){ec*=2;ep*=2}else{if(cN===1){ec=ec-en;ep=ep-em;en+=ec/2;em+=ep/2}else{if(cN===0){en+=ec/2;em+=ep/2}}}var eo=ec/2,ej=ep/2,ea=0.5522847498307933,ee=ea*eo,ed=ea*ej;cW.beginShape();cW.vertex(en+eo,em);cW.bezierVertex(en+eo,em-ed,0,en+ee,em-ej,0,en,em-ej,0);cW.bezierVertex(en-ee,em-ej,0,en-eo,em-ed,0,en-eo,em,0);cW.bezierVertex(en-eo,em+ed,0,en-ee,em+ej,0,en,em+ej,0);cW.bezierVertex(en+ee,em+ej,0,en+eo,em+ed,0,en+eo,em,0);cW.endShape();if(aH){var ef=0,ek=0,eh,eg;for(eh=0;eh>16)&255;ed[ee+1]=(ef>>8)&255;ed[ee+2]=ef&255;ed[ee+3]=(ef>>24)&255;eb.__isDirty=true}}(ea),toArray:function(eb){return function(){var ec=[],ef=eb.imageData.data,ee=eb.width*eb.height;if(eb.isRemote){throw"Image is loaded remotely. Cannot get pixels."}for(var ed=0,eg=0;ed>16)&255;ef[eg+1]=(eh>>8)&255;ef[eg+2]=eh&255;ef[eg+3]=(eh>>24)&255}eb.__isDirty=true}}(ea)}}var cG=function(ed,eg,ee){this.__isDirty=false;if(ed instanceof HTMLImageElement){this.fromHTMLImageData(ed)}else{if(eg||ee){this.width=ed||1;this.height=eg||1;var eb=this.sourceImg=d.createElement("canvas");eb.width=this.width;eb.height=this.height;var eh=this.imageData=eb.getContext("2d").createImageData(this.width,this.height);this.format=ee===2||ee===4?ee:1;if(this.format===1){for(var ec=3,ef=this.imageData.data,ea=ef.length;ec=cW.width||ea<0||ed<0||ed>=cW.height){return 0}if(dV){var ec=((0|ea)+cW.width*(0|ed))*4;eb=cW.imageData.data;return(eb[ec+3]&255)<<24|(eb[ec]&255)<<16|(eb[ec+1]&255)<<8|eb[ec+2]&255}eb=cW.toImageData(0|ea,0|ed,1,1).data;return(eb[3]&255)<<24|(eb[0]&255)<<16|(eb[1]&255)<<8|eb[2]&255}function c8(ea,ee,eb){if(eb.isRemote){throw"Image is loaded remotely. Cannot get x,y."}var ed=ee*eb.width*4+ea*4,ec=eb.imageData.data;return(ec[ed+3]&255)<<24|(ec[ed]&255)<<16|(ec[ed+1]&255)<<8|ec[ed+2]&255}function c6(ea,ee,eb,ec){var ed=new cG(eb,ec,2);ed.fromImageData(cW.toImageData(ea,ee,eb,ec));return ed}function c5(ef,ee,eg,el,er){if(er.isRemote){throw"Image is loaded remotely. Cannot get x,y,w,h."}var ep=new cG(eg,el,2),ec=ep.imageData.data,ed=er.width,em=er.height,eo=er.imageData.data;var ea=q.max(0,-ee),eb=q.max(0,-ef),eh=q.min(el,em-ee),ei=q.min(eg,ed-ef);for(var ek=ea;ek=0&&ec>=0&&ecbZ){T()}}}function bv(ea,eg,ed,eb){if(eb.isRemote){throw"Image is loaded remotely. Cannot set x,y."}var ef=cW.color.toArray(ed);var ee=eg*eb.width*4+ea*4;var ec=eb.imageData.data;ec[ee]=ef[0];ec[ee+1]=ef[1];ec[ee+2]=ef[2];ec[ee+3]=ef[3]}cW.set=function(ea,ef,ed,ec){var eb,ee;if(arguments.length===3){if(typeof ed==="number"){bx(ea,ef,ed)}else{if(ed instanceof cG||ed.__isPImage){cW.image(ed,ea,ef)}}}else{if(arguments.length===4){bv(ea,ef,ed,ec)}}};cW.imageData={};cW.pixels={getLength:function(){return cW.imageData.data.length?cW.imageData.data.length/4:0},getPixel:function(ea){var ec=ea*4,eb=cW.imageData.data;return eb[ec+3]<<24&4278190080|eb[ec+0]<<16&16711680|eb[ec+1]<<8&65280|eb[ec+2]&255},setPixel:function(ea,ed){var ec=ea*4,eb=cW.imageData.data;eb[ec+0]=(ed&16711680)>>>16;eb[ec+1]=(ed&65280)>>>8;eb[ec+2]=ed&255;eb[ec+3]=(ed&4278190080)>>>24},toArray:function(){var ea=[],ec=cW.imageData.width*cW.imageData.height,ed=cW.imageData.data;for(var eb=0,ee=0;eb0){bE(ed,ec,eb,ea)}var ee=cW.color.toGLArray(a4);d8.clearColor(ee[0],ee[1],ee[2],ee[3]);d8.clear(d8.COLOR_BUFFER_BIT|d8.DEPTH_BUFFER_BIT)};bR.prototype.image=function(ed,ei,eg,ej,ee){ei=q.round(ei);eg=q.round(eg);if(ed.width>0){var ek=ej||ed.width;var eh=ee||ed.height;var ea=bk(ei||0,eg||0,ej||ed.width,ee||ed.height,arguments.length<4);var ef=!!ed.sourceImg&&bf===null;if(ef){var eb=ed.sourceImg;if(ed.__isDirty){ed.updatePixels()}d8.drawImage(eb,0,0,eb.width,eb.height,ea.x,ea.y,ea.w,ea.h)}else{var ec=ed.toImageData();if(bf!==null){bf(ec);ed.__isDirty=true}d8.drawImage(by(ec).canvas,0,0,ed.width,ed.height,ea.x,ea.y,ea.w,ea.h)}}};bB.prototype.image=function(ec,ea,ee,eb,ed){if(ec.width>0){ea=q.round(ea);ee=q.round(ee);eb=eb||ec.width;ed=ed||ec.height;cW.beginShape(cW.QUADS);cW.texture(ec);cW.vertex(ea,ee,0,0,0);cW.vertex(ea,ee+ed,0,0,ed);cW.vertex(ea+eb,ee+ed,0,eb,ed);cW.vertex(ea+eb,ee,0,eb,0);cW.endShape()}};cW.tint=function(ed,ec,ea,ei){var ef=cW.color(ed,ec,ea,ei);var eb=cW.red(ef)/bJ;var ee=cW.green(ef)/bI;var eg=cW.blue(ef)/bG;var eh=cW.alpha(ef)/bU;bf=function(em){var el=em.data,ek=4*em.width*em.height;for(var ej=0;ej=ea){break}ep=0}for(ex=ep;ex=ea){break}ee=(ev+eB)*4;es=eg[ex];er+=es*ed[ee+3];ef+=es*ed[ee];el+=es*ed[ee+1];eq+=es*ed[ee+2];ec+=es;ev++}en=eB+ek;eC[en]=er/ec;eu[en]=ef/ec;eD[en]=el/ec;eh[en]=eq/ec}eB+=ea}eB=0;ez=-em;ey=ez*ea;for(ej=0;ej=eb){break}ep=0;en=ez;ev=ek+ey}for(ex=ep;ex=eb){break}es=eg[ex];er+=es*eC[ev];ef+=es*eu[ev];el+=es*eD[ev];eq+=es*eh[ev];ec+=es;en++;ev+=ea}ee=(ek+eB)*4;ed[ee]=ef/ec;ed[ee+1]=el/ec;ed[ee+2]=eq/ec;ed[ee+3]=er/ec}eB+=ea;ey+=ea;ez++}};var cf=function(er,el){var eh=0;var ev=el.pixels.getLength();var em=new K(ev);var ep,eb,ek,ej,ed;var eq,ee,eg,ei,ec,en,eu,ea,es,ef,et,eo;if(!er){while(eh=eb){eq=eh}if(eg<0){eg=0}if(ei>=ev){ei=eh}eu=el.pixels.getPixel(eg);en=el.pixels.getPixel(ee);ea=el.pixels.getPixel(ei);ec=el.pixels.getPixel(eq);ed=77*(ek>>16&255)+151*(ek>>8&255)+28*(ek&255);ef=77*(en>>16&255)+151*(en>>8&255)+28*(en&255);es=77*(ec>>16&255)+151*(ec>>8&255)+28*(ec&255);et=77*(eu>>16&255)+151*(eu>>8&255)+28*(eu&255);eo=77*(ea>>16&255)+151*(ea>>8&255)+28*(ea&255);if(ef>ed){ej=en;ed=ef}if(es>ed){ej=ec;ed=es}if(et>ed){ej=eu;ed=et}if(eo>ed){ej=ea;ed=eo}em[eh++]=ej}}}else{while(eh=eb){eq=eh}if(eg<0){eg=0}if(ei>=ev){ei=eh}eu=el.pixels.getPixel(eg);en=el.pixels.getPixel(ee);ea=el.pixels.getPixel(ei);ec=el.pixels.getPixel(eq);ed=77*(ek>>16&255)+151*(ek>>8&255)+28*(ek&255);ef=77*(en>>16&255)+151*(en>>8&255)+28*(en&255);es=77*(ec>>16&255)+151*(ec>>8&255)+28*(ec&255);et=77*(eu>>16&255)+151*(eu>>8&255)+28*(eu&255);eo=77*(ea>>16&255)+151*(ea>>8&255)+28*(ea&255);if(ef>16&255)+151*(ef>>8&255)+28*(ef&255)>>8;ek.pixels.setPixel(ej,ef&4278190080|eb<<16|eb<<8|eb)}}break;case 13:for(ej=0;ej255){throw"Levels must be between 2 and 255 for filter(POSTERIZE, levels)"}var ei=ep-1;for(ej=0;ej>16&255;var en=ek.pixels.getPixel(ej)>>8&255;var ec=ek.pixels.getPixel(ej)&255;ea=(ea*ep>>8)*255/ei;en=(en*ep>>8)*255/ei;ec=(ec*ep>>8)*255/ei;ek.pixels.setPixel(ej,4278190080&ek.pixels.getPixel(ej)|ea<<16|en<<8|ec)}break;case 14:for(ej=0;ej1){throw"Level must be between 0 and 1 for filter(THRESHOLD, level)"}var ee=cW.floor(eg*255);for(ej=0;ej>16,cW.max((ek.pixels.getPixel(ej)&65280)>>8,ek.pixels.getPixel(ej)&255));ek.pixels.setPixel(ej,ek.pixels.getPixel(ej)&4278190080|(eoel){ea=el}}else{var ek=el+ec-en;if(ea>ek){ea=ek}}if(egee){eh=ee}}else{var ed=ee+ej-eg;if(eh>ed){eh=ed}}return !(ea<=0||eh<=0)};var dS={};dS[1]=cW.modes.blend;dS[2]=cW.modes.add;dS[4]=cW.modes.subtract;dS[8]=cW.modes.lightest;dS[16]=cW.modes.darkest;dS[0]=cW.modes.replace;dS[32]=cW.modes.difference;dS[64]=cW.modes.exclusion;dS[128]=cW.modes.multiply;dS[256]=cW.modes.screen;dS[512]=cW.modes.overlay;dS[1024]=cW.modes.hard_light;dS[2048]=cW.modes.soft_light;dS[4096]=cW.modes.dodge;dS[8192]=cW.modes.burn;cW.blit_resize=function(en,ez,et,ey,es,eE,ej,er,ex,eo,ew,em,ep){var eC,eB;if(ez<0){ez=0}if(et<0){et=0}if(ey>=en.width){ey=en.width-1}if(es>=en.height){es=en.height-1}var eI=ey-ez;var eN=es-et;var ea=ew-ex;var ek=em-eo;if(ea<=0||ek<=0||eI<=0||eN<=0||ex>=ej||eo>=er||ez>=en.width||et>=en.height){return}var eh=q.floor(eI/ea*32768);var ee=q.floor(eN/ek*32768);var eG=cW.shared;eG.srcXOffset=q.floor(ex<0?-ex*eh:ez*32768);eG.srcYOffset=q.floor(eo<0?-eo*ee:et*32768);if(ex<0){ea+=ex;ex=0}if(eo<0){ek+=eo;eo=0}ea=q.min(ea,ej-ex);ek=q.min(ek,er-eo);var eu=eo*ej+ex;var eQ;eG.srcBuffer=en.imageData.data;eG.iw=en.width;eG.iw1=en.width-1;eG.ih1=en.height-1;var ev=cW.filter_bilinear,eK=cW.filter_new_scanline,ei=dS[ep],eH,eM,eF,eJ,ec,ed,eb=4278190080,eL=16711680,eA=65280,eg=255,eP=32767,eD=15,el=1,eq=9,ef=eG.srcBuffer,eO=q.min;for(eB=0;eB>eD)*eG.iw;eG.v2=eO((eG.srcYOffset>>eD)+1,eG.ih1)*eG.iw;for(eC=0;eC>eD;eG.ll=eG.ifU*eG.fracV>>eD;eG.ur=eG.fracU*eG.ifV>>eD;eG.lr=eG.fracU*eG.fracV>>eD;eG.u1=eG.sX>>eD;eG.u2=eO(eG.u1+1,eG.iw1);eF=(eG.v1+eG.u1)*4;eJ=(eG.v1+eG.u2)*4;ec=(eG.v2+eG.u1)*4;ed=(eG.v2+eG.u2)*4;eG.cUL=ef[eF+3]<<24&eb|ef[eF]<<16&eL|ef[eF+1]<<8&eA|ef[eF+2]⪚eG.cUR=ef[eJ+3]<<24&eb|ef[eJ]<<16&eL|ef[eJ+1]<<8&eA|ef[eJ+2]⪚eG.cLL=ef[ec+3]<<24&eb|ef[ec]<<16&eL|ef[ec+1]<<8&eA|ef[ec+2]⪚eG.cLR=ef[ed+3]<<24&eb|ef[ed]<<16&eL|ef[ed+1]<<8&eA|ef[ed+2]⪚eG.r=eG.ul*((eG.cUL&eL)>>16)+eG.ll*((eG.cLL&eL)>>16)+eG.ur*((eG.cUR&eL)>>16)+eG.lr*((eG.cLR&eL)>>16)<>>eD&eA;eG.b=eG.ul*(eG.cUL&eg)+eG.ll*(eG.cLL&eg)+eG.ur*(eG.cUR&eg)+eG.lr*(eG.cLR&eg)>>>eD;eG.a=eG.ul*((eG.cUL&eb)>>>24)+eG.ll*((eG.cLL&eb)>>>24)+eG.ur*((eG.cUR&eb)>>>24)+eG.lr*((eG.cLR&eb)>>>24)<>>16;eE[eM+1]=(eH&eA)>>>8;eE[eM+2]=eH⪚eE[eM+3]=(eH&eb)>>>24;eG.sX+=eh}eu+=ej;eG.srcYOffset+=ee}};cW.loadFont=function(eb,ec){if(eb===t){throw"font name required in loadFont."}if(eb.indexOf(".svg")===-1){if(ec===t){ec=W.size}return H.get(eb,ec)}var ea=cW.loadGlyphs(eb);return{name:eb,css:"12px sans-serif",glyph:true,units_per_em:ea.units_per_em,horiz_adv_x:1/ea.units_per_em*ea.horiz_adv_x,ascent:ea.ascent,descent:ea.descent,width:function(eh){var ef=0;var ed=eh.length;for(var ee=0;ee":return ea.greater;case"?":return ea.question;case"@":return ea.at;case"[":return ea.bracketleft;case"\\":return ea.backslash;case"]":return ea.bracketright;case"^":return ea.asciicircum;case"`":return ea.grave;case"{":return ea.braceleft;case"|":return ea.bar;case"}":return ea.braceright;case"~":return ea.asciitilde;default:return ea[eb]}}catch(ec){F.debug(ec)}};bR.prototype.text$line=function(ei,el,ek,ej,ef){var eh=0,eg=0;if(!W.glyph){if(ei&&"fillText" in d8){if(aq){d8.fillStyle=cW.color.toString(a1);aq=false}if(ef===39||ef===3){eh=W.measureTextWidth(ei);if(ef===39){eg=-eh}else{eg=-eh/2}}d8.fillText(ei,el+eg,ek)}}else{var ea=cW.glyphTable[Y];aD();d8.translate(el,ek+d0);if(ef===39||ef===3){eh=ea.width(ei);if(ef===39){eg=-eh}else{eg=-eh/2}}var em=ea.units_per_em,ee=1/em*d0;d8.scale(ee,ee);for(var eb=0,ec=ei.length;eben){return}var em=-1;var ee=0;var ea=0;var eg=[];for(var ef=0,es=eq.length;ef0){em=ef}else{return}}if(eh==="\n"){eg.push({text:eq.substring(ee,ef),width:ea});ee=ef+1}else{eg.push({text:eq.substring(ee,em+1),width:ea});ee=em+1}ea=0;ef=ee-1}}if(eeen-dA){break}ed=eg[ec];dY.text$line(ed.text,el+eu,ek+ei+et,ej,N)}}cW.text=function(){if(cI===5){return}if(arguments.length===3){bi(bu(arguments[0]),arguments[1],arguments[2],0)}else{if(arguments.length===4){bi(bu(arguments[0]),arguments[1],arguments[2],arguments[3])}else{if(arguments.length===5){bd(bu(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0)}else{if(arguments.length===6){bd(bu(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}}}}};cW.textMode=function(ea){cI=ea};cW.loadGlyphs=function(eg){var ei,eh,ee,ec,ep,eo,en,eq,ek,er,el,em="[0-9\\-]+",ej;var ef=function(ex,ew){var eu=0,et=[],es,ev=new RegExp(ex,"g");es=et[eu]=ev.exec(ew);while(es){eu++;es=et[eu]=ev.exec(ew)}return et};var eb=function(ex){var ey=ef("[A-Za-z][0-9\\- ]+|Z",ex);var ew=function(){aD();return dY.$ensureContext()};var eu=function(){bn();dd();cP()};ej="return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();";ei=0;eh=0;ee=0;ec=0;ep=0;eo=0;ex=0;eq=0;ek="";er=ey.length-1;for(var et=0;et([=]?)/g,aa)}while(Z);var bk=aE(aA);var al;var aJ={},a9,az=0;function bc(br,bq){var bs=bk.length;bk.push(br);return'"'+bq+bs+'"'}function a7(){return"class"+ ++az}function bl(br,bs,bq){br.classId=bs;br.scopeId=bq;aJ[bs]=br}var V,S,ap,aV,bi,aZ;var O=/\b((?:(?:public|private|final|protected|static|abstract)\s+)*)(class|interface)\s+([A-Za-z_$][\w$]*\b)(\s+extends\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?(\s+implements\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?\s*("A\d+")/g;var bb=/\b((?:(?:public|private|final|protected|static|abstract|synchronized)\s+)*)((?!(?:else|new|return|throw|function|public|private|protected)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+"|;)/g;var aM=/^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:else|new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*(?:"C\d+"\s*)*([=,]|$)/;var bm=/\b((?:(?:public|private|final|protected|static|abstract)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+")/g;var W=/^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*/;var au=/\bfunction(?:\s+([A-Za-z_$][\w$]*))?\s*("B\d+")\s*("A\d+")/g;function ae(br){var bq=br;bq=bq.replace(O,function(bs){return bc(bs,"E")});bq=bq.replace(bb,function(bs){return bc(bs,"D")});bq=bq.replace(au,function(bs){return bc(bs,"H")});return bq}function bd(bs,br){var bq=bs.replace(bm,function(bx,bu,bv,by,bw,bt){if(bv!==br){return bx}return bc(bx,"G")});return bq}function aH(bq){this.name=bq}aH.prototype.toString=function(){return this.name};function ao(br,bq){this.params=br;this.methodArgsParam=bq}ao.prototype.getNames=function(){var bs=[];for(var br=0,bq=this.params.length;br=0){bu=new aH(bv[1]);break}bq.push(new aH(bv[1]))}}return new ao(bq,bu)}function aq(bu){var bt=bu;bt=bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"C\d+")+\s*("A\d+")/g,function(bw,bv,bx){return bx});bt=bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"B\d+")\s*("A\d+")/g,function(bw,bv,bx){return bc(bw,"F")});bt=bt.replace(au,function(bv){return bc(bv,"H")});bt=bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*("C\d+"(?:\s*"C\d+")*)/g,function(bA,bz,bx){var bw=bx.replace(/"C(\d+)"/g,function(bC,bB){return bk[bB]}).replace(/\[\s*\]/g,"[null]").replace(/\s*\]\s*\[\s*/g,", ");var by="{"+bw.substring(1,bw.length-1)+"}";var bv="('"+bz+"', "+bc(by,"A")+")";return"$p.createJavaArray"+bc(bv,"B")});bt=bt.replace(/(\.\s*length)\s*"B\d+"/g,"$1");bt=bt.replace(/#([0-9A-Fa-f]{6})\b/g,function(bv,bw){return"0xFF"+bw});bt=bt.replace(/"B(\d+)"(\s*(?:[\w$']|"B))/g,function(by,bw,bx){var bz=bk[bw];if(!/^\(\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\s*(?:"C\d+"\s*)*\)$/.test(bz)){return by}if(/^\(\s*int\s*\)$/.test(bz)){return"(int)"+bx}var bv=bz.split(/"C(\d+)"/g);if(bv.length>1){if(!/^\[\s*\]$/.test(bk[bv[1]])){return by}}return""+bx});bt=bt.replace(/\(int\)([^,\]\)\}\?\:\*\+\-\/\^\|\%\&\~<\>\=]+)/g,function(bw,bv){var bx=aP(bv);return bx.untrim("__int_cast("+bx.middle+")")});bt=bt.replace(/\bsuper(\s*"B\d+")/g,"$$superCstr$1").replace(/\bsuper(\s*\.)/g,"$$super$1");bt=bt.replace(/\b0+((\d*)(?:\.[\d*])?(?:[eE][\-\+]?\d+)?[fF]?)\b/,function(bx,bw,bv){if(bw===bv){return bx}return bv===""?"0"+bw:bw});bt=bt.replace(/\b(\.?\d+\.?)[fF]\b/g,"$1");bt=bt.replace(/([^\s])%([^=\s])/g,"$1 % $2");bt=bt.replace(/\b(frameRate|keyPressed|mousePressed)\b(?!\s*"B)/g,"__$1");bt=bt.replace(/\b(boolean|byte|char|float|int)\s*"B/g,function(bw,bv){return"parse"+bv.substring(0,1).toUpperCase()+bv.substring(1)+'"B'});bt=bt.replace(/\bpixels\b\s*(("C(\d+)")|\.length)?(\s*=(?!=)([^,\]\)\}]+))?/g,function(bw,bA,bv,bz,by,bB){if(bv){var bx=bk[bz];if(by){return"pixels.setPixel"+bc("("+bx.substring(1,bx.length-1)+","+bB+")","B")}return"pixels.getPixel"+bc("("+bx.substring(1,bx.length-1)+")","B")}if(bA){return"pixels.getLength"+bc("()","B")}if(by){return"pixels.set"+bc("("+bB+")","B")}return"pixels.toArray"+bc("()","B")});var bs;function br(bw,bv,bA,by){var bx=bk[by];bs=true;var bz=aP(bx.substring(1,bx.length-1));return"__"+bA+(bz.middle===""?bc("("+bv.replace(/\.\s*$/,"")+")","B"):bc("("+bv.replace(/\.\s*$/,"")+","+bz.middle+")","B"))}do{bs=false;bt=bt.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*\.\s*(?:[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*\.\s*)*)(replace|replaceAll|replaceFirst|contains|equals|equalsIgnoreCase|hashCode|toCharArray|printStackTrace|split|startsWith|endsWith|codePointAt|matches)\s*"B(\d+)"/g,br)}while(bs);function bq(bx,bv,bw){bs=true;return"__instanceof"+bc("("+bv+", "+bw+")","B")}do{bs=false;bt=bt.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*(?:\.\s*[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*)*)instanceof\s+([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)/g,bq)}while(bs);bt=bt.replace(/\bthis(\s*"B\d+")/g,"$$constr$1");return bt}function aC(br,bq){this.baseInterfaceName=br;this.body=bq;bq.owner=this}aC.prototype.toString=function(){return"new ("+this.body+")"};function ai(bs){var br=(new RegExp(/\bnew\s*([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)\s*"B\d+"\s*"A(\d+)"/)).exec(bs);var bv=a9,bu=a7();a9=bu;var bq=br[1]+"$"+bu;var bt=new aC(bq,V(bk[br[2]],bq,"","implements "+br[1]));bl(bt,bu,bv);a9=bv;return bt}function af(br,bs,bq){this.name=br;this.params=bs;this.body=bq}af.prototype.toString=function(){var bs=al;var bt=av({"this":null},this.params.getNames());al=function(bu){return bt.hasOwnProperty(bu.name)?bu.name:bs(bu)};var br="function";if(this.name){br+=" "+this.name}var bq=this.params.prependMethodArgs(this.body.toString());br+=this.params+" "+bq;al=bs;return br};function aK(br){var bq=(new RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/)).exec(br);return new af(bq[1]!=="function"?bq[1]:null,aD(bk[bq[2]]),ap(bk[bq[3]]))}function ad(bq){this.members=bq}ad.prototype.toString=function(){var bs=al;al=function(bu){return bu.name==="this"?"this":bs(bu)};var bq="";for(var bt=0,br=this.members.length;bt =0){bq=bq.substring(0,bq.indexOf("="))}return"("+bq+" in "+this.container+")"};function aY(br,bq){this.initStatement=br;this.container=bq}aY.iteratorId=0;aY.prototype.toString=function(){var bu=this.initStatement.toString();var br="$it"+aY.iteratorId++;var bt=bu.replace(/^\s*var\s*/,"").split("=")[0];var bs="var "+br+" = new $p.ObjectIterator("+this.container+"), "+bt+" = void(0)";var bq=br+".hasNext() && (("+bt+" = "+br+".next()) || true)";return"("+bs+"; "+bq+";)"};function Y(br){var bq;if(/\bin\b/.test(br)){bq=br.substring(1,br.length-1).split(/\bin\b/g);return new aS(bn(a6(bq[0])),aZ(bq[1]))}if(br.indexOf(":")>=0&&br.indexOf(";")<0){bq=br.substring(1,br.length-1).split(":");return new aY(bn(a6(bq[0])),aZ(bq[1]))}bq=br.substring(1,br.length-1).split(";");return new a1(bn(a6(bq[0])),aZ(bq[1]),aZ(bq[2]))}function a2(bq){bq.sort(function(bs,br){return br.weight-bs.weight})}function ab(bs,bq,br){this.name=bs;this.body=bq;this.isStatic=br;bq.owner=this}ab.prototype.toString=function(){return""+this.body};function an(bs,bq,br){this.name=bs;this.body=bq;this.isStatic=br;bq.owner=this}an.prototype.toString=function(){return""+this.body};function T(bs){var br=O.exec(bs);O.lastIndex=0;var bt=br[1].indexOf("static")>=0;var bq=bk[aQ(br[6])],bv;var bw=a9,bu=a7();a9=bu;if(br[2]==="interface"){bv=new ab(br[3],S(bq,br[3],br[4]),bt)}else{bv=new an(br[3],V(bq,br[3],br[4],br[5]),bt)}bl(bv,bu,bw);a9=bw;return bv}function ac(bs,bt,bq,br){this.name=bs;this.params=bt;this.body=bq;this.isStatic=br}ac.prototype.toString=function(){var bt=av({},this.params.getNames());var bs=al;al=function(bu){return bt.hasOwnProperty(bu.name)?bu.name:bs(bu)};var br=this.params.prependMethodArgs(this.body.toString());var bq="function "+this.methodId+this.params+" "+br+"\n";al=bs;return bq};function P(bt){var br=bb.exec(bt);bb.lastIndex=0;var bs=br[1].indexOf("static")>=0;var bq=br[6]!==";"?bk[aQ(br[6])]:"{}";return new ac(br[3],aD(bk[aQ(br[4])]),ap(bq),bs)}function am(bs,br,bq){this.definitions=bs;this.fieldType=br;this.isStatic=bq}am.prototype.getNames=function(){var bs=[];for(var br=0,bq=this.definitions.length;br=0;var bt=bv.substring(bu[0].length).split(/,\s*/g);var br=aT(bu[2]);for(var bs=0;bs0){bx+=this.functions.join("\n")+"\n"}a2(this.innerClasses);for(bM=0,bK=this.innerClasses.length;bM0){bx+=this.cstrs.join("\n")+"\n"}bx+="function $constr() {\n";var bQ=[];for(bM=0,bK=this.cstrs.length;bM=":"===")+" "+bO+") { $constr_"+bO+".apply("+bG+", arguments); }")}if(bQ.length>0){bx+=bQ.join(" else ")+" else "}bx+="$superCstr();\n}\n";bx+="$constr.apply(null, arguments);\n";al=bR;return"(function() {\nfunction "+bs+"() {\n"+bx+"}\n"+bH+bz+"return "+bs+";\n})()"};V=function(bz,br,bq,bC){var bE=bz.substring(1,bz.length-1);bE=ae(bE);bE=bd(bE,br);var bs=[],bt=[],bD=[],bw=[];bE=bE.replace(/"([DEGH])(\d+)"/g,function(bH,bG,bF){if(bG==="D"){bs.push(bF)}else{if(bG==="E"){bt.push(bF)}else{if(bG==="H"){bw.push(bF)}else{bD.push(bF)}}}return""});var by=bE.replace(/^(?:\s*;)+/,"").split(/;(?:\s*;)*/g);var bx,bv;var bu;if(bq!==t){bx=bq.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g,"$1")}if(bC!==t){bv=bC.replace(/^\s*implements\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)}for(bu=0;bu0){for(bv=0,bt=bw.length;bv0){by.interfaces=bC}}}}}function a8(bq){var bv=[],bs={};var br,by,bw;for(br in aJ){if(aJ.hasOwnProperty(br)){bw=aJ[br];if(!bw.inScope&&!bw.derived){bv.push(br);bw.weight=0}else{var bx=[];if(bw.inScope){for(by in bw.inScope){if(bw.inScope.hasOwnProperty(by)){bx.push(bw.inScope[by])}}}if(bw.derived){bx=bx.concat(bw.derived)}bs[br]=bx}}}function bz(bB,bD){var bA=bs[bB];if(!bA){return false}var bC=bA.indexOf(bD);if(bC<0){return false}bA.splice(bC,1);if(bA.length>0){return false}delete bs[bB];return true}while(bv.length>0){br=bv.shift();bw=aJ[br];if(bw.scopeId&&bz(bw.scopeId,bw)){bv.push(bw.scopeId);aJ[bw.scopeId].weight=bw.weight+1}if(bw.base&&bz(bw.base.classId,bw)){bv.push(bw.base.classId);bw.base.weight=bw.weight+1}if(bw.interfaces){var bu,bt;for(bu=0,bt=bw.interfaces.length;buaG){aF=aG-aH}}aB.height=aF/aG*100+"%";ap()},az=[aj(ao,"mousemove",function(aF){if(aD){aA(ad.innerHeight-aF.clientY);au.scrollTop=aq}}),aj(ao,"mouseup",function(){if(aD){aD=aq=N}}),aj(aC,"dblclick",function(aF){aF.preventDefault();if(av){aA(av);av=N}else{av=ar.clientHeight;aB.height="0px"}}),aj(aC,"mousedown",function(aF){aF.preventDefault();aD=S;aq=au.scrollTop}),aj(aC,"contextmenu",function(){aD=N}),aj(at,"click",function(){aw()})];aw=function(){var aF=az.length;while(aF--){V.apply(T,az[aF])}al.removeChild(ar);U.paddingBottom=ax;aa(au);aa(ar);T[P]=X};W(ar,ab,au,ae,aC,ai,at,an);at[ag]="Close Log";ak(at,Z("\u2716"));aC[ag]="Double-click to toggle log minimization";al.insertBefore(ar,al.firstChild);T[P]=function(aH){if(ay===O){au.removeChild(au.firstChild)}else{ay++}var aG=ak(au,ah(am)),aF=ak(aG,ah(am));aG[ag]=(new Date).toLocaleTimeString();W(aG,Y,aF,af);ak(aF,Z(aH));au.scrollTop=au.scrollHeight};T[P](aE);ap()}})()}else{if(typeof print===R){T[P]=print}}}return T}();F.logger=j;F.version="1.4.1";F.lib={};F.registerLibrary=function(N,O){F.lib[N]=O;if(O.hasOwnProperty("init")){O.init(g)}};F.instances=k;F.getInstanceById=function(N){return k[J[N]]};F.Sketch=function(N){this.attachFunction=N;this.options={pauseOnBlur:false,globalKeyEvents:false};this.onLoad=G;this.onSetup=G;this.onPause=G;this.onLoop=G;this.onFrameStart=G;this.onFrameEnd=G;this.onExit=G;this.params={};this.imageCache={pending:0,images:{},operaCache:{},add:function(P,O){if(this.images[P]){return}if(!n){this.images[P]=null}if(!O){O=new Image;O.onload=function(R){return function(){R.pending--}}(this);this.pending++;O.src=P}this.images[P]=O;if(D.opera){var Q=d.createElement("div");Q.appendChild(O);Q.style.position="absolute";Q.style.opacity=0;Q.style.width="1px";Q.style.height="1px";if(!this.operaCache[P]){d.body.appendChild(Q);this.operaCache[P]=Q}}}};this.sourceCode=undefined;this.attach=function(P){if(typeof this.attachFunction==="function"){this.attachFunction(P)}else{if(this.sourceCode){var O=(new Function("return ("+this.sourceCode+");"))();O(P);this.attachFunction=O}else{throw"Unable to attach sketch to the processing instance"}}};this.toString=function(){var O;var P="((function(Sketch) {\n";P+="var sketch = new Sketch(\n"+this.sourceCode+");\n";for(O in this.options){if(this.options.hasOwnProperty(O)){var Q=this.options[O];P+="sketch.options."+O+" = "+(typeof Q==="string"?'"'+Q+'"':""+Q)+";\n"}}for(O in this.imageCache){if(this.options.hasOwnProperty(O)){P+='sketch.imageCache.add("'+O+'");\n'}}P+="return sketch;\n})(Processing.Sketch))";return P}};var v=function(Q,N){var O=[],U=[],V=N.length,S=0;function T(W,Y){var X=new XMLHttpRequest;X.onreadystatechange=function(){if(X.readyState===4){var Z;if(X.status!==200&&X.status!==0){Z="Invalid XHR status "+X.status}else{if(X.responseText===""){if("withCredentials" in new XMLHttpRequest&&(new XMLHttpRequest).withCredentials===false&&D.location.protocol==="file:"){Z="XMLHttpRequest failure, possibly due to a same-origin policy violation. You can try loading this page in another browser, or load it from http://localhost using a local webserver. See the Processing.js README for a more detailed explanation of this problem and solutions."}else{Z="File is empty."}}}Y(X.responseText,Z)}};X.open("GET",W,true);if(X.overrideMimeType){X.overrideMimeType("application/json")}X.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT");X.send(null)}function P(X,W){function Z(ac,aa){O[X]=ac;++S;if(aa){U.push(W+" ==> "+aa)}if(S===V){if(U.length===0){try{return new F(Q,O.join("\n"))}catch(ab){throw"Processing.js: Unable to execute pjs sketch: "+ab}}else{throw"Processing.js: Unable to load pjs sketch files: "+U.join("\n")}}}if(W.charAt(0)==="#"){var Y=d.getElementById(W.substring(1));if(Y){Z(Y.text||Y.textContent)}else{Z("","Unable to load pjs sketch: element with id '"+W.substring(1)+"' was not found")}return}T(W,Z)}for(var R=0;R=0;ac--){Q.push(ab[ac])}for(ac=0,aa=Q.length;ac0){for(var N=k.length-1;N>=0;N--){if(k[N]){k[N].exit()}}}I()};F.loadSketchFromSources=v;F.disableInit=function(){if(n){d.removeEventListener("DOMContentLoaded",I,false)}};if(n){D.Processing=F;d.addEventListener("DOMContentLoaded",I,false)}else{this.Processing=F}})(window,window.document,Math);