forked from processing-js/processing-js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
processing-min.js
executable file
·23 lines (17 loc) · 206 KB
/
processing-min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/***
processing 1.4.1. REVISION 01
modified version for Procoding
based on:
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(a,b,c,d){function j(b,c){return b in a?a[b]:"function"==typeof a[c]?a[c]:function(a){if(a instanceof Array)return a;if("number"==typeof a){var b=[];return b.length=a,b}}}function p(a){if("string"==typeof a){for(var b=0,e=0;a.length>e;++e)b=4294967295&31*b+a.charCodeAt(e);return b}return"object"!=typeof a?4294967295&a:a.hashCode instanceof Function?a.hashCode():(a.$id===d&&(a.$id=c.floor(65536*c.random())-32768<<16|c.floor(65536*c.random())),a.$id)}function q(a,b){return null===a||null===b?null===a&&null===b:"string"==typeof a?a===b:"object"!=typeof a?a===b:a.equals instanceof Function?a.equals(b):a===b}function v(){}function x(a,b,c){if(!a.hasOwnProperty(b)||"function"!=typeof a[b])return a[b]=c,void 0;var d=a[b];if("$overloads"in d)return d.$defaultOverload=c,void 0;if("$overloads"in c||d.length!==c.length){var e,f;"$overloads"in c?(e=c.$overloads.slice(0),e[d.length]=d,f=c.$defaultOverload):(e=[],e[c.length]=c,e[d.length]=d,f=d);var g=function(){var a=g.$overloads[arguments.length]||("$methodArgsIndex"in g&&arguments.length>g.$methodArgsIndex?g.$overloads[g.$methodArgsIndex]:null)||g.$defaultOverload;return a.apply(this,arguments)};g.$overloads=e,"$methodArgsIndex"in c&&(g.$methodArgsIndex=c.$methodArgsIndex),g.$defaultOverload=f,g.name=b,a[b]=g}}function y(a,b){function c(c){w.defineProperty(a,c,{get:function(){return b[c]},set:function(a){b[c]=a},enumerable:!0})}var d=[];for(var e in b)"function"==typeof b[e]?x(a,e,b[e]):"$"===e.charAt(0)||e in a||d.push(e);for(;d.length>0;)c(d.shift());a.$super=b}function z(a){return"string"!=typeof a?!1:-1!==["byte","int","char","color","float","long","double"].indexOf(a)}function F(a){var d=250,e=a.size/d,g=b.createElement("canvas");g.width=2*d,g.height=2*d,g.style.opacity=0;var h=a.getCSSDefinition(d+"px","normal"),i=g.getContext("2d");i.font=h;var j="dbflkhyjqpg";g.width=i.measureText(j).width,i.font=h;var k=b.createElement("div");k.style.position="absolute",k.style.opacity=0,k.style.fontFamily='"'+a.name+'"',k.style.fontSize=d+"px",k.innerHTML=j+"<br/>"+j,b.body.appendChild(k);var l=g.width,m=g.height,n=m/2;i.fillStyle="white",i.fillRect(0,0,l,m),i.fillStyle="black",i.fillText(j,0,n);for(var o=i.getImageData(0,0,l,m).data,p=0,q=4*l,r=o.length;r>++p&&255===o[p];)f();var s=c.round(p/q);for(p=r-1;--p>0&&255===o[p];)f();var t=c.round(p/q);if(a.ascent=e*(n-s),a.descent=e*(t-n),b.defaultView.getComputedStyle){var u=b.defaultView.getComputedStyle(k,null).getPropertyValue("height");u=e*u.replace("px",""),u>=2*a.size&&(a.leading=c.round(u/2))}return b.body.removeChild(k),a.caching?i:void 0}function G(a,b){a===d&&(a=""),this.name=a,b===d&&(b=0),this.size=b,this.glyph=!1,this.ascent=0,this.descent=0,this.leading=1.2*b;var c=a.indexOf(" Italic Bold");-1!==c&&(a=a.substring(0,c)),this.style="normal";var e=a.indexOf(" Italic");-1!==e&&(a=a.substring(0,e),this.style="italic"),this.weight="normal";var f=a.indexOf(" Bold");if(-1!==f&&(a=a.substring(0,f),this.weight="bold"),this.family="sans-serif",a!==d)switch(a){case"sans-serif":case"serif":case"monospace":case"fantasy":case"cursive":this.family=a;break;default:this.family='"'+a+'", sans-serif'}this.context2d=F(this),this.css=this.getCSSDefinition(),this.context2d&&(this.context2d.font=this.css)}function I(){var c,d,a=["abs","acos","alpha","ambient","ambientLight","append","applyMatrix","arc","arrayCopy","asin","atan","atan2","background","beginCamera","beginDraw","beginShape","bezier","bezierDetail","bezierPoint","bezierTangent","bezierVertex","binary","blend","blendColor","blit_resize","blue","box","breakShape","brightness","camera","ceil","Character","color","colorMode","concat","constrain","copy","cos","createFont","createGraphics","createImage","cursor","curve","curveDetail","curvePoint","curveTangent","curveTightness","curveVertex","day","degrees","directionalLight","disableContextMenu","dist","draw","ellipse","ellipseMode","emissive","enableContextMenu","endCamera","endDraw","endShape","exit","exp","expand","externals","fill","filter","floor","focused","frameCount","frameRate","frustum","get","glyphLook","glyphTable","green","height","hex","hint","hour","hue","image","imageMode","intersect","join","key","keyCode","keyPressed","keyReleased","keyTyped","lerp","lerpColor","lightFalloff","lights","lightSpecular","line","link","loadBytes","loadFont","loadGlyphs","loadImage","loadPixels","loadShape","loadXML","loadStrings","log","loop","mag","map","match","matchAll","max","millis","min","minute","mix","modelX","modelY","modelZ","modes","month","mouseButton","mouseClicked","mouseDragged","mouseMoved","mouseOut","mouseOver","mousePressed","mouseReleased","mouseScroll","mouseScrolled","mouseX","mouseY","name","nf","nfc","nfp","nfs","noCursor","noFill","noise","noiseDetail","noiseSeed","noLights","noLoop","norm","normal","noSmooth","noStroke","noTint","ortho","param","parseBoolean","parseByte","parseChar","parseFloat","parseInt","peg","perspective","PImage","pixels","PMatrix2D","PMatrix3D","PMatrixStack","pmouseX","pmouseY","point","pointLight","popMatrix","popStyle","pow","print","printCamera","println","printMatrix","printProjection","PShape","PShapeSVG","pushMatrix","pushStyle","quad","radians","random","Random","randomSeed","rect","rectMode","red","redraw","requestImage","resetMatrix","reverse","rotate","rotateX","rotateY","rotateZ","round","saturation","save","saveFrame","saveStrings","scale","screenX","screenY","screenZ","second","set","setup","shape","shapeMode","shared","shearX","shearY","shininess","shorten","sin","size","smooth","sort","specular","sphere","sphereDetail","splice","split","splitTokens","spotLight","sq","sqrt","status","str","stroke","strokeCap","strokeJoin","strokeWeight","subset","tan","text","textAlign","textAscent","textDescent","textFont","textLeading","textMode","textSize","texture","textureMode","textWidth","tint","toImageData","touchCancel","touchEnd","touchMove","touchStart","translate","transform","triangle","trim","unbinary","unhex","updatePixels","use3DContext","vertex","width","XMLElement","XML","year","__contains","__equals","__equalsIgnoreCase","__frameRate","__hashCode","__int_cast","__instanceof","__keyPressed","__mousePressed","__printStackTrace","__replace","__replaceAll","__replaceFirst","__toCharArray","__split","__codePointAt","__startsWith","__endsWith","__matches"],b={};for(c=0,d=a.length;d>c;++c)b[a[c]]=null;for(var e in H.lib)if(H.lib.hasOwnProperty(e)&&H.lib[e].exports){var f=H.lib[e].exports;for(c=0,d=f.length;d>c;++c)b[f[c]]=null}return b}function J(a){function c(a){for(var b=[],c=a.split(/([\{\[\(\)\]\}])/),d=c[0],e=[],f=1;c.length>f;f+=2){var g=c[f];if("["===g||"{"===g||"("===g)e.push(d),d=g;else if("]"===g||"}"===g||")"===g){var h="}"===g?"A":")"===g?"B":"C",i=b.length;b.push(d+g),d=e.pop()+'"'+h+(i+1)+'"'}d+=c[f+1]}return b.unshift(d),b}function e(a,b){return a.replace(/'(\d+)'/g,function(a,c){var d=b[c];return"/"===d.charAt(0)?d:/^'((?:[^'\\\n])|(?:\\.[0-9A-Fa-f]*))'$/.test(d)?"(new $p.Character("+d+"))":d})}function f(a){var c,b=/^\s*/.exec(a);if(b[0].length===a.length)c={left:b[0],middle:"",right:""};else{var d=/\s*$/.exec(a);c={left:b[0],middle:a.substring(b[0].length,d.index),right:d[0]}}return c.untrim=function(a){return this.left+a+this.right},c}function g(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}function h(a,b){for(var c=0,d=b.length;d>c;++c)a[b[c]]=null;return a}function i(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}function j(a){return a.substring(2,a.length-1)}function x(a,b){var c=r.length;return r.push(a),'"'+b+c+'"'}function y(){return"class"+ ++v}function z(a,b,c){a.classId=b,a.scopeId=c,t[b]=a}function N(a){var b=a;return b=b.replace(G,function(a){return x(a,"E")}),b=b.replace(H,function(a){return x(a,"D")}),b=b.replace(M,function(a){return x(a,"H")})}function O(a,b){var c=a.replace(K,function(a,c,d){return d!==b?a:x(a,"G")});return c}function P(a){this.name=a}function Q(a,b){this.params=a,this.methodArgsParam=b}function R(a){var b=g(a.substring(1,a.length-1)),c=[],d=null;if(""!==b)for(var e=b.split(","),f=0;e.length>f;++f){var h=/\b([A-Za-z_$][\w$]*\b)(\s*"[ABC][\d]*")*\s*$/.exec(e[f]);if(f===e.length-1&&e[f].indexOf("...")>=0){d=new P(h[1]);break}c.push(new P(h[1]))}return new Q(c,d)}function S(a){function d(a,b,d,e){var g=r[e];c=!0;var h=f(g.substring(1,g.length-1));return"__"+d+(""===h.middle?x("("+b.replace(/\.\s*$/,"")+")","B"):x("("+b.replace(/\.\s*$/,"")+","+h.middle+")","B"))}function e(a,b,d){return c=!0,"__instanceof"+x("("+b+", "+d+")","B")}var b=a;b=b.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"C\d+")+\s*("A\d+")/g,function(a,b,c){return c}),b=b.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"B\d+")\s*("A\d+")/g,function(a){return x(a,"F")}),b=b.replace(M,function(a){return x(a,"H")}),b=b.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*("C\d+"(?:\s*"C\d+")*)/g,function(a,b,c){var d=c.replace(/"C(\d+)"/g,function(a,b){return r[b]}).replace(/\[\s*\]/g,"[null]").replace(/\s*\]\s*\[\s*/g,", "),e="{"+d.substring(1,d.length-1)+"}",f="('"+b+"', "+x(e,"A")+")";return"$p.createJavaArray"+x(f,"B")}),b=b.replace(/(\.\s*length)\s*"B\d+"/g,"$1"),b=b.replace(/#([0-9A-Fa-f]{6})\b/g,function(a,b){return"0xFF"+b}),b=b.replace(/"B(\d+)"(\s*(?:[\w$']|"B))/g,function(a,b,c){var d=r[b];if(!/^\(\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\s*(?:"C\d+"\s*)*\)$/.test(d))return a;if(/^\(\s*int\s*\)$/.test(d))return"(int)"+c;var e=d.split(/"C(\d+)"/g);return e.length>1&&!/^\[\s*\]$/.test(r[e[1]])?a:""+c}),b=b.replace(/\(int\)([^,\]\)\}\?\:\*\+\-\/\^\|\%\&\~<\>\=]+)/g,function(a,b){var c=f(b);return c.untrim("__int_cast("+c.middle+")")}),b=b.replace(/\bsuper(\s*"B\d+")/g,"$$superCstr$1").replace(/\bsuper(\s*\.)/g,"$$super$1"),b=b.replace(/\b0+((\d*)(?:\.[\d*])?(?:[eE][\-\+]?\d+)?[fF]?)\b/,function(a,b,c){return b===c?a:""===c?"0"+b:b}),b=b.replace(/\b(\.?\d+\.?)[fF]\b/g,"$1"),b=b.replace(/([^\s])%([^=\s])/g,"$1 % $2"),b=b.replace(/\b(frameRate|keyPressed|mousePressed)\b(?!\s*"B)/g,"__$1"),b=b.replace(/\b(boolean|byte|char|float|int)\s*"B/g,function(a,b){return"parse"+b.substring(0,1).toUpperCase()+b.substring(1)+'"B'}),b=b.replace(/\bpixels\b\s*(("C(\d+)")|\.length)?(\s*=(?!=)([^,\]\)\}]+))?/g,function(a,b,c,d,e,f){if(c){var g=r[d];return e?"pixels.setPixel"+x("("+g.substring(1,g.length-1)+","+f+")","B"):"pixels.getPixel"+x("("+g.substring(1,g.length-1)+")","B")}return b?"pixels.getLength"+x("()","B"):e?"pixels.set"+x("("+f+")","B"):"pixels.toArray"+x("()","B")});var c;do c=!1,b=b.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,d);while(c);do c=!1,b=b.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,e);while(c);return b=b.replace(/\bthis(\s*"B\d+")/g,"$$constr$1")}function T(a,b){this.baseInterfaceName=a,this.body=b,b.owner=this}function U(a){var b=RegExp(/\bnew\s*([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)\s*"B\d+"\s*"A(\d+)"/).exec(a),c=u,d=y();u=d;var e=b[1]+"$"+d,f=new T(e,A(r[b[2]],e,"","implements "+b[1]));return z(f,d,c),u=c,f}function V(a,b,c){this.name=a,this.params=b,this.body=c}function W(a){var b=RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/).exec(a);return new V("function"!==b[1]?b[1]:null,R(r[b[2]]),C(r[b[3]]))}function X(a){this.members=a}function Y(a){for(var b=a.split(","),c=0;b.length>c;++c){var d=b[c].indexOf(":");b[c]=0>d?{value:F(b[c])}:{label:g(b[c].substring(0,d)),value:F(g(b[c].substring(d+1)))}}return new X(b)}function Z(a){if("("===a.charAt(0)||"["===a.charAt(0))return a.charAt(0)+Z(a.substring(1,a.length-1))+a.charAt(a.length-1);if("{"===a.charAt(0))return/^\{\s*(?:[A-Za-z_$][\w$]*|'\d+')\s*:/.test(a)?"{"+x(a.substring(1,a.length-1),"I")+"}":"["+Z(a.substring(1,a.length-1))+"]";var b=f(a),c=S(b.middle);return c=c.replace(/"[ABC](\d+)"/g,function(a,b){return Z(r[b])}),b.untrim(c)}function $(a){return a.replace(/(\.\s*)?((?:\b[A-Za-z_]|\$)[\w$]*)(\s*\.\s*([A-Za-z_$][\w$]*)(\s*\()?)?/g,function(a,b,c,e,f,g){if(b)return a;var h={name:c,member:f,callSign:!!g};return s(h)+(e===d?"":e)})}function _(a,b){this.expr=a,this.transforms=b}function ab(a,b,c){this.name=a,this.value=b,this.isDefault=c}function bb(a,b){var d,e,f,c=a.indexOf("=");return 0>c?(d=a,e=b,f=!0):(d=a.substring(0,c),e=F(a.substring(c+1)),f=!1),new ab(g(d.replace(/(\s*"C\d+")+/g,"")),e,f)}function cb(a){return"int"===a||"float"===a?"0":"boolean"===a?"false":"color"===a?"0x00000000":"null"}function db(a,b){this.definitions=a,this.varType=b}function eb(a){this.expression=a}function fb(a){if(J.test(a)){for(var b=L.exec(a),c=a.substring(b[0].length).split(","),d=cb(b[2]),e=0;c.length>e;++e)c[e]=bb(c[e],d);return new db(c,b[2])}return new eb(F(a))}function gb(a,b,c){this.initStatement=a,this.condition=b,this.step=c}function hb(a,b){this.initStatement=a,this.container=b}function ib(a,b){this.initStatement=a,this.container=b}function jb(a){var b;return/\bin\b/.test(a)?(b=a.substring(1,a.length-1).split(/\bin\b/g),new hb(fb(g(b[0])),F(b[1]))):a.indexOf(":")>=0&&0>a.indexOf(";")?(b=a.substring(1,a.length-1).split(":"),new ib(fb(g(b[0])),F(b[1]))):(b=a.substring(1,a.length-1).split(";"),new gb(fb(g(b[0])),F(b[1]),F(b[2])))}function kb(a){a.sort(function(a,b){return b.weight-a.weight})}function lb(a,b,c){this.name=a,this.body=b,this.isStatic=c,b.owner=this}function mb(a,b,c){this.name=a,this.body=b,this.isStatic=c,b.owner=this}function nb(a){var b=G.exec(a);G.lastIndex=0;var e,c=b[1].indexOf("static")>=0,d=r[j(b[6])],f=u,g=y();return u=g,e="interface"===b[2]?new lb(b[3],B(d,b[3],b[4]),c):new mb(b[3],A(d,b[3],b[4],b[5]),c),z(e,g,f),u=f,e}function ob(a,b,c,d){this.name=a,this.params=b,this.body=c,this.isStatic=d}function pb(a){var b=H.exec(a);H.lastIndex=0;var c=b[1].indexOf("static")>=0,d=";"!==b[6]?r[j(b[6])]:"{}";return new ob(b[3],R(r[j(b[4])]),C(d),c)}function qb(a,b,c){this.definitions=a,this.fieldType=b,this.isStatic=c}function rb(a){for(var b=L.exec(a),c=b[1].indexOf("static")>=0,d=a.substring(b[0].length).split(/,\s*/g),e=cb(b[2]),f=0;d.length>f;++f)d[f]=bb(d[f],e);return new qb(d,b[2],c)}function sb(a,b){this.params=a,this.body=b}function tb(a){var b=RegExp(/"B(\d+)"\s*"A(\d+)"/).exec(a),c=R(r[b[1]]);return new sb(c,C(r[b[2]]))}function ub(a,b,c,d,e,f){var g,h;for(this.name=a,this.interfacesNames=b,this.methodsNames=c,this.fields=d,this.innerClasses=e,this.misc=f,g=0,h=d.length;h>g;++g)d[g].owner=this}function vb(a,b,c,d,e,f,g,h,i){var j,k;for(this.name=a,this.baseClassName=b,this.interfacesNames=c,this.functions=d,this.methods=e,this.fields=f,this.cstrs=g,this.innerClasses=h,this.misc=i,j=0,k=f.length;k>j;++j)f[j].owner=this}function wb(a,b){this.name=a,this.body=b,b.owner=this}function xb(a,b){this.name=a,this.body=b,b.owner=this}function yb(a){var b=G.exec(a);G.lastIndex=0;var c=r[j(b[6])],d=u,e=y();u=e;var f;return f="interface"===b[2]?new wb(b[3],B(c,b[3],b[4])):new xb(b[3],A(c,b[3],b[4],b[5])),z(f,e,d),u=d,f}function zb(a,b,c){this.name=a,this.params=b,this.body=c}function Ab(a){var b=H.exec(a);return H.lastIndex=0,new zb(b[3],R(r[j(b[4])]),C(r[j(b[6])]))}function Bb(a){var b=a;return b=b.replace(/\b(catch\s*"B\d+"\s*"A\d+")(\s*catch\s*"B\d+"\s*"A\d+")+/g,"$1")}function Cb(a,b){this.argument=a,this.misc=b}function Db(a,b){this.argument=a,this.misc=b}function Eb(a,b,c){this.name=a,this.argument=b,this.misc=c}function Fb(a){this.expr=a}function Gb(a){this.label=a}function Hb(a){for(var b=[],c=0,d=a.length;d>c;++c){var e=a[c];e instanceof db?b=b.concat(e.getNames()):e instanceof Cb&&e.argument.initStatement instanceof db?b=b.concat(e.argument.initStatement.getNames()):(e instanceof lb||e instanceof mb||e instanceof wb||e instanceof xb||e instanceof zb||e instanceof V)&&b.push(e.name)}return h({},b)}function Ib(a){this.statements=a}function Jb(a){this.statements=a}function Kb(){function i(a,c){for(var g,e=c.split("."),f=a.scope;f;){if(f.hasOwnProperty(e[0])){g=f[e[0]];break}f=f.scope}g===d&&(g=b[e[0]]);for(var h=1,i=e.length;i>h&&g;++h)g=g.inScope[e[h]];return g}var c,e,b={};for(c in t)if(t.hasOwnProperty(c)){e=t[c];var f=e.scopeId,g=e.name;if(f){var h=t[f];e.scope=h,h.inScope===d&&(h.inScope={}),h.inScope[g]=e}else b[g]=e}for(c in t)if(t.hasOwnProperty(c)){e=t[c];var j=e.body.baseClassName;if(j){var k=i(e,j);k&&(e.base=k,k.derived||(k.derived=[]),k.derived.push(e))}var n,o,l=e.body.interfacesNames,m=[];if(l&&l.length>0){for(n=0,o=l.length;o>n;++n){var p=i(e,l[n]);m.push(p),p&&(p.derived||(p.derived=[]),p.derived.push(e))}m.length>0&&(e.interfaces=m)}}}function Lb(){function h(a,b){var d=c[a];if(!d)return!1;var e=d.indexOf(b);return 0>e?!1:(d.splice(e,1),d.length>0?!1:(delete c[a],!0))}var d,e,f,b=[],c={};for(d in t)if(t.hasOwnProperty(d))if(f=t[d],f.inScope||f.derived){var g=[];if(f.inScope)for(e in f.inScope)f.inScope.hasOwnProperty(e)&&g.push(f.inScope[e]);f.derived&&(g=g.concat(f.derived)),c[d]=g}else b.push(d),f.weight=0;for(;b.length>0;)if(d=b.shift(),f=t[d],f.scopeId&&h(f.scopeId,f)&&(b.push(f.scopeId),t[f.scopeId].weight=f.weight+1),f.base&&h(f.base.classId,f)&&(b.push(f.base.classId),f.base.weight=f.weight+1),f.interfaces){var i,j;for(i=0,j=f.interfaces.length;j>i;++i)f.interfaces[i]&&h(f.interfaces[i].classId,f)&&(b.push(f.interfaces[i].classId),f.interfaces[i].weight=f.weight+1)}}var b=I(),k=a.replace(/\r\n?|\n\r/g,"\n"),l=[],m=k.replace(/("(?:[^"\\\n]|\\.)*")|('(?:[^'\\\n]|\\.)*')|(([\[\(=|&!\^:?]\s*)(\/(?![*\/])(?:[^\/\\\n]|\\.)*\/[gim]*)\b)|(\/\/[^\n]*\n)|(\/\*(?:(?!\*\/)(?:.|\n))*\*\/)/g,function(a,b,c,d,e,f,g,h){var i;return b||c?(i=l.length,l.push(a),"'"+i+"'"):d?(i=l.length,l.push(f),e+"'"+i+"'"):""!==h?" ":"\n"});m=m.replace(/__x([0-9A-F]{4})/g,function(a,b){return"__x005F_x"+b}),m=m.replace(/\$/g,"__x0024");var n,p=m,q=function(a,b,c,d){return b||d?a:(n=!0,"")};do n=!1,p=p.replace(/([<]?)<\s*((?:\?|[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\[\])*(?:\s+(?:extends|super)\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+(?:extends|super)\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)?)*)\s*>([=]?)/g,q);while(n);var s,u,A,B,C,D,E,F,r=c(p),t={},v=0,G=/\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,H=/\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,J=/^((?:(?: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*)*([=,]|$)/,K=/\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,L=/^((?:(?: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*/,M=/\bfunction(?:\s+([A-Za-z_$][\w$]*))?\s*("B\d+")\s*("A\d+")/g;P.prototype.toString=function(){return this.name},Q.prototype.getNames=function(){for(var a=[],b=0,c=this.params.length;c>b;++b)a.push(this.params[b].name);return a},Q.prototype.prependMethodArgs=function(a){return this.methodArgsParam?"{\nvar "+this.methodArgsParam.name+" = Array.prototype.slice.call(arguments, "+this.params.length+");\n"+a.substring(1):a},Q.prototype.toString=function(){if(0===this.params.length)return"()";for(var a="(",b=0,c=this.params.length;c>b;++b)a+=this.params[b]+", ";return a.substring(0,a.length-2)+")"},T.prototype.toString=function(){return"new ("+this.body+")"},V.prototype.toString=function(){var a=s,b=h({"this":null},this.params.getNames());s=function(c){return b.hasOwnProperty(c.name)?c.name:a(c)};var c="function";this.name&&(c+=" "+this.name);var d=this.params.prependMethodArgs(""+this.body);return c+=this.params+" "+d,s=a,c},X.prototype.toString=function(){var a=s;s=function(b){return"this"===b.name?"this":a(b)};for(var b="",c=0,d=this.members.length;d>c;++c)this.members[c].label&&(b+=this.members[c].label+": "),b+=""+this.members[c].value+", ";return s=a,b.substring(0,b.length-2)},_.prototype.toString=function(){var a=this.transforms,b=$(this.expr);return b.replace(/"!(\d+)"/g,function(b,c){return""+a[c]})},F=function(a){var b=[],c=Z(a);return c=c.replace(/"H(\d+)"/g,function(a,c){return b.push(W(r[c])),'"!'+(b.length-1)+'"'}),c=c.replace(/"F(\d+)"/g,function(a,c){return b.push(U(r[c])),'"!'+(b.length-1)+'"'}),c=c.replace(/"I(\d+)"/g,function(a,c){return b.push(Y(r[c])),'"!'+(b.length-1)+'"'}),new _(c,b)},ab.prototype.toString=function(){return this.name+" = "+this.value},db.prototype.getNames=function(){for(var a=[],b=0,c=this.definitions.length;c>b;++b)a.push(this.definitions[b].name);return a},db.prototype.toString=function(){return"var "+this.definitions.join(",")},eb.prototype.toString=function(){return""+this.expression},gb.prototype.toString=function(){return"("+this.initStatement+"; "+this.condition+"; "+this.step+")"},hb.prototype.toString=function(){var a=""+this.initStatement;return a.indexOf("=")>=0&&(a=a.substring(0,a.indexOf("="))),"("+a+" in "+this.container+")"},ib.iteratorId=0,ib.prototype.toString=function(){var a=""+this.initStatement,b="$it"+ib.iteratorId++,c=a.replace(/^\s*var\s*/,"").split("=")[0],d="var "+b+" = new $p.ObjectIterator("+this.container+"), "+c+" = void(0)",e=b+".hasNext() && (("+c+" = "+b+".next()) || true)";return"("+d+"; "+e+";)"},lb.prototype.toString=function(){return""+this.body},mb.prototype.toString=function(){return""+this.body},ob.prototype.toString=function(){var a=h({},this.params.getNames()),b=s;s=function(c){return a.hasOwnProperty(c.name)?c.name:b(c)};var c=this.params.prependMethodArgs(""+this.body),d="function "+this.methodId+this.params+" "+c+"\n";return s=b,d},qb.prototype.getNames=function(){for(var a=[],b=0,c=this.definitions.length;c>b;++b)a.push(this.definitions[b].name);return a},qb.prototype.toString=function(){var a=s({name:"[this]"});if(this.isStatic){for(var b=this.owner.name,c=[],d=0,e=this.definitions.length;e>d;++d){var f=this.definitions[d],g=f.name,h=b+"."+g,i="if("+h+" === void(0)) {\n"+" "+h+" = "+f.value+"; }\n"+"$p.defineProperty("+a+", "+"'"+g+"', { get: function(){return "+h+";}, "+"set: function(val){"+h+" = val;} });\n";c.push(i)}return c.join("")}return a+"."+this.definitions.join("; "+a+".")},sb.prototype.toString=function(){var a=h({},this.params.getNames()),b=s;s=function(c){return a.hasOwnProperty(c.name)?c.name:b(c)};var c="function $constr_"+this.params.params.length+(""+this.params),d=this.params.prependMethodArgs(""+this.body);return/\$(superCstr|constr)\b/.test(d)||(d="{\n$superCstr();\n"+d.substring(1)),s=b,c+d+"\n"},ub.prototype.getMembers=function(a,b,c){this.owner.base&&this.owner.base.body.getMembers(a,b,c);var d,e,f,g;for(d=0,f=this.fields.length;f>d;++d){var h=this.fields[d].getNames();for(e=0,g=h.length;g>e;++e)a[h[e]]=this.fields[d]}for(d=0,f=this.methodsNames.length;f>d;++d){var i=this.methodsNames[d];b[i]=!0}for(d=0,f=this.innerClasses.length;f>d;++d){var j=this.innerClasses[d];c[j.name]=j}},ub.prototype.toString=function(){function a(a){for(var b=0;a;)++b,a=a.scope;return b}a(this.owner);var c=this.name,d="",e="",f={},g={},h={};this.getMembers(f,g,h);var i,j;if(this.owner.interfaces){var n,m=[];for(i=0,j=this.interfacesNames.length;j>i;++i)this.owner.interfaces[i]&&(n=s({name:this.interfacesNames[i]}),m.push(n),d+="$p.extendInterfaceMembers("+c+", "+n+");\n");e+=c+".$interfaces = ["+m.join(", ")+"];\n"}for(e+=c+".$isInterface = true;\n",e+=c+".$methods = ['"+this.methodsNames.join("', '")+"'];\n",kb(this.innerClasses),i=0,j=this.innerClasses.length;j>i;++i){var o=this.innerClasses[i];o.isStatic&&(d+=c+"."+o.name+" = "+o+";\n")}for(i=0,j=this.fields.length;j>i;++i){var p=this.fields[i];p.isStatic&&(d+=c+"."+p.definitions.join(";\n"+c+".")+";\n")}return"(function() {\nfunction "+c+"() { throw 'Unable to create the interface'; }\n"+d+e+"return "+c+";\n"+"})()"},B=function(a,b,c){var e=a.substring(1,a.length-1);e=N(e),e=O(e,b);var g=[],h=[];e=e.replace(/"([DE])(\d+)"/g,function(a,b,c){return"D"===b?g.push(c):"E"===b&&h.push(c),""});var j,k,l,i=e.split(/;(?:\s*;)*/g);for(c!==d&&(j=c.replace(/^\s*extends\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)),k=0,l=g.length;l>k;++k){var m=pb(r[g[k]]);g[k]=m.name}for(k=0,l=i.length-1;l>k;++k){var n=f(i[k]);i[k]=rb(n.middle)}var o=i.pop();for(k=0,l=h.length;l>k;++k)h[k]=nb(r[h[k]]);return new ub(b,j,g,i,h,{tail:o})},vb.prototype.getMembers=function(a,b,c){this.owner.base&&this.owner.base.body.getMembers(a,b,c);var d,e,f,g;for(d=0,f=this.fields.length;f>d;++d){var h=this.fields[d].getNames();for(e=0,g=h.length;g>e;++e)a[h[e]]=this.fields[d]}for(d=0,f=this.methods.length;f>d;++d){var i=this.methods[d];b[i.name]=i}for(d=0,f=this.innerClasses.length;f>d;++d){var j=this.innerClasses[d];c[j.name]=j}},vb.prototype.toString=function(){function a(a){for(var b=0;a;)++b,a=a.scope;return b}var b=a(this.owner),c="$this_"+b,d=this.name,e="var "+c+" = this;\n",f="",h="",i={},j={},k={};this.getMembers(i,j,k);var l=s;s=function(a){var b=a.name;return"this"===b?a.callSign||!a.member?c+".$self":c:i.hasOwnProperty(b)?i[b].isStatic?d+"."+b:c+"."+b:k.hasOwnProperty(b)?c+"."+b:j.hasOwnProperty(b)?j[b].isStatic?d+"."+b:c+".$self."+b:l(a)};var m;this.baseClassName?(m=l({name:this.baseClassName}),e+="var $super = { $upcast: "+c+" };\n",e+="function $superCstr(){"+m+".apply($super,arguments);if(!('$self' in $super)) $p.extendClassChain($super)}\n",h+=d+".$base = "+m+";\n"):e+="function $superCstr(){$p.extendClassChain("+c+")}\n",this.owner.base&&(f+="$p.extendStaticMembers("+d+", "+m+");\n");var n,o,p,q;if(this.owner.interfaces){var t,r=[];for(n=0,o=this.interfacesNames.length;o>n;++n)this.owner.interfaces[n]&&(t=l({name:this.interfacesNames[n]}),r.push(t),f+="$p.extendInterfaceMembers("+d+", "+t+");\n");h+=d+".$interfaces = ["+r.join(", ")+"];\n"}for(this.functions.length>0&&(e+=this.functions.join("\n")+"\n"),kb(this.innerClasses),n=0,o=this.innerClasses.length;o>n;++n){var u=this.innerClasses[n];u.isStatic?(f+=d+"."+u.name+" = "+u+";\n",e+=c+"."+u.name+" = "+d+"."+u.name+";\n"):e+=c+"."+u.name+" = "+u+";\n"}for(n=0,o=this.fields.length;o>n;++n){var v=this.fields[n];if(v.isStatic)for(f+=d+"."+v.definitions.join(";\n"+d+".")+";\n",p=0,q=v.definitions.length;q>p;++p){var w=v.definitions[p].name,x=d+"."+w;e+="$p.defineProperty("+c+", '"+w+"', {"+"get: function(){return "+x+"}, "+"set: function(val){"+x+" = val}});\n"}else e+=c+"."+v.definitions.join(";\n"+c+".")+";\n"}var y={};for(n=0,o=this.methods.length;o>n;++n){var z=this.methods[n],A=y[z.name],B=z.name+"$"+z.params.params.length,C=!!z.params.methodArgsParam;A?(++A,B+="_"+A):A=1,z.methodId=B,y[z.name]=A,z.isStatic?(f+=z,f+="$p.addMethod("+d+", '"+z.name+"', "+B+", "+C+");\n",e+="$p.addMethod("+c+", '"+z.name+"', "+B+", "+C+");\n"):(e+=z,e+="$p.addMethod("+c+", '"+z.name+"', "+B+", "+C+");\n")}e+=g(this.misc.tail),this.cstrs.length>0&&(e+=this.cstrs.join("\n")+"\n"),e+="function $constr() {\n";var D=[];for(n=0,o=this.cstrs.length;o>n;++n){var E=this.cstrs[n].params.params.length,F=!!this.cstrs[n].params.methodArgsParam;D.push("if(arguments.length "+(F?">=":"===")+" "+E+") { "+"$constr_"+E+".apply("+c+", arguments); }")}return D.length>0&&(e+=D.join(" else ")+" else "),e+="$superCstr();\n}\n",e+="$constr.apply(null, arguments);\n",s=l,"(function() {\nfunction "+d+"() {\n"+e+"}\n"+f+h+"return "+d+";\n"+"})()"},A=function(a,b,c,e){var g=a.substring(1,a.length-1);g=N(g),g=O(g,b);var h=[],i=[],j=[],k=[];g=g.replace(/"([DEGH])(\d+)"/g,function(a,b,c){return"D"===b?h.push(c):"E"===b?i.push(c):"H"===b?k.push(c):j.push(c),""});var m,n,o,l=g.replace(/^(?:\s*;)+/,"").split(/;(?:\s*;)*/g);for(c!==d&&(m=c.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g,"$1")),e!==d&&(n=e.replace(/^\s*implements\s+(.+?)\s*$/g,"$1").split(/\s*,\s*/g)),o=0;k.length>o;++o)k[o]=W(r[k[o]]);for(o=0;h.length>o;++o)h[o]=pb(r[h[o]]);for(o=0;l.length-1>o;++o){var p=f(l[o]);l[o]=rb(p.middle)}var q=l.pop();for(o=0;j.length>o;++o)j[o]=tb(r[j[o]]);for(o=0;i.length>o;++o)i[o]=nb(r[i[o]]);return new vb(b,m,n,k,h,l,j,i,{tail:q})},wb.prototype.toString=function(){return"var "+this.name+" = "+this.body+";\n"+"$p."+this.name+" = "+this.name+";\n"},xb.prototype.toString=function(){return"var "+this.name+" = "+this.body+";\n"+"$p."+this.name+" = "+this.name+";\n"},zb.prototype.toString=function(){var a=h({},this.params.getNames()),b=s;s=function(c){return a.hasOwnProperty(c.name)?c.name:b(c)};var c=this.params.prependMethodArgs(""+this.body),d="function "+this.name+this.params+" "+c+"\n"+"$p."+this.name+" = "+this.name+";";return s=b,d},Cb.prototype.toString=function(){return this.misc.prefix+(""+this.argument)},Db.prototype.toString=function(){return this.misc.prefix+(""+this.argument)},Eb.prototype.toString=function(){var a=this.misc.prefix;return this.argument!==d&&(a+=""+this.argument),a},Fb.prototype.toString=function(){return"case "+this.expr+":"},Gb.prototype.toString=function(){return this.label},D=function(a,b,c){var e=RegExp(/\b(catch|for|if|switch|while|with)\s*"B(\d+)"|\b(do|else|finally|return|throw|try|break|continue)\b|("[ADEH](\d+)")|\b(case)\s+([^:]+):|\b([A-Za-z_$][\w$]*\s*:)|(;)/g),h=[];a=Bb(a);for(var j,k,i=0;null!==(j=e.exec(a));){if(j[1]!==d){var l=a.lastIndexOf('"B',e.lastIndex),m=a.substring(i,l);"for"===j[1]?h.push(new Cb(jb(r[j[2]]),{prefix:m})):"catch"===j[1]?h.push(new Db(R(r[j[2]]),{prefix:m})):h.push(new Eb(j[1],F(r[j[2]]),{prefix:m}))}else if(j[3]!==d)h.push(new Eb(j[3],d,{prefix:a.substring(i,e.lastIndex)}));else if(j[4]!==d){if(k=a.substring(i,e.lastIndex-j[4].length),0!==g(k).length)continue;h.push(k);var n=j[4].charAt(1),o=j[5];"D"===n?h.push(b(r[o])):"E"===n?h.push(c(r[o])):"H"===n?h.push(W(r[o])):h.push(C(r[o]))}else if(j[6]!==d)h.push(new Fb(F(g(j[7]))));else if(j[8]!==d){if(k=a.substring(i,e.lastIndex-j[8].length),0!==g(k).length)continue;h.push(new Gb(a.substring(i,e.lastIndex)))}else{var p=f(a.substring(i,e.lastIndex-1));h.push(p.left),h.push(fb(p.middle)),h.push(p.right+";")}i=e.lastIndex}var q=f(a.substring(i));return h.push(q.left),""!==q.middle&&(h.push(fb(q.middle)),h.push(";"+q.right)),h},Ib.prototype.toString=function(){var a=Hb(this.statements),b=s;i(a)||(s=function(c){return a.hasOwnProperty(c.name)?c.name:b(c)});var c="{\n"+this.statements.join("")+"\n}";return s=b,c},C=function(a){var b=f(a.substring(1,a.length-1));return new Ib(D(b.middle))},Jb.prototype.toString=function(){for(var d,a=[],c=[],e=0,f=this.statements.length;f>e;++e)d=this.statements[e],d instanceof xb||d instanceof wb?a.push(d):c.push(d);kb(a);var g=Hb(this.statements);s=function(a){var c=a.name;return g.hasOwnProperty(c)?c:b.hasOwnProperty(c)||o.hasOwnProperty(c)||w.hasOwnProperty(c)?"$p."+c:c};var h="// this code was autogenerated from PJS\n(function($p) {\n"+a.join("")+"\n"+c.join("")+"\n})";return s=null,h},E=function(){var a=N(r[0]);return a=a.replace(/\bimport\s+[^;]+;/g,""),new Jb(D(a,Ab,yb))};var Mb=E();Kb(Mb),Lb(Mb);var Nb=""+Mb;return Nb=Nb.replace(/\s*\n(?:[\t ]*\n)+/g,"\n\n"),Nb=Nb.replace(/__x([0-9A-F]{4})/g,function(a,b){return String.fromCharCode(parseInt(b,16))
}),e(Nb,l)}function K(a,b){var c=RegExp(/\/\*\s*@pjs\s+((?:[^\*]|\*+[^\*\/])*)\*\//g).exec(a);if(c&&2===c.length)for(var d=[],e=c.splice(1,2)[0].replace(/\{([\s\S]*?)\}/g,function(){return function(a,b){return d.push(b),"{"+(d.length-1)+"}"}}()).replace("\n","").replace("\r","").split(";"),f=function(a){return a.replace(/^\s*["']?/,"").replace(/["']?\s*$/,"")},g=0,h=e.length;h>g;g++){var i=e[g].split("=");if(i&&2===i.length){var j=f(i[0]),k=f(i[1]),l=[];if("preload"===j){l=k.split(",");for(var m=0,n=l.length;n>m;m++){var o=f(l[m]);b.imageCache.add(o)}}else if("font"===j){l=k.split(",");for(var p=0,q=l.length;q>p;p++){var r=f(l[p]),s=/^\{(\d*?)\}$/.exec(r);G.preloading.add(s?JSON.parse("{"+d[s[1]]+"}"):r)}}else"pauseOnBlur"===j?b.options.pauseOnBlur="true"===k:"globalKeyEvents"===j?b.options.globalKeyEvents="true"===k:"param-"===j.substring(0,6)?b.params[j.substring(6)]=k:b.options[j]=k}}return a}var e=function(a){throw H.logger.log(a),"string"==typeof a?Error(a):a},f=function(){},g=function(){return"console"in a?function(b){a.console.log("Processing.js: "+b)}:f}(),h=function(a){var b=new XMLHttpRequest;return b.open("GET",a,!1),b.overrideMimeType&&b.overrideMimeType("text/plain"),b.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT"),b.send(null),200!==b.status&&0!==b.status&&e("XMLHttpRequest failed, status code "+b.status),b.responseText},i="document"in this&&!("fake"in this.document);b.head||(b.head=b.getElementsByTagName("head")[0]),b.documentMode>=9&&!b.doctype&&e("The doctype directive is missing. The recommended doctype in Internet Explorer is the HTML5 doctype: <!DOCTYPE html>");var k=j("Float32Array","WebGLFloatArray"),l=j("Int32Array","WebGLIntArray"),m=j("Uint16Array","WebGLUnsignedShortArray"),n=j("Uint8Array","WebGLUnsignedByteArray"),o={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:1e-4,MAX_FLOAT:3.4028235e38,MIN_FLOAT:-3.4028235e38,MAX_INT:2147483647,MIN_INT:-2147483648,PI:c.PI,TWO_PI:2*c.PI,HALF_PI:c.PI/2,THIRD_PI:c.PI/3,QUARTER_PI:c.PI/4,DEG_TO_RAD:c.PI/180,RAD_TO_DEG:180/c.PI,WHITESPACE:" \n\r\f\u00a0",RGB:1,ARGB:2,HSB:3,ALPHA:4,CMYK:5,TIFF:0,TARGA:1,JPEG:2,GIF:3,BLUR:11,GRAY:12,INVERT:13,OPAQUE:14,POSTERIZE:15,THRESHOLD:16,ERODE:17,DILATE:18,REPLACE:0,BLEND:1,ADD:2,SUBTRACT:4,LIGHTEST:8,DARKEST:16,DIFFERENCE:32,EXCLUSION:64,MULTIPLY:128,SCREEN:256,OVERLAY:512,HARD_LIGHT:1024,SOFT_LIGHT:2048,DODGE:4096,BURN:8192,ALPHA_MASK:4278190080,RED_MASK:16711680,GREEN_MASK:65280,BLUE_MASK:255,CUSTOM:0,ORTHOGRAPHIC:2,PERSPECTIVE:3,POINT:2,POINTS:2,LINE:4,LINES:4,TRIANGLE:8,TRIANGLES:9,TRIANGLE_STRIP:10,TRIANGLE_FAN:11,QUAD:16,QUADS:16,QUAD_STRIP:17,POLYGON:20,PATH:21,RECT:30,ELLIPSE:31,ARC:32,SPHERE:40,BOX:41,GROUP:0,PRIMITIVE:1,GEOMETRY:3,VERTEX:0,BEZIER_VERTEX:1,CURVE_VERTEX:2,BREAK:3,CLOSESHAPE:4,OPEN:1,CLOSE:2,CORNER:0,CORNERS:1,RADIUS:2,CENTER_RADIUS:2,CENTER:3,DIAMETER:3,CENTER_DIAMETER:3,BASELINE:0,TOP:101,BOTTOM:102,NORMAL:1,NORMALIZED:1,IMAGE:2,MODEL:4,SHAPE:5,SQUARE:"butt",ROUND:"round",PROJECT:"square",MITER:"miter",BEVEL:"bevel",AMBIENT:0,DIRECTIONAL:1,SPOT:3,BACKSPACE:8,TAB:9,ENTER:10,RETURN:13,ESC:27,DELETE:127,CODED:65535,SHIFT:16,CONTROL:17,ALT:18,CAPSLK:20,PGUP:33,PGDN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUMLK:144,META:157,INSERT:155,ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",NOCURSOR:"url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto",DISABLE_OPENGL_2X_SMOOTH:1,ENABLE_OPENGL_2X_SMOOTH:-1,ENABLE_OPENGL_4X_SMOOTH:2,ENABLE_NATIVE_FONTS:3,DISABLE_DEPTH_TEST:4,ENABLE_DEPTH_TEST:-4,ENABLE_DEPTH_SORT:5,DISABLE_DEPTH_SORT:-5,DISABLE_OPENGL_ERROR_REPORT:6,ENABLE_OPENGL_ERROR_REPORT:-6,ENABLE_ACCURATE_TEXTURES:7,DISABLE_ACCURATE_TEXTURES:-7,HINT_COUNT:10,SINCOS_LENGTH:720,PRECISIONB:15,PRECISIONF:32768,PREC_MAXVAL:32767,PREC_ALPHA_SHIFT:9,PREC_RED_SHIFT:1,NORMAL_MODE_AUTO:0,NORMAL_MODE_SHAPE:1,NORMAL_MODE_VERTEX:2,MAX_LIGHTS:8},r=function(a){if(a instanceof Array){var b=-1;this.hasNext=function(){return++b<a.length},this.next=function(){return a[b]}}else{if(a.iterator instanceof Function)return a.iterator();e("Unable to iterate: "+a)}},s=function(){function a(a){var b=-1;this.hasNext=function(){return a.length>b+1},this.next=function(){return a[++b]},this.remove=function(){a.splice(b--,1)}}function b(c){var d=[];c&&c.toArray&&(d=c.toArray()),this.get=function(a){return d[a]},this.contains=function(a){return this.indexOf(a)>-1},this.indexOf=function(a){for(var b=0,c=d.length;c>b;++b)if(q(a,d[b]))return b;return-1},this.lastIndexOf=function(a){for(var b=d.length-1;b>=0;--b)if(q(a,d[b]))return b;return-1},this.add=function(){if(1===arguments.length)d.push(arguments[0]);else if(2===arguments.length){var a=arguments[0];"number"==typeof a?a>=0&&d.length>=a?d.splice(a,0,arguments[1]):e(a+" is not a valid index"):e(typeof a+" is not a number")}else e("Please use the proper number of parameters.")},this.addAll=function(a,b){var c;if("number"==typeof a)for((0>a||a>d.length)&&e("Index out of bounds for addAll: "+a+" greater or equal than "+d.length),c=new r(b);c.hasNext();)d.splice(a++,0,c.next());else for(c=new r(a);c.hasNext();)d.push(c.next())},this.set=function(){if(2===arguments.length){var a=arguments[0];"number"==typeof a?a>=0&&d.length>a?d.splice(a,1,arguments[1]):e(a+" is not a valid index."):e(typeof a+" is not a number")}else e("Please use the proper number of parameters.")},this.size=function(){return d.length},this.clear=function(){d.length=0},this.remove=function(a){return"number"==typeof a?d.splice(a,1)[0]:(a=this.indexOf(a),a>-1?(d.splice(a,1),!0):!1)},this.removeAll=function(a){var c,d,e,f=new b;for(f.addAll(this),this.clear(),c=0,d=0;f.size()>c;c++)e=f.get(c),a.contains(e)||this.add(d++,e);return this.size()<f.size()?!0:!1},this.isEmpty=function(){return!d.length},this.clone=function(){return new b(this)},this.toArray=function(){return d.slice(0)},this.iterator=function(){return new a(d)}}return b}(),t=function(){function a(){function h(a){var b=p(a)%e.length;return 0>b?e.length+b:b}function i(){if(!(c*e.length>=f)){for(var a=[],b=0;e.length>b;++b)e[b]!==d&&(a=a.concat(e[b]));var g=2*e.length;e=[],e.length=g;for(var i=0;a.length>i;++i){var j=h(a[i].key),k=e[j];k===d&&(e[j]=k=[]),k.push(a[i])}}}function j(a,b){function i(){for(;!g;)if(++f,c>=e.length)g=!0;else{if(!(e[c]===d||f>=e[c].length))return;f=-1,++c}}var h,c=0,f=-1,g=!1;this.hasNext=function(){return!g},this.next=function(){return h=a(e[c][f]),i(),h},this.remove=function(){h!==d&&(b(h),--f,i())},i()}function k(a,b,c){this.clear=function(){g.clear()},this.contains=function(a){return b(a)},this.containsAll=function(a){for(var b=a.iterator();b.hasNext();)if(!this.contains(b.next()))return!1;return!0},this.isEmpty=function(){return g.isEmpty()},this.iterator=function(){return new j(a,c)},this.remove=function(a){return this.contains(a)?(c(a),!0):!1},this.removeAll=function(a){for(var b=a.iterator(),d=!1;b.hasNext();){var e=b.next();this.contains(e)&&(c(e),d=!0)}return!0},this.retainAll=function(a){for(var b=this.iterator(),d=[];b.hasNext();){var e=b.next();a.contains(e)||d.push(e)}for(var f=0;d.length>f;++f)c(d[f]);return d.length>0},this.size=function(){return g.size()},this.toArray=function(){for(var a=[],b=this.iterator();b.hasNext();)a.push(b.next());return a}}function l(a){this._isIn=function(b){return b===g&&a.removed===d},this.equals=function(b){return q(a.key,b.getKey())},this.getKey=function(){return a.key},this.getValue=function(){return a.value},this.hashCode=function(){return p(a.key)},this.setValue=function(b){var c=a.value;return a.value=b,c}}if(1===arguments.length&&arguments[0]instanceof a)return arguments[0].clone();var b=arguments.length>0?arguments[0]:16,c=arguments.length>1?arguments[1]:.75,e=[];e.length=b;var f=0,g=this;this.clear=function(){f=0,e=[],e.length=b},this.clone=function(){var b=new a;return b.putAll(this),b},this.containsKey=function(a){var b=h(a),c=e[b];if(c===d)return!1;for(var f=0;c.length>f;++f)if(q(c[f].key,a))return!0;return!1},this.containsValue=function(a){for(var b=0;e.length>b;++b){var c=e[b];if(c!==d)for(var f=0;c.length>f;++f)if(q(c[f].value,a))return!0}return!1},this.entrySet=function(){return new k(function(a){return new l(a)},function(a){return a instanceof l&&a._isIn(g)},function(a){return g.remove(a.getKey())})},this.get=function(a){var b=h(a),c=e[b];if(c===d)return null;for(var f=0;c.length>f;++f)if(q(c[f].key,a))return c[f].value;return null},this.isEmpty=function(){return 0===f},this.keySet=function(){return new k(function(a){return a.key},function(a){return g.containsKey(a)},function(a){return g.remove(a)})},this.values=function(){return new k(function(a){return a.value},function(a){return g.containsValue(a)},function(a){return g.removeByValue(a)})},this.put=function(a,b){var c=h(a),g=e[c];if(g===d)return++f,e[c]=[{key:a,value:b}],i(),null;for(var j=0;g.length>j;++j)if(q(g[j].key,a)){var k=g[j].value;return g[j].value=b,k}return++f,g.push({key:a,value:b}),i(),null},this.putAll=function(a){for(var b=a.entrySet().iterator();b.hasNext();){var c=b.next();this.put(c.getKey(),c.getValue())}},this.remove=function(a){var b=h(a),c=e[b];if(c===d)return null;for(var g=0;c.length>g;++g)if(q(c[g].key,a)){--f;var i=c[g].value;return c[g].removed=!0,c.length>1?c.splice(g,1):e[b]=d,i}return null},this.removeByValue=function(a){var b,c,d,f;for(b in e)if(e.hasOwnProperty(b))for(c=0,d=e[b].length;d>c;c++)if(f=e[b][c],f.value===a)return e[b].splice(c,1),!0;return!1},this.size=function(){return f}}return a}(),u=function(){function a(a,b,c){this.x=a||0,this.y=b||0,this.z=c||0}function b(a){return function(b,c){var d=b.get();return d[a](c),d}}a.fromAngle=function(b,e){return(e===d||null===e)&&(e=new a),e.x=c.cos(b),e.y=c.sin(b),e},a.random2D=function(b){return a.fromAngle(c.random()*o.TWO_PI,b)},a.random3D=function(b){var e=c.random()*o.TWO_PI,f=2*c.random()-1,g=c.sqrt(1-f*f),h=g*c.cos(e),i=g*c.sin(e);return b===d||null===b?b=new a(h,i,f):b.set(h,i,f),b},a.dist=function(a,b){return a.dist(b)},a.dot=function(a,b){return a.dot(b)},a.cross=function(a,b){return a.cross(b)},a.sub=function(b,c){return new a(b.x-c.x,b.y-c.y,b.z-c.z)},a.angleBetween=function(a,b){return c.acos(a.dot(b)/(a.mag()*b.mag()))},a.lerp=function(b,c,d){var e=new a(b.x,b.y,b.z);return e.lerp(c,d),e},a.prototype={set:function(a,b,c){1===arguments.length?this.set(a.x||a[0]||0,a.y||a[1]||0,a.z||a[2]||0):(this.x=a,this.y=b,this.z=c)},get:function(){return new a(this.x,this.y,this.z)},mag:function(){var a=this.x,b=this.y,d=this.z;return c.sqrt(a*a+b*b+d*d)},magSq:function(){var a=this.x,b=this.y,c=this.z;return a*a+b*b+c*c},setMag:function(a,b){if(b!==d){var c=a;return c.normalize(),c.mult(b),c}b=a,this.normalize(),this.mult(b)},add:function(a,b,c){1===arguments.length?(this.x+=a.x,this.y+=a.y,this.z+=a.z):(this.x+=a,this.y+=b,this.z+=c)},sub:function(a,b,c){1===arguments.length?(this.x-=a.x,this.y-=a.y,this.z-=a.z):(this.x-=a,this.y-=b,this.z-=c)},mult:function(a){"number"==typeof a?(this.x*=a,this.y*=a,this.z*=a):(this.x*=a.x,this.y*=a.y,this.z*=a.z)},div:function(a){"number"==typeof a?(this.x/=a,this.y/=a,this.z/=a):(this.x/=a.x,this.y/=a.y,this.z/=a.z)},rotate:function(a){var b=this.x,d=c.cos(a),e=c.sin(a);this.x=d*this.x-e*this.y,this.y=e*b+d*this.y},dist:function(a){var b=this.x-a.x,d=this.y-a.y,e=this.z-a.z;return c.sqrt(b*b+d*d+e*e)},dot:function(a,b,c){return 1===arguments.length?this.x*a.x+this.y*a.y+this.z*a.z:this.x*a+this.y*b+this.z*c},cross:function(b){var c=this.x,d=this.y,e=this.z;return new a(d*b.z-b.y*e,e*b.x-b.z*c,c*b.y-b.x*d)},lerp:function(a,b,c,d){var f,g,e=function(a,b,c){return a+(b-a)*c};2===arguments.length?(d=b,f=a.x,g=a.y,c=a.z):(f=a,g=b),this.x=e(this.x,f,d),this.y=e(this.y,g,d),this.z=e(this.z,c,d)},normalize:function(){var a=this.mag();a>0&&this.div(a)},limit:function(a){this.mag()>a&&(this.normalize(),this.mult(a))},heading:function(){return-c.atan2(-this.y,this.x)},heading2D:function(){return this.heading()},toString:function(){return"["+this.x+", "+this.y+", "+this.z+"]"},array:function(){return[this.x,this.y,this.z]}};for(var e in a.prototype)a.prototype.hasOwnProperty(e)&&!a.hasOwnProperty(e)&&(a[e]=b(e));return a}();v.prototype=o;var w=new v;w.ArrayList=s,w.HashMap=t,w.PVector=u,w.ObjectIterator=r,w.PConstants=o,w.defineProperty=function(a,b,c){"defineProperty"in Object?Object.defineProperty(a,b,c):(c.hasOwnProperty("get")&&a.__defineGetter__(b,c.get),c.hasOwnProperty("set")&&a.__defineSetter__(b,c.set))},w.extendClassChain=function(a){for(var b=[a],c=a.$upcast;c;c=c.$upcast)y(c,a),b.push(c),a=c;for(;b.length>0;)b.pop().$self=a},w.extendStaticMembers=function(a,b){y(a,b)},w.extendInterfaceMembers=function(a,b){y(a,b)},w.addMethod=function(a,b,c,d){var e=a[b];if(e||d){var f=c.length;if("$overloads"in e)e.$overloads[f]=c;else{var g=function(){var a=g.$overloads[arguments.length]||("$methodArgsIndex"in g&&arguments.length>g.$methodArgsIndex?g.$overloads[g.$methodArgsIndex]:null)||g.$defaultOverload;return a.apply(this,arguments)},h=[];e&&(h[e.length]=e),h[f]=c,g.$overloads=h,g.$defaultOverload=e||c,d&&(g.$methodArgsIndex=f),g.name=b,a[b]=g}}else a[b]=c},w.createJavaArray=function(a,b){var c=null,d=null;if("string"==typeof a&&("boolean"===a?d=!1:z(a)&&(d=0)),"number"==typeof b[0]){var e=0|b[0];if(1>=b.length){c=[],c.length=e;for(var f=0;e>f;++f)c[f]=d}else{c=[];for(var g=b.slice(1),h=0;e>h;++h)c.push(w.createJavaArray(a,g))}}return c};var A={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};(function(a){function g(a){return function(){e("Processing.js does not support "+a+".")}}for(var d,f,b="open() createOutput() createInput() BufferedReader selectFolder() dataPath() createWriter() selectOutput() beginRecord() saveStream() endRecord() selectInput() saveBytes() createReader() beginRaw() endRaw() PrintWriter delay()".split(" "),c=b.length;c--;)d=b[c],f=d.replace("()",""),a[f]=g(d)})(w),w.defineProperty(w,"screenWidth",{get:function(){return a.innerWidth}}),w.defineProperty(w,"screenHeight",{get:function(){return a.innerHeight}});var B=[],C={},D=function(a){B.splice(C[a],1),delete C[a]},E=function(a){a.externals.canvas.id!==d&&a.externals.canvas.id.length||(a.externals.canvas.id="__processing"+B.length),C[a.externals.canvas.id]=B.length,B.push(a)};G.prototype.caching=!0,G.prototype.getCSSDefinition=function(a,b){a===d&&(a=this.size+"px"),b===d&&(b=this.leading+"px");var c=[this.style,"normal",this.weight,a+"/"+b,this.family];return c.join(" ")},G.prototype.measureTextWidth=function(a){return this.context2d.measureText(a).width},G.prototype.measureTextWidthFallback=function(a){var c=b.createElement("canvas"),d=c.getContext("2d");return d.font=this.css,d.measureText(a).width},G.PFontCache={length:0},G.get=function(a,b){b=(0|10*b+.5)/10;var c=G.PFontCache,d=a+"/"+b;if(!c[d]){if(c[d]=new G(a,b),c.length++,50===c.length){G.prototype.measureTextWidth=G.prototype.measureTextWidthFallback,G.prototype.caching=!1;var e;for(e in c)"length"!==e&&(c[e].context2d=null);return new G(a,b)}if(400===c.length)return G.PFontCache={},G.get=G.getFallback,new G(a,b)}return c[d]},G.getFallback=function(a,b){return new G(a,b)},G.list=function(){return["sans-serif","serif","monospace","fantasy","cursive"]},G.preloading={template:{},initialized:!1,initialize:function(){var a=function(){var a="#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#",b=function(a){return"AAAAAAAA".substr(~~a?7-a:6)};return a.replace(/[#237]/g,b)},c=b.createElement("style");c.setAttribute("type","text/css"),c.innerHTML='@font-face {\n font-family: "PjsEmptyFont";\n src: url(\'data:application/x-font-ttf;base64,'+a()+"')\n"+" format('truetype');\n"+"}",b.head.appendChild(c);var d=b.createElement("span");d.style.cssText='position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;',d.innerHTML="AAAAAAAA",b.body.appendChild(d),this.template=d,this.initialized=!0},getElementWidth:function(a){return b.defaultView.getComputedStyle(a,"").getPropertyValue("width")},timeAttempted:0,pending:function(a){this.initialized||this.initialize();for(var c,d,e=this.getElementWidth(this.template),f=0;this.fontList.length>f;f++){if(c=this.fontList[f],d=this.getElementWidth(c),4e3>this.timeAttempted&&d===e)return this.timeAttempted+=a,!0;b.body.removeChild(c),this.fontList.splice(f--,1),this.timeAttempted=0}return 0===this.fontList.length?!1:!0},fontList:[],addedList:{},add:function(a){this.initialized||this.initialize();var c="object"==typeof a?a.fontFace:a,d="object"==typeof a?a.url:a;if(!this.addedList[c]){var e=b.createElement("style");e.setAttribute("type","text/css"),e.innerHTML="@font-face{\n font-family: '"+c+"';\n src: url('"+d+"');\n}\n",b.head.appendChild(e),this.addedList[c]=!0;var f=b.createElement("span");f.style.cssText="position: absolute; top: 0; left: 0; opacity: 0;",f.style.fontFamily='"'+c+'", "PjsEmptyFont", fantasy',f.innerHTML="AAAAAAAA",b.body.appendChild(f),this.fontList.push(f)}}},w.PFont=G;var H=this.Processing=function(g,i){function s(a){H.debug("Unimplemented - "+a)}function nd(a,b,c,e){var f=Db.locations[a];f===d&&(f=v.getUniformLocation(b,c),Db.locations[a]=f),null!==f&&(4===e.length?v.uniform4fv(f,e):3===e.length?v.uniform3fv(f,e):2===e.length?v.uniform2fv(f,e):v.uniform1f(f,e))}function od(a,b,c,e){var f=Db.locations[a];f===d&&(f=v.getUniformLocation(b,c),Db.locations[a]=f),null!==f&&(4===e.length?v.uniform4iv(f,e):3===e.length?v.uniform3iv(f,e):2===e.length?v.uniform2iv(f,e):v.uniform1i(f,e))}function pd(a,b,c,e,f){var g=Db.locations[a];g===d&&(g=v.getUniformLocation(b,c),Db.locations[a]=g),-1!==g&&(16===f.length?v.uniformMatrix4fv(g,e,f):9===f.length?v.uniformMatrix3fv(g,e,f):v.uniformMatrix2fv(g,e,f))}function qd(a,b,c,e,f){var g=Db.attributes[a];g===d&&(g=v.getAttribLocation(b,c),Db.attributes[a]=g),-1!==g&&(v.bindBuffer(v.ARRAY_BUFFER,f),v.vertexAttribPointer(g,e,v.FLOAT,!1,0,0),v.enableVertexAttribArray(g))}function rd(a,b,c){var e=Db.attributes[a];e===d&&(e=v.getAttribLocation(b,c),Db.attributes[a]=e),-1!==e&&v.disableVertexAttribArray(e)}function Nd(a,b,d,e){var f,g,h,i;if(pb===o.HSB){var j=t.color.toRGB(a,b,d);f=j[0],g=j[1],h=j[2]}else f=c.round(255*(a/ib)),g=c.round(255*(b/jb)),h=c.round(255*(d/kb));return i=c.round(255*(e/hb)),f=0>f?0:f,g=0>g?0:g,h=0>h?0:h,i=0>i?0:i,f=f>255?255:f,g=g>255?255:g,h=h>255?255:h,i=i>255?255:i,i<<24&o.ALPHA_MASK|f<<16&o.RED_MASK|g<<8&o.GREEN_MASK|h&o.BLUE_MASK}function Od(a,b){var d;return a&o.ALPHA_MASK?(d=c.round(255*(b/hb)),d=d>255?255:d,d=0>d?0:d,a-(a&o.ALPHA_MASK)+(d<<24&o.ALPHA_MASK)):pb===o.RGB?Nd(a,a,a,b):pb===o.HSB?Nd(0,0,a/ib*kb,b):void 0}function Pd(a){if(ib>=a&&a>=0){if(pb===o.RGB)return Nd(a,a,a,hb);if(pb===o.HSB)return Nd(0,0,a/ib*kb,hb)}return a?(a>2147483647&&(a-=4294967296),a):void 0}function Qd(a){var b,c,d;b=((a&o.RED_MASK)>>>16)/255,c=((a&o.GREEN_MASK)>>>8)/255,d=(a&o.BLUE_MASK)/255;var g,h,e=t.max(t.max(b,c),d),f=t.min(t.min(b,c),d);return f===e?[0,0,e*kb]:(h=(e-f)/e,g=b===e?(c-d)/(e-f):c===e?2+(d-b)/(e-f):4+(b-c)/(e-f),g/=6,0>g?g+=1:g>1&&(g-=1),[g*ib,h*jb,e*kb])}function Rd(){v.save()}function Sd(){v.restore(),L=!0,F=!0}function Td(){var a=(Date.now()-ub)/1e3;vb++;var b=vb/a;a>.5&&(ub=Date.now(),vb=0,t.__frameRate=b),t.frameCount++}function Vd(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c),Ud.push({elem:a,type:b,fn:c})}function Wd(a){var b=a.elem,c=a.type,d=a.fn;b.removeEventListener?b.removeEventListener(c,d,!1):b.detachEvent&&b.detachEvent("on"+c,d)}function Xd(a,b,e,f,g,h){var i=0>a?e:b,j=0===g,k=g===d||0>g?0:g,l=c.abs(a);if(j)for(k=1,l*=10;c.abs(c.round(l)-l)>1e-6&&7>k;)++k,l*=10;else 0!==k&&(l*=c.pow(10,k));var m,n=2*l;if(c.floor(l)===l)m=l;else if(c.floor(n)===n){var o=c.floor(l);m=o+o%2}else m=c.round(l);for(var p="",q=f+k;q>0||m>0;)q--,p=""+m%10+p,m=c.floor(m/10);if(h!==d)for(var r=p.length-3-k;r>0;)p=p.substring(0,r)+h+p.substring(r),r-=3;return k>0?i+p.substring(0,p.length-k)+"."+p.substring(p.length-k,p.length):i+p}function Yd(a,b,c,d,e,f){if(a instanceof Array){for(var g=[],h=0,i=a.length;i>h;h++)g.push(Xd(a[h],b,c,d,e,f));return g}return Xd(a,b,c,d,e,f)}function $d(a){var b=parseInt("0x"+a,16);return b>2147483647&&(b-=4294967296),b}function _d(a){return Array.prototype.slice.call(a,1)}function be(a){return"number"==typeof a?0!==a:"boolean"==typeof a?a:"string"==typeof a?"true"===a.toLowerCase():a instanceof Cd?49===a.code||84===a.code||116===a.code:void 0}function ce(a){return"number"==typeof a?a:"boolean"==typeof a?a?1:0:"string"==typeof a?parseFloat(a):a instanceof Cd?a.code:void 0}function de(a,b){if("number"==typeof a)return 4294967295&a;if("boolean"==typeof a)return a?1:0;if("string"==typeof a){var c=parseInt(a,b||10);return 4294967295&c}return a instanceof Cd?a.code:void 0}function fe(a,b){var c=a||362436069,d=b||521288629,e=function(){return c=4294967295&36969*(65535&c)+(c>>>16),d=4294967295&18e3*(65535&d)+(d>>>16),4294967295&((65535&c)<<16|65535&d)};this.nextDouble=function(){var a=e()/4294967296;return 0>a?1+a:a},this.nextInt=e}function ge(a){function i(a,b,c,d){var e=15&a,f=8>e?b:c,g=4>e?c:12===e||14===e?b:d;return(0===(1&e)?f:-f)+(0===(2&e)?g:-g)}function j(a,b,c){var d=0===(1&a)?b:c;return 0===(2&a)?-d:d}function k(a,b){return 0===(1&a)?-b:b}function l(a,b,c){return b+a*(c-b)}var e,f,b=a!==d?new fe(a):fe.createRandomized(),g=new n(512);for(e=0;256>e;++e)g[e]=e;for(e=0;256>e;++e){var h=g[f=255&b.nextInt()];g[f]=g[e],g[e]=h}for(e=0;256>e;++e)g[e+256]=g[e];this.noise3d=function(a,b,d){var e=255&c.floor(a),f=255&c.floor(b),h=255&c.floor(d);a-=c.floor(a),b-=c.floor(b),d-=c.floor(d);var j=(3-2*a)*a*a,k=(3-2*b)*b*b,m=(3-2*d)*d*d,n=g[e]+f,o=g[n]+h,p=g[n+1]+h,q=g[e+1]+f,r=g[q]+h,s=g[q+1]+h;return l(m,l(k,l(j,i(g[o],a,b,d),i(g[r],a-1,b,d)),l(j,i(g[p],a,b-1,d),i(g[s],a-1,b-1,d))),l(k,l(j,i(g[o+1],a,b,d-1),i(g[r+1],a-1,b,d-1)),l(j,i(g[p+1],a,b-1,d-1),i(g[s+1],a-1,b-1,d-1))))},this.noise2d=function(a,b){var d=255&c.floor(a),e=255&c.floor(b);a-=c.floor(a),b-=c.floor(b);var f=(3-2*a)*a*a,h=(3-2*b)*b*b,i=g[d]+e,k=g[d+1]+e;return l(h,l(f,j(g[i],a,b),j(g[k],a-1,b)),l(f,j(g[i+1],a,b-1),j(g[k+1],a-1,b-1)))},this.noise1d=function(a){var b=255&c.floor(a);a-=c.floor(a);var d=(3-2*a)*a*a;return l(d,k(g[b],a),k(g[b+1],a-1))}}function le(){z&&(F&&(v.fillStyle=t.color.toString(C),F=!1),v.fill())}function me(){I&&(L&&(v.strokeStyle=t.color.toString(K),L=!1),v.stroke())}function qe(){le(),me(),v.closePath()}function ye(a,c,e){var f=xe.shift();f===d&&(f={},f.canvas=b.createElement("canvas"),f.context=f.canvas.getContext("2d")),xe.push(f);var g=f.canvas,h=f.context,i=c||a.width,j=e||a.height;return g.width=i,g.height=j,a?"data"in a?h.putImageData(a,0,0):(h.clearRect(0,0,i,j),h.drawImage(a,0,0,i,j)):h.clearRect(0,0,i,j),f}function ze(a){return{getLength:function(a){return function(){return a.isRemote?(e("Image is loaded remotely. Cannot get length."),void 0):a.imageData.data.length?a.imageData.data.length/4:0}}(a),getPixel:function(a){return function(b){var c=4*b,d=a.imageData.data;return a.isRemote&&e("Image is loaded remotely. Cannot get pixels."),d[c+3]<<24&o.ALPHA_MASK|d[c]<<16&o.RED_MASK|d[c+1]<<8&o.GREEN_MASK|d[c+2]&o.BLUE_MASK}}(a),setPixel:function(a){return function(b,c){var d=4*b,f=a.imageData.data;a.isRemote&&e("Image is loaded remotely. Cannot set pixel."),f[d+0]=(c&o.RED_MASK)>>>16,f[d+1]=(c&o.GREEN_MASK)>>>8,f[d+2]=c&o.BLUE_MASK,f[d+3]=(c&o.ALPHA_MASK)>>>24,a.__isDirty=!0}}(a),toArray:function(a){return function(){var b=[],c=a.imageData.data,d=a.width*a.height;a.isRemote&&e("Image is loaded remotely. Cannot get pixels.");for(var f=0,g=0;d>f;f++,g+=4)b.push(c[g+3]<<24&o.ALPHA_MASK|c[g]<<16&o.RED_MASK|c[g+1]<<8&o.GREEN_MASK|c[g+2]&o.BLUE_MASK);return b}}(a),set:function(a){return function(b){var c,d,f;this.isRemote&&e("Image is loaded remotely. Cannot set pixels."),d=a.imageData.data;for(var g=0,h=b.length;h>g;g++)f=b[g],c=4*g,d[c+0]=(f&o.RED_MASK)>>>16,d[c+1]=(f&o.GREEN_MASK)>>>8,d[c+2]=f&o.BLUE_MASK,d[c+3]=(f&o.ALPHA_MASK)>>>24;a.__isDirty=!0}}(a)}}function Be(a,b){var c;if(a>=t.width||0>a||0>b||b>=t.height)return 0;if(kc){var d=4*((0|a)+t.width*(0|b));return c=t.imageData.data,c[d+3]<<24&o.ALPHA_MASK|c[d]<<16&o.RED_MASK|c[d+1]<<8&o.GREEN_MASK|c[d+2]&o.BLUE_MASK}return c=t.toImageData(0|a,0|b,1,1).data,c[3]<<24&o.ALPHA_MASK|c[0]<<16&o.RED_MASK|c[1]<<8&o.GREEN_MASK|c[2]&o.BLUE_MASK}function Ce(a,b,c){c.isRemote&&e("Image is loaded remotely. Cannot get x,y.");var d=4*b*c.width+4*a,f=c.imageData.data;return f[d+3]<<24&o.ALPHA_MASK|f[d]<<16&o.RED_MASK|f[d+1]<<8&o.GREEN_MASK|f[d+2]&o.BLUE_MASK}function De(a,b,c,d){var e=new Ae(c,d,o.ARGB);return e.fromImageData(t.toImageData(a,b,c,d)),e}function Ee(a,b,d,f,g){g.isRemote&&e("Image is loaded remotely. Cannot get x,y,w,h.");for(var h=new Ae(d,f,o.ARGB),i=h.imageData.data,j=g.width,k=g.height,l=g.imageData.data,m=c.max(0,-b),n=c.max(0,-a),p=c.min(f,k-b),q=c.min(d,j-a),r=m;p>r;++r)for(var s=4*((b+r)*j+(a+n)),t=4*(r*d+n),u=n;q>u;++u)i[t++]=l[s++],i[t++]=l[s++],i[t++]=l[s++],i[t++]=l[s++];return h.__isDirty=!0,h}function Fe(){kc&&(v=ic,kc=!1,t.updatePixels())}function Ge(){function a(a,b){function c(){Fe(),v[b].apply(v,arguments)}a[b]=c}function b(a,b){function c(){return Fe(),v[b]}function d(a){Fe(),v[b]=a}t.defineProperty(a,b,{get:c,set:d})}for(var c in v)"function"==typeof v[c]?a(this,c):b(this,c)}function He(){kc||(t.loadPixels(),null===jc&&(ic=v,jc=new Ge),kc=!0,v=jc,lc=0)}function Ie(a,b,c){t.width>a&&a>=0&&b>=0&&t.height>b&&(He(),t.pixels.setPixel((0|a)+t.width*(0|b),c),++lc>mc&&Fe())}function Je(a,b,c,d){d.isRemote&&e("Image is loaded remotely. Cannot set x,y.");var f=t.color.toArray(c),g=4*b*d.width+4*a,h=d.imageData.data;h[g]=f[0],h[g+1]=f[1],h[g+2]=f[2],h[g+3]=f[3]}function Pe(a){return a instanceof String?a:"number"==typeof a?a===(0|a)?""+a:t.nf(a,0,3):null===a||a===d?"":""+a}function Qe(a,b,c,d){var e,f;0>a.indexOf("\n")?(e=[a],f=1):(e=a.split(/\r?\n/g),f=e.length);var g=0;ac===o.TOP?g=ec+fc:ac===o.CENTER?g=ec/2-(f-1)*gc/2:ac===o.BOTTOM&&(g=-(fc+(f-1)*gc));for(var h=0;f>h;++h){var i=e[h];y.text$line(i,b,c+g,d,_b),g+=gc}}function Re(a,b,d,e,f,g){if(0!==a.length&&0!==e&&0!==f&&!(dc>f)){for(var h=-1,i=0,j=0,k=[],l=0,m=a.length;m>l;l++){var n=a[l],p=" "===n,q=hc.measureTextWidth(n);if("\n"!==n&&e>=j+q)p&&(h=l),j+=q;else{if(h+1===i){if(!(l>0))return;h=l}"\n"===n?(k.push({text:a.substring(i,l),width:j}),i=l+1):(k.push({text:a.substring(i,h+1),width:j}),i=h+1),j=0,l=i-1}}m>i&&k.push({text:a.substring(i),width:j});var r=1,s=ec;_b===o.CENTER?r=e/2:_b===o.RIGHT&&(r=e);var t=k.length,u=c.min(t,c.floor(f/gc));ac===o.TOP?s=ec+fc:ac===o.CENTER?s=f/2-gc*(u/2-1):ac===o.BOTTOM&&(s=fc+gc);var v,w,x;for(v=0;t>v&&(x=v*gc,!(s+x>f-fc));v++)w=k[v],y.text$line(w.text,b+r,d+s+x,g,_b)}}function Se(a){y="3D"===a?new zd:"2D"===a?new yd:new Ad;for(var b in Ad.prototype)Ad.prototype.hasOwnProperty(b)&&0>b.indexOf("$")&&(t[b]=y[b]);y.$init()}function Te(a){return function(){return Se("2D"),y[a].apply(this,arguments)}}function Ue(b){var d=b,e=0,f=0;if(t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,d.offsetParent)do e+=d.offsetLeft,f+=d.offsetTop;while(d=d.offsetParent);d=b;do e-=d.scrollLeft||0,f-=d.scrollTop||0;while(d=d.parentNode);return e+=qc,f+=rc,e+=sc,f+=tc,e+=a.pageXOffset,f+=a.pageYOffset,{X:e,Y:f}}function Ve(a,b){var c=Ue(a,b);t.mouseX=b.pageX-c.X,t.mouseY=b.pageY-c.Y}function We(a){var c,b=Ue(a.changedTouches[0].target,a.changedTouches[0]);for(c=0;a.touches.length>c;c++){var d=a.touches[c];d.offsetX=d.pageX-b.X,d.offsetY=d.pageY-b.Y}for(c=0;a.targetTouches.length>c;c++){var e=a.targetTouches[c];e.offsetX=e.pageX-b.X,e.offsetY=e.pageY-b.Y}for(c=0;a.changedTouches.length>c;c++){var f=a.changedTouches[c];f.offsetX=f.pageX-b.X,f.offsetY=f.pageY-b.Y}return a}function Ye(a){var b=a.which||a.keyCode;switch(b){case 13:return 10;case 91:case 93:case 224:return 157;case 57392:return 17;case 46:return 127;case 45:return 155}return b}function Ze(a){var b=a.which||a.keyCode,c=a.shiftKey||a.ctrlKey||a.altKey||a.metaKey;switch(b){case 13:b=c?13:10;break;case 8:b=c?127:8}return new Cd(b)}function $e(a){return"function"==typeof a.preventDefault?a.preventDefault():"function"==typeof a.stopPropagation&&a.stopPropagation(),!1}function _e(){var a;for(a in nc)if(nc.hasOwnProperty(a))return t.__keyPressed=!0,void 0;t.__keyPressed=!1}function af(){t.__keyPressed=!1,nc=[],oc=null}function bf(a,b){nc[a]=b,oc=null,t.key=b,t.keyCode=a,t.keyPressed(),t.keyCode=0,t.keyTyped(),_e()}function cf(a){var b=Ye(a);if(b===o.DELETE)return bf(b,new Cd(127)),void 0;if(0>pc.indexOf(b))return oc=b,void 0;var c=new Cd(o.CODED);return t.key=c,t.keyCode=b,nc[b]=c,t.keyPressed(),oc=null,_e(),$e(a)}function df(a){if(null!==oc){var b=oc,c=Ze(a);return bf(b,c),$e(a)}}function ef(a){var b=Ye(a),c=nc[b];
c!==d&&(t.key=c,t.keyCode=b,t.keyReleased(),delete nc[b],_e())}this instanceof H||e("called Processing constructor as if it were a function: missing 'new'.");var j,r=g===d&&i===d;j=r?b.createElement("canvas"):"string"==typeof g?b.getElementById(g):g,"getContext"in j||e("called Processing constructor without passing canvas element reference or id.");var t=this;t.externals={canvas:j,context:d,sketch:d},t.name="Processing.js Instance",t.use3DContext=!1,t.focused=!1,t.breakShape=!1,t.glyphTable={},t.pmouseX=0,t.pmouseY=0,t.mouseX=0,t.mouseY=0,t.mouseButton=0,t.mouseScroll=0,t.mouseClicked=d,t.mouseDragged=d,t.mouseMoved=d,t.mousePressed=d,t.mouseReleased=d,t.mouseScrolled=d,t.mouseOver=d,t.mouseOut=d,t.touchStart=d,t.touchEnd=d,t.touchMove=d,t.touchCancel=d,t.key=d,t.keyCode=d,t.keyPressed=f,t.keyReleased=f,t.keyTyped=f,t.draw=d,t.setup=d,t.__mousePressed=!1,t.__keyPressed=!1,t.__frameRate=60,t.frameCount=0,t.width=b.width,t.height=b.height;var v,x,y,wb,xb,yb,zb,Ab,Bb,Cb,Eb,Fb,Gb,Hb,Ib,Jb,Kb,Lb,Mb,Nb,Ob,Pb,Qb,Rb,Sb,Tb,Ub,Yb,Zb,$b,ic,lc,qc,rc,sc,tc,z=!0,B=[1,1,1,1],C=4294967295,F=!0,I=!0,J=[0,0,0,1],K=4278190080,L=!0,M=1,N=!1,O=!1,P=!0,Q=0,R=o.CORNER,S=o.CENTER,T=0,U=0,V=0,W=o.NORMAL_MODE_AUTO,X=60,Y=1e3/X,Z=o.ARROW,$=j.style.cursor,_=o.POLYGON,bb=[],cb=0,db=20,eb=!1,fb=-3355444,gb=20,hb=255,ib=255,jb=255,kb=255,nb=0,ob=0,pb=o.RGB,qb=null,rb=null,tb=Date.now(),ub=tb,vb=0,Db={attributes:{},locations:{}},Vb={width:0,height:0},Wb=o.IMAGE,Xb=!1,_b=o.LEFT,ac=o.BASELINE,bc=o.MODEL,cc="Arial",dc=12,ec=9,fc=2,gc=14,hc=G.get(cc,dc),jc=null,kc=!1,mc=1e3,nc=[],oc=null,pc=[o.SHIFT,o.CONTROL,o.ALT,o.CAPSLK,o.PGUP,o.PGDN,o.END,o.HOME,o.LEFT,o.UP,o.RIGHT,o.DOWN,o.NUMLK,o.INSERT,o.F1,o.F2,o.F3,o.F4,o.F5,o.F6,o.F7,o.F8,o.F9,o.F10,o.F11,o.F12,o.META];b.defaultView&&b.defaultView.getComputedStyle&&(qc=parseInt(b.defaultView.getComputedStyle(j,null).paddingLeft,10)||0,rc=parseInt(b.defaultView.getComputedStyle(j,null).paddingTop,10)||0,sc=parseInt(b.defaultView.getComputedStyle(j,null).borderLeftWidth,10)||0,tc=parseInt(b.defaultView.getComputedStyle(j,null).borderTopWidth,10)||0);var Cc,Ec,Fc,Gc,Hc,Ic,Jc,Kc,Lc,uc=0,vc=0,wc=0,xc=[],yc=[],zc=[],Ac=new k(o.SINCOS_LENGTH),Bc=new k(o.SINCOS_LENGTH),Mc=!1,Nc=!1,Oc=60*(c.PI/180),Pc=t.width/2,Qc=t.height/2,Rc=Qc/c.tan(Oc/2),Sc=Rc/10,Tc=10*Rc,Uc=t.width/t.height,Vc=[],Wc=[],Xc=0,Yc=!1,Zc=!1,$c=!0,_c=o.CORNER,ad=[],bd=new k([.5,.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,-.5,-.5,.5,.5,-.5,.5,.5,.5,.5,.5,.5,-.5,.5,.5,.5,.5,-.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,.5,-.5,.5,-.5,-.5,.5,-.5,.5,-.5,-.5,.5,-.5,-.5,.5,-.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5,-.5,.5,-.5,-.5,-.5,-.5,.5,.5,.5,.5,.5,-.5,-.5,.5,-.5,-.5,.5,-.5,-.5,.5,.5,.5,.5,.5]),cd=new k([.5,.5,.5,.5,-.5,.5,.5,.5,-.5,.5,-.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,.5,.5,-.5,-.5,.5,.5,.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,-.5,-.5,.5,-.5,-.5,.5,.5,-.5,.5,.5,.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,.5,.5,-.5,.5]),dd=new k([0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0]),ed=new k([0,0,0,0,1,0,1,1,0,1,0,0]),fd=new k([0,0,1,0,0,1,0,0,1,0,0,1]),gd="varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec4 aColor;uniform mat4 uView;uniform mat4 uProjection;uniform float uPointSize;void main(void) { vFrontColor = aColor; gl_PointSize = uPointSize; gl_Position = uProjection * uView * vec4(aVertex, 1.0);}",hd="#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform bool uSmooth;void main(void){ if(uSmooth == true){ float dist = distance(gl_PointCoord, vec2(0.5)); if(dist > 0.5){ discard; } } gl_FragColor = vFrontColor;}",id="varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec2 aTextureCoord;uniform vec4 uColor;uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection;uniform float uPointSize;varying vec2 vTextureCoord;void main(void) { gl_PointSize = uPointSize; vFrontColor = uColor; gl_Position = uProjection * uView * uModel * vec4(aVertex, 1.0); vTextureCoord = aTextureCoord;}",jd="#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;varying vec2 vTextureCoord;uniform sampler2D uSampler;uniform int uIsDrawingText;uniform bool uSmooth;void main(void){ if(uSmooth == true){ float dist = distance(gl_PointCoord, vec2(0.5)); if(dist > 0.5){ discard; } } if(uIsDrawingText == 1){ float alpha = texture2D(uSampler, vTextureCoord).a; gl_FragColor = vec4(vFrontColor.rgb * alpha, alpha); } else{ gl_FragColor = vFrontColor; }}",kd=/Windows/.test(navigator.userAgent),ld="varying vec4 vFrontColor;attribute vec3 aVertex;attribute vec3 aNormal;attribute vec4 aColor;attribute vec2 aTexture;varying vec2 vTexture;uniform vec4 uColor;uniform bool uUsingMat;uniform vec3 uSpecular;uniform vec3 uMaterialEmissive;uniform vec3 uMaterialAmbient;uniform vec3 uMaterialSpecular;uniform float uShininess;uniform mat4 uModel;uniform mat4 uView;uniform mat4 uProjection;uniform mat4 uNormalTransform;uniform int uLightCount;uniform vec3 uFalloff;struct Light { int type; vec3 color; vec3 position; vec3 direction; float angle; vec3 halfVector; float concentration;};uniform Light uLights0;uniform Light uLights1;uniform Light uLights2;uniform Light uLights3;uniform Light uLights4;uniform Light uLights5;uniform Light uLights6;uniform Light uLights7;Light getLight(int index){ if(index == 0) return uLights0; if(index == 1) return uLights1; if(index == 2) return uLights2; if(index == 3) return uLights3; if(index == 4) return uLights4; if(index == 5) return uLights5; if(index == 6) return uLights6; return uLights7;}void AmbientLight( inout vec3 totalAmbient, in vec3 ecPos, in Light light ) { float d = length( light.position - ecPos ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d )); totalAmbient += light.color * attenuation;}void DirectionalLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerFactor = 0.0; float nDotVP = max(0.0, dot( vertNormal, normalize(-light.position) )); float nDotVH = max(0.0, dot( vertNormal, normalize(-light.position-normalize(ecPos) ))); if( nDotVP != 0.0 ){ powerFactor = pow( nDotVH, uShininess ); } col += light.color * nDotVP; spec += uSpecular * powerFactor;}void PointLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float powerFactor; vec3 VP = light.position - ecPos; float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d )); float nDotVP = max( 0.0, dot( vertNormal, VP )); vec3 halfVector = normalize( VP - normalize(ecPos) ); float nDotHV = max( 0.0, dot( vertNormal, halfVector )); if( nDotVP == 0.0 ) { powerFactor = 0.0; } else { powerFactor = pow( nDotHV, uShininess ); } spec += uSpecular * powerFactor * attenuation; col += light.color * nDotVP * attenuation;}void SpotLight( inout vec3 col, inout vec3 spec, in vec3 vertNormal, in vec3 ecPos, in Light light ) { float spotAttenuation; float powerFactor = 0.0; vec3 VP = light.position - ecPos; vec3 ldir = normalize( -light.direction ); float d = length( VP ); VP = normalize( VP ); float attenuation = 1.0 / ( uFalloff[0] + ( uFalloff[1] * d ) + ( uFalloff[2] * d * d ) ); float spotDot = dot( VP, ldir );"+(kd?" spotAttenuation = 1.0; ":" if( spotDot > cos( light.angle ) ) { spotAttenuation = pow( spotDot, light.concentration ); } else{ spotAttenuation = 0.0; } attenuation *= spotAttenuation;")+" float nDotVP = max( 0.0, dot( vertNormal, VP ) );"+" vec3 halfVector = normalize( VP - normalize(ecPos) );"+" float nDotHV = max( 0.0, dot( vertNormal, halfVector ) );"+" if( nDotVP != 0.0 ) {"+" powerFactor = 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 );"+"}",md="#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; }}",sd=function(a,b,c){var d=a.createShader(a.VERTEX_SHADER);a.shaderSource(d,b),a.compileShader(d),a.getShaderParameter(d,a.COMPILE_STATUS)||e(a.getShaderInfoLog(d));var f=a.createShader(a.FRAGMENT_SHADER);a.shaderSource(f,c),a.compileShader(f),a.getShaderParameter(f,a.COMPILE_STATUS)||e(a.getShaderInfoLog(f));var g=a.createProgram();return a.attachShader(g,d),a.attachShader(g,f),a.linkProgram(g),a.getProgramParameter(g,a.LINK_STATUS)||e("Error linking shaders."),g},td=function(a,b,c,d){return{x:a,y:b,w:c,h:d}},ud=td,vd=function(a,b,c,d,e){return{x:a,y:b,w:e?c:c-a,h:e?d:d-b}},wd=function(a,b,c,d){return{x:a-c/2,y:b-d/2,w:c,h:d}},xd=function(){},yd=function(){},zd=function(){},Ad=function(){};yd.prototype=new xd,yd.prototype.constructor=yd,zd.prototype=new xd,zd.prototype.constructor=zd,Ad.prototype=new xd,Ad.prototype.constructor=Ad,xd.prototype.a3DOnlyFunction=f;var Bd={},Cd=t.Character=function(a){return this.code="string"==typeof a&&1===a.length?a.charCodeAt(0):"number"==typeof a?a:a instanceof Cd?a:0/0,Bd[this.code]===d?Bd[this.code]=this:Bd[this.code]};Cd.prototype.toString=function(){return String.fromCharCode(this.code)},Cd.prototype.valueOf=function(){return this.code};var Dd=t.PShape=function(a){this.family=a||o.GROUP,this.visible=!0,this.style=!0,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};Dd.prototype={isVisible:function(){return this.visible},setVisible:function(a){this.visible=a},disableStyle:function(){this.style=!1;for(var a=0,b=this.children.length;b>a;a++)this.children[a].disableStyle()},enableStyle:function(){this.style=!0;for(var a=0,b=this.children.length;b>a;a++)this.children[a].enableStyle()},getFamily:function(){return this.family},getWidth:function(){return this.width},getHeight:function(){return this.height},setName:function(a){this.name=a},getName:function(){return this.name},draw:function(a){a=a||t,this.visible&&(this.pre(a),this.drawImpl(a),this.post(a))},drawImpl:function(a){this.family===o.GROUP?this.drawGroup(a):this.family===o.PRIMITIVE?this.drawPrimitive(a):this.family===o.GEOMETRY?this.drawGeometry(a):this.family===o.PATH&&this.drawPath(a)},drawPath:function(a){var b,c;if(0!==this.vertices.length){if(a.beginShape(),0===this.vertexCodes.length)if(2===this.vertices[0].length)for(b=0,c=this.vertices.length;c>b;b++)a.vertex(this.vertices[b][0],this.vertices[b][1]);else for(b=0,c=this.vertices.length;c>b;b++)a.vertex(this.vertices[b][0],this.vertices[b][1],this.vertices[b][2]);else{var d=0;if(2===this.vertices[0].length)for(b=0,c=this.vertexCodes.length;c>b;b++)this.vertexCodes[b]===o.VERTEX?(a.vertex(this.vertices[d][0],this.vertices[d][1],this.vertices[d].moveTo),a.breakShape=!1,d++):this.vertexCodes[b]===o.BEZIER_VERTEX?(a.bezierVertex(this.vertices[d+0][0],this.vertices[d+0][1],this.vertices[d+1][0],this.vertices[d+1][1],this.vertices[d+2][0],this.vertices[d+2][1]),d+=3):this.vertexCodes[b]===o.CURVE_VERTEX?(a.curveVertex(this.vertices[d][0],this.vertices[d][1]),d++):this.vertexCodes[b]===o.BREAK&&(a.breakShape=!0);else for(b=0,c=this.vertexCodes.length;c>b;b++)this.vertexCodes[b]===o.VERTEX?(a.vertex(this.vertices[d][0],this.vertices[d][1],this.vertices[d][2]),this.vertices[d].moveTo===!0?Vc[Vc.length-1].moveTo=!0:this.vertices[d].moveTo===!1&&(Vc[Vc.length-1].moveTo=!1),a.breakShape=!1):this.vertexCodes[b]===o.BEZIER_VERTEX?(a.bezierVertex(this.vertices[d+0][0],this.vertices[d+0][1],this.vertices[d+0][2],this.vertices[d+1][0],this.vertices[d+1][1],this.vertices[d+1][2],this.vertices[d+2][0],this.vertices[d+2][1],this.vertices[d+2][2]),d+=3):this.vertexCodes[b]===o.CURVE_VERTEX?(a.curveVertex(this.vertices[d][0],this.vertices[d][1],this.vertices[d][2]),d++):this.vertexCodes[b]===o.BREAK&&(a.breakShape=!0)}a.endShape(this.close?o.CLOSE:o.OPEN)}},drawGeometry:function(a){var b,c;if(a.beginShape(this.kind),this.style)for(b=0,c=this.vertices.length;c>b;b++)a.vertex(this.vertices[b]);else for(b=0,c=this.vertices.length;c>b;b++){var d=this.vertices[b];0===d[2]?a.vertex(d[0],d[1]):a.vertex(d[0],d[1],d[2])}a.endShape()},drawGroup:function(a){for(var b=0,c=this.children.length;c>b;b++)this.children[b].draw(a)},drawPrimitive:function(a){if(this.kind===o.POINT)a.point(this.params[0],this.params[1]);else if(this.kind===o.LINE)4===this.params.length?a.line(this.params[0],this.params[1],this.params[2],this.params[3]):a.line(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]);else if(this.kind===o.TRIANGLE)a.triangle(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]);else if(this.kind===o.QUAD)a.quad(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5],this.params[6],this.params[7]);else if(this.kind===o.RECT)if(null!==this.image){var b=ud;a.imageMode(o.CORNER),a.image(this.image,this.params[0],this.params[1],this.params[2],this.params[3]),ud=b}else{var c=R;a.rectMode(o.CORNER),a.rect(this.params[0],this.params[1],this.params[2],this.params[3]),R=c}else if(this.kind===o.ELLIPSE){var d=S;a.ellipseMode(o.CORNER),a.ellipse(this.params[0],this.params[1],this.params[2],this.params[3]),S=d}else if(this.kind===o.ARC){var e=S;a.ellipseMode(o.CORNER),a.arc(this.params[0],this.params[1],this.params[2],this.params[3],this.params[4],this.params[5]),S=e}else this.kind===o.BOX?1===this.params.length?a.box(this.params[0]):a.box(this.params[0],this.params[1],this.params[2]):this.kind===o.SPHERE&&a.sphere(this.params[0])},pre:function(a){this.matrix&&(a.pushMatrix(),a.transform(this.matrix)),this.style&&(a.pushStyle(),this.styles(a))},post:function(a){this.matrix&&a.popMatrix(),this.style&&a.popStyle()},styles:function(a){this.stroke?(a.stroke(this.strokeColor),a.strokeWeight(this.strokeWeight),a.strokeCap(this.strokeCap),a.strokeJoin(this.strokeJoin)):a.noStroke(),this.fill?a.fill(this.fillColor):a.noFill()},getChild:function(a){var b,c;if("number"==typeof a)return this.children[a];var d;if(""===a||this.name===a)return this;if(this.nameTable.length>0){for(b=0,c=this.nameTable.length;c>b||d;b++)if(this.nameTable[b].getName===a){d=this.nameTable[b];break}if(d)return d}for(b=0,c=this.children.length;c>b;b++)if(d=this.children[b].getChild(a))return d;return null},getChildCount:function(){return this.children.length},addChild:function(a){this.children.push(a),a.parent=this,null!==a.getName()&&this.addName(a.getName(),a)},addName:function(a,b){null!==this.parent?this.parent.addName(a,b):this.nameTable.push([a,b])},translate:function(){2===arguments.length?(this.checkMatrix(2),this.matrix.translate(arguments[0],arguments[1])):(this.checkMatrix(3),this.matrix.translate(arguments[0],arguments[1],0))},checkMatrix:function(a){null===this.matrix?this.matrix=2===a?new t.PMatrix2D:new t.PMatrix3D:3===a&&this.matrix instanceof t.PMatrix2D&&(this.matrix=new t.PMatrix3D)},rotateX:function(a){this.rotate(a,1,0,0)},rotateY:function(a){this.rotate(a,0,1,0)},rotateZ:function(a){this.rotate(a,0,0,1)},rotate:function(){1===arguments.length?(this.checkMatrix(2),this.matrix.rotate(arguments[0])):(this.checkMatrix(3),this.matrix.rotate(arguments[0],arguments[1],arguments[2],arguments[3]))},scale:function(){2===arguments.length?(this.checkMatrix(2),this.matrix.scale(arguments[0],arguments[1])):3===arguments.length?(this.checkMatrix(2),this.matrix.scale(arguments[0],arguments[1],arguments[2])):(this.checkMatrix(2),this.matrix.scale(arguments[0]))},resetMatrix:function(){this.checkMatrix(2),this.matrix.reset()},applyMatrix:function(a){1===arguments.length?this.applyMatrix(a.elements[0],a.elements[1],0,a.elements[2],a.elements[3],a.elements[4],0,a.elements[5],0,0,1,0,0,0,0,1):6===arguments.length?(this.checkMatrix(2),this.matrix.apply(arguments[0],arguments[1],arguments[2],0,arguments[3],arguments[4],arguments[5],0,0,0,1,0,0,0,0,1)):16===arguments.length&&(this.checkMatrix(3),this.matrix.apply(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11],arguments[12],arguments[13],arguments[14],arguments[15]))}};var Ed=t.PShapeSVG=function(){t.PShape.call(this),1===arguments.length?(this.element=arguments[0],this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=o.ALPHA_MASK,this.strokeWeight=1,this.strokeCap=o.SQUARE,this.strokeJoin=o.MITER,this.strokeGradient=null,this.strokeGradientPaint=null,this.strokeName=null,this.strokeOpacity=1,this.fill=!0,this.fillColor=o.ALPHA_MASK,this.fillGradient=null,this.fillGradientPaint=null,this.fillName=null,this.fillOpacity=1,"svg"!==this.element.getName()&&e("root is not <svg>, it's <"+this.element.getName()+">")):2===arguments.length&&("string"==typeof arguments[1]?arguments[1].indexOf(".svg")>-1&&(this.element=new t.XMLElement(t,arguments[1]),this.vertexCodes=[],this.vertices=[],this.opacity=1,this.stroke=!1,this.strokeColor=o.ALPHA_MASK,this.strokeWeight=1,this.strokeCap=o.SQUARE,this.strokeJoin=o.MITER,this.strokeGradient="",this.strokeGradientPaint="",this.strokeName="",this.strokeOpacity=1,this.fill=!0,this.fillColor=o.ALPHA_MASK,this.fillGradient=null,this.fillGradientPaint=null,this.fillOpacity=1):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 a=this.element.getStringAttribute("display","inline");this.visible="none"!==a;var b=this.element.getAttribute("transform");b&&(this.matrix=this.parseMatrix(b));var c=this.element.getStringAttribute("viewBox");if(null!==c){var d=c.split(" ");this.width=d[2],this.height=d[3]}var f=this.element.getStringAttribute("width"),g=this.element.getStringAttribute("height");null!==f?(this.width=this.parseUnitSize(f),this.height=this.parseUnitSize(g)):(0===this.width||0===this.height)&&(this.width=1,this.height=1,e("The width and/or height is not readable in the <svg> tag of this file.")),this.parseColors(this.element),this.parseChildren(this.element)};Ed.prototype=new Dd,Ed.prototype.parseMatrix=function(){function a(a){var b=[];return a.replace(/\((.*?)\)/,function(){return function(a,c){b=c.replace(/,+/g," ").split(/\s+/)}}()),b}return function(b){this.checkMatrix(2);var c=[];if(b.replace(/\s*(\w+)\((.*?)\)/g,function(a){c.push(t.trim(a))}),0===c.length)return null;for(var d=0,e=c.length;e>d;d++){var f=a(c[d]);if(-1!==c[d].indexOf("matrix"))this.matrix.set(f[0],f[2],f[4],f[1],f[3],f[5]);else if(-1!==c[d].indexOf("translate")){var g=f[0],h=2===f.length?f[1]:0;this.matrix.translate(g,h)}else if(-1!==c[d].indexOf("scale")){var i=f[0],j=2===f.length?f[1]:f[0];this.matrix.scale(i,j)}else if(-1!==c[d].indexOf("rotate")){var k=f[0];1===f.length?this.matrix.rotate(t.radians(k)):3===f.length&&(this.matrix.translate(f[1],f[2]),this.matrix.rotate(t.radians(f[0])),this.matrix.translate(-f[1],-f[2]))}else-1!==c[d].indexOf("skewX")?this.matrix.skewX(parseFloat(f[0])):-1!==c[d].indexOf("skewY")?this.matrix.skewY(f[0]):-1!==c[d].indexOf("shearX")?this.matrix.shearX(f[0]):-1!==c[d].indexOf("shearY")&&this.matrix.shearY(f[0])}return this.matrix}}(),Ed.prototype.parseChildren=function(a){var d,e,b=a.getChildren(),c=new t.PShape;for(d=0,e=b.length;e>d;d++){var f=this.parseChild(b[d]);f&&c.addChild(f)}for(d=0,e=c.children.length;e>d;d++)this.children.push(c.children[d])},Ed.prototype.getName=function(){return this.name},Ed.prototype.parseChild=function(a){var c,b=a.getName();return"g"===b?c=new Ed(this,a):"defs"===b?c=new Ed(this,a):"line"===b?(c=new Ed(this,a),c.parseLine()):"circle"===b?(c=new Ed(this,a),c.parseEllipse(!0)):"ellipse"===b?(c=new Ed(this,a),c.parseEllipse(!1)):"rect"===b?(c=new Ed(this,a),c.parseRect()):"polygon"===b?(c=new Ed(this,a),c.parsePoly(!0)):"polyline"===b?(c=new Ed(this,a),c.parsePoly(!1)):"path"===b?(c=new Ed(this,a),c.parsePath()):"radialGradient"===b?s("PShapeSVG.prototype.parseChild, name = radialGradient"):"linearGradient"===b?s("PShapeSVG.prototype.parseChild, name = linearGradient"):"text"===b?s("PShapeSVG.prototype.parseChild, name = text"):"filter"===b?s("PShapeSVG.prototype.parseChild, name = filter"):"mask"===b?s("PShapeSVG.prototype.parseChild, name = mask"):f(),c},Ed.prototype.parsePath=function(){this.family=o.PATH,this.kind=0;var c=t.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g," "));if(null!==c){c=t.__toCharArray(c);for(var y,z,A,B,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,p=0,q=0,r=0,s=0,u=0,v="",w=[],x=!1;c.length>s;)if(u=c[s].valueOf(),u>=65&&90>=u||u>=97&&122>=u){if(A=s,s++,c.length>s)for(w=[],u=c[s].valueOf();!(u>=65&&90>=u||u>=97&&100>=u||u>=102&&122>=u)&&x===!1;)32===u?(""!==v&&(w.push(parseFloat(v)),v=""),s++):45===u?101===c[s-1].valueOf()?(v+=""+c[s],s++):(""!==v&&w.push(parseFloat(v)),v=""+c[s],s++):(v+=""+c[s],s++),s===c.length?x=!0:u=c[s].valueOf();if(""!==v&&(w.push(parseFloat(v)),v=""),z=c[A],u=z.valueOf(),77===u){if(w.length>=2&&0===w.length%2&&(d=w[0],e=w[1],this.parsePathMoveto(d,e),w.length>2))for(A=2,B=w.length;B>A;A+=2)d=w[A],e=w[A+1],this.parsePathLineto(d,e)}else if(109===u){if(w.length>=2&&0===w.length%2&&(d+=w[0],e+=w[1],this.parsePathMoveto(d,e),w.length>2))for(A=2,B=w.length;B>A;A+=2)d+=w[A],e+=w[A+1],this.parsePathLineto(d,e)}else if(76===u){if(w.length>=2&&0===w.length%2)for(A=0,B=w.length;B>A;A+=2)d=w[A],e=w[A+1],this.parsePathLineto(d,e)}else if(108===u){if(w.length>=2&&0===w.length%2)for(A=0,B=w.length;B>A;A+=2)d+=w[A],e+=w[A+1],this.parsePathLineto(d,e)}else if(72===u)for(A=0,B=w.length;B>A;A++)d=w[A],this.parsePathLineto(d,e);else if(104===u)for(A=0,B=w.length;B>A;A++)d+=w[A],this.parsePathLineto(d,e);else if(86===u)for(A=0,B=w.length;B>A;A++)e=w[A],this.parsePathLineto(d,e);else if(118===u)for(A=0,B=w.length;B>A;A++)e+=w[A],this.parsePathLineto(d,e);else if(67===u){if(w.length>=6&&0===w.length%6)for(A=0,B=w.length;B>A;A+=6)h=w[A],j=w[A+1],i=w[A+2],k=w[A+3],l=w[A+4],m=w[A+5],this.parsePathCurveto(h,j,i,k,l,m),d=l,e=m}else if(99===u){if(w.length>=6&&0===w.length%6)for(A=0,B=w.length;B>A;A+=6)h=d+w[A],j=e+w[A+1],i=d+w[A+2],k=e+w[A+3],l=d+w[A+4],m=e+w[A+5],this.parsePathCurveto(h,j,i,k,l,m),d=l,e=m}else if(83===u){if(w.length>=4&&0===w.length%4)for(A=0,B=w.length;B>A;A+=4)"c"===y.toLowerCase()||"s"===y.toLowerCase()?(n=this.vertices[this.vertices.length-2][0],p=this.vertices[this.vertices.length-2][1],q=this.vertices[this.vertices.length-1][0],r=this.vertices[this.vertices.length-1][1],h=q+(q-n),j=r+(r-p)):(h=this.vertices[this.vertices.length-1][0],j=this.vertices[this.vertices.length-1][1]),i=w[A],k=w[A+1],l=w[A+2],m=w[A+3],this.parsePathCurveto(h,j,i,k,l,m),d=l,e=m}else if(115===u){if(w.length>=4&&0===w.length%4)for(A=0,B=w.length;B>A;A+=4)"c"===y.toLowerCase()||"s"===y.toLowerCase()?(n=this.vertices[this.vertices.length-2][0],p=this.vertices[this.vertices.length-2][1],q=this.vertices[this.vertices.length-1][0],r=this.vertices[this.vertices.length-1][1],h=q+(q-n),j=r+(r-p)):(h=this.vertices[this.vertices.length-1][0],j=this.vertices[this.vertices.length-1][1]),i=d+w[A],k=e+w[A+1],l=d+w[A+2],m=e+w[A+3],this.parsePathCurveto(h,j,i,k,l,m),d=l,e=m}else if(81===u){if(w.length>=4&&0===w.length%4)for(A=0,B=w.length;B>A;A+=4)f=w[A],g=w[A+1],l=w[A+2],m=w[A+3],this.parsePathQuadto(d,e,f,g,l,m),d=l,e=m}else if(113===u){if(w.length>=4&&0===w.length%4)for(A=0,B=w.length;B>A;A+=4)f=d+w[A],g=e+w[A+1],l=d+w[A+2],m=e+w[A+3],this.parsePathQuadto(d,e,f,g,l,m),d=l,e=m}else if(84===u){if(w.length>=2&&0===w.length%2)for(A=0,B=w.length;B>A;A+=2)"q"===y.toLowerCase()||"t"===y.toLowerCase()?(n=this.vertices[this.vertices.length-2][0],p=this.vertices[this.vertices.length-2][1],q=this.vertices[this.vertices.length-1][0],r=this.vertices[this.vertices.length-1][1],f=q+(q-n),g=r+(r-p)):(f=d,g=e),l=w[A],m=w[A+1],this.parsePathQuadto(d,e,f,g,l,m),d=l,e=m}else if(116===u){if(w.length>=2&&0===w.length%2)for(A=0,B=w.length;B>A;A+=2)"q"===y.toLowerCase()||"t"===y.toLowerCase()?(n=this.vertices[this.vertices.length-2][0],p=this.vertices[this.vertices.length-2][1],q=this.vertices[this.vertices.length-1][0],r=this.vertices[this.vertices.length-1][1],f=q+(q-n),g=r+(r-p)):(f=d,g=e),l=d+w[A],m=e+w[A+1],this.parsePathQuadto(d,e,f,g,l,m),d=l,e=m}else(90===u||122===u)&&(this.close=!0);y=""+z}else s++}},Ed.prototype.parsePathQuadto=function(a,b,c,d,f,g){this.vertices.length>0?(this.parsePathCode(o.BEZIER_VERTEX),this.parsePathVertex(a+2*(c-a)/3,b+2*(d-b)/3),this.parsePathVertex(f+2*(c-f)/3,g+2*(d-g)/3),this.parsePathVertex(f,g)):e("Path must start with M/m")},Ed.prototype.parsePathCurveto=function(a,b,c,d,f,g){this.vertices.length>0?(this.parsePathCode(o.BEZIER_VERTEX),this.parsePathVertex(a,b),this.parsePathVertex(c,d),this.parsePathVertex(f,g)):e("Path must start with M/m")},Ed.prototype.parsePathLineto=function(a,b){this.vertices.length>0?(this.parsePathCode(o.VERTEX),this.parsePathVertex(a,b),this.vertices[this.vertices.length-1].moveTo=!1):e("Path must start with M/m")},Ed.prototype.parsePathMoveto=function(a,b){this.vertices.length>0&&this.parsePathCode(o.BREAK),this.parsePathCode(o.VERTEX),this.parsePathVertex(a,b),this.vertices[this.vertices.length-1].moveTo=!0},Ed.prototype.parsePathVertex=function(a,b){var c=[];c[0]=a,c[1]=b,this.vertices.push(c)},Ed.prototype.parsePathCode=function(a){this.vertexCodes.push(a)},Ed.prototype.parsePoly=function(a){this.family=o.PATH,this.close=a;var b=t.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g," "));if(null!==b){var c=b.split(" ");if(0===c.length%2)for(var d=0,f=c.length;f>d;d++){var g=[];g[0]=c[d],g[1]=c[++d],this.vertices.push(g)}else e("Error parsing polygon points: odd number of coordinates provided")}},Ed.prototype.parseRect=function(){this.kind=o.RECT,this.family=o.PRIMITIVE,this.params=[],this.params[0]=this.element.getFloatAttribute("x"),this.params[1]=this.element.getFloatAttribute("y"),this.params[2]=this.element.getFloatAttribute("width"),this.params[3]=this.element.getFloatAttribute("height"),(0>this.params[2]||0>this.params[3])&&e("svg error: negative width or height found while parsing <rect>")},Ed.prototype.parseEllipse=function(a){this.kind=o.ELLIPSE,this.family=o.PRIMITIVE,this.params=[],this.params[0]=0|this.element.getFloatAttribute("cx"),this.params[1]=0|this.element.getFloatAttribute("cy");var b,c;a?(b=c=this.element.getFloatAttribute("r"),0>b&&e("svg error: negative radius found while parsing <circle>")):(b=this.element.getFloatAttribute("rx"),c=this.element.getFloatAttribute("ry"),(0>b||0>c)&&e("svg error: negative x-axis radius or y-axis radius found while parsing <ellipse>")),this.params[0]-=b,this.params[1]-=c,this.params[2]=2*b,this.params[3]=2*c},Ed.prototype.parseLine=function(){this.kind=o.LINE,this.family=o.PRIMITIVE,this.params=[],this.params[0]=this.element.getFloatAttribute("x1"),this.params[1]=this.element.getFloatAttribute("y1"),this.params[2]=this.element.getFloatAttribute("x2"),this.params[3]=this.element.getFloatAttribute("y2")},Ed.prototype.parseColors=function(a){if(a.hasAttribute("opacity")&&this.setOpacity(a.getAttribute("opacity")),a.hasAttribute("stroke")&&this.setStroke(a.getAttribute("stroke")),a.hasAttribute("stroke-width")&&this.setStrokeWeight(a.getAttribute("stroke-width")),a.hasAttribute("stroke-linejoin")&&this.setStrokeJoin(a.getAttribute("stroke-linejoin")),a.hasAttribute("stroke-linecap")&&this.setStrokeCap(a.getStringAttribute("stroke-linecap")),a.hasAttribute("fill")&&this.setFill(a.getStringAttribute("fill")),a.hasAttribute("style"))for(var b=a.getStringAttribute("style"),c=(""+b).split(";"),d=0,e=c.length;e>d;d++){var f=t.trim(c[d].split(":"));"fill"===f[0]?this.setFill(f[1]):"fill-opacity"===f[0]?this.setFillOpacity(f[1]):"stroke"===f[0]?this.setStroke(f[1]):"stroke-width"===f[0]?this.setStrokeWeight(f[1]):"stroke-linecap"===f[0]?this.setStrokeCap(f[1]):"stroke-linejoin"===f[0]?this.setStrokeJoin(f[1]):"stroke-opacity"===f[0]?this.setStrokeOpacity(f[1]):"opacity"===f[0]&&this.setOpacity(f[1])}},Ed.prototype.setFillOpacity=function(a){this.fillOpacity=parseFloat(a),this.fillColor=255*this.fillOpacity<<24|16777215&this.fillColor},Ed.prototype.setFill=function(a){var b=4278190080&this.fillColor;"none"===a?this.fill=!1:0===a.indexOf("#")?(this.fill=!0,4===a.length&&(a=a.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")),this.fillColor=b|16777215&parseInt(a.substring(1),16)):0===a.indexOf("rgb")?(this.fill=!0,this.fillColor=b|this.parseRGB(a)):0===a.indexOf("url(#")?this.fillName=a.substring(5,a.length-1):A[a]&&(this.fill=!0,this.fillColor=b|16777215&parseInt(A[a].substring(1),16))},Ed.prototype.setOpacity=function(a){this.strokeColor=255*parseFloat(a)<<24|16777215&this.strokeColor,this.fillColor=255*parseFloat(a)<<24|16777215&this.fillColor},Ed.prototype.setStroke=function(a){var b=4278190080&this.strokeColor;"none"===a?this.stroke=!1:"#"===a.charAt(0)?(this.stroke=!0,4===a.length&&(a=a.replace(/#(.)(.)(.)/,"#$1$1$2$2$3$3")),this.strokeColor=b|16777215&parseInt(a.substring(1),16)):0===a.indexOf("rgb")?(this.stroke=!0,this.strokeColor=b|this.parseRGB(a)):0===a.indexOf("url(#")?this.strokeName=a.substring(5,a.length-1):A[a]&&(this.stroke=!0,this.strokeColor=b|16777215&parseInt(A[a].substring(1),16))},Ed.prototype.setStrokeWeight=function(a){this.strokeWeight=this.parseUnitSize(a)},Ed.prototype.setStrokeJoin=function(a){"miter"===a?this.strokeJoin=o.MITER:"round"===a?this.strokeJoin=o.ROUND:"bevel"===a&&(this.strokeJoin=o.BEVEL)
},Ed.prototype.setStrokeCap=function(a){"butt"===a?this.strokeCap=o.SQUARE:"round"===a?this.strokeCap=o.ROUND:"square"===a&&(this.strokeCap=o.PROJECT)},Ed.prototype.setStrokeOpacity=function(a){this.strokeOpacity=parseFloat(a),this.strokeColor=255*this.strokeOpacity<<24|16777215&this.strokeColor},Ed.prototype.parseRGB=function(a){var b=a.substring(a.indexOf("(")+1,a.indexOf(")")),c=b.split(", ");return c[0]<<16|c[1]<<8|c[2]},Ed.prototype.parseUnitSize=function(a){var b=a.length-2;return 0>b?a:a.indexOf("pt")===b?1.25*parseFloat(a.substring(0,b)):a.indexOf("pc")===b?15*parseFloat(a.substring(0,b)):a.indexOf("mm")===b?3.543307*parseFloat(a.substring(0,b)):a.indexOf("cm")===b?35.43307*parseFloat(a.substring(0,b)):a.indexOf("in")===b?90*parseFloat(a.substring(0,b)):a.indexOf("px")===b?parseFloat(a.substring(0,b)):parseFloat(a)},t.shape=function(a,b,c,d,e){arguments.length>=1&&null!==arguments[0]&&a.isVisible()&&(t.pushMatrix(),_c===o.CENTER?5===arguments.length?(t.translate(b-d/2,c-e/2),t.scale(d/a.getWidth(),e/a.getHeight())):3===arguments.length?t.translate(b-a.getWidth()/2,-a.getHeight()/2):t.translate(-a.getWidth()/2,-a.getHeight()/2):_c===o.CORNER?5===arguments.length?(t.translate(b,c),t.scale(d/a.getWidth(),e/a.getHeight())):3===arguments.length&&t.translate(b,c):_c===o.CORNERS&&(5===arguments.length?(d-=b,e-=c,t.translate(b,c),t.scale(d/a.getWidth(),e/a.getHeight())):3===arguments.length&&t.translate(b,c)),a.draw(t),(1===arguments.length&&_c===o.CENTER||arguments.length>1)&&t.popMatrix())},t.shapeMode=function(a){_c=a},t.loadShape=function(a){return 1===arguments.length&&a.indexOf(".svg")>-1?new Ed(null,a):null};var Fd=function(a,b,c,d,e){this.fullName=a||"",this.name=b||"",this.namespace=c||"",this.value=d,this.type=e};Fd.prototype={getName:function(){return this.name},getFullName:function(){return this.fullName},getNamespace:function(){return this.namespace},getValue:function(){return this.value},getType:function(){return this.type},setValue:function(a){this.value=a}};var Gd=t.XMLElement=function(a,b,c,e){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",a&&("string"==typeof a?b===d&&a.indexOf("<")>-1?this.parse(a):(this.fullName=a,this.namespace=b,this.systemId=c,this.lineNr=e):this.parse(b))};Gd.prototype={parse:function(a){var b;try{var c=a.substring(a.length-4);(".xml"===c||".svg"===c)&&(a=h(a)),b=(new DOMParser).parseFromString(a,"text/xml");var d=b.documentElement;return d?this.parseChildrenRecursive(null,d):e("Error loading document"),this}catch(f){e(f)}},parseChildrenRecursive:function(a,b){var c,d,e,f,g,h;if(a?(c=new Gd(b.nodeName),c.parent=a):(this.fullName=b.localName,this.name=b.nodeName,c=this),3===b.nodeType&&""!==b.textContent)return this.createPCDataElement(b.textContent);if(4===b.nodeType)return this.createCDataElement(b.textContent);if(b.attributes)for(f=0,g=b.attributes.length;g>f;f++)e=b.attributes[f],d=new Fd(e.getname,e.nodeName,e.namespaceURI,e.nodeValue,e.nodeType),c.attributes.push(d);if(b.childNodes)for(f=0,g=b.childNodes.length;g>f;f++){var i=b.childNodes[f];h=c.parseChildrenRecursive(c,i),null!==h&&c.children.push(h)}return c},createElement:function(a,b,c,e){return c===d?new Gd(a,b):new Gd(a,b,c,e)},createPCDataElement:function(a){if(""===a.replace(/^\s+$/g,""))return null;var c=new Gd;return c.type="TEXT",c.content=a,c},createCDataElement:function(a){var b=this.createPCDataElement(a);if(null===b)return null;b.type="CDATA";var d,c={"<":"<",">":">","'":"'",'"':"""};for(d in c)Object.hasOwnProperty(c,d)||(a=a.replace(RegExp(d,"g"),c[d]));return b.cdata=a,b},hasAttribute:function(){return 1===arguments.length?null!==this.getAttribute(arguments[0]):2===arguments.length?null!==this.getAttribute(arguments[0],arguments[1]):void 0},equals:function(a){if(!(a instanceof Gd))return!1;var b,c;if(this.fullName!==a.fullName)return!1;if(this.attributes.length!==a.getAttributeCount())return!1;if(this.attributes.length!==a.attributes.length)return!1;var d,e,h;for(b=0,c=this.attributes.length;c>b;b++){if(d=this.attributes[b].getName(),e=this.attributes[b].getNamespace(),h=a.findAttribute(d,e),null===h)return!1;if(this.attributes[b].getValue()!==h.getValue())return!1;if(this.attributes[b].getType()!==h.getType())return!1}if(this.children.length!==a.getChildCount())return!1;if(this.children.length>0){var i,j;for(b=0,c=this.children.length;c>b;b++)if(i=this.getChild(b),j=a.getChild(b),!i.equals(j))return!1;return!0}return this.content===a.content},getContent:function(){if("TEXT"===this.type||"CDATA"===this.type)return this.content;var a=this.children;return 1!==a.length||"TEXT"!==a[0].type&&"CDATA"!==a[0].type?null:a[0].content},getAttribute:function(){var a;return 2===arguments.length?(a=this.findAttribute(arguments[0]),a?a.getValue():arguments[1]):1===arguments.length?(a=this.findAttribute(arguments[0]),a?a.getValue():null):3===arguments.length?(a=this.findAttribute(arguments[0],arguments[1]),a?a.getValue():arguments[2]):void 0},getStringAttribute:function(){return 1===arguments.length?this.getAttribute(arguments[0]):2===arguments.length?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getString:function(a){return this.getStringAttribute(a)},getFloatAttribute:function(){return 1===arguments.length?parseFloat(this.getAttribute(arguments[0],0)):2===arguments.length?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getFloat:function(a){return this.getFloatAttribute(a)},getIntAttribute:function(){return 1===arguments.length?this.getAttribute(arguments[0],0):2===arguments.length?this.getAttribute(arguments[0],arguments[1]):this.getAttribute(arguments[0],arguments[1],arguments[2])},getInt:function(a){return this.getIntAttribute(a)},hasChildren:function(){return this.children.length>0},addChild:function(a){null!==a&&(a.parent=this,this.children.push(a))},insertChild:function(a,b){if(a){if(null===a.getLocalName()&&!this.hasChildren()){var c=this.children[this.children.length-1];if(null===c.getLocalName())return c.setContent(c.getContent()+a.getContent()),void 0}a.parent=this,this.children.splice(b,0,a)}},getChild:function(a){if("number"==typeof a)return this.children[a];if(-1!==a.indexOf("/"))return this.getChildRecursive(a.split("/"),0);for(var b,c,d=0,e=this.getChildCount();e>d;d++)if(b=this.getChild(d),c=b.getName(),null!==c&&c===a)return b;return null},getChildren:function(){if(1===arguments.length){if("number"==typeof arguments[0])return this.getChild(arguments[0]);if(-1!==arguments[0].indexOf("/"))return this.getChildrenRecursive(arguments[0].split("/"),0);for(var b,c,a=[],d=0,e=this.getChildCount();e>d;d++)b=this.getChild(d),c=b.getName(),null!==c&&c===arguments[0]&&a.push(b);return a}return this.children},getChildCount:function(){return this.children.length},getChildRecursive:function(a,b){if(b===a.length)return this;for(var c,d,e=a[b],f=0,g=this.getChildCount();g>f;f++)if(c=this.getChild(f),d=c.getName(),null!==d&&d===e)return c.getChildRecursive(a,b+1);return null},getChildrenRecursive:function(a,b){if(b===a.length-1)return this.getChildren(a[b]);for(var c=this.getChildren(a[b]),d=[],e=0;c.length>e;e++)d=d.concat(c[e].getChildrenRecursive(a,b+1));return d},isLeaf:function(){return!this.hasChildren()},listChildren:function(){for(var a=[],b=0,c=this.children.length;c>b;b++)a.push(this.getChild(b).getName());return a},removeAttribute:function(a,b){this.namespace=b||"";for(var c=0,d=this.attributes.length;d>c;c++)if(this.attributes[c].getName()===a&&this.attributes[c].getNamespace()===this.namespace){this.attributes.splice(c,1);break}},removeChild:function(a){if(a)for(var b=0,c=this.children.length;c>b;b++)if(this.children[b].equals(a)){this.children.splice(b,1);break}},removeChildAtIndex:function(a){this.children.length>a&&this.children.splice(a,1)},findAttribute:function(a,b){this.namespace=b||"";for(var c=0,d=this.attributes.length;d>c;c++)if(this.attributes[c].getName()===a&&this.attributes[c].getNamespace()===this.namespace)return this.attributes[c];return null},setAttribute:function(){var a;if(3===arguments.length){var b=arguments[0].indexOf(":"),c=arguments[0].substring(b+1);a=this.findAttribute(c,arguments[1]),a?a.setValue(arguments[2]):(a=new Fd(arguments[0],c,arguments[1],arguments[2],"CDATA"),this.attributes.push(a))}else a=this.findAttribute(arguments[0]),a?a.setValue(arguments[1]):(a=new Fd(arguments[0],arguments[0],null,arguments[1],"CDATA"),this.attributes.push(a))},setString:function(a,b){this.setAttribute(a,b)},setInt:function(a,b){this.setAttribute(a,b)},setFloat:function(a,b){this.setAttribute(a,b)},setContent:function(a){this.children.length>0&&H.debug("Tried to set content for XMLElement with children"),this.content=a},setName:function(){if(1===arguments.length)this.name=arguments[0],this.fullName=arguments[0],this.namespace=null;else{var a=arguments[0].indexOf(":");this.name=null===arguments[1]||0>a?arguments[0]:arguments[0].substring(a+1),this.fullName=arguments[0],this.namespace=arguments[1]}},getName:function(){return this.fullName},getLocalName:function(){return this.name},getAttributeCount:function(){return this.attributes.length},toString:function(){if("TEXT"===this.type)return this.content;if("CDATA"===this.type)return this.cdata;var c,d,a=this.fullName,b="<"+a;for(c=0;this.attributes.length>c;c++){var e=this.attributes[c];b+=" "+e.getName()+"="+'"'+e.getValue()+'"'}if(0===this.children.length)b+=""===this.content?"/>":">"+this.content+"</"+a+">";else{for(b+=">",d=0;this.children.length>d;d++)b+=""+this.children[d];b+="</"+a+">"}return b}},Gd.parse=function(a){var b=new Gd;return b.parse(a),b};var Hd=t.XML=t.XMLElement;t.loadXML=function(a){return new Hd(t,a)};var Id=function(a){for(var b=0,d=0;a.length>d;d++)b=0!==d?c.max(b,c.abs(a[d])):c.abs(a[d]);var e=(b+"").indexOf(".");return 0===e?e=1:-1===e&&(e=(b+"").length),e},Jd=t.PMatrix2D=function(){0===arguments.length?this.reset():1===arguments.length&&arguments[0]instanceof Jd?this.set(arguments[0].array()):6===arguments.length&&this.set(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])};Jd.prototype={set:function(){if(6===arguments.length){var a=arguments;this.set([a[0],a[1],a[2],a[3],a[4],a[5]])}else 1===arguments.length&&arguments[0]instanceof Jd?this.elements=arguments[0].array():1===arguments.length&&arguments[0]instanceof Array&&(this.elements=arguments[0].slice())},get:function(){var a=new Jd;return a.set(this.elements),a},reset:function(){this.set([1,0,0,0,1,0])},array:function(){return this.elements.slice()},translate:function(a,b){this.elements[2]=a*this.elements[0]+b*this.elements[1]+this.elements[2],this.elements[5]=a*this.elements[3]+b*this.elements[4]+this.elements[5]},invTranslate:function(a,b){this.translate(-a,-b)},transpose:function(){},mult:function(a,b){var c,d;return a instanceof u?(c=a.x,d=a.y,b||(b=new u)):a instanceof Array&&(c=a[0],d=a[1],b||(b=[])),b instanceof Array?(b[0]=this.elements[0]*c+this.elements[1]*d+this.elements[2],b[1]=this.elements[3]*c+this.elements[4]*d+this.elements[5]):b instanceof u&&(b.x=this.elements[0]*c+this.elements[1]*d+this.elements[2],b.y=this.elements[3]*c+this.elements[4]*d+this.elements[5],b.z=0),b},multX:function(a,b){return a*this.elements[0]+b*this.elements[1]+this.elements[2]},multY:function(a,b){return a*this.elements[3]+b*this.elements[4]+this.elements[5]},skewX:function(a){this.apply(1,0,1,a,0,0)},skewY:function(a){this.apply(1,0,1,0,a,0)},shearX:function(a){this.apply(1,0,1,c.tan(a),0,0)},shearY:function(a){this.apply(1,0,1,0,c.tan(a),0)},determinant:function(){return this.elements[0]*this.elements[4]-this.elements[1]*this.elements[3]},invert:function(){var a=this.determinant();if(c.abs(a)>o.MIN_INT){var b=this.elements[0],d=this.elements[1],e=this.elements[2],f=this.elements[3],g=this.elements[4],h=this.elements[5];return this.elements[0]=g/a,this.elements[3]=-f/a,this.elements[1]=-d/a,this.elements[4]=b/a,this.elements[2]=(d*h-g*e)/a,this.elements[5]=(f*e-b*h)/a,!0}return!1},scale:function(a,b){a&&!b&&(b=a),a&&b&&(this.elements[0]*=a,this.elements[1]*=b,this.elements[3]*=a,this.elements[4]*=b)},invScale:function(a,b){a&&!b&&(b=a),this.scale(1/a,1/b)},apply:function(){var a;1===arguments.length&&arguments[0]instanceof Jd?a=arguments[0].array():6===arguments.length?a=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,this.elements[2],0,0,this.elements[5]],c=0,d=0;2>d;d++)for(var e=0;3>e;e++,c++)b[c]+=this.elements[3*d+0]*a[e+0]+this.elements[3*d+1]*a[e+3];this.elements=b.slice()},preApply:function(){var a;1===arguments.length&&arguments[0]instanceof Jd?a=arguments[0].array():6===arguments.length?a=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(a=arguments[0]);var b=[0,0,a[2],0,0,a[5]];b[2]=a[2]+this.elements[2]*a[0]+this.elements[5]*a[1],b[5]=a[5]+this.elements[2]*a[3]+this.elements[5]*a[4],b[0]=this.elements[0]*a[0]+this.elements[3]*a[1],b[3]=this.elements[0]*a[3]+this.elements[3]*a[4],b[1]=this.elements[1]*a[0]+this.elements[4]*a[1],b[4]=this.elements[1]*a[3]+this.elements[4]*a[4],this.elements=b.slice()},rotate:function(a){var b=c.cos(a),d=c.sin(a),e=this.elements[0],f=this.elements[1];this.elements[0]=b*e+d*f,this.elements[1]=-d*e+b*f,e=this.elements[3],f=this.elements[4],this.elements[3]=b*e+d*f,this.elements[4]=-d*e+b*f},rotateZ:function(a){this.rotate(a)},invRotateZ:function(a){this.rotateZ(a-c.PI)},print:function(){var a=Id(this.elements),b=""+t.nfs(this.elements[0],a,4)+" "+t.nfs(this.elements[1],a,4)+" "+t.nfs(this.elements[2],a,4)+"\n"+t.nfs(this.elements[3],a,4)+" "+t.nfs(this.elements[4],a,4)+" "+t.nfs(this.elements[5],a,4)+"\n\n";t.println(b)}};var Ld=t.PMatrix3D=function(){this.reset()};Ld.prototype={set:function(){16===arguments.length?this.elements=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Ld?this.elements=arguments[0].array():1===arguments.length&&arguments[0]instanceof Array&&(this.elements=arguments[0].slice())},get:function(){var a=new Ld;return a.set(this.elements),a},reset:function(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},array:function(){return this.elements.slice()},translate:function(a,b,c){c===d&&(c=0),this.elements[3]+=a*this.elements[0]+b*this.elements[1]+c*this.elements[2],this.elements[7]+=a*this.elements[4]+b*this.elements[5]+c*this.elements[6],this.elements[11]+=a*this.elements[8]+b*this.elements[9]+c*this.elements[10],this.elements[15]+=a*this.elements[12]+b*this.elements[13]+c*this.elements[14]},transpose:function(){var a=this.elements[4];this.elements[4]=this.elements[1],this.elements[1]=a,a=this.elements[8],this.elements[8]=this.elements[2],this.elements[2]=a,a=this.elements[6],this.elements[6]=this.elements[9],this.elements[9]=a,a=this.elements[3],this.elements[3]=this.elements[12],this.elements[12]=a,a=this.elements[7],this.elements[7]=this.elements[13],this.elements[13]=a,a=this.elements[11],this.elements[11]=this.elements[14],this.elements[14]=a},mult:function(a,b){var c,d,e,f;return a instanceof u?(c=a.x,d=a.y,e=a.z,f=1,b||(b=new u)):a instanceof Array&&(c=a[0],d=a[1],e=a[2],f=a[3]||1,(!b||3!==b.length&&4!==b.length)&&(b=[0,0,0])),b instanceof Array&&(3===b.length?(b[0]=this.elements[0]*c+this.elements[1]*d+this.elements[2]*e+this.elements[3],b[1]=this.elements[4]*c+this.elements[5]*d+this.elements[6]*e+this.elements[7],b[2]=this.elements[8]*c+this.elements[9]*d+this.elements[10]*e+this.elements[11]):4===b.length&&(b[0]=this.elements[0]*c+this.elements[1]*d+this.elements[2]*e+this.elements[3]*f,b[1]=this.elements[4]*c+this.elements[5]*d+this.elements[6]*e+this.elements[7]*f,b[2]=this.elements[8]*c+this.elements[9]*d+this.elements[10]*e+this.elements[11]*f,b[3]=this.elements[12]*c+this.elements[13]*d+this.elements[14]*e+this.elements[15]*f)),b instanceof u&&(b.x=this.elements[0]*c+this.elements[1]*d+this.elements[2]*e+this.elements[3],b.y=this.elements[4]*c+this.elements[5]*d+this.elements[6]*e+this.elements[7],b.z=this.elements[8]*c+this.elements[9]*d+this.elements[10]*e+this.elements[11]),b},preApply:function(){var a;1===arguments.length&&arguments[0]instanceof Ld?a=arguments[0].array():16===arguments.length?a=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0,d=0;4>d;d++)for(var e=0;4>e;e++,c++)b[c]+=this.elements[e+0]*a[4*d+0]+this.elements[e+4]*a[4*d+1]+this.elements[e+8]*a[4*d+2]+this.elements[e+12]*a[4*d+3];this.elements=b.slice()},apply:function(){var a;1===arguments.length&&arguments[0]instanceof Ld?a=arguments[0].array():16===arguments.length?a=Array.prototype.slice.call(arguments):1===arguments.length&&arguments[0]instanceof Array&&(a=arguments[0]);for(var b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],c=0,d=0;4>d;d++)for(var e=0;4>e;e++,c++)b[c]+=this.elements[4*d+0]*a[e+0]+this.elements[4*d+1]*a[e+4]+this.elements[4*d+2]*a[e+8]+this.elements[4*d+3]*a[e+12];this.elements=b.slice()},rotate:function(a,b,c,d){if(c){var e=t.cos(a),f=t.sin(a),g=1-e;this.apply(g*b*b+e,g*b*c-f*d,g*b*d+f*c,0,g*b*c+f*d,g*c*c+e,g*c*d-f*b,0,g*b*d-f*c,g*c*d+f*b,g*d*d+e,0,0,0,0,1)}else this.rotateZ(a)},invApply:function(){Kc===d&&(Kc=new Ld);var a=arguments;return Kc.set(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]),Kc.invert()?(this.preApply(Kc),!0):!1},rotateX:function(a){var b=t.cos(a),c=t.sin(a);this.apply([1,0,0,0,0,b,-c,0,0,c,b,0,0,0,0,1])},rotateY:function(a){var b=t.cos(a),c=t.sin(a);this.apply([b,0,c,0,0,1,0,0,-c,0,b,0,0,0,0,1])},rotateZ:function(a){var b=c.cos(a),d=c.sin(a);this.apply([b,-d,0,0,d,b,0,0,0,0,1,0,0,0,0,1])},scale:function(a,b,c){!a||b||c?a&&b&&!c&&(c=1):b=c=a,a&&b&&c&&(this.elements[0]*=a,this.elements[1]*=b,this.elements[2]*=c,this.elements[4]*=a,this.elements[5]*=b,this.elements[6]*=c,this.elements[8]*=a,this.elements[9]*=b,this.elements[10]*=c,this.elements[12]*=a,this.elements[13]*=b,this.elements[14]*=c)},skewX:function(a){var b=c.tan(a);this.apply(1,b,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},skewY:function(a){var b=c.tan(a);this.apply(1,0,0,0,b,1,0,0,0,0,1,0,0,0,0,1)},shearX:function(a){var b=c.tan(a);this.apply(1,b,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},shearY:function(a){var b=c.tan(a);this.apply(1,0,0,0,b,1,0,0,0,0,1,0,0,0,0,1)},multX:function(a,b,c,d){return c?d?this.elements[0]*a+this.elements[1]*b+this.elements[2]*c+this.elements[3]*d:this.elements[0]*a+this.elements[1]*b+this.elements[2]*c+this.elements[3]:this.elements[0]*a+this.elements[1]*b+this.elements[3]},multY:function(a,b,c,d){return c?d?this.elements[4]*a+this.elements[5]*b+this.elements[6]*c+this.elements[7]*d:this.elements[4]*a+this.elements[5]*b+this.elements[6]*c+this.elements[7]:this.elements[4]*a+this.elements[5]*b+this.elements[7]},multZ:function(a,b,c,d){return d?this.elements[8]*a+this.elements[9]*b+this.elements[10]*c+this.elements[11]*d:this.elements[8]*a+this.elements[9]*b+this.elements[10]*c+this.elements[11]},multW:function(a,b,c,d){return d?this.elements[12]*a+this.elements[13]*b+this.elements[14]*c+this.elements[15]*d:this.elements[12]*a+this.elements[13]*b+this.elements[14]*c+this.elements[15]},invert:function(){var a=this.elements[0]*this.elements[5]-this.elements[1]*this.elements[4],b=this.elements[0]*this.elements[6]-this.elements[2]*this.elements[4],d=this.elements[0]*this.elements[7]-this.elements[3]*this.elements[4],e=this.elements[1]*this.elements[6]-this.elements[2]*this.elements[5],f=this.elements[1]*this.elements[7]-this.elements[3]*this.elements[5],g=this.elements[2]*this.elements[7]-this.elements[3]*this.elements[6],h=this.elements[8]*this.elements[13]-this.elements[9]*this.elements[12],i=this.elements[8]*this.elements[14]-this.elements[10]*this.elements[12],j=this.elements[8]*this.elements[15]-this.elements[11]*this.elements[12],k=this.elements[9]*this.elements[14]-this.elements[10]*this.elements[13],l=this.elements[9]*this.elements[15]-this.elements[11]*this.elements[13],m=this.elements[10]*this.elements[15]-this.elements[11]*this.elements[14],n=a*m-b*l+d*k+e*j-f*i+g*h;if(1e-9>=c.abs(n))return!1;var o=[];o[0]=+this.elements[5]*m-this.elements[6]*l+this.elements[7]*k,o[4]=-this.elements[4]*m+this.elements[6]*j-this.elements[7]*i,o[8]=+this.elements[4]*l-this.elements[5]*j+this.elements[7]*h,o[12]=-this.elements[4]*k+this.elements[5]*i-this.elements[6]*h,o[1]=-this.elements[1]*m+this.elements[2]*l-this.elements[3]*k,o[5]=+this.elements[0]*m-this.elements[2]*j+this.elements[3]*i,o[9]=-this.elements[0]*l+this.elements[1]*j-this.elements[3]*h,o[13]=+this.elements[0]*k-this.elements[1]*i+this.elements[2]*h,o[2]=+this.elements[13]*g-this.elements[14]*f+this.elements[15]*e,o[6]=-this.elements[12]*g+this.elements[14]*d-this.elements[15]*b,o[10]=+this.elements[12]*f-this.elements[13]*d+this.elements[15]*a,o[14]=-this.elements[12]*e+this.elements[13]*b-this.elements[14]*a,o[3]=-this.elements[9]*g+this.elements[10]*f-this.elements[11]*e,o[7]=+this.elements[8]*g-this.elements[10]*d+this.elements[11]*b,o[11]=-this.elements[8]*f+this.elements[9]*d-this.elements[11]*a,o[15]=+this.elements[8]*e-this.elements[9]*b+this.elements[10]*a;var p=1/n;return o[0]*=p,o[1]*=p,o[2]*=p,o[3]*=p,o[4]*=p,o[5]*=p,o[6]*=p,o[7]*=p,o[8]*=p,o[9]*=p,o[10]*=p,o[11]*=p,o[12]*=p,o[13]*=p,o[14]*=p,o[15]*=p,this.elements=o.slice(),!0},toString:function(){for(var a="",b=0;15>b;b++)a+=this.elements[b]+", ";return a+=this.elements[15]},print:function(){var a=Id(this.elements),b=""+t.nfs(this.elements[0],a,4)+" "+t.nfs(this.elements[1],a,4)+" "+t.nfs(this.elements[2],a,4)+" "+t.nfs(this.elements[3],a,4)+"\n"+t.nfs(this.elements[4],a,4)+" "+t.nfs(this.elements[5],a,4)+" "+t.nfs(this.elements[6],a,4)+" "+t.nfs(this.elements[7],a,4)+"\n"+t.nfs(this.elements[8],a,4)+" "+t.nfs(this.elements[9],a,4)+" "+t.nfs(this.elements[10],a,4)+" "+t.nfs(this.elements[11],a,4)+"\n"+t.nfs(this.elements[12],a,4)+" "+t.nfs(this.elements[13],a,4)+" "+t.nfs(this.elements[14],a,4)+" "+t.nfs(this.elements[15],a,4)+"\n\n";t.println(b)},invTranslate:function(a,b,c){this.preApply(1,0,0,-a,0,1,0,-b,0,0,1,-c,0,0,0,1)},invRotateX:function(a){var b=c.cos(-a),d=c.sin(-a);this.preApply([1,0,0,0,0,b,-d,0,0,d,b,0,0,0,0,1])},invRotateY:function(a){var b=c.cos(-a),d=c.sin(-a);this.preApply([b,0,d,0,0,1,0,0,-d,0,b,0,0,0,0,1])},invRotateZ:function(a){var b=c.cos(-a),d=c.sin(-a);this.preApply([b,-d,0,0,d,b,0,0,0,0,1,0,0,0,0,1])},invScale:function(a,b,c){this.preApply([1/a,0,0,0,0,1/b,0,0,0,0,1/c,0,0,0,0,1])}};var Md=t.PMatrixStack=function(){this.matrixStack=[]};Md.prototype.load=function(){var a=y.$newPMatrix();1===arguments.length?a.set(arguments[0]):a.set(arguments),this.matrixStack.push(a)},yd.prototype.$newPMatrix=function(){return new Jd},zd.prototype.$newPMatrix=function(){return new Ld},Md.prototype.push=function(){this.matrixStack.push(this.peek())},Md.prototype.pop=function(){return this.matrixStack.pop()},Md.prototype.peek=function(){var a=y.$newPMatrix();return a.set(this.matrixStack[this.matrixStack.length-1]),a},Md.prototype.mult=function(a){this.matrixStack[this.matrixStack.length-1].apply(a)},t.split=function(a,b){return a.split(b)},t.splitTokens=function(a,b){if(b===d)return a.split(/\s+/g);var g,h,c=b.split(/()/g),e="",f=a.length,i=[];for(g=0;f>g;g++)h=a[g],c.indexOf(h)>-1?(""!==e&&i.push(e),e=""):e+=h;return""!==e&&i.push(e),i},t.append=function(a,b){return a[a.length]=b,a},t.concat=function(a,b){return a.concat(b)},t.sort=function(a,b){var c=[];if(a.length>0){for(var d=b>0?b:a.length,e=0;d>e;e++)c.push(a[e]);if("string"==typeof a[0]?c.sort():c.sort(function(a,b){return a-b}),b>0)for(var f=c.length;a.length>f;f++)c.push(a[f])}return c},t.splice=function(a,b,c){if(0===b.length)return a;if(b instanceof Array)for(var d=0,e=c;b.length>d;e++,d++)a.splice(e,0,b[d]);else a.splice(c,0,b);return a},t.subset=function(a,b,c){var e=c!==d?b+c:a.length;return a.slice(b,e)},t.join=function(a,b){return a.join(b)},t.shorten=function(a){for(var b=[],c=a.length,d=0;c>d;d++)b[d]=a[d];return b.pop(),b},t.expand=function(a,b){var c=a.slice(0),d=b||2*a.length;return c.length=d,c},t.arrayCopy=function(){var a,c,g,b=0,f=0;2===arguments.length?(a=arguments[0],c=arguments[1],g=a.length):3===arguments.length?(a=arguments[0],c=arguments[1],g=arguments[2]):5===arguments.length&&(a=arguments[0],b=arguments[1],c=arguments[2],f=arguments[3],g=arguments[4]);for(var h=b,i=f;g+b>h;h++,i++)c[i]!==d?c[i]=a[h]:e("array index out of bounds exception")},t.reverse=function(a){return a.reverse()},t.mix=function(a,b,c){return a+((b-a)*c>>8)},t.peg=function(a){return 0>a?0:a>255?255:a},t.modes=function(){function h(a,b,c,d,e,g,h,i,j,k,l){var m=f(((4278190080&a)>>>24)+b,255)<<24,n=c+((j-c)*b>>8);n=(0>n?0:n>255?255:n)<<16;var o=d+((k-d)*b>>8);o=(0>o?0:o>255?255:o)<<8;var p=e+((l-e)*b>>8);return p=0>p?0:p>255?255:p,m|n|o|p}var a=o.ALPHA_MASK,b=o.RED_MASK,d=o.GREEN_MASK,e=o.BLUE_MASK,f=c.min,g=c.max;return{replace:function(a,b){return b},blend:function(c,g){var h=(g&a)>>>24,i=c&b,j=c&d,k=c&e,l=g&b,m=g&d,n=g&e;return f(((c&a)>>>24)+h,255)<<24|i+((l-i)*h>>8)&b|j+((m-j)*h>>8)&d|k+((n-k)*h>>8)&e},add:function(c,g){var h=(g&a)>>>24;return f(((c&a)>>>24)+h,255)<<24|f((c&b)+((g&b)>>8)*h,b)&b|f((c&d)+((g&d)>>8)*h,d)&d|f((c&e)+((g&e)*h>>8),e)},subtract:function(c,h){var i=(h&a)>>>24;return f(((c&a)>>>24)+i,255)<<24|g((c&b)-((h&b)>>8)*i,d)&b|g((c&d)-((h&d)>>8)*i,e)&d|g((c&e)-((h&e)*i>>8),0)},lightest:function(c,h){var i=(h&a)>>>24;return f(((c&a)>>>24)+i,255)<<24|g(c&b,((h&b)>>8)*i)&b|g(c&d,((h&d)>>8)*i)&d|g(c&e,(h&e)*i>>8)},darkest:function(c,g){var h=(g&a)>>>24,i=c&b,j=c&d,k=c&e,l=f(c&b,((g&b)>>8)*h),m=f(c&d,((g&d)>>8)*h),n=f(c&e,(g&e)*h>>8);return f(((c&a)>>>24)+h,255)<<24|i+((l-i)*h>>8)&b|j+((m-j)*h>>8)&d|k+((n-k)*h>>8)&e},difference:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=i>l?i-l:l-i,p=j>m?j-m:m-j,q=k>n?k-n:n-k;return h(c,g,i,j,k,l,m,n,o,p,q)},exclusion:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=i+l-(i*l>>7),p=j+m-(j*m>>7),q=k+n-(k*n>>7);return h(c,g,i,j,k,l,m,n,o,p,q)},multiply:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=i*l>>8,p=j*m>>8,q=k*n>>8;return h(c,g,i,j,k,l,m,n,o,p,q)},screen:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=255-((255-i)*(255-l)>>8),p=255-((255-j)*(255-m)>>8),q=255-((255-k)*(255-n)>>8);return h(c,g,i,j,k,l,m,n,o,p,q)},hard_light:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=128>l?i*l>>7:255-((255-i)*(255-l)>>7),p=128>m?j*m>>7:255-((255-j)*(255-m)>>7),q=128>n?k*n>>7:255-((255-k)*(255-n)>>7);return h(c,g,i,j,k,l,m,n,o,p,q)},soft_light:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=(i*l>>7)+(i*i>>8)-(i*i*l>>15),p=(j*m>>7)+(j*j>>8)-(j*j*m>>15),q=(k*n>>7)+(k*k>>8)-(k*k*n>>15);return h(c,g,i,j,k,l,m,n,o,p,q)},overlay:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=128>i?i*l>>7:255-((255-i)*(255-l)>>7),p=128>j?j*m>>7:255-((255-j)*(255-m)>>7),q=128>k?k*n>>7:255-((255-k)*(255-n)>>7);return h(c,g,i,j,k,l,m,n,o,p,q)},dodge:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=255;255!==l&&(o=(i<<8)/(255-l),o=0>o?0:o>255?255:o);var p=255;255!==m&&(p=(j<<8)/(255-m),p=0>p?0:p>255?255:p);var q=255;return 255!==n&&(q=(k<<8)/(255-n),q=0>q?0:q>255?255:q),h(c,g,i,j,k,l,m,n,o,p,q)},burn:function(c,f){var g=(f&a)>>>24,i=(c&b)>>16,j=(c&d)>>8,k=c&e,l=(f&b)>>16,m=(f&d)>>8,n=f&e,o=0;0!==l&&(o=(255-i<<8)/l,o=255-(0>o?0:o>255?255:o));var p=0;0!==m&&(p=(255-j<<8)/m,p=255-(0>p?0:p>255?255:p));var q=0;return 0!==n&&(q=(255-k<<8)/n,q=255-(0>q?0:q>255?255:q)),h(c,g,i,j,k,l,m,n,o,p,q)}}}(),t.color=function(a,b,c,e){return a!==d&&b!==d&&c!==d&&e!==d?Nd(a,b,c,e):a!==d&&b!==d&&c!==d?Nd(a,b,c,hb):a!==d&&b!==d?Od(a,b):"number"==typeof a?Pd(a):Nd(ib,jb,kb,hb)},t.color.toString=function(a){return"rgba("+((a&o.RED_MASK)>>>16)+","+((a&o.GREEN_MASK)>>>8)+","+(a&o.BLUE_MASK)+","+((a&o.ALPHA_MASK)>>>24)/255+")"},t.color.toInt=function(a,b,c,d){return d<<24&o.ALPHA_MASK|a<<16&o.RED_MASK|b<<8&o.GREEN_MASK|c&o.BLUE_MASK},t.color.toArray=function(a){return[(a&o.RED_MASK)>>>16,(a&o.GREEN_MASK)>>>8,a&o.BLUE_MASK,(a&o.ALPHA_MASK)>>>24]},t.color.toGLArray=function(a){return[((a&o.RED_MASK)>>>16)/255,((a&o.GREEN_MASK)>>>8)/255,(a&o.BLUE_MASK)/255,((a&o.ALPHA_MASK)>>>24)/255]},t.color.toRGB=function(a,b,d){a=a>ib?ib:a,b=b>jb?jb:b,d=d>kb?kb:d,a=360*(a/ib),b=100*(b/jb),d=100*(d/kb);var e=c.round(255*(d/100));if(0===b)return[e,e,e];var f=a%360,g=f%60,h=c.round(255*(d*(100-b)/1e4)),i=c.round(255*(d*(6e3-b*g)/6e5)),j=c.round(255*(d*(6e3-b*(60-g))/6e5));switch(c.floor(f/60)){case 0:return[e,j,h];case 1:return[i,e,h];case 2:return[h,e,j];case 3:return[h,i,e];case 4:return[j,h,e];case 5:return[e,h,i]}},t.brightness=function(a){return Qd(a)[2]},t.saturation=function(a){return Qd(a)[1]},t.hue=function(a){return Qd(a)[0]},t.red=function(a){return((a&o.RED_MASK)>>>16)/255*ib},t.green=function(a){return((a&o.GREEN_MASK)>>>8)/255*jb},t.blue=function(a){return(a&o.BLUE_MASK)/255*kb},t.alpha=function(a){return((a&o.ALPHA_MASK)>>>24)/255*hb},t.lerpColor=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,p,q,r,s,u,v,w=t.color(a),x=t.color(b);return pb===o.HSB?(q=Qd(w),k=((w&o.ALPHA_MASK)>>>24)/hb,r=Qd(x),p=((x&o.ALPHA_MASK)>>>24)/hb,u=t.lerp(q[0],r[0],c),v=t.lerp(q[1],r[1],c),f=t.lerp(q[2],r[2],c),s=t.color.toRGB(u,v,f),g=t.lerp(k,p,c)*hb,g<<24&o.ALPHA_MASK|s[0]<<16&o.RED_MASK|s[1]<<8&o.GREEN_MASK|s[2]&o.BLUE_MASK):(h=(w&o.RED_MASK)>>>16,i=(w&o.GREEN_MASK)>>>8,j=w&o.BLUE_MASK,k=((w&o.ALPHA_MASK)>>>24)/hb,l=(x&o.RED_MASK)>>>16,m=(x&o.GREEN_MASK)>>>8,n=x&o.BLUE_MASK,p=((x&o.ALPHA_MASK)>>>24)/hb,d=0|t.lerp(h,l,c),e=0|t.lerp(i,m,c),f=0|t.lerp(j,n,c),g=t.lerp(k,p,c)*hb,g<<24&o.ALPHA_MASK|d<<16&o.RED_MASK|e<<8&o.GREEN_MASK|f&o.BLUE_MASK)},t.colorMode=function(){pb=arguments[0],arguments.length>1&&(ib=arguments[1],jb=arguments[2]||arguments[1],kb=arguments[3]||arguments[1],hb=arguments[4]||arguments[1])},t.blendColor=function(a,b,c){return c===o.REPLACE?t.modes.replace(a,b):c===o.BLEND?t.modes.blend(a,b):c===o.ADD?t.modes.add(a,b):c===o.SUBTRACT?t.modes.subtract(a,b):c===o.LIGHTEST?t.modes.lightest(a,b):c===o.DARKEST?t.modes.darkest(a,b):c===o.DIFFERENCE?t.modes.difference(a,b):c===o.EXCLUSION?t.modes.exclusion(a,b):c===o.MULTIPLY?t.modes.multiply(a,b):c===o.SCREEN?t.modes.screen(a,b):c===o.HARD_LIGHT?t.modes.hard_light(a,b):c===o.SOFT_LIGHT?t.modes.soft_light(a,b):c===o.OVERLAY?t.modes.overlay(a,b):c===o.DODGE?t.modes.dodge(a,b):c===o.BURN?t.modes.burn(a,b):void 0},t.printMatrix=function(){Gc.print()},yd.prototype.translate=function(a,b){Gc.translate(a,b),Hc.invTranslate(a,b),v.translate(a,b)},zd.prototype.translate=function(a,b,c){Gc.translate(a,b,c),Hc.invTranslate(a,b,c)},yd.prototype.scale=function(a,b){Gc.scale(a,b),Hc.invScale(a,b),v.scale(a,b||a)},zd.prototype.scale=function(a,b,c){Gc.scale(a,b,c),Hc.invScale(a,b,c)},yd.prototype.transform=function(a){var b=a.array();v.transform(b[0],b[3],b[1],b[4],b[2],b[5])},zd.prototype.transformm=function(){e("p.transform is currently not supported in 3D mode")},yd.prototype.pushMatrix=function(){Ic.load(Gc),Jc.load(Hc),Rd()},zd.prototype.pushMatrix=function(){Ic.load(Gc),Jc.load(Hc)},yd.prototype.popMatrix=function(){Gc.set(Ic.pop()),Hc.set(Jc.pop()),Sd()},zd.prototype.popMatrix=function(){Gc.set(Ic.pop()),Hc.set(Jc.pop())},yd.prototype.resetMatrix=function(){Gc.reset(),Hc.reset(),v.setTransform(1,0,0,1,0,0)},zd.prototype.resetMatrix=function(){Gc.reset(),Hc.reset()},xd.prototype.applyMatrix=function(){var a=arguments;Gc.apply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]),Hc.invApply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15])},yd.prototype.applyMatrix=function(){for(var a=arguments,b=a.length;16>b;b++)a[b]=0;
a[10]=a[15]=1,xd.prototype.applyMatrix.apply(this,a)},t.rotateX=function(a){Gc.rotateX(a),Hc.invRotateX(a)},yd.prototype.rotateZ=function(){e("rotateZ() is not supported in 2D mode. Use rotate(float) instead.")},zd.prototype.rotateZ=function(a){Gc.rotateZ(a),Hc.invRotateZ(a)},t.rotateY=function(a){Gc.rotateY(a),Hc.invRotateY(a)},yd.prototype.rotate=function(a){Gc.rotateZ(a),Hc.invRotateZ(a),v.rotate(a)},zd.prototype.rotate=function(a){t.rotateZ(a)},yd.prototype.shearX=function(a){Gc.shearX(a),v.transform(1,0,a,1,0,0)},zd.prototype.shearX=function(a){Gc.shearX(a)},yd.prototype.shearY=function(a){Gc.shearY(a),v.transform(1,a,0,1,0,0)},zd.prototype.shearY=function(a){Gc.shearY(a)},t.pushStyle=function(){Rd(),t.pushMatrix();var a={doFill:z,currentFillColor:C,doStroke:I,currentStrokeColor:K,curTint:qb,curRectMode:R,curColorMode:pb,colorModeX:ib,colorModeZ:kb,colorModeY:jb,colorModeA:hb,curTextFont:hc,horizontalTextAlignment:_b,verticalTextAlignment:ac,textMode:bc,curFontName:cc,curTextSize:dc,curTextAscent:ec,curTextDescent:fc,curTextLeading:gc};ad.push(a)},t.popStyle=function(){var a=ad.pop();a?(Sd(),t.popMatrix(),z=a.doFill,C=a.currentFillColor,I=a.doStroke,K=a.currentStrokeColor,qb=a.curTint,R=a.curRectMode,pb=a.curColorMode,ib=a.colorModeX,kb=a.colorModeZ,jb=a.colorModeY,hb=a.colorModeA,hc=a.curTextFont,cc=a.curFontName,dc=a.curTextSize,_b=a.horizontalTextAlignment,ac=a.verticalTextAlignment,bc=a.textMode,ec=a.curTextAscent,fc=a.curTextDescent,gc=a.curTextLeading):e("Too many popStyle() without enough pushStyle()")},t.year=function(){return(new Date).getFullYear()},t.month=function(){return(new Date).getMonth()+1},t.day=function(){return(new Date).getDate()},t.hour=function(){return(new Date).getHours()},t.minute=function(){return(new Date).getMinutes()},t.second=function(){return(new Date).getSeconds()},t.millis=function(){return Date.now()-tb},yd.prototype.redraw=function(){Td(),v.lineWidth=M;var a=t.pmouseX,b=t.pmouseY;t.pmouseX=nb,t.pmouseY=ob,Rd(),t.draw(),Sd(),nb=t.mouseX,ob=t.mouseY,t.pmouseX=a,t.pmouseY=b},zd.prototype.redraw=function(){Td();var a=t.pmouseX,b=t.pmouseY;t.pmouseX=nb,t.pmouseY=ob,v.clear(v.DEPTH_BUFFER_BIT),Db={attributes:{},locations:{}},t.noLights(),t.lightFalloff(1,0,0),t.shininess(1),t.ambient(255,255,255),t.specular(0,0,0),t.emissive(0,0,0),t.camera(),t.draw(),nb=t.mouseX,ob=t.mouseY,t.pmouseX=a,t.pmouseY=b},t.noLoop=function(){P=!1,N=!1,clearInterval(Q),x.onPause()},t.loop=function(){N||(ub=Date.now(),vb=0,Q=a.setInterval(function(){try{x.onFrameStart(),t.redraw(),x.onFrameEnd()}catch(b){a.clearInterval(Q),e(b)}},Y),P=!0,N=!0,x.onLoop())},t.frameRate=function(a){X=a,Y=1e3/X,P&&(t.noLoop(),t.loop())};var Ud=[];t.exit=function(){a.clearInterval(Q),D(t.externals.canvas.id),delete j.onmousedown;for(var b in H.lib)H.lib.hasOwnProperty(b)&&H.lib[b].hasOwnProperty("detach")&&H.lib[b].detach(t);for(var c=Ud.length;c--;)Wd(Ud[c]);x.onExit()},t.cursor=function(){if(arguments.length>1||1===arguments.length&&arguments[0]instanceof t.PImage){var b,c,a=arguments[0];if(arguments.length>=3){if(b=arguments[1],c=arguments[2],0>b||0>c||c>=a.height||b>=a.width)throw"x and y must be non-negative and less than the dimensions of the image"}else b=a.width>>>1,c=a.height>>>1;var d=a.toDataURL(),e='url("'+d+'") '+b+" "+c+", default";Z=j.style.cursor=e}else if(1===arguments.length){var f=arguments[0];Z=j.style.cursor=f}else Z=j.style.cursor=$},t.noCursor=function(){Z=j.style.cursor=o.NOCURSOR},t.link=function(b,c){c!==d?a.open(b,c):a.location=b},t.beginDraw=f,t.endDraw=f,yd.prototype.toImageData=function(a,b,c,e){return a=a!==d?a:0,b=b!==d?b:0,c=c!==d?c:t.width,e=e!==d?e:t.height,v.getImageData(a,b,c,e)},zd.prototype.toImageData=function(a,e,f,g){a=a!==d?a:0,e=e!==d?e:0,f=f!==d?f:t.width,g=g!==d?g:t.height;var h=b.createElement("canvas"),i=h.getContext("2d"),j=i.createImageData(f,g),k=new n(4*f*g);v.readPixels(a,e,f,g,v.RGBA,v.UNSIGNED_BYTE,k);for(var l=0,m=k.length,o=j.data;m>l;l++)o[l]=k[4*(g-1-c.floor(l/4/f))*f+l%(4*f)];return j},t.status=function(b){a.status=b},t.binary=function(a,b){var c;if(b>0)c=b;else if(a instanceof Cd)c=16,a|=0;else for(c=32;c>1&&!(1&a>>>c-1);)c--;for(var d="";c>0;)d+=1&a>>>--c?"1":"0";return d},t.unbinary=function(a){for(var b=a.length-1,c=1,d=0;b>=0;){var f=a[b--];"0"!==f&&"1"!==f&&e("the value passed into unbinary was not an 8 bit binary number"),"1"===f&&(d+=c),c<<=1}return d},t.nf=function(a,b,c){return Yd(a,"","-",b,c)},t.nfs=function(a,b,c){return Yd(a," ","-",b,c)},t.nfp=function(a,b,c){return Yd(a,"+","-",b,c)},t.nfc=function(a,b){return Yd(a,"","-",0,b,",")};var Zd=function(a,b){b=b===d||null===b?b=8:b,0>a&&(a=4294967295+a+1);for(var c=Number(a).toString(16).toUpperCase();b>c.length;)c="0"+c;return c.length>=b&&(c=c.substring(c.length-b,c.length)),c};t.hex=function(a,b){return 1===arguments.length&&(b=a instanceof Cd?4:8),Zd(a,b)},t.unhex=function(a){if(a instanceof Array){for(var b=[],c=0;a.length>c;c++)b.push($d(a[c]));return b}return $d(a)},t.loadStrings=function(a){if(localStorage[a])return localStorage[a].split("\n");var b=h(a);return"string"!=typeof b||""===b?[]:(b=b.replace(/(\r\n?)/g,"\n").replace(/\n$/,""),b.split("\n"))},t.saveStrings=function(a,b){localStorage[a]=b.join("\n")},t.loadBytes=function(a){for(var b=h(a),c=[],d=0;b.length>d;d++)c.push(b.charCodeAt(d));return c},t.matchAll=function(a,b){for(var d,c=[],e=RegExp(b,"g");null!==(d=e.exec(a));)c.push(d),0===d[0].length&&++e.lastIndex;return c.length>0?c:null},t.__contains=function(a,b){return"string"!=typeof a?a.contains.apply(a,_d(arguments)):null!==a&&null!==b&&"string"==typeof b&&a.indexOf(b)>-1},t.__replaceAll=function(a,b,c){return"string"!=typeof a?a.replaceAll.apply(a,_d(arguments)):a.replace(RegExp(b,"g"),c)},t.__replaceFirst=function(a,b,c){return"string"!=typeof a?a.replaceFirst.apply(a,_d(arguments)):a.replace(RegExp(b,""),c)},t.__replace=function(a,b,c){if("string"!=typeof a)return a.replace.apply(a,_d(arguments));if(b instanceof RegExp)return a.replace(b,c);if("string"!=typeof b&&(b=""+b),""===b)return a;var d=a.indexOf(b);if(0>d)return a;var e=0,f="";do f+=a.substring(e,d)+c,e=d+b.length;while((d=a.indexOf(b,e))>=0);return f+a.substring(e)},t.__equals=function(a,b){return a.equals instanceof Function?a.equals.apply(a,_d(arguments)):q(a,b)},t.__equalsIgnoreCase=function(a,b){return"string"!=typeof a?a.equalsIgnoreCase.apply(a,_d(arguments)):a.toLowerCase()===b.toLowerCase()},t.__toCharArray=function(a){if("string"!=typeof a)return a.toCharArray.apply(a,_d(arguments));for(var b=[],c=0,d=a.length;d>c;++c)b[c]=new Cd(a.charAt(c));return b},t.__split=function(a,b,c){if("string"!=typeof a)return a.split.apply(a,_d(arguments));var e=RegExp(b);if(c===d||1>c)return a.split(e);for(var h,f=[],g=a;-1!==(h=g.search(e))&&c-1>f.length;){var i=""+e.exec(g);f.push(g.substring(0,h)),g=g.substring(h+i.length)}return(-1!==h||""!==g)&&f.push(g),f},t.__codePointAt=function(a,b){var d,e,c=a.charCodeAt(b);return c>=55296&&56319>=c?(d=c,e=a.charCodeAt(b+1),1024*(d-55296)+(e-56320)+65536):c},t.match=function(a,b){return a.match(b)},t.__matches=function(a,b){return RegExp(b).test(a)},t.__startsWith=function(a,b,c){return"string"!=typeof a?a.startsWith.apply(a,_d(arguments)):(c=c||0,0>c||c>a.length?!1:""===b||b===a?!0:a.indexOf(b)===c)},t.__endsWith=function(a,b){if("string"!=typeof a)return a.endsWith.apply(a,_d(arguments));var c=b?b.length:0;return""===b||b===a?!0:a.indexOf(b)===a.length-c},t.__hashCode=function(a){return a.hashCode instanceof Function?a.hashCode.apply(a,_d(arguments)):p(a)},t.__printStackTrace=function(a){t.println("Exception: "+(""+a))};var ae=[];t.println=function(a){var b=ae.length,c="";b&&(c=ae.join(""),ae.length=0),0===arguments.length&&0===b?H.logger.log(c+""):0!==arguments.length&&H.logger.log(c+a)},t.print=function(a){ae.push(a)},t.str=function(a){if(a instanceof Array){for(var b=[],c=0;a.length>c;c++)b.push(""+a[c]);return b}return""+a},t.trim=function(a){if(a instanceof Array){for(var b=[],c=0;a.length>c;c++)b.push(a[c].replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,""));return b}return a.replace(/^\s*/,"").replace(/\s*$/,"").replace(/\r*$/,"")},t.parseBoolean=function(a){if(a instanceof Array){for(var b=[],c=0;a.length>c;c++)b.push(be(a[c]));return b}return be(a)},t.parseByte=function(a){if(a instanceof Array){for(var b=[],c=0;a.length>c;c++)b.push(0-(128&a[c])|127&a[c]);return b}return 0-(128&a)|127&a},t.parseChar=function(a){if("number"==typeof a)return new Cd(String.fromCharCode(65535&a));if(a instanceof Array){for(var b=[],c=0;a.length>c;c++)b.push(new Cd(String.fromCharCode(65535&a[c])));return b}e("char() may receive only one argument of type int, byte, int[], or byte[].")},t.parseFloat=function(a){if(a instanceof Array){for(var b=[],c=0;a.length>c;c++)b.push(ce(a[c]));return b}return ce(a)},t.parseInt=function(a,b){if(a instanceof Array){for(var c=[],d=0;a.length>d;d++)"string"!=typeof a[d]||/^\s*[+\-]?\d+\s*$/.test(a[d])?c.push(de(a[d],b)):c.push(0);return c}return de(a,b)},t.__int_cast=function(a){return 0|a},t.__instanceof=function(a,b){if("function"!=typeof b&&e("Function is expected as type argument for instanceof operator"),"string"==typeof a)return b===Object||b===String;if(a instanceof b)return!0;if("object"!=typeof a||null===a)return!1;var c=a.constructor;if(b.$isInterface){for(var d=[];c;)c.$interfaces&&(d=d.concat(c.$interfaces)),c=c.$base;for(;d.length>0;){var f=d.shift();if(f===b)return!0;f.$interfaces&&(d=d.concat(f.$interfaces))}return!1}for(;c.hasOwnProperty("$base");)if(c=c.$base,c===b)return!0;return!1},t.abs=c.abs,t.ceil=c.ceil,t.constrain=function(a,b,c){return a>c?c:b>a?b:a},t.dist=function(){var a,b,d;return 4===arguments.length?(a=arguments[0]-arguments[2],b=arguments[1]-arguments[3],c.sqrt(a*a+b*b)):6===arguments.length?(a=arguments[0]-arguments[3],b=arguments[1]-arguments[4],d=arguments[2]-arguments[5],c.sqrt(a*a+b*b+d*d)):void 0},t.exp=c.exp,t.floor=c.floor,t.lerp=function(a,b,c){return(b-a)*c+a},t.log=c.log,t.mag=function(a,b,d){return d?c.sqrt(a*a+b*b+d*d):c.sqrt(a*a+b*b)},t.map=function(a,b,c,d,e){return d+(e-d)*((a-b)/(c-b))},t.max=function(){if(2===arguments.length)return arguments[0]<arguments[1]?arguments[1]:arguments[0];var a=1===arguments.length?arguments[0]:arguments;"length"in a&&a.length>0||e("Non-empty array is expected");for(var b=a[0],c=a.length,d=1;c>d;++d)a[d]>b&&(b=a[d]);return b},t.min=function(){if(2===arguments.length)return arguments[0]<arguments[1]?arguments[0]:arguments[1];var a=1===arguments.length?arguments[0]:arguments;"length"in a&&a.length>0||e("Non-empty array is expected");for(var b=a[0],c=a.length,d=1;c>d;++d)b>a[d]&&(b=a[d]);return b},t.norm=function(a,b,c){return(a-b)/(c-b)},t.pow=c.pow,t.round=c.round,t.sq=function(a){return a*a},t.sqrt=c.sqrt,t.acos=c.acos,t.asin=c.asin,t.atan=c.atan,t.atan2=c.atan2,t.cos=c.cos,t.degrees=function(a){return 180*a/c.PI},t.radians=function(a){return a/180*c.PI},t.sin=c.sin,t.tan=c.tan;var ee=c.random;t.random=function(){if(0===arguments.length)return ee();if(1===arguments.length)return ee()*arguments[0];var a=arguments[0],b=arguments[1];return ee()*(b-a)+a},fe.createRandomized=function(){var a=new Date;return new fe(4294967295&a/6e4,4294967295&a)},t.randomSeed=function(a){ee=new fe(a).nextDouble},t.Random=function(a){var e,f,b=!1;this.nextGaussian=function(){if(b)return b=!1,e;var a,d,g;do a=2*f()-1,d=2*f()-1,g=a*a+d*d;while(g>=1||0===g);var h=c.sqrt(-2*c.log(g)/g);return e=d*h,b=!0,a*h},f=a===d?c.random:new fe(a).nextDouble};var he={generator:d,octaves:4,fallout:.5,seed:d};t.noise=function(a,b,c){he.generator===d&&(he.generator=new ge(he.seed));for(var e=he.generator,f=1,g=1,h=0,i=0;he.octaves>i;++i){switch(f*=he.fallout,arguments.length){case 1:h+=f*(1+e.noise1d(g*a))/2;break;case 2:h+=f*(1+e.noise2d(g*a,g*b))/2;break;case 3:h+=f*(1+e.noise3d(g*a,g*b,g*c))/2}g*=2}return h},t.noiseDetail=function(a,b){he.octaves=a,b!==d&&(he.fallout=b)},t.noiseSeed=function(a){he.seed=a,he.generator=d},xd.prototype.size=function(a,b){var e={fillStyle:v.fillStyle,strokeStyle:v.strokeStyle,lineCap:v.lineCap,lineJoin:v.lineJoin};j.style.length>0&&(j.style.removeProperty("width"),j.style.removeProperty("height")),j.width=t.width=a||100,j.height=t.height=b||100;for(var f in e)e.hasOwnProperty(f)&&(v[f]=e[f]);t.textFont(hc),t.background(),mc=c.max(1e3,.05*a*b),t.externals.context=v;for(var g=0;o.SINCOS_LENGTH>g;g++)Ac[g]=t.sin(.5*g*(o.PI/180)),Bc[g]=t.cos(.5*g*(o.PI/180))},yd.prototype.size=function(){v===d&&(v=j.getContext("2d"),Ic=new Md,Jc=new Md,Gc=new Jd,Hc=new Jd),xd.prototype.size.apply(this,arguments)},zd.prototype.size=function(){var a=!1;return function(b,c){function f(a){for(var c,b=["experimental-webgl","webgl","webkit-3d"],d=0,e=b.length;e>d&&!(c=a.getContext(b[d],{antialias:!1,preserveDrawingBuffer:!0}));d++);return c}a&&e("Multiple calls to size() for 3D renders are not allowed."),a=!0;try{j.width=t.width=b||100,j.height=t.height=c||100,v=f(j),Tb=v.createTexture(),Ub=v.createTexture()}catch(g){H.debug(g)}v||e("WebGL context is not supported on this browser."),v.viewport(0,0,j.width,j.height),v.enable(v.DEPTH_TEST),v.enable(v.BLEND),v.blendFunc(v.SRC_ALPHA,v.ONE_MINUS_SRC_ALPHA),Fb=sd(v,id,jd),Gb=sd(v,gd,hd),t.strokeWeight(1),Eb=sd(v,ld,md),v.useProgram(Eb),od("usingTexture3d",Eb,"usingTexture",Xb),t.lightFalloff(1,0,0),t.shininess(1),t.ambient(255,255,255),t.specular(0,0,0),t.emissive(0,0,0),Hb=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Hb),v.bufferData(v.ARRAY_BUFFER,bd,v.STATIC_DRAW),Ib=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Ib),v.bufferData(v.ARRAY_BUFFER,dd,v.STATIC_DRAW),Jb=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Jb),v.bufferData(v.ARRAY_BUFFER,cd,v.STATIC_DRAW),Kb=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Kb),v.bufferData(v.ARRAY_BUFFER,ed,v.STATIC_DRAW),Lb=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Lb),v.bufferData(v.ARRAY_BUFFER,fd,v.STATIC_DRAW),Mb=v.createBuffer(),Nb=v.createBuffer(),Ob=v.createBuffer(),Pb=v.createBuffer(),Qb=v.createBuffer(),Sb=v.createBuffer(),Rb=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Rb),v.bufferData(v.ARRAY_BUFFER,new k([0,0,0]),v.STATIC_DRAW),Yb=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Yb),v.bufferData(v.ARRAY_BUFFER,new k([1,1,0,-1,1,0,-1,-1,0,1,-1,0]),v.STATIC_DRAW),Zb=v.createBuffer(),v.bindBuffer(v.ARRAY_BUFFER,Zb),v.bufferData(v.ARRAY_BUFFER,new k([0,0,1,0,1,1,0,1]),v.STATIC_DRAW),$b=v.createBuffer(),v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,$b),v.bufferData(v.ELEMENT_ARRAY_BUFFER,new m([0,1,2,2,3,0]),v.STATIC_DRAW),Ec=new Ld,Fc=new Ld,Gc=new Ld,Hc=new Ld,Lc=new Ld,t.camera(),t.perspective(),Ic=new Md,Jc=new Md,xb=new Ld,yb=new Ld,zb=new Ld,Ab=new Ld,Bb=new Ld,Cb=new Ld,Cb.set(-1,3,-3,1,3,-6,3,0,-3,3,0,0,1,0,0,0),xd.prototype.size.apply(this,arguments)}}(),yd.prototype.ambientLight=xd.prototype.a3DOnlyFunction,zd.prototype.ambientLight=function(a,b,c,d,f,g){uc===o.MAX_LIGHTS&&e("can only create "+o.MAX_LIGHTS+" lights");var h=new u(d,f,g),i=new Ld;i.scale(1,-1,1),i.apply(Gc.array()),i.mult(h,h);var j=Nd(a,b,c,0),k=[((j&o.RED_MASK)>>>16)/255,((j&o.GREEN_MASK)>>>8)/255,(j&o.BLUE_MASK)/255];v.useProgram(Eb),nd("uLights.color.3d."+uc,Eb,"uLights"+uc+".color",k),nd("uLights.position.3d."+uc,Eb,"uLights"+uc+".position",h.array()),od("uLights.type.3d."+uc,Eb,"uLights"+uc+".type",0),od("uLightCount3d",Eb,"uLightCount",++uc)},yd.prototype.directionalLight=xd.prototype.a3DOnlyFunction,zd.prototype.directionalLight=function(a,b,c,d,f,g){uc===o.MAX_LIGHTS&&e("can only create "+o.MAX_LIGHTS+" lights"),v.useProgram(Eb);var h=new Ld;h.scale(1,-1,1),h.apply(Gc.array()),h=h.array();var i=[h[0]*d+h[4]*f+h[8]*g,h[1]*d+h[5]*f+h[9]*g,h[2]*d+h[6]*f+h[10]*g],j=Nd(a,b,c,0),k=[((j&o.RED_MASK)>>>16)/255,((j&o.GREEN_MASK)>>>8)/255,(j&o.BLUE_MASK)/255];nd("uLights.color.3d."+uc,Eb,"uLights"+uc+".color",k),nd("uLights.position.3d."+uc,Eb,"uLights"+uc+".position",i),od("uLights.type.3d."+uc,Eb,"uLights"+uc+".type",1),od("uLightCount3d",Eb,"uLightCount",++uc)},yd.prototype.lightFalloff=xd.prototype.a3DOnlyFunction,zd.prototype.lightFalloff=function(a,b,c){v.useProgram(Eb),nd("uFalloff3d",Eb,"uFalloff",[a,b,c])},yd.prototype.lightSpecular=xd.prototype.a3DOnlyFunction,zd.prototype.lightSpecular=function(a,b,c){var d=Nd(a,b,c,0),e=[((d&o.RED_MASK)>>>16)/255,((d&o.GREEN_MASK)>>>8)/255,(d&o.BLUE_MASK)/255];v.useProgram(Eb),nd("uSpecular3d",Eb,"uSpecular",e)},t.lights=function(){t.ambientLight(128,128,128),t.directionalLight(128,128,128,0,0,-1),t.lightFalloff(1,0,0),t.lightSpecular(0,0,0)},yd.prototype.pointLight=xd.prototype.a3DOnlyFunction,zd.prototype.pointLight=function(a,b,c,d,f,g){uc===o.MAX_LIGHTS&&e("can only create "+o.MAX_LIGHTS+" lights");var h=new u(d,f,g),i=new Ld;i.scale(1,-1,1),i.apply(Gc.array()),i.mult(h,h);var j=Nd(a,b,c,0),k=[((j&o.RED_MASK)>>>16)/255,((j&o.GREEN_MASK)>>>8)/255,(j&o.BLUE_MASK)/255];v.useProgram(Eb),nd("uLights.color.3d."+uc,Eb,"uLights"+uc+".color",k),nd("uLights.position.3d."+uc,Eb,"uLights"+uc+".position",h.array()),od("uLights.type.3d."+uc,Eb,"uLights"+uc+".type",2),od("uLightCount3d",Eb,"uLightCount",++uc)},yd.prototype.noLights=xd.prototype.a3DOnlyFunction,zd.prototype.noLights=function(){uc=0,v.useProgram(Eb),od("uLightCount3d",Eb,"uLightCount",uc)},yd.prototype.spotLight=xd.prototype.a3DOnlyFunction,zd.prototype.spotLight=function(a,b,c,d,f,g,h,i,j,k,l){uc===o.MAX_LIGHTS&&e("can only create "+o.MAX_LIGHTS+" lights"),v.useProgram(Eb);var m=new u(d,f,g),n=new Ld;n.scale(1,-1,1),n.apply(Gc.array()),n.mult(m,m),n=n.array();var p=[n[0]*h+n[4]*i+n[8]*j,n[1]*h+n[5]*i+n[9]*j,n[2]*h+n[6]*i+n[10]*j],q=Nd(a,b,c,0),r=[((q&o.RED_MASK)>>>16)/255,((q&o.GREEN_MASK)>>>8)/255,(q&o.BLUE_MASK)/255];nd("uLights.color.3d."+uc,Eb,"uLights"+uc+".color",r),nd("uLights.position.3d."+uc,Eb,"uLights"+uc+".position",m.array()),nd("uLights.direction.3d."+uc,Eb,"uLights"+uc+".direction",p),nd("uLights.concentration.3d."+uc,Eb,"uLights"+uc+".concentration",l),nd("uLights.angle.3d."+uc,Eb,"uLights"+uc+".angle",k),od("uLights.type.3d."+uc,Eb,"uLights"+uc+".type",3),od("uLightCount3d",Eb,"uLightCount",++uc)},yd.prototype.beginCamera=function(){e("beginCamera() is not available in 2D mode")},zd.prototype.beginCamera=function(){Mc&&e("You cannot call beginCamera() again before calling endCamera()"),Mc=!0,Gc=Fc,Hc=Ec},yd.prototype.endCamera=function(){e("endCamera() is not available in 2D mode")},zd.prototype.endCamera=function(){Mc||e("You cannot call endCamera() before calling beginCamera()"),Gc.set(Ec),Hc.set(Fc),Mc=!1},t.camera=function(a,b,e,f,g,h,i,j,k){a===d&&(Pc=t.width/2,Qc=t.height/2,Rc=Qc/c.tan(Oc/2),a=Pc,b=Qc,e=Rc,f=Pc,g=Qc,h=0,i=0,j=1,k=0);var l=new u(a-f,b-g,e-h),m=new u(i,j,k);l.normalize();var n=u.cross(m,l);m=u.cross(l,n),n.normalize(),m.normalize();var o=n.x,p=n.y,q=n.z,r=m.x,s=m.y,v=m.z,w=l.x,x=l.y,y=l.z;Ec.set(o,p,q,0,r,s,v,0,w,x,y,0,0,0,0,1),Ec.translate(-a,-b,-e),Fc.reset(),Fc.invApply(o,p,q,0,r,s,v,0,w,x,y,0,0,0,0,1),Fc.translate(a,b,e),Gc.set(Ec),Hc.set(Fc)},t.perspective=function(a,b,d,e){0===arguments.length&&(Qc=j.height/2,Rc=Qc/c.tan(Oc/2),Sc=Rc/10,Tc=10*Rc,Uc=t.width/t.height,a=Oc,b=Uc,d=Sc,e=Tc);var f,g,h,i;f=d*c.tan(a/2),g=-f,h=f*b,i=g*b,t.frustum(i,h,g,f,d,e)},yd.prototype.frustum=function(){e("Processing.js: frustum() is not supported in 2D mode")},zd.prototype.frustum=function(a,b,c,d,e,f){Nc=!0,Lc=new Ld,Lc.set(2*e/(b-a),0,(b+a)/(b-a),0,0,2*e/(d-c),(d+c)/(d-c),0,0,0,-(f+e)/(f-e),-(2*f*e)/(f-e),0,0,-1,0);var g=new Ld;g.set(Lc),g.transpose(),v.useProgram(Fb),pd("projection2d",Fb,"uProjection",!1,g.array()),v.useProgram(Eb),pd("projection3d",Eb,"uProjection",!1,g.array()),v.useProgram(Gb),pd("uProjectionUS",Gb,"uProjection",!1,g.array())},t.ortho=function(a,b,c,d,e,f){0===arguments.length&&(a=0,b=t.width,c=0,d=t.height,e=-10,f=10);var g=2/(b-a),h=2/(d-c),i=-2/(f-e),j=-(b+a)/(b-a),k=-(d+c)/(d-c),l=-(f+e)/(f-e);Lc=new Ld,Lc.set(g,0,0,j,0,h,0,k,0,0,i,l,0,0,0,1);var m=new Ld;m.set(Lc),m.transpose(),v.useProgram(Fb),pd("projection2d",Fb,"uProjection",!1,m.array()),v.useProgram(Eb),pd("projection3d",Eb,"uProjection",!1,m.array()),v.useProgram(Gb),pd("uProjectionUS",Gb,"uProjection",!1,m.array()),Nc=!1},t.printProjection=function(){Lc.print()},t.printCamera=function(){Ec.print()},yd.prototype.box=xd.prototype.a3DOnlyFunction,zd.prototype.box=function(a,b,c){b&&c||(b=c=a);var d=new Ld;d.scale(a,b,c);var e=new Ld;if(e.scale(1,-1,1),e.apply(Gc.array()),e.transpose(),z){if(v.useProgram(Eb),pd("model3d",Eb,"uModel",!1,d.array()),pd("view3d",Eb,"uView",!1,e.array()),v.enable(v.POLYGON_OFFSET_FILL),v.polygonOffset(1,1),nd("color3d",Eb,"uColor",B),uc>0){var f=new Ld;f.set(e);var g=new Ld;g.set(d),f.mult(g);var h=new Ld;h.set(f),h.invert(),h.transpose(),pd("uNormalTransform3d",Eb,"uNormalTransform",!1,h.array()),qd("aNormal3d",Eb,"aNormal",3,Ib)}else rd("aNormal3d",Eb,"aNormal");qd("aVertex3d",Eb,"aVertex",3,Hb),rd("aColor3d",Eb,"aColor"),rd("aTexture3d",Eb,"aTexture"),v.drawArrays(v.TRIANGLES,0,bd.length/3),v.disable(v.POLYGON_OFFSET_FILL)}M>0&&I&&(v.useProgram(Fb),pd("uModel2d",Fb,"uModel",!1,d.array()),pd("uView2d",Fb,"uView",!1,e.array()),nd("uColor2d",Fb,"uColor",J),od("uIsDrawingText2d",Fb,"uIsDrawingText",!1),qd("vertex2d",Fb,"aVertex",3,Jb),rd("aTextureCoord2d",Fb,"aTextureCoord"),v.drawArrays(v.LINES,0,cd.length/3))};var ie=function(){var a;for(Cc=[],a=0;wc>a;a++)Cc.push(0),Cc.push(-1),Cc.push(0),Cc.push(xc[a]),Cc.push(yc[a]),Cc.push(zc[a]);Cc.push(0),Cc.push(-1),Cc.push(0),Cc.push(xc[0]),Cc.push(yc[0]),Cc.push(zc[0]);var b,c,d,e=0;for(a=2;vc>a;a++){b=c=e,e+=wc,d=e;for(var f=0;wc>f;f++)Cc.push(xc[b]),Cc.push(yc[b]),Cc.push(zc[b++]),Cc.push(xc[d]),Cc.push(yc[d]),Cc.push(zc[d++]);b=c,d=e,Cc.push(xc[b]),Cc.push(yc[b]),Cc.push(zc[b]),Cc.push(xc[d]),Cc.push(yc[d]),Cc.push(zc[d])}for(a=0;wc>a;a++)d=e+a,Cc.push(xc[d]),Cc.push(yc[d]),Cc.push(zc[d]),Cc.push(0),Cc.push(1),Cc.push(0);Cc.push(xc[e]),Cc.push(yc[e]),Cc.push(zc[e]),Cc.push(0),Cc.push(1),Cc.push(0),v.bindBuffer(v.ARRAY_BUFFER,Mb),v.bufferData(v.ARRAY_BUFFER,new k(Cc),v.STATIC_DRAW)};t.sphereDetail=function(a,b){var c;if(1===arguments.length&&(a=b=arguments[0]),3>a&&(a=3),2>b&&(b=2),a!==wc||b!==vc){var d=o.SINCOS_LENGTH/a,e=new k(a),f=new k(a);for(c=0;a>c;c++)e[c]=Bc[0|c*d%o.SINCOS_LENGTH],f[c]=Ac[0|c*d%o.SINCOS_LENGTH];var g=a*(b-1)+2,h=0;xc=new k(g),yc=new k(g),zc=new k(g);var i=.5*o.SINCOS_LENGTH/b,j=i;for(c=1;b>c;c++){for(var l=Ac[0|j%o.SINCOS_LENGTH],m=-Bc[0|j%o.SINCOS_LENGTH],n=0;a>n;n++)xc[h]=e[n]*l,yc[h]=m,zc[h++]=f[n]*l;j+=i}wc=a,vc=b,ie()}},yd.prototype.sphere=xd.prototype.a3DOnlyFunction,zd.prototype.sphere=function(){var a=arguments[0];(3>wc||2>vc)&&t.sphereDetail(30);var b=new Ld;b.scale(a,a,a);var c=new Ld;if(c.scale(1,-1,1),c.apply(Gc.array()),c.transpose(),z){if(uc>0){var d=new Ld;d.set(c);var e=new Ld;e.set(b),d.mult(e);var f=new Ld;f.set(d),f.invert(),f.transpose(),pd("uNormalTransform3d",Eb,"uNormalTransform",!1,f.array()),qd("aNormal3d",Eb,"aNormal",3,Mb)}else rd("aNormal3d",Eb,"aNormal");v.useProgram(Eb),rd("aTexture3d",Eb,"aTexture"),pd("uModel3d",Eb,"uModel",!1,b.array()),pd("uView3d",Eb,"uView",!1,c.array()),qd("aVertex3d",Eb,"aVertex",3,Mb),rd("aColor3d",Eb,"aColor"),v.enable(v.POLYGON_OFFSET_FILL),v.polygonOffset(1,1),nd("uColor3d",Eb,"uColor",B),v.drawArrays(v.TRIANGLE_STRIP,0,Cc.length/3),v.disable(v.POLYGON_OFFSET_FILL)}M>0&&I&&(v.useProgram(Fb),pd("uModel2d",Fb,"uModel",!1,b.array()),pd("uView2d",Fb,"uView",!1,c.array()),qd("aVertex2d",Fb,"aVertex",3,Mb),rd("aTextureCoord2d",Fb,"aTextureCoord"),nd("uColor2d",Fb,"uColor",J),od("uIsDrawingText",Fb,"uIsDrawingText",!1),v.drawArrays(v.LINE_STRIP,0,Cc.length/3))},t.modelX=function(a,b,c){var d=Gc.array(),e=Fc.array(),f=d[0]*a+d[1]*b+d[2]*c+d[3],g=d[4]*a+d[5]*b+d[6]*c+d[7],h=d[8]*a+d[9]*b+d[10]*c+d[11],i=d[12]*a+d[13]*b+d[14]*c+d[15],j=e[0]*f+e[1]*g+e[2]*h+e[3]*i,k=e[12]*f+e[13]*g+e[14]*h+e[15]*i;return 0!==k?j/k:j},t.modelY=function(a,b,c){var d=Gc.array(),e=Fc.array(),f=d[0]*a+d[1]*b+d[2]*c+d[3],g=d[4]*a+d[5]*b+d[6]*c+d[7],h=d[8]*a+d[9]*b+d[10]*c+d[11],i=d[12]*a+d[13]*b+d[14]*c+d[15],j=e[4]*f+e[5]*g+e[6]*h+e[7]*i,k=e[12]*f+e[13]*g+e[14]*h+e[15]*i;return 0!==k?j/k:j},t.modelZ=function(a,b,c){var d=Gc.array(),e=Fc.array(),f=d[0]*a+d[1]*b+d[2]*c+d[3],g=d[4]*a+d[5]*b+d[6]*c+d[7],h=d[8]*a+d[9]*b+d[10]*c+d[11],i=d[12]*a+d[13]*b+d[14]*c+d[15],j=e[8]*f+e[9]*g+e[10]*h+e[11]*i,k=e[12]*f+e[13]*g+e[14]*h+e[15]*i;return 0!==k?j/k:j},yd.prototype.ambient=xd.prototype.a3DOnlyFunction,zd.prototype.ambient=function(a,b,c){v.useProgram(Eb),od("uUsingMat3d",Eb,"uUsingMat",!0);var d=t.color(a,b,c);nd("uMaterialAmbient3d",Eb,"uMaterialAmbient",t.color.toGLArray(d).slice(0,3))},yd.prototype.emissive=xd.prototype.a3DOnlyFunction,zd.prototype.emissive=function(a,b,c){v.useProgram(Eb),od("uUsingMat3d",Eb,"uUsingMat",!0);var d=t.color(a,b,c);nd("uMaterialEmissive3d",Eb,"uMaterialEmissive",t.color.toGLArray(d).slice(0,3))},yd.prototype.shininess=xd.prototype.a3DOnlyFunction,zd.prototype.shininess=function(a){v.useProgram(Eb),od("uUsingMat3d",Eb,"uUsingMat",!0),nd("uShininess3d",Eb,"uShininess",a)},yd.prototype.specular=xd.prototype.a3DOnlyFunction,zd.prototype.specular=function(a,b,c){v.useProgram(Eb),od("uUsingMat3d",Eb,"uUsingMat",!0);var d=t.color(a,b,c);nd("uMaterialSpecular3d",Eb,"uMaterialSpecular",t.color.toGLArray(d).slice(0,3))},t.screenX=function(a,b,c){var d=Gc.array();if(16===d.length){var e=d[0]*a+d[1]*b+d[2]*c+d[3],f=d[4]*a+d[5]*b+d[6]*c+d[7],g=d[8]*a+d[9]*b+d[10]*c+d[11],h=d[12]*a+d[13]*b+d[14]*c+d[15],i=Lc.array(),j=i[0]*e+i[1]*f+i[2]*g+i[3]*h,k=i[12]*e+i[13]*f+i[14]*g+i[15]*h;return 0!==k&&(j/=k),t.width*(1+j)/2}return Gc.multX(a,b)},t.screenY=function(a,b,c){var d=Gc.array();if(16===d.length){var e=d[0]*a+d[1]*b+d[2]*c+d[3],f=d[4]*a+d[5]*b+d[6]*c+d[7],g=d[8]*a+d[9]*b+d[10]*c+d[11],h=d[12]*a+d[13]*b+d[14]*c+d[15],i=Lc.array(),j=i[4]*e+i[5]*f+i[6]*g+i[7]*h,k=i[12]*e+i[13]*f+i[14]*g+i[15]*h;return 0!==k&&(j/=k),t.height*(1+j)/2}return Gc.multY(a,b)},t.screenZ=function(a,b,c){var d=Gc.array();if(16!==d.length)return 0;var e=Lc.array(),f=d[0]*a+d[1]*b+d[2]*c+d[3],g=d[4]*a+d[5]*b+d[6]*c+d[7],h=d[8]*a+d[9]*b+d[10]*c+d[11],i=d[12]*a+d[13]*b+d[14]*c+d[15],j=e[8]*f+e[9]*g+e[10]*h+e[11]*i,k=e[12]*f+e[13]*g+e[14]*h+e[15]*i;return 0!==k&&(j/=k),(j+1)/2},xd.prototype.fill=function(){var a=t.color(arguments[0],arguments[1],arguments[2],arguments[3]);a===C&&z||(z=!0,C=a)},yd.prototype.fill=function(){xd.prototype.fill.apply(this,arguments),F=!0},zd.prototype.fill=function(){xd.prototype.fill.apply(this,arguments),B=t.color.toGLArray(C)},t.noFill=function(){z=!1},xd.prototype.stroke=function(){var a=t.color(arguments[0],arguments[1],arguments[2],arguments[3]);a===K&&I||(I=!0,K=a)},yd.prototype.stroke=function(){xd.prototype.stroke.apply(this,arguments),L=!0},zd.prototype.stroke=function(){xd.prototype.stroke.apply(this,arguments),J=t.color.toGLArray(K)},t.noStroke=function(){I=!1},xd.prototype.strokeWeight=function(a){M=a},yd.prototype.strokeWeight=function(a){xd.prototype.strokeWeight.apply(this,arguments),v.lineWidth=a},zd.prototype.strokeWeight=function(a){xd.prototype.strokeWeight.apply(this,arguments),v.useProgram(Fb),nd("pointSize2d",Fb,"uPointSize",a),v.useProgram(Gb),nd("pointSizeUnlitShape",Gb,"uPointSize",a),v.lineWidth(a)},t.strokeCap=function(a){y.$ensureContext().lineCap=a},t.strokeJoin=function(a){y.$ensureContext().lineJoin=a},yd.prototype.smooth=function(){O=!0;var a=j.style;a.setProperty("image-rendering","optimizeQuality","important"),a.setProperty("-ms-interpolation-mode","bicubic","important"),v.hasOwnProperty("mozImageSmoothingEnabled")&&(v.mozImageSmoothingEnabled=!0)},zd.prototype.smooth=function(){O=!0},yd.prototype.noSmooth=function(){O=!1;var a=j.style;a.setProperty("image-rendering","optimizeSpeed","important"),a.setProperty("image-rendering","-moz-crisp-edges","important"),a.setProperty("image-rendering","-webkit-optimize-contrast","important"),a.setProperty("image-rendering","optimize-contrast","important"),a.setProperty("-ms-interpolation-mode","nearest-neighbor","important"),v.hasOwnProperty("mozImageSmoothingEnabled")&&(v.mozImageSmoothingEnabled=!1)},zd.prototype.noSmooth=function(){O=!1},yd.prototype.point=function(a,b){I&&(a=c.round(a),b=c.round(b),v.fillStyle=t.color.toString(K),F=!0,M>1?(v.beginPath(),v.arc(a,b,M/2,0,o.TWO_PI,!1),v.fill()):v.fillRect(a,b,1,1))},zd.prototype.point=function(a,b,c){var d=new Ld;d.translate(a,b,c||0),d.transpose();var e=new Ld;e.scale(1,-1,1),e.apply(Gc.array()),e.transpose(),v.useProgram(Fb),pd("uModel2d",Fb,"uModel",!1,d.array()),pd("uView2d",Fb,"uView",!1,e.array()),M>0&&I&&(nd("uColor2d",Fb,"uColor",J),od("uIsDrawingText2d",Fb,"uIsDrawingText",!1),od("uSmooth2d",Fb,"uSmooth",O),qd("aVertex2d",Fb,"aVertex",3,Rb),rd("aTextureCoord2d",Fb,"aTextureCoord"),v.drawArrays(v.POINTS,0,1))},t.beginShape=function(a){_=a,bb=[],Vc=[]},yd.prototype.vertex=function(a,b,c){var d=[];$c&&($c=!1),d.isVert=!0,d[0]=a,d[1]=b,d[2]=0,d[3]=0,d[4]=0,d[5]=C,d[6]=K,Vc.push(d),c&&(Vc[Vc.length-1].moveTo=c)},zd.prototype.vertex=function(a,b,c,e,f){var g=[];$c&&($c=!1),g.isVert=!0,f===d&&Xb&&(f=e,e=c,c=0),e!==d&&f!==d&&(Wb===o.IMAGE&&(e/=Vb.width,f/=Vb.height),e=e>1?1:e,e=0>e?0:e,f=f>1?1:f,f=0>f?0:f),g[0]=a,g[1]=b,g[2]=c||0,g[3]=e||0,g[4]=f||0,g[5]=B[0],g[6]=B[1],g[7]=B[2],g[8]=B[3],g[9]=J[0],g[10]=J[1],g[11]=J[2],g[12]=J[3],g[13]=T,g[14]=U,g[15]=V,Vc.push(g)};var ne=function(a,b){var c=new Ld;c.scale(1,-1,1),c.apply(Gc.array()),c.transpose(),v.useProgram(Gb),pd("uViewUS",Gb,"uView",!1,c.array()),od("uSmoothUS",Gb,"uSmooth",O),qd("aVertexUS",Gb,"aVertex",3,Rb),v.bufferData(v.ARRAY_BUFFER,new k(a),v.STREAM_DRAW),qd("aColorUS",Gb,"aColor",4,Pb),v.bufferData(v.ARRAY_BUFFER,new k(b),v.STREAM_DRAW),v.drawArrays(v.POINTS,0,a.length/3)},oe=function(a,b,c){var d;d="LINES"===b?v.LINES:"LINE_LOOP"===b?v.LINE_LOOP:v.LINE_STRIP;var e=new Ld;e.scale(1,-1,1),e.apply(Gc.array()),e.transpose(),v.useProgram(Gb),pd("uViewUS",Gb,"uView",!1,e.array()),qd("aVertexUS",Gb,"aVertex",3,Nb),v.bufferData(v.ARRAY_BUFFER,new k(a),v.STREAM_DRAW),qd("aColorUS",Gb,"aColor",4,Qb),v.bufferData(v.ARRAY_BUFFER,new k(c),v.STREAM_DRAW),v.drawArrays(d,0,a.length/3)},pe=function(a,b,c,d){var e;e="TRIANGLES"===b?v.TRIANGLES:"TRIANGLE_FAN"===b?v.TRIANGLE_FAN:v.TRIANGLE_STRIP;var f=new Ld;f.scale(1,-1,1),f.apply(Gc.array()),f.transpose(),v.useProgram(Eb),pd("model3d",Eb,"uModel",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),pd("view3d",Eb,"uView",!1,f.array()),v.enable(v.POLYGON_OFFSET_FILL),v.polygonOffset(1,1),nd("color3d",Eb,"uColor",[-1,0,0,0]),qd("vertex3d",Eb,"aVertex",3,Ob),v.bufferData(v.ARRAY_BUFFER,new k(a),v.STREAM_DRAW),Xb&&null!==qb&&rb(c),qd("aColor3d",Eb,"aColor",4,Pb),v.bufferData(v.ARRAY_BUFFER,new k(c),v.STREAM_DRAW),rd("aNormal3d",Eb,"aNormal"),Xb&&(od("uUsingTexture3d",Eb,"uUsingTexture",Xb),qd("aTexture3d",Eb,"aTexture",2,Sb),v.bufferData(v.ARRAY_BUFFER,new k(d),v.STREAM_DRAW)),v.drawArrays(e,0,a.length/3),v.disable(v.POLYGON_OFFSET_FILL)};yd.prototype.endShape=function(a){if(0!==Vc.length){var b=a===o.CLOSE;b&&Vc.push(Vc[0]);var i,e=[],f=[],g=[],h=[];$c=!0;var j,k,m=Vc.length;for(j=0;m>j;j++)for(i=Vc[j],k=0;3>k;k++)e.push(i[k]);for(j=0;m>j;j++)for(i=Vc[j],k=5;9>k;k++)f.push(i[k]);for(j=0;m>j;j++)for(i=Vc[j],k=9;13>k;k++)g.push(i[k]);for(j=0;m>j;j++)i=Vc[j],h.push(i[3]),h.push(i[4]);if(!Yc||_!==o.POLYGON&&_!==d)if(!Zc||_!==o.POLYGON&&_!==d)if(_===o.POINTS)for(j=0;m>j;j++)i=Vc[j],I&&t.stroke(i[6]),t.point(i[0],i[1]);else if(_===o.LINES)for(j=0;m>j+1;j+=2)i=Vc[j],I&&t.stroke(Vc[j+1][6]),t.line(i[0],i[1],Vc[j+1][0],Vc[j+1][1]);else if(_===o.TRIANGLES)for(j=0;m>j+2;j+=3)i=Vc[j],v.beginPath(),v.moveTo(i[0],i[1]),v.lineTo(Vc[j+1][0],Vc[j+1][1]),v.lineTo(Vc[j+2][0],Vc[j+2][1]),v.lineTo(i[0],i[1]),z&&(t.fill(Vc[j+2][5]),le()),I&&(t.stroke(Vc[j+2][6]),me()),v.closePath();else if(_===o.TRIANGLE_STRIP)for(j=0;m>j+1;j++)i=Vc[j],v.beginPath(),v.moveTo(Vc[j+1][0],Vc[j+1][1]),v.lineTo(i[0],i[1]),I&&t.stroke(Vc[j+1][6]),z&&t.fill(Vc[j+1][5]),m>j+2&&(v.lineTo(Vc[j+2][0],Vc[j+2][1]),I&&t.stroke(Vc[j+2][6]),z&&t.fill(Vc[j+2][5])),qe();else if(_===o.TRIANGLE_FAN){if(m>2)for(v.beginPath(),v.moveTo(Vc[0][0],Vc[0][1]),v.lineTo(Vc[1][0],Vc[1][1]),v.lineTo(Vc[2][0],Vc[2][1]),z&&(t.fill(Vc[2][5]),le()),I&&(t.stroke(Vc[2][6]),me()),v.closePath(),j=3;m>j;j++)i=Vc[j],v.beginPath(),v.moveTo(Vc[0][0],Vc[0][1]),v.lineTo(Vc[j-1][0],Vc[j-1][1]),v.lineTo(i[0],i[1]),z&&(t.fill(i[5]),le()),I&&(t.stroke(i[6]),me()),v.closePath()
}else if(_===o.QUADS)for(j=0;m>j+3;j+=4){for(i=Vc[j],v.beginPath(),v.moveTo(i[0],i[1]),k=1;4>k;k++)v.lineTo(Vc[j+k][0],Vc[j+k][1]);v.lineTo(i[0],i[1]),z&&(t.fill(Vc[j+3][5]),le()),I&&(t.stroke(Vc[j+3][6]),me()),v.closePath()}else if(_===o.QUAD_STRIP){if(m>3)for(j=0;m>j+1;j+=2)i=Vc[j],v.beginPath(),m>j+3?(v.moveTo(Vc[j+2][0],Vc[j+2][1]),v.lineTo(i[0],i[1]),v.lineTo(Vc[j+1][0],Vc[j+1][1]),v.lineTo(Vc[j+3][0],Vc[j+3][1]),z&&t.fill(Vc[j+3][5]),I&&t.stroke(Vc[j+3][6])):(v.moveTo(i[0],i[1]),v.lineTo(Vc[j+1][0],Vc[j+1][1])),qe()}else{for(v.beginPath(),v.moveTo(Vc[0][0],Vc[0][1]),j=1;m>j;j++)i=Vc[j],i.isVert&&(i.moveTo?v.moveTo(i[0],i[1]):v.lineTo(i[0],i[1]));qe()}else{for(v.beginPath(),j=0;m>j;j++)i=Vc[j],Vc[j].isVert?Vc[j].moveTo?v.moveTo(i[0],i[1]):v.lineTo(i[0],i[1]):v.bezierCurveTo(Vc[j][0],Vc[j][1],Vc[j][2],Vc[j][3],Vc[j][4],Vc[j][5]);qe()}else if(m>3){var n=[],p=1-cb;for(v.beginPath(),v.moveTo(Vc[1][0],Vc[1][1]),j=1;m>j+2;j++)i=Vc[j],n[0]=[i[0],i[1]],n[1]=[i[0]+(p*Vc[j+1][0]-p*Vc[j-1][0])/6,i[1]+(p*Vc[j+1][1]-p*Vc[j-1][1])/6],n[2]=[Vc[j+1][0]+(p*Vc[j][0]-p*Vc[j+2][0])/6,Vc[j+1][1]+(p*Vc[j][1]-p*Vc[j+2][1])/6],n[3]=[Vc[j+1][0],Vc[j+1][1]],v.bezierCurveTo(n[1][0],n[1][1],n[2][0],n[2][1],n[3][0],n[3][1]);qe()}Yc=!1,Zc=!1,Wc=[],Xc=0,b&&Vc.pop()}},zd.prototype.endShape=function(a){if(0!==Vc.length){var i,b=a===o.CLOSE,c=[],e=[],f=[],g=[],h=[];$c=!0;var j,k,l,m=Vc.length;for(j=0;m>j;j++)for(i=Vc[j],k=0;3>k;k++)e.push(i[k]);for(j=0;m>j;j++)for(i=Vc[j],k=5;9>k;k++)f.push(i[k]);for(j=0;m>j;j++)for(i=Vc[j],k=9;13>k;k++)g.push(i[k]);for(j=0;m>j;j++)i=Vc[j],h.push(i[3]),h.push(i[4]);if(b){for(e.push(Vc[0][0]),e.push(Vc[0][1]),e.push(Vc[0][2]),j=5;9>j;j++)f.push(Vc[0][j]);for(j=9;13>j;j++)g.push(Vc[0][j]);h.push(Vc[0][3]),h.push(Vc[0][4])}if(!Yc||_!==o.POLYGON&&_!==d)if(!Zc||_!==o.POLYGON&&_!==d){if(_===o.POINTS){for(j=0;m>j;j++)for(i=Vc[j],k=0;3>k;k++)c.push(i[k]);ne(c,g)}else if(_===o.LINES){for(j=0;m>j;j++)for(i=Vc[j],k=0;3>k;k++)c.push(i[k]);for(j=0;m>j;j++)for(i=Vc[j],k=5;9>k;k++)f.push(i[k]);oe(c,"LINES",g)}else if(_===o.TRIANGLES){if(m>2)for(j=0;m>j+2;j+=3){for(e=[],h=[],c=[],f=[],g=[],k=0;3>k;k++)for(l=0;3>l;l++)c.push(Vc[j+k][l]),e.push(Vc[j+k][l]);for(k=0;3>k;k++)for(l=3;5>l;l++)h.push(Vc[j+k][l]);for(k=0;3>k;k++)for(l=5;9>l;l++)f.push(Vc[j+k][l]),g.push(Vc[j+k][l+4]);I&&oe(c,"LINE_LOOP",g),(z||Xb)&&pe(e,"TRIANGLES",f,h)}}else if(_===o.TRIANGLE_STRIP){if(m>2)for(j=0;m>j+2;j++){for(c=[],e=[],g=[],f=[],h=[],k=0;3>k;k++)for(l=0;3>l;l++)c.push(Vc[j+k][l]),e.push(Vc[j+k][l]);for(k=0;3>k;k++)for(l=3;5>l;l++)h.push(Vc[j+k][l]);for(k=0;3>k;k++)for(l=5;9>l;l++)g.push(Vc[j+k][l+4]),f.push(Vc[j+k][l]);(z||Xb)&&pe(e,"TRIANGLE_STRIP",f,h),I&&oe(c,"LINE_LOOP",g)}}else if(_===o.TRIANGLE_FAN){if(m>2){for(j=0;3>j;j++)for(i=Vc[j],k=0;3>k;k++)c.push(i[k]);for(j=0;3>j;j++)for(i=Vc[j],k=9;13>k;k++)g.push(i[k]);for(I&&oe(c,"LINE_LOOP",g),j=2;m>j+1;j++){for(c=[],g=[],c.push(Vc[0][0]),c.push(Vc[0][1]),c.push(Vc[0][2]),g.push(Vc[0][9]),g.push(Vc[0][10]),g.push(Vc[0][11]),g.push(Vc[0][12]),k=0;2>k;k++)for(l=0;3>l;l++)c.push(Vc[j+k][l]);for(k=0;2>k;k++)for(l=9;13>l;l++)g.push(Vc[j+k][l]);I&&oe(c,"LINE_STRIP",g)}(z||Xb)&&pe(e,"TRIANGLE_FAN",f,h)}}else if(_===o.QUADS)for(j=0;m>j+3;j+=4){for(c=[],k=0;4>k;k++)for(i=Vc[j+k],l=0;3>l;l++)c.push(i[l]);if(I&&oe(c,"LINE_LOOP",g),z){for(e=[],f=[],h=[],k=0;3>k;k++)e.push(Vc[j][k]);for(k=5;9>k;k++)f.push(Vc[j][k]);for(k=0;3>k;k++)e.push(Vc[j+1][k]);for(k=5;9>k;k++)f.push(Vc[j+1][k]);for(k=0;3>k;k++)e.push(Vc[j+3][k]);for(k=5;9>k;k++)f.push(Vc[j+3][k]);for(k=0;3>k;k++)e.push(Vc[j+2][k]);for(k=5;9>k;k++)f.push(Vc[j+2][k]);Xb&&(h.push(Vc[j+0][3]),h.push(Vc[j+0][4]),h.push(Vc[j+1][3]),h.push(Vc[j+1][4]),h.push(Vc[j+3][3]),h.push(Vc[j+3][4]),h.push(Vc[j+2][3]),h.push(Vc[j+2][4])),pe(e,"TRIANGLE_STRIP",f,h)}}else if(_===o.QUAD_STRIP){var n=[];if(m>3){for(j=0;2>j;j++)for(i=Vc[j],k=0;3>k;k++)c.push(i[k]);for(j=0;2>j;j++)for(i=Vc[j],k=9;13>k;k++)g.push(i[k]);for(oe(c,"LINE_STRIP",g),m>4&&m%2>0&&(n=e.splice(e.length-3),Vc.pop()),j=0;m>j+3;j+=2){for(c=[],g=[],k=0;3>k;k++)c.push(Vc[j+1][k]);for(k=0;3>k;k++)c.push(Vc[j+3][k]);for(k=0;3>k;k++)c.push(Vc[j+2][k]);for(k=0;3>k;k++)c.push(Vc[j+0][k]);for(k=9;13>k;k++)g.push(Vc[j+1][k]);for(k=9;13>k;k++)g.push(Vc[j+3][k]);for(k=9;13>k;k++)g.push(Vc[j+2][k]);for(k=9;13>k;k++)g.push(Vc[j+0][k]);I&&oe(c,"LINE_STRIP",g)}(z||Xb)&&pe(e,"TRIANGLE_LIST",f,h)}}else if(1===m){for(k=0;3>k;k++)c.push(Vc[0][k]);for(k=9;13>k;k++)g.push(Vc[0][k]);ne(c,g)}else{for(j=0;m>j;j++){for(i=Vc[j],k=0;3>k;k++)c.push(i[k]);for(k=5;9>k;k++)g.push(i[k])}I&&b?oe(c,"LINE_LOOP",g):I&&!b&&oe(c,"LINE_STRIP",g),(z||Xb)&&pe(e,"TRIANGLE_FAN",f,h)}Xb=!1,v.useProgram(Eb),od("usingTexture3d",Eb,"uUsingTexture",Xb)}else c=e,c.splice(c.length-3),g.splice(g.length-4),I&&oe(c,null,g),z&&pe(e,"TRIANGLES",f);else c=e,I&&oe(c,null,g),z&&pe(e,null,f);Yc=!1,Zc=!1,Wc=[],Xc=0}};var re=function(a,b){var c=1/a,d=c*c,e=d*c;b.set(0,0,0,1,e,d,c,0,6*e,2*d,0,0,6*e,0,0,0)},se=function(){zb||(xb=new Ld,zb=new Ld,eb=!0);var a=cb;xb.set((a-1)/2,(a+3)/2,(-3-a)/2,(1-a)/2,1-a,(-5-a)/2,a+2,(a-1)/2,(a-1)/2,0,(1-a)/2,0,0,1,0,0),re(db,zb),Bb||(yb=new Ld),yb.set(xb),yb.preApply(Bb),zb.apply(xb)};yd.prototype.bezierVertex=function(){Zc=!0;var a=[];$c&&e("vertex() must be used at least once before calling bezierVertex()");for(var b=0;arguments.length>b;b++)a[b]=arguments[b];Vc.push(a),Vc[Vc.length-1].isVert=!1},zd.prototype.bezierVertex=function(){if(Zc=!0,$c&&e("vertex() must be used at least once before calling bezierVertex()"),9===arguments.length){Ab===d&&(Ab=new Ld);var b=Vc.length-1;re(gb,Ab),Ab.apply(Cb);for(var c=Ab.array(),f=Vc[b][0],g=Vc[b][1],h=Vc[b][2],i=c[4]*f+c[5]*arguments[0]+c[6]*arguments[3]+c[7]*arguments[6],j=c[8]*f+c[9]*arguments[0]+c[10]*arguments[3]+c[11]*arguments[6],k=c[12]*f+c[13]*arguments[0]+c[14]*arguments[3]+c[15]*arguments[6],l=c[4]*g+c[5]*arguments[1]+c[6]*arguments[4]+c[7]*arguments[7],m=c[8]*g+c[9]*arguments[1]+c[10]*arguments[4]+c[11]*arguments[7],n=c[12]*g+c[13]*arguments[1]+c[14]*arguments[4]+c[15]*arguments[7],o=c[4]*h+c[5]*arguments[2]+c[6]*arguments[5]+c[7]*arguments[8],p=c[8]*h+c[9]*arguments[2]+c[10]*arguments[5]+c[11]*arguments[8],q=c[12]*h+c[13]*arguments[2]+c[14]*arguments[5]+c[15]*arguments[8],r=0;gb>r;r++)f+=i,i+=j,j+=k,g+=l,l+=m,m+=n,h+=o,o+=p,p+=q,t.vertex(f,g,h);t.vertex(arguments[6],arguments[7],arguments[8])}},t.texture=function(a){var c=y.$ensureContext();if(a.__texture)c.bindTexture(c.TEXTURE_2D,a.__texture);else if("canvas"===a.localName)c.bindTexture(c.TEXTURE_2D,Tb),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,a),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.generateMipmap(c.TEXTURE_2D),Vb.width=a.width,Vb.height=a.height;else{var g,d=c.createTexture(),e=b.createElement("canvas"),f=e.getContext("2d");if(a.width&0===a.width-1)e.width=a.width;else{for(g=1;a.width>g;)g*=2;e.width=g}if(a.height&0===a.height-1)e.height=a.height;else{for(g=1;a.height>g;)g*=2;e.height=g}f.drawImage(a.sourceImg,0,0,a.width,a.height,0,0,e.width,e.height),c.bindTexture(c.TEXTURE_2D,d),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,e),c.generateMipmap(c.TEXTURE_2D),a.__texture=d,Vb.width=a.width,Vb.height=a.height}Xb=!0,c.useProgram(Eb),od("usingTexture3d",Eb,"uUsingTexture",Xb)},t.textureMode=function(a){Wb=a};var te=function(a,b,c,d,e,f,g,h,i,j,k,l){var m=d,n=e,o=f,p=zb.array(),q=p[4]*a+p[5]*d+p[6]*g+p[7]*j,r=p[8]*a+p[9]*d+p[10]*g+p[11]*j,s=p[12]*a+p[13]*d+p[14]*g+p[15]*j,u=p[4]*b+p[5]*e+p[6]*h+p[7]*k,v=p[8]*b+p[9]*e+p[10]*h+p[11]*k,w=p[12]*b+p[13]*e+p[14]*h+p[15]*k,x=p[4]*c+p[5]*f+p[6]*i+p[7]*l,y=p[8]*c+p[9]*f+p[10]*i+p[11]*l,z=p[12]*c+p[13]*f+p[14]*i+p[15]*l;t.vertex(m,n,o);for(var A=0;db>A;A++)m+=q,q+=r,r+=s,n+=u,u+=v,v+=w,o+=x,x+=y,y+=z,t.vertex(m,n,o)};yd.prototype.curveVertex=function(a,b){Yc=!0,t.vertex(a,b)},zd.prototype.curveVertex=function(a,b,c){Yc=!0,eb||se();var d=[];d[0]=a,d[1]=b,d[2]=c,Wc.push(d),Xc++,Xc>3&&te(Wc[Xc-4][0],Wc[Xc-4][1],Wc[Xc-4][2],Wc[Xc-3][0],Wc[Xc-3][1],Wc[Xc-3][2],Wc[Xc-2][0],Wc[Xc-2][1],Wc[Xc-2][2],Wc[Xc-1][0],Wc[Xc-1][1],Wc[Xc-1][2])},yd.prototype.curve=function(a,b,c,d,e,f,g,h){t.beginShape(),t.curveVertex(a,b),t.curveVertex(c,d),t.curveVertex(e,f),t.curveVertex(g,h),t.endShape()},zd.prototype.curve=function(a,b,c,e,f,g,h,i,j,k,l,m){return m!==d?(t.beginShape(),t.curveVertex(a,b,c),t.curveVertex(e,f,g),t.curveVertex(h,i,j),t.curveVertex(k,l,m),t.endShape(),void 0):(t.beginShape(),t.curveVertex(a,b),t.curveVertex(c,e),t.curveVertex(f,g),t.curveVertex(h,i),t.endShape(),void 0)},t.curveTightness=function(a){cb=a},t.curveDetail=function(a){db=a,se()},t.rectMode=function(a){R=a},t.imageMode=function(a){switch(a){case o.CORNER:ud=td;break;case o.CORNERS:ud=vd;break;case o.CENTER:ud=wd;break;default:e("Invalid imageMode")}},t.ellipseMode=function(a){S=a},t.arc=function(a,b,c,d,e,f){if(!(0>=c||e>f)){for(S===o.CORNERS?(c-=a,d-=b):S===o.RADIUS?(a-=c,b-=d,c=2*c,d=2*d):S===o.CENTER&&(a-=c/2,b-=d/2);0>e;)e+=o.TWO_PI,f+=o.TWO_PI;f-e>o.TWO_PI&&(e=0,f=o.TWO_PI);var m,n,g=c/2,h=d/2,i=a+g,j=b+h,k=0|.5+2*e*t.RAD_TO_DEG,l=0|.5+2*f*t.RAD_TO_DEG;if(z){var p=I;for(I=!1,t.beginShape(),t.vertex(i,j),m=k;l>=m;m++)n=m%o.SINCOS_LENGTH,t.vertex(i+Bc[n]*g,j+Ac[n]*h);t.endShape(o.CLOSE),I=p}if(I){var q=z;for(z=!1,t.beginShape(),m=k;l>=m;m++)n=m%o.SINCOS_LENGTH,t.vertex(i+Bc[n]*g,j+Ac[n]*h);t.endShape(),z=q}}},yd.prototype.line=function(a,b,e,f){if(I){if(a=c.round(a),e=c.round(e),b=c.round(b),f=c.round(f),a===e&&b===f)return t.point(a,b),void 0;for(var g=d,h=d,i=!0,j=Gc.array(),k=[1,0,0,0,1,0],l=0;6>l&&i;l++)i=j[l]===k[l];i&&(a===e?(b>f&&(g=b,b=f,f=g),f++,1===M%2&&v.translate(.5,0)):b===f&&(a>e&&(g=a,a=e,e=g),e++,1===M%2&&v.translate(0,.5)),1===M&&(h=v.lineCap,v.lineCap="butt")),v.beginPath(),v.moveTo(a||0,b||0),v.lineTo(e||0,f||0),me(),i&&(a===e&&1===M%2?v.translate(-.5,0):b===f&&1===M%2&&v.translate(0,-.5),1===M&&(v.lineCap=h))}},zd.prototype.line=function(a,b,c,e,f,g){if((f===d||g===d)&&(g=0,f=e,e=c,c=0),a===e&&b===f&&c===g)return t.point(a,b,c),void 0;var h=[a,b,c,e,f,g],i=new Ld;i.scale(1,-1,1),i.apply(Gc.array()),i.transpose(),M>0&&I&&(v.useProgram(Fb),pd("uModel2d",Fb,"uModel",!1,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),pd("uView2d",Fb,"uView",!1,i.array()),nd("uColor2d",Fb,"uColor",J),od("uIsDrawingText",Fb,"uIsDrawingText",!1),qd("aVertex2d",Fb,"aVertex",3,Nb),rd("aTextureCoord2d",Fb,"aTextureCoord"),v.bufferData(v.ARRAY_BUFFER,new k(h),v.STREAM_DRAW),v.drawArrays(v.LINES,0,2))},yd.prototype.bezier=function(){8!==arguments.length&&e("You must use 8 parameters for bezier() in 2D mode"),t.beginShape(),t.vertex(arguments[0],arguments[1]),t.bezierVertex(arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7]),t.endShape()},zd.prototype.bezier=function(){12!==arguments.length&&e("You must use 12 parameters for bezier() in 3D mode"),t.beginShape(),t.vertex(arguments[0],arguments[1],arguments[2]),t.bezierVertex(arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10],arguments[11]),t.endShape()},t.bezierDetail=function(a){gb=a},t.bezierPoint=function(a,b,c,d,e){return(1-e)*(1-e)*(1-e)*a+3*(1-e)*(1-e)*e*b+3*(1-e)*e*e*c+e*e*e*d},t.bezierTangent=function(a,b,c,d,e){return 3*e*e*(-a+3*b-3*c+d)+6*e*(a-2*b+c)+3*(-a+b)},t.curvePoint=function(a,b,c,d,e){return.5*(2*b+(-a+c)*e+(2*a-5*b+4*c-d)*e*e+(-a+3*b-3*c+d)*e*e*e)},t.curveTangent=function(a,b,c,d,e){return.5*(-a+c+2*(2*a-5*b+4*c-d)*e+3*(-a+3*b-3*c+d)*e*e)},t.triangle=function(a,b,c,d,e,f){t.beginShape(o.TRIANGLES),t.vertex(a,b,0),t.vertex(c,d,0),t.vertex(e,f,0),t.endShape()},t.quad=function(a,b,c,d,e,f,g,h){t.beginShape(o.QUADS),t.vertex(a,b,0),t.vertex(c,d,0),t.vertex(e,f,0),t.vertex(g,h,0),t.endShape()};var ue=function(a,b,e,f,g,h,i,j){j===d&&(h=g,i=g,j=g);var k=e/2,l=f/2;(g>k||g>l)&&(g=c.min(k,l)),(h>k||h>l)&&(h=c.min(k,l)),(i>k||i>l)&&(i=c.min(k,l)),(j>k||j>l)&&(j=c.min(k,l)),(!z||I)&&v.translate(.5,.5),v.beginPath(),v.moveTo(a+g,b),v.lineTo(a+e-h,b),v.quadraticCurveTo(a+e,b,a+e,b+h),v.lineTo(a+e,b+f-i),v.quadraticCurveTo(a+e,b+f,a+e-i,b+f),v.lineTo(a+j,b+f),v.quadraticCurveTo(a,b+f,a,b+f-j),v.lineTo(a,b+g),v.quadraticCurveTo(a,b,a+g,b),(!z||I)&&v.translate(-.5,-.5),le(),me()};yd.prototype.rect=function(a,b,e,f,g,h,i,j){if(e||f){if(R===o.CORNERS?(e-=a,f-=b):R===o.RADIUS?(e*=2,f*=2,a-=e/2,b-=f/2):R===o.CENTER&&(a-=e/2,b-=f/2),a=c.round(a),b=c.round(b),e=c.round(e),f=c.round(f),g!==d)return ue(a,b,e,f,g,h,i,j),void 0;I&&1===M%2&&v.translate(.5,.5),v.beginPath(),v.rect(a,b,e,f),le(),me(),I&&1===M%2&&v.translate(-.5,-.5)}},zd.prototype.rect=function(a,b,c,f,g){g!==d&&e("rect() with rounded corners is not supported in 3D mode"),R===o.CORNERS?(c-=a,f-=b):R===o.RADIUS?(c*=2,f*=2,a-=c/2,b-=f/2):R===o.CENTER&&(a-=c/2,b-=f/2);var k=new Ld;k.translate(a,b,0),k.scale(c,f,1),k.transpose();var l=new Ld;if(l.scale(1,-1,1),l.apply(Gc.array()),l.transpose(),M>0&&I&&(v.useProgram(Fb),pd("uModel2d",Fb,"uModel",!1,k.array()),pd("uView2d",Fb,"uView",!1,l.array()),nd("uColor2d",Fb,"uColor",J),od("uIsDrawingText2d",Fb,"uIsDrawingText",!1),qd("aVertex2d",Fb,"aVertex",3,Kb),rd("aTextureCoord2d",Fb,"aTextureCoord"),v.drawArrays(v.LINE_LOOP,0,ed.length/3)),z){if(v.useProgram(Eb),pd("uModel3d",Eb,"uModel",!1,k.array()),pd("uView3d",Eb,"uView",!1,l.array()),v.enable(v.POLYGON_OFFSET_FILL),v.polygonOffset(1,1),nd("color3d",Eb,"uColor",B),uc>0){var m=new Ld;m.set(l);var n=new Ld;n.set(k),m.mult(n);var p=new Ld;p.set(m),p.invert(),p.transpose(),pd("uNormalTransform3d",Eb,"uNormalTransform",!1,p.array()),qd("aNormal3d",Eb,"aNormal",3,Lb)}else rd("normal3d",Eb,"aNormal");qd("vertex3d",Eb,"aVertex",3,Kb),v.drawArrays(v.TRIANGLE_FAN,0,ed.length/3),v.disable(v.POLYGON_OFFSET_FILL)}},yd.prototype.ellipse=function(a,b,c,d){if(a=a||0,b=b||0,!(0>=c&&0>=d))if(S===o.RADIUS?(c*=2,d*=2):S===o.CORNERS?(c-=a,d-=b,a+=c/2,b+=d/2):S===o.CORNER&&(a+=c/2,b+=d/2),c===d)v.beginPath(),v.arc(a,b,c/2,0,o.TWO_PI,!1),le(),me();else{var e=c/2,f=d/2,g=.5522847498307933,h=g*e,i=g*f;t.beginShape(),t.vertex(a+e,b),t.bezierVertex(a+e,b-i,a+h,b-f,a,b-f),t.bezierVertex(a-h,b-f,a-e,b-i,a-e,b),t.bezierVertex(a-e,b+i,a-h,b+f,a,b+f),t.bezierVertex(a+h,b+f,a+e,b+i,a+e,b),t.endShape()}},zd.prototype.ellipse=function(a,b,c,d){if(a=a||0,b=b||0,!(0>=c&&0>=d)){S===o.RADIUS?(c*=2,d*=2):S===o.CORNERS?(c-=a,d-=b,a+=c/2,b+=d/2):S===o.CORNER&&(a+=c/2,b+=d/2);var e=c/2,f=d/2,g=.5522847498307933,h=g*e,i=g*f;if(t.beginShape(),t.vertex(a+e,b),t.bezierVertex(a+e,b-i,0,a+h,b-f,0,a,b-f,0),t.bezierVertex(a-h,b-f,0,a-e,b-i,0,a-e,b,0),t.bezierVertex(a-e,b+i,0,a-h,b+f,0,a,b+f,0),t.bezierVertex(a+h,b+f,0,a+e,b+i,0,a+e,b,0),t.endShape(),z){var l,m,j=0,k=0;for(l=0;Vc.length>l;l++)j+=Vc[l][0],k+=Vc[l][1];j/=Vc.length,k/=Vc.length;var n=[],p=[],q=[];for(n[0]=j,n[1]=k,n[2]=0,n[3]=0,n[4]=0,n[5]=B[0],n[6]=B[1],n[7]=B[2],n[8]=B[3],n[9]=J[0],n[10]=J[1],n[11]=J[2],n[12]=J[3],n[13]=T,n[14]=U,n[15]=V,Vc.unshift(n),l=0;Vc.length>l;l++){for(m=0;3>m;m++)p.push(Vc[l][m]);for(m=5;9>m;m++)q.push(Vc[l][m])}pe(p,"TRIANGLE_FAN",q)}}},t.normal=function(a,b,c){(3!==arguments.length||"number"!=typeof a||"number"!=typeof b||"number"!=typeof c)&&e("normal() requires three numeric arguments."),T=a,U=b,V=c,0!==_&&(W===o.NORMAL_MODE_AUTO?W=o.NORMAL_MODE_SHAPE:W===o.NORMAL_MODE_SHAPE&&(W=o.NORMAL_MODE_VERTEX))},t.save=function(b,c){return c!==d?a.open(c.toDataURL(),"_blank"):a.open(t.externals.canvas.toDataURL(),"_blank")};var ve=0;t.saveFrame=function(a){a===d&&(a="screen-####.png");var b=a.replace(/#+/,function(a){for(var b=""+ve++;b.length<a.length;)b="0"+b;return b});t.save(b)};var we=b.createElement("canvas").getContext("2d"),xe=[d,d,d],Ae=function(a,c,d){if(this.__isDirty=!1,a instanceof HTMLImageElement)this.fromHTMLImageData(a);else if(c||d){this.width=a||1,this.height=c||1;var e=this.sourceImg=b.createElement("canvas");if(e.width=this.width,e.height=this.height,this.imageData=e.getContext("2d").createImageData(this.width,this.height),this.format=d===o.ARGB||d===o.ALPHA?d:o.RGB,this.format===o.RGB)for(var g=3,h=this.imageData.data,i=h.length;i>g;g+=4)h[g]=255;this.__isDirty=!0,this.updatePixels()}else this.width=0,this.height=0,this.imageData=we.createImageData(1,1),this.format=o.ARGB;this.pixels=ze(this)};Ae.prototype={__isPImage:!0,updatePixels:function(){var a=this.sourceImg;a&&a instanceof HTMLCanvasElement&&this.__isDirty&&a.getContext("2d").putImageData(this.imageData,0,0),this.__isDirty=!1},fromHTMLImageData:function(a){var b=ye(a);try{var c=b.context.getImageData(0,0,a.width,a.height);this.fromImageData(c)}catch(d){a.width&&a.height&&(this.isRemote=!0,this.width=a.width,this.height=a.height)}this.sourceImg=a},get:function(a,b,c,d){return arguments.length?2===arguments.length?t.get(a,b,this):4===arguments.length?t.get(a,b,c,d,this):void 0:t.get(this)},set:function(a,b,c){t.set(a,b,c,this),this.__isDirty=!0},blend:function(a,b,c,d,e,f,g,h,i,j){9===arguments.length?t.blend(this,a,b,c,d,e,f,g,h,i,this):10===arguments.length&&t.blend(a,b,c,d,e,f,g,h,i,j,this),delete this.sourceImg},copy:function(a,b,c,d,e,f,g,h,i){8===arguments.length?t.blend(this,a,b,c,d,e,f,g,h,o.REPLACE,this):9===arguments.length&&t.blend(a,b,c,d,e,f,g,h,i,o.REPLACE,this),delete this.sourceImg},filter:function(a,b){2===arguments.length?t.filter(a,b,this):1===arguments.length&&t.filter(a,null,this),delete this.sourceImg},save:function(a){t.save(a,this)},resize:function(a,b){if(this.isRemote&&e("Image is loaded remotely. Cannot resize."),0!==this.width||0!==this.height){0===a&&0!==b?a=c.floor(this.width/this.height*b):0===b&&0!==a&&(b=c.floor(this.height/this.width*a));var d=ye(this.imageData).canvas,f=ye(d,a,b).context.getImageData(0,0,a,b);this.fromImageData(f)}},mask:function(a){var c,d,b=this.toImageData();if(a instanceof Ae||a.__isPImage)if(a.width===this.width&&a.height===this.height)for(a=a.toImageData(),c=2,d=4*this.width*this.height;d>c;c+=4)b.data[c+1]=a.data[c];else e("mask must have the same dimensions as PImage.");else if(a instanceof Array)if(this.width*this.height===a.length)for(c=0,d=a.length;d>c;++c)b.data[4*c+3]=a[c];else e("mask array must be the same length as PImage pixels array.");this.fromImageData(b)},loadPixels:f,toImageData:function(){if(this.isRemote)return this.sourceImg;if(!this.__isDirty)return this.imageData;var a=ye(this.sourceImg);return a.context.getImageData(0,0,this.width,this.height)},toDataURL:function(){this.isRemote&&e("Image is loaded remotely. Cannot create dataURI.");var a=ye(this.imageData);return a.canvas.toDataURL()},fromImageData:function(a){var c=a.width,d=a.height,e=b.createElement("canvas"),f=e.getContext("2d");this.width=e.width=c,this.height=e.height=d,f.putImageData(a,0,0),this.format=o.ARGB,this.imageData=a,this.sourceImg=e}},t.PImage=Ae,t.createImage=function(a,b,c){return new Ae(a,b,c)},t.loadImage=function(a,c,d){var e;if(x.imageCache.images[a])return e=new Ae(x.imageCache.images[a]),e.loaded=!0,e;e=new Ae;var f=b.createElement("img");return e.sourceImg=f,f.onload=function(a,b,c){var d=a,e=b,f=c;return function(){e.fromHTMLImageData(d),e.loaded=!0,f&&f()}}(f,e,d),f.src=a,e},t.requestImage=t.loadImage,t.get=function(a,b,c,d,e){return void 0!==e?Ee(a,b,c,d,e):void 0!==d?De(a,b,c,d):void 0!==c?Ce(a,b,c):void 0!==b?Be(a,b):void 0!==a?Ee(0,0,a.width,a.height,a):De(0,0,t.width,t.height)},t.createGraphics=function(a,b,c){var d=new H;return d.size(a,b,c),d.background(0,0),d},t.set=function(a,b,c,d){3===arguments.length?"number"==typeof c?Ie(a,b,c):(c instanceof Ae||c.__isPImage)&&t.image(c,a,b):4===arguments.length&&Je(a,b,c,d)},t.imageData={},t.pixels={getLength:function(){return t.imageData.data.length?t.imageData.data.length/4:0},getPixel:function(a){var b=4*a,c=t.imageData.data;return 4278190080&c[b+3]<<24|16711680&c[b+0]<<16|65280&c[b+1]<<8|255&c[b+2]},setPixel:function(a,b){var c=4*a,d=t.imageData.data;d[c+0]=(16711680&b)>>>16,d[c+1]=(65280&b)>>>8,d[c+2]=255&b,d[c+3]=(4278190080&b)>>>24},toArray:function(){for(var a=[],b=t.imageData.width*t.imageData.height,c=t.imageData.data,d=0,e=0;b>d;d++,e+=4)a.push(4278190080&c[e+3]<<24|16711680&c[e+0]<<16|65280&c[e+1]<<8|255&c[e+2]);return a},set:function(a){for(var b=0,c=a.length;c>b;b++)this.setPixel(b,a[b])}},t.loadPixels=function(){t.imageData=y.$ensureContext().getImageData(0,0,t.width,t.height)},t.updatePixels=function(){t.imageData&&y.$ensureContext().putImageData(t.imageData,0,0)},t.hint=function(a){var b=y.$ensureContext();a===o.DISABLE_DEPTH_TEST?(b.disable(b.DEPTH_TEST),b.depthMask(!1),b.clear(b.DEPTH_BUFFER_BIT)):a===o.ENABLE_DEPTH_TEST?(b.enable(b.DEPTH_TEST),b.depthMask(!0)):a===o.ENABLE_OPENGL_2X_SMOOTH||a===o.ENABLE_OPENGL_4X_SMOOTH?O=!0:a===o.DISABLE_OPENGL_2X_SMOOTH&&(O=!1)};var Ke=function(a,b,c,d){var f;a instanceof Ae||a.__isPImage?(f=a,f.loaded||e("Error using image in background(): PImage not loaded."),(f.width!==t.width||f.height!==t.height)&&e("Background image must be the same dimensions as the canvas.")):f=t.color(a,b,c,d),fb=f};yd.prototype.background=function(a,b,c,e){a!==d&&Ke(a,b,c,e),fb instanceof Ae||fb.__isPImage?(Rd(),v.setTransform(1,0,0,1,0,0),t.image(fb,0,0),Sd()):(Rd(),v.setTransform(1,0,0,1,0,0),t.alpha(fb)!==hb&&v.clearRect(0,0,t.width,t.height),v.fillStyle=t.color.toString(fb),v.fillRect(0,0,t.width,t.height),F=!0,Sd())},zd.prototype.background=function(a,b,c,d){arguments.length>0&&Ke(a,b,c,d);var e=t.color.toGLArray(fb);v.clearColor(e[0],e[1],e[2],e[3]),v.clear(v.COLOR_BUFFER_BIT|v.DEPTH_BUFFER_BIT)},yd.prototype.image=function(a,b,d,e,f){if(b=c.round(b),d=c.round(d),a.width>0){e||a.width,f||a.height;var i=ud(b||0,d||0,e||a.width,f||a.height,4>arguments.length),j=!!a.sourceImg&&null===qb;if(j){var k=a.sourceImg;a.__isDirty&&a.updatePixels(),v.drawImage(k,0,0,k.width,k.height,i.x,i.y,i.w,i.h)}else{var l=a.toImageData();null!==qb&&(qb(l),a.__isDirty=!0),v.drawImage(ye(l).canvas,0,0,a.width,a.height,i.x,i.y,i.w,i.h)}}},zd.prototype.image=function(a,b,d,e,f){a.width>0&&(b=c.round(b),d=c.round(d),e=e||a.width,f=f||a.height,t.beginShape(t.QUADS),t.texture(a),t.vertex(b,d,0,0,0),t.vertex(b,d+f,0,0,f),t.vertex(b+e,d+f,0,e,f),t.vertex(b+e,d,0,e,0),t.endShape())},t.tint=function(a,b,c,d){var e=t.color(a,b,c,d),f=t.red(e)/ib,g=t.green(e)/jb,h=t.blue(e)/kb,i=t.alpha(e)/hb;qb=function(a){for(var b=a.data,c=4*a.width*a.height,d=0;c>d;)b[d++]*=f,b[d++]*=g,b[d++]*=h,b[d++]*=i},rb=function(a){for(var b=0;a.length>b;)a[b++]=f,a[b++]=g,a[b++]=h,a[b++]=i}},t.noTint=function(){qb=null,rb=null},t.copy=function(a,b,c,e,f,g,h,i,j){j===d&&(j=i,i=h,h=g,g=f,f=e,e=c,c=b,b=a,a=t),t.blend(a,b,c,e,f,g,h,i,j,o.REPLACE)},t.blend=function(a,b,c,f,g,h,i,j,k,l,m){a.isRemote&&e("Image is loaded remotely. Cannot blend image."),l===d&&(l=k,k=j,j=i,i=h,h=g,g=f,f=c,c=b,b=a,a=t);var n=b+f,o=c+g,p=h+j,q=i+k,r=m||t;(m===d||l===d)&&t.loadPixels(),a.loadPixels(),a===t&&t.intersect(b,c,n,o,h,i,p,q)?t.blit_resize(t.get(b,c,n-b,o-c),0,0,n-b-1,o-c-1,r.imageData.data,r.width,r.height,h,i,p,q,l):t.blit_resize(a,b,c,n,o,r.imageData.data,r.width,r.height,h,i,p,q,l),m===d&&t.updatePixels()};var Le=function(a){var c,d,b=t.floor(3.5*a);if(b=1>b?1:248>b?b:248,t.shared.blurRadius!==b){t.shared.blurRadius=b,t.shared.blurKernelSize=1+(t.shared.blurRadius<<1),t.shared.blurKernel=new k(t.shared.blurKernelSize);var e=t.shared.blurKernel,f=t.shared.blurKernelSize;for(t.shared.blurRadius,c=0;f>c;c++)e[c]=0;var h=(b-1)*(b-1);for(c=1;b>c;c++)e[b+c]=e[d]=h;e[b]=b*b}},Me=function(a,b){var c,d,e,f,g,i,j,l,m,n,o,w,x,y,z,p=b.pixels.getLength(),q=new k(p),r=new k(p),s=new k(p),u=new k(p),v=0;Le(a);var A=b.height,B=b.width,C=t.shared.blurKernelSize,D=t.shared.blurRadius,E=t.shared.blurKernel,F=b.imageData.data;for(x=0;A>x;x++){for(w=0;B>w;w++){if(f=e=d=g=c=0,j=w-D,0>j)o=-j,j=0;else{if(j>=B)break;o=0}for(y=o;C>y&&!(j>=B);y++)z=4*(j+v),i=E[y],g+=i*F[z+3],d+=i*F[z],e+=i*F[z+1],f+=i*F[z+2],c+=i,j++;l=v+w,u[l]=g/c,q[l]=d/c,r[l]=e/c,s[l]=f/c}v+=B}for(v=0,m=-D,n=m*B,x=0;A>x;x++){for(w=0;B>w;w++){if(f=e=d=g=c=0,0>m)o=l=-m,j=w;else{if(m>=A)break;o=0,l=m,j=w+n}for(y=o;C>y&&!(l>=A);y++)i=E[y],g+=i*u[j],d+=i*q[j],e+=i*r[j],f+=i*s[j],c+=i,l++,j+=B;z=4*(w+v),F[z]=d/c,F[z+1]=e/c,F[z+2]=f/c,F[z+3]=g/c}v+=B,n+=B,m++}},Ne=function(a,b){var f,g,h,i,j,k,m,n,o,p,q,r,s,t,u,v,w,c=0,d=b.pixels.getLength(),e=new l(d);if(a)for(;d>c;)for(f=c,g=c+b.width;g>c;)h=i=b.pixels.getPixel(c),m=c-1,k=c+1,n=c-b.width,o=c+b.width,f>m&&(m=c),k>=g&&(k=c),0>n&&(n=0),o>=d&&(o=c),r=b.pixels.getPixel(n),q=b.pixels.getPixel(m),s=b.pixels.getPixel(o),p=b.pixels.getPixel(k),j=77*(255&h>>16)+151*(255&h>>8)+28*(255&h),u=77*(255&q>>16)+151*(255&q>>8)+28*(255&q),t=77*(255&p>>16)+151*(255&p>>8)+28*(255&p),v=77*(255&r>>16)+151*(255&r>>8)+28*(255&r),w=77*(255&s>>16)+151*(255&s>>8)+28*(255&s),j>u&&(i=q,j=u),j>t&&(i=p,j=t),j>v&&(i=r,j=v),j>w&&(i=s,j=w),e[c++]=i;else for(;d>c;)for(f=c,g=c+b.width;g>c;)h=i=b.pixels.getPixel(c),m=c-1,k=c+1,n=c-b.width,o=c+b.width,f>m&&(m=c),k>=g&&(k=c),0>n&&(n=0),o>=d&&(o=c),r=b.pixels.getPixel(n),q=b.pixels.getPixel(m),s=b.pixels.getPixel(o),p=b.pixels.getPixel(k),j=77*(255&h>>16)+151*(255&h>>8)+28*(255&h),u=77*(255&q>>16)+151*(255&q>>8)+28*(255&q),t=77*(255&p>>16)+151*(255&p>>8)+28*(255&p),v=77*(255&r>>16)+151*(255&r>>8)+28*(255&r),w=77*(255&s>>16)+151*(255&s>>8)+28*(255&s),u>j&&(i=q,j=u),t>j&&(i=p,j=t),v>j&&(i=r,j=v),w>j&&(i=s,j=w),e[c++]=i;b.pixels.set(e)};t.filter=function(a,b,c){var f,g,h,i;3===arguments.length?(c.loadPixels(),f=c):(t.loadPixels(),f=t),b===d&&(b=null),f.isRemote&&e("Image is loaded remotely. Cannot filter image.");var j=f.pixels.getLength();switch(a){case o.BLUR:var k=b||1;Me(k,f);break;case o.GRAY:if(f.format===o.ALPHA){for(i=0;j>i;i++)g=255-f.pixels.getPixel(i),f.pixels.setPixel(i,4278190080|g<<16|g<<8|g);f.format=o.RGB}else for(i=0;j>i;i++)g=f.pixels.getPixel(i),h=77*(255&g>>16)+151*(255&g>>8)+28*(255&g)>>8,f.pixels.setPixel(i,g&o.ALPHA_MASK|h<<16|h<<8|h);break;case o.INVERT:for(i=0;j>i;i++)f.pixels.setPixel(i,16777215^f.pixels.getPixel(i));break;case o.POSTERIZE:null===b&&e("Use filter(POSTERIZE, int levels) instead of filter(POSTERIZE)");var l=t.floor(b);(2>l||l>255)&&e("Levels must be between 2 and 255 for filter(POSTERIZE, levels)");var m=l-1;for(i=0;j>i;i++){var n=255&f.pixels.getPixel(i)>>16,p=255&f.pixels.getPixel(i)>>8,q=255&f.pixels.getPixel(i);n=255*(n*l>>8)/m,p=255*(p*l>>8)/m,q=255*(q*l>>8)/m,f.pixels.setPixel(i,4278190080&f.pixels.getPixel(i)|n<<16|p<<8|q)}break;case o.OPAQUE:for(i=0;j>i;i++)f.pixels.setPixel(i,4278190080|f.pixels.getPixel(i));f.format=o.RGB;break;case o.THRESHOLD:null===b&&(b=.5),(0>b||b>1)&&e("Level must be between 0 and 1 for filter(THRESHOLD, level)");var r=t.floor(255*b);for(i=0;j>i;i++){var s=t.max((f.pixels.getPixel(i)&o.RED_MASK)>>16,t.max((f.pixels.getPixel(i)&o.GREEN_MASK)>>8,f.pixels.getPixel(i)&o.BLUE_MASK));f.pixels.setPixel(i,f.pixels.getPixel(i)&o.ALPHA_MASK|(r>s?0:16777215))}break;case o.ERODE:Ne(!0,f);break;case o.DILATE:Ne(!1,f)}f.updatePixels()},t.shared={fracU:0,ifU:0,fracV:0,ifV:0,u1:0,u2:0,v1:0,v2:0,sX:0,sY:0,iw:0,iw1:0,ih1:0,ul:0,ll:0,ur:0,lr:0,cUL:0,cLL:0,cUR:0,cLR:0,srcXOffset:0,srcYOffset:0,r:0,g:0,b:0,a:0,srcBuffer:null,blurRadius:0,blurKernelSize:0,blurKernel:null},t.intersect=function(a,b,c,d,e,f,g,h){var i=c-a+1,j=d-b+1,k=g-e+1,l=h-f+1;if(a>e)k+=e-a,k>i&&(k=i);else{var m=i+a-e;k>m&&(k=m)}if(b>f)l+=f-b,l>j&&(l=j);else{var n=j+b-f;l>n&&(l=n)}return!(0>=k||0>=l)};var Oe={};Oe[o.BLEND]=t.modes.blend,Oe[o.ADD]=t.modes.add,Oe[o.SUBTRACT]=t.modes.subtract,Oe[o.LIGHTEST]=t.modes.lightest,Oe[o.DARKEST]=t.modes.darkest,Oe[o.REPLACE]=t.modes.replace,Oe[o.DIFFERENCE]=t.modes.difference,Oe[o.EXCLUSION]=t.modes.exclusion,Oe[o.MULTIPLY]=t.modes.multiply,Oe[o.SCREEN]=t.modes.screen,Oe[o.OVERLAY]=t.modes.overlay,Oe[o.HARD_LIGHT]=t.modes.hard_light,Oe[o.SOFT_LIGHT]=t.modes.soft_light,Oe[o.DODGE]=t.modes.dodge,Oe[o.BURN]=t.modes.burn,t.blit_resize=function(a,b,d,e,f,g,h,i,j,k,l,m,n){var p,q;0>b&&(b=0),0>d&&(d=0),e>=a.width&&(e=a.width-1),f>=a.height&&(f=a.height-1);var r=e-b,s=f-d,u=l-j,v=m-k;if(!(0>=u||0>=v||0>=r||0>=s||j>=h||k>=i||b>=a.width||d>=a.height)){var w=c.floor(r/u*o.PRECISIONF),x=c.floor(s/v*o.PRECISIONF),y=t.shared;y.srcXOffset=c.floor(0>j?-j*w:b*o.PRECISIONF),y.srcYOffset=c.floor(0>k?-k*x:d*o.PRECISIONF),0>j&&(u+=j,j=0),0>k&&(v+=k,k=0),u=c.min(u,h-j),v=c.min(v,i-k);var A,z=k*h+j;y.srcBuffer=a.imageData.data,y.iw=a.width,y.iw1=a.width-1,y.ih1=a.height-1;var E,F,G,H,I,J,D=(t.filter_bilinear,t.filter_new_scanline,Oe[n]),K=o.ALPHA_MASK,L=o.RED_MASK,M=o.GREEN_MASK,N=o.BLUE_MASK,O=o.PREC_MAXVAL,P=o.PRECISIONB,Q=o.PREC_RED_SHIFT,R=o.PREC_ALPHA_SHIFT,S=y.srcBuffer,T=c.min;for(q=0;v>q;q++){for(y.sX=y.srcXOffset,y.fracV=y.srcYOffset&O,y.ifV=O-y.fracV,y.v1=(y.srcYOffset>>P)*y.iw,y.v2=T((y.srcYOffset>>P)+1,y.ih1)*y.iw,p=0;u>p;p++)F=4*(z+p),A=g[F+3]<<24&K|g[F]<<16&L|g[F+1]<<8&M|g[F+2]&N,y.fracU=y.sX&O,y.ifU=O-y.fracU,y.ul=y.ifU*y.ifV>>P,y.ll=y.ifU*y.fracV>>P,y.ur=y.fracU*y.ifV>>P,y.lr=y.fracU*y.fracV>>P,y.u1=y.sX>>P,y.u2=T(y.u1+1,y.iw1),G=4*(y.v1+y.u1),H=4*(y.v1+y.u2),I=4*(y.v2+y.u1),J=4*(y.v2+y.u2),y.cUL=S[G+3]<<24&K|S[G]<<16&L|S[G+1]<<8&M|S[G+2]&N,y.cUR=S[H+3]<<24&K|S[H]<<16&L|S[H+1]<<8&M|S[H+2]&N,y.cLL=S[I+3]<<24&K|S[I]<<16&L|S[I+1]<<8&M|S[I+2]&N,y.cLR=S[J+3]<<24&K|S[J]<<16&L|S[J+1]<<8&M|S[J+2]&N,y.r=y.ul*((y.cUL&L)>>16)+y.ll*((y.cLL&L)>>16)+y.ur*((y.cUR&L)>>16)+y.lr*((y.cLR&L)>>16)<<Q&L,y.g=y.ul*(y.cUL&M)+y.ll*(y.cLL&M)+y.ur*(y.cUR&M)+y.lr*(y.cLR&M)>>>P&M,y.b=y.ul*(y.cUL&N)+y.ll*(y.cLL&N)+y.ur*(y.cUR&N)+y.lr*(y.cLR&N)>>>P,y.a=y.ul*((y.cUL&K)>>>24)+y.ll*((y.cLL&K)>>>24)+y.ur*((y.cUR&K)>>>24)+y.lr*((y.cLR&K)>>>24)<<R&K,E=D(A,y.a|y.r|y.g|y.b),g[F]=(E&L)>>>16,g[F+1]=(E&M)>>>8,g[F+2]=E&N,g[F+3]=(E&K)>>>24,y.sX+=w;z+=h,y.srcYOffset+=x}}},t.loadFont=function(a,b){if(a===d&&e("font name required in loadFont."),-1===a.indexOf(".svg"))return b===d&&(b=hc.size),G.get(a,b);var c=t.loadGlyphs(a);return{name:a,css:"12px sans-serif",glyph:!0,units_per_em:c.units_per_em,horiz_adv_x:1/c.units_per_em*c.horiz_adv_x,ascent:c.ascent,descent:c.descent,width:function(b){for(var c=0,d=b.length,e=0;d>e;e++)try{c+=parseFloat(t.glyphLook(t.glyphTable[a],b[e]).horiz_adv_x)}catch(f){H.debug(f)}return c/t.glyphTable[a].units_per_em}}},t.createFont=function(a,b){return t.loadFont(a,b)},t.textFont=function(a,b){b!==d&&(a.glyph||(a=G.get(a.name,b)),dc=b),hc=a,cc=hc.name,ec=hc.ascent,fc=hc.descent,gc=hc.leading;var c=y.$ensureContext();c.font=hc.css},t.textSize=function(a){hc=G.get(cc,a),dc=a,ec=hc.ascent,fc=hc.descent,gc=hc.leading;var b=y.$ensureContext();b.font=hc.css},t.textAscent=function(){return ec},t.textDescent=function(){return fc},t.textLeading=function(a){gc=a},t.textAlign=function(a,b){_b=a,ac=b||o.BASELINE},yd.prototype.textWidth=function(a){var e,b=Pe(a).split(/\r?\n/g),d=0,f=b.length;for(v.font=hc.css,e=0;f>e;++e)d=c.max(d,hc.measureTextWidth(b[e]));return 0|d},zd.prototype.textWidth=function(a){var g,e=Pe(a).split(/\r?\n/g),f=0,h=e.length;wb===d&&(wb=b.createElement("canvas"));var i=wb.getContext("2d");for(i.font=hc.css,g=0;h>g;++g)f=c.max(f,i.measureText(e[g]).width);return 0|f},t.glyphLook=function(a,b){try{switch(b){case"1":return a.one;case"2":return a.two;case"3":return a.three;case"4":return a.four;case"5":return a.five;case"6":return a.six;case"7":return a.seven;case"8":return a.eight;case"9":return a.nine;case"0":return a.zero;case" ":return a.space;case"$":return a.dollar;case"!":return a.exclam;case'"':return a.quotedbl;case"#":return a.numbersign;case"%":return a.percent;case"&":return a.ampersand;case"'":return a.quotesingle;case"(":return a.parenleft;case")":return a.parenright;case"*":return a.asterisk;case"+":return a.plus;case",":return a.comma;case"-":return a.hyphen;case".":return a.period;case"/":return a.slash;case"_":return a.underscore;case":":return a.colon;case";":return a.semicolon;case"<":return a.less;case"=":return a.equal;case">":return a.greater;
case"?":return a.question;case"@":return a.at;case"[":return a.bracketleft;case"\\":return a.backslash;case"]":return a.bracketright;case"^":return a.asciicircum;case"`":return a.grave;case"{":return a.braceleft;case"|":return a.bar;case"}":return a.braceright;case"~":return a.asciitilde;default:return a[b]}}catch(c){H.debug(c)}},yd.prototype.text$line=function(a,b,c,d,e){var f=0,g=0;if(hc.glyph){var h=t.glyphTable[cc];Rd(),v.translate(b,c+dc),(e===o.RIGHT||e===o.CENTER)&&(f=h.width(a),g=e===o.RIGHT?-f:-f/2);var i=h.units_per_em,j=1/i*dc;v.scale(j,j);for(var k=0,l=a.length;l>k;k++)try{t.glyphLook(h,a[k]).draw()}catch(m){H.debug(m)}Sd()}else a&&"fillText"in v&&(F&&(v.fillStyle=t.color.toString(C),F=!1),(e===o.RIGHT||e===o.CENTER)&&(f=hc.measureTextWidth(a),g=e===o.RIGHT?-f:-f/2),v.fillText(a,b+g,c))},zd.prototype.text$line=function(a,c,e,f,g){wb===d&&(wb=b.createElement("canvas"));var h=v;v=wb.getContext("2d"),v.font=hc.css;var i=hc.measureTextWidth(a);wb.width=i,wb.height=dc,v=wb.getContext("2d"),v.font=hc.css,v.textBaseline="top",yd.prototype.text$line(a,0,0,0,o.LEFT);var j=wb.width/wb.height;v=h,v.bindTexture(v.TEXTURE_2D,Ub),v.texImage2D(v.TEXTURE_2D,0,v.RGBA,v.RGBA,v.UNSIGNED_BYTE,wb),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,v.LINEAR),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,v.CLAMP_TO_EDGE),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,v.CLAMP_TO_EDGE);var k=0;g===o.RIGHT?k=-i:g===o.CENTER&&(k=-i/2);var l=new Ld,m=.5*dc;l.translate(c+k-m/2,e-m,f),l.scale(-j*m,-m,m),l.translate(-1,-1,-1),l.transpose();var n=new Ld;n.scale(1,-1,1),n.apply(Gc.array()),n.transpose(),v.useProgram(Fb),qd("aVertex2d",Fb,"aVertex",3,Yb),qd("aTextureCoord2d",Fb,"aTextureCoord",2,Zb),od("uSampler2d",Fb,"uSampler",[0]),od("uIsDrawingText2d",Fb,"uIsDrawingText",!0),pd("uModel2d",Fb,"uModel",!1,l.array()),pd("uView2d",Fb,"uView",!1,n.array()),nd("uColor2d",Fb,"uColor",B),v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,$b),v.drawElements(v.TRIANGLES,6,v.UNSIGNED_SHORT,0)},t.text=function(){bc!==o.SHAPE&&(3===arguments.length?Qe(Pe(arguments[0]),arguments[1],arguments[2],0):4===arguments.length?Qe(Pe(arguments[0]),arguments[1],arguments[2],arguments[3]):5===arguments.length?Re(Pe(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],0):6===arguments.length&&Re(Pe(arguments[0]),arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]))},t.textMode=function(a){bc=a},t.loadGlyphs=function(e){var f,g,h,i,j,k,l,m,n,o,p,r,q="[0-9\\-]+",s=function(a,b){var e,c=0,d=[],f=RegExp(a,"g");for(e=d[c]=f.exec(b);e;)c++,e=d[c]=f.exec(b);return d},u=function(a){var b=s("[A-Za-z][0-9\\- ]+|Z",a),d=function(){return Rd(),y.$ensureContext()},e=function(){le(),me(),Sd()};r="return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();",f=0,g=0,h=0,i=0,j=0,k=0,a=0,m=0,n="",o=b.length-1;for(var l=0;o>l;l++){var t=b[l][0],u=s(q,t);switch(t[0]){case"M":f=parseFloat(u[0][0]),g=parseFloat(u[1][0]),r+="curContext.moveTo("+f+","+-g+");";break;case"L":f=parseFloat(u[0][0]),g=parseFloat(u[1][0]),r+="curContext.lineTo("+f+","+-g+");";break;case"H":f=parseFloat(u[0][0]),r+="curContext.lineTo("+f+","+-g+");";break;case"V":g=parseFloat(u[0][0]),r+="curContext.lineTo("+f+","+-g+");";break;case"T":j=parseFloat(u[0][0]),k=parseFloat(u[1][0]),"Q"===n||"T"===n?(a=c.sqrt(c.pow(f-h,2)+c.pow(i-g,2)),m=c.PI+c.atan2(h-f,i-g),h=f+c.sin(m)*a,i=g+c.cos(m)*a):(h=f,i=g),r+="curContext.quadraticCurveTo("+h+","+-i+","+j+","+-k+");",f=j,g=k;break;case"Q":h=parseFloat(u[0][0]),i=parseFloat(u[1][0]),j=parseFloat(u[2][0]),k=parseFloat(u[3][0]),r+="curContext.quadraticCurveTo("+h+","+-i+","+j+","+-k+");",f=j,g=k;break;case"Z":r+="curContext.closePath();"}n=t[0]}return r+="afterPathDraw();",r+="curContext.translate("+p+",0);",r+="}}",Function("beforePathDraw","afterPathDraw",r)(d,e)},v=function(a){var b=a.getElementsByTagName("font");t.glyphTable[e].horiz_adv_x=b[0].getAttribute("horiz-adv-x");var c=a.getElementsByTagName("font-face")[0];t.glyphTable[e].units_per_em=parseFloat(c.getAttribute("units-per-em")),t.glyphTable[e].ascent=parseFloat(c.getAttribute("ascent")),t.glyphTable[e].descent=parseFloat(c.getAttribute("descent"));for(var f=a.getElementsByTagName("glyph"),g=f.length,h=0;g>h;h++){var i=f[h].getAttribute("unicode"),j=f[h].getAttribute("glyph-name");p=f[h].getAttribute("horiz-adv-x"),null===p&&(p=t.glyphTable[e].horiz_adv_x),l=f[h].getAttribute("d"),l!==d&&(r=u(l),t.glyphTable[e][j]={name:j,unicode:i,horiz_adv_x:p,draw:r.draw})}},w=function(){var c;try{c=b.implementation.createDocument("","",null)}catch(d){return H.debug(d.message),void 0}try{c.async=!1,c.load(e),v(c.getElementsByTagName("svg")[0])}catch(f){H.debug(f);try{var g=new a.XMLHttpRequest;g.open("GET",e,!1),g.send(null),v(g.responseXML.documentElement)}catch(h){H.debug(f)}}};return t.glyphTable[e]={},w(e),t.glyphTable[e]},t.param=function(a){var b="data-processing-"+a;if(j.hasAttribute(b))return j.getAttribute(b);for(var c=0,d=j.childNodes.length;d>c;++c){var e=j.childNodes.item(c);if(1===e.nodeType&&"param"===e.tagName.toLowerCase()&&e.getAttribute("name")===a)return e.getAttribute("value")}return x.params.hasOwnProperty(a)?x.params[a]:null},Ad.prototype.translate=Te("translate"),Ad.prototype.transform=Te("transform"),Ad.prototype.scale=Te("scale"),Ad.prototype.pushMatrix=Te("pushMatrix"),Ad.prototype.popMatrix=Te("popMatrix"),Ad.prototype.resetMatrix=Te("resetMatrix"),Ad.prototype.applyMatrix=Te("applyMatrix"),Ad.prototype.rotate=Te("rotate"),Ad.prototype.rotateZ=Te("rotateZ"),Ad.prototype.shearX=Te("shearX"),Ad.prototype.shearY=Te("shearY"),Ad.prototype.redraw=Te("redraw"),Ad.prototype.toImageData=Te("toImageData"),Ad.prototype.ambientLight=Te("ambientLight"),Ad.prototype.directionalLight=Te("directionalLight"),Ad.prototype.lightFalloff=Te("lightFalloff"),Ad.prototype.lightSpecular=Te("lightSpecular"),Ad.prototype.pointLight=Te("pointLight"),Ad.prototype.noLights=Te("noLights"),Ad.prototype.spotLight=Te("spotLight"),Ad.prototype.beginCamera=Te("beginCamera"),Ad.prototype.endCamera=Te("endCamera"),Ad.prototype.frustum=Te("frustum"),Ad.prototype.box=Te("box"),Ad.prototype.sphere=Te("sphere"),Ad.prototype.ambient=Te("ambient"),Ad.prototype.emissive=Te("emissive"),Ad.prototype.shininess=Te("shininess"),Ad.prototype.specular=Te("specular"),Ad.prototype.fill=Te("fill"),Ad.prototype.stroke=Te("stroke"),Ad.prototype.strokeWeight=Te("strokeWeight"),Ad.prototype.smooth=Te("smooth"),Ad.prototype.noSmooth=Te("noSmooth"),Ad.prototype.point=Te("point"),Ad.prototype.vertex=Te("vertex"),Ad.prototype.endShape=Te("endShape"),Ad.prototype.bezierVertex=Te("bezierVertex"),Ad.prototype.curveVertex=Te("curveVertex"),Ad.prototype.curve=Te("curve"),Ad.prototype.line=Te("line"),Ad.prototype.bezier=Te("bezier"),Ad.prototype.rect=Te("rect"),Ad.prototype.ellipse=Te("ellipse"),Ad.prototype.background=Te("background"),Ad.prototype.image=Te("image"),Ad.prototype.textWidth=Te("textWidth"),Ad.prototype.text$line=Te("text$line"),Ad.prototype.$ensureContext=Te("$ensureContext"),Ad.prototype.$newPMatrix=Te("$newPMatrix"),Ad.prototype.size=function(a,b,c){Se(c===o.WEBGL?"3D":"2D"),t.size(a,b,c)},Ad.prototype.$init=f,yd.prototype.$init=function(){t.size(t.width,t.height),v.lineCap="round",t.noSmooth(),t.disableContextMenu()},zd.prototype.$init=function(){t.use3DContext=!0,t.disableContextMenu()},xd.prototype.$ensureContext=function(){return v},Vd(j,"touchstart",function(a){j.setAttribute("style","-webkit-user-select: none"),j.setAttribute("onclick","void(0)"),j.setAttribute("style","-webkit-tap-highlight-color:rgba(0,0,0,0)");for(var b=0,c=Ud.length;c>b;b++){var e=Ud[b].type;("mouseout"===e||"mousemove"===e||"mousedown"===e||"mouseup"===e||"DOMMouseScroll"===e||"mousewheel"===e||"touchstart"===e)&&Wd(Ud[b])}t.touchStart!==d||t.touchMove!==d||t.touchEnd!==d||t.touchCancel!==d?(Vd(j,"touchstart",function(a){t.touchStart!==d&&(a=We(a),t.touchStart(a))}),Vd(j,"touchmove",function(a){t.touchMove!==d&&(a.preventDefault(),a=We(a),t.touchMove(a))}),Vd(j,"touchend",function(a){t.touchEnd!==d&&(a=We(a),t.touchEnd(a))}),Vd(j,"touchcancel",function(a){t.touchCancel!==d&&(a=We(a),t.touchCancel(a))})):(Vd(j,"touchstart",function(a){Ve(j,a.touches[0]),t.__mousePressed=!0,t.mouseDragging=!1,t.mouseButton=o.LEFT,"function"==typeof t.mousePressed&&t.mousePressed()}),Vd(j,"touchmove",function(a){a.preventDefault(),Ve(j,a.touches[0]),"function"!=typeof t.mouseMoved||t.__mousePressed||t.mouseMoved(),"function"==typeof t.mouseDragged&&t.__mousePressed&&(t.mouseDragged(),t.mouseDragging=!0)}),Vd(j,"touchend",function(){t.__mousePressed=!1,"function"!=typeof t.mouseClicked||t.mouseDragging||t.mouseClicked(),"function"==typeof t.mouseReleased&&t.mouseReleased()})),j.dispatchEvent(a)}),function(){var a=!0,b=function(a){a.preventDefault(),a.stopPropagation()};t.disableContextMenu=function(){a&&(Vd(j,"contextmenu",b),a=!1)},t.enableContextMenu=function(){a||(Wd({elem:j,type:"contextmenu",fn:b}),a=!0)}}(),Vd(j,"mousemove",function(a){Ve(j,a),"function"!=typeof t.mouseMoved||t.__mousePressed||t.mouseMoved(),"function"==typeof t.mouseDragged&&t.__mousePressed&&(t.mouseDragged(),t.mouseDragging=!0)}),Vd(j,"mouseout",function(){"function"==typeof t.mouseOut&&t.mouseOut()}),Vd(j,"mouseover",function(a){Ve(j,a),"function"==typeof t.mouseOver&&t.mouseOver()}),j.onmousedown=function(){return j.focus(),!1},Vd(j,"mousedown",function(a){switch(t.__mousePressed=!0,t.mouseDragging=!1,a.which){case 1:t.mouseButton=o.LEFT;break;case 2:t.mouseButton=o.CENTER;break;case 3:t.mouseButton=o.RIGHT}"function"==typeof t.mousePressed&&t.mousePressed()}),Vd(j,"mouseup",function(){t.__mousePressed=!1,"function"!=typeof t.mouseClicked||t.mouseDragging||t.mouseClicked(),"function"==typeof t.mouseReleased&&t.mouseReleased()});var Xe=function(b){var c=0;b.wheelDelta?(c=b.wheelDelta/120,a.opera&&(c=-c)):b.detail&&(c=-b.detail/3),t.mouseScroll=c,c&&"function"==typeof t.mouseScrolled&&t.mouseScrolled()};if(Vd(b,"DOMMouseScroll",Xe),Vd(b,"mousewheel",Xe),j.getAttribute("tabindex")||j.setAttribute("tabindex",0),r)x=new H.Sketch,Se(),t.size=function(a,b,c){c&&c===o.WEBGL?Se("3D"):Se("2D"),t.size(a,b,c)};else{x=i instanceof H.Sketch?i:"function"==typeof i?new H.Sketch(i):i?H.compile(i):new H.Sketch(function(){}),t.externals.sketch=x,Se(),j.onfocus=function(){t.focused=!0},j.onblur=function(){t.focused=!1,x.options.globalKeyEvents||af()},x.options.pauseOnBlur&&(Vd(a,"focus",function(){P&&t.loop()}),Vd(a,"blur",function(){P&&N&&(t.noLoop(),P=!0),af()}));var ff=x.options.globalKeyEvents?a:j;Vd(ff,"keydown",cf),Vd(ff,"keypress",df),Vd(ff,"keyup",ef);for(var gf in H.lib)H.lib.hasOwnProperty(gf)&&(H.lib[gf].hasOwnProperty("attach")?H.lib[gf].attach(t):H.lib[gf]instanceof Function&&H.lib[gf].call(this));var hf=100,jf=function(c){if(x.imageCache.pending||G.preloading.pending(hf))a.setTimeout(function(){jf(c)},hf);else{if(a.opera){var d,e,f=x.imageCache.operaCache;for(d in f)f.hasOwnProperty(d)&&(e=f[d],null!==e&&b.body.removeChild(e),delete f[d])}x.attach(c,w),x.onLoad(c),c.setup&&(c.setup(),c.resetMatrix(),x.onSetup()),Fe(),c.draw&&(P?c.loop():c.redraw())}};E(this),jf(t)}};H.debug=g,H.prototype=w,H.compile=function(a){var b=new H.Sketch,c=K(a,b),d=J(c);return b.sourceCode=d,b};var L=function(){"use strict";var a={},c="undefined",d="function",e=!1,f=!0,g=512,h="log";return typeof tinylog!==c&&typeof tinylog[h]===d?a[h]=tinylog[h]:typeof b===c||b.fake?typeof print===d&&(a[h]=print):function(){var c=b,d="div",i="style",j="title",k={zIndex:1e4,position:"fixed",bottom:"0px",width:"100%",height:"15%",fontFamily:"sans-serif",color:"#ccc",backgroundColor:"black"},l={position:"relative",fontFamily:"monospace",overflow:"auto",height:"100%",paddingTop:"5px"},m={height:"5px",marginTop:"-5px",cursor:"n-resize",backgroundColor:"darkgrey"},n={position:"absolute",top:"5px",right:"20px",color:"#111",MozBorderRadius:"4px",webkitBorderRadius:"4px",borderRadius:"4px",cursor:"pointer",fontWeight:"normal",textAlign:"center",padding:"3px 5px",backgroundColor:"#333",fontSize:"12px"},o={minHeight:"16px"},p={fontSize:"12px",margin:"0 8px 0 8px",maxWidth:"100%",whiteSpace:"pre-wrap",overflow:"auto"},q=c.defaultView,r=c.documentElement,s=r[i],t=function(){for(var b,c,d,a=arguments.length;a--;){c=arguments[a--],b=arguments[a][i];for(d in c)c.hasOwnProperty(d)&&(b[d]=c[d])}},u=function(a,b,c){return a.addEventListener?a.addEventListener(b,c,e):a.attachEvent&&a.attachEvent("on"+b,c),[a,b,c]},v=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,e):a.detachEvent&&a.detachEvent("on"+b,c)},w=function(a){for(var b=a.childNodes,c=b.length;c--;)a.removeChild(b.item(0))},x=function(a,b){return a.appendChild(b)},y=function(a){return c.createElement(a)},z=function(a){return c.createTextNode(a)},A=a[h]=function(b){var B,C=s.paddingBottom,D=y(d),E=D[i],F=x(D,y(d)),G=x(D,y(d)),H=x(D,y(d)),I=e,J=e,K=e,L=0,M=function(){s.paddingBottom=D.clientHeight+"px"},N=function(a){var b=q.innerHeight,c=F.clientHeight;0>a?a=0:a+c>b&&(a=b-c),E.height=100*(a/b)+"%",M()},O=[u(c,"mousemove",function(a){I&&(N(q.innerHeight-a.clientY),G.scrollTop=K)}),u(c,"mouseup",function(){I&&(I=K=e)}),u(F,"dblclick",function(a){a.preventDefault(),J?(N(J),J=e):(J=D.clientHeight,E.height="0px")}),u(F,"mousedown",function(a){a.preventDefault(),I=f,K=G.scrollTop}),u(F,"contextmenu",function(){I=e}),u(H,"click",function(){B()})];B=function(){for(var b=O.length;b--;)v.apply(a,O[b]);r.removeChild(D),s.paddingBottom=C,w(G),w(D),a[h]=A},t(D,k,G,l,F,m,H,n),H[j]="Close Log",x(H,z("\u2716")),F[j]="Double-click to toggle log minimization",r.insertBefore(D,r.firstChild),a[h]=function(a){L===g?G.removeChild(G.firstChild):L++;var b=x(G,y(d)),c=x(b,y(d));b[j]=(new Date).toLocaleTimeString(),t(b,o,c,p),x(c,z(a)),G.scrollTop=G.scrollHeight},a[h](b),M()}}(),a}();H.logger=L,H.version="1.4.1",H.lib={},H.registerLibrary=function(a,b){H.lib[a]=b,b.hasOwnProperty("init")&&b.init(w)},H.instances=B,H.getInstanceById=function(a){return B[C[a]]},H.Sketch=function(c){this.attachFunction=c,this.options={pauseOnBlur:!1,globalKeyEvents:!1},this.onLoad=f,this.onSetup=f,this.onPause=f,this.onLoop=f,this.onFrameStart=f,this.onFrameEnd=f,this.onExit=f,this.params={},this.imageCache={pending:0,images:{},operaCache:{},add:function(c,d){if(!this.images[c]&&(i||(this.images[c]=null),d||(d=new Image,d.onload=function(a){return function(){a.pending--}}(this),this.pending++,d.src=c),this.images[c]=d,a.opera)){var e=b.createElement("div");e.appendChild(d),e.style.position="absolute",e.style.opacity=0,e.style.width="1px",e.style.height="1px",this.operaCache[c]||(b.body.appendChild(e),this.operaCache[c]=e)}}},this.sourceCode=void 0,this.attach=function(a){if("function"==typeof this.attachFunction)this.attachFunction(a);else if(this.sourceCode){var b=Function("return ("+this.sourceCode+");")();b(a),this.attachFunction=b}else e("Unable to attach sketch to the processing instance")},this.toString=function(){var a,b="((function(Sketch) {\n";b+="var sketch = new Sketch(\n"+this.sourceCode+");\n";for(a in this.options)if(this.options.hasOwnProperty(a)){var c=this.options[a];b+="sketch.options."+a+" = "+("string"==typeof c?'"'+c+'"':""+c)+";\n"}for(a in this.imageCache)this.options.hasOwnProperty(a)&&(b+='sketch.imageCache.add("'+a+'");\n');return b+="return sketch;\n})(Processing.Sketch))"}};var M=function(c,d){function j(b,c){var d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState){var b;200!==d.status&&0!==d.status?b="Invalid XHR status "+d.status:""===d.responseText&&(b="withCredentials"in new XMLHttpRequest&&(new XMLHttpRequest).withCredentials===!1&&"file:"===a.location.protocol?"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.":"File is empty."),c(d.responseText,b)}},d.open("GET",b,!0),d.overrideMimeType&&d.overrideMimeType("application/json"),d.setRequestHeader("If-Modified-Since","Fri, 01 Jan 1960 00:00:00 GMT"),d.send(null)}function k(a,d){function k(b,j){if(f[a]=b,++i,j&&g.push(d+" ==> "+j),i===h)if(0===g.length)try{return new H(c,f.join("\n"))}catch(k){e("Processing.js: Unable to execute pjs sketch: "+k)}else e("Processing.js: Unable to load pjs sketch files: "+g.join("\n"))}if("#"===d.charAt(0)){var l=b.getElementById(d.substring(1));return l?k(l.text||l.textContent):k("","Unable to load pjs sketch: element with id '"+d.substring(1)+"' was not found"),void 0}j(d,k)}for(var f=[],g=[],h=d.length,i=0,l=0;h>l;++l)k(l,d[l])},N=function(){b.removeEventListener("DOMContentLoaded",N,!1),B=[],H.instances=B;for(var c,a=b.getElementsByTagName("canvas"),e=0,f=a.length;f>e;e++){var g=a[e].getAttribute("data-processing-sources");if(null===g&&(g=a[e].getAttribute("data-src"),null===g&&(g=a[e].getAttribute("datasrc"))),g){c=g.split(/\s+/g);for(var h=0;c.length>h;)c[h]?h++:c.splice(h,1);M(a[e],c)}}var i,j,k,l,m=b.getElementsByTagName("script"),n=[];for(i=m.length-1;i>=0;i--)n.push(m[i]);for(i=0,j=n.length;j>i;i++){var o=n[i];if(o.getAttribute){var p=o.getAttribute("type");if(p&&("text/processing"===p.toLowerCase()||"application/processing"===p.toLowerCase())){var q=o.getAttribute("data-processing-target");if(a=d,q)a=b.getElementById(q);else{for(var r=o.nextSibling;r&&1!==r.nodeType;)r=r.nextSibling;r&&"canvas"===r.nodeName.toLowerCase()&&(a=r)}if(a){if(o.getAttribute("src")){c=o.getAttribute("src").split(/\s+/),M(a,c);continue}k=o.textContent||o.text,l=new H(a,k)}}}}};H.reload=function(){if(B.length>0)for(var a=B.length-1;a>=0;a--)B[a]&&B[a].exit();N()},H.loadSketchFromSources=M,H.disableInit=function(){i&&b.removeEventListener("DOMContentLoaded",N,!1)},i?(a.Processing=H,b.addEventListener("DOMContentLoaded",N,!1)):this.Processing=H})(window,window.document,Math);