aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Code/ZJW/javascripts/processing.min.js')
-rw-r--r--Code/ZJW/javascripts/processing.min.js12665
1 files changed, 12665 insertions, 0 deletions
diff --git a/Code/ZJW/javascripts/processing.min.js b/Code/ZJW/javascripts/processing.min.js
new file mode 100644
index 0000000..81e7fe8
--- /dev/null
+++ b/Code/ZJW/javascripts/processing.min.js
@@ -0,0 +1,12665 @@
1/***
2
3 P R O C E S S I N G . J S - 1.4.1
4 a port of the Processing visualization language
5
6 Processing.js is licensed under the MIT License, see LICENSE.
7 For a list of copyright holders, please refer to AUTHORS.
8
9 http://processingjs.org
10
11***/
12
13(function(D, d, q, t) {
14 var G = function() {};
15 var s = function() {
16 if ("console" in D) {
17 return function(N) {
18 D.console.log("Processing.js: " + N)
19 }
20 }
21 return G
22 }();
23 var w = function(N) {
24 var O = new XMLHttpRequest;
25 O.open("GET", N, false);
26 if (O.overrideMimeType) {
27 O.overrideMimeType("text/plain")
28 }
29 O.setRequestHeader("If-Modified-Since", "Fri, 01 Jan 1960 00:00:00 GMT");
30 O.send(null);
31 if (O.status !== 200 && O.status !== 0) {
32 throw "XMLHttpRequest failed, status code " + O.status
33 }
34 return O.responseText
35 };
36 var n = "document" in this && !("fake" in this.document);
37 d.head = d.head || d.getElementsByTagName("head")[0];
38
39 function C(N, O) {
40 if (N in D) {
41 return D[N]
42 }
43 if (typeof D[O] === "function") {
44 return D[O]
45 }
46 return function(Q) {
47 if (Q instanceof Array) {
48 return Q
49 }
50 if (typeof Q === "number") {
51 var P = [];
52 P.length = Q;
53 return P
54 }
55 }
56 }
57 if (d.documentMode >= 9 && !d.doctype) {
58 throw "The doctype directive is missing. The recommended doctype in Internet Explorer is the HTML5 doctype: <!DOCTYPE html>"
59 }
60 var e = C("Float32Array", "WebGLFloatArray"),
61 K = C("Int32Array", "WebGLIntArray"),
62 y = C("Uint16Array", "WebGLUnsignedShortArray"),
63 b = C("Uint8Array", "WebGLUnsignedByteArray");
64 var B = {
65 X: 0,
66 Y: 1,
67 Z: 2,
68 R: 3,
69 G: 4,
70 B: 5,
71 A: 6,
72 U: 7,
73 V: 8,
74 NX: 9,
75 NY: 10,
76 NZ: 11,
77 EDGE: 12,
78 SR: 13,
79 SG: 14,
80 SB: 15,
81 SA: 16,
82 SW: 17,
83 TX: 18,
84 TY: 19,
85 TZ: 20,
86 VX: 21,
87 VY: 22,
88 VZ: 23,
89 VW: 24,
90 AR: 25,
91 AG: 26,
92 AB: 27,
93 DR: 3,
94 DG: 4,
95 DB: 5,
96 DA: 6,
97 SPR: 28,
98 SPG: 29,
99 SPB: 30,
100 SHINE: 31,
101 ER: 32,
102 EG: 33,
103 EB: 34,
104 BEEN_LIT: 35,
105 VERTEX_FIELD_COUNT: 36,
106 P2D: 1,
107 JAVA2D: 1,
108 WEBGL: 2,
109 P3D: 2,
110 OPENGL: 2,
111 PDF: 0,
112 DXF: 0,
113 OTHER: 0,
114 WINDOWS: 1,
115 MAXOSX: 2,
116 LINUX: 3,
117 EPSILON: 0.0001,
118 MAX_FLOAT: 3.4028235e+38,
119 MIN_FLOAT: -3.4028235e+38,
120 MAX_INT: 2147483647,
121 MIN_INT: -2147483648,
122 PI: q.PI,
123 TWO_PI: 2 * q.PI,
124 HALF_PI: q.PI / 2,
125 THIRD_PI: q.PI / 3,
126 QUARTER_PI: q.PI / 4,
127 DEG_TO_RAD: q.PI / 180,
128 RAD_TO_DEG: 180 / q.PI,
129 WHITESPACE: " \t\n\r\u000c\u00a0",
130 RGB: 1,
131 ARGB: 2,
132 HSB: 3,
133 ALPHA: 4,
134 CMYK: 5,
135 TIFF: 0,
136 TARGA: 1,
137 JPEG: 2,
138 GIF: 3,
139 BLUR: 11,
140 GRAY: 12,
141 INVERT: 13,
142 OPAQUE: 14,
143 POSTERIZE: 15,
144 THRESHOLD: 16,
145 ERODE: 17,
146 DILATE: 18,
147 REPLACE: 0,
148 BLEND: 1 << 0,
149 ADD: 1 << 1,
150 SUBTRACT: 1 << 2,
151 LIGHTEST: 1 << 3,
152 DARKEST: 1 << 4,
153 DIFFERENCE: 1 << 5,
154 EXCLUSION: 1 << 6,
155 MULTIPLY: 1 << 7,
156 SCREEN: 1 << 8,
157 OVERLAY: 1 << 9,
158 HARD_LIGHT: 1 << 10,
159 SOFT_LIGHT: 1 << 11,
160 DODGE: 1 << 12,
161 BURN: 1 << 13,
162 ALPHA_MASK: 4278190080,
163 RED_MASK: 16711680,
164 GREEN_MASK: 65280,
165 BLUE_MASK: 255,
166 CUSTOM: 0,
167 ORTHOGRAPHIC: 2,
168 PERSPECTIVE: 3,
169 POINT: 2,
170 POINTS: 2,
171 LINE: 4,
172 LINES: 4,
173 TRIANGLE: 8,
174 TRIANGLES: 9,
175 TRIANGLE_STRIP: 10,
176 TRIANGLE_FAN: 11,
177 QUAD: 16,
178 QUADS: 16,
179 QUAD_STRIP: 17,
180 POLYGON: 20,
181 PATH: 21,
182 RECT: 30,
183 ELLIPSE: 31,
184 ARC: 32,
185 SPHERE: 40,
186 BOX: 41,
187 GROUP: 0,
188 PRIMITIVE: 1,
189 GEOMETRY: 3,
190 VERTEX: 0,
191 BEZIER_VERTEX: 1,
192 CURVE_VERTEX: 2,
193 BREAK: 3,
194 CLOSESHAPE: 4,
195 OPEN: 1,
196 CLOSE: 2,
197 CORNER: 0,
198 CORNERS: 1,
199 RADIUS: 2,
200 CENTER_RADIUS: 2,
201 CENTER: 3,
202 DIAMETER: 3,
203 CENTER_DIAMETER: 3,
204 BASELINE: 0,
205 TOP: 101,
206 BOTTOM: 102,
207 NORMAL: 1,
208 NORMALIZED: 1,
209 IMAGE: 2,
210 MODEL: 4,
211 SHAPE: 5,
212 SQUARE: "butt",
213 ROUND: "round",
214 PROJECT: "square",
215 MITER: "miter",
216 BEVEL: "bevel",
217 AMBIENT: 0,
218 DIRECTIONAL: 1,
219 SPOT: 3,
220 BACKSPACE: 8,
221 TAB: 9,
222 ENTER: 10,
223 RETURN: 13,
224 ESC: 27,
225 DELETE: 127,
226 CODED: 65535,
227 SHIFT: 16,
228 CONTROL: 17,
229 ALT: 18,
230 CAPSLK: 20,
231 PGUP: 33,
232 PGDN: 34,
233 END: 35,
234 HOME: 36,
235 LEFT: 37,
236 UP: 38,
237 RIGHT: 39,
238 DOWN: 40,
239 F1: 112,
240 F2: 113,
241 F3: 114,
242 F4: 115,
243 F5: 116,
244 F6: 117,
245 F7: 118,
246 F8: 119,
247 F9: 120,
248 F10: 121,
249 F11: 122,
250 F12: 123,
251 NUMLK: 144,
252 META: 157,
253 INSERT: 155,
254 ARROW: "default",
255 CROSS: "crosshair",
256 HAND: "pointer",
257 MOVE: "move",
258 TEXT: "text",
259 WAIT: "wait",
260 NOCURSOR: "url('data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), auto",
261 DISABLE_OPENGL_2X_SMOOTH: 1,
262 ENABLE_OPENGL_2X_SMOOTH: -1,
263 ENABLE_OPENGL_4X_SMOOTH: 2,
264 ENABLE_NATIVE_FONTS: 3,
265 DISABLE_DEPTH_TEST: 4,
266 ENABLE_DEPTH_TEST: -4,
267 ENABLE_DEPTH_SORT: 5,
268 DISABLE_DEPTH_SORT: -5,
269 DISABLE_OPENGL_ERROR_REPORT: 6,
270 ENABLE_OPENGL_ERROR_REPORT: -6,
271 ENABLE_ACCURATE_TEXTURES: 7,
272 DISABLE_ACCURATE_TEXTURES: -7,
273 HINT_COUNT: 10,
274 SINCOS_LENGTH: 720,
275 PRECISIONB: 15,
276 PRECISIONF: 1 << 15,
277 PREC_MAXVAL: (1 << 15) - 1,
278 PREC_ALPHA_SHIFT: 24 - 15,
279 PREC_RED_SHIFT: 16 - 15,
280 NORMAL_MODE_AUTO: 0,
281 NORMAL_MODE_SHAPE: 1,
282 NORMAL_MODE_VERTEX: 2,
283 MAX_LIGHTS: 8
284 };
285
286 function h(P) {
287 if (typeof P === "string") {
288 var O = 0;
289 for (var N = 0; N < P.length; ++N) {
290 O = O * 31 + P.charCodeAt(N) & 4294967295
291 }
292 return O
293 }
294 if (typeof P !== "object") {
295 return P & 4294967295
296 }
297 if (P.hashCode instanceof Function) {
298 return P.hashCode()
299 }
300 if (P.$id === t) {
301 P.$id = q.floor(q.random() * 65536) - 32768 << 16 | q.floor(q.random() * 65536)
302 }
303 return P.$id
304 }
305
306 function r(O, N) {
307 if (O === null || N === null) {
308 return O === null && N === null
309 }
310 if (typeof O === "string") {
311 return O === N
312 }
313 if (typeof O !== "object") {
314 return O === N
315 }
316 if (O.equals instanceof Function) {
317 return O.equals(N)
318 }
319 return O === N
320 }
321 var o = function(O) {
322 if (O.iterator instanceof Function) {
323 return O.iterator()
324 }
325 if (O instanceof Array) {
326 var N = -1;
327 this.hasNext = function() {
328 return ++N < O.length
329 };
330 this.next = function() {
331 return O[N]
332 }
333 } else {
334 throw "Unable to iterate: " + O
335 }
336 };
337 var f = function() {
338 function O(Q) {
339 var P = 0;
340 this.hasNext = function() {
341 return P < Q.length
342 };
343 this.next = function() {
344 return Q[P++]
345 };
346 this.remove = function() {
347 Q.splice(P, 1)
348 }
349 }
350
351 function N(P) {
352 var Q;
353 if (P instanceof N) {
354 Q = P.toArray()
355 } else {
356 Q = [];
357 if (typeof P === "number") {
358 Q.length = P > 0 ? P : 0
359 }
360 }
361 this.get = function(R) {
362 return Q[R]
363 };
364 this.contains = function(R) {
365 return this.indexOf(R) > -1
366 };
367 this.indexOf = function(T) {
368 for (var S = 0, R = Q.length; S < R; ++S) {
369 if (r(T, Q[S])) {
370 return S
371 }
372 }
373 return -1
374 };
375 this.lastIndexOf = function(S) {
376 for (var R = Q.length - 1; R >= 0; --R) {
377 if (r(S, Q[R])) {
378 return R
379 }
380 }
381 return -1
382 };
383 this.add = function() {
384 if (arguments.length === 1) {
385 Q.push(arguments[0])
386 } else {
387 if (arguments.length === 2) {
388 var R = arguments[0];
389 if (typeof R === "number") {
390 if (R >= 0 && R <= Q.length) {
391 Q.splice(R, 0, arguments[1])
392 } else {
393 throw R + " is not a valid index"
394 }
395 } else {
396 throw typeof R + " is not a number"
397 }
398 } else {
399 throw "Please use the proper number of parameters."
400 }
401 }
402 };
403 this.addAll = function(S, R) {
404 var T;
405 if (typeof S === "number") {
406 if (S < 0 || S > Q.length) {
407 throw "Index out of bounds for addAll: " + S + " greater or equal than " + Q.length
408 }
409 T = new o(R);
410 while (T.hasNext()) {
411 Q.splice(S++, 0, T.next())
412 }
413 } else {
414 T = new o(S);
415 while (T.hasNext()) {
416 Q.push(T.next())
417 }
418 }
419 };
420 this.set = function() {
421 if (arguments.length === 2) {
422 var R = arguments[0];
423 if (typeof R === "number") {
424 if (R >= 0 && R < Q.length) {
425 Q.splice(R, 1, arguments[1])
426 } else {
427 throw R + " is not a valid index."
428 }
429 } else {
430 throw typeof R + " is not a number"
431 }
432 } else {
433 throw "Please use the proper number of parameters."
434 }
435 };
436 this.size = function() {
437 return Q.length
438 };
439 this.clear = function() {
440 Q.length = 0
441 };
442 this.remove = function(R) {
443 if (typeof R === "number") {
444 return Q.splice(R, 1)[0]
445 }
446 R = this.indexOf(R);
447 if (R > -1) {
448 Q.splice(R, 1);
449 return true
450 }
451 return false
452 };
453 this.removeAll = function(V) {
454 var S, R, U, T = new N;
455 T.addAll(this);
456 this.clear();
457 for (S = 0, R = 0; S < T.size(); S++) {
458 U = T.get(S);
459 if (!V.contains(U)) {
460 this.add(R++, U)
461 }
462 }
463 if (this.size() < T.size()) {
464 return true
465 }
466 return false
467 };
468 this.isEmpty = function() {
469 return !Q.length
470 };
471 this.clone = function() {
472 return new N(this)
473 };
474 this.toArray = function() {
475 return Q.slice(0)
476 };
477 this.iterator = function() {
478 return new O(Q)
479 }
480 }
481 return N
482 }();
483 var x = function() {
484 function N() {
485 if (arguments.length === 1 && arguments[0] instanceof N) {
486 return arguments[0].clone()
487 }
488 var W = arguments.length > 0 ? arguments[0] : 16;
489 var X = arguments.length > 1 ? arguments[1] : 0.75;
490 var Q = [];
491 Q.length = W;
492 var S = 0;
493 var O = this;
494
495 function U(Z) {
496 var Y = h(Z) % Q.length;
497 return Y < 0 ? Q.length + Y : Y
498 }
499
500 function R() {
501 if (S <= X * Q.length) {
502 return
503 }
504 var ab = [];
505 for (var aa = 0; aa < Q.length; ++aa) {
506 if (Q[aa] !== t) {
507 ab = ab.concat(Q[aa])
508 }
509 }
510 var ac = Q.length * 2;
511 Q = [];
512 Q.length = ac;
513 for (var Z = 0; Z < ab.length; ++Z) {
514 var Y = U(ab[Z].key);
515 var ad = Q[Y];
516 if (ad === t) {
517 Q[Y] = ad = []
518 }
519 ad.push(ab[Z])
520 }
521 }
522
523 function P(ad, ae) {
524 var Y = 0;
525 var ac = -1;
526 var ab = false;
527 var aa;
528
529 function Z() {
530 while (!ab) {
531 ++ac;
532 if (Y >= Q.length) {
533 ab = true
534 } else {
535 if (Q[Y] === t || ac >= Q[Y].length) {
536 ac = -1;
537 ++Y
538 } else {
539 return
540 }
541 }
542 }
543 }
544 this.hasNext = function() {
545 return !ab
546 };
547 this.next = function() {
548 aa = ad(Q[Y][ac]);
549 Z();
550 return aa
551 };
552 this.remove = function() {
553 if (aa !== t) {
554 ae(aa);
555 --ac;
556 Z()
557 }
558 };
559 Z()
560 }
561
562 function V(Y, Z, aa) {
563 this.clear = function() {
564 O.clear()
565 };
566 this.contains = function(ab) {
567 return Z(ab)
568 };
569 this.containsAll = function(ac) {
570 var ab = ac.iterator();
571 while (ab.hasNext()) {
572 if (!this.contains(ab.next())) {
573 return false
574 }
575 }
576 return true
577 };
578 this.isEmpty = function() {
579 return O.isEmpty()
580 };
581 this.iterator = function() {
582 return new P(Y, aa)
583 };
584 this.remove = function(ab) {
585 if (this.contains(ab)) {
586 aa(ab);
587 return true
588 }
589 return false
590 };
591 this.removeAll = function(ae) {
592 var ab = ae.iterator();
593 var ad = false;
594 while (ab.hasNext()) {
595 var ac = ab.next();
596 if (this.contains(ac)) {
597 aa(ac);
598 ad = true
599 }
600 }
601 return true
602 };
603 this.retainAll = function(af) {
604 var ad = this.iterator();
605 var ac = [];
606 while (ad.hasNext()) {
607 var ae = ad.next();
608 if (!af.contains(ae)) {
609 ac.push(ae)
610 }
611 }
612 for (var ab = 0; ab < ac.length; ++ab) {
613 aa(ac[ab])
614 }
615 return ac.length > 0
616 };
617 this.size = function() {
618 return O.size()
619 };
620 this.toArray = function() {
621 var ab = [];
622 var ac = this.iterator();
623 while (ac.hasNext()) {
624 ab.push(ac.next())
625 }
626 return ab
627 }
628 }
629
630 function T(Y) {
631 this._isIn = function(Z) {
632 return Z === O && Y.removed === t
633 };
634 this.equals = function(Z) {
635 return r(Y.key, Z.getKey())
636 };
637 this.getKey = function() {
638 return Y.key
639 };
640 this.getValue = function() {
641 return Y.value
642 };
643 this.hashCode = function(Z) {
644 return h(Y.key)
645 };
646 this.setValue = function(aa) {
647 var Z = Y.value;
648 Y.value = aa;
649 return Z
650 }
651 }
652 this.clear = function() {
653 S = 0;
654 Q = [];
655 Q.length = W
656 };
657 this.clone = function() {
658 var Y = new N;
659 Y.putAll(this);
660 return Y
661 };
662 this.containsKey = function(aa) {
663 var Y = U(aa);
664 var ab = Q[Y];
665 if (ab === t) {
666 return false
667 }
668 for (var Z = 0; Z < ab.length; ++Z) {
669 if (r(ab[Z].key, aa)) {
670 return true
671 }
672 }
673 return false
674 };
675 this.containsValue = function(aa) {
676 for (var Z = 0; Z < Q.length; ++Z) {
677 var ab = Q[Z];
678 if (ab === t) {
679 continue
680 }
681 for (var Y = 0; Y < ab.length; ++Y) {
682 if (r(ab[Y].value, aa)) {
683 return true
684 }
685 }
686 }
687 return false
688 };
689 this.entrySet = function() {
690 return new V(function(Y) {
691 return new T(Y)
692 }, function(Y) {
693 return Y instanceof T && Y._isIn(O)
694 }, function(Y) {
695 return O.remove(Y.getKey())
696 })
697 };
698 this.get = function(aa) {
699 var Y = U(aa);
700 var ab = Q[Y];
701 if (ab === t) {
702 return null
703 }
704 for (var Z = 0; Z < ab.length; ++Z) {
705 if (r(ab[Z].key, aa)) {
706 return ab[Z].value
707 }
708 }
709 return null
710 };
711 this.isEmpty = function() {
712 return S === 0
713 };
714 this.keySet = function() {
715 return new V(function(Y) {
716 return Y.key
717 }, function(Y) {
718 return O.containsKey(Y)
719 }, function(Y) {
720 return O.remove(Y)
721 })
722 };
723 this.values = function() {
724 return new V(function(Y) {
725 return Y.value
726 }, function(Y) {
727 return O.containsValue(Y)
728 }, function(Y) {
729 return O.removeByValue(Y)
730 })
731 };
732 this.put = function(aa, ac) {
733 var Y = U(aa);
734 var ad = Q[Y];
735 if (ad === t) {
736 ++S;
737 Q[Y] = [{
738 key: aa,
739 value: ac
740 }];
741 R();
742 return null
743 }
744 for (var Z = 0; Z < ad.length; ++Z) {
745 if (r(ad[Z].key, aa)) {
746 var ab = ad[Z].value;
747 ad[Z].value = ac;
748 return ab
749 }
750 }++S;
751 ad.push({
752 key: aa,
753 value: ac
754 });
755 R();
756 return null
757 };
758 this.putAll = function(Y) {
759 var Z = Y.entrySet().iterator();
760 while (Z.hasNext()) {
761 var aa = Z.next();
762 this.put(aa.getKey(), aa.getValue())
763 }
764 };
765 this.remove = function(aa) {
766 var Y = U(aa);
767 var ac = Q[Y];
768 if (ac === t) {
769 return null
770 }
771 for (var Z = 0; Z < ac.length; ++Z) {
772 if (r(ac[Z].key, aa)) {
773 --S;
774 var ab = ac[Z].value;
775 ac[Z].removed = true;
776 if (ac.length > 1) {
777 ac.splice(Z, 1)
778 } else {
779 Q[Y] = t
780 }
781 return ab
782 }
783 }
784 return null
785 };
786 this.removeByValue = function(aa) {
787 var ac, Z, Y, ab;
788 for (ac in Q) {
789 if (Q.hasOwnProperty(ac)) {
790 for (Z = 0, Y = Q[ac].length; Z < Y; Z++) {
791 ab = Q[ac][Z];
792 if (ab.value === aa) {
793 Q[ac].splice(Z, 1);
794 return true
795 }
796 }
797 }
798 }
799 return false
800 };
801 this.size = function() {
802 return S
803 }
804 }
805 return N
806 }();
807 var A = function() {
808 function N(Q, S, R) {
809 this.x = Q || 0;
810 this.y = S || 0;
811 this.z = R || 0
812 }
813 N.dist = function(R, Q) {
814 return R.dist(Q)
815 };
816 N.dot = function(R, Q) {
817 return R.dot(Q)
818 };
819 N.cross = function(R, Q) {
820 return R.cross(Q)
821 };
822 N.angleBetween = function(R, Q) {
823 return q.acos(R.dot(Q) / (R.mag() * Q.mag()))
824 };
825 N.prototype = {
826 set: function(Q, S, R) {
827 if (arguments.length === 1) {
828 this.set(Q.x || Q[0] || 0, Q.y || Q[1] || 0, Q.z || Q[2] || 0)
829 } else {
830 this.x = Q;
831 this.y = S;
832 this.z = R
833 }
834 },
835 get: function() {
836 return new N(this.x, this.y, this.z)
837 },
838 mag: function() {
839 var Q = this.x,
840 S = this.y,
841 R = this.z;
842 return q.sqrt(Q * Q + S * S + R * R)
843 },
844 add: function(Q, S, R) {
845 if (arguments.length === 1) {
846 this.x += Q.x;
847 this.y += Q.y;
848 this.z += Q.z
849 } else {
850 this.x += Q;
851 this.y += S;
852 this.z += R
853 }
854 },
855 sub: function(Q, S, R) {
856 if (arguments.length === 1) {
857 this.x -= Q.x;
858 this.y -= Q.y;
859 this.z -= Q.z
860 } else {
861 this.x -= Q;
862 this.y -= S;
863 this.z -= R
864 }
865 },
866 mult: function(Q) {
867 if (typeof Q === "number") {
868 this.x *= Q;
869 this.y *= Q;
870 this.z *= Q
871 } else {
872 this.x *= Q.x;
873 this.y *= Q.y;
874 this.z *= Q.z
875 }
876 },
877 div: function(Q) {
878 if (typeof Q === "number") {
879 this.x /= Q;
880 this.y /= Q;
881 this.z /= Q
882 } else {
883 this.x /= Q.x;
884 this.y /= Q.y;
885 this.z /= Q.z
886 }
887 },
888 dist: function(T) {
889 var S = this.x - T.x,
890 R = this.y - T.y,
891 Q = this.z - T.z;
892 return q.sqrt(S * S + R * R + Q * Q)
893 },
894 dot: function(Q, S, R) {
895 if (arguments.length === 1) {
896 return this.x * Q.x + this.y * Q.y + this.z * Q.z
897 }
898 return this.x * Q + this.y * S + this.z * R
899 },
900 cross: function(R) {
901 var Q = this.x,
902 T = this.y,
903 S = this.z;
904 return new N(T * R.z - R.y * S, S * R.x - R.z * Q, Q * R.y - R.x * T)
905 },
906 normalize: function() {
907 var Q = this.mag();
908 if (Q > 0) {
909 this.div(Q)
910 }
911 },
912 limit: function(Q) {
913 if (this.mag() > Q) {
914 this.normalize();
915 this.mult(Q)
916 }
917 },
918 heading2D: function() {
919 return -q.atan2(-this.y, this.x)
920 },
921 toString: function() {
922 return "[" + this.x + ", " + this.y + ", " + this.z + "]"
923 },
924 array: function() {
925 return [this.x, this.y, this.z]
926 }
927 };
928
929 function O(Q) {
930 return function(T, S) {
931 var R = T.get();
932 R[Q](S);
933 return R
934 }
935 }
936 for (var P in N.prototype) {
937 if (N.prototype.hasOwnProperty(P) && !N.hasOwnProperty(P)) {
938 N[P] = O(P)
939 }
940 }
941 return N
942 }();
943
944 function M() {}
945 M.prototype = B;
946 var g = new M;
947 g.ArrayList = f;
948 g.HashMap = x;
949 g.PVector = A;
950 g.ObjectIterator = o;
951 g.PConstants = B;
952 g.defineProperty = function(O, N, P) {
953 if ("defineProperty" in Object) {
954 Object.defineProperty(O, N, P)
955 } else {
956 if (P.hasOwnProperty("get")) {
957 O.__defineGetter__(N, P.get)
958 }
959 if (P.hasOwnProperty("set")) {
960 O.__defineSetter__(N, P.set)
961 }
962 }
963 };
964
965 function m(O, N, R) {
966 if (!O.hasOwnProperty(N) || typeof O[N] !== "function") {
967 O[N] = R;
968 return
969 }
970 var Q = O[N];
971 if ("$overloads" in Q) {
972 Q.$defaultOverload = R;
973 return
974 }
975 if (!("$overloads" in R) && Q.length === R.length) {
976 return
977 }
978 var T, P;
979 if ("$overloads" in R) {
980 T = R.$overloads.slice(0);
981 T[Q.length] = Q;
982 P = R.$defaultOverload
983 } else {
984 T = [];
985 T[R.length] = R;
986 T[Q.length] = Q;
987 P = Q
988 }
989 var S = function() {
990 var U = S.$overloads[arguments.length] || ("$methodArgsIndex" in S && arguments.length > S.$methodArgsIndex ? S.$overloads[S.$methodArgsIndex] : null) || S.$defaultOverload;
991 return U.apply(this, arguments)
992 };
993 S.$overloads = T;
994 if ("$methodArgsIndex" in R) {
995 S.$methodArgsIndex = R.$methodArgsIndex
996 }
997 S.$defaultOverload = P;
998 S.name = N;
999 O[N] = S
1000 }
1001
1002 function i(Q, P) {
1003 function R(S) {
1004 g.defineProperty(Q, S, {
1005 get: function() {
1006 return P[S]
1007 },
1008 set: function(T) {
1009 P[S] = T
1010 },
1011 enumerable: true
1012 })
1013 }
1014 var O = [];
1015 for (var N in P) {
1016 if (typeof P[N] === "function") {
1017 m(Q, N, P[N])
1018 } else {
1019 if (N.charAt(0) !== "$" && !(N in Q)) {
1020 O.push(N)
1021 }
1022 }
1023 }
1024 while (O.length > 0) {
1025 R(O.shift())
1026 }
1027 Q.$super = P
1028 }
1029 g.extendClassChain = function(O) {
1030 var P = [O];
1031 for (var N = O.$upcast; N; N = N.$upcast) {
1032 i(N, O);
1033 P.push(N);
1034 O = N
1035 }
1036 while (P.length > 0) {
1037 P.pop().$self = O
1038 }
1039 };
1040 g.extendStaticMembers = function(N, O) {
1041 i(N, O)
1042 };
1043 g.extendInterfaceMembers = function(N, O) {
1044 i(N, O)
1045 };
1046 g.addMethod = function(Q, P, S, R) {
1047 var N = Q[P];
1048 if (N || R) {
1049 var O = S.length;
1050 if ("$overloads" in N) {
1051 N.$overloads[O] = S
1052 } else {
1053 var T = function() {
1054 var V = T.$overloads[arguments.length] || ("$methodArgsIndex" in T && arguments.length > T.$methodArgsIndex ? T.$overloads[T.$methodArgsIndex] : null) || T.$defaultOverload;
1055 return V.apply(this, arguments)
1056 };
1057 var U = [];
1058 if (N) {
1059 U[N.length] = N
1060 }
1061 U[O] = S;
1062 T.$overloads = U;
1063 T.$defaultOverload = N || S;
1064 if (R) {
1065 T.$methodArgsIndex = O
1066 }
1067 T.name = P;
1068 Q[P] = T
1069 }
1070 } else {
1071 Q[P] = S
1072 }
1073 };
1074
1075 function l(N) {
1076 if (typeof N !== "string") {
1077 return false
1078 }
1079 return ["byte", "int", "char", "color", "float", "long", "double"].indexOf(N) !== -1
1080 }
1081 g.createJavaArray = function(S, T) {
1082 var O = null,
1083 P = null;
1084 if (typeof S === "string") {
1085 if (S === "boolean") {
1086 P = false
1087 } else {
1088 if (l(S)) {
1089 P = 0
1090 }
1091 }
1092 }
1093 if (typeof T[0] === "number") {
1094 var N = 0 | T[0];
1095 if (T.length <= 1) {
1096 O = [];
1097 O.length = N;
1098 for (var R = 0; R < N; ++R) {
1099 O[R] = P
1100 }
1101 } else {
1102 O = [];
1103 var U = T.slice(1);
1104 for (var Q = 0; Q < N; ++Q) {
1105 O.push(g.createJavaArray(S, U))
1106 }
1107 }
1108 }
1109 return O
1110 };
1111 var E = {
1112 aliceblue: "#f0f8ff",
1113 antiquewhite: "#faebd7",
1114 aqua: "#00ffff",
1115 aquamarine: "#7fffd4",
1116 azure: "#f0ffff",
1117 beige: "#f5f5dc",
1118 bisque: "#ffe4c4",
1119 black: "#000000",
1120 blanchedalmond: "#ffebcd",
1121 blue: "#0000ff",
1122 blueviolet: "#8a2be2",
1123 brown: "#a52a2a",
1124 burlywood: "#deb887",
1125 cadetblue: "#5f9ea0",
1126 chartreuse: "#7fff00",
1127 chocolate: "#d2691e",
1128 coral: "#ff7f50",
1129 cornflowerblue: "#6495ed",
1130 cornsilk: "#fff8dc",
1131 crimson: "#dc143c",
1132 cyan: "#00ffff",
1133 darkblue: "#00008b",
1134 darkcyan: "#008b8b",
1135 darkgoldenrod: "#b8860b",
1136 darkgray: "#a9a9a9",
1137 darkgreen: "#006400",
1138 darkkhaki: "#bdb76b",
1139 darkmagenta: "#8b008b",
1140 darkolivegreen: "#556b2f",
1141 darkorange: "#ff8c00",
1142 darkorchid: "#9932cc",
1143 darkred: "#8b0000",
1144 darksalmon: "#e9967a",
1145 darkseagreen: "#8fbc8f",
1146 darkslateblue: "#483d8b",
1147 darkslategray: "#2f4f4f",
1148 darkturquoise: "#00ced1",
1149 darkviolet: "#9400d3",
1150 deeppink: "#ff1493",
1151 deepskyblue: "#00bfff",
1152 dimgray: "#696969",
1153 dodgerblue: "#1e90ff",
1154 firebrick: "#b22222",
1155 floralwhite: "#fffaf0",
1156 forestgreen: "#228b22",
1157 fuchsia: "#ff00ff",
1158 gainsboro: "#dcdcdc",
1159 ghostwhite: "#f8f8ff",
1160 gold: "#ffd700",
1161 goldenrod: "#daa520",
1162 gray: "#808080",
1163 green: "#008000",
1164 greenyellow: "#adff2f",
1165 honeydew: "#f0fff0",
1166 hotpink: "#ff69b4",
1167 indianred: "#cd5c5c",
1168 indigo: "#4b0082",
1169 ivory: "#fffff0",
1170 khaki: "#f0e68c",
1171 lavender: "#e6e6fa",
1172 lavenderblush: "#fff0f5",
1173 lawngreen: "#7cfc00",
1174 lemonchiffon: "#fffacd",
1175 lightblue: "#add8e6",
1176 lightcoral: "#f08080",
1177 lightcyan: "#e0ffff",
1178 lightgoldenrodyellow: "#fafad2",
1179 lightgrey: "#d3d3d3",
1180 lightgreen: "#90ee90",
1181 lightpink: "#ffb6c1",
1182 lightsalmon: "#ffa07a",
1183 lightseagreen: "#20b2aa",
1184 lightskyblue: "#87cefa",
1185 lightslategray: "#778899",
1186 lightsteelblue: "#b0c4de",
1187 lightyellow: "#ffffe0",
1188 lime: "#00ff00",
1189 limegreen: "#32cd32",
1190 linen: "#faf0e6",
1191 magenta: "#ff00ff",
1192 maroon: "#800000",
1193 mediumaquamarine: "#66cdaa",
1194 mediumblue: "#0000cd",
1195 mediumorchid: "#ba55d3",
1196 mediumpurple: "#9370d8",
1197 mediumseagreen: "#3cb371",
1198 mediumslateblue: "#7b68ee",
1199 mediumspringgreen: "#00fa9a",
1200 mediumturquoise: "#48d1cc",
1201 mediumvioletred: "#c71585",
1202 midnightblue: "#191970",
1203 mintcream: "#f5fffa",
1204 mistyrose: "#ffe4e1",
1205 moccasin: "#ffe4b5",
1206 navajowhite: "#ffdead",
1207 navy: "#000080",
1208 oldlace: "#fdf5e6",
1209 olive: "#808000",
1210 olivedrab: "#6b8e23",
1211 orange: "#ffa500",
1212 orangered: "#ff4500",
1213 orchid: "#da70d6",
1214 palegoldenrod: "#eee8aa",
1215 palegreen: "#98fb98",
1216 paleturquoise: "#afeeee",
1217 palevioletred: "#d87093",
1218 papayawhip: "#ffefd5",
1219 peachpuff: "#ffdab9",
1220 peru: "#cd853f",
1221 pink: "#ffc0cb",
1222 plum: "#dda0dd",
1223 powderblue: "#b0e0e6",
1224 purple: "#800080",
1225 red: "#ff0000",
1226 rosybrown: "#bc8f8f",
1227 royalblue: "#4169e1",
1228 saddlebrown: "#8b4513",
1229 salmon: "#fa8072",
1230 sandybrown: "#f4a460",
1231 seagreen: "#2e8b57",
1232 seashell: "#fff5ee",
1233 sienna: "#a0522d",
1234 silver: "#c0c0c0",
1235 skyblue: "#87ceeb",
1236 slateblue: "#6a5acd",
1237 slategray: "#708090",
1238 snow: "#fffafa",
1239 springgreen: "#00ff7f",
1240 steelblue: "#4682b4",
1241 tan: "#d2b48c",
1242 teal: "#008080",
1243 thistle: "#d8bfd8",
1244 tomato: "#ff6347",
1245 turquoise: "#40e0d0",
1246 violet: "#ee82ee",
1247 wheat: "#f5deb3",
1248 white: "#ffffff",
1249 whitesmoke: "#f5f5f5",
1250 yellow: "#ffff00",
1251 yellowgreen: "#9acd32"
1252 };
1253 (function(O) {
1254 var R = ("open() createOutput() createInput() BufferedReader selectFolder() dataPath() createWriter() selectOutput() beginRecord() saveStream() endRecord() selectInput() saveBytes() createReader() beginRaw() endRaw() PrintWriter delay()").split(" "),
1255 Q = R.length,
1256 N, S;
1257
1258 function P(T) {
1259 return function() {
1260 throw "Processing.js does not support " + T + "."
1261 }
1262 }
1263 while (Q--) {
1264 N = R[Q];
1265 S = N.replace("()", "");
1266 O[S] = P(N)
1267 }
1268 })(g);
1269 g.defineProperty(g, "screenWidth", {
1270 get: function() {
1271 return D.innerWidth
1272 }
1273 });
1274 g.defineProperty(g, "screenHeight", {
1275 get: function() {
1276 return D.innerHeight
1277 }
1278 });
1279 g.defineProperty(g, "online", {
1280 get: function() {
1281 return true
1282 }
1283 });
1284 var k = [];
1285 var J = {};
1286 var L = function(N) {
1287 k.splice(J[N], 1);
1288 delete J[N]
1289 };
1290 var a = function(N) {
1291 if (N.externals.canvas.id === t || !N.externals.canvas.id.length) {
1292 N.externals.canvas.id = "__processing" + k.length
1293 }
1294 J[N.externals.canvas.id] = k.length;
1295 k.push(N)
1296 };
1297
1298 function p(X) {
1299 var Q = 250,
1300 ae = X.size / Q,
1301 N = d.createElement("canvas");
1302 N.width = 2 * Q;
1303 N.height = 2 * Q;
1304 N.style.opacity = 0;
1305 var W = X.getCSSDefinition(Q + "px", "normal"),
1306 Y = N.getContext("2d");
1307 Y.font = W;
1308 var ac = "dbflkhyjqpg";
1309 N.width = Y.measureText(ac).width;
1310 Y.font = W;
1311 var T = d.createElement("div");
1312 T.style.position = "absolute";
1313 T.style.opacity = 0;
1314 T.style.fontFamily = '"' + X.name + '"';
1315 T.style.fontSize = Q + "px";
1316 T.innerHTML = ac + "<br/>" + ac;
1317 d.body.appendChild(T);
1318 var U = N.width,
1319 ab = N.height,
1320 V = ab / 2;
1321 Y.fillStyle = "white";
1322 Y.fillRect(0, 0, U, ab);
1323 Y.fillStyle = "black";
1324 Y.fillText(ac, 0, V);
1325 var P = Y.getImageData(0, 0, U, ab).data;
1326 var Z = 0,
1327 S = U * 4,
1328 aa = P.length;
1329 while (++Z < aa && P[Z] === 255) {
1330 G()
1331 }
1332 var R = q.round(Z / S);
1333 Z = aa - 1;
1334 while (--Z > 0 && P[Z] === 255) {
1335 G()
1336 }
1337 var ad = q.round(Z / S);
1338 X.ascent = ae * (V - R);
1339 X.descent = ae * (ad - V);
1340 if (d.defaultView.getComputedStyle) {
1341 var O = d.defaultView.getComputedStyle(T, null).getPropertyValue("height");
1342 O = ae * O.replace("px", "");
1343 if (O >= X.size * 2) {
1344 X.leading = q.round(O / 2)
1345 }
1346 }
1347 d.body.removeChild(T);
1348 if (X.caching) {
1349 return Y
1350 }
1351 }
1352
1353 function H(N, O) {
1354 if (N === t) {
1355 N = ""
1356 }
1357 this.name = N;
1358 if (O === t) {
1359 O = 0
1360 }
1361 this.size = O;
1362 this.glyph = false;
1363 this.ascent = 0;
1364 this.descent = 0;
1365 this.leading = 1.2 * O;
1366 var R = N.indexOf(" Italic Bold");
1367 if (R !== -1) {
1368 N = N.substring(0, R)
1369 }
1370 this.style = "normal";
1371 var Q = N.indexOf(" Italic");
1372 if (Q !== -1) {
1373 N = N.substring(0, Q);
1374 this.style = "italic"
1375 }
1376 this.weight = "normal";
1377 var P = N.indexOf(" Bold");
1378 if (P !== -1) {
1379 N = N.substring(0, P);
1380 this.weight = "bold"
1381 }
1382 this.family = "sans-serif";
1383 if (N !== t) {
1384 switch (N) {
1385 case "sans-serif":
1386 case "serif":
1387 case "monospace":
1388 case "fantasy":
1389 case "cursive":
1390 this.family = N;
1391 break;
1392 default:
1393 this.family = '"' + N + '", sans-serif';
1394 break
1395 }
1396 }
1397 this.context2d = p(this);
1398 this.css = this.getCSSDefinition();
1399 if (this.context2d) {
1400 this.context2d.font = this.css
1401 }
1402 }
1403 H.prototype.caching = true;
1404 H.prototype.getCSSDefinition = function(P, N) {
1405 if (P === t) {
1406 P = this.size + "px"
1407 }
1408 if (N === t) {
1409 N = this.leading + "px"
1410 }
1411 var O = [this.style, "normal", this.weight, P + "/" + N, this.family];
1412 return O.join(" ")
1413 };
1414 H.prototype.measureTextWidth = function(N) {
1415 return this.context2d.measureText(N).width
1416 };
1417 H.prototype.measureTextWidthFallback = function(P) {
1418 var O = d.createElement("canvas"),
1419 N = O.getContext("2d");
1420 N.font = this.css;
1421 return N.measureText(P).width
1422 };
1423 H.PFontCache = {
1424 length: 0
1425 };
1426 H.get = function(Q, R) {
1427 R = (R * 10 + 0.5 | 0) / 10;
1428 var O = H.PFontCache,
1429 N = Q + "/" + R;
1430 if (!O[N]) {
1431 O[N] = new H(Q, R);
1432 O.length++;
1433 if (O.length === 50) {
1434 H.prototype.measureTextWidth = H.prototype.measureTextWidthFallback;
1435 H.prototype.caching = false;
1436 var P;
1437 for (P in O) {
1438 if (P !== "length") {
1439 O[P].context2d = null
1440 }
1441 }
1442 return new H(Q, R)
1443 }
1444 if (O.length === 400) {
1445 H.PFontCache = {};
1446 H.get = H.getFallback;
1447 return new H(Q, R)
1448 }
1449 }
1450 return O[N]
1451 };
1452 H.getFallback = function(N, O) {
1453 return new H(N, O)
1454 };
1455 H.list = function() {
1456 return ["sans-serif", "serif", "monospace", "fantasy", "cursive"]
1457 };
1458 H.preloading = {
1459 template: {},
1460 initialized: false,
1461 initialize: function() {
1462 var P = function() {
1463 var R = "#E3KAI2wAgT1MvMg7Eo3VmNtYX7ABi3CxnbHlm7Abw3kaGVhZ7ACs3OGhoZWE7A53CRobXR47AY3AGbG9jYQ7G03Bm1heH7ABC3CBuYW1l7Ae3AgcG9zd7AI3AE#B3AQ2kgTY18PPPUACwAg3ALSRoo3#yld0xg32QAB77#E777773B#E3C#I#Q77773E#Q7777777772CMAIw7AB77732B#M#Q3wAB#g3B#E#E2BB//82BB////w#B7#gAEg3E77x2B32B#E#Q#MTcBAQ32gAe#M#QQJ#E32M#QQJ#I#g32Q77#";
1464 var Q = function(S) {
1465 return "AAAAAAAA".substr(~~S ? 7 - S : 6)
1466 };
1467 return R.replace(/[#237]/g, Q)
1468 };
1469 var N = d.createElement("style");
1470 N.setAttribute("type", "text/css");
1471 N.innerHTML = '@font-face {\n font-family: "PjsEmptyFont";\n src: url(\'data:application/x-font-ttf;base64,' + P() + "')\n format('truetype');\n}";
1472 d.head.appendChild(N);
1473 var O = d.createElement("span");
1474 O.style.cssText = 'position: absolute; top: 0; left: 0; opacity: 0; font-family: "PjsEmptyFont", fantasy;';
1475 O.innerHTML = "AAAAAAAA";
1476 d.body.appendChild(O);
1477 this.template = O;
1478 this.initialized = true
1479 },
1480 getElementWidth: function(N) {
1481 return d.defaultView.getComputedStyle(N, "").getPropertyValue("width")
1482 },
1483 timeAttempted: 0,
1484 pending: function(R) {
1485 if (!this.initialized) {
1486 this.initialize()
1487 }
1488 var P, N, Q = this.getElementWidth(this.template);
1489 for (var O = 0; O < this.fontList.length; O++) {
1490 P = this.fontList[O];
1491 N = this.getElementWidth(P);
1492 if (this.timeAttempted < 4000 && N === Q) {
1493 this.timeAttempted += R;
1494 return true
1495 } else {
1496 d.body.removeChild(P);
1497 this.fontList.splice(O--, 1);
1498 this.timeAttempted = 0
1499 }
1500 }
1501 if (this.fontList.length === 0) {
1502 return false
1503 }
1504 return true
1505 },
1506 fontList: [],
1507 addedList: {},
1508 add: function(N) {
1509 if (!this.initialized) {
1510 this.initialize()
1511 }
1512 var R = typeof N === "object" ? N.fontFace : N,
1513 Q = typeof N === "object" ? N.url : N;
1514 if (this.addedList[R]) {
1515 return
1516 }
1517 var P = d.createElement("style");
1518 P.setAttribute("type", "text/css");
1519 P.innerHTML = "@font-face{\n font-family: '" + R + "';\n src: url('" + Q + "');\n}\n";
1520 d.head.appendChild(P);
1521 this.addedList[R] = true;
1522 var O = d.createElement("span");
1523 O.style.cssText = "position: absolute; top: 0; left: 0; opacity: 0;";
1524 O.style.fontFamily = '"' + R + '", "PjsEmptyFont", fantasy';
1525 O.innerHTML = "AAAAAAAA";
1526 d.body.appendChild(O);
1527 this.fontList.push(O)
1528 }
1529 };
1530 g.PFont = H;
1531 var F = this.Processing = function(be, ba) {
1532 if (!(this instanceof F)) {
1533 throw "called Processing constructor as if it were a function: missing 'new'."
1534 }
1535 var ae, cV = be === t && ba === t;
1536 if (cV) {
1537 ae = d.createElement("canvas")
1538 } else {
1539 ae = typeof be === "string" ? d.getElementById(be) : be
1540 } if (!(ae instanceof HTMLCanvasElement)) {
1541 throw "called Processing constructor without passing canvas element reference or id."
1542 }
1543
1544 function dw(ea) {
1545 F.debug("Unimplemented - " + ea)
1546 }
1547 var cW = this;
1548 cW.externals = {
1549 canvas: ae,
1550 context: t,
1551 sketch: t
1552 };
1553 cW.name = "Processing.js Instance";
1554 cW.use3DContext = false;
1555 cW.focused = false;
1556 cW.breakShape = false;
1557 cW.glyphTable = {};
1558 cW.pmouseX = 0;
1559 cW.pmouseY = 0;
1560 cW.mouseX = 0;
1561 cW.mouseY = 0;
1562 cW.mouseButton = 0;
1563 cW.mouseScroll = 0;
1564 cW.mouseClicked = t;
1565 cW.mouseDragged = t;
1566 cW.mouseMoved = t;
1567 cW.mousePressed = t;
1568 cW.mouseReleased = t;
1569 cW.mouseScrolled = t;
1570 cW.mouseOver = t;
1571 cW.mouseOut = t;
1572 cW.touchStart = t;
1573 cW.touchEnd = t;
1574 cW.touchMove = t;
1575 cW.touchCancel = t;
1576 cW.key = t;
1577 cW.keyCode = t;
1578 cW.keyPressed = G;
1579 cW.keyReleased = G;
1580 cW.keyTyped = G;
1581 cW.draw = t;
1582 cW.setup = t;
1583 cW.__mousePressed = false;
1584 cW.__keyPressed = false;
1585 cW.__frameRate = 60;
1586 cW.frameCount = 0;
1587 cW.width = 100;
1588 cW.height = 100;
1589 var d8, cQ, dY, bD = true,
1590 aH = true,
1591 bo = [1, 1, 1, 1],
1592 a1 = 4294967295,
1593 aq = true,
1594 ce = true,
1595 c0 = [0, 0, 0, 1],
1596 cv = 4278190080,
1597 b3 = true,
1598 dW = 1,
1599 ax = false,
1600 dO = false,
1601 aC = true,
1602 b4 = 0,
1603 bK = 0,
1604 cN = 3,
1605 a8 = 0,
1606 a7 = 0,
1607 a6 = 0,
1608 a2 = 0,
1609 dU = 60,
1610 az = 1000 / dU,
1611 Z = "default",
1612 ck = ae.style.cursor,
1613 dR = 20,
1614 cj = 0,
1615 d6 = [],
1616 aJ = 0,
1617 Q = 20,
1618 cM = false,
1619 a4 = -3355444,
1620 cy = 20,
1621 bU = 255,
1622 bJ = 255,
1623 bI = 255,
1624 bG = 255,
1625 cZ = false,
1626 aK = false,
1627 dN = 0,
1628 d5 = 0,
1629 cY = 1,
1630 bf = null,
1631 bw = null,
1632 a5 = false,
1633 dq = Date.now(),
1634 dt = dq,
1635 P = 0,
1636 cE, c3, aQ, aL, bz, cd, U, dC = {
1637 attributes: {},
1638 locations: {}
1639 },
1640 dx, dQ, bT, bh, cJ, dk, aB, b2, bg, b8, at, aG, bC, aw, af, c7, bS, cs = {
1641 width: 0,
1642 height: 0
1643 },
1644 d4 = 2,
1645 dT = false,
1646 cH, ac, R, N = 37,
1647 c1 = 0,
1648 cI = 4,
1649 Y = "Arial",
1650 d0 = 12,
1651 a3 = 9,
1652 dA = 2,
1653 d7 = 14,
1654 W = H.get(Y, d0),
1655 aj, cn = null,
1656 dV = false,
1657 d3, bZ = 1000,
1658 ag = [],
1659 dI = null,
1660 dX = [16, 17, 18, 20, 33, 34, 35, 36, 37, 38, 39, 40, 144, 155, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 157];
1661 var ad, dp, aU, bX;
1662 if (d.defaultView && d.defaultView.getComputedStyle) {
1663 ad = parseInt(d.defaultView.getComputedStyle(ae, null)["paddingLeft"], 10) || 0;
1664 dp = parseInt(d.defaultView.getComputedStyle(ae, null)["paddingTop"], 10) || 0;
1665 aU = parseInt(d.defaultView.getComputedStyle(ae, null)["borderLeftWidth"], 10) || 0;
1666 bX = parseInt(d.defaultView.getComputedStyle(ae, null)["borderTopWidth"], 10) || 0
1667 }
1668 var dL = 0;
1669 var bL = 0,
1670 bM = 0,
1671 bt = [],
1672 bs = [],
1673 br = [],
1674 ah = new e(720),
1675 bl = new e(720),
1676 cF, cA;
1677 var bV, ch, dJ, aT, am, da, ab, db, ap = false,
1678 ci = false,
1679 cK = 60 * (q.PI / 180),
1680 dl = cW.width / 2,
1681 dj = cW.height / 2,
1682 di = dj / q.tan(cK / 2),
1683 a0 = di / 10,
1684 av = di * 10,
1685 b5 = cW.width / cW.height;
1686 var bb = [],
1687 cb = [],
1688 c2 = 0,
1689 dP = false,
1690 aa = false,
1691 du = true;
1692 var S = 0;
1693 var bm = [];
1694 var dh = new e([0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5]);
1695 var bH = new e([0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, -0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5]);
1696 var df = new e([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]);
1697 var ak = new e([0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0]);
1698 var ai = new e([0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1]);
1699 var aO = "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);}";
1700 var bQ = "#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;}";
1701 var dE = "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;}";
1702 var aW = "#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; }}";
1703 var bA = /Windows/.test(navigator.userAgent);
1704 var dn = "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 );" + (bA ? " 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 );}";
1705 var aF = "#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec4 vFrontColor;uniform sampler2D uSampler;uniform bool uUsingTexture;varying vec2 vTexture;void main(void){ if( uUsingTexture ){ gl_FragColor = vec4(texture2D(uSampler, vTexture.xy)) * vFrontColor; } else{ gl_FragColor = vFrontColor; }}";
1706
1707 function d2(ec, eb, ee, ed) {
1708 var ea = dC.locations[ec];
1709 if (ea === t) {
1710 ea = d8.getUniformLocation(eb, ee);
1711 dC.locations[ec] = ea
1712 }
1713 if (ea !== null) {
1714 if (ed.length === 4) {
1715 d8.uniform4fv(ea, ed)
1716 } else {
1717 if (ed.length === 3) {
1718 d8.uniform3fv(ea, ed)
1719 } else {
1720 if (ed.length === 2) {
1721 d8.uniform2fv(ea, ed)
1722 } else {
1723 d8.uniform1f(ea, ed)
1724 }
1725 }
1726 }
1727 }
1728 }
1729
1730 function dZ(ec, eb, ee, ed) {
1731 var ea = dC.locations[ec];
1732 if (ea === t) {
1733 ea = d8.getUniformLocation(eb, ee);
1734 dC.locations[ec] = ea
1735 }
1736 if (ea !== null) {
1737 if (ed.length === 4) {
1738 d8.uniform4iv(ea, ed)
1739 } else {
1740 if (ed.length === 3) {
1741 d8.uniform3iv(ea, ed)
1742 } else {
1743 if (ed.length === 2) {
1744 d8.uniform2iv(ea, ed)
1745 } else {
1746 d8.uniform1i(ea, ed)
1747 }
1748 }
1749 }
1750 }
1751 }
1752
1753 function a9(ee, ec, ef, ed, eb) {
1754 var ea = dC.locations[ee];
1755 if (ea === t) {
1756 ea = d8.getUniformLocation(ec, ef);
1757 dC.locations[ee] = ea
1758 }
1759 if (ea !== -1) {
1760 if (eb.length === 16) {
1761 d8.uniformMatrix4fv(ea, ed, eb)
1762 } else {
1763 if (eb.length === 9) {
1764 d8.uniformMatrix3fv(ea, ed, eb)
1765 } else {
1766 d8.uniformMatrix2fv(ea, ed, eb)
1767 }
1768 }
1769 }
1770 }
1771
1772 function dc(ee, ec, ef, eb, ed) {
1773 var ea = dC.attributes[ee];
1774 if (ea === t) {
1775 ea = d8.getAttribLocation(ec, ef);
1776 dC.attributes[ee] = ea
1777 }
1778 if (ea !== -1) {
1779 d8.bindBuffer(d8.ARRAY_BUFFER, ed);
1780 d8.vertexAttribPointer(ea, eb, d8.FLOAT, false, 0, 0);
1781 d8.enableVertexAttribArray(ea)
1782 }
1783 }
1784
1785 function cg(ec, eb, ed) {
1786 var ea = dC.attributes[ec];
1787 if (ea === t) {
1788 ea = d8.getAttribLocation(eb, ed);
1789 dC.attributes[ec] = ea
1790 }
1791 if (ea !== -1) {
1792 d8.disableVertexAttribArray(ea)
1793 }
1794 }
1795 var bF = function(ec, ee, eb) {
1796 var ef = ec.createShader(ec.VERTEX_SHADER);
1797 ec.shaderSource(ef, ee);
1798 ec.compileShader(ef);
1799 if (!ec.getShaderParameter(ef, ec.COMPILE_STATUS)) {
1800 throw ec.getShaderInfoLog(ef)
1801 }
1802 var ed = ec.createShader(ec.FRAGMENT_SHADER);
1803 ec.shaderSource(ed, eb);
1804 ec.compileShader(ed);
1805 if (!ec.getShaderParameter(ed, ec.COMPILE_STATUS)) {
1806 throw ec.getShaderInfoLog(ed)
1807 }
1808 var ea = ec.createProgram();
1809 ec.attachShader(ea, ef);
1810 ec.attachShader(ea, ed);
1811 ec.linkProgram(ea);
1812 if (!ec.getProgramParameter(ea, ec.LINK_STATUS)) {
1813 throw "Error linking shaders."
1814 }
1815 return ea
1816 };
1817 var aZ = function(ea, ee, eb, ed, ec) {
1818 return {
1819 x: ea,
1820 y: ee,
1821 w: eb,
1822 h: ed
1823 }
1824 };
1825 var bk = aZ;
1826 var b1 = function(ea, ee, eb, ed, ec) {
1827 return {
1828 x: ea,
1829 y: ee,
1830 w: ec ? eb : eb - ea,
1831 h: ec ? ed : ed - ee
1832 }
1833 };
1834 var aN = function(ea, ee, eb, ed, ec) {
1835 return {
1836 x: ea - eb / 2,
1837 y: ee - ed / 2,
1838 w: eb,
1839 h: ed
1840 }
1841 };
1842 var ds = function() {};
1843 var bR = function() {};
1844 var bB = function() {};
1845 var ca = function() {};
1846 bR.prototype = new ds;
1847 bR.prototype.constructor = bR;
1848 bB.prototype = new ds;
1849 bB.prototype.constructor = bB;
1850 ca.prototype = new ds;
1851 ca.prototype.constructor = ca;
1852 ds.prototype.a3DOnlyFunction = G;
1853 var cl = {};
1854 var bP = cW.Character = function(ea) {
1855 if (typeof ea === "string" && ea.length === 1) {
1856 this.code = ea.charCodeAt(0)
1857 } else {
1858 if (typeof ea === "number") {
1859 this.code = ea
1860 } else {
1861 if (ea instanceof bP) {
1862 this.code = ea
1863 } else {
1864 this.code = NaN
1865 }
1866 }
1867 }
1868 return cl[this.code] === t ? cl[this.code] = this : cl[this.code]
1869 };
1870 bP.prototype.toString = function() {
1871 return String.fromCharCode(this.code)
1872 };
1873 bP.prototype.valueOf = function() {
1874 return this.code
1875 };
1876 var O = cW.PShape = function(ea) {
1877 this.family = ea || 0;
1878 this.visible = true;
1879 this.style = true;
1880 this.children = [];
1881 this.nameTable = [];
1882 this.params = [];
1883 this.name = "";
1884 this.image = null;
1885 this.matrix = null;
1886 this.kind = null;
1887 this.close = null;
1888 this.width = null;
1889 this.height = null;
1890 this.parent = null
1891 };
1892 O.prototype = {
1893 isVisible: function() {
1894 return this.visible
1895 },
1896 setVisible: function(ea) {
1897 this.visible = ea
1898 },
1899 disableStyle: function() {
1900 this.style = false;
1901 for (var eb = 0, ea = this.children.length; eb < ea; eb++) {
1902 this.children[eb].disableStyle()
1903 }
1904 },
1905 enableStyle: function() {
1906 this.style = true;
1907 for (var eb = 0, ea = this.children.length; eb < ea; eb++) {
1908 this.children[eb].enableStyle()
1909 }
1910 },
1911 getFamily: function() {
1912 return this.family
1913 },
1914 getWidth: function() {
1915 return this.width
1916 },
1917 getHeight: function() {
1918 return this.height
1919 },
1920 setName: function(ea) {
1921 this.name = ea
1922 },
1923 getName: function() {
1924 return this.name
1925 },
1926 draw: function(ea) {
1927 ea = ea || cW;
1928 if (this.visible) {
1929 this.pre(ea);
1930 this.drawImpl(ea);
1931 this.post(ea)
1932 }
1933 },
1934 drawImpl: function(ea) {
1935 if (this.family === 0) {
1936 this.drawGroup(ea)
1937 } else {
1938 if (this.family === 1) {
1939 this.drawPrimitive(ea)
1940 } else {
1941 if (this.family === 3) {
1942 this.drawGeometry(ea)
1943 } else {
1944 if (this.family === 21) {
1945 this.drawPath(ea)
1946 }
1947 }
1948 }
1949 }
1950 },
1951 drawPath: function(ec) {
1952 var ed, eb;
1953 if (this.vertices.length === 0) {
1954 return
1955 }
1956 ec.beginShape();
1957 if (this.vertexCodes.length === 0) {
1958 if (this.vertices[0].length === 2) {
1959 for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
1960 ec.vertex(this.vertices[ed][0], this.vertices[ed][1])
1961 }
1962 } else {
1963 for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
1964 ec.vertex(this.vertices[ed][0], this.vertices[ed][1], this.vertices[ed][2])
1965 }
1966 }
1967 } else {
1968 var ea = 0;
1969 if (this.vertices[0].length === 2) {
1970 for (ed = 0, eb = this.vertexCodes.length; ed < eb; ed++) {
1971 if (this.vertexCodes[ed] === 0) {
1972 ec.vertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea]["moveTo"]);
1973 ec.breakShape = false;
1974 ea++
1975 } else {
1976 if (this.vertexCodes[ed] === 1) {
1977 ec.bezierVertex(this.vertices[ea + 0][0], this.vertices[ea + 0][1], this.vertices[ea + 1][0], this.vertices[ea + 1][1], this.vertices[ea + 2][0], this.vertices[ea + 2][1]);
1978 ea += 3
1979 } else {
1980 if (this.vertexCodes[ed] === 2) {
1981 ec.curveVertex(this.vertices[ea][0], this.vertices[ea][1]);
1982 ea++
1983 } else {
1984 if (this.vertexCodes[ed] === 3) {
1985 ec.breakShape = true
1986 }
1987 }
1988 }
1989 }
1990 }
1991 } else {
1992 for (ed = 0, eb = this.vertexCodes.length; ed < eb; ed++) {
1993 if (this.vertexCodes[ed] === 0) {
1994 ec.vertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea][2]);
1995 if (this.vertices[ea]["moveTo"] === true) {
1996 bb[bb.length - 1]["moveTo"] = true
1997 } else {
1998 if (this.vertices[ea]["moveTo"] === false) {
1999 bb[bb.length - 1]["moveTo"] = false
2000 }
2001 }
2002 ec.breakShape = false
2003 } else {
2004 if (this.vertexCodes[ed] === 1) {
2005 ec.bezierVertex(this.vertices[ea + 0][0], this.vertices[ea + 0][1], this.vertices[ea + 0][2], this.vertices[ea + 1][0], this.vertices[ea + 1][1], this.vertices[ea + 1][2], this.vertices[ea + 2][0], this.vertices[ea + 2][1], this.vertices[ea + 2][2]);
2006 ea += 3
2007 } else {
2008 if (this.vertexCodes[ed] === 2) {
2009 ec.curveVertex(this.vertices[ea][0], this.vertices[ea][1], this.vertices[ea][2]);
2010 ea++
2011 } else {
2012 if (this.vertexCodes[ed] === 3) {
2013 ec.breakShape = true
2014 }
2015 }
2016 }
2017 }
2018 }
2019 }
2020 }
2021 ec.endShape(this.close ? 2 : 1)
2022 },
2023 drawGeometry: function(ec) {
2024 var ed, eb;
2025 ec.beginShape(this.kind);
2026 if (this.style) {
2027 for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
2028 ec.vertex(this.vertices[ed])
2029 }
2030 } else {
2031 for (ed = 0, eb = this.vertices.length; ed < eb; ed++) {
2032 var ea = this.vertices[ed];
2033 if (ea[2] === 0) {
2034 ec.vertex(ea[0], ea[1])
2035 } else {
2036 ec.vertex(ea[0], ea[1], ea[2])
2037 }
2038 }
2039 }
2040 ec.endShape()
2041 },
2042 drawGroup: function(eb) {
2043 for (var ec = 0, ea = this.children.length; ec < ea; ec++) {
2044 this.children[ec].draw(eb)
2045 }
2046 },
2047 drawPrimitive: function(ea) {
2048 if (this.kind === 2) {
2049 ea.point(this.params[0], this.params[1])
2050 } else {
2051 if (this.kind === 4) {
2052 if (this.params.length === 4) {
2053 ea.line(this.params[0], this.params[1], this.params[2], this.params[3])
2054 } else {
2055 ea.line(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5])
2056 }
2057 } else {
2058 if (this.kind === 8) {
2059 ea.triangle(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5])
2060 } else {
2061 if (this.kind === 16) {
2062 ea.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])
2063 } else {
2064 if (this.kind === 30) {
2065 if (this.image !== null) {
2066 var ee = bk;
2067 ea.imageMode(0);
2068 ea.image(this.image, this.params[0], this.params[1], this.params[2], this.params[3]);
2069 bk = ee
2070 } else {
2071 var eb = bK;
2072 ea.rectMode(0);
2073 ea.rect(this.params[0], this.params[1], this.params[2], this.params[3]);
2074 bK = eb
2075 }
2076 } else {
2077 if (this.kind === 31) {
2078 var ec = cN;
2079 ea.ellipseMode(0);
2080 ea.ellipse(this.params[0], this.params[1], this.params[2], this.params[3]);
2081 cN = ec
2082 } else {
2083 if (this.kind === 32) {
2084 var ed = cN;
2085 ea.ellipseMode(0);
2086 ea.arc(this.params[0], this.params[1], this.params[2], this.params[3], this.params[4], this.params[5]);
2087 cN = ed
2088 } else {
2089 if (this.kind === 41) {
2090 if (this.params.length === 1) {
2091 ea.box(this.params[0])
2092 } else {
2093 ea.box(this.params[0], this.params[1], this.params[2])
2094 }
2095 } else {
2096 if (this.kind === 40) {
2097 ea.sphere(this.params[0])
2098 }
2099 }
2100 }
2101 }
2102 }
2103 }
2104 }
2105 }
2106 }
2107 },
2108 pre: function(ea) {
2109 if (this.matrix) {
2110 ea.pushMatrix();
2111 ea.transform(this.matrix)
2112 }
2113 if (this.style) {
2114 ea.pushStyle();
2115 this.styles(ea)
2116 }
2117 },
2118 post: function(ea) {
2119 if (this.matrix) {
2120 ea.popMatrix()
2121 }
2122 if (this.style) {
2123 ea.popStyle()
2124 }
2125 },
2126 styles: function(ea) {
2127 if (this.stroke) {
2128 ea.stroke(this.strokeColor);
2129 ea.strokeWeight(this.strokeWeight);
2130 ea.strokeCap(this.strokeCap);
2131 ea.strokeJoin(this.strokeJoin)
2132 } else {
2133 ea.noStroke()
2134 } if (this.fill) {
2135 ea.fill(this.fillColor)
2136 } else {
2137 ea.noFill()
2138 }
2139 },
2140 getChild: function(ed) {
2141 var eb, ea;
2142 if (typeof ed === "number") {
2143 return this.children[ed]
2144 }
2145 var ec;
2146 if (ed === "" || this.name === ed) {
2147 return this
2148 }
2149 if (this.nameTable.length > 0) {
2150 for (eb = 0, ea = this.nameTable.length; eb < ea || ec; eb++) {
2151 if (this.nameTable[eb].getName === ed) {
2152 ec = this.nameTable[eb];
2153 break
2154 }
2155 }
2156 if (ec) {
2157 return ec
2158 }
2159 }
2160 for (eb = 0, ea = this.children.length; eb < ea; eb++) {
2161 ec = this.children[eb].getChild(ed);
2162 if (ec) {
2163 return ec
2164 }
2165 }
2166 return null
2167 },
2168 getChildCount: function() {
2169 return this.children.length
2170 },
2171 addChild: function(ea) {
2172 this.children.push(ea);
2173 ea.parent = this;
2174 if (ea.getName() !== null) {
2175 this.addName(ea.getName(), ea)
2176 }
2177 },
2178 addName: function(eb, ea) {
2179 if (this.parent !== null) {
2180 this.parent.addName(eb, ea)
2181 } else {
2182 this.nameTable.push([eb, ea])
2183 }
2184 },
2185 translate: function() {
2186 if (arguments.length === 2) {
2187 this.checkMatrix(2);
2188 this.matrix.translate(arguments[0], arguments[1])
2189 } else {
2190 this.checkMatrix(3);
2191 this.matrix.translate(arguments[0], arguments[1], 0)
2192 }
2193 },
2194 checkMatrix: function(ea) {
2195 if (this.matrix === null) {
2196 if (ea === 2) {
2197 this.matrix = new cW.PMatrix2D
2198 } else {
2199 this.matrix = new cW.PMatrix3D
2200 }
2201 } else {
2202 if (ea === 3 && this.matrix instanceof cW.PMatrix2D) {
2203 this.matrix = new cW.PMatrix3D
2204 }
2205 }
2206 },
2207 rotateX: function(ea) {
2208 this.rotate(ea, 1, 0, 0)
2209 },
2210 rotateY: function(ea) {
2211 this.rotate(ea, 0, 1, 0)
2212 },
2213 rotateZ: function(ea) {
2214 this.rotate(ea, 0, 0, 1)
2215 },
2216 rotate: function() {
2217 if (arguments.length === 1) {
2218 this.checkMatrix(2);
2219 this.matrix.rotate(arguments[0])
2220 } else {
2221 this.checkMatrix(3);
2222 this.matrix.rotate(arguments[0], arguments[1], arguments[2], arguments[3])
2223 }
2224 },
2225 scale: function() {
2226 if (arguments.length === 2) {
2227 this.checkMatrix(2);
2228 this.matrix.scale(arguments[0], arguments[1])
2229 } else {
2230 if (arguments.length === 3) {
2231 this.checkMatrix(2);
2232 this.matrix.scale(arguments[0], arguments[1], arguments[2])
2233 } else {
2234 this.checkMatrix(2);
2235 this.matrix.scale(arguments[0])
2236 }
2237 }
2238 },
2239 resetMatrix: function() {
2240 this.checkMatrix(2);
2241 this.matrix.reset()
2242 },
2243 applyMatrix: function(ea) {
2244 if (arguments.length === 1) {
2245 this.applyMatrix(ea.elements[0], ea.elements[1], 0, ea.elements[2], ea.elements[3], ea.elements[4], 0, ea.elements[5], 0, 0, 1, 0, 0, 0, 0, 1)
2246 } else {
2247 if (arguments.length === 6) {
2248 this.checkMatrix(2);
2249 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)
2250 } else {
2251 if (arguments.length === 16) {
2252 this.checkMatrix(3);
2253 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])
2254 }
2255 }
2256 }
2257 }
2258 };
2259 var cr = cW.PShapeSVG = function() {
2260 cW.PShape.call(this);
2261 if (arguments.length === 1) {
2262 this.element = arguments[0];
2263 this.vertexCodes = [];
2264 this.vertices = [];
2265 this.opacity = 1;
2266 this.stroke = false;
2267 this.strokeColor = 4278190080;
2268 this.strokeWeight = 1;
2269 this.strokeCap = "butt";
2270 this.strokeJoin = "miter";
2271 this.strokeGradient = null;
2272 this.strokeGradientPaint = null;
2273 this.strokeName = null;
2274 this.strokeOpacity = 1;
2275 this.fill = true;
2276 this.fillColor = 4278190080;
2277 this.fillGradient = null;
2278 this.fillGradientPaint = null;
2279 this.fillName = null;
2280 this.fillOpacity = 1;
2281 if (this.element.getName() !== "svg") {
2282 throw "root is not <svg>, it's <" + this.element.getName() + ">"
2283 }
2284 } else {
2285 if (arguments.length === 2) {
2286 if (typeof arguments[1] === "string") {
2287 if (arguments[1].indexOf(".svg") > -1) {
2288 this.element = new cW.XMLElement(cW, arguments[1]);
2289 this.vertexCodes = [];
2290 this.vertices = [];
2291 this.opacity = 1;
2292 this.stroke = false;
2293 this.strokeColor = 4278190080;
2294 this.strokeWeight = 1;
2295 this.strokeCap = "butt";
2296 this.strokeJoin = "miter";
2297 this.strokeGradient = "";
2298 this.strokeGradientPaint = "";
2299 this.strokeName = "";
2300 this.strokeOpacity = 1;
2301 this.fill = true;
2302 this.fillColor = 4278190080;
2303 this.fillGradient = null;
2304 this.fillGradientPaint = null;
2305 this.fillOpacity = 1
2306 }
2307 } else {
2308 if (arguments[0]) {
2309 this.element = arguments[1];
2310 this.vertexCodes = arguments[0].vertexCodes.slice();
2311 this.vertices = arguments[0].vertices.slice();
2312 this.stroke = arguments[0].stroke;
2313 this.strokeColor = arguments[0].strokeColor;
2314 this.strokeWeight = arguments[0].strokeWeight;
2315 this.strokeCap = arguments[0].strokeCap;
2316 this.strokeJoin = arguments[0].strokeJoin;
2317 this.strokeGradient = arguments[0].strokeGradient;
2318 this.strokeGradientPaint = arguments[0].strokeGradientPaint;
2319 this.strokeName = arguments[0].strokeName;
2320 this.fill = arguments[0].fill;
2321 this.fillColor = arguments[0].fillColor;
2322 this.fillGradient = arguments[0].fillGradient;
2323 this.fillGradientPaint = arguments[0].fillGradientPaint;
2324 this.fillName = arguments[0].fillName;
2325 this.strokeOpacity = arguments[0].strokeOpacity;
2326 this.fillOpacity = arguments[0].fillOpacity;
2327 this.opacity = arguments[0].opacity
2328 }
2329 }
2330 }
2331 }
2332 this.name = this.element.getStringAttribute("id");
2333 var ea = this.element.getStringAttribute("display", "inline");
2334 this.visible = ea !== "none";
2335 var ef = this.element.getAttribute("transform");
2336 if (ef) {
2337 this.matrix = this.parseMatrix(ef)
2338 }
2339 var ec = this.element.getStringAttribute("viewBox");
2340 if (ec !== null) {
2341 var ee = ec.split(" ");
2342 this.width = ee[2];
2343 this.height = ee[3]
2344 }
2345 var eb = this.element.getStringAttribute("width");
2346 var ed = this.element.getStringAttribute("height");
2347 if (eb !== null) {
2348 this.width = this.parseUnitSize(eb);
2349 this.height = this.parseUnitSize(ed)
2350 } else {
2351 if (this.width === 0 || this.height === 0) {
2352 this.width = 1;
2353 this.height = 1;
2354 throw "The width and/or height is not readable in the <svg> tag of this file."
2355 }
2356 }
2357 this.parseColors(this.element);
2358 this.parseChildren(this.element)
2359 };
2360 cr.prototype = new O;
2361 cr.prototype.parseMatrix = function() {
2362 function ea(ec) {
2363 var eb = [];
2364 ec.replace(/\((.*?)\)/, function() {
2365 return function(ed, ee) {
2366 eb = ee.replace(/,+/g, " ").split(/\s+/)
2367 }
2368 }());
2369 return eb
2370 }
2371 return function(ei) {
2372 this.checkMatrix(2);
2373 var eb = [];
2374 ei.replace(/\s*(\w+)\((.*?)\)/g, function(el) {
2375 eb.push(cW.trim(el))
2376 });
2377 if (eb.length === 0) {
2378 return null
2379 }
2380 for (var eg = 0, ee = eb.length; eg < ee; eg++) {
2381 var ec = ea(eb[eg]);
2382 if (eb[eg].indexOf("matrix") !== -1) {
2383 this.matrix.set(ec[0], ec[2], ec[4], ec[1], ec[3], ec[5])
2384 } else {
2385 if (eb[eg].indexOf("translate") !== -1) {
2386 var eh = ec[0];
2387 var ef = ec.length === 2 ? ec[1] : 0;
2388 this.matrix.translate(eh, ef)
2389 } else {
2390 if (eb[eg].indexOf("scale") !== -1) {
2391 var ek = ec[0];
2392 var ej = ec.length === 2 ? ec[1] : ec[0];
2393 this.matrix.scale(ek, ej)
2394 } else {
2395 if (eb[eg].indexOf("rotate") !== -1) {
2396 var ed = ec[0];
2397 if (ec.length === 1) {
2398 this.matrix.rotate(cW.radians(ed))
2399 } else {
2400 if (ec.length === 3) {
2401 this.matrix.translate(ec[1], ec[2]);
2402 this.matrix.rotate(cW.radians(ec[0]));
2403 this.matrix.translate(-ec[1], -ec[2])
2404 }
2405 }
2406 } else {
2407 if (eb[eg].indexOf("skewX") !== -1) {
2408 this.matrix.skewX(parseFloat(ec[0]))
2409 } else {
2410 if (eb[eg].indexOf("skewY") !== -1) {
2411 this.matrix.skewY(ec[0])
2412 } else {
2413 if (eb[eg].indexOf("shearX") !== -1) {
2414 this.matrix.shearX(ec[0])
2415 } else {
2416 if (eb[eg].indexOf("shearY") !== -1) {
2417 this.matrix.shearY(ec[0])
2418 }
2419 }
2420 }
2421 }
2422 }
2423 }
2424 }
2425 }
2426 }
2427 return this.matrix
2428 }
2429 }();
2430 cr.prototype.parseChildren = function(ef) {
2431 var eb = ef.getChildren();
2432 var ee = new cW.PShape;
2433 for (var ed = 0, ec = eb.length; ed < ec; ed++) {
2434 var ea = this.parseChild(eb[ed]);
2435 if (ea) {
2436 ee.addChild(ea)
2437 }
2438 }
2439 this.children.push(ee)
2440 };
2441 cr.prototype.getName = function() {
2442 return this.name
2443 };
2444 cr.prototype.parseChild = function(ec) {
2445 var eb = ec.getName();
2446 var ea;
2447 if (eb === "g") {
2448 ea = new cr(this, ec)
2449 } else {
2450 if (eb === "defs") {
2451 ea = new cr(this, ec)
2452 } else {
2453 if (eb === "line") {
2454 ea = new cr(this, ec);
2455 ea.parseLine()
2456 } else {
2457 if (eb === "circle") {
2458 ea = new cr(this, ec);
2459 ea.parseEllipse(true)
2460 } else {
2461 if (eb === "ellipse") {
2462 ea = new cr(this, ec);
2463 ea.parseEllipse(false)
2464 } else {
2465 if (eb === "rect") {
2466 ea = new cr(this, ec);
2467 ea.parseRect()
2468 } else {
2469 if (eb === "polygon") {
2470 ea = new cr(this, ec);
2471 ea.parsePoly(true)
2472 } else {
2473 if (eb === "polyline") {
2474 ea = new cr(this, ec);
2475 ea.parsePoly(false)
2476 } else {
2477 if (eb === "path") {
2478 ea = new cr(this, ec);
2479 ea.parsePath()
2480 } else {
2481 if (eb === "radialGradient") {
2482 dw("PShapeSVG.prototype.parseChild, name = radialGradient")
2483 } else {
2484 if (eb === "linearGradient") {
2485 dw("PShapeSVG.prototype.parseChild, name = linearGradient")
2486 } else {
2487 if (eb === "text") {
2488 dw("PShapeSVG.prototype.parseChild, name = text")
2489 } else {
2490 if (eb === "filter") {
2491 dw("PShapeSVG.prototype.parseChild, name = filter")
2492 } else {
2493 if (eb === "mask") {
2494 dw("PShapeSVG.prototype.parseChild, name = mask")
2495 } else {
2496 G()
2497 }
2498 }
2499 }
2500 }
2501 }
2502 }
2503 }
2504 }
2505 }
2506 }
2507 }
2508 }
2509 }
2510 }
2511 return ea
2512 };
2513 cr.prototype.parsePath = function() {
2514 this.family = 21;
2515 this.kind = 0;
2516 var ef = [];
2517 var ez;
2518 var ey = cW.trim(this.element.getStringAttribute("d").replace(/[\s,]+/g, " "));
2519 if (ey === null) {
2520 return
2521 }
2522 ey = cW.__toCharArray(ey);
2523 var ed = 0,
2524 ec = 0,
2525 ek = 0,
2526 ei = 0,
2527 ej = 0,
2528 eh = 0,
2529 eq = 0,
2530 ep = 0,
2531 eb = 0,
2532 ea = 0,
2533 em = 0,
2534 el = 0,
2535 eo = 0,
2536 en = 0,
2537 ex = 0,
2538 et = 0;
2539 var er = "";
2540 var ev = [];
2541 var ew = false;
2542 var eg;
2543 var ee;
2544 var eu, es;
2545 while (ex < ey.length) {
2546 et = ey[ex].valueOf();
2547 if (et >= 65 && et <= 90 || et >= 97 && et <= 122) {
2548 eu = ex;
2549 ex++;
2550 if (ex < ey.length) {
2551 ev = [];
2552 et = ey[ex].valueOf();
2553 while (!(et >= 65 && et <= 90 || et >= 97 && et <= 100 || et >= 102 && et <= 122) && ew === false) {
2554 if (et === 32) {
2555 if (er !== "") {
2556 ev.push(parseFloat(er));
2557 er = ""
2558 }
2559 ex++
2560 } else {
2561 if (et === 45) {
2562 if (ey[ex - 1].valueOf() === 101) {
2563 er += ey[ex].toString();
2564 ex++
2565 } else {
2566 if (er !== "") {
2567 ev.push(parseFloat(er))
2568 }
2569 er = ey[ex].toString();
2570 ex++
2571 }
2572 } else {
2573 er += ey[ex].toString();
2574 ex++
2575 }
2576 } if (ex === ey.length) {
2577 ew = true
2578 } else {
2579 et = ey[ex].valueOf()
2580 }
2581 }
2582 }
2583 if (er !== "") {
2584 ev.push(parseFloat(er));
2585 er = ""
2586 }
2587 ee = ey[eu];
2588 et = ee.valueOf();
2589 if (et === 77) {
2590 if (ev.length >= 2 && ev.length % 2 === 0) {
2591 ed = ev[0];
2592 ec = ev[1];
2593 this.parsePathMoveto(ed, ec);
2594 if (ev.length > 2) {
2595 for (eu = 2, es = ev.length; eu < es; eu += 2) {
2596 ed = ev[eu];
2597 ec = ev[eu + 1];
2598 this.parsePathLineto(ed, ec)
2599 }
2600 }
2601 }
2602 } else {
2603 if (et === 109) {
2604 if (ev.length >= 2 && ev.length % 2 === 0) {
2605 ed += ev[0];
2606 ec += ev[1];
2607 this.parsePathMoveto(ed, ec);
2608 if (ev.length > 2) {
2609 for (eu = 2, es = ev.length; eu < es; eu += 2) {
2610 ed += ev[eu];
2611 ec += ev[eu + 1];
2612 this.parsePathLineto(ed, ec)
2613 }
2614 }
2615 }
2616 } else {
2617 if (et === 76) {
2618 if (ev.length >= 2 && ev.length % 2 === 0) {
2619 for (eu = 0, es = ev.length; eu < es; eu += 2) {
2620 ed = ev[eu];
2621 ec = ev[eu + 1];
2622 this.parsePathLineto(ed, ec)
2623 }
2624 }
2625 } else {
2626 if (et === 108) {
2627 if (ev.length >= 2 && ev.length % 2 === 0) {
2628 for (eu = 0, es = ev.length; eu < es; eu += 2) {
2629 ed += ev[eu];
2630 ec += ev[eu + 1];
2631 this.parsePathLineto(ed, ec)
2632 }
2633 }
2634 } else {
2635 if (et === 72) {
2636 for (eu = 0, es = ev.length; eu < es; eu++) {
2637 ed = ev[eu];
2638 this.parsePathLineto(ed, ec)
2639 }
2640 } else {
2641 if (et === 104) {
2642 for (eu = 0, es = ev.length; eu < es; eu++) {
2643 ed += ev[eu];
2644 this.parsePathLineto(ed, ec)
2645 }
2646 } else {
2647 if (et === 86) {
2648 for (eu = 0, es = ev.length; eu < es; eu++) {
2649 ec = ev[eu];
2650 this.parsePathLineto(ed, ec)
2651 }
2652 } else {
2653 if (et === 118) {
2654 for (eu = 0, es = ev.length; eu < es; eu++) {
2655 ec += ev[eu];
2656 this.parsePathLineto(ed, ec)
2657 }
2658 } else {
2659 if (et === 67) {
2660 if (ev.length >= 6 && ev.length % 6 === 0) {
2661 for (eu = 0, es = ev.length; eu < es; eu += 6) {
2662 ej = ev[eu];
2663 eq = ev[eu + 1];
2664 eh = ev[eu + 2];
2665 ep = ev[eu + 3];
2666 eb = ev[eu + 4];
2667 ea = ev[eu + 5];
2668 this.parsePathCurveto(ej, eq, eh, ep, eb, ea);
2669 ed = eb;
2670 ec = ea
2671 }
2672 }
2673 } else {
2674 if (et === 99) {
2675 if (ev.length >= 6 && ev.length % 6 === 0) {
2676 for (eu = 0, es = ev.length; eu < es; eu += 6) {
2677 ej = ed + ev[eu];
2678 eq = ec + ev[eu + 1];
2679 eh = ed + ev[eu + 2];
2680 ep = ec + ev[eu + 3];
2681 eb = ed + ev[eu + 4];
2682 ea = ec + ev[eu + 5];
2683 this.parsePathCurveto(ej, eq, eh, ep, eb, ea);
2684 ed = eb;
2685 ec = ea
2686 }
2687 }
2688 } else {
2689 if (et === 83) {
2690 if (ev.length >= 4 && ev.length % 4 === 0) {
2691 for (eu = 0, es = ev.length; eu < es; eu += 4) {
2692 if (eg.toLowerCase() === "c" || eg.toLowerCase() === "s") {
2693 em = this.vertices[this.vertices.length - 2][0];
2694 el = this.vertices[this.vertices.length - 2][1];
2695 eo = this.vertices[this.vertices.length - 1][0];
2696 en = this.vertices[this.vertices.length - 1][1];
2697 ej = eo + (eo - em);
2698 eq = en + (en - el)
2699 } else {
2700 ej = this.vertices[this.vertices.length - 1][0];
2701 eq = this.vertices[this.vertices.length - 1][1]
2702 }
2703 eh = ev[eu];
2704 ep = ev[eu + 1];
2705 eb = ev[eu + 2];
2706 ea = ev[eu + 3];
2707 this.parsePathCurveto(ej, eq, eh, ep, eb, ea);
2708 ed = eb;
2709 ec = ea
2710 }
2711 }
2712 } else {
2713 if (et === 115) {
2714 if (ev.length >= 4 && ev.length % 4 === 0) {
2715 for (eu = 0, es = ev.length; eu < es; eu += 4) {
2716 if (eg.toLowerCase() === "c" || eg.toLowerCase() === "s") {
2717 em = this.vertices[this.vertices.length - 2][0];
2718 el = this.vertices[this.vertices.length - 2][1];
2719 eo = this.vertices[this.vertices.length - 1][0];
2720 en = this.vertices[this.vertices.length - 1][1];
2721 ej = eo + (eo - em);
2722 eq = en + (en - el)
2723 } else {
2724 ej = this.vertices[this.vertices.length - 1][0];
2725 eq = this.vertices[this.vertices.length - 1][1]
2726 }
2727 eh = ed + ev[eu];
2728 ep = ec + ev[eu + 1];
2729 eb = ed + ev[eu + 2];
2730 ea = ec + ev[eu + 3];
2731 this.parsePathCurveto(ej, eq, eh, ep, eb, ea);
2732 ed = eb;
2733 ec = ea
2734 }
2735 }
2736 } else {
2737 if (et === 81) {
2738 if (ev.length >= 4 && ev.length % 4 === 0) {
2739 for (eu = 0, es = ev.length; eu < es; eu += 4) {
2740 ek = ev[eu];
2741 ei = ev[eu + 1];
2742 eb = ev[eu + 2];
2743 ea = ev[eu + 3];
2744 this.parsePathQuadto(ed, ec, ek, ei, eb, ea);
2745 ed = eb;
2746 ec = ea
2747 }
2748 }
2749 } else {
2750 if (et === 113) {
2751 if (ev.length >= 4 && ev.length % 4 === 0) {
2752 for (eu = 0, es = ev.length; eu < es; eu += 4) {
2753 ek = ed + ev[eu];
2754 ei = ec + ev[eu + 1];
2755 eb = ed + ev[eu + 2];
2756 ea = ec + ev[eu + 3];
2757 this.parsePathQuadto(ed, ec, ek, ei, eb, ea);
2758 ed = eb;
2759 ec = ea
2760 }
2761 }
2762 } else {
2763 if (et === 84) {
2764 if (ev.length >= 2 && ev.length % 2 === 0) {
2765 for (eu = 0, es = ev.length; eu < es; eu += 2) {
2766 if (eg.toLowerCase() === "q" || eg.toLowerCase() === "t") {
2767 em = this.vertices[this.vertices.length - 2][0];
2768 el = this.vertices[this.vertices.length - 2][1];
2769 eo = this.vertices[this.vertices.length - 1][0];
2770 en = this.vertices[this.vertices.length - 1][1];
2771 ek = eo + (eo - em);
2772 ei = en + (en - el)
2773 } else {
2774 ek = ed;
2775 ei = ec
2776 }
2777 eb = ev[eu];
2778 ea = ev[eu + 1];
2779 this.parsePathQuadto(ed, ec, ek, ei, eb, ea);
2780 ed = eb;
2781 ec = ea
2782 }
2783 }
2784 } else {
2785 if (et === 116) {
2786 if (ev.length >= 2 && ev.length % 2 === 0) {
2787 for (eu = 0, es = ev.length; eu < es; eu += 2) {
2788 if (eg.toLowerCase() === "q" || eg.toLowerCase() === "t") {
2789 em = this.vertices[this.vertices.length - 2][0];
2790 el = this.vertices[this.vertices.length - 2][1];
2791 eo = this.vertices[this.vertices.length - 1][0];
2792 en = this.vertices[this.vertices.length - 1][1];
2793 ek = eo + (eo - em);
2794 ei = en + (en - el)
2795 } else {
2796 ek = ed;
2797 ei = ec
2798 }
2799 eb = ed + ev[eu];
2800 ea = ec + ev[eu + 1];
2801 this.parsePathQuadto(ed, ec, ek, ei, eb, ea);
2802 ed = eb;
2803 ec = ea
2804 }
2805 }
2806 } else {
2807 if (et === 90 || et === 122) {
2808 this.close = true
2809 }
2810 }
2811 }
2812 }
2813 }
2814 }
2815 }
2816 }
2817 }
2818 }
2819 }
2820 }
2821 }
2822 }
2823 }
2824 }
2825 }
2826 eg = ee.toString()
2827 } else {
2828 ex++
2829 }
2830 }
2831 };
2832 cr.prototype.parsePathQuadto = function(ec, ee, ea, ef, eb, ed) {
2833 if (this.vertices.length > 0) {
2834 this.parsePathCode(1);
2835 this.parsePathVertex(ec + (ea - ec) * 2 / 3, ee + (ef - ee) * 2 / 3);
2836 this.parsePathVertex(eb + (ea - eb) * 2 / 3, ed + (ef - ed) * 2 / 3);
2837 this.parsePathVertex(eb, ed)
2838 } else {
2839 throw "Path must start with M/m"
2840 }
2841 };
2842 cr.prototype.parsePathCurveto = function(ed, ef, eb, ee, ea, ec) {
2843 if (this.vertices.length > 0) {
2844 this.parsePathCode(1);
2845 this.parsePathVertex(ed, ef);
2846 this.parsePathVertex(eb, ee);
2847 this.parsePathVertex(ea, ec)
2848 } else {
2849 throw "Path must start with M/m"
2850 }
2851 };
2852 cr.prototype.parsePathLineto = function(eb, ea) {
2853 if (this.vertices.length > 0) {
2854 this.parsePathCode(0);
2855 this.parsePathVertex(eb, ea);
2856 this.vertices[this.vertices.length - 1]["moveTo"] = false
2857 } else {
2858 throw "Path must start with M/m"
2859 }
2860 };
2861 cr.prototype.parsePathMoveto = function(eb, ea) {
2862 if (this.vertices.length > 0) {
2863 this.parsePathCode(3)
2864 }
2865 this.parsePathCode(0);
2866 this.parsePathVertex(eb, ea);
2867 this.vertices[this.vertices.length - 1]["moveTo"] = true
2868 };
2869 cr.prototype.parsePathVertex = function(ea, ec) {
2870 var eb = [];
2871 eb[0] = ea;
2872 eb[1] = ec;
2873 this.vertices.push(eb)
2874 };
2875 cr.prototype.parsePathCode = function(ea) {
2876 this.vertexCodes.push(ea)
2877 };
2878 cr.prototype.parsePoly = function(ee) {
2879 this.family = 21;
2880 this.close = ee;
2881 var eb = cW.trim(this.element.getStringAttribute("points").replace(/[,\s]+/g, " "));
2882 if (eb !== null) {
2883 var ea = eb.split(" ");
2884 if (ea.length % 2 === 0) {
2885 for (var ed = 0, ec = ea.length; ed < ec; ed++) {
2886 var ef = [];
2887 ef[0] = ea[ed];
2888 ef[1] = ea[++ed];
2889 this.vertices.push(ef)
2890 }
2891 } else {
2892 throw "Error parsing polygon points: odd number of coordinates provided"
2893 }
2894 }
2895 };
2896 cr.prototype.parseRect = function() {
2897 this.kind = 30;
2898 this.family = 1;
2899 this.params = [];
2900 this.params[0] = this.element.getFloatAttribute("x");
2901 this.params[1] = this.element.getFloatAttribute("y");
2902 this.params[2] = this.element.getFloatAttribute("width");
2903 this.params[3] = this.element.getFloatAttribute("height");
2904 if (this.params[2] < 0 || this.params[3] < 0) {
2905 throw "svg error: negative width or height found while parsing <rect>"
2906 }
2907 };
2908 cr.prototype.parseEllipse = function(ec) {
2909 this.kind = 31;
2910 this.family = 1;
2911 this.params = [];
2912 this.params[0] = this.element.getFloatAttribute("cx") | 0;
2913 this.params[1] = this.element.getFloatAttribute("cy") | 0;
2914 var eb, ea;
2915 if (ec) {
2916 eb = ea = this.element.getFloatAttribute("r");
2917 if (eb < 0) {
2918 throw "svg error: negative radius found while parsing <circle>"
2919 }
2920 } else {
2921 eb = this.element.getFloatAttribute("rx");
2922 ea = this.element.getFloatAttribute("ry");
2923 if (eb < 0 || ea < 0) {
2924 throw "svg error: negative x-axis radius or y-axis radius found while parsing <ellipse>"
2925 }
2926 }
2927 this.params[0] -= eb;
2928 this.params[1] -= ea;
2929 this.params[2] = eb * 2;
2930 this.params[3] = ea * 2
2931 };
2932 cr.prototype.parseLine = function() {
2933 this.kind = 4;
2934 this.family = 1;
2935 this.params = [];
2936 this.params[0] = this.element.getFloatAttribute("x1");
2937 this.params[1] = this.element.getFloatAttribute("y1");
2938 this.params[2] = this.element.getFloatAttribute("x2");
2939 this.params[3] = this.element.getFloatAttribute("y2")
2940 };
2941 cr.prototype.parseColors = function(ec) {
2942 if (ec.hasAttribute("opacity")) {
2943 this.setOpacity(ec.getAttribute("opacity"))
2944 }
2945 if (ec.hasAttribute("stroke")) {
2946 this.setStroke(ec.getAttribute("stroke"))
2947 }
2948 if (ec.hasAttribute("stroke-width")) {
2949 this.setStrokeWeight(ec.getAttribute("stroke-width"))
2950 }
2951 if (ec.hasAttribute("stroke-linejoin")) {
2952 this.setStrokeJoin(ec.getAttribute("stroke-linejoin"))
2953 }
2954 if (ec.hasAttribute("stroke-linecap")) {
2955 this.setStrokeCap(ec.getStringAttribute("stroke-linecap"))
2956 }
2957 if (ec.hasAttribute("fill")) {
2958 this.setFill(ec.getStringAttribute("fill"))
2959 }
2960 if (ec.hasAttribute("style")) {
2961 var ef = ec.getStringAttribute("style");
2962 var ed = ef.toString().split(";");
2963 for (var eb = 0, ea = ed.length; eb < ea; eb++) {
2964 var ee = cW.trim(ed[eb].split(":"));
2965 if (ee[0] === "fill") {
2966 this.setFill(ee[1])
2967 } else {
2968 if (ee[0] === "fill-opacity") {
2969 this.setFillOpacity(ee[1])
2970 } else {
2971 if (ee[0] === "stroke") {
2972 this.setStroke(ee[1])
2973 } else {
2974 if (ee[0] === "stroke-width") {
2975 this.setStrokeWeight(ee[1])
2976 } else {
2977 if (ee[0] === "stroke-linecap") {
2978 this.setStrokeCap(ee[1])
2979 } else {
2980 if (ee[0] === "stroke-linejoin") {
2981 this.setStrokeJoin(ee[1])
2982 } else {
2983 if (ee[0] === "stroke-opacity") {
2984 this.setStrokeOpacity(ee[1])
2985 } else {
2986 if (ee[0] === "opacity") {
2987 this.setOpacity(ee[1])
2988 }
2989 }
2990 }
2991 }
2992 }
2993 }
2994 }
2995 }
2996 }
2997 }
2998 };
2999 cr.prototype.setFillOpacity = function(ea) {
3000 this.fillOpacity = parseFloat(ea);
3001 this.fillColor = this.fillOpacity * 255 << 24 | this.fillColor & 16777215
3002 };
3003 cr.prototype.setFill = function(ea) {
3004 var eb = this.fillColor & 4278190080;
3005 if (ea === "none") {
3006 this.fill = false
3007 } else {
3008 if (ea.indexOf("#") === 0) {
3009 this.fill = true;
3010 if (ea.length === 4) {
3011 ea = ea.replace(/#(.)(.)(.)/, "#$1$1$2$2$3$3")
3012 }
3013 this.fillColor = eb | parseInt(ea.substring(1), 16) & 16777215
3014 } else {
3015 if (ea.indexOf("rgb") === 0) {
3016 this.fill = true;
3017 this.fillColor = eb | this.parseRGB(ea)
3018 } else {
3019 if (ea.indexOf("url(#") === 0) {
3020 this.fillName = ea.substring(5, ea.length - 1)
3021 } else {
3022 if (E[ea]) {
3023 this.fill = true;
3024 this.fillColor = eb | parseInt(E[ea].substring(1), 16) & 16777215
3025 }
3026 }
3027 }
3028 }
3029 }
3030 };
3031 cr.prototype.setOpacity = function(ea) {
3032 this.strokeColor = parseFloat(ea) * 255 << 24 | this.strokeColor & 16777215;
3033 this.fillColor = parseFloat(ea) * 255 << 24 | this.fillColor & 16777215
3034 };
3035 cr.prototype.setStroke = function(ea) {
3036 var eb = this.strokeColor & 4278190080;
3037 if (ea === "none") {
3038 this.stroke = false
3039 } else {
3040 if (ea.charAt(0) === "#") {
3041 this.stroke = true;
3042 if (ea.length === 4) {
3043 ea = ea.replace(/#(.)(.)(.)/, "#$1$1$2$2$3$3")
3044 }
3045 this.strokeColor = eb | parseInt(ea.substring(1), 16) & 16777215
3046 } else {
3047 if (ea.indexOf("rgb") === 0) {
3048 this.stroke = true;
3049 this.strokeColor = eb | this.parseRGB(ea)
3050 } else {
3051 if (ea.indexOf("url(#") === 0) {
3052 this.strokeName = ea.substring(5, ea.length - 1)
3053 } else {
3054 if (E[ea]) {
3055 this.stroke = true;
3056 this.strokeColor = eb | parseInt(E[ea].substring(1), 16) & 16777215
3057 }
3058 }
3059 }
3060 }
3061 }
3062 };
3063 cr.prototype.setStrokeWeight = function(ea) {
3064 this.strokeWeight = this.parseUnitSize(ea)
3065 };
3066 cr.prototype.setStrokeJoin = function(ea) {
3067 if (ea === "miter") {
3068 this.strokeJoin = "miter"
3069 } else {
3070 if (ea === "round") {
3071 this.strokeJoin = "round"
3072 } else {
3073 if (ea === "bevel") {
3074 this.strokeJoin = "bevel"
3075 }
3076 }
3077 }
3078 };
3079 cr.prototype.setStrokeCap = function(ea) {
3080 if (ea === "butt") {
3081 this.strokeCap = "butt"
3082 } else {
3083 if (ea === "round") {
3084 this.strokeCap = "round"
3085 } else {
3086 if (ea === "square") {
3087 this.strokeCap = "square"
3088 }
3089 }
3090 }
3091 };
3092 cr.prototype.setStrokeOpacity = function(ea) {
3093 this.strokeOpacity = parseFloat(ea);
3094 this.strokeColor = this.strokeOpacity * 255 << 24 | this.strokeColor & 16777215
3095 };
3096 cr.prototype.parseRGB = function(eb) {
3097 var ec = eb.substring(eb.indexOf("(") + 1, eb.indexOf(")"));
3098 var ea = ec.split(", ");
3099 return ea[0] << 16 | ea[1] << 8 | ea[2]
3100 };
3101 cr.prototype.parseUnitSize = function(eb) {
3102 var ea = eb.length - 2;
3103 if (ea < 0) {
3104 return eb
3105 }
3106 if (eb.indexOf("pt") === ea) {
3107 return parseFloat(eb.substring(0, ea)) * 1.25
3108 }
3109 if (eb.indexOf("pc") === ea) {
3110 return parseFloat(eb.substring(0, ea)) * 15
3111 }
3112 if (eb.indexOf("mm") === ea) {
3113 return parseFloat(eb.substring(0, ea)) * 3.543307
3114 }
3115 if (eb.indexOf("cm") === ea) {
3116 return parseFloat(eb.substring(0, ea)) * 35.43307
3117 }
3118 if (eb.indexOf("in") === ea) {
3119 return parseFloat(eb.substring(0, ea)) * 90
3120 }
3121 if (eb.indexOf("px") === ea) {
3122 return parseFloat(eb.substring(0, ea))
3123 }
3124 return parseFloat(eb)
3125 };
3126 cW.shape = function(ec, eb, ee, ed, ea) {
3127 if (arguments.length >= 1 && arguments[0] !== null) {
3128 if (ec.isVisible()) {
3129 cW.pushMatrix();
3130 if (S === 3) {
3131 if (arguments.length === 5) {
3132 cW.translate(eb - ed / 2, ee - ea / 2);
3133 cW.scale(ed / ec.getWidth(), ea / ec.getHeight())
3134 } else {
3135 if (arguments.length === 3) {
3136 cW.translate(eb - ec.getWidth() / 2, -ec.getHeight() / 2)
3137 } else {
3138 cW.translate(-ec.getWidth() / 2, -ec.getHeight() / 2)
3139 }
3140 }
3141 } else {
3142 if (S === 0) {
3143 if (arguments.length === 5) {
3144 cW.translate(eb, ee);
3145 cW.scale(ed / ec.getWidth(), ea / ec.getHeight())
3146 } else {
3147 if (arguments.length === 3) {
3148 cW.translate(eb, ee)
3149 }
3150 }
3151 } else {
3152 if (S === 1) {
3153 if (arguments.length === 5) {
3154 ed -= eb;
3155 ea -= ee;
3156 cW.translate(eb, ee);
3157 cW.scale(ed / ec.getWidth(), ea / ec.getHeight())
3158 } else {
3159 if (arguments.length === 3) {
3160 cW.translate(eb, ee)
3161 }
3162 }
3163 }
3164 }
3165 }
3166 ec.draw(cW);
3167 if (arguments.length === 1 && S === 3 || arguments.length > 1) {
3168 cW.popMatrix()
3169 }
3170 }
3171 }
3172 };
3173 cW.shapeMode = function(ea) {
3174 S = ea
3175 };
3176 cW.loadShape = function(ea) {
3177 if (arguments.length === 1) {
3178 if (ea.indexOf(".svg") > -1) {
3179 return new cr(null, ea)
3180 }
3181 }
3182 return null
3183 };
3184 var cT = function(ee, ed, ea, eb, ec) {
3185 this.fullName = ee || "";
3186 this.name = ed || "";
3187 this.namespace = ea || "";
3188 this.value = eb;
3189 this.type = ec
3190 };
3191 cT.prototype = {
3192 getName: function() {
3193 return this.name
3194 },
3195 getFullName: function() {
3196 return this.fullName
3197 },
3198 getNamespace: function() {
3199 return this.namespace
3200 },
3201 getValue: function() {
3202 return this.value
3203 },
3204 getType: function() {
3205 return this.type
3206 },
3207 setValue: function(ea) {
3208 this.value = ea
3209 }
3210 };
3211 var b9 = cW.XMLElement = function(ea, ec, ed, eb) {
3212 this.attributes = [];
3213 this.children = [];
3214 this.fullName = null;
3215 this.name = null;
3216 this.namespace = "";
3217 this.content = null;
3218 this.parent = null;
3219 this.lineNr = "";
3220 this.systemID = "";
3221 this.type = "ELEMENT";
3222 if (ea) {
3223 if (typeof ea === "string") {
3224 if (ec === t && ea.indexOf("<") > -1) {
3225 this.parse(ea)
3226 } else {
3227 this.fullName = ea;
3228 this.namespace = ec;
3229 this.systemId = ed;
3230 this.lineNr = eb
3231 }
3232 } else {
3233 this.parse(ec)
3234 }
3235 }
3236 };
3237 b9.prototype = {
3238 parse: function(ea) {
3239 var ec;
3240 try {
3241 var ee = ea.substring(ea.length - 4);
3242 if (ee === ".xml" || ee === ".svg") {
3243 ea = w(ea)
3244 }
3245 ec = (new DOMParser).parseFromString(ea, "text/xml");
3246 var eb = ec.documentElement;
3247 if (eb) {
3248 this.parseChildrenRecursive(null, eb)
3249 } else {
3250 throw "Error loading document"
3251 }
3252 return this
3253 } catch (ed) {
3254 throw ed
3255 }
3256 },
3257 parseChildrenRecursive: function(ei, eg) {
3258 var ef, eb, eh, ee, ed, ea;
3259 if (!ei) {
3260 this.fullName = eg.localName;
3261 this.name = eg.nodeName;
3262 ef = this
3263 } else {
3264 ef = new b9(eg.nodeName);
3265 ef.parent = ei
3266 } if (eg.nodeType === 3 && eg.textContent !== "") {
3267 return this.createPCDataElement(eg.textContent)
3268 }
3269 if (eg.nodeType === 4) {
3270 return this.createCDataElement(eg.textContent)
3271 }
3272 if (eg.attributes) {
3273 for (ee = 0, ed = eg.attributes.length; ee < ed; ee++) {
3274 eh = eg.attributes[ee];
3275 eb = new cT(eh.getname, eh.nodeName, eh.namespaceURI, eh.nodeValue, eh.nodeType);
3276 ef.attributes.push(eb)
3277 }
3278 }
3279 if (eg.childNodes) {
3280 for (ee = 0, ed = eg.childNodes.length; ee < ed; ee++) {
3281 var ec = eg.childNodes[ee];
3282 ea = ef.parseChildrenRecursive(ef, ec);
3283 if (ea !== null) {
3284 ef.children.push(ea)
3285 }
3286 }
3287 }
3288 return ef
3289 },
3290 createElement: function(eb, ec, ed, ea) {
3291 if (ed === t) {
3292 return new b9(eb, ec)
3293 }
3294 return new b9(eb, ec, ed, ea)
3295 },
3296 createPCDataElement: function(eb, ea) {
3297 if (eb.replace(/^\s+$/g, "") === "") {
3298 return null
3299 }
3300 var ec = new b9;
3301 ec.type = "TEXT";
3302 ec.content = eb;
3303 return ec
3304 },
3305 createCDataElement: function(ec) {
3306 var ed = this.createPCDataElement(ec);
3307 if (ed === null) {
3308 return null
3309 }
3310 ed.type = "CDATA";
3311 var eb = {
3312 "<": "&lt;",
3313 ">": "&gt;",
3314 "'": "&apos;",
3315 '"': "&quot;"
3316 },
3317 ea;
3318 for (ea in eb) {
3319 if (!Object.hasOwnProperty(eb, ea)) {
3320 ec = ec.replace(new RegExp(ea, "g"), eb[ea])
3321 }
3322 }
3323 ed.cdata = ec;
3324 return ed
3325 },
3326 hasAttribute: function() {
3327 if (arguments.length === 1) {
3328 return this.getAttribute(arguments[0]) !== null
3329 }
3330 if (arguments.length === 2) {
3331 return this.getAttribute(arguments[0], arguments[1]) !== null
3332 }
3333 },
3334 equals: function(ef) {
3335 if (!(ef instanceof b9)) {
3336 return false
3337 }
3338 var ec, eb;
3339 if (this.fullName !== ef.fullName) {
3340 return false
3341 }
3342 if (this.attributes.length !== ef.getAttributeCount()) {
3343 return false
3344 }
3345 if (this.attributes.length !== ef.attributes.length) {
3346 return false
3347 }
3348 var ej, eh, ea, eg, ei;
3349 for (ec = 0, eb = this.attributes.length; ec < eb; ec++) {
3350 ej = this.attributes[ec].getName();
3351 eh = this.attributes[ec].getNamespace();
3352 ei = ef.findAttribute(ej, eh);
3353 if (ei === null) {
3354 return false
3355 }
3356 if (this.attributes[ec].getValue() !== ei.getValue()) {
3357 return false
3358 }
3359 if (this.attributes[ec].getType() !== ei.getType()) {
3360 return false
3361 }
3362 }
3363 if (this.children.length !== ef.getChildCount()) {
3364 return false
3365 }
3366 if (this.children.length > 0) {
3367 var ee, ed;
3368 for (ec = 0, eb = this.children.length; ec < eb; ec++) {
3369 ee = this.getChild(ec);
3370 ed = ef.getChild(ec);
3371 if (!ee.equals(ed)) {
3372 return false
3373 }
3374 }
3375 return true
3376 }
3377 return this.content === ef.content
3378 },
3379 getContent: function() {
3380 if (this.type === "TEXT" || this.type === "CDATA") {
3381 return this.content
3382 }
3383 var ea = this.children;
3384 if (ea.length === 1 && (ea[0].type === "TEXT" || ea[0].type === "CDATA")) {
3385 return ea[0].content
3386 }
3387 return null
3388 },
3389 getAttribute: function() {
3390 var ea;
3391 if (arguments.length === 2) {
3392 ea = this.findAttribute(arguments[0]);
3393 if (ea) {
3394 return ea.getValue()
3395 }
3396 return arguments[1]
3397 } else {
3398 if (arguments.length === 1) {
3399 ea = this.findAttribute(arguments[0]);
3400 if (ea) {
3401 return ea.getValue()
3402 }
3403 return null
3404 } else {
3405 if (arguments.length === 3) {
3406 ea = this.findAttribute(arguments[0], arguments[1]);
3407 if (ea) {
3408 return ea.getValue()
3409 }
3410 return arguments[2]
3411 }
3412 }
3413 }
3414 },
3415 getStringAttribute: function() {
3416 if (arguments.length === 1) {
3417 return this.getAttribute(arguments[0])
3418 }
3419 if (arguments.length === 2) {
3420 return this.getAttribute(arguments[0], arguments[1])
3421 }
3422 return this.getAttribute(arguments[0], arguments[1], arguments[2])
3423 },
3424 getString: function(ea) {
3425 return this.getStringAttribute(ea)
3426 },
3427 getFloatAttribute: function() {
3428 if (arguments.length === 1) {
3429 return parseFloat(this.getAttribute(arguments[0], 0))
3430 }
3431 if (arguments.length === 2) {
3432 return this.getAttribute(arguments[0], arguments[1])
3433 }
3434 return this.getAttribute(arguments[0], arguments[1], arguments[2])
3435 },
3436 getFloat: function(ea) {
3437 return this.getFloatAttribute(ea)
3438 },
3439 getIntAttribute: function() {
3440 if (arguments.length === 1) {
3441 return this.getAttribute(arguments[0], 0)
3442 }
3443 if (arguments.length === 2) {
3444 return this.getAttribute(arguments[0], arguments[1])
3445 }
3446 return this.getAttribute(arguments[0], arguments[1], arguments[2])
3447 },
3448 getInt: function(ea) {
3449 return this.getIntAttribute(ea)
3450 },
3451 hasChildren: function() {
3452 return this.children.length > 0
3453 },
3454 addChild: function(ea) {
3455 if (ea !== null) {
3456 ea.parent = this;
3457 this.children.push(ea)
3458 }
3459 },
3460 insertChild: function(ec, ea) {
3461 if (ec) {
3462 if (ec.getLocalName() === null && !this.hasChildren()) {
3463 var eb = this.children[this.children.length - 1];
3464 if (eb.getLocalName() === null) {
3465 eb.setContent(eb.getContent() + ec.getContent());
3466 return
3467 }
3468 }
3469 ec.parent = this;
3470 this.children.splice(ea, 0, ec)
3471 }
3472 },
3473 getChild: function(eb) {
3474 if (typeof eb === "number") {
3475 return this.children[eb]
3476 }
3477 if (eb.indexOf("/") !== -1) {
3478 return this.getChildRecursive(eb.split("/"), 0)
3479 }
3480 var ea, ee;
3481 for (var ed = 0, ec = this.getChildCount(); ed < ec; ed++) {
3482 ea = this.getChild(ed);
3483 ee = ea.getName();
3484 if (ee !== null && ee === eb) {
3485 return ea
3486 }
3487 }
3488 return null
3489 },
3490 getChildren: function() {
3491 if (arguments.length === 1) {
3492 if (typeof arguments[0] === "number") {
3493 return this.getChild(arguments[0])
3494 }
3495 if (arguments[0].indexOf("/") !== -1) {
3496 return this.getChildrenRecursive(arguments[0].split("/"), 0)
3497 }
3498 var ee = [];
3499 var ea, ed;
3500 for (var ec = 0, eb = this.getChildCount(); ec < eb; ec++) {
3501 ea = this.getChild(ec);
3502 ed = ea.getName();
3503 if (ed !== null && ed === arguments[0]) {
3504 ee.push(ea)
3505 }
3506 }
3507 return ee
3508 }
3509 return this.children
3510 },
3511 getChildCount: function() {
3512 return this.children.length
3513 },
3514 getChildRecursive: function(eb, eg) {
3515 if (eg === eb.length) {
3516 return this
3517 }
3518 var ea, ef, ee = eb[eg];
3519 for (var ed = 0, ec = this.getChildCount(); ed < ec; ed++) {
3520 ea = this.getChild(ed);
3521 ef = ea.getName();
3522 if (ef !== null && ef === ee) {
3523 return ea.getChildRecursive(eb, eg + 1)
3524 }
3525 }
3526 return null
3527 },
3528 getChildrenRecursive: function(ea, ee) {
3529 if (ee === ea.length - 1) {
3530 return this.getChildren(ea[ee])
3531 }
3532 var ed = this.getChildren(ea[ee]);
3533 var ec = [];
3534 for (var eb = 0; eb < ed.length; eb++) {
3535 ec = ec.concat(ed[eb].getChildrenRecursive(ea, ee + 1))
3536 }
3537 return ec
3538 },
3539 isLeaf: function() {
3540 return !this.hasChildren()
3541 },
3542 listChildren: function() {
3543 var ea = [];
3544 for (var ec = 0, eb = this.children.length; ec < eb; ec++) {
3545 ea.push(this.getChild(ec).getName())
3546 }
3547 return ea
3548 },
3549 removeAttribute: function(eb, ed) {
3550 this.namespace = ed || "";
3551 for (var ec = 0, ea = this.attributes.length; ec < ea; ec++) {
3552 if (this.attributes[ec].getName() === eb && this.attributes[ec].getNamespace() === this.namespace) {
3553 this.attributes.splice(ec, 1);
3554 break
3555 }
3556 }
3557 },
3558 removeChild: function(ec) {
3559 if (ec) {
3560 for (var eb = 0, ea = this.children.length; eb < ea; eb++) {
3561 if (this.children[eb].equals(ec)) {
3562 this.children.splice(eb, 1);
3563 break
3564 }
3565 }
3566 }
3567 },
3568 removeChildAtIndex: function(ea) {
3569 if (this.children.length > ea) {
3570 this.children.splice(ea, 1)
3571 }
3572 },
3573 findAttribute: function(eb, ed) {
3574 this.namespace = ed || "";
3575 for (var ec = 0, ea = this.attributes.length; ec < ea; ec++) {
3576 if (this.attributes[ec].getName() === eb && this.attributes[ec].getNamespace() === this.namespace) {
3577 return this.attributes[ec]
3578 }
3579 }
3580 return null
3581 },
3582 setAttribute: function() {
3583 var ea;
3584 if (arguments.length === 3) {
3585 var ec = arguments[0].indexOf(":");
3586 var eb = arguments[0].substring(ec + 1);
3587 ea = this.findAttribute(eb, arguments[1]);
3588 if (ea) {
3589 ea.setValue(arguments[2])
3590 } else {
3591 ea = new cT(arguments[0], eb, arguments[1], arguments[2], "CDATA");
3592 this.attributes.push(ea)
3593 }
3594 } else {
3595 ea = this.findAttribute(arguments[0]);
3596 if (ea) {
3597 ea.setValue(arguments[1])
3598 } else {
3599 ea = new cT(arguments[0], arguments[0], null, arguments[1], "CDATA");
3600 this.attributes.push(ea)
3601 }
3602 }
3603 },
3604 setString: function(ea, eb) {
3605 this.setAttribute(ea, eb)
3606 },
3607 setInt: function(ea, eb) {
3608 this.setAttribute(ea, eb)
3609 },
3610 setFloat: function(ea, eb) {
3611 this.setAttribute(ea, eb)
3612 },
3613 setContent: function(ea) {
3614 if (this.children.length > 0) {
3615 F.debug("Tried to set content for XMLElement with children")
3616 }
3617 this.content = ea
3618 },
3619 setName: function() {
3620 if (arguments.length === 1) {
3621 this.name = arguments[0];
3622 this.fullName = arguments[0];
3623 this.namespace = null
3624 } else {
3625 var ea = arguments[0].indexOf(":");
3626 if (arguments[1] === null || ea < 0) {
3627 this.name = arguments[0]
3628 } else {
3629 this.name = arguments[0].substring(ea + 1)
3630 }
3631 this.fullName = arguments[0];
3632 this.namespace = arguments[1]
3633 }
3634 },
3635 getName: function() {
3636 return this.fullName
3637 },
3638 getLocalName: function() {
3639 return this.name
3640 },
3641 getAttributeCount: function() {
3642 return this.attributes.length
3643 },
3644 toString: function() {
3645 if (this.type === "TEXT") {
3646 return this.content
3647 }
3648 if (this.type === "CDATA") {
3649 return this.cdata
3650 }
3651 var ec = this.fullName;
3652 var ed = "<" + ec;
3653 var eb, ee;
3654 for (eb = 0; eb < this.attributes.length; eb++) {
3655 var ea = this.attributes[eb];
3656 ed += " " + ea.getName() + '="' + ea.getValue() + '"'
3657 }
3658 if (this.children.length === 0) {
3659 if (this.content === "") {
3660 ed += "/>"
3661 } else {
3662 ed += ">" + this.content + "</" + ec + ">"
3663 }
3664 } else {
3665 ed += ">";
3666 for (ee = 0; ee < this.children.length; ee++) {
3667 ed += this.children[ee].toString()
3668 }
3669 ed += "</" + ec + ">"
3670 }
3671 return ed
3672 }
3673 };
3674 b9.parse = function(eb) {
3675 var ea = new b9;
3676 ea.parse(eb);
3677 return ea
3678 };
3679 var dg = cW.XML = cW.XMLElement;
3680 cW.loadXML = function(ea) {
3681 return new dg(cW, ea)
3682 };
3683 var cm = function(ed) {
3684 var ea = 0;
3685 for (var eb = 0; eb < ed.length; eb++) {
3686 if (eb !== 0) {
3687 ea = q.max(ea, q.abs(ed[eb]))
3688 } else {
3689 ea = q.abs(ed[eb])
3690 }
3691 }
3692 var ec = (ea + "").indexOf(".");
3693 if (ec === 0) {
3694 ec = 1
3695 } else {
3696 if (ec === -1) {
3697 ec = (ea + "").length
3698 }
3699 }
3700 return ec
3701 };
3702 var aX = cW.PMatrix2D = function() {
3703 if (arguments.length === 0) {
3704 this.reset()
3705 } else {
3706 if (arguments.length === 1 && arguments[0] instanceof aX) {
3707 this.set(arguments[0].array())
3708 } else {
3709 if (arguments.length === 6) {
3710 this.set(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5])
3711 }
3712 }
3713 }
3714 };
3715 aX.prototype = {
3716 set: function() {
3717 if (arguments.length === 6) {
3718 var ea = arguments;
3719 this.set([ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]])
3720 } else {
3721 if (arguments.length === 1 && arguments[0] instanceof aX) {
3722 this.elements = arguments[0].array()
3723 } else {
3724 if (arguments.length === 1 && arguments[0] instanceof Array) {
3725 this.elements = arguments[0].slice()
3726 }
3727 }
3728 }
3729 },
3730 get: function() {
3731 var ea = new aX;
3732 ea.set(this.elements);
3733 return ea
3734 },
3735 reset: function() {
3736 this.set([1, 0, 0, 0, 1, 0])
3737 },
3738 array: function aE() {
3739 return this.elements.slice()
3740 },
3741 translate: function(eb, ea) {
3742 this.elements[2] = eb * this.elements[0] + ea * this.elements[1] + this.elements[2];
3743 this.elements[5] = eb * this.elements[3] + ea * this.elements[4] + this.elements[5]
3744 },
3745 invTranslate: function(eb, ea) {
3746 this.translate(-eb, -ea)
3747 },
3748 transpose: function() {},
3749 mult: function(eb, ec) {
3750 var ea, ed;
3751 if (eb instanceof A) {
3752 ea = eb.x;
3753 ed = eb.y;
3754 if (!ec) {
3755 ec = new A
3756 }
3757 } else {
3758 if (eb instanceof Array) {
3759 ea = eb[0];
3760 ed = eb[1];
3761 if (!ec) {
3762 ec = []
3763 }
3764 }
3765 } if (ec instanceof Array) {
3766 ec[0] = this.elements[0] * ea + this.elements[1] * ed + this.elements[2];
3767 ec[1] = this.elements[3] * ea + this.elements[4] * ed + this.elements[5]
3768 } else {
3769 if (ec instanceof A) {
3770 ec.x = this.elements[0] * ea + this.elements[1] * ed + this.elements[2];
3771 ec.y = this.elements[3] * ea + this.elements[4] * ed + this.elements[5];
3772 ec.z = 0
3773 }
3774 }
3775 return ec
3776 },
3777 multX: function(ea, eb) {
3778 return ea * this.elements[0] + eb * this.elements[1] + this.elements[2]
3779 },
3780 multY: function(ea, eb) {
3781 return ea * this.elements[3] + eb * this.elements[4] + this.elements[5]
3782 },
3783 skewX: function(ea) {
3784 this.apply(1, 0, 1, ea, 0, 0)
3785 },
3786 skewY: function(ea) {
3787 this.apply(1, 0, 1, 0, ea, 0)
3788 },
3789 shearX: function(ea) {
3790 this.apply(1, 0, 1, q.tan(ea), 0, 0)
3791 },
3792 shearY: function(ea) {
3793 this.apply(1, 0, 1, 0, q.tan(ea), 0)
3794 },
3795 determinant: function() {
3796 return this.elements[0] * this.elements[4] - this.elements[1] * this.elements[3]
3797 },
3798 invert: function() {
3799 var ef = this.determinant();
3800 if (q.abs(ef) > -2147483648) {
3801 var eb = this.elements[0];
3802 var eg = this.elements[1];
3803 var ee = this.elements[2];
3804 var ed = this.elements[3];
3805 var ec = this.elements[4];
3806 var ea = this.elements[5];
3807 this.elements[0] = ec / ef;
3808 this.elements[3] = -ed / ef;
3809 this.elements[1] = -eg / ef;
3810 this.elements[4] = eb / ef;
3811 this.elements[2] = (eg * ea - ec * ee) / ef;
3812 this.elements[5] = (ed * ee - eb * ea) / ef;
3813 return true
3814 }
3815 return false
3816 },
3817 scale: function(eb, ea) {
3818 if (eb && !ea) {
3819 ea = eb
3820 }
3821 if (eb && ea) {
3822 this.elements[0] *= eb;
3823 this.elements[1] *= ea;
3824 this.elements[3] *= eb;
3825 this.elements[4] *= ea
3826 }
3827 },
3828 invScale: function(eb, ea) {
3829 if (eb && !ea) {
3830 ea = eb
3831 }
3832 this.scale(1 / eb, 1 / ea)
3833 },
3834 apply: function() {
3835 var ec;
3836 if (arguments.length === 1 && arguments[0] instanceof aX) {
3837 ec = arguments[0].array()
3838 } else {
3839 if (arguments.length === 6) {
3840 ec = Array.prototype.slice.call(arguments)
3841 } else {
3842 if (arguments.length === 1 && arguments[0] instanceof Array) {
3843 ec = arguments[0]
3844 }
3845 }
3846 }
3847 var ea = [0, 0, this.elements[2], 0, 0, this.elements[5]];
3848 var ed = 0;
3849 for (var ee = 0; ee < 2; ee++) {
3850 for (var eb = 0; eb < 3; eb++, ed++) {
3851 ea[ed] += this.elements[ee * 3 + 0] * ec[eb + 0] + this.elements[ee * 3 + 1] * ec[eb + 3]
3852 }
3853 }
3854 this.elements = ea.slice()
3855 },
3856 preApply: function() {
3857 var eb;
3858 if (arguments.length === 1 && arguments[0] instanceof aX) {
3859 eb = arguments[0].array()
3860 } else {
3861 if (arguments.length === 6) {
3862 eb = Array.prototype.slice.call(arguments)
3863 } else {
3864 if (arguments.length === 1 && arguments[0] instanceof Array) {
3865 eb = arguments[0]
3866 }
3867 }
3868 }
3869 var ea = [0, 0, eb[2], 0, 0, eb[5]];
3870 ea[2] = eb[2] + this.elements[2] * eb[0] + this.elements[5] * eb[1];
3871 ea[5] = eb[5] + this.elements[2] * eb[3] + this.elements[5] * eb[4];
3872 ea[0] = this.elements[0] * eb[0] + this.elements[3] * eb[1];
3873 ea[3] = this.elements[0] * eb[3] + this.elements[3] * eb[4];
3874 ea[1] = this.elements[1] * eb[0] + this.elements[4] * eb[1];
3875 ea[4] = this.elements[1] * eb[3] + this.elements[4] * eb[4];
3876 this.elements = ea.slice()
3877 },
3878 rotate: function(ec) {
3879 var ee = q.cos(ec);
3880 var ea = q.sin(ec);
3881 var ed = this.elements[0];
3882 var eb = this.elements[1];
3883 this.elements[0] = ee * ed + ea * eb;
3884 this.elements[1] = -ea * ed + ee * eb;
3885 ed = this.elements[3];
3886 eb = this.elements[4];
3887 this.elements[3] = ee * ed + ea * eb;
3888 this.elements[4] = -ea * ed + ee * eb
3889 },
3890 rotateZ: function(ea) {
3891 this.rotate(ea)
3892 },
3893 invRotateZ: function(ea) {
3894 this.rotateZ(ea - q.PI)
3895 },
3896 print: function() {
3897 var eb = cm(this.elements);
3898 var ea = "" + cW.nfs(this.elements[0], eb, 4) + " " + cW.nfs(this.elements[1], eb, 4) + " " + cW.nfs(this.elements[2], eb, 4) + "\n" + cW.nfs(this.elements[3], eb, 4) + " " + cW.nfs(this.elements[4], eb, 4) + " " + cW.nfs(this.elements[5], eb, 4) + "\n\n";
3899 cW.println(ea)
3900 }
3901 };
3902 var aP = cW.PMatrix3D = function() {
3903 this.reset()
3904 };
3905 aP.prototype = {
3906 set: function() {
3907 if (arguments.length === 16) {
3908 this.elements = Array.prototype.slice.call(arguments)
3909 } else {
3910 if (arguments.length === 1 && arguments[0] instanceof aP) {
3911 this.elements = arguments[0].array()
3912 } else {
3913 if (arguments.length === 1 && arguments[0] instanceof Array) {
3914 this.elements = arguments[0].slice()
3915 }
3916 }
3917 }
3918 },
3919 get: function() {
3920 var ea = new aP;
3921 ea.set(this.elements);
3922 return ea
3923 },
3924 reset: function() {
3925 this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
3926 },
3927 array: function aE() {
3928 return this.elements.slice()
3929 },
3930 translate: function(eb, ea, ec) {
3931 if (ec === t) {
3932 ec = 0
3933 }
3934 this.elements[3] += eb * this.elements[0] + ea * this.elements[1] + ec * this.elements[2];
3935 this.elements[7] += eb * this.elements[4] + ea * this.elements[5] + ec * this.elements[6];
3936 this.elements[11] += eb * this.elements[8] + ea * this.elements[9] + ec * this.elements[10];
3937 this.elements[15] += eb * this.elements[12] + ea * this.elements[13] + ec * this.elements[14]
3938 },
3939 transpose: function() {
3940 var ea = this.elements[4];
3941 this.elements[4] = this.elements[1];
3942 this.elements[1] = ea;
3943 ea = this.elements[8];
3944 this.elements[8] = this.elements[2];
3945 this.elements[2] = ea;
3946 ea = this.elements[6];
3947 this.elements[6] = this.elements[9];
3948 this.elements[9] = ea;
3949 ea = this.elements[3];
3950 this.elements[3] = this.elements[12];
3951 this.elements[12] = ea;
3952 ea = this.elements[7];
3953 this.elements[7] = this.elements[13];
3954 this.elements[13] = ea;
3955 ea = this.elements[11];
3956 this.elements[11] = this.elements[14];
3957 this.elements[14] = ea
3958 },
3959 mult: function(ec, ed) {
3960 var ea, ef, ee, eb;
3961 if (ec instanceof A) {
3962 ea = ec.x;
3963 ef = ec.y;
3964 ee = ec.z;
3965 eb = 1;
3966 if (!ed) {
3967 ed = new A
3968 }
3969 } else {
3970 if (ec instanceof Array) {
3971 ea = ec[0];
3972 ef = ec[1];
3973 ee = ec[2];
3974 eb = ec[3] || 1;
3975 if (!ed || ed.length !== 3 && ed.length !== 4) {
3976 ed = [0, 0, 0]
3977 }
3978 }
3979 } if (ed instanceof Array) {
3980 if (ed.length === 3) {
3981 ed[0] = this.elements[0] * ea + this.elements[1] * ef + this.elements[2] * ee + this.elements[3];
3982 ed[1] = this.elements[4] * ea + this.elements[5] * ef + this.elements[6] * ee + this.elements[7];
3983 ed[2] = this.elements[8] * ea + this.elements[9] * ef + this.elements[10] * ee + this.elements[11]
3984 } else {
3985 if (ed.length === 4) {
3986 ed[0] = this.elements[0] * ea + this.elements[1] * ef + this.elements[2] * ee + this.elements[3] * eb;
3987 ed[1] = this.elements[4] * ea + this.elements[5] * ef + this.elements[6] * ee + this.elements[7] * eb;
3988 ed[2] = this.elements[8] * ea + this.elements[9] * ef + this.elements[10] * ee + this.elements[11] * eb;
3989 ed[3] = this.elements[12] * ea + this.elements[13] * ef + this.elements[14] * ee + this.elements[15] * eb
3990 }
3991 }
3992 }
3993 if (ed instanceof A) {
3994 ed.x = this.elements[0] * ea + this.elements[1] * ef + this.elements[2] * ee + this.elements[3];
3995 ed.y = this.elements[4] * ea + this.elements[5] * ef + this.elements[6] * ee + this.elements[7];
3996 ed.z = this.elements[8] * ea + this.elements[9] * ef + this.elements[10] * ee + this.elements[11]
3997 }
3998 return ed
3999 },
4000 preApply: function() {
4001 var ec;
4002 if (arguments.length === 1 && arguments[0] instanceof aP) {
4003 ec = arguments[0].array()
4004 } else {
4005 if (arguments.length === 16) {
4006 ec = Array.prototype.slice.call(arguments)
4007 } else {
4008 if (arguments.length === 1 && arguments[0] instanceof Array) {
4009 ec = arguments[0]
4010 }
4011 }
4012 }
4013 var ea = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
4014 var ed = 0;
4015 for (var ee = 0; ee < 4; ee++) {
4016 for (var eb = 0; eb < 4; eb++, ed++) {
4017 ea[ed] += this.elements[eb + 0] * ec[ee * 4 + 0] + this.elements[eb + 4] * ec[ee * 4 + 1] + this.elements[eb + 8] * ec[ee * 4 + 2] + this.elements[eb + 12] * ec[ee * 4 + 3]
4018 }
4019 }
4020 this.elements = ea.slice()
4021 },
4022 apply: function() {
4023 var ec;
4024 if (arguments.length === 1 && arguments[0] instanceof aP) {
4025 ec = arguments[0].array()
4026 } else {
4027 if (arguments.length === 16) {
4028 ec = Array.prototype.slice.call(arguments)
4029 } else {
4030 if (arguments.length === 1 && arguments[0] instanceof Array) {
4031 ec = arguments[0]
4032 }
4033 }
4034 }
4035 var ea = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
4036 var ed = 0;
4037 for (var ee = 0; ee < 4; ee++) {
4038 for (var eb = 0; eb < 4; eb++, ed++) {
4039 ea[ed] += this.elements[ee * 4 + 0] * ec[eb + 0] + this.elements[ee * 4 + 1] * ec[eb + 4] + this.elements[ee * 4 + 2] * ec[eb + 8] + this.elements[ee * 4 + 3] * ec[eb + 12]
4040 }
4041 }
4042 this.elements = ea.slice()
4043 },
4044 rotate: function(ee, ea, eg, ed) {
4045 if (!eg) {
4046 this.rotateZ(ee)
4047 } else {
4048 var ef = cW.cos(ee);
4049 var ec = cW.sin(ee);
4050 var eb = 1 - ef;
4051 this.apply(eb * ea * ea + ef, eb * ea * eg - ec * ed, eb * ea * ed + ec * eg, 0, eb * ea * eg + ec * ed, eb * eg * eg + ef, eb * eg * ed - ec * ea, 0, eb * ea * ed - ec * eg, eb * eg * ed + ec * ea, eb * ed * ed + ef, 0, 0, 0, 0, 1)
4052 }
4053 },
4054 invApply: function() {
4055 if (ab === t) {
4056 ab = new aP
4057 }
4058 var ea = arguments;
4059 ab.set(ea[0], ea[1], ea[2], ea[3], ea[4], ea[5], ea[6], ea[7], ea[8], ea[9], ea[10], ea[11], ea[12], ea[13], ea[14], ea[15]);
4060 if (!ab.invert()) {
4061 return false
4062 }
4063 this.preApply(ab);
4064 return true
4065 },
4066 rotateX: function(eb) {
4067 var ec = cW.cos(eb);
4068 var ea = cW.sin(eb);
4069 this.apply([1, 0, 0, 0, 0, ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1])
4070 },
4071 rotateY: function(eb) {
4072 var ec = cW.cos(eb);
4073 var ea = cW.sin(eb);
4074 this.apply([ec, 0, ea, 0, 0, 1, 0, 0, -ea, 0, ec, 0, 0, 0, 0, 1])
4075 },
4076 rotateZ: function(eb) {
4077 var ec = q.cos(eb);
4078 var ea = q.sin(eb);
4079 this.apply([ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
4080 },
4081 scale: function(ec, eb, ea) {
4082 if (ec && !eb && !ea) {
4083 eb = ea = ec
4084 } else {
4085 if (ec && eb && !ea) {
4086 ea = 1
4087 }
4088 } if (ec && eb && ea) {
4089 this.elements[0] *= ec;
4090 this.elements[1] *= eb;
4091 this.elements[2] *= ea;
4092 this.elements[4] *= ec;
4093 this.elements[5] *= eb;
4094 this.elements[6] *= ea;
4095 this.elements[8] *= ec;
4096 this.elements[9] *= eb;
4097 this.elements[10] *= ea;
4098 this.elements[12] *= ec;
4099 this.elements[13] *= eb;
4100 this.elements[14] *= ea
4101 }
4102 },
4103 skewX: function(eb) {
4104 var ea = q.tan(eb);
4105 this.apply(1, ea, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
4106 },
4107 skewY: function(eb) {
4108 var ea = q.tan(eb);
4109 this.apply(1, 0, 0, 0, ea, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
4110 },
4111 shearX: function(eb) {
4112 var ea = q.tan(eb);
4113 this.apply(1, ea, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
4114 },
4115 shearY: function(eb) {
4116 var ea = q.tan(eb);
4117 this.apply(1, 0, 0, 0, ea, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
4118 },
4119 multX: function(ea, ed, ec, eb) {
4120 if (!ec) {
4121 return this.elements[0] * ea + this.elements[1] * ed + this.elements[3]
4122 }
4123 if (!eb) {
4124 return this.elements[0] * ea + this.elements[1] * ed + this.elements[2] * ec + this.elements[3]
4125 }
4126 return this.elements[0] * ea + this.elements[1] * ed + this.elements[2] * ec + this.elements[3] * eb
4127 },
4128 multY: function(ea, ed, ec, eb) {
4129 if (!ec) {
4130 return this.elements[4] * ea + this.elements[5] * ed + this.elements[7]
4131 }
4132 if (!eb) {
4133 return this.elements[4] * ea + this.elements[5] * ed + this.elements[6] * ec + this.elements[7]
4134 }
4135 return this.elements[4] * ea + this.elements[5] * ed + this.elements[6] * ec + this.elements[7] * eb
4136 },
4137 multZ: function(ea, ed, ec, eb) {
4138 if (!eb) {
4139 return this.elements[8] * ea + this.elements[9] * ed + this.elements[10] * ec + this.elements[11]
4140 }
4141 return this.elements[8] * ea + this.elements[9] * ed + this.elements[10] * ec + this.elements[11] * eb
4142 },
4143 multW: function(ea, ed, ec, eb) {
4144 if (!eb) {
4145 return this.elements[12] * ea + this.elements[13] * ed + this.elements[14] * ec + this.elements[15]
4146 }
4147 return this.elements[12] * ea + this.elements[13] * ed + this.elements[14] * ec + this.elements[15] * eb
4148 },
4149 invert: function() {
4150 var ej = this.elements[0] * this.elements[5] - this.elements[1] * this.elements[4];
4151 var ei = this.elements[0] * this.elements[6] - this.elements[2] * this.elements[4];
4152 var eh = this.elements[0] * this.elements[7] - this.elements[3] * this.elements[4];
4153 var eg = this.elements[1] * this.elements[6] - this.elements[2] * this.elements[5];
4154 var ef = this.elements[1] * this.elements[7] - this.elements[3] * this.elements[5];
4155 var ee = this.elements[2] * this.elements[7] - this.elements[3] * this.elements[6];
4156 var ed = this.elements[8] * this.elements[13] - this.elements[9] * this.elements[12];
4157 var ec = this.elements[8] * this.elements[14] - this.elements[10] * this.elements[12];
4158 var eb = this.elements[8] * this.elements[15] - this.elements[11] * this.elements[12];
4159 var eo = this.elements[9] * this.elements[14] - this.elements[10] * this.elements[13];
4160 var em = this.elements[9] * this.elements[15] - this.elements[11] * this.elements[13];
4161 var el = this.elements[10] * this.elements[15] - this.elements[11] * this.elements[14];
4162 var en = ej * el - ei * em + eh * eo + eg * eb - ef * ec + ee * ed;
4163 if (q.abs(en) <= 1e-9) {
4164 return false
4165 }
4166 var ek = [];
4167 ek[0] = +this.elements[5] * el - this.elements[6] * em + this.elements[7] * eo;
4168 ek[4] = -this.elements[4] * el + this.elements[6] * eb - this.elements[7] * ec;
4169 ek[8] = +this.elements[4] * em - this.elements[5] * eb + this.elements[7] * ed;
4170 ek[12] = -this.elements[4] * eo + this.elements[5] * ec - this.elements[6] * ed;
4171 ek[1] = -this.elements[1] * el + this.elements[2] * em - this.elements[3] * eo;
4172 ek[5] = +this.elements[0] * el - this.elements[2] * eb + this.elements[3] * ec;
4173 ek[9] = -this.elements[0] * em + this.elements[1] * eb - this.elements[3] * ed;
4174 ek[13] = +this.elements[0] * eo - this.elements[1] * ec + this.elements[2] * ed;
4175 ek[2] = +this.elements[13] * ee - this.elements[14] * ef + this.elements[15] * eg;
4176 ek[6] = -this.elements[12] * ee + this.elements[14] * eh - this.elements[15] * ei;
4177 ek[10] = +this.elements[12] * ef - this.elements[13] * eh + this.elements[15] * ej;
4178 ek[14] = -this.elements[12] * eg + this.elements[13] * ei - this.elements[14] * ej;
4179 ek[3] = -this.elements[9] * ee + this.elements[10] * ef - this.elements[11] * eg;
4180 ek[7] = +this.elements[8] * ee - this.elements[10] * eh + this.elements[11] * ei;
4181 ek[11] = -this.elements[8] * ef + this.elements[9] * eh - this.elements[11] * ej;
4182 ek[15] = +this.elements[8] * eg - this.elements[9] * ei + this.elements[10] * ej;
4183 var ea = 1 / en;
4184 ek[0] *= ea;
4185 ek[1] *= ea;
4186 ek[2] *= ea;
4187 ek[3] *= ea;
4188 ek[4] *= ea;
4189 ek[5] *= ea;
4190 ek[6] *= ea;
4191 ek[7] *= ea;
4192 ek[8] *= ea;
4193 ek[9] *= ea;
4194 ek[10] *= ea;
4195 ek[11] *= ea;
4196 ek[12] *= ea;
4197 ek[13] *= ea;
4198 ek[14] *= ea;
4199 ek[15] *= ea;
4200 this.elements = ek.slice();
4201 return true
4202 },
4203 toString: function() {
4204 var eb = "";
4205 for (var ea = 0; ea < 15; ea++) {
4206 eb += this.elements[ea] + ", "
4207 }
4208 eb += this.elements[15];
4209 return eb
4210 },
4211 print: function() {
4212 var eb = cm(this.elements);
4213 var ea = "" + cW.nfs(this.elements[0], eb, 4) + " " + cW.nfs(this.elements[1], eb, 4) + " " + cW.nfs(this.elements[2], eb, 4) + " " + cW.nfs(this.elements[3], eb, 4) + "\n" + cW.nfs(this.elements[4], eb, 4) + " " + cW.nfs(this.elements[5], eb, 4) + " " + cW.nfs(this.elements[6], eb, 4) + " " + cW.nfs(this.elements[7], eb, 4) + "\n" + cW.nfs(this.elements[8], eb, 4) + " " + cW.nfs(this.elements[9], eb, 4) + " " + cW.nfs(this.elements[10], eb, 4) + " " + cW.nfs(this.elements[11], eb, 4) + "\n" + cW.nfs(this.elements[12], eb, 4) + " " + cW.nfs(this.elements[13], eb, 4) + " " + cW.nfs(this.elements[14], eb, 4) + " " + cW.nfs(this.elements[15], eb, 4) + "\n\n";
4214 cW.println(ea)
4215 },
4216 invTranslate: function(eb, ea, ec) {
4217 this.preApply(1, 0, 0, -eb, 0, 1, 0, -ea, 0, 0, 1, -ec, 0, 0, 0, 1)
4218 },
4219 invRotateX: function(eb) {
4220 var ec = q.cos(-eb);
4221 var ea = q.sin(-eb);
4222 this.preApply([1, 0, 0, 0, 0, ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1])
4223 },
4224 invRotateY: function(eb) {
4225 var ec = q.cos(-eb);
4226 var ea = q.sin(-eb);
4227 this.preApply([ec, 0, ea, 0, 0, 1, 0, 0, -ea, 0, ec, 0, 0, 0, 0, 1])
4228 },
4229 invRotateZ: function(eb) {
4230 var ec = q.cos(-eb);
4231 var ea = q.sin(-eb);
4232 this.preApply([ec, -ea, 0, 0, ea, ec, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
4233 },
4234 invScale: function(ea, ec, eb) {
4235 this.preApply([1 / ea, 0, 0, 0, 0, 1 / ec, 0, 0, 0, 0, 1 / eb, 0, 0, 0, 0, 1])
4236 }
4237 };
4238 var V = cW.PMatrixStack = function() {
4239 this.matrixStack = []
4240 };
4241 V.prototype.load = function() {
4242 var ea = dY.$newPMatrix();
4243 if (arguments.length === 1) {
4244 ea.set(arguments[0])
4245 } else {
4246 ea.set(arguments)
4247 }
4248 this.matrixStack.push(ea)
4249 };
4250 bR.prototype.$newPMatrix = function() {
4251 return new aX
4252 };
4253 bB.prototype.$newPMatrix = function() {
4254 return new aP
4255 };
4256 V.prototype.push = function() {
4257 this.matrixStack.push(this.peek())
4258 };
4259 V.prototype.pop = function() {
4260 return this.matrixStack.pop()
4261 };
4262 V.prototype.peek = function() {
4263 var ea = dY.$newPMatrix();
4264 ea.set(this.matrixStack[this.matrixStack.length - 1]);
4265 return ea
4266 };
4267 V.prototype.mult = function(ea) {
4268 this.matrixStack[this.matrixStack.length - 1].apply(ea)
4269 };
4270 cW.split = function(eb, ea) {
4271 return eb.split(ea)
4272 };
4273 cW.splitTokens = function(eg, ef) {
4274 if (ef === t) {
4275 return eg.split(/\s+/g)
4276 }
4277 var ed = ef.split(/()/g),
4278 eb = "",
4279 ea = eg.length,
4280 ec, eh, ee = [];
4281 for (ec = 0; ec < ea; ec++) {
4282 eh = eg[ec];
4283 if (ed.indexOf(eh) > -1) {
4284 if (eb !== "") {
4285 ee.push(eb)
4286 }
4287 eb = ""
4288 } else {
4289 eb += eh
4290 }
4291 }
4292 if (eb !== "") {
4293 ee.push(eb)
4294 }
4295 return ee
4296 };
4297 cW.append = function(eb, ea) {
4298 eb[eb.length] = ea;
4299 return eb
4300 };
4301 cW.concat = function(eb, ea) {
4302 return eb.concat(ea)
4303 };
4304 cW.sort = function(ef, ed) {
4305 var eb = [];
4306 if (ef.length > 0) {
4307 var ee = ed > 0 ? ed : ef.length;
4308 for (var ec = 0; ec < ee; ec++) {
4309 eb.push(ef[ec])
4310 }
4311 if (typeof ef[0] === "string") {
4312 eb.sort()
4313 } else {
4314 eb.sort(function(eh, eg) {
4315 return eh - eg
4316 })
4317 } if (ed > 0) {
4318 for (var ea = eb.length; ea < ef.length; ea++) {
4319 eb.push(ef[ea])
4320 }
4321 }
4322 }
4323 return eb
4324 };
4325 cW.splice = function(ee, ed, eb) {
4326 if (ed.length === 0) {
4327 return ee
4328 }
4329 if (ed instanceof Array) {
4330 for (var ec = 0, ea = eb; ec < ed.length; ea++, ec++) {
4331 ee.splice(ea, 0, ed[ec])
4332 }
4333 } else {
4334 ee.splice(eb, 0, ed)
4335 }
4336 return ee
4337 };
4338 cW.subset = function(ed, ec, eb) {
4339 var ea = eb !== t ? ec + eb : ed.length;
4340 return ed.slice(ec, ea)
4341 };
4342 cW.join = function(eb, ea) {
4343 return eb.join(ea)
4344 };
4345 cW.shorten = function(ed) {
4346 var eb = [];
4347 var ea = ed.length;
4348 for (var ec = 0; ec < ea; ec++) {
4349 eb[ec] = ed[ec]
4350 }
4351 eb.pop();
4352 return eb
4353 };
4354 cW.expand = function(ec, ed) {
4355 var eb = ec.slice(0),
4356 ea = ed || ec.length * 2;
4357 eb.length = ea;
4358 return eb
4359 };
4360 cW.arrayCopy = function() {
4361 var eg, ee = 0,
4362 ec, eb = 0,
4363 ef;
4364 if (arguments.length === 2) {
4365 eg = arguments[0];
4366 ec = arguments[1];
4367 ef = eg.length
4368 } else {
4369 if (arguments.length === 3) {
4370 eg = arguments[0];
4371 ec = arguments[1];
4372 ef = arguments[2]
4373 } else {
4374 if (arguments.length === 5) {
4375 eg = arguments[0];
4376 ee = arguments[1];
4377 ec = arguments[2];
4378 eb = arguments[3];
4379 ef = arguments[4]
4380 }
4381 }
4382 }
4383 for (var ed = ee, ea = eb; ed < ef + ee; ed++, ea++) {
4384 if (ec[ea] !== t) {
4385 ec[ea] = eg[ed]
4386 } else {
4387 throw "array index out of bounds exception"
4388 }
4389 }
4390 };
4391 cW.reverse = function(ea) {
4392 return ea.reverse()
4393 };
4394 cW.mix = function(eb, ea, ec) {
4395 return eb + ((ea - eb) * ec >> 8)
4396 };
4397 cW.peg = function(ea) {
4398 return ea < 0 ? 0 : ea > 255 ? 255 : ea
4399 };
4400 cW.modes = function() {
4401 var ef = 4278190080,
4402 ec = 16711680,
4403 eb = 65280,
4404 ee = 255,
4405 ed = q.min,
4406 ea = q.max;
4407
4408 function eg(el, eo, ek, et, ev, eu, em, eq, ep, ei, ej) {
4409 var es = ed(((el & 4278190080) >>> 24) + eo, 255) << 24;
4410 var eh = ek + ((ep - ek) * eo >> 8);
4411 eh = (eh < 0 ? 0 : eh > 255 ? 255 : eh) << 16;
4412 var en = et + ((ei - et) * eo >> 8);
4413 en = (en < 0 ? 0 : en > 255 ? 255 : en) << 8;
4414 var er = ev + ((ej - ev) * eo >> 8);
4415 er = er < 0 ? 0 : er > 255 ? 255 : er;
4416 return es | eh | en | er
4417 }
4418 return {
4419 replace: function(ei, eh) {
4420 return eh
4421 },
4422 blend: function(ej, ei) {
4423 var el = (ei & ef) >>> 24,
4424 eh = ej & ec,
4425 en = ej & eb,
4426 ep = ej & ee,
4427 eo = ei & ec,
4428 ek = ei & eb,
4429 em = ei & ee;
4430 return ed(((ej & ef) >>> 24) + el, 255) << 24 | eh + ((eo - eh) * el >> 8) & ec | en + ((ek - en) * el >> 8) & eb | ep + ((em - ep) * el >> 8) & ee
4431 },
4432 add: function(ei, eh) {
4433 var ej = (eh & ef) >>> 24;
4434 return ed(((ei & ef) >>> 24) + ej, 255) << 24 | ed((ei & ec) + ((eh & ec) >> 8) * ej, ec) & ec | ed((ei & eb) + ((eh & eb) >> 8) * ej, eb) & eb | ed((ei & ee) + ((eh & ee) * ej >> 8), ee)
4435 },
4436 subtract: function(ei, eh) {
4437 var ej = (eh & ef) >>> 24;
4438 return ed(((ei & ef) >>> 24) + ej, 255) << 24 | ea((ei & ec) - ((eh & ec) >> 8) * ej, eb) & ec | ea((ei & eb) - ((eh & eb) >> 8) * ej, ee) & eb | ea((ei & ee) - ((eh & ee) * ej >> 8), 0)
4439 },
4440 lightest: function(ei, eh) {
4441 var ej = (eh & ef) >>> 24;
4442 return ed(((ei & ef) >>> 24) + ej, 255) << 24 | ea(ei & ec, ((eh & ec) >> 8) * ej) & ec | ea(ei & eb, ((eh & eb) >> 8) * ej) & eb | ea(ei & ee, (eh & ee) * ej >> 8)
4443 },
4444 darkest: function(ej, ei) {
4445 var el = (ei & ef) >>> 24,
4446 eh = ej & ec,
4447 en = ej & eb,
4448 ep = ej & ee,
4449 eo = ed(ej & ec, ((ei & ec) >> 8) * el),
4450 ek = ed(ej & eb, ((ei & eb) >> 8) * el),
4451 em = ed(ej & ee, (ei & ee) * el >> 8);
4452 return ed(((ej & ef) >>> 24) + el, 255) << 24 | eh + ((eo - eh) * el >> 8) & ec | en + ((ek - en) * el >> 8) & eb | ep + ((em - ep) * el >> 8) & ee
4453 },
4454 difference: function(el, ek) {
4455 var en = (ek & ef) >>> 24,
4456 ej = (el & ec) >> 16,
4457 eq = (el & eb) >> 8,
4458 es = el & ee,
4459 er = (ek & ec) >> 16,
4460 em = (ek & eb) >> 8,
4461 ep = ek & ee,
4462 eo = ej > er ? ej - er : er - ej,
4463 eh = eq > em ? eq - em : em - eq,
4464 ei = es > ep ? es - ep : ep - es;
4465 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4466 },
4467 exclusion: function(el, ek) {
4468 var en = (ek & ef) >>> 24,
4469 ej = (el & ec) >> 16,
4470 eq = (el & eb) >> 8,
4471 es = el & ee,
4472 er = (ek & ec) >> 16,
4473 em = (ek & eb) >> 8,
4474 ep = ek & ee,
4475 eo = ej + er - (ej * er >> 7),
4476 eh = eq + em - (eq * em >> 7),
4477 ei = es + ep - (es * ep >> 7);
4478 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4479 },
4480 multiply: function(el, ek) {
4481 var en = (ek & ef) >>> 24,
4482 ej = (el & ec) >> 16,
4483 eq = (el & eb) >> 8,
4484 es = el & ee,
4485 er = (ek & ec) >> 16,
4486 em = (ek & eb) >> 8,
4487 ep = ek & ee,
4488 eo = ej * er >> 8,
4489 eh = eq * em >> 8,
4490 ei = es * ep >> 8;
4491 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4492 },
4493 screen: function(el, ek) {
4494 var en = (ek & ef) >>> 24,
4495 ej = (el & ec) >> 16,
4496 eq = (el & eb) >> 8,
4497 es = el & ee,
4498 er = (ek & ec) >> 16,
4499 em = (ek & eb) >> 8,
4500 ep = ek & ee,
4501 eo = 255 - ((255 - ej) * (255 - er) >> 8),
4502 eh = 255 - ((255 - eq) * (255 - em) >> 8),
4503 ei = 255 - ((255 - es) * (255 - ep) >> 8);
4504 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4505 },
4506 hard_light: function(el, ek) {
4507 var en = (ek & ef) >>> 24,
4508 ej = (el & ec) >> 16,
4509 eq = (el & eb) >> 8,
4510 es = el & ee,
4511 er = (ek & ec) >> 16,
4512 em = (ek & eb) >> 8,
4513 ep = ek & ee,
4514 eo = er < 128 ? ej * er >> 7 : 255 - ((255 - ej) * (255 - er) >> 7),
4515 eh = em < 128 ? eq * em >> 7 : 255 - ((255 - eq) * (255 - em) >> 7),
4516 ei = ep < 128 ? es * ep >> 7 : 255 - ((255 - es) * (255 - ep) >> 7);
4517 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4518 },
4519 soft_light: function(el, ek) {
4520 var en = (ek & ef) >>> 24,
4521 ej = (el & ec) >> 16,
4522 eq = (el & eb) >> 8,
4523 es = el & ee,
4524 er = (ek & ec) >> 16,
4525 em = (ek & eb) >> 8,
4526 ep = ek & ee,
4527 eo = (ej * er >> 7) + (ej * ej >> 8) - (ej * ej * er >> 15),
4528 eh = (eq * em >> 7) + (eq * eq >> 8) - (eq * eq * em >> 15),
4529 ei = (es * ep >> 7) + (es * es >> 8) - (es * es * ep >> 15);
4530 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4531 },
4532 overlay: function(el, ek) {
4533 var en = (ek & ef) >>> 24,
4534 ej = (el & ec) >> 16,
4535 eq = (el & eb) >> 8,
4536 es = el & ee,
4537 er = (ek & ec) >> 16,
4538 em = (ek & eb) >> 8,
4539 ep = ek & ee,
4540 eo = ej < 128 ? ej * er >> 7 : 255 - ((255 - ej) * (255 - er) >> 7),
4541 eh = eq < 128 ? eq * em >> 7 : 255 - ((255 - eq) * (255 - em) >> 7),
4542 ei = es < 128 ? es * ep >> 7 : 255 - ((255 - es) * (255 - ep) >> 7);
4543 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4544 },
4545 dodge: function(el, ek) {
4546 var en = (ek & ef) >>> 24,
4547 ej = (el & ec) >> 16,
4548 eq = (el & eb) >> 8,
4549 es = el & ee,
4550 er = (ek & ec) >> 16,
4551 em = (ek & eb) >> 8,
4552 ep = ek & ee;
4553 var eo = 255;
4554 if (er !== 255) {
4555 eo = (ej << 8) / (255 - er);
4556 eo = eo < 0 ? 0 : eo > 255 ? 255 : eo
4557 }
4558 var eh = 255;
4559 if (em !== 255) {
4560 eh = (eq << 8) / (255 - em);
4561 eh = eh < 0 ? 0 : eh > 255 ? 255 : eh
4562 }
4563 var ei = 255;
4564 if (ep !== 255) {
4565 ei = (es << 8) / (255 - ep);
4566 ei = ei < 0 ? 0 : ei > 255 ? 255 : ei
4567 }
4568 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4569 },
4570 burn: function(el, ek) {
4571 var en = (ek & ef) >>> 24,
4572 ej = (el & ec) >> 16,
4573 eq = (el & eb) >> 8,
4574 es = el & ee,
4575 er = (ek & ec) >> 16,
4576 em = (ek & eb) >> 8,
4577 ep = ek & ee;
4578 var eo = 0;
4579 if (er !== 0) {
4580 eo = (255 - ej << 8) / er;
4581 eo = 255 - (eo < 0 ? 0 : eo > 255 ? 255 : eo)
4582 }
4583 var eh = 0;
4584 if (em !== 0) {
4585 eh = (255 - eq << 8) / em;
4586 eh = 255 - (eh < 0 ? 0 : eh > 255 ? 255 : eh)
4587 }
4588 var ei = 0;
4589 if (ep !== 0) {
4590 ei = (255 - es << 8) / ep;
4591 ei = 255 - (ei < 0 ? 0 : ei > 255 ? 255 : ei)
4592 }
4593 return eg(el, en, ej, eq, es, er, em, ep, eo, eh, ei)
4594 }
4595 }
4596 }();
4597
4598 function dH(ef, ee, ec, eb) {
4599 var ea, ed, eh, ei;
4600 if (cY === 3) {
4601 var eg = cW.color.toRGB(ef, ee, ec);
4602 ea = eg[0];
4603 ed = eg[1];
4604 eh = eg[2]
4605 } else {
4606 ea = q.round(255 * (ef / bJ));
4607 ed = q.round(255 * (ee / bI));
4608 eh = q.round(255 * (ec / bG))
4609 }
4610 ei = q.round(255 * (eb / bU));
4611 ea = ea < 0 ? 0 : ea;
4612 ed = ed < 0 ? 0 : ed;
4613 eh = eh < 0 ? 0 : eh;
4614 ei = ei < 0 ? 0 : ei;
4615 ea = ea > 255 ? 255 : ea;
4616 ed = ed > 255 ? 255 : ed;
4617 eh = eh > 255 ? 255 : eh;
4618 ei = ei > 255 ? 255 : ei;
4619 return ei << 24 & 4278190080 | ea << 16 & 16711680 | ed << 8 & 65280 | eh & 255
4620 }
4621
4622 function dK(ea, ec) {
4623 var eb;
4624 if (ea & 4278190080) {
4625 eb = q.round(255 * (ec / bU));
4626 eb = eb > 255 ? 255 : eb;
4627 eb = eb < 0 ? 0 : eb;
4628 return ea - (ea & 4278190080) + (eb << 24 & 4278190080)
4629 }
4630 if (cY === 1) {
4631 return dH(ea, ea, ea, ec)
4632 }
4633 if (cY === 3) {
4634 return dH(0, 0, ea / bJ * bG, ec)
4635 }
4636 }
4637
4638 function dM(ea) {
4639 if (ea <= bJ && ea >= 0) {
4640 if (cY === 1) {
4641 return dH(ea, ea, ea, bU)
4642 }
4643 if (cY === 3) {
4644 return dH(0, 0, ea / bJ * bG, bU)
4645 }
4646 }
4647 if (ea) {
4648 if (ea > 2147483647) {
4649 ea -= 4294967296
4650 }
4651 return ea
4652 }
4653 }
4654 cW.color = function(ea, ed, ec, eb) {
4655 if (ea !== t && ed !== t && ec !== t && eb !== t) {
4656 return dH(ea, ed, ec, eb)
4657 }
4658 if (ea !== t && ed !== t && ec !== t) {
4659 return dH(ea, ed, ec, bU)
4660 }
4661 if (ea !== t && ed !== t) {
4662 return dK(ea, ed)
4663 }
4664 if (typeof ea === "number") {
4665 return dM(ea)
4666 }
4667 return dH(bJ, bI, bG, bU)
4668 };
4669 cW.color.toString = function(ea) {
4670 return "rgba(" + ((ea >> 16) & 255) + "," + ((ea >> 8) & 255) + "," + (ea & 255) + "," + ((ea >> 24) & 255) / 255 + ")"
4671 };
4672 cW.color.toInt = function(ed, ec, ea, eb) {
4673 return eb << 24 & 4278190080 | ed << 16 & 16711680 | ec << 8 & 65280 | ea & 255
4674 };
4675 cW.color.toArray = function(ea) {
4676 return [(ea >> 16) & 255, (ea >> 8) & 255, ea & 255, (ea >> 24) & 255]
4677 };
4678 cW.color.toGLArray = function(ea) {
4679 return [((ea & 16711680) >>> 16) / 255, ((ea >> 8) & 255) / 255, (ea & 255) / 255, ((ea >> 24) & 255) / 255]
4680 };
4681 cW.color.toRGB = function(ec, ei, ef) {
4682 ec = ec > bJ ? bJ : ec;
4683 ei = ei > bI ? bI : ei;
4684 ef = ef > bG ? bG : ef;
4685 ec = ec / bJ * 360;
4686 ei = ei / bI * 100;
4687 ef = ef / bG * 100;
4688 var eh = q.round(ef / 100 * 255);
4689 if (ei === 0) {
4690 return [eh, eh, eh]
4691 }
4692 var ed = ec % 360;
4693 var ee = ed % 60;
4694 var eb = q.round(ef * (100 - ei) / 10000 * 255);
4695 var ea = q.round(ef * (6000 - ei * ee) / 600000 * 255);
4696 var eg = q.round(ef * (6000 - ei * (60 - ee)) / 600000 * 255);
4697 switch (q.floor(ed / 60)) {
4698 case 0:
4699 return [eh, eg, eb];
4700 case 1:
4701 return [ea, eh, eb];
4702 case 2:
4703 return [eb, eh, eg];
4704 case 3:
4705 return [eb, ea, eh];
4706 case 4:
4707 return [eg, eb, eh];
4708 case 5:
4709 return [eh, eb, ea]
4710 }
4711 };
4712
4713 function aS(eh) {
4714 var eg, ef, eb;
4715 eg = ((eh >> 16) & 255) / 255;
4716 ef = ((eh >> 8) & 255) / 255;
4717 eb = (eh & 255) / 255;
4718 var ea = cW.max(cW.max(eg, ef), eb),
4719 ed = cW.min(cW.min(eg, ef), eb),
4720 ec, ee;
4721 if (ed === ea) {
4722 return [0, 0, ea * bG]
4723 }
4724 ee = (ea - ed) / ea;
4725 if (eg === ea) {
4726 ec = (ef - eb) / (ea - ed)
4727 } else {
4728 if (ef === ea) {
4729 ec = 2 + (eb - eg) / (ea - ed)
4730 } else {
4731 ec = 4 + (eg - ef) / (ea - ed)
4732 }
4733 }
4734 ec /= 6;
4735 if (ec < 0) {
4736 ec += 1
4737 } else {
4738 if (ec > 1) {
4739 ec -= 1
4740 }
4741 }
4742 return [ec * bJ, ee * bI, ea * bG]
4743 }
4744 cW.brightness = function(ea) {
4745 return aS(ea)[2]
4746 };
4747 cW.saturation = function(ea) {
4748 return aS(ea)[1]
4749 };
4750 cW.hue = function(ea) {
4751 return aS(ea)[0]
4752 };
4753 cW.red = function(ea) {
4754 return ((ea >> 16) & 255) / 255 * bJ
4755 };
4756 cW.green = function(ea) {
4757 return ((ea & 65280) >>> 8) / 255 * bI
4758 };
4759 cW.blue = function(ea) {
4760 return (ea & 255) / 255 * bG
4761 };
4762 cW.alpha = function(ea) {
4763 return ((ea >> 24) & 255) / 255 * bU
4764 };
4765 cW.lerpColor = function(em, el, ef) {
4766 var ek, eq, er, es, eo, ea, eg, eu, en, ev, ee, et;
4767 var ei, eh, eb, ep, ej;
4768 var ed = cW.color(em);
4769 var ec = cW.color(el);
4770 if (cY === 3) {
4771 ei = aS(ed);
4772 eu = ((ed >> 24) & 255) / bU;
4773 eh = aS(ec);
4774 et = ((ec & 4278190080) >>> 24) / bU;
4775 ep = cW.lerp(ei[0], eh[0], ef);
4776 ej = cW.lerp(ei[1], eh[1], ef);
4777 er = cW.lerp(ei[2], eh[2], ef);
4778 eb = cW.color.toRGB(ep, ej, er);
4779 es = cW.lerp(eu, et, ef) * bU;
4780 return es << 24 & 4278190080 | (eb[0] & 255) << 16 | (eb[1] & 255) << 8 | eb[2] & 255
4781 }
4782 eo = (ed >> 16) & 255;
4783 ea = (ed >> 8) & 255;
4784 eg = ed & 255;
4785 eu = ((ed >> 24) & 255) / bU;
4786 en = (ec & 16711680) >>> 16;
4787 ev = (ec >> 8) & 255;
4788 ee = ec & 255;
4789 et = ((ec >> 24) & 255) / bU;
4790 ek = cW.lerp(eo, en, ef) | 0;
4791 eq = cW.lerp(ea, ev, ef) | 0;
4792 er = cW.lerp(eg, ee, ef) | 0;
4793 es = cW.lerp(eu, et, ef) * bU;
4794 return es << 24 & 4278190080 | ek << 16 & 16711680 | eq << 8 & 65280 | er & 255
4795 };
4796 cW.colorMode = function() {
4797 cY = arguments[0];
4798 if (arguments.length > 1) {
4799 bJ = arguments[1];
4800 bI = arguments[2] || arguments[1];
4801 bG = arguments[3] || arguments[1];
4802 bU = arguments[4] || arguments[1]
4803 }
4804 };
4805 cW.blendColor = function(eb, ea, ec) {
4806 if (ec === 0) {
4807 return cW.modes.replace(eb, ea)
4808 } else {
4809 if (ec === 1) {
4810 return cW.modes.blend(eb, ea)
4811 } else {
4812 if (ec === 2) {
4813 return cW.modes.add(eb, ea)
4814 } else {
4815 if (ec === 4) {
4816 return cW.modes.subtract(eb, ea)
4817 } else {
4818 if (ec === 8) {
4819 return cW.modes.lightest(eb, ea)
4820 } else {
4821 if (ec === 16) {
4822 return cW.modes.darkest(eb, ea)
4823 } else {
4824 if (ec === 32) {
4825 return cW.modes.difference(eb, ea)
4826 } else {
4827 if (ec === 64) {
4828 return cW.modes.exclusion(eb, ea)
4829 } else {
4830 if (ec === 128) {
4831 return cW.modes.multiply(eb, ea)
4832 } else {
4833 if (ec === 256) {
4834 return cW.modes.screen(eb, ea)
4835 } else {
4836 if (ec === 1024) {
4837 return cW.modes.hard_light(eb, ea)
4838 } else {
4839 if (ec === 2048) {
4840 return cW.modes.soft_light(eb, ea)
4841 } else {
4842 if (ec === 512) {
4843 return cW.modes.overlay(eb, ea)
4844 } else {
4845 if (ec === 4096) {
4846 return cW.modes.dodge(eb, ea)
4847 } else {
4848 if (ec === 8192) {
4849 return cW.modes.burn(eb, ea)
4850 }
4851 }
4852 }
4853 }
4854 }
4855 }
4856 }
4857 }
4858 }
4859 }
4860 }
4861 }
4862 }
4863 }
4864 }
4865 };
4866
4867 function aD() {
4868 d8.save()
4869 }
4870
4871 function cP() {
4872 d8.restore();
4873 b3 = true;
4874 aq = true
4875 }
4876 cW.printMatrix = function() {
4877 dJ.print()
4878 };
4879 bR.prototype.translate = function(ea, eb) {
4880 dJ.translate(ea, eb);
4881 aT.invTranslate(ea, eb);
4882 d8.translate(ea, eb)
4883 };
4884 bB.prototype.translate = function(ea, ec, eb) {
4885 dJ.translate(ea, ec, eb);
4886 aT.invTranslate(ea, ec, eb)
4887 };
4888 bR.prototype.scale = function(ea, eb) {
4889 dJ.scale(ea, eb);
4890 aT.invScale(ea, eb);
4891 d8.scale(ea, eb || ea)
4892 };
4893 bB.prototype.scale = function(ea, ec, eb) {
4894 dJ.scale(ea, ec, eb);
4895 aT.invScale(ea, ec, eb)
4896 };
4897 bR.prototype.transform = function(eb) {
4898 var ea = eb.array();
4899 d8.transform(ea[0], ea[3], ea[1], ea[4], ea[2], ea[5])
4900 };
4901 bB.prototype.transformm = function(ea) {
4902 throw "p.transform is currently not supported in 3D mode"
4903 };
4904 bR.prototype.pushMatrix = function() {
4905 am.load(dJ);
4906 da.load(aT);
4907 aD()
4908 };
4909 bB.prototype.pushMatrix = function() {
4910 am.load(dJ);
4911 da.load(aT)
4912 };
4913 bR.prototype.popMatrix = function() {
4914 dJ.set(am.pop());
4915 aT.set(da.pop());
4916 cP()
4917 };
4918 bB.prototype.popMatrix = function() {
4919 dJ.set(am.pop());
4920 aT.set(da.pop())
4921 };
4922 bR.prototype.resetMatrix = function() {
4923 dJ.reset();
4924 aT.reset();
4925 d8.setTransform(1, 0, 0, 1, 0, 0)
4926 };
4927 bB.prototype.resetMatrix = function() {
4928 dJ.reset();
4929 aT.reset()
4930 };
4931 ds.prototype.applyMatrix = function() {
4932 var ea = arguments;
4933 dJ.apply(ea[0], ea[1], ea[2], ea[3], ea[4], ea[5], ea[6], ea[7], ea[8], ea[9], ea[10], ea[11], ea[12], ea[13], ea[14], ea[15]);
4934 aT.invApply(ea[0], ea[1], ea[2], ea[3], ea[4], ea[5], ea[6], ea[7], ea[8], ea[9], ea[10], ea[11], ea[12], ea[13], ea[14], ea[15])
4935 };
4936 bR.prototype.applyMatrix = function() {
4937 var ea = arguments;
4938 for (var eb = ea.length; eb < 16; eb++) {
4939 ea[eb] = 0
4940 }
4941 ea[10] = ea[15] = 1;
4942 ds.prototype.applyMatrix.apply(this, ea)
4943 };
4944 cW.rotateX = function(ea) {
4945 dJ.rotateX(ea);
4946 aT.invRotateX(ea)
4947 };
4948 bR.prototype.rotateZ = function() {
4949 throw "rotateZ() is not supported in 2D mode. Use rotate(float) instead."
4950 };
4951 bB.prototype.rotateZ = function(ea) {
4952 dJ.rotateZ(ea);
4953 aT.invRotateZ(ea)
4954 };
4955 cW.rotateY = function(ea) {
4956 dJ.rotateY(ea);
4957 aT.invRotateY(ea)
4958 };
4959 bR.prototype.rotate = function(ea) {
4960 dJ.rotateZ(ea);
4961 aT.invRotateZ(ea);
4962 d8.rotate(ea)
4963 };
4964 bB.prototype.rotate = function(ea) {
4965 cW.rotateZ(ea)
4966 };
4967 bR.prototype.shearX = function(ea) {
4968 dJ.shearX(ea);
4969 d8.transform(1, 0, ea, 1, 0, 0)
4970 };
4971 bB.prototype.shearX = function(ea) {
4972 dJ.shearX(ea)
4973 };
4974 bR.prototype.shearY = function(ea) {
4975 dJ.shearY(ea);
4976 d8.transform(1, ea, 0, 1, 0, 0)
4977 };
4978 bB.prototype.shearY = function(ea) {
4979 dJ.shearY(ea)
4980 };
4981 cW.pushStyle = function() {
4982 aD();
4983 cW.pushMatrix();
4984 var ea = {
4985 doFill: aH,
4986 currentFillColor: a1,
4987 doStroke: ce,
4988 currentStrokeColor: cv,
4989 curTint: bf,
4990 curRectMode: bK,
4991 curColorMode: cY,
4992 colorModeX: bJ,
4993 colorModeZ: bG,
4994 colorModeY: bI,
4995 colorModeA: bU,
4996 curTextFont: W,
4997 horizontalTextAlignment: N,
4998 verticalTextAlignment: c1,
4999 textMode: cI,
5000 curFontName: Y,
5001 curTextSize: d0,
5002 curTextAscent: a3,
5003 curTextDescent: dA,
5004 curTextLeading: d7
5005 };
5006 bm.push(ea)
5007 };
5008 cW.popStyle = function() {
5009 var ea = bm.pop();
5010 if (ea) {
5011 cP();
5012 cW.popMatrix();
5013 aH = ea.doFill;
5014 a1 = ea.currentFillColor;
5015 ce = ea.doStroke;
5016 cv = ea.currentStrokeColor;
5017 bf = ea.curTint;
5018 bK = ea.curRectMode;
5019 cY = ea.curColorMode;
5020 bJ = ea.colorModeX;
5021 bG = ea.colorModeZ;
5022 bI = ea.colorModeY;
5023 bU = ea.colorModeA;
5024 W = ea.curTextFont;
5025 Y = ea.curFontName;
5026 d0 = ea.curTextSize;
5027 N = ea.horizontalTextAlignment;
5028 c1 = ea.verticalTextAlignment;
5029 cI = ea.textMode;
5030 a3 = ea.curTextAscent;
5031 dA = ea.curTextDescent;
5032 d7 = ea.curTextLeading
5033 } else {
5034 throw "Too many popStyle() without enough pushStyle()"
5035 }
5036 };
5037 cW.year = function() {
5038 return (new Date).getFullYear()
5039 };
5040 cW.month = function() {
5041 return (new Date).getMonth() + 1
5042 };
5043 cW.day = function() {
5044 return (new Date).getDate()
5045 };
5046 cW.hour = function() {
5047 return (new Date).getHours()
5048 };
5049 cW.minute = function() {
5050 return (new Date).getMinutes()
5051 };
5052 cW.second = function() {
5053 return (new Date).getSeconds()
5054 };
5055 cW.millis = function() {
5056 return Date.now() - dq
5057 };
5058
5059 function ct() {
5060 var ea = (Date.now() - dt) / 1000;
5061 P++;
5062 var eb = P / ea;
5063 if (ea > 0.5) {
5064 dt = Date.now();
5065 P = 0;
5066 cW.__frameRate = eb
5067 }
5068 cW.frameCount++
5069 }
5070 bR.prototype.redraw = function() {
5071 ct();
5072 d8.lineWidth = dW;
5073 var ea = cW.pmouseX,
5074 eb = cW.pmouseY;
5075 cW.pmouseX = dN;
5076 cW.pmouseY = d5;
5077 aD();
5078 cW.draw();
5079 cP();
5080 dN = cW.mouseX;
5081 d5 = cW.mouseY;
5082 cW.pmouseX = ea;
5083 cW.pmouseY = eb
5084 };
5085 bB.prototype.redraw = function() {
5086 ct();
5087 var ea = cW.pmouseX,
5088 eb = cW.pmouseY;
5089 cW.pmouseX = dN;
5090 cW.pmouseY = d5;
5091 d8.clear(d8.DEPTH_BUFFER_BIT);
5092 dC = {
5093 attributes: {},
5094 locations: {}
5095 };
5096 cW.noLights();
5097 cW.lightFalloff(1, 0, 0);
5098 cW.shininess(1);
5099 cW.ambient(255, 255, 255);
5100 cW.specular(0, 0, 0);
5101 cW.emissive(0, 0, 0);
5102 cW.camera();
5103 cW.draw();
5104 dN = cW.mouseX;
5105 d5 = cW.mouseY;
5106 cW.pmouseX = ea;
5107 cW.pmouseY = eb
5108 };
5109 cW.noLoop = function() {
5110 aC = false;
5111 ax = false;
5112 clearInterval(b4);
5113 cQ.onPause()
5114 };
5115 cW.loop = function() {
5116 if (ax) {
5117 return
5118 }
5119 dt = Date.now();
5120 P = 0;
5121 b4 = D.setInterval(function() {
5122 try {
5123 cQ.onFrameStart();
5124 cW.redraw();
5125 cQ.onFrameEnd()
5126 } catch (ea) {
5127 D.clearInterval(b4);
5128 throw ea
5129 }
5130 }, az);
5131 aC = true;
5132 ax = true;
5133 cQ.onLoop()
5134 };
5135 cW.frameRate = function(ea) {
5136 dU = ea;
5137 az = 1000 / dU;
5138 if (aC) {
5139 cW.noLoop();
5140 cW.loop()
5141 }
5142 };
5143 var au = [];
5144
5145 function bO(ec, eb, ea) {
5146 if (ec.addEventListener) {
5147 ec.addEventListener(eb, ea, false)
5148 } else {
5149 ec.attachEvent("on" + eb, ea)
5150 }
5151 au.push({
5152 elem: ec,
5153 type: eb,
5154 fn: ea
5155 })
5156 }
5157
5158 function de(ea) {
5159 var ed = ea.elem,
5160 ec = ea.type,
5161 eb = ea.fn;
5162 if (ed.removeEventListener) {
5163 ed.removeEventListener(ec, eb, false)
5164 } else {
5165 if (ed.detachEvent) {
5166 ed.detachEvent("on" + ec, eb)
5167 }
5168 }
5169 }
5170 cW.exit = function() {
5171 D.clearInterval(b4);
5172 L(cW.externals.canvas.id);
5173 delete ae.onmousedown;
5174 for (var eb in F.lib) {
5175 if (F.lib.hasOwnProperty(eb)) {
5176 if (F.lib[eb].hasOwnProperty("detach")) {
5177 F.lib[eb].detach(cW)
5178 }
5179 }
5180 }
5181 var ea = au.length;
5182 while (ea--) {
5183 de(au[ea])
5184 }
5185 cQ.onExit()
5186 };
5187 cW.cursor = function() {
5188 if (arguments.length > 1 || arguments.length === 1 && arguments[0] instanceof cW.PImage) {
5189 var ed = arguments[0],
5190 ea, ef;
5191 if (arguments.length >= 3) {
5192 ea = arguments[1];
5193 ef = arguments[2];
5194 if (ea < 0 || ef < 0 || ef >= ed.height || ea >= ed.width) {
5195 throw "x and y must be non-negative and less than the dimensions of the image"
5196 }
5197 } else {
5198 ea = ed.width >>> 1;
5199 ef = ed.height >>> 1
5200 }
5201 var eb = ed.toDataURL();
5202 var ec = 'url("' + eb + '") ' + ea + " " + ef + ", default";
5203 Z = ae.style.cursor = ec
5204 } else {
5205 if (arguments.length === 1) {
5206 var ee = arguments[0];
5207 Z = ae.style.cursor = ee
5208 } else {
5209 Z = ae.style.cursor = ck
5210 }
5211 }
5212 };
5213 cW.noCursor = function() {
5214 Z = ae.style.cursor = B.NOCURSOR
5215 };
5216 cW.link = function(ea, eb) {
5217 if (eb !== t) {
5218 D.open(ea, eb)
5219 } else {
5220 D.location = ea
5221 }
5222 };
5223 cW.beginDraw = G;
5224 cW.endDraw = G;
5225 bR.prototype.toImageData = function(ea, ed, eb, ec) {
5226 ea = ea !== t ? ea : 0;
5227 ed = ed !== t ? ed : 0;
5228 eb = eb !== t ? eb : cW.width;
5229 ec = ec !== t ? ec : cW.height;
5230 return d8.getImageData(ea, ed, eb, ec)
5231 };
5232 bB.prototype.toImageData = function(ei, eh, ej, ee) {
5233 ei = ei !== t ? ei : 0;
5234 eh = eh !== t ? eh : 0;
5235 ej = ej !== t ? ej : cW.width;
5236 ee = ee !== t ? ee : cW.height;
5237 var eg = d.createElement("canvas"),
5238 ek = eg.getContext("2d"),
5239 ed = ek.createImageData(ej, ee),
5240 eb = new b(ej * ee * 4);
5241 d8.readPixels(ei, eh, ej, ee, d8.RGBA, d8.UNSIGNED_BYTE, eb);
5242 for (var ec = 0, ef = eb.length, ea = ed.data; ec < ef; ec++) {
5243 ea[ec] = eb[(ee - 1 - q.floor(ec / 4 / ej)) * ej * 4 + ec % (ej * 4)]
5244 }
5245 return ed
5246 };
5247 cW.status = function(ea) {
5248 D.status = ea
5249 };
5250 cW.binary = function(eb, ec) {
5251 var ed;
5252 if (ec > 0) {
5253 ed = ec
5254 } else {
5255 if (eb instanceof bP) {
5256 ed = 16;
5257 eb |= 0
5258 } else {
5259 ed = 32;
5260 while (ed > 1 && !(eb >>> ed - 1 & 1)) {
5261 ed--
5262 }
5263 }
5264 }
5265 var ea = "";
5266 while (ed > 0) {
5267 ea += eb >>> --ed & 1 ? "1" : "0"
5268 }
5269 return ea
5270 };
5271 cW.unbinary = function(eb) {
5272 var ed = eb.length - 1,
5273 ec = 1,
5274 ea = 0;
5275 while (ed >= 0) {
5276 var ee = eb[ed--];
5277 if (ee !== "0" && ee !== "1") {
5278 throw "the value passed into unbinary was not an 8 bit binary number"
5279 }
5280 if (ee === "1") {
5281 ea += ec
5282 }
5283 ec <<= 1
5284 }
5285 return ea
5286 };
5287
5288 function cX(em, ek, ee, ep, eg, en) {
5289 var ec = em < 0 ? ee : ek;
5290 var eb = eg === 0;
5291 var el = eg === t || eg < 0 ? 0 : eg;
5292 var ej = q.abs(em);
5293 if (eb) {
5294 el = 1;
5295 ej *= 10;
5296 while (q.abs(q.round(ej) - ej) > 0.000001 && el < 7) {
5297 ++el;
5298 ej *= 10
5299 }
5300 } else {
5301 if (el !== 0) {
5302 ej *= q.pow(10, el)
5303 }
5304 }
5305 var ed, ei = ej * 2;
5306 if (q.floor(ej) === ej) {
5307 ed = ej
5308 } else {
5309 if (q.floor(ei) === ei) {
5310 var ea = q.floor(ej);
5311 ed = ea + ea % 2
5312 } else {
5313 ed = q.round(ej)
5314 }
5315 }
5316 var ef = "";
5317 var eo = ep + el;
5318 while (eo > 0 || ed > 0) {
5319 eo--;
5320 ef = "" + ed % 10 + ef;
5321 ed = q.floor(ed / 10)
5322 }
5323 if (en !== t) {
5324 var eh = ef.length - 3 - el;
5325 while (eh > 0) {
5326 ef = ef.substring(0, eh) + en + ef.substring(eh);
5327 eh -= 3
5328 }
5329 }
5330 if (el > 0) {
5331 return ec + ef.substring(0, ef.length - el) + "." + ef.substring(ef.length - el, ef.length)
5332 }
5333 return ec + ef
5334 }
5335
5336 function ao(eg, ef, ea, ei, eb, eh) {
5337 if (eg instanceof Array) {
5338 var ed = [];
5339 for (var ec = 0, ee = eg.length; ec < ee; ec++) {
5340 ed.push(cX(eg[ec], ef, ea, ei, eb, eh))
5341 }
5342 return ed
5343 }
5344 return cX(eg, ef, ea, ei, eb, eh)
5345 }
5346 cW.nf = function(ec, ea, eb) {
5347 return ao(ec, "", "-", ea, eb)
5348 };
5349 cW.nfs = function(ec, ea, eb) {
5350 return ao(ec, " ", "-", ea, eb)
5351 };
5352 cW.nfp = function(ec, ea, eb) {
5353 return ao(ec, "+", "-", ea, eb)
5354 };
5355 cW.nfc = function(ec, ea, eb) {
5356 return ao(ec, "", "-", ea, eb, ",")
5357 };
5358 var aM = function(ec, eb) {
5359 eb = eb === t || eb === null ? eb = 8 : eb;
5360 if (ec < 0) {
5361 ec = 4294967295 + ec + 1
5362 }
5363 var ea = Number(ec).toString(16).toUpperCase();
5364 while (ea.length < eb) {
5365 ea = "0" + ea
5366 }
5367 if (ea.length >= eb) {
5368 ea = ea.substring(ea.length - eb, ea.length)
5369 }
5370 return ea
5371 };
5372 cW.hex = function(eb, ea) {
5373 if (arguments.length === 1) {
5374 if (eb instanceof bP) {
5375 ea = 4
5376 } else {
5377 ea = 8
5378 }
5379 }
5380 return aM(eb, ea)
5381 };
5382
5383 function dF(ea) {
5384 var eb = parseInt("0x" + ea, 16);
5385 if (eb > 2147483647) {
5386 eb -= 4294967296
5387 }
5388 return eb
5389 }
5390 cW.unhex = function(ec) {
5391 if (ec instanceof Array) {
5392 var ea = [];
5393 for (var eb = 0; eb < ec.length; eb++) {
5394 ea.push(dF(ec[eb]))
5395 }
5396 return ea
5397 }
5398 return dF(ec)
5399 };
5400 cW.loadStrings = function(eb) {
5401 if (localStorage[eb]) {
5402 return localStorage[eb].split("\n")
5403 }
5404 var ea = w(eb);
5405 if (typeof ea !== "string" || ea === "") {
5406 return []
5407 }
5408 ea = ea.replace(/(\r\n?)/g, "\n").replace(/\n$/, "");
5409 return ea.split("\n")
5410 };
5411 cW.saveStrings = function(eb, ea) {
5412 localStorage[eb] = ea.join("\n")
5413 };
5414 cW.loadBytes = function(ec) {
5415 var eb = w(ec);
5416 var ea = [];
5417 for (var ed = 0; ed < eb.length; ed++) {
5418 ea.push(eb.charCodeAt(ed))
5419 }
5420 return ea
5421 };
5422
5423 function bc(ea) {
5424 return Array.prototype.slice.call(ea, 1)
5425 }
5426 cW.matchAll = function(eb, ea) {
5427 var ed = [],
5428 ec;
5429 var ee = new RegExp(ea, "g");
5430 while ((ec = ee.exec(eb)) !== null) {
5431 ed.push(ec);
5432 if (ec[0].length === 0) {
5433 ++ee.lastIndex
5434 }
5435 }
5436 return ed.length > 0 ? ed : null
5437 };
5438 cW.__contains = function(eb, ea) {
5439 if (typeof eb !== "string") {
5440 return eb.contains.apply(eb, bc(arguments))
5441 }
5442 return eb !== null && ea !== null && typeof ea === "string" && eb.indexOf(ea) > -1
5443 };
5444 cW.__replaceAll = function(ea, ec, eb) {
5445 if (typeof ea !== "string") {
5446 return ea.replaceAll.apply(ea, bc(arguments))
5447 }
5448 return ea.replace(new RegExp(ec, "g"), eb)
5449 };
5450 cW.__replaceFirst = function(ea, ec, eb) {
5451 if (typeof ea !== "string") {
5452 return ea.replaceFirst.apply(ea, bc(arguments))
5453 }
5454 return ea.replace(new RegExp(ec, ""), eb)
5455 };
5456 cW.__replace = function(ed, ef, ee) {
5457 if (typeof ed !== "string") {
5458 return ed.replace.apply(ed, bc(arguments))
5459 }
5460 if (ef instanceof RegExp) {
5461 return ed.replace(ef, ee)
5462 }
5463 if (typeof ef !== "string") {
5464 ef = ef.toString()
5465 }
5466 if (ef === "") {
5467 return ed
5468 }
5469 var ec = ed.indexOf(ef);
5470 if (ec < 0) {
5471 return ed
5472 }
5473 var eb = 0,
5474 ea = "";
5475 do {
5476 ea += ed.substring(eb, ec) + ee;
5477 eb = ec + ef.length
5478 } while ((ec = ed.indexOf(ef, eb)) >= 0);
5479 return ea + ed.substring(eb)
5480 };
5481 cW.__equals = function(eb, ea) {
5482 if (eb.equals instanceof Function) {
5483 return eb.equals.apply(eb, bc(arguments))
5484 }
5485 return eb.valueOf() === ea.valueOf()
5486 };
5487 cW.__equalsIgnoreCase = function(eb, ea) {
5488 if (typeof eb !== "string") {
5489 return eb.equalsIgnoreCase.apply(eb, bc(arguments))
5490 }
5491 return eb.toLowerCase() === ea.toLowerCase()
5492 };
5493 cW.__toCharArray = function(ec) {
5494 if (typeof ec !== "string") {
5495 return ec.toCharArray.apply(ec, bc(arguments))
5496 }
5497 var ed = [];
5498 for (var eb = 0, ea = ec.length; eb < ea; ++eb) {
5499 ed[eb] = new bP(ec.charAt(eb))
5500 }
5501 return ed
5502 };
5503 cW.__split = function(ed, ee, eb) {
5504 if (typeof ed !== "string") {
5505 return ed.split.apply(ed, bc(arguments))
5506 }
5507 var eg = new RegExp(ee);
5508 if (eb === t || eb < 1) {
5509 return ed.split(eg)
5510 }
5511 var ea = [],
5512 ef = ed,
5513 eh;
5514 while ((eh = ef.search(eg)) !== -1 && ea.length < eb - 1) {
5515 var ec = eg.exec(ef).toString();
5516 ea.push(ef.substring(0, eh));
5517 ef = ef.substring(eh + ec.length)
5518 }
5519 if (eh !== -1 || ef !== "") {
5520 ea.push(ef)
5521 }
5522 return ea
5523 };
5524 cW.__codePointAt = function(ed, eb) {
5525 var ee = ed.charCodeAt(eb),
5526 ec, ea;
5527 if (55296 <= ee && ee <= 56319) {
5528 ec = ee;
5529 ea = ed.charCodeAt(eb + 1);
5530 return (ec - 55296) * 1024 + (ea - 56320) + 65536
5531 }
5532 return ee
5533 };
5534 cW.match = function(eb, ea) {
5535 return eb.match(ea)
5536 };
5537 cW.__matches = function(eb, ea) {
5538 return (new RegExp(ea)).test(eb)
5539 };
5540 cW.__startsWith = function(ea, ec, eb) {
5541 if (typeof ea !== "string") {
5542 return ea.startsWith.apply(ea, bc(arguments))
5543 }
5544 eb = eb || 0;
5545 if (eb < 0 || eb > ea.length) {
5546 return false
5547 }
5548 return ec === "" || ec === ea ? true : ea.indexOf(ec) === eb
5549 };
5550 cW.__endsWith = function(eb, ec) {
5551 if (typeof eb !== "string") {
5552 return eb.endsWith.apply(eb, bc(arguments))
5553 }
5554 var ea = ec ? ec.length : 0;
5555 return ec === "" || ec === eb ? true : eb.indexOf(ec) === eb.length - ea
5556 };
5557 cW.__hashCode = function(ea) {
5558 if (ea.hashCode instanceof Function) {
5559 return ea.hashCode.apply(ea, bc(arguments))
5560 }
5561 return h(ea)
5562 };
5563 cW.__printStackTrace = function(ea) {
5564 cW.println("Exception: " + ea.toString())
5565 };
5566 var d9 = [];
5567 cW.println = function(ea) {
5568 var eb = d9.length;
5569 if (eb) {
5570 F.logger.log(d9.join(""));
5571 d9.length = 0
5572 }
5573 if (arguments.length === 0 && eb === 0) {
5574 F.logger.log("")
5575 } else {
5576 if (arguments.length !== 0) {
5577 F.logger.log(ea)
5578 }
5579 }
5580 };
5581 cW.print = function(ea) {
5582 d9.push(ea)
5583 };
5584 cW.str = function(ec) {
5585 if (ec instanceof Array) {
5586 var ea = [];
5587 for (var eb = 0; eb < ec.length; eb++) {
5588 ea.push(ec[eb].toString() + "")
5589 }
5590 return ea
5591 }
5592 return ec.toString() + ""
5593 };
5594 cW.trim = function(ec) {
5595 if (ec instanceof Array) {
5596 var ea = [];
5597 for (var eb = 0; eb < ec.length; eb++) {
5598 ea.push(ec[eb].replace(/^\s*/, "").replace(/\s*$/, "").replace(/\r*$/, ""))
5599 }
5600 return ea
5601 }
5602 return ec.replace(/^\s*/, "").replace(/\s*$/, "").replace(/\r*$/, "")
5603 };
5604
5605 function aR(ea) {
5606 if (typeof ea === "number") {
5607 return ea !== 0
5608 }
5609 if (typeof ea === "boolean") {
5610 return ea
5611 }
5612 if (typeof ea === "string") {
5613 return ea.toLowerCase() === "true"
5614 }
5615 if (ea instanceof bP) {
5616 return ea.code === 49 || ea.code === 84 || ea.code === 116
5617 }
5618 }
5619 cW.parseBoolean = function(ec) {
5620 if (ec instanceof Array) {
5621 var ea = [];
5622 for (var eb = 0; eb < ec.length; eb++) {
5623 ea.push(aR(ec[eb]))
5624 }
5625 return ea
5626 }
5627 return aR(ec)
5628 };
5629 cW.parseByte = function(ec) {
5630 if (ec instanceof Array) {
5631 var ea = [];
5632 for (var eb = 0; eb < ec.length; eb++) {
5633 ea.push(0 - (ec[eb] & 128) | ec[eb] & 127)
5634 }
5635 return ea
5636 }
5637 return 0 - (ec & 128) | ec & 127
5638 };
5639 cW.parseChar = function(ec) {
5640 if (typeof ec === "number") {
5641 return new bP(String.fromCharCode(ec & 65535))
5642 }
5643 if (ec instanceof Array) {
5644 var ea = [];
5645 for (var eb = 0; eb < ec.length; eb++) {
5646 ea.push(new bP(String.fromCharCode(ec[eb] & 65535)))
5647 }
5648 return ea
5649 }
5650 throw "char() may receive only one argument of type int, byte, int[], or byte[]."
5651 };
5652
5653 function cO(ea) {
5654 if (typeof ea === "number") {
5655 return ea
5656 }
5657 if (typeof ea === "boolean") {
5658 return ea ? 1 : 0
5659 }
5660 if (typeof ea === "string") {
5661 return parseFloat(ea)
5662 }
5663 if (ea instanceof bP) {
5664 return ea.code
5665 }
5666 }
5667 cW.parseFloat = function(ec) {
5668 if (ec instanceof Array) {
5669 var ea = [];
5670 for (var eb = 0; eb < ec.length; eb++) {
5671 ea.push(cO(ec[eb]))
5672 }
5673 return ea
5674 }
5675 return cO(ec)
5676 };
5677
5678 function al(ec, ea) {
5679 if (typeof ec === "number") {
5680 return ec & 4294967295
5681 }
5682 if (typeof ec === "boolean") {
5683 return ec ? 1 : 0
5684 }
5685 if (typeof ec === "string") {
5686 var eb = parseInt(ec, ea || 10);
5687 return eb & 4294967295
5688 }
5689 if (ec instanceof bP) {
5690 return ec.code
5691 }
5692 }
5693 cW.parseInt = function(ed, ec) {
5694 if (ed instanceof Array) {
5695 var ea = [];
5696 for (var eb = 0; eb < ed.length; eb++) {
5697 if (typeof ed[eb] === "string" && !/^\s*[+\-]?\d+\s*$/.test(ed[eb])) {
5698 ea.push(0)
5699 } else {
5700 ea.push(al(ed[eb], ec))
5701 }
5702 }
5703 return ea
5704 }
5705 return al(ed, ec)
5706 };
5707 cW.__int_cast = function(ea) {
5708 return 0 | ea
5709 };
5710 cW.__instanceof = function(ec, eb) {
5711 if (typeof eb !== "function") {
5712 throw "Function is expected as type argument for instanceof operator"
5713 }
5714 if (typeof ec === "string") {
5715 return eb === Object || eb === String
5716 }
5717 if (ec instanceof eb) {
5718 return true
5719 }
5720 if (typeof ec !== "object" || ec === null) {
5721 return false
5722 }
5723 var ee = ec.constructor;
5724 if (eb.$isInterface) {
5725 var ed = [];
5726 while (ee) {
5727 if (ee.$interfaces) {
5728 ed = ed.concat(ee.$interfaces)
5729 }
5730 ee = ee.$base
5731 }
5732 while (ed.length > 0) {
5733 var ea = ed.shift();
5734 if (ea === eb) {
5735 return true
5736 }
5737 if (ea.$interfaces) {
5738 ed = ed.concat(ea.$interfaces)
5739 }
5740 }
5741 return false
5742 }
5743 while (ee.hasOwnProperty("$base")) {
5744 ee = ee.$base;
5745 if (ee === eb) {
5746 return true
5747 }
5748 }
5749 return false
5750 };
5751 cW.abs = q.abs;
5752 cW.ceil = q.ceil;
5753 cW.constrain = function(eb, ec, ea) {
5754 return eb > ea ? ea : eb < ec ? ec : eb
5755 };
5756 cW.dist = function() {
5757 var ec, eb, ea;
5758 if (arguments.length === 4) {
5759 ec = arguments[0] - arguments[2];
5760 eb = arguments[1] - arguments[3];
5761 return q.sqrt(ec * ec + eb * eb)
5762 }
5763 if (arguments.length === 6) {
5764 ec = arguments[0] - arguments[3];
5765 eb = arguments[1] - arguments[4];
5766 ea = arguments[2] - arguments[5];
5767 return q.sqrt(ec * ec + eb * eb + ea * ea)
5768 }
5769 };
5770 cW.exp = q.exp;
5771 cW.floor = q.floor;
5772 cW.lerp = function(eb, ea, ec) {
5773 return (ea - eb) * ec + eb
5774 };
5775 cW.log = q.log;
5776 cW.mag = function(eb, ea, ec) {
5777 if (ec) {
5778 return q.sqrt(eb * eb + ea * ea + ec * ec)
5779 }
5780 return q.sqrt(eb * eb + ea * ea)
5781 };
5782 cW.map = function(ed, eb, ec, ea, ee) {
5783 return ea + (ee - ea) * ((ed - eb) / (ec - eb))
5784 };
5785 cW.max = function() {
5786 if (arguments.length === 2) {
5787 return arguments[0] < arguments[1] ? arguments[1] : arguments[0]
5788 }
5789 var eb = arguments.length === 1 ? arguments[0] : arguments;
5790 if (!("length" in eb && eb.length > 0)) {
5791 throw "Non-empty array is expected"
5792 }
5793 var ea = eb[0],
5794 ed = eb.length;
5795 for (var ec = 1; ec < ed; ++ec) {
5796 if (ea < eb[ec]) {
5797 ea = eb[ec]
5798 }
5799 }
5800 return ea
5801 };
5802 cW.min = function() {
5803 if (arguments.length === 2) {
5804 return arguments[0] < arguments[1] ? arguments[0] : arguments[1]
5805 }
5806 var ea = arguments.length === 1 ? arguments[0] : arguments;
5807 if (!("length" in ea && ea.length > 0)) {
5808 throw "Non-empty array is expected"
5809 }
5810 var ec = ea[0],
5811 ed = ea.length;
5812 for (var eb = 1; eb < ed; ++eb) {
5813 if (ec > ea[eb]) {
5814 ec = ea[eb]
5815 }
5816 }
5817 return ec
5818 };
5819 cW.norm = function(eb, ea, ec) {
5820 return (eb - ea) / (ec - ea)
5821 };
5822 cW.pow = q.pow;
5823 cW.round = q.round;
5824 cW.sq = function(ea) {
5825 return ea * ea
5826 };
5827 cW.sqrt = q.sqrt;
5828 cW.acos = q.acos;
5829 cW.asin = q.asin;
5830 cW.atan = q.atan;
5831 cW.atan2 = q.atan2;
5832 cW.cos = q.cos;
5833 cW.degrees = function(ea) {
5834 return ea * 180 / q.PI
5835 };
5836 cW.radians = function(ea) {
5837 return ea / 180 * q.PI
5838 };
5839 cW.sin = q.sin;
5840 cW.tan = q.tan;
5841 var bY = q.random;
5842 cW.random = function() {
5843 if (arguments.length === 0) {
5844 return bY()
5845 }
5846 if (arguments.length === 1) {
5847 return bY() * arguments[0]
5848 }
5849 var eb = arguments[0],
5850 ea = arguments[1];
5851 return bY() * (ea - eb) + eb
5852 };
5853
5854 function co(ec, eb) {
5855 var ee = ec || 362436069,
5856 ea = eb || 521288629;
5857 var ed = function() {
5858 ee = 36969 * (ee & 65535) + (ee >>> 16) & 4294967295;
5859 ea = 18000 * (ea & 65535) + (ea >>> 16) & 4294967295;
5860 return ((ee & 65535) << 16 | ea & 65535) & 4294967295
5861 };
5862 this.nextDouble = function() {
5863 var ef = ed() / 4294967296;
5864 return ef < 0 ? 1 + ef : ef
5865 };
5866 this.nextInt = ed
5867 }
5868 co.createRandomized = function() {
5869 var ea = new Date;
5870 return new co(ea / 60000 & 4294967295, ea & 4294967295)
5871 };
5872 cW.randomSeed = function(ea) {
5873 bY = (new co(ea)).nextDouble
5874 };
5875 cW.Random = function(ea) {
5876 var ed = false,
5877 eb, ec;
5878 this.nextGaussian = function() {
5879 if (ed) {
5880 ed = false;
5881 return eb
5882 }
5883 var eh, ef, ee;
5884 do {
5885 eh = 2 * ec() - 1;
5886 ef = 2 * ec() - 1;
5887 ee = eh * eh + ef * ef
5888 } while (ee >= 1 || ee === 0);
5889 var eg = q.sqrt(-2 * q.log(ee) / ee);
5890 eb = ef * eg;
5891 ed = true;
5892 return eh * eg
5893 };
5894 ec = ea === t ? q.random : (new co(ea)).nextDouble
5895 };
5896
5897 function dz(eh) {
5898 var eb = eh !== t ? new co(eh) : co.createRandomized();
5899 var eg, ee;
5900 var ed = new b(512);
5901 for (eg = 0; eg < 256; ++eg) {
5902 ed[eg] = eg
5903 }
5904 for (eg = 0; eg < 256; ++eg) {
5905 var ej = ed[ee = eb.nextInt() & 255];
5906 ed[ee] = ed[eg];
5907 ed[eg] = ej
5908 }
5909 for (eg = 0; eg < 256; ++eg) {
5910 ed[eg + 256] = ed[eg]
5911 }
5912
5913 function ea(en, ek, eq, ep) {
5914 var eo = en & 15;
5915 var em = eo < 8 ? ek : eq,
5916 el = eo < 4 ? eq : eo === 12 || eo === 14 ? ek : ep;
5917 return ((eo & 1) === 0 ? em : -em) + ((eo & 2) === 0 ? el : -el)
5918 }
5919
5920 function ef(em, ek, en) {
5921 var el = (em & 1) === 0 ? ek : en;
5922 return (em & 2) === 0 ? -el : el
5923 }
5924
5925 function ei(el, ek) {
5926 return (el & 1) === 0 ? -ek : ek
5927 }
5928
5929 function ec(em, el, ek) {
5930 return el + em * (ek - el)
5931 }
5932 this.noise3d = function(ew, ev, eu) {
5933 var en = q.floor(ew) & 255,
5934 el = q.floor(ev) & 255,
5935 ek = q.floor(eu) & 255;
5936 ew -= q.floor(ew);
5937 ev -= q.floor(ev);
5938 eu -= q.floor(eu);
5939 var er = (3 - 2 * ew) * ew * ew,
5940 eq = (3 - 2 * ev) * ev * ev,
5941 ep = (3 - 2 * eu) * eu * eu;
5942 var ey = ed[en] + el,
5943 et = ed[ey] + ek,
5944 es = ed[ey + 1] + ek,
5945 ex = ed[en + 1] + el,
5946 eo = ed[ex] + ek,
5947 em = ed[ex + 1] + ek;
5948 return ec(ep, ec(eq, ec(er, ea(ed[et], ew, ev, eu), ea(ed[eo], ew - 1, ev, eu)), ec(er, ea(ed[es], ew, ev - 1, eu), ea(ed[em], ew - 1, ev - 1, eu))), ec(eq, ec(er, ea(ed[et + 1], ew, ev, eu - 1), ea(ed[eo + 1], ew - 1, ev, eu - 1)), ec(er, ea(ed[es + 1], ew, ev - 1, eu - 1), ea(ed[em + 1], ew - 1, ev - 1, eu - 1))))
5949 };
5950 this.noise2d = function(ek, er) {
5951 var eq = q.floor(ek) & 255,
5952 eo = q.floor(er) & 255;
5953 ek -= q.floor(ek);
5954 er -= q.floor(er);
5955 var em = (3 - 2 * ek) * ek * ek,
5956 el = (3 - 2 * er) * er * er;
5957 var ep = ed[eq] + eo,
5958 en = ed[eq + 1] + eo;
5959 return ec(el, ec(em, ef(ed[ep], ek, er), ef(ed[en], ek - 1, er)), ec(em, ef(ed[ep + 1], ek, er - 1), ef(ed[en + 1], ek - 1, er - 1)))
5960 };
5961 this.noise1d = function(ek) {
5962 var em = q.floor(ek) & 255;
5963 ek -= q.floor(ek);
5964 var el = (3 - 2 * ek) * ek * ek;
5965 return ec(el, ei(ed[em], ek), ei(ed[em + 1], ek - 1))
5966 }
5967 }
5968 var bW = {
5969 generator: t,
5970 octaves: 4,
5971 fallout: 0.5,
5972 seed: t
5973 };
5974 cW.noise = function(ea, eh, eg) {
5975 if (bW.generator === t) {
5976 bW.generator = new dz(bW.seed)
5977 }
5978 var ef = bW.generator;
5979 var ee = 1,
5980 eb = 1,
5981 ed = 0;
5982 for (var ec = 0; ec < bW.octaves; ++ec) {
5983 ee *= bW.fallout;
5984 switch (arguments.length) {
5985 case 1:
5986 ed += ee * (1 + ef.noise1d(eb * ea)) / 2;
5987 break;
5988 case 2:
5989 ed += ee * (1 + ef.noise2d(eb * ea, eb * eh)) / 2;
5990 break;
5991 case 3:
5992 ed += ee * (1 + ef.noise3d(eb * ea, eb * eh, eb * eg)) / 2;
5993 break
5994 }
5995 eb *= 2
5996 }
5997 return ed
5998 };
5999 cW.noiseDetail = function(eb, ea) {
6000 bW.octaves = eb;
6001 if (ea !== t) {
6002 bW.fallout = ea
6003 }
6004 };
6005 cW.noiseSeed = function(ea) {
6006 bW.seed = ea;
6007 bW.generator = t
6008 };
6009 ds.prototype.size = function(eb, ee, ed) {
6010 if (ce) {
6011 cW.stroke(0)
6012 }
6013 if (aH) {
6014 cW.fill(255)
6015 }
6016 var ec = {
6017 fillStyle: d8.fillStyle,
6018 strokeStyle: d8.strokeStyle,
6019 lineCap: d8.lineCap,
6020 lineJoin: d8.lineJoin
6021 };
6022 if (ae.style.length > 0) {
6023 ae.style.removeProperty("width");
6024 ae.style.removeProperty("height")
6025 }
6026 ae.width = cW.width = eb || 100;
6027 ae.height = cW.height = ee || 100;
6028 for (var ef in ec) {
6029 if (ec.hasOwnProperty(ef)) {
6030 d8[ef] = ec[ef]
6031 }
6032 }
6033 cW.textFont(W);
6034 cW.background();
6035 bZ = q.max(1000, eb * ee * 0.05);
6036 cW.externals.context = d8;
6037 for (var ea = 0; ea < 720; ea++) {
6038 ah[ea] = cW.sin(ea * (q.PI / 180) * 0.5);
6039 bl[ea] = cW.cos(ea * (q.PI / 180) * 0.5)
6040 }
6041 };
6042 bR.prototype.size = function(ea, ec, eb) {
6043 if (d8 === t) {
6044 d8 = ae.getContext("2d");
6045 am = new V;
6046 da = new V;
6047 dJ = new aX;
6048 aT = new aX
6049 }
6050 ds.prototype.size.apply(this, arguments)
6051 };
6052 bB.prototype.size = function() {
6053 var eb = false;
6054 return function ea(ed, ef, ee) {
6055 if (eb) {
6056 throw "Multiple calls to size() for 3D renders are not allowed."
6057 }
6058 eb = true;
6059
6060 function eg(ei) {
6061 var el = ["experimental-webgl", "webgl", "webkit-3d"],
6062 ek;
6063 for (var ej = 0, eh = el.length; ej < eh; ej++) {
6064 ek = ei.getContext(el[ej], {
6065 antialias: false,
6066 preserveDrawingBuffer: true
6067 });
6068 if (ek) {
6069 break
6070 }
6071 }
6072 return ek
6073 }
6074 try {
6075 ae.width = cW.width = ed || 100;
6076 ae.height = cW.height = ef || 100;
6077 d8 = eg(ae);
6078 c7 = d8.createTexture();
6079 bS = d8.createTexture()
6080 } catch (ec) {
6081 F.debug(ec)
6082 }
6083 if (!d8) {
6084 throw "WebGL context is not supported on this browser."
6085 }
6086 d8.viewport(0, 0, ae.width, ae.height);
6087 d8.enable(d8.DEPTH_TEST);
6088 d8.enable(d8.BLEND);
6089 d8.blendFunc(d8.SRC_ALPHA, d8.ONE_MINUS_SRC_ALPHA);
6090 dQ = bF(d8, dE, aW);
6091 bT = bF(d8, aO, bQ);
6092 cW.strokeWeight(1);
6093 dx = bF(d8, dn, aF);
6094 d8.useProgram(dx);
6095 dZ("usingTexture3d", dx, "usingTexture", dT);
6096 cW.lightFalloff(1, 0, 0);
6097 cW.shininess(1);
6098 cW.ambient(255, 255, 255);
6099 cW.specular(0, 0, 0);
6100 cW.emissive(0, 0, 0);
6101 bh = d8.createBuffer();
6102 d8.bindBuffer(d8.ARRAY_BUFFER, bh);
6103 d8.bufferData(d8.ARRAY_BUFFER, dh, d8.STATIC_DRAW);
6104 cJ = d8.createBuffer();
6105 d8.bindBuffer(d8.ARRAY_BUFFER, cJ);
6106 d8.bufferData(d8.ARRAY_BUFFER, df, d8.STATIC_DRAW);
6107 dk = d8.createBuffer();
6108 d8.bindBuffer(d8.ARRAY_BUFFER, dk);
6109 d8.bufferData(d8.ARRAY_BUFFER, bH, d8.STATIC_DRAW);
6110 aB = d8.createBuffer();
6111 d8.bindBuffer(d8.ARRAY_BUFFER, aB);
6112 d8.bufferData(d8.ARRAY_BUFFER, ak, d8.STATIC_DRAW);
6113 b2 = d8.createBuffer();
6114 d8.bindBuffer(d8.ARRAY_BUFFER, b2);
6115 d8.bufferData(d8.ARRAY_BUFFER, ai, d8.STATIC_DRAW);
6116 bg = d8.createBuffer();
6117 b8 = d8.createBuffer();
6118 at = d8.createBuffer();
6119 aG = d8.createBuffer();
6120 bC = d8.createBuffer();
6121 af = d8.createBuffer();
6122 aw = d8.createBuffer();
6123 d8.bindBuffer(d8.ARRAY_BUFFER, aw);
6124 d8.bufferData(d8.ARRAY_BUFFER, new e([0, 0, 0]), d8.STATIC_DRAW);
6125 cH = d8.createBuffer();
6126 d8.bindBuffer(d8.ARRAY_BUFFER, cH);
6127 d8.bufferData(d8.ARRAY_BUFFER, new e([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]), d8.STATIC_DRAW);
6128 ac = d8.createBuffer();
6129 d8.bindBuffer(d8.ARRAY_BUFFER, ac);
6130 d8.bufferData(d8.ARRAY_BUFFER, new e([0, 0, 1, 0, 1, 1, 0, 1]), d8.STATIC_DRAW);
6131 R = d8.createBuffer();
6132 d8.bindBuffer(d8.ELEMENT_ARRAY_BUFFER, R);
6133 d8.bufferData(d8.ELEMENT_ARRAY_BUFFER, new y([0, 1, 2, 2, 3, 0]), d8.STATIC_DRAW);
6134 bV = new aP;
6135 ch = new aP;
6136 dJ = new aP;
6137 aT = new aP;
6138 db = new aP;
6139 cW.camera();
6140 cW.perspective();
6141 am = new V;
6142 da = new V;
6143 c3 = new aP;
6144 aQ = new aP;
6145 aL = new aP;
6146 bz = new aP;
6147 cd = new aP;
6148 U = new aP;
6149 U.set(-1, 3, -3, 1, 3, -6, 3, 0, -3, 3, 0, 0, 1, 0, 0, 0);
6150 ds.prototype.size.apply(this, arguments)
6151 }
6152 }();
6153 bR.prototype.ambientLight = ds.prototype.a3DOnlyFunction;
6154 bB.prototype.ambientLight = function(ea, ed, ei, ej, ef, ee) {
6155 if (dL === 8) {
6156 throw "can only create " + 8 + " lights"
6157 }
6158 var eg = new A(ej, ef, ee);
6159 var eh = new aP;
6160 eh.scale(1, -1, 1);
6161 eh.apply(dJ.array());
6162 eh.mult(eg, eg);
6163 var eb = dH(ea, ed, ei, 0);
6164 var ec = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255];
6165 d8.useProgram(dx);
6166 d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ec);
6167 d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", eg.array());
6168 dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 0);
6169 dZ("uLightCount3d", dx, "uLightCount", ++dL)
6170 };
6171 bR.prototype.directionalLight = ds.prototype.a3DOnlyFunction;
6172 bB.prototype.directionalLight = function(ea, eg, ei, eh, ef, ee) {
6173 if (dL === 8) {
6174 throw "can only create " + 8 + " lights"
6175 }
6176 d8.useProgram(dx);
6177 var ej = new aP;
6178 ej.scale(1, -1, 1);
6179 ej.apply(dJ.array());
6180 ej = ej.array();
6181 var ec = [ej[0] * eh + ej[4] * ef + ej[8] * ee, ej[1] * eh + ej[5] * ef + ej[9] * ee, ej[2] * eh + ej[6] * ef + ej[10] * ee];
6182 var eb = dH(ea, eg, ei, 0);
6183 var ed = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255];
6184 d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ed);
6185 d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", ec);
6186 dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 1);
6187 dZ("uLightCount3d", dx, "uLightCount", ++dL)
6188 };
6189 bR.prototype.lightFalloff = ds.prototype.a3DOnlyFunction;
6190 bB.prototype.lightFalloff = function(eb, ea, ec) {
6191 d8.useProgram(dx);
6192 d2("uFalloff3d", dx, "uFalloff", [eb, ea, ec])
6193 };
6194 bR.prototype.lightSpecular = ds.prototype.a3DOnlyFunction;
6195 bB.prototype.lightSpecular = function(ee, ed, ea) {
6196 var eb = dH(ee, ed, ea, 0);
6197 var ec = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255];
6198 d8.useProgram(dx);
6199 d2("uSpecular3d", dx, "uSpecular", ec)
6200 };
6201 cW.lights = function() {
6202 cW.ambientLight(128, 128, 128);
6203 cW.directionalLight(128, 128, 128, 0, 0, -1);
6204 cW.lightFalloff(1, 0, 0);
6205 cW.lightSpecular(0, 0, 0)
6206 };
6207 bR.prototype.pointLight = ds.prototype.a3DOnlyFunction;
6208 bB.prototype.pointLight = function(ea, ed, ei, ej, ef, ee) {
6209 if (dL === 8) {
6210 throw "can only create " + 8 + " lights"
6211 }
6212 var eg = new A(ej, ef, ee);
6213 var eh = new aP;
6214 eh.scale(1, -1, 1);
6215 eh.apply(dJ.array());
6216 eh.mult(eg, eg);
6217 var eb = dH(ea, ed, ei, 0);
6218 var ec = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255];
6219 d8.useProgram(dx);
6220 d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ec);
6221 d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", eg.array());
6222 dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 2);
6223 dZ("uLightCount3d", dx, "uLightCount", ++dL)
6224 };
6225 bR.prototype.noLights = ds.prototype.a3DOnlyFunction;
6226 bB.prototype.noLights = function() {
6227 dL = 0;
6228 d8.useProgram(dx);
6229 dZ("uLightCount3d", dx, "uLightCount", dL)
6230 };
6231 bR.prototype.spotLight = ds.prototype.a3DOnlyFunction;
6232 bB.prototype.spotLight = function(ea, ei, en, eo, em, ek, ej, eh, ef, ee, eg) {
6233 if (dL === 8) {
6234 throw "can only create " + 8 + " lights"
6235 }
6236 d8.useProgram(dx);
6237 var el = new A(eo, em, ek);
6238 var ep = new aP;
6239 ep.scale(1, -1, 1);
6240 ep.apply(dJ.array());
6241 ep.mult(el, el);
6242 ep = ep.array();
6243 var ec = [ep[0] * ej + ep[4] * eh + ep[8] * ef, ep[1] * ej + ep[5] * eh + ep[9] * ef, ep[2] * ej + ep[6] * eh + ep[10] * ef];
6244 var eb = dH(ea, ei, en, 0);
6245 var ed = [((eb >> 16) & 255) / 255, ((eb >> 8) & 255) / 255, (eb & 255) / 255];
6246 d2("uLights.color.3d." + dL, dx, "uLights" + dL + ".color", ed);
6247 d2("uLights.position.3d." + dL, dx, "uLights" + dL + ".position", el.array());
6248 d2("uLights.direction.3d." + dL, dx, "uLights" + dL + ".direction", ec);
6249 d2("uLights.concentration.3d." + dL, dx, "uLights" + dL + ".concentration", eg);
6250 d2("uLights.angle.3d." + dL, dx, "uLights" + dL + ".angle", ee);
6251 dZ("uLights.type.3d." + dL, dx, "uLights" + dL + ".type", 3);
6252 dZ("uLightCount3d", dx, "uLightCount", ++dL)
6253 };
6254 bR.prototype.beginCamera = function() {
6255 throw "beginCamera() is not available in 2D mode"
6256 };
6257 bB.prototype.beginCamera = function() {
6258 if (ap) {
6259 throw "You cannot call beginCamera() again before calling endCamera()"
6260 }
6261 ap = true;
6262 dJ = ch;
6263 aT = bV
6264 };
6265 bR.prototype.endCamera = function() {
6266 throw "endCamera() is not available in 2D mode"
6267 };
6268 bB.prototype.endCamera = function() {
6269 if (!ap) {
6270 throw "You cannot call endCamera() before calling beginCamera()"
6271 }
6272 dJ.set(bV);
6273 aT.set(ch);
6274 ap = false
6275 };
6276 cW.camera = function(el, ek, ei, eg, ee, ed, et, er, ep) {
6277 if (el === t) {
6278 dl = cW.width / 2;
6279 dj = cW.height / 2;
6280 di = dj / q.tan(cK / 2);
6281 el = dl;
6282 ek = dj;
6283 ei = di;
6284 eg = dl;
6285 ee = dj;
6286 ed = 0;
6287 et = 0;
6288 er = 1;
6289 ep = 0
6290 }
6291 var ef = new A(el - eg, ek - ee, ei - ed);
6292 var eh = new A(et, er, ep);
6293 ef.normalize();
6294 var ej = A.cross(eh, ef);
6295 eh = A.cross(ef, ej);
6296 ej.normalize();
6297 eh.normalize();
6298 var eu = ej.x,
6299 es = ej.y,
6300 eq = ej.z;
6301 var ec = eh.x,
6302 eb = eh.y,
6303 ea = eh.z;
6304 var eo = ef.x,
6305 en = ef.y,
6306 em = ef.z;
6307 bV.set(eu, es, eq, 0, ec, eb, ea, 0, eo, en, em, 0, 0, 0, 0, 1);
6308 bV.translate(-el, -ek, -ei);
6309 ch.reset();
6310 ch.invApply(eu, es, eq, 0, ec, eb, ea, 0, eo, en, em, 0, 0, 0, 0, 1);
6311 ch.translate(el, ek, ei);
6312 dJ.set(bV);
6313 aT.set(ch)
6314 };
6315 cW.perspective = function(ee, ec, ef, eb) {
6316 if (arguments.length === 0) {
6317 dj = ae.height / 2;
6318 di = dj / q.tan(cK / 2);
6319 a0 = di / 10;
6320 av = di * 10;
6321 b5 = cW.width / cW.height;
6322 ee = cK;
6323 ec = b5;
6324 ef = a0;
6325 eb = av
6326 }
6327 var eg, ea, eh, ed;
6328 eg = ef * q.tan(ee / 2);
6329 ea = -eg;
6330 eh = eg * ec;
6331 ed = ea * ec;
6332 cW.frustum(ed, eh, ea, eg, ef, eb)
6333 };
6334 bR.prototype.frustum = function() {
6335 throw "Processing.js: frustum() is not supported in 2D mode"
6336 };
6337 bB.prototype.frustum = function(eg, ec, eb, ef, ee, ea) {
6338 ci = true;
6339 db = new aP;
6340 db.set(2 * ee / (ec - eg), 0, (ec + eg) / (ec - eg), 0, 0, 2 * ee / (ef - eb), (ef + eb) / (ef - eb), 0, 0, 0, -(ea + ee) / (ea - ee), -(2 * ea * ee) / (ea - ee), 0, 0, -1, 0);
6341 var ed = new aP;
6342 ed.set(db);
6343 ed.transpose();
6344 d8.useProgram(dQ);
6345 a9("projection2d", dQ, "uProjection", false, ed.array());
6346 d8.useProgram(dx);
6347 a9("projection3d", dx, "uProjection", false, ed.array());
6348 d8.useProgram(bT);
6349 a9("uProjectionUS", bT, "uProjection", false, ed.array())
6350 };
6351 cW.ortho = function(eb, em, ea, ek, eh, eg) {
6352 if (arguments.length === 0) {
6353 eb = 0;
6354 em = cW.width;
6355 ea = 0;
6356 ek = cW.height;
6357 eh = -10;
6358 eg = 10
6359 }
6360 var el = 2 / (em - eb);
6361 var ej = 2 / (ek - ea);
6362 var ei = -2 / (eg - eh);
6363 var ef = -(em + eb) / (em - eb);
6364 var ee = -(ek + ea) / (ek - ea);
6365 var ed = -(eg + eh) / (eg - eh);
6366 db = new aP;
6367 db.set(el, 0, 0, ef, 0, ej, 0, ee, 0, 0, ei, ed, 0, 0, 0, 1);
6368 var ec = new aP;
6369 ec.set(db);
6370 ec.transpose();
6371 d8.useProgram(dQ);
6372 a9("projection2d", dQ, "uProjection", false, ec.array());
6373 d8.useProgram(dx);
6374 a9("projection3d", dx, "uProjection", false, ec.array());
6375 d8.useProgram(bT);
6376 a9("uProjectionUS", bT, "uProjection", false, ec.array());
6377 ci = false
6378 };
6379 cW.printProjection = function() {
6380 db.print()
6381 };
6382 cW.printCamera = function() {
6383 bV.print()
6384 };
6385 bR.prototype.box = ds.prototype.a3DOnlyFunction;
6386 bB.prototype.box = function(ec, ef, eh) {
6387 if (!ef || !eh) {
6388 ef = eh = ec
6389 }
6390 var ee = new aP;
6391 ee.scale(ec, ef, eh);
6392 var eb = new aP;
6393 eb.scale(1, -1, 1);
6394 eb.apply(dJ.array());
6395 eb.transpose();
6396 if (aH) {
6397 d8.useProgram(dx);
6398 a9("model3d", dx, "uModel", false, ee.array());
6399 a9("view3d", dx, "uView", false, eb.array());
6400 d8.enable(d8.POLYGON_OFFSET_FILL);
6401 d8.polygonOffset(1, 1);
6402 d2("color3d", dx, "uColor", bo);
6403 if (dL > 0) {
6404 var ed = new aP;
6405 ed.set(eb);
6406 var ea = new aP;
6407 ea.set(ee);
6408 ed.mult(ea);
6409 var eg = new aP;
6410 eg.set(ed);
6411 eg.invert();
6412 eg.transpose();
6413 a9("uNormalTransform3d", dx, "uNormalTransform", false, eg.array());
6414 dc("aNormal3d", dx, "aNormal", 3, cJ)
6415 } else {
6416 cg("aNormal3d", dx, "aNormal")
6417 }
6418 dc("aVertex3d", dx, "aVertex", 3, bh);
6419 cg("aColor3d", dx, "aColor");
6420 cg("aTexture3d", dx, "aTexture");
6421 d8.drawArrays(d8.TRIANGLES, 0, dh.length / 3);
6422 d8.disable(d8.POLYGON_OFFSET_FILL)
6423 }
6424 if (dW > 0 && ce) {
6425 d8.useProgram(dQ);
6426 a9("uModel2d", dQ, "uModel", false, ee.array());
6427 a9("uView2d", dQ, "uView", false, eb.array());
6428 d2("uColor2d", dQ, "uColor", c0);
6429 dZ("uIsDrawingText2d", dQ, "uIsDrawingText", false);
6430 dc("vertex2d", dQ, "aVertex", 3, dk);
6431 cg("aTextureCoord2d", dQ, "aTextureCoord");
6432 d8.drawArrays(d8.LINES, 0, bH.length / 3)
6433 }
6434 };
6435 var cD = function() {
6436 var eb;
6437 cF = [];
6438 for (eb = 0; eb < bM; eb++) {
6439 cF.push(0);
6440 cF.push(-1);
6441 cF.push(0);
6442 cF.push(bt[eb]);
6443 cF.push(bs[eb]);
6444 cF.push(br[eb])
6445 }
6446 cF.push(0);
6447 cF.push(-1);
6448 cF.push(0);
6449 cF.push(bt[0]);
6450 cF.push(bs[0]);
6451 cF.push(br[0]);
6452 var ef, ec, ee;
6453 var ed = 0;
6454 for (eb = 2; eb < bL; eb++) {
6455 ef = ec = ed;
6456 ed += bM;
6457 ee = ed;
6458 for (var ea = 0; ea < bM; ea++) {
6459 cF.push(bt[ef]);
6460 cF.push(bs[ef]);
6461 cF.push(br[ef++]);
6462 cF.push(bt[ee]);
6463 cF.push(bs[ee]);
6464 cF.push(br[ee++])
6465 }
6466 ef = ec;
6467 ee = ed;
6468 cF.push(bt[ef]);
6469 cF.push(bs[ef]);
6470 cF.push(br[ef]);
6471 cF.push(bt[ee]);
6472 cF.push(bs[ee]);
6473 cF.push(br[ee])
6474 }
6475 for (eb = 0; eb < bM; eb++) {
6476 ee = ed + eb;
6477 cF.push(bt[ee]);
6478 cF.push(bs[ee]);
6479 cF.push(br[ee]);
6480 cF.push(0);
6481 cF.push(1);
6482 cF.push(0)
6483 }
6484 cF.push(bt[ed]);
6485 cF.push(bs[ed]);
6486 cF.push(br[ed]);
6487 cF.push(0);
6488 cF.push(1);
6489 cF.push(0);
6490 d8.bindBuffer(d8.ARRAY_BUFFER, bg);
6491 d8.bufferData(d8.ARRAY_BUFFER, new e(cF), d8.STATIC_DRAW)
6492 };
6493 cW.sphereDetail = function(eb, em) {
6494 var eh;
6495 if (arguments.length === 1) {
6496 eb = em = arguments[0]
6497 }
6498 if (eb < 3) {
6499 eb = 3
6500 }
6501 if (em < 2) {
6502 em = 2
6503 }
6504 if (eb === bM && em === bL) {
6505 return
6506 }
6507 var el = 720 / eb;
6508 var ef = new e(eb);
6509 var ec = new e(eb);
6510 for (eh = 0; eh < eb; eh++) {
6511 ef[eh] = bl[eh * el % 720 | 0];
6512 ec[eh] = ah[eh * el % 720 | 0]
6513 }
6514 var ek = eb * (em - 1) + 2;
6515 var ej = 0;
6516 bt = new e(ek);
6517 bs = new e(ek);
6518 br = new e(ek);
6519 var ei = 720 * 0.5 / em;
6520 var ee = ei;
6521 for (eh = 1; eh < em; eh++) {
6522 var ed = ah[ee % 720 | 0];
6523 var ea = -bl[ee % 720 | 0];
6524 for (var eg = 0; eg < eb; eg++) {
6525 bt[ej] = ef[eg] * ed;
6526 bs[ej] = ea;
6527 br[ej++] = ec[eg] * ed
6528 }
6529 ee += ei
6530 }
6531 bM = eb;
6532 bL = em;
6533 cD()
6534 };
6535 bR.prototype.sphere = ds.prototype.a3DOnlyFunction;
6536 bB.prototype.sphere = function() {
6537 var ee = arguments[0];
6538 if (bM < 3 || bL < 2) {
6539 cW.sphereDetail(30)
6540 }
6541 var ed = new aP;
6542 ed.scale(ee, ee, ee);
6543 var eb = new aP;
6544 eb.scale(1, -1, 1);
6545 eb.apply(dJ.array());
6546 eb.transpose();
6547 if (aH) {
6548 if (dL > 0) {
6549 var ec = new aP;
6550 ec.set(eb);
6551 var ea = new aP;
6552 ea.set(ed);
6553 ec.mult(ea);
6554 var ef = new aP;
6555 ef.set(ec);
6556 ef.invert();
6557 ef.transpose();
6558 a9("uNormalTransform3d", dx, "uNormalTransform", false, ef.array());
6559 dc("aNormal3d", dx, "aNormal", 3, bg)
6560 } else {
6561 cg("aNormal3d", dx, "aNormal")
6562 }
6563 d8.useProgram(dx);
6564 cg("aTexture3d", dx, "aTexture");
6565 a9("uModel3d", dx, "uModel", false, ed.array());
6566 a9("uView3d", dx, "uView", false, eb.array());
6567 dc("aVertex3d", dx, "aVertex", 3, bg);
6568 cg("aColor3d", dx, "aColor");
6569 d8.enable(d8.POLYGON_OFFSET_FILL);
6570 d8.polygonOffset(1, 1);
6571 d2("uColor3d", dx, "uColor", bo);
6572 d8.drawArrays(d8.TRIANGLE_STRIP, 0, cF.length / 3);
6573 d8.disable(d8.POLYGON_OFFSET_FILL)
6574 }
6575 if (dW > 0 && ce) {
6576 d8.useProgram(dQ);
6577 a9("uModel2d", dQ, "uModel", false, ed.array());
6578 a9("uView2d", dQ, "uView", false, eb.array());
6579 dc("aVertex2d", dQ, "aVertex", 3, bg);
6580 cg("aTextureCoord2d", dQ, "aTextureCoord");
6581 d2("uColor2d", dQ, "uColor", c0);
6582 dZ("uIsDrawingText", dQ, "uIsDrawingText", false);
6583 d8.drawArrays(d8.LINE_STRIP, 0, cF.length / 3)
6584 }
6585 };
6586 cW.modelX = function(eg, ef, ee) {
6587 var ei = dJ.array();
6588 var ek = ch.array();
6589 var ea = ei[0] * eg + ei[1] * ef + ei[2] * ee + ei[3];
6590 var ej = ei[4] * eg + ei[5] * ef + ei[6] * ee + ei[7];
6591 var eh = ei[8] * eg + ei[9] * ef + ei[10] * ee + ei[11];
6592 var eb = ei[12] * eg + ei[13] * ef + ei[14] * ee + ei[15];
6593 var ec = ek[0] * ea + ek[1] * ej + ek[2] * eh + ek[3] * eb;
6594 var ed = ek[12] * ea + ek[13] * ej + ek[14] * eh + ek[15] * eb;
6595 return ed !== 0 ? ec / ed : ec
6596 };
6597 cW.modelY = function(eg, ef, ee) {
6598 var ei = dJ.array();
6599 var ek = ch.array();
6600 var ea = ei[0] * eg + ei[1] * ef + ei[2] * ee + ei[3];
6601 var ej = ei[4] * eg + ei[5] * ef + ei[6] * ee + ei[7];
6602 var eh = ei[8] * eg + ei[9] * ef + ei[10] * ee + ei[11];
6603 var eb = ei[12] * eg + ei[13] * ef + ei[14] * ee + ei[15];
6604 var ec = ek[4] * ea + ek[5] * ej + ek[6] * eh + ek[7] * eb;
6605 var ed = ek[12] * ea + ek[13] * ej + ek[14] * eh + ek[15] * eb;
6606 return ed !== 0 ? ec / ed : ec
6607 };
6608 cW.modelZ = function(eg, ef, ee) {
6609 var ei = dJ.array();
6610 var ek = ch.array();
6611 var ea = ei[0] * eg + ei[1] * ef + ei[2] * ee + ei[3];
6612 var ej = ei[4] * eg + ei[5] * ef + ei[6] * ee + ei[7];
6613 var eh = ei[8] * eg + ei[9] * ef + ei[10] * ee + ei[11];
6614 var ec = ei[12] * eg + ei[13] * ef + ei[14] * ee + ei[15];
6615 var eb = ek[8] * ea + ek[9] * ej + ek[10] * eh + ek[11] * ec;
6616 var ed = ek[12] * ea + ek[13] * ej + ek[14] * eh + ek[15] * ec;
6617 return ed !== 0 ? eb / ed : eb
6618 };
6619 bR.prototype.ambient = ds.prototype.a3DOnlyFunction;
6620 bB.prototype.ambient = function(ed, ec, eb) {
6621 d8.useProgram(dx);
6622 dZ("uUsingMat3d", dx, "uUsingMat", true);
6623 var ea = cW.color(ed, ec, eb);
6624 d2("uMaterialAmbient3d", dx, "uMaterialAmbient", cW.color.toGLArray(ea).slice(0, 3))
6625 };
6626 bR.prototype.emissive = ds.prototype.a3DOnlyFunction;
6627 bB.prototype.emissive = function(ed, ec, eb) {
6628 d8.useProgram(dx);
6629 dZ("uUsingMat3d", dx, "uUsingMat", true);
6630 var ea = cW.color(ed, ec, eb);
6631 d2("uMaterialEmissive3d", dx, "uMaterialEmissive", cW.color.toGLArray(ea).slice(0, 3))
6632 };
6633 bR.prototype.shininess = ds.prototype.a3DOnlyFunction;
6634 bB.prototype.shininess = function(ea) {
6635 d8.useProgram(dx);
6636 dZ("uUsingMat3d", dx, "uUsingMat", true);
6637 d2("uShininess3d", dx, "uShininess", ea)
6638 };
6639 bR.prototype.specular = ds.prototype.a3DOnlyFunction;
6640 bB.prototype.specular = function(ed, ec, eb) {
6641 d8.useProgram(dx);
6642 dZ("uUsingMat3d", dx, "uUsingMat", true);
6643 var ea = cW.color(ed, ec, eb);
6644 d2("uMaterialSpecular3d", dx, "uMaterialSpecular", cW.color.toGLArray(ea).slice(0, 3))
6645 };
6646 cW.screenX = function(eh, eg, ef) {
6647 var ej = dJ.array();
6648 if (ej.length === 16) {
6649 var ea = ej[0] * eh + ej[1] * eg + ej[2] * ef + ej[3];
6650 var ek = ej[4] * eh + ej[5] * eg + ej[6] * ef + ej[7];
6651 var ei = ej[8] * eh + ej[9] * eg + ej[10] * ef + ej[11];
6652 var eb = ej[12] * eh + ej[13] * eg + ej[14] * ef + ej[15];
6653 var ee = db.array();
6654 var ec = ee[0] * ea + ee[1] * ek + ee[2] * ei + ee[3] * eb;
6655 var ed = ee[12] * ea + ee[13] * ek + ee[14] * ei + ee[15] * eb;
6656 if (ed !== 0) {
6657 ec /= ed
6658 }
6659 return cW.width * (1 + ec) / 2
6660 }
6661 return dJ.multX(eh, eg)
6662 };
6663 cW.screenY = function aA(eh, eg, ef) {
6664 var ej = dJ.array();
6665 if (ej.length === 16) {
6666 var ea = ej[0] * eh + ej[1] * eg + ej[2] * ef + ej[3];
6667 var ek = ej[4] * eh + ej[5] * eg + ej[6] * ef + ej[7];
6668 var ei = ej[8] * eh + ej[9] * eg + ej[10] * ef + ej[11];
6669 var eb = ej[12] * eh + ej[13] * eg + ej[14] * ef + ej[15];
6670 var ee = db.array();
6671 var ec = ee[4] * ea + ee[5] * ek + ee[6] * ei + ee[7] * eb;
6672 var ed = ee[12] * ea + ee[13] * ek + ee[14] * ei + ee[15] * eb;
6673 if (ed !== 0) {
6674 ec /= ed
6675 }
6676 return cW.height * (1 + ec) / 2
6677 }
6678 return dJ.multY(eh, eg)
6679 };
6680 cW.screenZ = function ay(eh, eg, ef) {
6681 var ej = dJ.array();
6682 if (ej.length !== 16) {
6683 return 0
6684 }
6685 var ee = db.array();
6686 var ea = ej[0] * eh + ej[1] * eg + ej[2] * ef + ej[3];
6687 var ek = ej[4] * eh + ej[5] * eg + ej[6] * ef + ej[7];
6688 var ei = ej[8] * eh + ej[9] * eg + ej[10] * ef + ej[11];
6689 var ec = ej[12] * eh + ej[13] * eg + ej[14] * ef + ej[15];
6690 var eb = ee[8] * ea + ee[9] * ek + ee[10] * ei + ee[11] * ec;
6691 var ed = ee[12] * ea + ee[13] * ek + ee[14] * ei + ee[15] * ec;
6692 if (ed !== 0) {
6693 eb /= ed
6694 }
6695 return (eb + 1) / 2
6696 };
6697 ds.prototype.fill = function() {
6698 var ea = cW.color(arguments[0], arguments[1], arguments[2], arguments[3]);
6699 if (ea === a1 && aH) {
6700 return
6701 }
6702 aH = true;
6703 a1 = ea
6704 };
6705 bR.prototype.fill = function() {
6706 ds.prototype.fill.apply(this, arguments);
6707 aq = true
6708 };
6709 bB.prototype.fill = function() {
6710 ds.prototype.fill.apply(this, arguments);
6711 bo = cW.color.toGLArray(a1)
6712 };
6713
6714 function bn() {
6715 if (aH) {
6716 if (aq) {
6717 d8.fillStyle = cW.color.toString(a1);
6718 aq = false
6719 }
6720 d8.fill()
6721 }
6722 }
6723 cW.noFill = function() {
6724 aH = false
6725 };
6726 ds.prototype.stroke = function() {
6727 var ea = cW.color(arguments[0], arguments[1], arguments[2], arguments[3]);
6728 if (ea === cv && ce) {
6729 return
6730 }
6731 ce = true;
6732 cv = ea
6733 };
6734 bR.prototype.stroke = function() {
6735 ds.prototype.stroke.apply(this, arguments);
6736 b3 = true
6737 };
6738 bB.prototype.stroke = function() {
6739 ds.prototype.stroke.apply(this, arguments);
6740 c0 = cW.color.toGLArray(cv)
6741 };
6742
6743 function dd() {
6744 if (ce) {
6745 if (b3) {
6746 d8.strokeStyle = cW.color.toString(cv);
6747 b3 = false
6748 }
6749 d8.stroke()
6750 }
6751 }
6752 cW.noStroke = function() {
6753 ce = false
6754 };
6755 ds.prototype.strokeWeight = function(ea) {
6756 dW = ea
6757 };
6758 bR.prototype.strokeWeight = function(ea) {
6759 ds.prototype.strokeWeight.apply(this, arguments);
6760 d8.lineWidth = ea
6761 };
6762 bB.prototype.strokeWeight = function(ea) {
6763 ds.prototype.strokeWeight.apply(this, arguments);
6764 d8.useProgram(dQ);
6765 d2("pointSize2d", dQ, "uPointSize", ea);
6766 d8.useProgram(bT);
6767 d2("pointSizeUnlitShape", bT, "uPointSize", ea);
6768 d8.lineWidth(ea)
6769 };
6770 cW.strokeCap = function(ea) {
6771 dY.$ensureContext().lineCap = ea
6772 };
6773 cW.strokeJoin = function(ea) {
6774 dY.$ensureContext().lineJoin = ea
6775 };
6776 bR.prototype.smooth = function() {
6777 dO = true;
6778 var ea = ae.style;
6779 ea.setProperty("image-rendering", "optimizeQuality", "important");
6780 ea.setProperty("-ms-interpolation-mode", "bicubic", "important");
6781 if (d8.hasOwnProperty("mozImageSmoothingEnabled")) {
6782 d8.mozImageSmoothingEnabled = true
6783 }
6784 };
6785 bB.prototype.smooth = function() {
6786 dO = true
6787 };
6788 bR.prototype.noSmooth = function() {
6789 dO = false;
6790 var ea = ae.style;
6791 ea.setProperty("image-rendering", "optimizeSpeed", "important");
6792 ea.setProperty("image-rendering", "-moz-crisp-edges", "important");
6793 ea.setProperty("image-rendering", "-webkit-optimize-contrast", "important");
6794 ea.setProperty("image-rendering", "optimize-contrast", "important");
6795 ea.setProperty("-ms-interpolation-mode", "nearest-neighbor", "important");
6796 if (d8.hasOwnProperty("mozImageSmoothingEnabled")) {
6797 d8.mozImageSmoothingEnabled = false
6798 }
6799 };
6800 bB.prototype.noSmooth = function() {
6801 dO = false
6802 };
6803 bR.prototype.point = function(ea, eb) {
6804 if (!ce) {
6805 return
6806 }
6807 ea = q.round(ea);
6808 eb = q.round(eb);
6809 d8.fillStyle = cW.color.toString(cv);
6810 aq = true;
6811 if (dW > 1) {
6812 d8.beginPath();
6813 d8.arc(ea, eb, dW / 2, 0, 6.283185307179586, false);
6814 d8.fill()
6815 } else {
6816 d8.fillRect(ea, eb, 1, 1)
6817 }
6818 };
6819 bB.prototype.point = function(ea, ee, ed) {
6820 var ec = new aP;
6821 ec.translate(ea, ee, ed || 0);
6822 ec.transpose();
6823 var eb = new aP;
6824 eb.scale(1, -1, 1);
6825 eb.apply(dJ.array());
6826 eb.transpose();
6827 d8.useProgram(dQ);
6828 a9("uModel2d", dQ, "uModel", false, ec.array());
6829 a9("uView2d", dQ, "uView", false, eb.array());
6830 if (dW > 0 && ce) {
6831 d2("uColor2d", dQ, "uColor", c0);
6832 dZ("uIsDrawingText2d", dQ, "uIsDrawingText", false);
6833 dZ("uSmooth2d", dQ, "uSmooth", dO);
6834 dc("aVertex2d", dQ, "aVertex", 3, aw);
6835 cg("aTextureCoord2d", dQ, "aTextureCoord");
6836 d8.drawArrays(d8.POINTS, 0, 1)
6837 }
6838 };
6839 cW.beginShape = function(ea) {
6840 dR = ea;
6841 d6 = [];
6842 bb = []
6843 };
6844 bR.prototype.vertex = function(eb, ed, ea) {
6845 var ec = [];
6846 if (du) {
6847 du = false
6848 }
6849 ec.isVert = true;
6850 ec[0] = eb;
6851 ec[1] = ed;
6852 ec[2] = 0;
6853 ec[3] = 0;
6854 ec[4] = 0;
6855 ec[5] = a1;
6856 ec[6] = cv;
6857 bb.push(ec);
6858 if (ea) {
6859 bb[bb.length - 1]["moveTo"] = ea
6860 }
6861 };
6862 bB.prototype.vertex = function(ea, ef, ee, ed, ec) {
6863 var eb = [];
6864 if (du) {
6865 du = false
6866 }
6867 eb.isVert = true;
6868 if (ec === t && dT) {
6869 ec = ed;
6870 ed = ee;
6871 ee = 0
6872 }
6873 if (ed !== t && ec !== t) {
6874 if (d4 === 2) {
6875 ed /= cs.width;
6876 ec /= cs.height
6877 }
6878 ed = ed > 1 ? 1 : ed;
6879 ed = ed < 0 ? 0 : ed;
6880 ec = ec > 1 ? 1 : ec;
6881 ec = ec < 0 ? 0 : ec
6882 }
6883 eb[0] = ea;
6884 eb[1] = ef;
6885 eb[2] = ee || 0;
6886 eb[3] = ed || 0;
6887 eb[4] = ec || 0;
6888 eb[5] = bo[0];
6889 eb[6] = bo[1];
6890 eb[7] = bo[2];
6891 eb[8] = bo[3];
6892 eb[9] = c0[0];
6893 eb[10] = c0[1];
6894 eb[11] = c0[2];
6895 eb[12] = c0[3];
6896 eb[13] = a8;
6897 eb[14] = a7;
6898 eb[15] = a6;
6899 bb.push(eb)
6900 };
6901 var d1 = function(ec, eb) {
6902 var ea = new aP;
6903 ea.scale(1, -1, 1);
6904 ea.apply(dJ.array());
6905 ea.transpose();
6906 d8.useProgram(bT);
6907 a9("uViewUS", bT, "uView", false, ea.array());
6908 dZ("uSmoothUS", bT, "uSmooth", dO);
6909 dc("aVertexUS", bT, "aVertex", 3, aw);
6910 d8.bufferData(d8.ARRAY_BUFFER, new e(ec), d8.STREAM_DRAW);
6911 dc("aColorUS", bT, "aColor", 4, aG);
6912 d8.bufferData(d8.ARRAY_BUFFER, new e(eb), d8.STREAM_DRAW);
6913 d8.drawArrays(d8.POINTS, 0, ec.length / 3)
6914 };
6915 var bj = function(ee, ed, ec) {
6916 var eb;
6917 if (ed === "LINES") {
6918 eb = d8.LINES
6919 } else {
6920 if (ed === "LINE_LOOP") {
6921 eb = d8.LINE_LOOP
6922 } else {
6923 eb = d8.LINE_STRIP
6924 }
6925 }
6926 var ea = new aP;
6927 ea.scale(1, -1, 1);
6928 ea.apply(dJ.array());
6929 ea.transpose();
6930 d8.useProgram(bT);
6931 a9("uViewUS", bT, "uView", false, ea.array());
6932 dc("aVertexUS", bT, "aVertex", 3, b8);
6933 d8.bufferData(d8.ARRAY_BUFFER, new e(ee), d8.STREAM_DRAW);
6934 dc("aColorUS", bT, "aColor", 4, bC);
6935 d8.bufferData(d8.ARRAY_BUFFER, new e(ec), d8.STREAM_DRAW);
6936 d8.drawArrays(eb, 0, ee.length / 3)
6937 };
6938 var dm = function(ef, ee, ed, ec) {
6939 var eb;
6940 if (ee === "TRIANGLES") {
6941 eb = d8.TRIANGLES
6942 } else {
6943 if (ee === "TRIANGLE_FAN") {
6944 eb = d8.TRIANGLE_FAN
6945 } else {
6946 eb = d8.TRIANGLE_STRIP
6947 }
6948 }
6949 var ea = new aP;
6950 ea.scale(1, -1, 1);
6951 ea.apply(dJ.array());
6952 ea.transpose();
6953 d8.useProgram(dx);
6954 a9("model3d", dx, "uModel", false, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
6955 a9("view3d", dx, "uView", false, ea.array());
6956 d8.enable(d8.POLYGON_OFFSET_FILL);
6957 d8.polygonOffset(1, 1);
6958 d2("color3d", dx, "uColor", [-1, 0, 0, 0]);
6959 dc("vertex3d", dx, "aVertex", 3, at);
6960 d8.bufferData(d8.ARRAY_BUFFER, new e(ef), d8.STREAM_DRAW);
6961 if (dT && bf !== null) {
6962 bw(ed)
6963 }
6964 dc("aColor3d", dx, "aColor", 4, aG);
6965 d8.bufferData(d8.ARRAY_BUFFER, new e(ed), d8.STREAM_DRAW);
6966 cg("aNormal3d", dx, "aNormal");
6967 if (dT) {
6968 dZ("uUsingTexture3d", dx, "uUsingTexture", dT);
6969 dc("aTexture3d", dx, "aTexture", 2, af);
6970 d8.bufferData(d8.ARRAY_BUFFER, new e(ec), d8.STREAM_DRAW)
6971 }
6972 d8.drawArrays(eb, 0, ef.length / 3);
6973 d8.disable(d8.POLYGON_OFFSET_FILL)
6974 };
6975
6976 function cS() {
6977 bn();
6978 dd();
6979 d8.closePath()
6980 }
6981 bR.prototype.endShape = function(eh) {
6982 if (bb.length === 0) {
6983 return
6984 }
6985 var ed = eh === 2;
6986 if (ed) {
6987 bb.push(bb[0])
6988 }
6989 var ec = [];
6990 var ea = [];
6991 var ej = [];
6992 var em = [];
6993 var ef = [];
6994 var ei;
6995 du = true;
6996 var eg, ee, eb;
6997 var el = bb.length;
6998 for (eg = 0; eg < el; eg++) {
6999 ei = bb[eg];
7000 for (ee = 0; ee < 3; ee++) {
7001 ea.push(ei[ee])
7002 }
7003 }
7004 for (eg = 0; eg < el; eg++) {
7005 ei = bb[eg];
7006 for (ee = 5; ee < 9; ee++) {
7007 ej.push(ei[ee])
7008 }
7009 }
7010 for (eg = 0; eg < el; eg++) {
7011 ei = bb[eg];
7012 for (ee = 9; ee < 13; ee++) {
7013 em.push(ei[ee])
7014 }
7015 }
7016 for (eg = 0; eg < el; eg++) {
7017 ei = bb[eg];
7018 ef.push(ei[3]);
7019 ef.push(ei[4])
7020 }
7021 if (dP && (dR === 20 || dR === t)) {
7022 if (el > 3) {
7023 var ek = [],
7024 en = 1 - aJ;
7025 d8.beginPath();
7026 d8.moveTo(bb[1][0], bb[1][1]);
7027 for (eg = 1; eg + 2 < el; eg++) {
7028 ei = bb[eg];
7029 ek[0] = [ei[0], ei[1]];
7030 ek[1] = [ei[0] + (en * bb[eg + 1][0] - en * bb[eg - 1][0]) / 6, ei[1] + (en * bb[eg + 1][1] - en * bb[eg - 1][1]) / 6];
7031 ek[2] = [bb[eg + 1][0] + (en * bb[eg][0] - en * bb[eg + 2][0]) / 6, bb[eg + 1][1] + (en * bb[eg][1] - en * bb[eg + 2][1]) / 6];
7032 ek[3] = [bb[eg + 1][0], bb[eg + 1][1]];
7033 d8.bezierCurveTo(ek[1][0], ek[1][1], ek[2][0], ek[2][1], ek[3][0], ek[3][1])
7034 }
7035 cS()
7036 }
7037 } else {
7038 if (aa && (dR === 20 || dR === t)) {
7039 d8.beginPath();
7040 for (eg = 0; eg < el; eg++) {
7041 ei = bb[eg];
7042 if (bb[eg]["isVert"]) {
7043 if (bb[eg]["moveTo"]) {
7044 d8.moveTo(ei[0], ei[1])
7045 } else {
7046 d8.lineTo(ei[0], ei[1])
7047 }
7048 } else {
7049 d8.bezierCurveTo(bb[eg][0], bb[eg][1], bb[eg][2], bb[eg][3], bb[eg][4], bb[eg][5])
7050 }
7051 }
7052 cS()
7053 } else {
7054 if (dR === 2) {
7055 for (eg = 0; eg < el; eg++) {
7056 ei = bb[eg];
7057 if (ce) {
7058 cW.stroke(ei[6])
7059 }
7060 cW.point(ei[0], ei[1])
7061 }
7062 } else {
7063 if (dR === 4) {
7064 for (eg = 0; eg + 1 < el; eg += 2) {
7065 ei = bb[eg];
7066 if (ce) {
7067 cW.stroke(bb[eg + 1][6])
7068 }
7069 cW.line(ei[0], ei[1], bb[eg + 1][0], bb[eg + 1][1])
7070 }
7071 } else {
7072 if (dR === 9) {
7073 for (eg = 0; eg + 2 < el; eg += 3) {
7074 ei = bb[eg];
7075 d8.beginPath();
7076 d8.moveTo(ei[0], ei[1]);
7077 d8.lineTo(bb[eg + 1][0], bb[eg + 1][1]);
7078 d8.lineTo(bb[eg + 2][0], bb[eg + 2][1]);
7079 d8.lineTo(ei[0], ei[1]);
7080 if (aH) {
7081 cW.fill(bb[eg + 2][5]);
7082 bn()
7083 }
7084 if (ce) {
7085 cW.stroke(bb[eg + 2][6]);
7086 dd()
7087 }
7088 d8.closePath()
7089 }
7090 } else {
7091 if (dR === 10) {
7092 for (eg = 0; eg + 1 < el; eg++) {
7093 ei = bb[eg];
7094 d8.beginPath();
7095 d8.moveTo(bb[eg + 1][0], bb[eg + 1][1]);
7096 d8.lineTo(ei[0], ei[1]);
7097 if (ce) {
7098 cW.stroke(bb[eg + 1][6])
7099 }
7100 if (aH) {
7101 cW.fill(bb[eg + 1][5])
7102 }
7103 if (eg + 2 < el) {
7104 d8.lineTo(bb[eg + 2][0], bb[eg + 2][1]);
7105 if (ce) {
7106 cW.stroke(bb[eg + 2][6])
7107 }
7108 if (aH) {
7109 cW.fill(bb[eg + 2][5])
7110 }
7111 }
7112 cS()
7113 }
7114 } else {
7115 if (dR === 11) {
7116 if (el > 2) {
7117 d8.beginPath();
7118 d8.moveTo(bb[0][0], bb[0][1]);
7119 d8.lineTo(bb[1][0], bb[1][1]);
7120 d8.lineTo(bb[2][0], bb[2][1]);
7121 if (aH) {
7122 cW.fill(bb[2][5]);
7123 bn()
7124 }
7125 if (ce) {
7126 cW.stroke(bb[2][6]);
7127 dd()
7128 }
7129 d8.closePath();
7130 for (eg = 3; eg < el; eg++) {
7131 ei = bb[eg];
7132 d8.beginPath();
7133 d8.moveTo(bb[0][0], bb[0][1]);
7134 d8.lineTo(bb[eg - 1][0], bb[eg - 1][1]);
7135 d8.lineTo(ei[0], ei[1]);
7136 if (aH) {
7137 cW.fill(ei[5]);
7138 bn()
7139 }
7140 if (ce) {
7141 cW.stroke(ei[6]);
7142 dd()
7143 }
7144 d8.closePath()
7145 }
7146 }
7147 } else {
7148 if (dR === 16) {
7149 for (eg = 0; eg + 3 < el; eg += 4) {
7150 ei = bb[eg];
7151 d8.beginPath();
7152 d8.moveTo(ei[0], ei[1]);
7153 for (ee = 1; ee < 4; ee++) {
7154 d8.lineTo(bb[eg + ee][0], bb[eg + ee][1])
7155 }
7156 d8.lineTo(ei[0], ei[1]);
7157 if (aH) {
7158 cW.fill(bb[eg + 3][5]);
7159 bn()
7160 }
7161 if (ce) {
7162 cW.stroke(bb[eg + 3][6]);
7163 dd()
7164 }
7165 d8.closePath()
7166 }
7167 } else {
7168 if (dR === 17) {
7169 if (el > 3) {
7170 for (eg = 0; eg + 1 < el; eg += 2) {
7171 ei = bb[eg];
7172 d8.beginPath();
7173 if (eg + 3 < el) {
7174 d8.moveTo(bb[eg + 2][0], bb[eg + 2][1]);
7175 d8.lineTo(ei[0], ei[1]);
7176 d8.lineTo(bb[eg + 1][0], bb[eg + 1][1]);
7177 d8.lineTo(bb[eg + 3][0], bb[eg + 3][1]);
7178 if (aH) {
7179 cW.fill(bb[eg + 3][5])
7180 }
7181 if (ce) {
7182 cW.stroke(bb[eg + 3][6])
7183 }
7184 } else {
7185 d8.moveTo(ei[0], ei[1]);
7186 d8.lineTo(bb[eg + 1][0], bb[eg + 1][1])
7187 }
7188 cS()
7189 }
7190 }
7191 } else {
7192 d8.beginPath();
7193 d8.moveTo(bb[0][0], bb[0][1]);
7194 for (eg = 1; eg < el; eg++) {
7195 ei = bb[eg];
7196 if (ei.isVert) {
7197 if (ei.moveTo) {
7198 d8.moveTo(ei[0], ei[1])
7199 } else {
7200 d8.lineTo(ei[0], ei[1])
7201 }
7202 }
7203 }
7204 cS()
7205 }
7206 }
7207 }
7208 }
7209 }
7210 }
7211 }
7212 }
7213 }
7214 dP = false;
7215 aa = false;
7216 cb = [];
7217 c2 = 0;
7218 if (ed) {
7219 bb.pop()
7220 }
7221 };
7222 bB.prototype.endShape = function(eh) {
7223 if (bb.length === 0) {
7224 return
7225 }
7226 var ed = eh === 2;
7227 var ec = [];
7228 var ea = [];
7229 var ej = [];
7230 var em = [];
7231 var ef = [];
7232 var ei;
7233 du = true;
7234 var eg, ee, eb;
7235 var el = bb.length;
7236 for (eg = 0; eg < el; eg++) {
7237 ei = bb[eg];
7238 for (ee = 0; ee < 3; ee++) {
7239 ea.push(ei[ee])
7240 }
7241 }
7242 for (eg = 0; eg < el; eg++) {
7243 ei = bb[eg];
7244 for (ee = 5; ee < 9; ee++) {
7245 ej.push(ei[ee])
7246 }
7247 }
7248 for (eg = 0; eg < el; eg++) {
7249 ei = bb[eg];
7250 for (ee = 9; ee < 13; ee++) {
7251 em.push(ei[ee])
7252 }
7253 }
7254 for (eg = 0; eg < el; eg++) {
7255 ei = bb[eg];
7256 ef.push(ei[3]);
7257 ef.push(ei[4])
7258 }
7259 if (ed) {
7260 ea.push(bb[0][0]);
7261 ea.push(bb[0][1]);
7262 ea.push(bb[0][2]);
7263 for (eg = 5; eg < 9; eg++) {
7264 ej.push(bb[0][eg])
7265 }
7266 for (eg = 9; eg < 13; eg++) {
7267 em.push(bb[0][eg])
7268 }
7269 ef.push(bb[0][3]);
7270 ef.push(bb[0][4])
7271 }
7272 if (dP && (dR === 20 || dR === t)) {
7273 ec = ea;
7274 if (ce) {
7275 bj(ec, null, em)
7276 }
7277 if (aH) {
7278 dm(ea, null, ej)
7279 }
7280 } else {
7281 if (aa && (dR === 20 || dR === t)) {
7282 ec = ea;
7283 ec.splice(ec.length - 3);
7284 em.splice(em.length - 4);
7285 if (ce) {
7286 bj(ec, null, em)
7287 }
7288 if (aH) {
7289 dm(ea, "TRIANGLES", ej)
7290 }
7291 } else {
7292 if (dR === 2) {
7293 for (eg = 0; eg < el; eg++) {
7294 ei = bb[eg];
7295 for (ee = 0; ee < 3; ee++) {
7296 ec.push(ei[ee])
7297 }
7298 }
7299 d1(ec, em)
7300 } else {
7301 if (dR === 4) {
7302 for (eg = 0; eg < el; eg++) {
7303 ei = bb[eg];
7304 for (ee = 0; ee < 3; ee++) {
7305 ec.push(ei[ee])
7306 }
7307 }
7308 for (eg = 0; eg < el; eg++) {
7309 ei = bb[eg];
7310 for (ee = 5; ee < 9; ee++) {
7311 ej.push(ei[ee])
7312 }
7313 }
7314 bj(ec, "LINES", em)
7315 } else {
7316 if (dR === 9) {
7317 if (el > 2) {
7318 for (eg = 0; eg + 2 < el; eg += 3) {
7319 ea = [];
7320 ef = [];
7321 ec = [];
7322 ej = [];
7323 em = [];
7324 for (ee = 0; ee < 3; ee++) {
7325 for (eb = 0; eb < 3; eb++) {
7326 ec.push(bb[eg + ee][eb]);
7327 ea.push(bb[eg + ee][eb])
7328 }
7329 }
7330 for (ee = 0; ee < 3; ee++) {
7331 for (eb = 3; eb < 5; eb++) {
7332 ef.push(bb[eg + ee][eb])
7333 }
7334 }
7335 for (ee = 0; ee < 3; ee++) {
7336 for (eb = 5; eb < 9; eb++) {
7337 ej.push(bb[eg + ee][eb]);
7338 em.push(bb[eg + ee][eb + 4])
7339 }
7340 }
7341 if (ce) {
7342 bj(ec, "LINE_LOOP", em)
7343 }
7344 if (aH || dT) {
7345 dm(ea, "TRIANGLES", ej, ef)
7346 }
7347 }
7348 }
7349 } else {
7350 if (dR === 10) {
7351 if (el > 2) {
7352 for (eg = 0; eg + 2 < el; eg++) {
7353 ec = [];
7354 ea = [];
7355 em = [];
7356 ej = [];
7357 ef = [];
7358 for (ee = 0; ee < 3; ee++) {
7359 for (eb = 0; eb < 3; eb++) {
7360 ec.push(bb[eg + ee][eb]);
7361 ea.push(bb[eg + ee][eb])
7362 }
7363 }
7364 for (ee = 0; ee < 3; ee++) {
7365 for (eb = 3; eb < 5; eb++) {
7366 ef.push(bb[eg + ee][eb])
7367 }
7368 }
7369 for (ee = 0; ee < 3; ee++) {
7370 for (eb = 5; eb < 9; eb++) {
7371 em.push(bb[eg + ee][eb + 4]);
7372 ej.push(bb[eg + ee][eb])
7373 }
7374 }
7375 if (aH || dT) {
7376 dm(ea, "TRIANGLE_STRIP", ej, ef)
7377 }
7378 if (ce) {
7379 bj(ec, "LINE_LOOP", em)
7380 }
7381 }
7382 }
7383 } else {
7384 if (dR === 11) {
7385 if (el > 2) {
7386 for (eg = 0; eg < 3; eg++) {
7387 ei = bb[eg];
7388 for (ee = 0; ee < 3; ee++) {
7389 ec.push(ei[ee])
7390 }
7391 }
7392 for (eg = 0; eg < 3; eg++) {
7393 ei = bb[eg];
7394 for (ee = 9; ee < 13; ee++) {
7395 em.push(ei[ee])
7396 }
7397 }
7398 if (ce) {
7399 bj(ec, "LINE_LOOP", em)
7400 }
7401 for (eg = 2; eg + 1 < el; eg++) {
7402 ec = [];
7403 em = [];
7404 ec.push(bb[0][0]);
7405 ec.push(bb[0][1]);
7406 ec.push(bb[0][2]);
7407 em.push(bb[0][9]);
7408 em.push(bb[0][10]);
7409 em.push(bb[0][11]);
7410 em.push(bb[0][12]);
7411 for (ee = 0; ee < 2; ee++) {
7412 for (eb = 0; eb < 3; eb++) {
7413 ec.push(bb[eg + ee][eb])
7414 }
7415 }
7416 for (ee = 0; ee < 2; ee++) {
7417 for (eb = 9; eb < 13; eb++) {
7418 em.push(bb[eg + ee][eb])
7419 }
7420 }
7421 if (ce) {
7422 bj(ec, "LINE_STRIP", em)
7423 }
7424 }
7425 if (aH || dT) {
7426 dm(ea, "TRIANGLE_FAN", ej, ef)
7427 }
7428 }
7429 } else {
7430 if (dR === 16) {
7431 for (eg = 0; eg + 3 < el; eg += 4) {
7432 ec = [];
7433 for (ee = 0; ee < 4; ee++) {
7434 ei = bb[eg + ee];
7435 for (eb = 0; eb < 3; eb++) {
7436 ec.push(ei[eb])
7437 }
7438 }
7439 if (ce) {
7440 bj(ec, "LINE_LOOP", em)
7441 }
7442 if (aH) {
7443 ea = [];
7444 ej = [];
7445 ef = [];
7446 for (ee = 0; ee < 3; ee++) {
7447 ea.push(bb[eg][ee])
7448 }
7449 for (ee = 5; ee < 9; ee++) {
7450 ej.push(bb[eg][ee])
7451 }
7452 for (ee = 0; ee < 3; ee++) {
7453 ea.push(bb[eg + 1][ee])
7454 }
7455 for (ee = 5; ee < 9; ee++) {
7456 ej.push(bb[eg + 1][ee])
7457 }
7458 for (ee = 0; ee < 3; ee++) {
7459 ea.push(bb[eg + 3][ee])
7460 }
7461 for (ee = 5; ee < 9; ee++) {
7462 ej.push(bb[eg + 3][ee])
7463 }
7464 for (ee = 0; ee < 3; ee++) {
7465 ea.push(bb[eg + 2][ee])
7466 }
7467 for (ee = 5; ee < 9; ee++) {
7468 ej.push(bb[eg + 2][ee])
7469 }
7470 if (dT) {
7471 ef.push(bb[eg + 0][3]);
7472 ef.push(bb[eg + 0][4]);
7473 ef.push(bb[eg + 1][3]);
7474 ef.push(bb[eg + 1][4]);
7475 ef.push(bb[eg + 3][3]);
7476 ef.push(bb[eg + 3][4]);
7477 ef.push(bb[eg + 2][3]);
7478 ef.push(bb[eg + 2][4])
7479 }
7480 dm(ea, "TRIANGLE_STRIP", ej, ef)
7481 }
7482 }
7483 } else {
7484 if (dR === 17) {
7485 var ek = [];
7486 if (el > 3) {
7487 for (eg = 0; eg < 2; eg++) {
7488 ei = bb[eg];
7489 for (ee = 0; ee < 3; ee++) {
7490 ec.push(ei[ee])
7491 }
7492 }
7493 for (eg = 0; eg < 2; eg++) {
7494 ei = bb[eg];
7495 for (ee = 9; ee < 13; ee++) {
7496 em.push(ei[ee])
7497 }
7498 }
7499 bj(ec, "LINE_STRIP", em);
7500 if (el > 4 && el % 2 > 0) {
7501 ek = ea.splice(ea.length - 3);
7502 bb.pop()
7503 }
7504 for (eg = 0; eg + 3 < el; eg += 2) {
7505 ec = [];
7506 em = [];
7507 for (ee = 0; ee < 3; ee++) {
7508 ec.push(bb[eg + 1][ee])
7509 }
7510 for (ee = 0; ee < 3; ee++) {
7511 ec.push(bb[eg + 3][ee])
7512 }
7513 for (ee = 0; ee < 3; ee++) {
7514 ec.push(bb[eg + 2][ee])
7515 }
7516 for (ee = 0; ee < 3; ee++) {
7517 ec.push(bb[eg + 0][ee])
7518 }
7519 for (ee = 9; ee < 13; ee++) {
7520 em.push(bb[eg + 1][ee])
7521 }
7522 for (ee = 9; ee < 13; ee++) {
7523 em.push(bb[eg + 3][ee])
7524 }
7525 for (ee = 9; ee < 13; ee++) {
7526 em.push(bb[eg + 2][ee])
7527 }
7528 for (ee = 9; ee < 13; ee++) {
7529 em.push(bb[eg + 0][ee])
7530 }
7531 if (ce) {
7532 bj(ec, "LINE_STRIP", em)
7533 }
7534 }
7535 if (aH || dT) {
7536 dm(ea, "TRIANGLE_LIST", ej, ef)
7537 }
7538 }
7539 } else {
7540 if (el === 1) {
7541 for (ee = 0; ee < 3; ee++) {
7542 ec.push(bb[0][ee])
7543 }
7544 for (ee = 9; ee < 13; ee++) {
7545 em.push(bb[0][ee])
7546 }
7547 d1(ec, em)
7548 } else {
7549 for (eg = 0; eg < el; eg++) {
7550 ei = bb[eg];
7551 for (ee = 0; ee < 3; ee++) {
7552 ec.push(ei[ee])
7553 }
7554 for (ee = 5; ee < 9; ee++) {
7555 em.push(ei[ee])
7556 }
7557 }
7558 if (ce && ed) {
7559 bj(ec, "LINE_LOOP", em)
7560 } else {
7561 if (ce && !ed) {
7562 bj(ec, "LINE_STRIP", em)
7563 }
7564 } if (aH || dT) {
7565 dm(ea, "TRIANGLE_FAN", ej, ef)
7566 }
7567 }
7568 }
7569 }
7570 }
7571 }
7572 }
7573 }
7574 }
7575 dT = false;
7576 d8.useProgram(dx);
7577 dZ("usingTexture3d", dx, "uUsingTexture", dT)
7578 }
7579 }
7580 dP = false;
7581 aa = false;
7582 cb = [];
7583 c2 = 0
7584 };
7585 var aY = function(ed, ec) {
7586 var ee = 1 / ed;
7587 var eb = ee * ee;
7588 var ea = eb * ee;
7589 ec.set(0, 0, 0, 1, ea, eb, ee, 0, 6 * ea, 2 * eb, 0, 0, 6 * ea, 0, 0, 0)
7590 };
7591 var dr = function() {
7592 if (!aL) {
7593 c3 = new aP;
7594 aL = new aP;
7595 cM = true
7596 }
7597 var ea = aJ;
7598 c3.set((ea - 1) / 2, (ea + 3) / 2, (-3 - ea) / 2, (1 - ea) / 2, 1 - ea, (-5 - ea) / 2, ea + 2, (ea - 1) / 2, (ea - 1) / 2, 0, (1 - ea) / 2, 0, 0, 1, 0, 0);
7599 aY(Q, aL);
7600 if (!cd) {
7601 aQ = new aP
7602 }
7603 aQ.set(c3);
7604 aQ.preApply(cd);
7605 aL.apply(c3)
7606 };
7607 bR.prototype.bezierVertex = function() {
7608 aa = true;
7609 var ea = [];
7610 if (du) {
7611 throw "vertex() must be used at least once before calling bezierVertex()"
7612 }
7613 for (var eb = 0; eb < arguments.length; eb++) {
7614 ea[eb] = arguments[eb]
7615 }
7616 bb.push(ea);
7617 bb[bb.length - 1]["isVert"] = false
7618 };
7619 bB.prototype.bezierVertex = function() {
7620 aa = true;
7621 var eh = [];
7622 if (du) {
7623 throw "vertex() must be used at least once before calling bezierVertex()"
7624 }
7625 if (arguments.length === 9) {
7626 if (bz === t) {
7627 bz = new aP
7628 }
7629 var em = bb.length - 1;
7630 aY(cy, bz);
7631 bz.apply(U);
7632 var eo = bz.array();
7633 var ed = bb[em][0],
7634 en = bb[em][1],
7635 eg = bb[em][2];
7636 var ej = eo[4] * ed + eo[5] * arguments[0] + eo[6] * arguments[3] + eo[7] * arguments[6];
7637 var ei = eo[8] * ed + eo[9] * arguments[0] + eo[10] * arguments[3] + eo[11] * arguments[6];
7638 var ef = eo[12] * ed + eo[13] * arguments[0] + eo[14] * arguments[3] + eo[15] * arguments[6];
7639 var ep = eo[4] * en + eo[5] * arguments[1] + eo[6] * arguments[4] + eo[7] * arguments[7];
7640 var el = eo[8] * en + eo[9] * arguments[1] + eo[10] * arguments[4] + eo[11] * arguments[7];
7641 var ek = eo[12] * en + eo[13] * arguments[1] + eo[14] * arguments[4] + eo[15] * arguments[7];
7642 var ec = eo[4] * eg + eo[5] * arguments[2] + eo[6] * arguments[5] + eo[7] * arguments[8];
7643 var eb = eo[8] * eg + eo[9] * arguments[2] + eo[10] * arguments[5] + eo[11] * arguments[8];
7644 var ea = eo[12] * eg + eo[13] * arguments[2] + eo[14] * arguments[5] + eo[15] * arguments[8];
7645 for (var ee = 0; ee < cy; ee++) {
7646 ed += ej;
7647 ej += ei;
7648 ei += ef;
7649 en += ep;
7650 ep += el;
7651 el += ek;
7652 eg += ec;
7653 ec += eb;
7654 eb += ea;
7655 cW.vertex(ed, en, eg)
7656 }
7657 cW.vertex(arguments[6], arguments[7], arguments[8])
7658 }
7659 };
7660 cW.texture = function(ed) {
7661 var eb = dY.$ensureContext();
7662 if (ed.__texture) {
7663 eb.bindTexture(eb.TEXTURE_2D, ed.__texture)
7664 } else {
7665 if (ed.localName === "canvas") {
7666 eb.bindTexture(eb.TEXTURE_2D, c7);
7667 eb.texImage2D(eb.TEXTURE_2D, 0, eb.RGBA, eb.RGBA, eb.UNSIGNED_BYTE, ed);
7668 eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MAG_FILTER, eb.LINEAR);
7669 eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MIN_FILTER, eb.LINEAR);
7670 eb.generateMipmap(eb.TEXTURE_2D);
7671 cs.width = ed.width;
7672 cs.height = ed.height
7673 } else {
7674 var ec = eb.createTexture(),
7675 ef = d.createElement("canvas"),
7676 ea = ef.getContext("2d"),
7677 ee;
7678 if (ed.width & ed.width - 1 === 0) {
7679 ef.width = ed.width
7680 } else {
7681 ee = 1;
7682 while (ee < ed.width) {
7683 ee *= 2
7684 }
7685 ef.width = ee
7686 } if (ed.height & ed.height - 1 === 0) {
7687 ef.height = ed.height
7688 } else {
7689 ee = 1;
7690 while (ee < ed.height) {
7691 ee *= 2
7692 }
7693 ef.height = ee
7694 }
7695 ea.drawImage(ed.sourceImg, 0, 0, ed.width, ed.height, 0, 0, ef.width, ef.height);
7696 eb.bindTexture(eb.TEXTURE_2D, ec);
7697 eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MIN_FILTER, eb.LINEAR_MIPMAP_LINEAR);
7698 eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_MAG_FILTER, eb.LINEAR);
7699 eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_WRAP_T, eb.CLAMP_TO_EDGE);
7700 eb.texParameteri(eb.TEXTURE_2D, eb.TEXTURE_WRAP_S, eb.CLAMP_TO_EDGE);
7701 eb.texImage2D(eb.TEXTURE_2D, 0, eb.RGBA, eb.RGBA, eb.UNSIGNED_BYTE, ef);
7702 eb.generateMipmap(eb.TEXTURE_2D);
7703 ed.__texture = ec;
7704 cs.width = ed.width;
7705 cs.height = ed.height
7706 }
7707 }
7708 dT = true;
7709 eb.useProgram(dx);
7710 dZ("usingTexture3d", dx, "uUsingTexture", dT)
7711 };
7712 cW.textureMode = function(ea) {
7713 d4 = ea
7714 };
7715 var ar = function(ev, eg, em, et, ef, el, er, ee, ek, ep, ed, ei) {
7716 var ew = et;
7717 var eh = ef;
7718 var en = el;
7719 var ej = aL.array();
7720 var eu = ej[4] * ev + ej[5] * et + ej[6] * er + ej[7] * ep;
7721 var es = ej[8] * ev + ej[9] * et + ej[10] * er + ej[11] * ep;
7722 var eq = ej[12] * ev + ej[13] * et + ej[14] * er + ej[15] * ep;
7723 var ez = ej[4] * eg + ej[5] * ef + ej[6] * ee + ej[7] * ed;
7724 var ey = ej[8] * eg + ej[9] * ef + ej[10] * ee + ej[11] * ed;
7725 var ex = ej[12] * eg + ej[13] * ef + ej[14] * ee + ej[15] * ed;
7726 var ec = ej[4] * em + ej[5] * el + ej[6] * ek + ej[7] * ei;
7727 var eb = ej[8] * em + ej[9] * el + ej[10] * ek + ej[11] * ei;
7728 var ea = ej[12] * em + ej[13] * el + ej[14] * ek + ej[15] * ei;
7729 cW.vertex(ew, eh, en);
7730 for (var eo = 0; eo < Q; eo++) {
7731 ew += eu;
7732 eu += es;
7733 es += eq;
7734 eh += ez;
7735 ez += ey;
7736 ey += ex;
7737 en += ec;
7738 ec += eb;
7739 eb += ea;
7740 cW.vertex(ew, eh, en)
7741 }
7742 };
7743 bR.prototype.curveVertex = function(ea, eb) {
7744 dP = true;
7745 cW.vertex(ea, eb)
7746 };
7747 bB.prototype.curveVertex = function(ea, ed, ec) {
7748 dP = true;
7749 if (!cM) {
7750 dr()
7751 }
7752 var eb = [];
7753 eb[0] = ea;
7754 eb[1] = ed;
7755 eb[2] = ec;
7756 cb.push(eb);
7757 c2++;
7758 if (c2 > 3) {
7759 ar(cb[c2 - 4][0], cb[c2 - 4][1], cb[c2 - 4][2], cb[c2 - 3][0], cb[c2 - 3][1], cb[c2 - 3][2], cb[c2 - 2][0], cb[c2 - 2][1], cb[c2 - 2][2], cb[c2 - 1][0], cb[c2 - 1][1], cb[c2 - 1][2])
7760 }
7761 };
7762 bR.prototype.curve = function(ef, eh, ed, eg, eb, ee, ea, ec) {
7763 cW.beginShape();
7764 cW.curveVertex(ef, eh);
7765 cW.curveVertex(ed, eg);
7766 cW.curveVertex(eb, ee);
7767 cW.curveVertex(ea, ec);
7768 cW.endShape()
7769 };
7770 bB.prototype.curve = function(ec, ek, eg, eb, ej, ef, ea, ei, ee, el, eh, ed) {
7771 if (ed !== t) {
7772 cW.beginShape();
7773 cW.curveVertex(ec, ek, eg);
7774 cW.curveVertex(eb, ej, ef);
7775 cW.curveVertex(ea, ei, ee);
7776 cW.curveVertex(el, eh, ed);
7777 cW.endShape();
7778 return
7779 }
7780 cW.beginShape();
7781 cW.curveVertex(ec, ek);
7782 cW.curveVertex(eg, eb);
7783 cW.curveVertex(ej, ef);
7784 cW.curveVertex(ea, ei);
7785 cW.endShape()
7786 };
7787 cW.curveTightness = function(ea) {
7788 aJ = ea
7789 };
7790 cW.curveDetail = function(ea) {
7791 Q = ea;
7792 dr()
7793 };
7794 cW.rectMode = function(ea) {
7795 bK = ea
7796 };
7797 cW.imageMode = function(ea) {
7798 switch (ea) {
7799 case 0:
7800 bk = aZ;
7801 break;
7802 case 1:
7803 bk = b1;
7804 break;
7805 case 3:
7806 bk = aN;
7807 break;
7808 default:
7809 throw "Invalid imageMode"
7810 }
7811 };
7812 cW.ellipseMode = function(ea) {
7813 cN = ea
7814 };
7815 cW.arc = function(em, ek, ed, eo, ec, el) {
7816 if (ed <= 0 || el < ec) {
7817 return
7818 }
7819 if (cN === 1) {
7820 ed = ed - em;
7821 eo = eo - ek
7822 } else {
7823 if (cN === 2) {
7824 em = em - ed;
7825 ek = ek - eo;
7826 ed = ed * 2;
7827 eo = eo * 2
7828 } else {
7829 if (cN === 3) {
7830 em = em - ed / 2;
7831 ek = ek - eo / 2
7832 }
7833 }
7834 }
7835 while (ec < 0) {
7836 ec += 6.283185307179586;
7837 el += 6.283185307179586
7838 }
7839 if (el - ec > 6.283185307179586) {
7840 ec = 0;
7841 el = 6.283185307179586
7842 }
7843 var en = ed / 2,
7844 ep = eo / 2,
7845 eh = em + en,
7846 ef = ek + ep,
7847 eb = 0 | 0.5 + ec * cW.RAD_TO_DEG * 2,
7848 ej = 0 | 0.5 + el * cW.RAD_TO_DEG * 2,
7849 ei, eg;
7850 if (aH) {
7851 var ee = ce;
7852 ce = false;
7853 cW.beginShape();
7854 cW.vertex(eh, ef);
7855 for (ei = eb; ei <= ej; ei++) {
7856 eg = ei % 720;
7857 cW.vertex(eh + bl[eg] * en, ef + ah[eg] * ep)
7858 }
7859 cW.endShape(2);
7860 ce = ee
7861 }
7862 if (ce) {
7863 var ea = aH;
7864 aH = false;
7865 cW.beginShape();
7866 for (ei = eb; ei <= ej; ei++) {
7867 eg = ei % 720;
7868 cW.vertex(eh + bl[eg] * en, ef + ah[eg] * ep)
7869 }
7870 cW.endShape();
7871 aH = ea
7872 }
7873 };
7874 bR.prototype.line = function(eb, ei, ea, eg) {
7875 if (!ce) {
7876 return
7877 }
7878 eb = q.round(eb);
7879 ea = q.round(ea);
7880 ei = q.round(ei);
7881 eg = q.round(eg);
7882 if (eb === ea && ei === eg) {
7883 cW.point(eb, ei);
7884 return
7885 }
7886 var ec = t,
7887 ej = t,
7888 ef = true,
7889 eh = dJ.array(),
7890 ed = [1, 0, 0, 0, 1, 0];
7891 for (var ee = 0; ee < 6 && ef; ee++) {
7892 ef = eh[ee] === ed[ee]
7893 }
7894 if (ef) {
7895 if (eb === ea) {
7896 if (ei > eg) {
7897 ec = ei;
7898 ei = eg;
7899 eg = ec
7900 }
7901 eg++;
7902 if (dW % 2 === 1) {
7903 d8.translate(0.5, 0)
7904 }
7905 } else {
7906 if (ei === eg) {
7907 if (eb > ea) {
7908 ec = eb;
7909 eb = ea;
7910 ea = ec
7911 }
7912 ea++;
7913 if (dW % 2 === 1) {
7914 d8.translate(0, 0.5)
7915 }
7916 }
7917 } if (dW === 1) {
7918 ej = d8.lineCap;
7919 d8.lineCap = "butt"
7920 }
7921 }
7922 d8.beginPath();
7923 d8.moveTo(eb || 0, ei || 0);
7924 d8.lineTo(ea || 0, eg || 0);
7925 dd();
7926 if (ef) {
7927 if (eb === ea && dW % 2 === 1) {
7928 d8.translate(-0.5, 0)
7929 } else {
7930 if (ei === eg && dW % 2 === 1) {
7931 d8.translate(0, -0.5)
7932 }
7933 } if (dW === 1) {
7934 d8.lineCap = ej
7935 }
7936 }
7937 };
7938 bB.prototype.line = function(ec, ef, eh, eb, ed, eg) {
7939 if (ed === t || eg === t) {
7940 eg = 0;
7941 ed = eb;
7942 eb = eh;
7943 eh = 0
7944 }
7945 if (ec === eb && ef === ed && eh === eg) {
7946 cW.point(ec, ef, eh);
7947 return
7948 }
7949 var ee = [ec, ef, eh, eb, ed, eg];
7950 var ea = new aP;
7951 ea.scale(1, -1, 1);
7952 ea.apply(dJ.array());
7953 ea.transpose();
7954 if (dW > 0 && ce) {
7955 d8.useProgram(dQ);
7956 a9("uModel2d", dQ, "uModel", false, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
7957 a9("uView2d", dQ, "uView", false, ea.array());
7958 d2("uColor2d", dQ, "uColor", c0);
7959 dZ("uIsDrawingText", dQ, "uIsDrawingText", false);
7960 dc("aVertex2d", dQ, "aVertex", 3, b8);
7961 cg("aTextureCoord2d", dQ, "aTextureCoord");
7962 d8.bufferData(d8.ARRAY_BUFFER, new e(ee), d8.STREAM_DRAW);
7963 d8.drawArrays(d8.LINES, 0, 2)
7964 }
7965 };
7966 bR.prototype.bezier = function() {
7967 if (arguments.length !== 8) {
7968 throw "You must use 8 parameters for bezier() in 2D mode"
7969 }
7970 cW.beginShape();
7971 cW.vertex(arguments[0], arguments[1]);
7972 cW.bezierVertex(arguments[2], arguments[3], arguments[4], arguments[5], arguments[6], arguments[7]);
7973 cW.endShape()
7974 };
7975 bB.prototype.bezier = function() {
7976 if (arguments.length !== 12) {
7977 throw "You must use 12 parameters for bezier() in 3D mode"
7978 }
7979 cW.beginShape();
7980 cW.vertex(arguments[0], arguments[1], arguments[2]);
7981 cW.bezierVertex(arguments[3], arguments[4], arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10], arguments[11]);
7982 cW.endShape()
7983 };
7984 cW.bezierDetail = function(ea) {
7985 cy = ea
7986 };
7987 cW.bezierPoint = function(eb, ea, ee, ed, ec) {
7988 return (1 - ec) * (1 - ec) * (1 - ec) * eb + 3 * (1 - ec) * (1 - ec) * ec * ea + 3 * (1 - ec) * ec * ec * ee + ec * ec * ec * ed
7989 };
7990 cW.bezierTangent = function(eb, ea, ee, ed, ec) {
7991 return 3 * ec * ec * (-eb + 3 * ea - 3 * ee + ed) + 6 * ec * (eb - 2 * ea + ee) + 3 * (-eb + ea)
7992 };
7993 cW.curvePoint = function(eb, ea, ee, ed, ec) {
7994 return 0.5 * (2 * ea + (-eb + ee) * ec + (2 * eb - 5 * ea + 4 * ee - ed) * ec * ec + (-eb + 3 * ea - 3 * ee + ed) * ec * ec * ec)
7995 };
7996 cW.curveTangent = function(eb, ea, ee, ed, ec) {
7997 return 0.5 * (-eb + ee + 2 * (2 * eb - 5 * ea + 4 * ee - ed) * ec + 3 * (-eb + 3 * ea - 3 * ee + ed) * ec * ec)
7998 };
7999 cW.triangle = function(ed, ef, eb, ee, ea, ec) {
8000 cW.beginShape(9);
8001 cW.vertex(ed, ef, 0);
8002 cW.vertex(eb, ee, 0);
8003 cW.vertex(ea, ec, 0);
8004 cW.endShape()
8005 };
8006 cW.quad = function(ef, eh, ed, eg, eb, ee, ea, ec) {
8007 cW.beginShape(16);
8008 cW.vertex(ef, eh, 0);
8009 cW.vertex(ed, eg, 0);
8010 cW.vertex(eb, ee, 0);
8011 cW.vertex(ea, ec, 0);
8012 cW.endShape()
8013 };
8014 var bN = function(eg, ef, ea, eh, ej, ee, ei, eb) {
8015 if (eb === t) {
8016 ee = ej;
8017 ei = ej;
8018 eb = ej
8019 }
8020 var ec = ea / 2,
8021 ed = eh / 2;
8022 if (ej > ec || ej > ed) {
8023 ej = q.min(ec, ed)
8024 }
8025 if (ee > ec || ee > ed) {
8026 ee = q.min(ec, ed)
8027 }
8028 if (ei > ec || ei > ed) {
8029 ei = q.min(ec, ed)
8030 }
8031 if (eb > ec || eb > ed) {
8032 eb = q.min(ec, ed)
8033 }
8034 if (!aH || ce) {
8035 d8.translate(0.5, 0.5)
8036 }
8037 d8.beginPath();
8038 d8.moveTo(eg + ej, ef);
8039 d8.lineTo(eg + ea - ee, ef);
8040 d8.quadraticCurveTo(eg + ea, ef, eg + ea, ef + ee);
8041 d8.lineTo(eg + ea, ef + eh - ei);
8042 d8.quadraticCurveTo(eg + ea, ef + eh, eg + ea - ei, ef + eh);
8043 d8.lineTo(eg + eb, ef + eh);
8044 d8.quadraticCurveTo(eg, ef + eh, eg, ef + eh - eb);
8045 d8.lineTo(eg, ef + ej);
8046 d8.quadraticCurveTo(eg, ef, eg + ej, ef);
8047 if (!aH || ce) {
8048 d8.translate(-0.5, -0.5)
8049 }
8050 bn();
8051 dd()
8052 };
8053 bR.prototype.rect = function(eb, eh, ee, ea, ec, ef, ed, eg) {
8054 if (!ee && !ea) {
8055 return
8056 }
8057 if (bK === 1) {
8058 ee -= eb;
8059 ea -= eh
8060 } else {
8061 if (bK === 2) {
8062 ee *= 2;
8063 ea *= 2;
8064 eb -= ee / 2;
8065 eh -= ea / 2
8066 } else {
8067 if (bK === 3) {
8068 eb -= ee / 2;
8069 eh -= ea / 2
8070 }
8071 }
8072 }
8073 eb = q.round(eb);
8074 eh = q.round(eh);
8075 ee = q.round(ee);
8076 ea = q.round(ea);
8077 if (ec !== t) {
8078 bN(eb, eh, ee, ea, ec, ef, ed, eg);
8079 return
8080 }
8081 if (ce && dW % 2 === 1) {
8082 d8.translate(0.5, 0.5)
8083 }
8084 d8.beginPath();
8085 d8.rect(eb, eh, ee, ea);
8086 bn();
8087 dd();
8088 if (ce && dW % 2 === 1) {
8089 d8.translate(-0.5, -0.5)
8090 }
8091 };
8092 bB.prototype.rect = function(ei, eh, ea, ek, em, ef, el, eb) {
8093 if (em !== t) {
8094 throw "rect() with rounded corners is not supported in 3D mode"
8095 }
8096 if (bK === 1) {
8097 ea -= ei;
8098 ek -= eh
8099 } else {
8100 if (bK === 2) {
8101 ea *= 2;
8102 ek *= 2;
8103 ei -= ea / 2;
8104 eh -= ek / 2
8105 } else {
8106 if (bK === 3) {
8107 ei -= ea / 2;
8108 eh -= ek / 2
8109 }
8110 }
8111 }
8112 var ee = new aP;
8113 ee.translate(ei, eh, 0);
8114 ee.scale(ea, ek, 1);
8115 ee.transpose();
8116 var eg = new aP;
8117 eg.scale(1, -1, 1);
8118 eg.apply(dJ.array());
8119 eg.transpose();
8120 if (dW > 0 && ce) {
8121 d8.useProgram(dQ);
8122 a9("uModel2d", dQ, "uModel", false, ee.array());
8123 a9("uView2d", dQ, "uView", false, eg.array());
8124 d2("uColor2d", dQ, "uColor", c0);
8125 dZ("uIsDrawingText2d", dQ, "uIsDrawingText", false);
8126 dc("aVertex2d", dQ, "aVertex", 3, aB);
8127 cg("aTextureCoord2d", dQ, "aTextureCoord");
8128 d8.drawArrays(d8.LINE_LOOP, 0, ak.length / 3)
8129 }
8130 if (aH) {
8131 d8.useProgram(dx);
8132 a9("uModel3d", dx, "uModel", false, ee.array());
8133 a9("uView3d", dx, "uView", false, eg.array());
8134 d8.enable(d8.POLYGON_OFFSET_FILL);
8135 d8.polygonOffset(1, 1);
8136 d2("color3d", dx, "uColor", bo);
8137 if (dL > 0) {
8138 var ej = new aP;
8139 ej.set(eg);
8140 var ec = new aP;
8141 ec.set(ee);
8142 ej.mult(ec);
8143 var ed = new aP;
8144 ed.set(ej);
8145 ed.invert();
8146 ed.transpose();
8147 a9("uNormalTransform3d", dx, "uNormalTransform", false, ed.array());
8148 dc("aNormal3d", dx, "aNormal", 3, b2)
8149 } else {
8150 cg("normal3d", dx, "aNormal")
8151 }
8152 dc("vertex3d", dx, "aVertex", 3, aB);
8153 d8.drawArrays(d8.TRIANGLE_FAN, 0, ak.length / 3);
8154 d8.disable(d8.POLYGON_OFFSET_FILL)
8155 }
8156 };
8157 bR.prototype.ellipse = function(eg, ef, eb, ei) {
8158 eg = eg || 0;
8159 ef = ef || 0;
8160 if (eb <= 0 && ei <= 0) {
8161 return
8162 }
8163 if (cN === 2) {
8164 eb *= 2;
8165 ei *= 2
8166 } else {
8167 if (cN === 1) {
8168 eb = eb - eg;
8169 ei = ei - ef;
8170 eg += eb / 2;
8171 ef += ei / 2
8172 } else {
8173 if (cN === 0) {
8174 eg += eb / 2;
8175 ef += ei / 2
8176 }
8177 }
8178 } if (eb === ei) {
8179 d8.beginPath();
8180 d8.arc(eg, ef, eb / 2, 0, 6.283185307179586, false);
8181 bn();
8182 dd()
8183 } else {
8184 var eh = eb / 2,
8185 ee = ei / 2,
8186 ea = 0.5522847498307933,
8187 ed = ea * eh,
8188 ec = ea * ee;
8189 cW.beginShape();
8190 cW.vertex(eg + eh, ef);
8191 cW.bezierVertex(eg + eh, ef - ec, eg + ed, ef - ee, eg, ef - ee);
8192 cW.bezierVertex(eg - ed, ef - ee, eg - eh, ef - ec, eg - eh, ef);
8193 cW.bezierVertex(eg - eh, ef + ec, eg - ed, ef + ee, eg, ef + ee);
8194 cW.bezierVertex(eg + ed, ef + ee, eg + eh, ef + ec, eg + eh, ef);
8195 cW.endShape()
8196 }
8197 };
8198 bB.prototype.ellipse = function(en, em, ec, ep) {
8199 en = en || 0;
8200 em = em || 0;
8201 if (ec <= 0 && ep <= 0) {
8202 return
8203 }
8204 if (cN === 2) {
8205 ec *= 2;
8206 ep *= 2
8207 } else {
8208 if (cN === 1) {
8209 ec = ec - en;
8210 ep = ep - em;
8211 en += ec / 2;
8212 em += ep / 2
8213 } else {
8214 if (cN === 0) {
8215 en += ec / 2;
8216 em += ep / 2
8217 }
8218 }
8219 }
8220 var eo = ec / 2,
8221 ej = ep / 2,
8222 ea = 0.5522847498307933,
8223 ee = ea * eo,
8224 ed = ea * ej;
8225 cW.beginShape();
8226 cW.vertex(en + eo, em);
8227 cW.bezierVertex(en + eo, em - ed, 0, en + ee, em - ej, 0, en, em - ej, 0);
8228 cW.bezierVertex(en - ee, em - ej, 0, en - eo, em - ed, 0, en - eo, em, 0);
8229 cW.bezierVertex(en - eo, em + ed, 0, en - ee, em + ej, 0, en, em + ej, 0);
8230 cW.bezierVertex(en + ee, em + ej, 0, en + eo, em + ed, 0, en + eo, em, 0);
8231 cW.endShape();
8232 if (aH) {
8233 var ef = 0,
8234 ek = 0,
8235 eh, eg;
8236 for (eh = 0; eh < bb.length; eh++) {
8237 ef += bb[eh][0];
8238 ek += bb[eh][1]
8239 }
8240 ef /= bb.length;
8241 ek /= bb.length;
8242 var ei = [],
8243 eb = [],
8244 el = [];
8245 ei[0] = ef;
8246 ei[1] = ek;
8247 ei[2] = 0;
8248 ei[3] = 0;
8249 ei[4] = 0;
8250 ei[5] = bo[0];
8251 ei[6] = bo[1];
8252 ei[7] = bo[2];
8253 ei[8] = bo[3];
8254 ei[9] = c0[0];
8255 ei[10] = c0[1];
8256 ei[11] = c0[2];
8257 ei[12] = c0[3];
8258 ei[13] = a8;
8259 ei[14] = a7;
8260 ei[15] = a6;
8261 bb.unshift(ei);
8262 for (eh = 0; eh < bb.length; eh++) {
8263 for (eg = 0; eg < 3; eg++) {
8264 eb.push(bb[eh][eg])
8265 }
8266 for (eg = 5; eg < 9; eg++) {
8267 el.push(bb[eh][eg])
8268 }
8269 }
8270 dm(eb, "TRIANGLE_FAN", el)
8271 }
8272 };
8273 cW.normal = function(ea, ec, eb) {
8274 if (arguments.length !== 3 || !(typeof ea === "number" && typeof ec === "number" && typeof eb === "number")) {
8275 throw "normal() requires three numeric arguments."
8276 }
8277 a8 = ea;
8278 a7 = ec;
8279 a6 = eb;
8280 if (dR !== 0) {
8281 if (a2 === 0) {
8282 a2 = 1
8283 } else {
8284 if (a2 === 1) {
8285 a2 = 2
8286 }
8287 }
8288 }
8289 };
8290 cW.save = function(eb, ea) {
8291 if (ea !== t) {
8292 return D.open(ea.toDataURL(), "_blank")
8293 }
8294 return D.open(cW.externals.canvas.toDataURL(), "_blank")
8295 };
8296 var cw = 0;
8297 cW.saveFrame = function(ea) {
8298 if (ea === t) {
8299 ea = "screen-####.png"
8300 }
8301 var eb = ea.replace(/#+/, function(ed) {
8302 var ec = "" + cw++;
8303 while (ec.length < ed.length) {
8304 ec = "0" + ec
8305 }
8306 return ec
8307 });
8308 cW.save(eb)
8309 };
8310 var cc = d.createElement("canvas").getContext("2d");
8311 var X = [t, t, t];
8312
8313 function by(eh, eb, eg) {
8314 var ed = X.shift();
8315 if (ed === t) {
8316 ed = {};
8317 ed.canvas = d.createElement("canvas");
8318 ed.context = ed.canvas.getContext("2d")
8319 }
8320 X.push(ed);
8321 var ec = ed.canvas,
8322 ee = ed.context,
8323 ef = eb || eh.width,
8324 ea = eg || eh.height;
8325 ec.width = ef;
8326 ec.height = ea;
8327 if (!eh) {
8328 ee.clearRect(0, 0, ef, ea)
8329 } else {
8330 if ("data" in eh) {
8331 ee.putImageData(eh, 0, 0)
8332 } else {
8333 ee.clearRect(0, 0, ef, ea);
8334 ee.drawImage(eh, 0, 0, ef, ea)
8335 }
8336 }
8337 return ed
8338 }
8339
8340 function b0(ea) {
8341 return {
8342 getLength: function(eb) {
8343 return function() {
8344 if (eb.isRemote) {
8345 throw "Image is loaded remotely. Cannot get length."
8346 } else {
8347 return eb.imageData.data.length ? eb.imageData.data.length / 4 : 0
8348 }
8349 }
8350 }(ea),
8351 getPixel: function(eb) {
8352 return function(ec) {
8353 var ee = ec * 4,
8354 ed = eb.imageData.data;
8355 if (eb.isRemote) {
8356 throw "Image is loaded remotely. Cannot get pixels."
8357 }
8358 return (ed[ee + 3] & 255) << 24 | (ed[ee] & 255) << 16 | (ed[ee + 1] & 255) << 8 | ed[ee + 2] & 255
8359 }
8360 }(ea),
8361 setPixel: function(eb) {
8362 return function(ec, ef) {
8363 var ee = ec * 4,
8364 ed = eb.imageData.data;
8365 if (eb.isRemote) {
8366 throw "Image is loaded remotely. Cannot set pixel."
8367 }
8368 ed[ee + 0] = (ef >> 16) & 255;
8369 ed[ee + 1] = (ef >> 8) & 255;
8370 ed[ee + 2] = ef & 255;
8371 ed[ee + 3] = (ef >> 24) & 255;
8372 eb.__isDirty = true
8373 }
8374 }(ea),
8375 toArray: function(eb) {
8376 return function() {
8377 var ec = [],
8378 ef = eb.imageData.data,
8379 ee = eb.width * eb.height;
8380 if (eb.isRemote) {
8381 throw "Image is loaded remotely. Cannot get pixels."
8382 }
8383 for (var ed = 0, eg = 0; ed < ee; ed++, eg += 4) {
8384 ec.push((ef[eg + 3] & 255) << 24 | (ef[eg] & 255) << 16 | (ef[eg + 1] & 255) << 8 | ef[eg + 2] & 255)
8385 }
8386 return ec
8387 }
8388 }(ea),
8389 set: function(eb) {
8390 return function(ec) {
8391 var eg, ef, eh;
8392 if (this.isRemote) {
8393 throw "Image is loaded remotely. Cannot set pixels."
8394 }
8395 ef = eb.imageData.data;
8396 for (var ed = 0, ee = ec.length; ed < ee; ed++) {
8397 eh = ec[ed];
8398 eg = ed * 4;
8399 ef[eg + 0] = (eh >> 16) & 255;
8400 ef[eg + 1] = (eh >> 8) & 255;
8401 ef[eg + 2] = eh & 255;
8402 ef[eg + 3] = (eh >> 24) & 255
8403 }
8404 eb.__isDirty = true
8405 }
8406 }(ea)
8407 }
8408 }
8409 var cG = function(ed, eg, ee) {
8410 this.__isDirty = false;
8411 if (ed instanceof HTMLImageElement) {
8412 this.fromHTMLImageData(ed)
8413 } else {
8414 if (eg || ee) {
8415 this.width = ed || 1;
8416 this.height = eg || 1;
8417 var eb = this.sourceImg = d.createElement("canvas");
8418 eb.width = this.width;
8419 eb.height = this.height;
8420 var eh = this.imageData = eb.getContext("2d").createImageData(this.width, this.height);
8421 this.format = ee === 2 || ee === 4 ? ee : 1;
8422 if (this.format === 1) {
8423 for (var ec = 3, ef = this.imageData.data, ea = ef.length; ec < ea; ec += 4) {
8424 ef[ec] = 255
8425 }
8426 }
8427 this.__isDirty = true;
8428 this.updatePixels()
8429 } else {
8430 this.width = 0;
8431 this.height = 0;
8432 this.imageData = cc.createImageData(1, 1);
8433 this.format = 2
8434 }
8435 }
8436 this.pixels = b0(this)
8437 };
8438 cG.prototype = {
8439 __isPImage: true,
8440 updatePixels: function() {
8441 var ea = this.sourceImg;
8442 if (ea && ea instanceof HTMLCanvasElement && this.__isDirty) {
8443 ea.getContext("2d").putImageData(this.imageData, 0, 0)
8444 }
8445 this.__isDirty = false
8446 },
8447 fromHTMLImageData: function(ea) {
8448 var eb = by(ea);
8449 try {
8450 var ed = eb.context.getImageData(0, 0, ea.width, ea.height);
8451 this.fromImageData(ed)
8452 } catch (ec) {
8453 if (ea.width && ea.height) {
8454 this.isRemote = true;
8455 this.width = ea.width;
8456 this.height = ea.height
8457 }
8458 }
8459 this.sourceImg = ea
8460 },
8461 get: function(ea, ed, eb, ec) {
8462 if (!arguments.length) {
8463 return cW.get(this)
8464 }
8465 if (arguments.length === 2) {
8466 return cW.get(ea, ed, this)
8467 }
8468 if (arguments.length === 4) {
8469 return cW.get(ea, ed, eb, ec, this)
8470 }
8471 },
8472 set: function(ea, ec, eb) {
8473 cW.set(ea, ec, eb, this);
8474 this.__isDirty = true
8475 },
8476 blend: function(ei, ee, ed, eb, eg, ej, eh, ef, ea, ec) {
8477 if (arguments.length === 9) {
8478 cW.blend(this, ei, ee, ed, eb, eg, ej, eh, ef, ea, this)
8479 } else {
8480 if (arguments.length === 10) {
8481 cW.blend(ei, ee, ed, eb, eg, ej, eh, ef, ea, ec, this)
8482 }
8483 }
8484 delete this.sourceImg
8485 },
8486 copy: function(eh, ee, ed, ec, eb, ei, eg, ef, ea) {
8487 if (arguments.length === 8) {
8488 cW.blend(this, eh, ee, ed, ec, eb, ei, eg, ef, 0, this)
8489 } else {
8490 if (arguments.length === 9) {
8491 cW.blend(eh, ee, ed, ec, eb, ei, eg, ef, ea, 0, this)
8492 }
8493 }
8494 delete this.sourceImg
8495 },
8496 filter: function(eb, ea) {
8497 if (arguments.length === 2) {
8498 cW.filter(eb, ea, this)
8499 } else {
8500 if (arguments.length === 1) {
8501 cW.filter(eb, null, this)
8502 }
8503 }
8504 delete this.sourceImg
8505 },
8506 save: function(ea) {
8507 cW.save(ea, this)
8508 },
8509 resize: function(ea, ec) {
8510 if (this.isRemote) {
8511 throw "Image is loaded remotely. Cannot resize."
8512 }
8513 if (this.width !== 0 || this.height !== 0) {
8514 if (ea === 0 && ec !== 0) {
8515 ea = q.floor(this.width / this.height * ec)
8516 } else {
8517 if (ec === 0 && ea !== 0) {
8518 ec = q.floor(this.height / this.width * ea)
8519 }
8520 }
8521 var eb = by(this.imageData).canvas;
8522 var ed = by(eb, ea, ec).context.getImageData(0, 0, ea, ec);
8523 this.fromImageData(ed)
8524 }
8525 },
8526 mask: function(ea) {
8527 var ed = this.toImageData(),
8528 ec, eb;
8529 if (ea instanceof cG || ea.__isPImage) {
8530 if (ea.width === this.width && ea.height === this.height) {
8531 ea = ea.toImageData();
8532 for (ec = 2, eb = this.width * this.height * 4; ec < eb; ec += 4) {
8533 ed.data[ec + 1] = ea.data[ec]
8534 }
8535 } else {
8536 throw "mask must have the same dimensions as PImage."
8537 }
8538 } else {
8539 if (ea instanceof Array) {
8540 if (this.width * this.height === ea.length) {
8541 for (ec = 0, eb = ea.length; ec < eb; ++ec) {
8542 ed.data[ec * 4 + 3] = ea[ec]
8543 }
8544 } else {
8545 throw "mask array must be the same length as PImage pixels array."
8546 }
8547 }
8548 }
8549 this.fromImageData(ed)
8550 },
8551 loadPixels: G,
8552 toImageData: function() {
8553 if (this.isRemote) {
8554 return this.sourceImg
8555 }
8556 if (!this.__isDirty) {
8557 return this.imageData
8558 }
8559 var ea = by(this.sourceImg);
8560 return ea.context.getImageData(0, 0, this.width, this.height)
8561 },
8562 toDataURL: function() {
8563 if (this.isRemote) {
8564 throw "Image is loaded remotely. Cannot create dataURI."
8565 }
8566 var ea = by(this.imageData);
8567 return ea.canvas.toDataURL()
8568 },
8569 fromImageData: function(ee) {
8570 var eb = ee.width,
8571 ed = ee.height,
8572 ec = d.createElement("canvas"),
8573 ea = ec.getContext("2d");
8574 this.width = ec.width = eb;
8575 this.height = ec.height = ed;
8576 ea.putImageData(ee, 0, 0);
8577 this.format = 2;
8578 this.imageData = ee;
8579 this.sourceImg = ec
8580 }
8581 };
8582 cW.PImage = cG;
8583 cW.createImage = function(ea, eb, ec) {
8584 return new cG(ea, eb, ec)
8585 };
8586 cW.loadImage = function(eb, ec, ee) {
8587 if (ec) {
8588 eb = eb + "." + ec
8589 }
8590 var ed;
8591 if (cQ.imageCache.images[eb]) {
8592 ed = new cG(cQ.imageCache.images[eb]);
8593 ed.loaded = true;
8594 return ed
8595 }
8596 ed = new cG;
8597 var ea = d.createElement("img");
8598 ed.sourceImg = ea;
8599 ea.onload = function(ei, eg, ef) {
8600 var ej = ei;
8601 var eh = eg;
8602 var ek = ef;
8603 return function() {
8604 eh.fromHTMLImageData(ej);
8605 eh.loaded = true;
8606 if (ek) {
8607 ek()
8608 }
8609 }
8610 }(ea, ed, ee);
8611 ea.src = eb;
8612 return ed
8613 };
8614 cW.requestImage = cW.loadImage;
8615
8616 function c9(ea, ed) {
8617 var eb;
8618 if (ea >= cW.width || ea < 0 || ed < 0 || ed >= cW.height) {
8619 return 0
8620 }
8621 if (dV) {
8622 var ec = ((0 | ea) + cW.width * (0 | ed)) * 4;
8623 eb = cW.imageData.data;
8624 return (eb[ec + 3] & 255) << 24 | (eb[ec] & 255) << 16 | (eb[ec + 1] & 255) << 8 | eb[ec + 2] & 255
8625 }
8626 eb = cW.toImageData(0 | ea, 0 | ed, 1, 1).data;
8627 return (eb[3] & 255) << 24 | (eb[0] & 255) << 16 | (eb[1] & 255) << 8 | eb[2] & 255
8628 }
8629
8630 function c8(ea, ee, eb) {
8631 if (eb.isRemote) {
8632 throw "Image is loaded remotely. Cannot get x,y."
8633 }
8634 var ed = ee * eb.width * 4 + ea * 4,
8635 ec = eb.imageData.data;
8636 return (ec[ed + 3] & 255) << 24 | (ec[ed] & 255) << 16 | (ec[ed + 1] & 255) << 8 | ec[ed + 2] & 255
8637 }
8638
8639 function c6(ea, ee, eb, ec) {
8640 var ed = new cG(eb, ec, 2);
8641 ed.fromImageData(cW.toImageData(ea, ee, eb, ec));
8642 return ed
8643 }
8644
8645 function c5(ef, ee, eg, el, er) {
8646 if (er.isRemote) {
8647 throw "Image is loaded remotely. Cannot get x,y,w,h."
8648 }
8649 var ep = new cG(eg, el, 2),
8650 ec = ep.imageData.data,
8651 ed = er.width,
8652 em = er.height,
8653 eo = er.imageData.data;
8654 var ea = q.max(0, -ee),
8655 eb = q.max(0, -ef),
8656 eh = q.min(el, em - ee),
8657 ei = q.min(eg, ed - ef);
8658 for (var ek = ea; ek < eh; ++ek) {
8659 var en = ((ee + ek) * ed + (ef + eb)) * 4;
8660 var eq = (ek * eg + eb) * 4;
8661 for (var ej = eb; ej < ei; ++ej) {
8662 ec[eq++] = eo[en++];
8663 ec[eq++] = eo[en++];
8664 ec[eq++] = eo[en++];
8665 ec[eq++] = eo[en++]
8666 }
8667 }
8668 ep.__isDirty = true;
8669 return ep
8670 }
8671 cW.get = function(ea, ee, eb, ed, ec) {
8672 if (ec !== undefined) {
8673 return c5(ea, ee, eb, ed, ec)
8674 }
8675 if (ed !== undefined) {
8676 return c6(ea, ee, eb, ed)
8677 }
8678 if (eb !== undefined) {
8679 return c8(ea, ee, eb)
8680 }
8681 if (ee !== undefined) {
8682 return c9(ea, ee)
8683 }
8684 if (ea !== undefined) {
8685 return c5(0, 0, ea.width, ea.height, ea)
8686 }
8687 return c6(0, 0, cW.width, cW.height)
8688 };
8689 cW.createGraphics = function(ea, ec, eb) {
8690 var ed = new F;
8691 ed.size(ea, ec, eb);
8692 ed.background(0, 0);
8693 return ed
8694 };
8695
8696 function T() {
8697 if (dV) {
8698 d8 = aj;
8699 dV = false;
8700 cW.updatePixels()
8701 }
8702 }
8703
8704 function cq() {
8705 function eb(ef, ed) {
8706 function ee() {
8707 T();
8708 d8[ed].apply(d8, arguments)
8709 }
8710 ef[ed] = ee
8711 }
8712
8713 function ea(eg, ee) {
8714 function ed() {
8715 T();
8716 return d8[ee]
8717 }
8718
8719 function ef(eh) {
8720 T();
8721 d8[ee] = eh
8722 }
8723 cW.defineProperty(eg, ee, {
8724 get: ed,
8725 set: ef
8726 })
8727 }
8728 for (var ec in d8) {
8729 if (typeof d8[ec] === "function") {
8730 eb(this, ec)
8731 } else {
8732 ea(this, ec)
8733 }
8734 }
8735 }
8736
8737 function cC() {
8738 if (dV) {
8739 return
8740 }
8741 cW.loadPixels();
8742 if (cn === null) {
8743 aj = d8;
8744 cn = new cq
8745 }
8746 dV = true;
8747 d8 = cn;
8748 d3 = 0
8749 }
8750
8751 function bx(ea, ec, eb) {
8752 if (ea < cW.width && ea >= 0 && ec >= 0 && ec < cW.height) {
8753 cC();
8754 cW.pixels.setPixel((0 | ea) + cW.width * (0 | ec), eb);
8755 if (++d3 > bZ) {
8756 T()
8757 }
8758 }
8759 }
8760
8761 function bv(ea, eg, ed, eb) {
8762 if (eb.isRemote) {
8763 throw "Image is loaded remotely. Cannot set x,y."
8764 }
8765 var ef = cW.color.toArray(ed);
8766 var ee = eg * eb.width * 4 + ea * 4;
8767 var ec = eb.imageData.data;
8768 ec[ee] = ef[0];
8769 ec[ee + 1] = ef[1];
8770 ec[ee + 2] = ef[2];
8771 ec[ee + 3] = ef[3]
8772 }
8773 cW.set = function(ea, ef, ed, ec) {
8774 var eb, ee;
8775 if (arguments.length === 3) {
8776 if (typeof ed === "number") {
8777 bx(ea, ef, ed)
8778 } else {
8779 if (ed instanceof cG || ed.__isPImage) {
8780 cW.image(ed, ea, ef)
8781 }
8782 }
8783 } else {
8784 if (arguments.length === 4) {
8785 bv(ea, ef, ed, ec)
8786 }
8787 }
8788 };
8789 cW.imageData = {};
8790 cW.pixels = {
8791 getLength: function() {
8792 return cW.imageData.data.length ? cW.imageData.data.length / 4 : 0
8793 },
8794 getPixel: function(ea) {
8795 var ec = ea * 4,
8796 eb = cW.imageData.data;
8797 return eb[ec + 3] << 24 & 4278190080 | eb[ec + 0] << 16 & 16711680 | eb[ec + 1] << 8 & 65280 | eb[ec + 2] & 255
8798 },
8799 setPixel: function(ea, ed) {
8800 var ec = ea * 4,
8801 eb = cW.imageData.data;
8802 eb[ec + 0] = (ed & 16711680) >>> 16;
8803 eb[ec + 1] = (ed & 65280) >>> 8;
8804 eb[ec + 2] = ed & 255;
8805 eb[ec + 3] = (ed & 4278190080) >>> 24
8806 },
8807 toArray: function() {
8808 var ea = [],
8809 ec = cW.imageData.width * cW.imageData.height,
8810 ed = cW.imageData.data;
8811 for (var eb = 0, ee = 0; eb < ec; eb++, ee += 4) {
8812 ea.push(ed[ee + 3] << 24 & 4278190080 | ed[ee + 0] << 16 & 16711680 | ed[ee + 1] << 8 & 65280 | ed[ee + 2] & 255)
8813 }
8814 return ea
8815 },
8816 set: function(ea) {
8817 for (var eb = 0, ec = ea.length; eb < ec; eb++) {
8818 this.setPixel(eb, ea[eb])
8819 }
8820 }
8821 };
8822 cW.loadPixels = function() {
8823 cW.imageData = dY.$ensureContext().getImageData(0, 0, cW.width, cW.height)
8824 };
8825 cW.updatePixels = function() {
8826 if (cW.imageData) {
8827 dY.$ensureContext().putImageData(cW.imageData, 0, 0)
8828 }
8829 };
8830 cW.hint = function(eb) {
8831 var ea = dY.$ensureContext();
8832 if (eb === 4) {
8833 ea.disable(ea.DEPTH_TEST);
8834 ea.depthMask(false);
8835 ea.clear(ea.DEPTH_BUFFER_BIT)
8836 } else {
8837 if (eb === -4) {
8838 ea.enable(ea.DEPTH_TEST);
8839 ea.depthMask(true)
8840 } else {
8841 if (eb === -1 || eb === 2) {
8842 dO = true
8843 } else {
8844 if (eb === 1) {
8845 dO = false
8846 }
8847 }
8848 }
8849 }
8850 };
8851 var bE = function(ed, ec, eb, ea) {
8852 var ee;
8853 if (ed instanceof cG || ed.__isPImage) {
8854 ee = ed;
8855 if (!ee.loaded) {
8856 throw "Error using image in background(): PImage not loaded."
8857 }
8858 if (ee.width !== cW.width || ee.height !== cW.height) {
8859 throw "Background image must be the same dimensions as the canvas."
8860 }
8861 } else {
8862 ee = cW.color(ed, ec, eb, ea)
8863 }
8864 a4 = ee
8865 };
8866 bR.prototype.background = function(ed, ec, eb, ea) {
8867 if (ed !== t) {
8868 bE(ed, ec, eb, ea)
8869 }
8870 if (a4 instanceof cG || a4.__isPImage) {
8871 aD();
8872 d8.setTransform(1, 0, 0, 1, 0, 0);
8873 cW.image(a4, 0, 0);
8874 cP()
8875 } else {
8876 aD();
8877 d8.setTransform(1, 0, 0, 1, 0, 0);
8878 if (cW.alpha(a4) !== bU) {
8879 d8.clearRect(0, 0, cW.width, cW.height)
8880 }
8881 d8.fillStyle = cW.color.toString(a4);
8882 d8.fillRect(0, 0, cW.width, cW.height);
8883 aq = true;
8884 cP()
8885 }
8886 };
8887 bB.prototype.background = function(ed, ec, eb, ea) {
8888 if (arguments.length > 0) {
8889 bE(ed, ec, eb, ea)
8890 }
8891 var ee = cW.color.toGLArray(a4);
8892 d8.clearColor(ee[0], ee[1], ee[2], ee[3]);
8893 d8.clear(d8.COLOR_BUFFER_BIT | d8.DEPTH_BUFFER_BIT)
8894 };
8895 bR.prototype.image = function(ed, ei, eg, ej, ee) {
8896 ei = q.round(ei);
8897 eg = q.round(eg);
8898 if (ed.width > 0) {
8899 var ek = ej || ed.width;
8900 var eh = ee || ed.height;
8901 var ea = bk(ei || 0, eg || 0, ej || ed.width, ee || ed.height, arguments.length < 4);
8902 var ef = !!ed.sourceImg && bf === null;
8903 if (ef) {
8904 var eb = ed.sourceImg;
8905 if (ed.__isDirty) {
8906 ed.updatePixels()
8907 }
8908 d8.drawImage(eb, 0, 0, eb.width, eb.height, ea.x, ea.y, ea.w, ea.h)
8909 } else {
8910 var ec = ed.toImageData();
8911 if (bf !== null) {
8912 bf(ec);
8913 ed.__isDirty = true
8914 }
8915 d8.drawImage(by(ec).canvas, 0, 0, ed.width, ed.height, ea.x, ea.y, ea.w, ea.h)
8916 }
8917 }
8918 };
8919 bB.prototype.image = function(ec, ea, ee, eb, ed) {
8920 if (ec.width > 0) {
8921 ea = q.round(ea);
8922 ee = q.round(ee);
8923 eb = eb || ec.width;
8924 ed = ed || ec.height;
8925 cW.beginShape(cW.QUADS);
8926 cW.texture(ec);
8927 cW.vertex(ea, ee, 0, 0, 0);
8928 cW.vertex(ea, ee + ed, 0, 0, ed);
8929 cW.vertex(ea + eb, ee + ed, 0, eb, ed);
8930 cW.vertex(ea + eb, ee, 0, eb, 0);
8931 cW.endShape()
8932 }
8933 };
8934 cW.tint = function(ed, ec, ea, ei) {
8935 var ef = cW.color(ed, ec, ea, ei);
8936 var eb = cW.red(ef) / bJ;
8937 var ee = cW.green(ef) / bI;
8938 var eg = cW.blue(ef) / bG;
8939 var eh = cW.alpha(ef) / bU;
8940 bf = function(em) {
8941 var el = em.data,
8942 ek = 4 * em.width * em.height;
8943 for (var ej = 0; ej < ek;) {
8944 el[ej++] *= eb;
8945 el[ej++] *= ee;
8946 el[ej++] *= eg;
8947 el[ej++] *= eh
8948 }
8949 };
8950 bw = function(ek) {
8951 for (var ej = 0; ej < ek.length;) {
8952 ek[ej++] = eb;
8953 ek[ej++] = ee;
8954 ek[ej++] = eg;
8955 ek[ej++] = eh
8956 }
8957 }
8958 };
8959 cW.noTint = function() {
8960 bf = null;
8961 bw = null
8962 };
8963 cW.copy = function(ea, ef, ee, eg, ec, ei, eh, eb, ed) {
8964 if (ed === t) {
8965 ed = eb;
8966 eb = eh;
8967 eh = ei;
8968 ei = ec;
8969 ec = eg;
8970 eg = ee;
8971 ee = ef;
8972 ef = ea;
8973 ea = cW
8974 }
8975 cW.blend(ea, ef, ee, eg, ec, ei, eh, eb, ed, 0)
8976 };
8977 cW.blend = function(ea, ek, ej, en, ef, ep, eo, eb, eh, eg, ed) {
8978 if (ea.isRemote) {
8979 throw "Image is loaded remotely. Cannot blend image."
8980 }
8981 if (eg === t) {
8982 eg = eh;
8983 eh = eb;
8984 eb = eo;
8985 eo = ep;
8986 ep = ef;
8987 ef = en;
8988 en = ej;
8989 ej = ek;
8990 ek = ea;
8991 ea = cW
8992 }
8993 var ec = ek + en,
8994 ei = ej + ef,
8995 em = ep + eb,
8996 ee = eo + eh,
8997 el = ed || cW;
8998 if (ed === t || eg === t) {
8999 cW.loadPixels()
9000 }
9001 ea.loadPixels();
9002 if (ea === cW && cW.intersect(ek, ej, ec, ei, ep, eo, em, ee)) {
9003 cW.blit_resize(cW.get(ek, ej, ec - ek, ei - ej), 0, 0, ec - ek - 1, ei - ej - 1, el.imageData.data, el.width, el.height, ep, eo, em, ee, eg)
9004 } else {
9005 cW.blit_resize(ea, ek, ej, ec, ei, el.imageData.data, el.width, el.height, ep, eo, em, ee, eg)
9006 } if (ed === t) {
9007 cW.updatePixels()
9008 }
9009 };
9010 var bp = function(ee) {
9011 var ea = cW.floor(ee * 3.5),
9012 ec, eb;
9013 ea = ea < 1 ? 1 : ea < 248 ? ea : 248;
9014 if (cW.shared.blurRadius !== ea) {
9015 cW.shared.blurRadius = ea;
9016 cW.shared.blurKernelSize = 1 + (cW.shared.blurRadius << 1);
9017 cW.shared.blurKernel = new e(cW.shared.blurKernelSize);
9018 var eg = cW.shared.blurKernel;
9019 var ef = cW.shared.blurKernelSize;
9020 var ed = cW.shared.blurRadius;
9021 for (ec = 0; ec < ef; ec++) {
9022 eg[ec] = 0
9023 }
9024 var eh = (ea - 1) * (ea - 1);
9025 for (ec = 1; ec < ea; ec++) {
9026 eg[ea + ec] = eg[eb] = eh
9027 }
9028 eg[ea] = ea * ea
9029 }
9030 };
9031 var b7 = function(eo, et) {
9032 var ec, ef, el, eq, er, eA, es;
9033 var ev, en, ez, ey, ep;
9034 var ei = et.pixels.getLength();
9035 var eu = new e(ei);
9036 var eD = new e(ei);
9037 var eh = new e(ei);
9038 var eC = new e(ei);
9039 var eB = 0;
9040 var ek, ej, ex, ee;
9041 bp(eo);
9042 var eb = et.height;
9043 var ea = et.width;
9044 var ew = cW.shared.blurKernelSize;
9045 var em = cW.shared.blurRadius;
9046 var eg = cW.shared.blurKernel;
9047 var ed = et.imageData.data;
9048 for (ej = 0; ej < eb; ej++) {
9049 for (ek = 0; ek < ea; ek++) {
9050 eq = el = ef = er = ec = 0;
9051 ev = ek - em;
9052 if (ev < 0) {
9053 ep = -ev;
9054 ev = 0
9055 } else {
9056 if (ev >= ea) {
9057 break
9058 }
9059 ep = 0
9060 }
9061 for (ex = ep; ex < ew; ex++) {
9062 if (ev >= ea) {
9063 break
9064 }
9065 ee = (ev + eB) * 4;
9066 es = eg[ex];
9067 er += es * ed[ee + 3];
9068 ef += es * ed[ee];
9069 el += es * ed[ee + 1];
9070 eq += es * ed[ee + 2];
9071 ec += es;
9072 ev++
9073 }
9074 en = eB + ek;
9075 eC[en] = er / ec;
9076 eu[en] = ef / ec;
9077 eD[en] = el / ec;
9078 eh[en] = eq / ec
9079 }
9080 eB += ea
9081 }
9082 eB = 0;
9083 ez = -em;
9084 ey = ez * ea;
9085 for (ej = 0; ej < eb; ej++) {
9086 for (ek = 0; ek < ea; ek++) {
9087 eq = el = ef = er = ec = 0;
9088 if (ez < 0) {
9089 ep = en = -ez;
9090 ev = ek
9091 } else {
9092 if (ez >= eb) {
9093 break
9094 }
9095 ep = 0;
9096 en = ez;
9097 ev = ek + ey
9098 }
9099 for (ex = ep; ex < ew; ex++) {
9100 if (en >= eb) {
9101 break
9102 }
9103 es = eg[ex];
9104 er += es * eC[ev];
9105 ef += es * eu[ev];
9106 el += es * eD[ev];
9107 eq += es * eh[ev];
9108 ec += es;
9109 en++;
9110 ev += ea
9111 }
9112 ee = (ek + eB) * 4;
9113 ed[ee] = ef / ec;
9114 ed[ee + 1] = el / ec;
9115 ed[ee + 2] = eq / ec;
9116 ed[ee + 3] = er / ec
9117 }
9118 eB += ea;
9119 ey += ea;
9120 ez++
9121 }
9122 };
9123 var cf = function(er, el) {
9124 var eh = 0;
9125 var ev = el.pixels.getLength();
9126 var em = new K(ev);
9127 var ep, eb, ek, ej, ed;
9128 var eq, ee, eg, ei, ec, en, eu, ea, es, ef, et, eo;
9129 if (!er) {
9130 while (eh < ev) {
9131 ep = eh;
9132 eb = eh + el.width;
9133 while (eh < eb) {
9134 ek = ej = el.pixels.getPixel(eh);
9135 ee = eh - 1;
9136 eq = eh + 1;
9137 eg = eh - el.width;
9138 ei = eh + el.width;
9139 if (ee < ep) {
9140 ee = eh
9141 }
9142 if (eq >= eb) {
9143 eq = eh
9144 }
9145 if (eg < 0) {
9146 eg = 0
9147 }
9148 if (ei >= ev) {
9149 ei = eh
9150 }
9151 eu = el.pixels.getPixel(eg);
9152 en = el.pixels.getPixel(ee);
9153 ea = el.pixels.getPixel(ei);
9154 ec = el.pixels.getPixel(eq);
9155 ed = 77 * (ek >> 16 & 255) + 151 * (ek >> 8 & 255) + 28 * (ek & 255);
9156 ef = 77 * (en >> 16 & 255) + 151 * (en >> 8 & 255) + 28 * (en & 255);
9157 es = 77 * (ec >> 16 & 255) + 151 * (ec >> 8 & 255) + 28 * (ec & 255);
9158 et = 77 * (eu >> 16 & 255) + 151 * (eu >> 8 & 255) + 28 * (eu & 255);
9159 eo = 77 * (ea >> 16 & 255) + 151 * (ea >> 8 & 255) + 28 * (ea & 255);
9160 if (ef > ed) {
9161 ej = en;
9162 ed = ef
9163 }
9164 if (es > ed) {
9165 ej = ec;
9166 ed = es
9167 }
9168 if (et > ed) {
9169 ej = eu;
9170 ed = et
9171 }
9172 if (eo > ed) {
9173 ej = ea;
9174 ed = eo
9175 }
9176 em[eh++] = ej
9177 }
9178 }
9179 } else {
9180 while (eh < ev) {
9181 ep = eh;
9182 eb = eh + el.width;
9183 while (eh < eb) {
9184 ek = ej = el.pixels.getPixel(eh);
9185 ee = eh - 1;
9186 eq = eh + 1;
9187 eg = eh - el.width;
9188 ei = eh + el.width;
9189 if (ee < ep) {
9190 ee = eh
9191 }
9192 if (eq >= eb) {
9193 eq = eh
9194 }
9195 if (eg < 0) {
9196 eg = 0
9197 }
9198 if (ei >= ev) {
9199 ei = eh
9200 }
9201 eu = el.pixels.getPixel(eg);
9202 en = el.pixels.getPixel(ee);
9203 ea = el.pixels.getPixel(ei);
9204 ec = el.pixels.getPixel(eq);
9205 ed = 77 * (ek >> 16 & 255) + 151 * (ek >> 8 & 255) + 28 * (ek & 255);
9206 ef = 77 * (en >> 16 & 255) + 151 * (en >> 8 & 255) + 28 * (en & 255);
9207 es = 77 * (ec >> 16 & 255) + 151 * (ec >> 8 & 255) + 28 * (ec & 255);
9208 et = 77 * (eu >> 16 & 255) + 151 * (eu >> 8 & 255) + 28 * (eu & 255);
9209 eo = 77 * (ea >> 16 & 255) + 151 * (ea >> 8 & 255) + 28 * (ea & 255);
9210 if (ef < ed) {
9211 ej = en;
9212 ed = ef
9213 }
9214 if (es < ed) {
9215 ej = ec;
9216 ed = es
9217 }
9218 if (et < ed) {
9219 ej = eu;
9220 ed = et
9221 }
9222 if (eo < ed) {
9223 ej = ea;
9224 ed = eo
9225 }
9226 em[eh++] = ej
9227 }
9228 }
9229 }
9230 el.pixels.set(em)
9231 };
9232 cW.filter = function(eh, eg, ed) {
9233 var ek, ef, eb, ej;
9234 if (arguments.length === 3) {
9235 ed.loadPixels();
9236 ek = ed
9237 } else {
9238 cW.loadPixels();
9239 ek = cW
9240 } if (eg === t) {
9241 eg = null
9242 }
9243 if (ek.isRemote) {
9244 throw "Image is loaded remotely. Cannot filter image."
9245 }
9246 var el = ek.pixels.getLength();
9247 switch (eh) {
9248 case 11:
9249 var em = eg || 1;
9250 b7(em, ek);
9251 break;
9252 case 12:
9253 if (ek.format === 4) {
9254 for (ej = 0; ej < el; ej++) {
9255 ef = 255 - ek.pixels.getPixel(ej);
9256 ek.pixels.setPixel(ej, 4278190080 | ef << 16 | ef << 8 | ef)
9257 }
9258 ek.format = 1
9259 } else {
9260 for (ej = 0; ej < el; ej++) {
9261 ef = ek.pixels.getPixel(ej);
9262 eb = 77 * (ef >> 16 & 255) + 151 * (ef >> 8 & 255) + 28 * (ef & 255) >> 8;
9263 ek.pixels.setPixel(ej, ef & 4278190080 | eb << 16 | eb << 8 | eb)
9264 }
9265 }
9266 break;
9267 case 13:
9268 for (ej = 0; ej < el; ej++) {
9269 ek.pixels.setPixel(ej, ek.pixels.getPixel(ej) ^ 16777215)
9270 }
9271 break;
9272 case 15:
9273 if (eg === null) {
9274 throw "Use filter(POSTERIZE, int levels) instead of filter(POSTERIZE)"
9275 }
9276 var ep = cW.floor(eg);
9277 if (ep < 2 || ep > 255) {
9278 throw "Levels must be between 2 and 255 for filter(POSTERIZE, levels)"
9279 }
9280 var ei = ep - 1;
9281 for (ej = 0; ej < el; ej++) {
9282 var ea = ek.pixels.getPixel(ej) >> 16 & 255;
9283 var en = ek.pixels.getPixel(ej) >> 8 & 255;
9284 var ec = ek.pixels.getPixel(ej) & 255;
9285 ea = (ea * ep >> 8) * 255 / ei;
9286 en = (en * ep >> 8) * 255 / ei;
9287 ec = (ec * ep >> 8) * 255 / ei;
9288 ek.pixels.setPixel(ej, 4278190080 & ek.pixels.getPixel(ej) | ea << 16 | en << 8 | ec)
9289 }
9290 break;
9291 case 14:
9292 for (ej = 0; ej < el; ej++) {
9293 ek.pixels.setPixel(ej, ek.pixels.getPixel(ej) | 4278190080)
9294 }
9295 ek.format = 1;
9296 break;
9297 case 16:
9298 if (eg === null) {
9299 eg = 0.5
9300 }
9301 if (eg < 0 || eg > 1) {
9302 throw "Level must be between 0 and 1 for filter(THRESHOLD, level)"
9303 }
9304 var ee = cW.floor(eg * 255);
9305 for (ej = 0; ej < el; ej++) {
9306 var eo = cW.max((ek.pixels.getPixel(ej) & 16711680) >> 16, cW.max((ek.pixels.getPixel(ej) & 65280) >> 8, ek.pixels.getPixel(ej) & 255));
9307 ek.pixels.setPixel(ej, ek.pixels.getPixel(ej) & 4278190080 | (eo < ee ? 0 : 16777215))
9308 }
9309 break;
9310 case 17:
9311 cf(true, ek);
9312 break;
9313 case 18:
9314 cf(false, ek);
9315 break
9316 }
9317 ek.updatePixels()
9318 };
9319 cW.shared = {
9320 fracU: 0,
9321 ifU: 0,
9322 fracV: 0,
9323 ifV: 0,
9324 u1: 0,
9325 u2: 0,
9326 v1: 0,
9327 v2: 0,
9328 sX: 0,
9329 sY: 0,
9330 iw: 0,
9331 iw1: 0,
9332 ih1: 0,
9333 ul: 0,
9334 ll: 0,
9335 ur: 0,
9336 lr: 0,
9337 cUL: 0,
9338 cLL: 0,
9339 cUR: 0,
9340 cLR: 0,
9341 srcXOffset: 0,
9342 srcYOffset: 0,
9343 r: 0,
9344 g: 0,
9345 b: 0,
9346 a: 0,
9347 srcBuffer: null,
9348 blurRadius: 0,
9349 blurKernelSize: 0,
9350 blurKernel: null
9351 };
9352 cW.intersect = function(ec, ej, eb, ei, en, eg, em, ef) {
9353 var el = eb - ec + 1;
9354 var ee = ei - ej + 1;
9355 var ea = em - en + 1;
9356 var eh = ef - eg + 1;
9357 if (en < ec) {
9358 ea += en - ec;
9359 if (ea > el) {
9360 ea = el
9361 }
9362 } else {
9363 var ek = el + ec - en;
9364 if (ea > ek) {
9365 ea = ek
9366 }
9367 } if (eg < ej) {
9368 eh += eg - ej;
9369 if (eh > ee) {
9370 eh = ee
9371 }
9372 } else {
9373 var ed = ee + ej - eg;
9374 if (eh > ed) {
9375 eh = ed
9376 }
9377 }
9378 return !(ea <= 0 || eh <= 0)
9379 };
9380 var dS = {};
9381 dS[1] = cW.modes.blend;
9382 dS[2] = cW.modes.add;
9383 dS[4] = cW.modes.subtract;
9384 dS[8] = cW.modes.lightest;
9385 dS[16] = cW.modes.darkest;
9386 dS[0] = cW.modes.replace;
9387 dS[32] = cW.modes.difference;
9388 dS[64] = cW.modes.exclusion;
9389 dS[128] = cW.modes.multiply;
9390 dS[256] = cW.modes.screen;
9391 dS[512] = cW.modes.overlay;
9392 dS[1024] = cW.modes.hard_light;
9393 dS[2048] = cW.modes.soft_light;
9394 dS[4096] = cW.modes.dodge;
9395 dS[8192] = cW.modes.burn;
9396 cW.blit_resize = function(en, ez, et, ey, es, eE, ej, er, ex, eo, ew, em, ep) {
9397 var eC, eB;
9398 if (ez < 0) {
9399 ez = 0
9400 }
9401 if (et < 0) {
9402 et = 0
9403 }
9404 if (ey >= en.width) {
9405 ey = en.width - 1
9406 }
9407 if (es >= en.height) {
9408 es = en.height - 1
9409 }
9410 var eI = ey - ez;
9411 var eN = es - et;
9412 var ea = ew - ex;
9413 var ek = em - eo;
9414 if (ea <= 0 || ek <= 0 || eI <= 0 || eN <= 0 || ex >= ej || eo >= er || ez >= en.width || et >= en.height) {
9415 return
9416 }
9417 var eh = q.floor(eI / ea * 32768);
9418 var ee = q.floor(eN / ek * 32768);
9419 var eG = cW.shared;
9420 eG.srcXOffset = q.floor(ex < 0 ? -ex * eh : ez * 32768);
9421 eG.srcYOffset = q.floor(eo < 0 ? -eo * ee : et * 32768);
9422 if (ex < 0) {
9423 ea += ex;
9424 ex = 0
9425 }
9426 if (eo < 0) {
9427 ek += eo;
9428 eo = 0
9429 }
9430 ea = q.min(ea, ej - ex);
9431 ek = q.min(ek, er - eo);
9432 var eu = eo * ej + ex;
9433 var eQ;
9434 eG.srcBuffer = en.imageData.data;
9435 eG.iw = en.width;
9436 eG.iw1 = en.width - 1;
9437 eG.ih1 = en.height - 1;
9438 var ev = cW.filter_bilinear,
9439 eK = cW.filter_new_scanline,
9440 ei = dS[ep],
9441 eH, eM, eF, eJ, ec, ed, eb = 4278190080,
9442 eL = 16711680,
9443 eA = 65280,
9444 eg = 255,
9445 eP = 32767,
9446 eD = 15,
9447 el = 1,
9448 eq = 9,
9449 ef = eG.srcBuffer,
9450 eO = q.min;
9451 for (eB = 0; eB < ek; eB++) {
9452 eG.sX = eG.srcXOffset;
9453 eG.fracV = eG.srcYOffset & eP;
9454 eG.ifV = eP - eG.fracV;
9455 eG.v1 = (eG.srcYOffset >> eD) * eG.iw;
9456 eG.v2 = eO((eG.srcYOffset >> eD) + 1, eG.ih1) * eG.iw;
9457 for (eC = 0; eC < ea; eC++) {
9458 eM = (eu + eC) * 4;
9459 eQ = eE[eM + 3] << 24 & eb | eE[eM] << 16 & eL | eE[eM + 1] << 8 & eA | eE[eM + 2] & eg;
9460 eG.fracU = eG.sX & eP;
9461 eG.ifU = eP - eG.fracU;
9462 eG.ul = eG.ifU * eG.ifV >> eD;
9463 eG.ll = eG.ifU * eG.fracV >> eD;
9464 eG.ur = eG.fracU * eG.ifV >> eD;
9465 eG.lr = eG.fracU * eG.fracV >> eD;
9466 eG.u1 = eG.sX >> eD;
9467 eG.u2 = eO(eG.u1 + 1, eG.iw1);
9468 eF = (eG.v1 + eG.u1) * 4;
9469 eJ = (eG.v1 + eG.u2) * 4;
9470 ec = (eG.v2 + eG.u1) * 4;
9471 ed = (eG.v2 + eG.u2) * 4;
9472 eG.cUL = ef[eF + 3] << 24 & eb | ef[eF] << 16 & eL | ef[eF + 1] << 8 & eA | ef[eF + 2] & eg;
9473 eG.cUR = ef[eJ + 3] << 24 & eb | ef[eJ] << 16 & eL | ef[eJ + 1] << 8 & eA | ef[eJ + 2] & eg;
9474 eG.cLL = ef[ec + 3] << 24 & eb | ef[ec] << 16 & eL | ef[ec + 1] << 8 & eA | ef[ec + 2] & eg;
9475 eG.cLR = ef[ed + 3] << 24 & eb | ef[ed] << 16 & eL | ef[ed + 1] << 8 & eA | ef[ed + 2] & eg;
9476 eG.r = eG.ul * ((eG.cUL & eL) >> 16) + eG.ll * ((eG.cLL & eL) >> 16) + eG.ur * ((eG.cUR & eL) >> 16) + eG.lr * ((eG.cLR & eL) >> 16) << el & eL;
9477 eG.g = eG.ul * (eG.cUL & eA) + eG.ll * (eG.cLL & eA) + eG.ur * (eG.cUR & eA) + eG.lr * (eG.cLR & eA) >>> eD & eA;
9478 eG.b = eG.ul * (eG.cUL & eg) + eG.ll * (eG.cLL & eg) + eG.ur * (eG.cUR & eg) + eG.lr * (eG.cLR & eg) >>> eD;
9479 eG.a = eG.ul * ((eG.cUL & eb) >>> 24) + eG.ll * ((eG.cLL & eb) >>> 24) + eG.ur * ((eG.cUR & eb) >>> 24) + eG.lr * ((eG.cLR & eb) >>> 24) << eq & eb;
9480 eH = ei(eQ, eG.a | eG.r | eG.g | eG.b);
9481 eE[eM] = (eH & eL) >>> 16;
9482 eE[eM + 1] = (eH & eA) >>> 8;
9483 eE[eM + 2] = eH & eg;
9484 eE[eM + 3] = (eH & eb) >>> 24;
9485 eG.sX += eh
9486 }
9487 eu += ej;
9488 eG.srcYOffset += ee
9489 }
9490 };
9491 cW.loadFont = function(eb, ec) {
9492 if (eb === t) {
9493 throw "font name required in loadFont."
9494 }
9495 if (eb.indexOf(".svg") === -1) {
9496 if (ec === t) {
9497 ec = W.size
9498 }
9499 return H.get(eb, ec)
9500 }
9501 var ea = cW.loadGlyphs(eb);
9502 return {
9503 name: eb,
9504 css: "12px sans-serif",
9505 glyph: true,
9506 units_per_em: ea.units_per_em,
9507 horiz_adv_x: 1 / ea.units_per_em * ea.horiz_adv_x,
9508 ascent: ea.ascent,
9509 descent: ea.descent,
9510 width: function(eh) {
9511 var ef = 0;
9512 var ed = eh.length;
9513 for (var ee = 0; ee < ed; ee++) {
9514 try {
9515 ef += parseFloat(cW.glyphLook(cW.glyphTable[eb], eh[ee]).horiz_adv_x)
9516 } catch (eg) {
9517 F.debug(eg)
9518 }
9519 }
9520 return ef / cW.glyphTable[eb].units_per_em
9521 }
9522 }
9523 };
9524 cW.createFont = function(ea, eb) {
9525 return cW.loadFont(ea, eb)
9526 };
9527 cW.textFont = function(ea, ec) {
9528 if (ec !== t) {
9529 if (!ea.glyph) {
9530 ea = H.get(ea.name, ec)
9531 }
9532 d0 = ec
9533 }
9534 W = ea;
9535 Y = W.name;
9536 a3 = W.ascent;
9537 dA = W.descent;
9538 d7 = W.leading;
9539 var eb = dY.$ensureContext();
9540 eb.font = W.css
9541 };
9542 cW.textSize = function(eb) {
9543 W = H.get(Y, eb);
9544 d0 = eb;
9545 a3 = W.ascent;
9546 dA = W.descent;
9547 d7 = W.leading;
9548 var ea = dY.$ensureContext();
9549 ea.font = W.css
9550 };
9551 cW.textAscent = function() {
9552 return a3
9553 };
9554 cW.textDescent = function() {
9555 return dA
9556 };
9557 cW.textLeading = function(ea) {
9558 d7 = ea
9559 };
9560 cW.textAlign = function(eb, ea) {
9561 N = eb;
9562 c1 = ea || 0
9563 };
9564
9565 function bu(ea) {
9566 if (ea instanceof String) {
9567 return ea
9568 }
9569 if (typeof ea === "number") {
9570 if (ea === (0 | ea)) {
9571 return ea.toString()
9572 }
9573 return cW.nf(ea, 0, 3)
9574 }
9575 if (ea === null || ea === t) {
9576 return ""
9577 }
9578 return ea.toString()
9579 }
9580 bR.prototype.textWidth = function(ee) {
9581 var ea = bu(ee).split(/\r?\n/g),
9582 ec = 0;
9583 var eb, ed = ea.length;
9584 d8.font = W.css;
9585 for (eb = 0; eb < ed; ++eb) {
9586 ec = q.max(ec, W.measureTextWidth(ea[eb]))
9587 }
9588 return ec | 0
9589 };
9590 bB.prototype.textWidth = function(ef) {
9591 var ea = bu(ef).split(/\r?\n/g),
9592 ed = 0;
9593 var ec, ee = ea.length;
9594 if (cE === t) {
9595 cE = d.createElement("canvas")
9596 }
9597 var eb = cE.getContext("2d");
9598 eb.font = W.css;
9599 for (ec = 0; ec < ee; ++ec) {
9600 ed = q.max(ed, eb.measureText(ea[ec]).width)
9601 }
9602 return ed | 0
9603 };
9604 cW.glyphLook = function(ea, eb) {
9605 try {
9606 switch (eb) {
9607 case "1":
9608 return ea.one;
9609 case "2":
9610 return ea.two;
9611 case "3":
9612 return ea.three;
9613 case "4":
9614 return ea.four;
9615 case "5":
9616 return ea.five;
9617 case "6":
9618 return ea.six;
9619 case "7":
9620 return ea.seven;
9621 case "8":
9622 return ea.eight;
9623 case "9":
9624 return ea.nine;
9625 case "0":
9626 return ea.zero;
9627 case " ":
9628 return ea.space;
9629 case "$":
9630 return ea.dollar;
9631 case "!":
9632 return ea.exclam;
9633 case '"':
9634 return ea.quotedbl;
9635 case "#":
9636 return ea.numbersign;
9637 case "%":
9638 return ea.percent;
9639 case "&":
9640 return ea.ampersand;
9641 case "'":
9642 return ea.quotesingle;
9643 case "(":
9644 return ea.parenleft;
9645 case ")":
9646 return ea.parenright;
9647 case "*":
9648 return ea.asterisk;
9649 case "+":
9650 return ea.plus;
9651 case ",":
9652 return ea.comma;
9653 case "-":
9654 return ea.hyphen;
9655 case ".":
9656 return ea.period;
9657 case "/":
9658 return ea.slash;
9659 case "_":
9660 return ea.underscore;
9661 case ":":
9662 return ea.colon;
9663 case ";":
9664 return ea.semicolon;
9665 case "<":
9666 return ea.less;
9667 case "=":
9668 return ea.equal;
9669 case ">":
9670 return ea.greater;
9671 case "?":
9672 return ea.question;
9673 case "@":
9674 return ea.at;
9675 case "[":
9676 return ea.bracketleft;
9677 case "\\":
9678 return ea.backslash;
9679 case "]":
9680 return ea.bracketright;
9681 case "^":
9682 return ea.asciicircum;
9683 case "`":
9684 return ea.grave;
9685 case "{":
9686 return ea.braceleft;
9687 case "|":
9688 return ea.bar;
9689 case "}":
9690 return ea.braceright;
9691 case "~":
9692 return ea.asciitilde;
9693 default:
9694 return ea[eb]
9695 }
9696 } catch (ec) {
9697 F.debug(ec)
9698 }
9699 };
9700 bR.prototype.text$line = function(ei, el, ek, ej, ef) {
9701 var eh = 0,
9702 eg = 0;
9703 if (!W.glyph) {
9704 if (ei && "fillText" in d8) {
9705 if (aq) {
9706 d8.fillStyle = cW.color.toString(a1);
9707 aq = false
9708 }
9709 if (ef === 39 || ef === 3) {
9710 eh = W.measureTextWidth(ei);
9711 if (ef === 39) {
9712 eg = -eh
9713 } else {
9714 eg = -eh / 2
9715 }
9716 }
9717 d8.fillText(ei, el + eg, ek)
9718 }
9719 } else {
9720 var ea = cW.glyphTable[Y];
9721 aD();
9722 d8.translate(el, ek + d0);
9723 if (ef === 39 || ef === 3) {
9724 eh = ea.width(ei);
9725 if (ef === 39) {
9726 eg = -eh
9727 } else {
9728 eg = -eh / 2
9729 }
9730 }
9731 var em = ea.units_per_em,
9732 ee = 1 / em * d0;
9733 d8.scale(ee, ee);
9734 for (var eb = 0, ec = ei.length; eb < ec; eb++) {
9735 try {
9736 cW.glyphLook(ea, ei[eb]).draw()
9737 } catch (ed) {
9738 F.debug(ed)
9739 }
9740 }
9741 cP()
9742 }
9743 };
9744 bB.prototype.text$line = function(eh, el, ek, ei, ef) {
9745 if (cE === t) {
9746 cE = d.createElement("canvas")
9747 }
9748 var eb = d8;
9749 d8 = cE.getContext("2d");
9750 d8.font = W.css;
9751 var eg = W.measureTextWidth(eh);
9752 cE.width = eg;
9753 cE.height = d0;
9754 d8 = cE.getContext("2d");
9755 d8.font = W.css;
9756 d8.textBaseline = "top";
9757 bR.prototype.text$line(eh, 0, 0, 0, 37);
9758 var ea = cE.width / cE.height;
9759 d8 = eb;
9760 d8.bindTexture(d8.TEXTURE_2D, bS);
9761 d8.texImage2D(d8.TEXTURE_2D, 0, d8.RGBA, d8.RGBA, d8.UNSIGNED_BYTE, cE);
9762 d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_MAG_FILTER, d8.LINEAR);
9763 d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_MIN_FILTER, d8.LINEAR);
9764 d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_WRAP_T, d8.CLAMP_TO_EDGE);
9765 d8.texParameteri(d8.TEXTURE_2D, d8.TEXTURE_WRAP_S, d8.CLAMP_TO_EDGE);
9766 var ee = 0;
9767 if (ef === 39) {
9768 ee = -eg
9769 } else {
9770 if (ef === 3) {
9771 ee = -eg / 2
9772 }
9773 }
9774 var ec = new aP;
9775 var ed = d0 * 0.5;
9776 ec.translate(el + ee - ed / 2, ek - ed, ei);
9777 ec.scale(-ea * ed, -ed, ed);
9778 ec.translate(-1, -1, -1);
9779 ec.transpose();
9780 var ej = new aP;
9781 ej.scale(1, -1, 1);
9782 ej.apply(dJ.array());
9783 ej.transpose();
9784 d8.useProgram(dQ);
9785 dc("aVertex2d", dQ, "aVertex", 3, cH);
9786 dc("aTextureCoord2d", dQ, "aTextureCoord", 2, ac);
9787 dZ("uSampler2d", dQ, "uSampler", [0]);
9788 dZ("uIsDrawingText2d", dQ, "uIsDrawingText", true);
9789 a9("uModel2d", dQ, "uModel", false, ec.array());
9790 a9("uView2d", dQ, "uView", false, ej.array());
9791 d2("uColor2d", dQ, "uColor", bo);
9792 d8.bindBuffer(d8.ELEMENT_ARRAY_BUFFER, R);
9793 d8.drawElements(d8.TRIANGLES, 6, d8.UNSIGNED_SHORT, 0)
9794 };
9795
9796 function bi(ed, eg, ef, ee) {
9797 var ei, ec;
9798 if (ed.indexOf("\n") < 0) {
9799 ei = [ed];
9800 ec = 1
9801 } else {
9802 ei = ed.split(/\r?\n/g);
9803 ec = ei.length
9804 }
9805 var ea = 0;
9806 if (c1 === 101) {
9807 ea = a3 + dA
9808 } else {
9809 if (c1 === 3) {
9810 ea = a3 / 2 - (ec - 1) * d7 / 2
9811 } else {
9812 if (c1 === 102) {
9813 ea = -(dA + (ec - 1) * d7)
9814 }
9815 }
9816 }
9817 for (var eb = 0; eb < ec; ++eb) {
9818 var eh = ei[eb];
9819 dY.text$line(eh, eg, ef + ea, ee, N);
9820 ea += d7
9821 }
9822 }
9823
9824 function bd(eq, el, ek, ep, en, ej) {
9825 if (eq.length === 0 || ep === 0 || en === 0) {
9826 return
9827 }
9828 if (d0 > en) {
9829 return
9830 }
9831 var em = -1;
9832 var ee = 0;
9833 var ea = 0;
9834 var eg = [];
9835 for (var ef = 0, es = eq.length; ef < es; ef++) {
9836 var eh = eq[ef];
9837 var ev = eh === " ";
9838 var eo = W.measureTextWidth(eh);
9839 if (eh !== "\n" && ea + eo <= ep) {
9840 if (ev) {
9841 em = ef
9842 }
9843 ea += eo
9844 } else {
9845 if (em + 1 === ee) {
9846 if (ef > 0) {
9847 em = ef
9848 } else {
9849 return
9850 }
9851 }
9852 if (eh === "\n") {
9853 eg.push({
9854 text: eq.substring(ee, ef),
9855 width: ea
9856 });
9857 ee = ef + 1
9858 } else {
9859 eg.push({
9860 text: eq.substring(ee, em + 1),
9861 width: ea
9862 });
9863 ee = em + 1
9864 }
9865 ea = 0;
9866 ef = ee - 1
9867 }
9868 }
9869 if (ee < es) {
9870 eg.push({
9871 text: eq.substring(ee),
9872 width: ea
9873 })
9874 }
9875 var eu = 1,
9876 ei = a3;
9877 if (N === 3) {
9878 eu = ep / 2
9879 } else {
9880 if (N === 39) {
9881 eu = ep
9882 }
9883 }
9884 var er = eg.length,
9885 eb = q.min(er, q.floor(en / d7));
9886 if (c1 === 101) {
9887 ei = a3 + dA
9888 } else {
9889 if (c1 === 3) {
9890 ei = en / 2 - d7 * (eb / 2 - 1)
9891 } else {
9892 if (c1 === 102) {
9893 ei = dA + d7
9894 }
9895 }
9896 }
9897 var ec, ed, et;
9898 for (ec = 0; ec < er; ec++) {
9899 et = ec * d7;
9900 if (ei + et > en - dA) {
9901 break
9902 }
9903 ed = eg[ec];
9904 dY.text$line(ed.text, el + eu, ek + ei + et, ej, N)
9905 }
9906 }
9907 cW.text = function() {
9908 if (cI === 5) {
9909 return
9910 }
9911 if (arguments.length === 3) {
9912 bi(bu(arguments[0]), arguments[1], arguments[2], 0)
9913 } else {
9914 if (arguments.length === 4) {
9915 bi(bu(arguments[0]), arguments[1], arguments[2], arguments[3])
9916 } else {
9917 if (arguments.length === 5) {
9918 bd(bu(arguments[0]), arguments[1], arguments[2], arguments[3], arguments[4], 0)
9919 } else {
9920 if (arguments.length === 6) {
9921 bd(bu(arguments[0]), arguments[1], arguments[2], arguments[3], arguments[4], arguments[5])
9922 }
9923 }
9924 }
9925 }
9926 };
9927 cW.textMode = function(ea) {
9928 cI = ea
9929 };
9930 cW.loadGlyphs = function(eg) {
9931 var ei, eh, ee, ec, ep, eo, en, eq, ek, er, el, em = "[0-9\\-]+",
9932 ej;
9933 var ef = function(ex, ew) {
9934 var eu = 0,
9935 et = [],
9936 es, ev = new RegExp(ex, "g");
9937 es = et[eu] = ev.exec(ew);
9938 while (es) {
9939 eu++;
9940 es = et[eu] = ev.exec(ew)
9941 }
9942 return et
9943 };
9944 var eb = function(ex) {
9945 var ey = ef("[A-Za-z][0-9\\- ]+|Z", ex);
9946 var ew = function() {
9947 aD();
9948 return dY.$ensureContext()
9949 };
9950 var eu = function() {
9951 bn();
9952 dd();
9953 cP()
9954 };
9955 ej = "return {draw:function(){var curContext=beforePathDraw();curContext.beginPath();";
9956 ei = 0;
9957 eh = 0;
9958 ee = 0;
9959 ec = 0;
9960 ep = 0;
9961 eo = 0;
9962 ex = 0;
9963 eq = 0;
9964 ek = "";
9965 er = ey.length - 1;
9966 for (var et = 0; et < er; et++) {
9967 var es = ey[et][0],
9968 ev = ef(em, es);
9969 switch (es[0]) {
9970 case "M":
9971 ei = parseFloat(ev[0][0]);
9972 eh = parseFloat(ev[1][0]);
9973 ej += "curContext.moveTo(" + ei + "," + -eh + ");";
9974 break;
9975 case "L":
9976 ei = parseFloat(ev[0][0]);
9977 eh = parseFloat(ev[1][0]);
9978 ej += "curContext.lineTo(" + ei + "," + -eh + ");";
9979 break;
9980 case "H":
9981 ei = parseFloat(ev[0][0]);
9982 ej += "curContext.lineTo(" + ei + "," + -eh + ");";
9983 break;
9984 case "V":
9985 eh = parseFloat(ev[0][0]);
9986 ej += "curContext.lineTo(" + ei + "," + -eh + ");";
9987 break;
9988 case "T":
9989 ep = parseFloat(ev[0][0]);
9990 eo = parseFloat(ev[1][0]);
9991 if (ek === "Q" || ek === "T") {
9992 ex = q.sqrt(q.pow(ei - ee, 2) + q.pow(ec - eh, 2));
9993 eq = q.PI + q.atan2(ee - ei, ec - eh);
9994 ee = ei + q.sin(eq) * ex;
9995 ec = eh + q.cos(eq) * ex
9996 } else {
9997 ee = ei;
9998 ec = eh
9999 }
10000 ej += "curContext.quadraticCurveTo(" + ee + "," + -ec + "," + ep + "," + -eo + ");";
10001 ei = ep;
10002 eh = eo;
10003 break;
10004 case "Q":
10005 ee = parseFloat(ev[0][0]);
10006 ec = parseFloat(ev[1][0]);
10007 ep = parseFloat(ev[2][0]);
10008 eo = parseFloat(ev[3][0]);
10009 ej += "curContext.quadraticCurveTo(" + ee + "," + -ec + "," + ep + "," + -eo + ");";
10010 ei = ep;
10011 eh = eo;
10012 break;
10013 case "Z":
10014 ej += "curContext.closePath();";
10015 break
10016 }
10017 ek = es[0]
10018 }
10019 ej += "afterPathDraw();";
10020 ej += "curContext.translate(" + el + ",0);";
10021 ej += "}}";
10022 return (new Function("beforePathDraw", "afterPathDraw", ej))(ew, eu)
10023 };
10024 var ea = function(ev) {
10025 var eu = ev.getElementsByTagName("font");
10026 cW.glyphTable[eg].horiz_adv_x = eu[0].getAttribute("horiz-adv-x");
10027 var ex = ev.getElementsByTagName("font-face")[0];
10028 cW.glyphTable[eg].units_per_em = parseFloat(ex.getAttribute("units-per-em"));
10029 cW.glyphTable[eg].ascent = parseFloat(ex.getAttribute("ascent"));
10030 cW.glyphTable[eg].descent = parseFloat(ex.getAttribute("descent"));
10031 var ez = ev.getElementsByTagName("glyph"),
10032 et = ez.length;
10033 for (var ey = 0; ey < et; ey++) {
10034 var es = ez[ey].getAttribute("unicode");
10035 var ew = ez[ey].getAttribute("glyph-name");
10036 el = ez[ey].getAttribute("horiz-adv-x");
10037 if (el === null) {
10038 el = cW.glyphTable[eg].horiz_adv_x
10039 }
10040 en = ez[ey].getAttribute("d");
10041 if (en !== t) {
10042 ej = eb(en);
10043 cW.glyphTable[eg][ew] = {
10044 name: ew,
10045 unicode: es,
10046 horiz_adv_x: el,
10047 draw: ej.draw
10048 }
10049 }
10050 }
10051 };
10052 var ed = function() {
10053 var eu;
10054 try {
10055 eu = d.implementation.createDocument("", "", null)
10056 } catch (ew) {
10057 F.debug(ew.message);
10058 return
10059 }
10060 try {
10061 eu.async = false;
10062 eu.load(eg);
10063 ea(eu.getElementsByTagName("svg")[0])
10064 } catch (et) {
10065 F.debug(et);
10066 try {
10067 var es = new D.XMLHttpRequest;
10068 es.open("GET", eg, false);
10069 es.send(null);
10070 ea(es.responseXML.documentElement)
10071 } catch (ev) {
10072 F.debug(et)
10073 }
10074 }
10075 };
10076 cW.glyphTable[eg] = {};
10077 ed(eg);
10078 return cW.glyphTable[eg]
10079 };
10080 cW.param = function(ec) {
10081 var eb = "data-processing-" + ec;
10082 if (ae.hasAttribute(eb)) {
10083 return ae.getAttribute(eb)
10084 }
10085 for (var ed = 0, ea = ae.childNodes.length; ed < ea; ++ed) {
10086 var ee = ae.childNodes.item(ed);
10087 if (ee.nodeType !== 1 || ee.tagName.toLowerCase() !== "param") {
10088 continue
10089 }
10090 if (ee.getAttribute("name") === ec) {
10091 return ee.getAttribute("value")
10092 }
10093 }
10094 if (cQ.params.hasOwnProperty(ec)) {
10095 return cQ.params[ec]
10096 }
10097 return null
10098 };
10099
10100 function cL(eb) {
10101 if (eb === "3D") {
10102 dY = new bB
10103 } else {
10104 if (eb === "2D") {
10105 dY = new bR
10106 } else {
10107 dY = new ca
10108 }
10109 }
10110 for (var ea in ca.prototype) {
10111 if (ca.prototype.hasOwnProperty(ea) && ea.indexOf("$") < 0) {
10112 cW[ea] = dY[ea]
10113 }
10114 }
10115 dY.$init()
10116 }
10117
10118 function cU(ea) {
10119 return function() {
10120 cL("2D");
10121 return dY[ea].apply(this, arguments)
10122 }
10123 }
10124 ca.prototype.translate = cU("translate");
10125 ca.prototype.transform = cU("transform");
10126 ca.prototype.scale = cU("scale");
10127 ca.prototype.pushMatrix = cU("pushMatrix");
10128 ca.prototype.popMatrix = cU("popMatrix");
10129 ca.prototype.resetMatrix = cU("resetMatrix");
10130 ca.prototype.applyMatrix = cU("applyMatrix");
10131 ca.prototype.rotate = cU("rotate");
10132 ca.prototype.rotateZ = cU("rotateZ");
10133 ca.prototype.shearX = cU("shearX");
10134 ca.prototype.shearY = cU("shearY");
10135 ca.prototype.redraw = cU("redraw");
10136 ca.prototype.toImageData = cU("toImageData");
10137 ca.prototype.ambientLight = cU("ambientLight");
10138 ca.prototype.directionalLight = cU("directionalLight");
10139 ca.prototype.lightFalloff = cU("lightFalloff");
10140 ca.prototype.lightSpecular = cU("lightSpecular");
10141 ca.prototype.pointLight = cU("pointLight");
10142 ca.prototype.noLights = cU("noLights");
10143 ca.prototype.spotLight = cU("spotLight");
10144 ca.prototype.beginCamera = cU("beginCamera");
10145 ca.prototype.endCamera = cU("endCamera");
10146 ca.prototype.frustum = cU("frustum");
10147 ca.prototype.box = cU("box");
10148 ca.prototype.sphere = cU("sphere");
10149 ca.prototype.ambient = cU("ambient");
10150 ca.prototype.emissive = cU("emissive");
10151 ca.prototype.shininess = cU("shininess");
10152 ca.prototype.specular = cU("specular");
10153 ca.prototype.fill = cU("fill");
10154 ca.prototype.stroke = cU("stroke");
10155 ca.prototype.strokeWeight = cU("strokeWeight");
10156 ca.prototype.smooth = cU("smooth");
10157 ca.prototype.noSmooth = cU("noSmooth");
10158 ca.prototype.point = cU("point");
10159 ca.prototype.vertex = cU("vertex");
10160 ca.prototype.endShape = cU("endShape");
10161 ca.prototype.bezierVertex = cU("bezierVertex");
10162 ca.prototype.curveVertex = cU("curveVertex");
10163 ca.prototype.curve = cU("curve");
10164 ca.prototype.line = cU("line");
10165 ca.prototype.bezier = cU("bezier");
10166 ca.prototype.rect = cU("rect");
10167 ca.prototype.ellipse = cU("ellipse");
10168 ca.prototype.background = cU("background");
10169 ca.prototype.image = cU("image");
10170 ca.prototype.textWidth = cU("textWidth");
10171 ca.prototype.text$line = cU("text$line");
10172 ca.prototype.$ensureContext = cU("$ensureContext");
10173 ca.prototype.$newPMatrix = cU("$newPMatrix");
10174 ca.prototype.size = function(ea, ec, eb) {
10175 cL(eb === 2 ? "3D" : "2D");
10176 cW.size(ea, ec, eb)
10177 };
10178 ca.prototype.$init = G;
10179 bR.prototype.$init = function() {
10180 cW.size(cW.width, cW.height);
10181 d8.lineCap = "round";
10182 cW.noSmooth();
10183 cW.disableContextMenu()
10184 };
10185 bB.prototype.$init = function() {
10186 cW.use3DContext = true;
10187 cW.disableContextMenu()
10188 };
10189 ds.prototype.$ensureContext = function() {
10190 return d8
10191 };
10192
10193 function dy(eb, ed) {
10194 var ec = eb,
10195 ea = 0,
10196 ee = 0;
10197 cW.pmouseX = cW.mouseX;
10198 cW.pmouseY = cW.mouseY;
10199 if (ec.offsetParent) {
10200 do {
10201 ea += ec.offsetLeft;
10202 ee += ec.offsetTop
10203 } while (!!(ec = ec.offsetParent))
10204 }
10205 ec = eb;
10206 do {
10207 ea -= ec.scrollLeft || 0;
10208 ee -= ec.scrollTop || 0
10209 } while (!!(ec = ec.parentNode));
10210 ea += ad;
10211 ee += dp;
10212 ea += aU;
10213 ee += bX;
10214 ea += D.pageXOffset;
10215 ee += D.pageYOffset;
10216 return {
10217 X: ea,
10218 Y: ee
10219 }
10220 }
10221
10222 function aI(ea, eb) {
10223 var ec = dy(ea, eb);
10224 cW.mouseX = eb.pageX - ec.X;
10225 cW.mouseY = eb.pageY - ec.Y
10226 }
10227
10228 function cu(eb) {
10229 var ed = dy(eb.changedTouches[0].target, eb.changedTouches[0]),
10230 ea;
10231 for (ea = 0; ea < eb.touches.length; ea++) {
10232 var ef = eb.touches[ea];
10233 ef.offsetX = ef.pageX - ed.X;
10234 ef.offsetY = ef.pageY - ed.Y
10235 }
10236 for (ea = 0; ea < eb.targetTouches.length; ea++) {
10237 var ec = eb.targetTouches[ea];
10238 ec.offsetX = ec.pageX - ed.X;
10239 ec.offsetY = ec.pageY - ed.Y
10240 }
10241 for (ea = 0; ea < eb.changedTouches.length; ea++) {
10242 var ee = eb.changedTouches[ea];
10243 ee.offsetX = ee.pageX - ed.X;
10244 ee.offsetY = ee.pageY - ed.Y
10245 }
10246 return eb
10247 }
10248 bO(ae, "touchstart", function(ec) {
10249 ae.setAttribute("style", "-webkit-user-select: none");
10250 ae.setAttribute("onclick", "void(0)");
10251 ae.setAttribute("style", "-webkit-tap-highlight-color:rgba(0,0,0,0)");
10252 for (var eb = 0, ea = au.length; eb < ea; eb++) {
10253 var ed = au[eb].type;
10254 if (ed === "mouseout" || ed === "mousemove" || ed === "mousedown" || ed === "mouseup" || ed === "DOMMouseScroll" || ed === "mousewheel" || ed === "touchstart") {
10255 de(au[eb])
10256 }
10257 }
10258 if (cW.touchStart !== t || cW.touchMove !== t || cW.touchEnd !== t || cW.touchCancel !== t) {
10259 bO(ae, "touchstart", function(ee) {
10260 if (cW.touchStart !== t) {
10261 ee = cu(ee);
10262 cW.touchStart(ee)
10263 }
10264 });
10265 bO(ae, "touchmove", function(ee) {
10266 if (cW.touchMove !== t) {
10267 ee.preventDefault();
10268 ee = cu(ee);
10269 cW.touchMove(ee)
10270 }
10271 });
10272 bO(ae, "touchend", function(ee) {
10273 if (cW.touchEnd !== t) {
10274 ee = cu(ee);
10275 cW.touchEnd(ee)
10276 }
10277 });
10278 bO(ae, "touchcancel", function(ee) {
10279 if (cW.touchCancel !== t) {
10280 ee = cu(ee);
10281 cW.touchCancel(ee)
10282 }
10283 })
10284 } else {
10285 bO(ae, "touchstart", function(ee) {
10286 aI(ae, ee.touches[0]);
10287 cW.__mousePressed = true;
10288 cW.mouseDragging = false;
10289 cW.mouseButton = 37;
10290 if (typeof cW.mousePressed === "function") {
10291 cW.mousePressed()
10292 }
10293 });
10294 bO(ae, "touchmove", function(ee) {
10295 ee.preventDefault();
10296 aI(ae, ee.touches[0]);
10297 if (typeof cW.mouseMoved === "function" && !cW.__mousePressed) {
10298 cW.mouseMoved()
10299 }
10300 if (typeof cW.mouseDragged === "function" && cW.__mousePressed) {
10301 cW.mouseDragged();
10302 cW.mouseDragging = true
10303 }
10304 });
10305 bO(ae, "touchend", function(ee) {
10306 cW.__mousePressed = false;
10307 if (typeof cW.mouseClicked === "function" && !cW.mouseDragging) {
10308 cW.mouseClicked()
10309 }
10310 if (typeof cW.mouseReleased === "function") {
10311 cW.mouseReleased()
10312 }
10313 })
10314 }
10315 ae.dispatchEvent(ec)
10316 });
10317 (function() {
10318 var ea = true,
10319 eb = function(ec) {
10320 ec.preventDefault();
10321 ec.stopPropagation()
10322 };
10323 cW.disableContextMenu = function() {
10324 if (!ea) {
10325 return
10326 }
10327 bO(ae, "contextmenu", eb);
10328 ea = false
10329 };
10330 cW.enableContextMenu = function() {
10331 if (ea) {
10332 return
10333 }
10334 de({
10335 elem: ae,
10336 type: "contextmenu",
10337 fn: eb
10338 });
10339 ea = true
10340 }
10341 })();
10342 bO(ae, "mousemove", function(ea) {
10343 aI(ae, ea);
10344 if (typeof cW.mouseMoved === "function" && !cW.__mousePressed) {
10345 cW.mouseMoved()
10346 }
10347 if (typeof cW.mouseDragged === "function" && cW.__mousePressed) {
10348 cW.mouseDragged();
10349 cW.mouseDragging = true
10350 }
10351 });
10352 bO(ae, "mouseout", function(ea) {
10353 if (typeof cW.mouseOut === "function") {
10354 cW.mouseOut()
10355 }
10356 });
10357 bO(ae, "mouseover", function(ea) {
10358 aI(ae, ea);
10359 if (typeof cW.mouseOver === "function") {
10360 cW.mouseOver()
10361 }
10362 });
10363 ae.onmousedown = function() {
10364 ae.focus();
10365 return false
10366 };
10367 bO(ae, "mousedown", function(ea) {
10368 cW.__mousePressed = true;
10369 cW.mouseDragging = false;
10370 switch (ea.which) {
10371 case 1:
10372 cW.mouseButton = 37;
10373 break;
10374 case 2:
10375 cW.mouseButton = 3;
10376 break;
10377 case 3:
10378 cW.mouseButton = 39;
10379 break
10380 }
10381 if (typeof cW.mousePressed === "function") {
10382 cW.mousePressed()
10383 }
10384 });
10385 bO(ae, "mouseup", function(ea) {
10386 cW.__mousePressed = false;
10387 if (typeof cW.mouseClicked === "function" && !cW.mouseDragging) {
10388 cW.mouseClicked()
10389 }
10390 if (typeof cW.mouseReleased === "function") {
10391 cW.mouseReleased()
10392 }
10393 });
10394 var an = function(ea) {
10395 var eb = 0;
10396 if (ea.wheelDelta) {
10397 eb = ea.wheelDelta / 120;
10398 if (D.opera) {
10399 eb = -eb
10400 }
10401 } else {
10402 if (ea.detail) {
10403 eb = -ea.detail / 3
10404 }
10405 }
10406 cW.mouseScroll = eb;
10407 if (eb && typeof cW.mouseScrolled === "function") {
10408 cW.mouseScrolled()
10409 }
10410 };
10411 bO(d, "DOMMouseScroll", an);
10412 bO(d, "mousewheel", an);
10413 if (!ae.getAttribute("tabindex")) {
10414 ae.setAttribute("tabindex", 0)
10415 }
10416
10417 function dD(eb) {
10418 var ea = eb.which || eb.keyCode;
10419 switch (ea) {
10420 case 13:
10421 return 10;
10422 case 91:
10423 case 93:
10424 case 224:
10425 return 157;
10426 case 57392:
10427 return 17;
10428 case 46:
10429 return 127;
10430 case 45:
10431 return 155
10432 }
10433 return ea
10434 }
10435
10436 function cB(eb) {
10437 var ec = eb.which || eb.keyCode;
10438 var ea = eb.shiftKey || eb.ctrlKey || eb.altKey || eb.metaKey;
10439 switch (ec) {
10440 case 13:
10441 ec = ea ? 13 : 10;
10442 break;
10443 case 8:
10444 ec = ea ? 127 : 8;
10445 break
10446 }
10447 return new bP(ec)
10448 }
10449
10450 function cR(ea) {
10451 if (typeof ea.preventDefault === "function") {
10452 ea.preventDefault()
10453 } else {
10454 if (typeof ea.stopPropagation === "function") {
10455 ea.stopPropagation()
10456 }
10457 }
10458 return false
10459 }
10460
10461 function dG() {
10462 var ea;
10463 for (ea in ag) {
10464 if (ag.hasOwnProperty(ea)) {
10465 cW.__keyPressed = true;
10466 return
10467 }
10468 }
10469 cW.__keyPressed = false
10470 }
10471
10472 function cx() {
10473 cW.__keyPressed = false;
10474 ag = [];
10475 dI = null
10476 }
10477
10478 function bq(ea, eb) {
10479 ag[ea] = eb;
10480 dI = null;
10481 cW.key = eb;
10482 cW.keyCode = ea;
10483 cW.keyPressed();
10484 cW.keyCode = 0;
10485 cW.keyTyped();
10486 dG()
10487 }
10488
10489 function cz(eb) {
10490 var ea = dD(eb);
10491 if (ea === 127) {
10492 bq(ea, new bP(127));
10493 return
10494 }
10495 if (dX.indexOf(ea) < 0) {
10496 dI = ea;
10497 return
10498 }
10499 var ec = new bP(65535);
10500 cW.key = ec;
10501 cW.keyCode = ea;
10502 ag[ea] = ec;
10503 cW.keyPressed();
10504 dI = null;
10505 dG();
10506 return cR(eb)
10507 }
10508
10509 function dv(eb) {
10510 if (dI === null) {
10511 return
10512 }
10513 var ea = dI,
10514 ec = cB(eb);
10515 bq(ea, ec);
10516 return cR(eb)
10517 }
10518
10519 function cp(eb) {
10520 var ea = dD(eb),
10521 ec = ag[ea];
10522 if (ec === t) {
10523 return
10524 }
10525 cW.key = ec;
10526 cW.keyCode = ea;
10527 cW.keyReleased();
10528 delete ag[ea];
10529 dG()
10530 }
10531 if (!cV) {
10532 if (ba instanceof F.Sketch) {
10533 cQ = ba
10534 } else {
10535 if (typeof ba === "function") {
10536 cQ = new F.Sketch(ba)
10537 } else {
10538 if (!ba) {
10539 cQ = new F.Sketch(function() {})
10540 } else {
10541 cQ = F.compile(ba)
10542 }
10543 }
10544 }
10545 cW.externals.sketch = cQ;
10546 cL();
10547 ae.onfocus = function() {
10548 cW.focused = true
10549 };
10550 ae.onblur = function() {
10551 cW.focused = false;
10552 if (!cQ.options.globalKeyEvents) {
10553 cx()
10554 }
10555 };
10556 if (cQ.options.pauseOnBlur) {
10557 bO(D, "focus", function() {
10558 if (aC) {
10559 cW.loop()
10560 }
10561 });
10562 bO(D, "blur", function() {
10563 if (aC && ax) {
10564 cW.noLoop();
10565 aC = true
10566 }
10567 cx()
10568 })
10569 }
10570 var aV = cQ.options.globalKeyEvents ? D : ae;
10571 bO(aV, "keydown", cz);
10572 bO(aV, "keypress", dv);
10573 bO(aV, "keyup", cp);
10574 for (var c4 in F.lib) {
10575 if (F.lib.hasOwnProperty(c4)) {
10576 if (F.lib[c4].hasOwnProperty("attach")) {
10577 F.lib[c4].attach(cW)
10578 } else {
10579 if (F.lib[c4] instanceof Function) {
10580 F.lib[c4].call(this)
10581 }
10582 }
10583 }
10584 }
10585 var dB = 100;
10586 var b6 = function(ed) {
10587 if (!(cQ.imageCache.pending || H.preloading.pending(dB))) {
10588 if (D.opera) {
10589 var ec, eb, ea = cQ.imageCache.operaCache;
10590 for (ec in ea) {
10591 if (ea.hasOwnProperty(ec)) {
10592 eb = ea[ec];
10593 if (eb !== null) {
10594 d.body.removeChild(eb)
10595 }
10596 delete ea[ec]
10597 }
10598 }
10599 }
10600 cQ.attach(ed, g);
10601 cQ.onLoad(ed);
10602 if (ed.setup) {
10603 ed.setup();
10604 ed.resetMatrix();
10605 cQ.onSetup()
10606 }
10607 T();
10608 if (ed.draw) {
10609 if (!aC) {
10610 ed.redraw()
10611 } else {
10612 ed.loop()
10613 }
10614 }
10615 } else {
10616 D.setTimeout(function() {
10617 b6(ed)
10618 }, dB)
10619 }
10620 };
10621 a(this);
10622 b6(cW)
10623 } else {
10624 cQ = new F.Sketch;
10625 cL();
10626 cW.size = function(ea, ec, eb) {
10627 if (eb && eb === 2) {
10628 cL("3D")
10629 } else {
10630 cL("2D")
10631 }
10632 cW.size(ea, ec, eb)
10633 }
10634 }
10635 };
10636 F.debug = s;
10637 F.prototype = g;
10638
10639 function u() {
10640 var R = ["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"];
10641 var P = {};
10642 var Q, O;
10643 for (Q = 0, O = R.length; Q < O; ++Q) {
10644 P[R[Q]] = null
10645 }
10646 for (var S in F.lib) {
10647 if (F.lib.hasOwnProperty(S)) {
10648 if (F.lib[S].exports) {
10649 var N = F.lib[S].exports;
10650 for (Q = 0, O = N.length; Q < O; ++Q) {
10651 P[N[Q]] = null
10652 }
10653 }
10654 }
10655 }
10656 return P
10657 }
10658
10659 function c(ar) {
10660 var aX = u();
10661
10662 function aE(bq) {
10663 var bt = [];
10664 var bv = bq.split(/([\{\[\(\)\]\}])/);
10665 var by = bv[0];
10666 var bw = [];
10667 for (var bs = 1; bs < bv.length; bs += 2) {
10668 var bx = bv[bs];
10669 if (bx === "[" || bx === "{" || bx === "(") {
10670 bw.push(by);
10671 by = bx
10672 } else {
10673 if (bx === "]" || bx === "}" || bx === ")") {
10674 var br = bx === "}" ? "A" : bx === ")" ? "B" : "C";
10675 var bu = bt.length;
10676 bt.push(by + bx);
10677 by = bw.pop() + '"' + br + (bu + 1) + '"'
10678 }
10679 }
10680 by += bv[bs + 1]
10681 }
10682 bt.unshift(by);
10683 return bt
10684 }
10685
10686 function aj(br, bq) {
10687 return br.replace(/'(\d+)'/g, function(bt, bs) {
10688 var bu = bq[bs];
10689 if (bu.charAt(0) === "/") {
10690 return bu
10691 }
10692 return /^'((?:[^'\\\n])|(?:\\.[0-9A-Fa-f]*))'$/.test(bu) ? "(new $p.Character(" + bu + "))" : bu
10693 })
10694 }
10695
10696 function aP(bt) {
10697 var bs = /^\s*/.exec(bt),
10698 bq;
10699 if (bs[0].length === bt.length) {
10700 bq = {
10701 left: bs[0],
10702 middle: "",
10703 right: ""
10704 }
10705 } else {
10706 var br = /\s*$/.exec(bt);
10707 bq = {
10708 left: bs[0],
10709 middle: bt.substring(bs[0].length, br.index),
10710 right: br[0]
10711 }
10712 }
10713 bq.untrim = function(bu) {
10714 return this.left + bu + this.right
10715 };
10716 return bq
10717 }
10718
10719 function a6(bq) {
10720 return bq.replace(/^\s+/, "").replace(/\s+$/, "")
10721 }
10722
10723 function av(bs, bt) {
10724 for (var br = 0, bq = bt.length; br < bq; ++br) {
10725 bs[bt[br]] = null
10726 }
10727 return bs
10728 }
10729
10730 function ba(br) {
10731 for (var bq in br) {
10732 if (br.hasOwnProperty(bq)) {
10733 return false
10734 }
10735 }
10736 return true
10737 }
10738
10739 function aQ(bq) {
10740 return bq.substring(2, bq.length - 1)
10741 }
10742 var bg = ar.replace(/\r\n?|\n\r/g, "\n");
10743 var N = [];
10744 var a3 = bg.replace(/("(?:[^"\\\n]|\\.)*")|('(?:[^'\\\n]|\\.)*')|(([\[\(=|&!\^:?]\s*)(\/(?![*\/])(?:[^\/\\\n]|\\.)*\/[gim]*)\b)|(\/\/[^\n]*\n)|(\/\*(?:(?!\*\/)(?:.|\n))*\*\/)/g, function(by, br, bv, bw, bt, bx, bq, bs) {
10745 var bu;
10746 if (br || bv) {
10747 bu = N.length;
10748 N.push(by);
10749 return "'" + bu + "'"
10750 }
10751 if (bw) {
10752 bu = N.length;
10753 N.push(bx);
10754 return bt + "'" + bu + "'"
10755 }
10756 return bs !== "" ? " " : "\n"
10757 });
10758 a3 = a3.replace(/__x([0-9A-F]{4})/g, function(br, bq) {
10759 return "__x005F_x" + bq
10760 });
10761 a3 = a3.replace(/\$/g, "__x0024");
10762 var Z;
10763 var aA = a3;
10764 var aa = function(br, bs, bq, bt) {
10765 if (!!bs || !!bt) {
10766 return br
10767 }
10768 Z = true;
10769 return ""
10770 };
10771 do {
10772 Z = false;
10773 aA = aA.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, aa)
10774 } while (Z);
10775 var bk = aE(aA);
10776 var al;
10777 var aJ = {},
10778 a9, az = 0;
10779
10780 function bc(br, bq) {
10781 var bs = bk.length;
10782 bk.push(br);
10783 return '"' + bq + bs + '"'
10784 }
10785
10786 function a7() {
10787 return "class" + ++az
10788 }
10789
10790 function bl(br, bs, bq) {
10791 br.classId = bs;
10792 br.scopeId = bq;
10793 aJ[bs] = br
10794 }
10795 var V, S, ap, aV, bi, aZ;
10796 var O = /\b((?:(?:public|private|final|protected|static|abstract)\s+)*)(class|interface)\s+([A-Za-z_$][\w$]*\b)(\s+extends\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?(\s+implements\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\b)*)?\s*("A\d+")/g;
10797 var bb = /\b((?:(?:public|private|final|protected|static|abstract|synchronized)\s+)*)((?!(?:else|new|return|throw|function|public|private|protected)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+"|;)/g;
10798 var aM = /^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:else|new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*([A-Za-z_$][\w$]*\b)\s*(?:"C\d+"\s*)*([=,]|$)/;
10799 var bm = /\b((?:(?:public|private|final|protected|static|abstract)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b)\s*("B\d+")(\s*throws\s+[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*,\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)*)?\s*("A\d+")/g;
10800 var W = /^((?:(?:public|private|final|protected|static)\s+)*)((?!(?:new|return|throw)\b)[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*(?:\s*"C\d+")*)\s*/;
10801 var au = /\bfunction(?:\s+([A-Za-z_$][\w$]*))?\s*("B\d+")\s*("A\d+")/g;
10802
10803 function ae(br) {
10804 var bq = br;
10805 bq = bq.replace(O, function(bs) {
10806 return bc(bs, "E")
10807 });
10808 bq = bq.replace(bb, function(bs) {
10809 return bc(bs, "D")
10810 });
10811 bq = bq.replace(au, function(bs) {
10812 return bc(bs, "H")
10813 });
10814 return bq
10815 }
10816
10817 function bd(bs, br) {
10818 var bq = bs.replace(bm, function(bx, bu, bv, by, bw, bt) {
10819 if (bv !== br) {
10820 return bx
10821 }
10822 return bc(bx, "G")
10823 });
10824 return bq
10825 }
10826
10827 function aH(bq) {
10828 this.name = bq
10829 }
10830 aH.prototype.toString = function() {
10831 return this.name
10832 };
10833
10834 function ao(br, bq) {
10835 this.params = br;
10836 this.methodArgsParam = bq
10837 }
10838 ao.prototype.getNames = function() {
10839 var bs = [];
10840 for (var br = 0, bq = this.params.length; br < bq; ++br) {
10841 bs.push(this.params[br].name)
10842 }
10843 return bs
10844 };
10845 ao.prototype.prependMethodArgs = function(bq) {
10846 if (!this.methodArgsParam) {
10847 return bq
10848 }
10849 return "{\nvar " + this.methodArgsParam.name + " = Array.prototype.slice.call(arguments, " + this.params.length + ");\n" + bq.substring(1)
10850 };
10851 ao.prototype.toString = function() {
10852 if (this.params.length === 0) {
10853 return "()"
10854 }
10855 var bq = "(";
10856 for (var bs = 0, br = this.params.length; bs < br; ++bs) {
10857 bq += this.params[bs] + ", "
10858 }
10859 return bq.substring(0, bq.length - 2) + ")"
10860 };
10861
10862 function aD(bw) {
10863 var bt = a6(bw.substring(1, bw.length - 1));
10864 var bq = [],
10865 bu = null;
10866 if (bt !== "") {
10867 var br = bt.split(",");
10868 for (var bs = 0; bs < br.length; ++bs) {
10869 var bv = /\b([A-Za-z_$][\w$]*\b)(\s*"[ABC][\d]*")*\s*$/.exec(br[bs]);
10870 if (bs === br.length - 1 && br[bs].indexOf("...") >= 0) {
10871 bu = new aH(bv[1]);
10872 break
10873 }
10874 bq.push(new aH(bv[1]))
10875 }
10876 }
10877 return new ao(bq, bu)
10878 }
10879
10880 function aq(bu) {
10881 var bt = bu;
10882 bt = bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"C\d+")+\s*("A\d+")/g, function(bw, bv, bx) {
10883 return bx
10884 });
10885 bt = bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)(?:\s*"B\d+")\s*("A\d+")/g, function(bw, bv, bx) {
10886 return bc(bw, "F")
10887 });
10888 bt = bt.replace(au, function(bv) {
10889 return bc(bv, "H")
10890 });
10891 bt = bt.replace(/\bnew\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*("C\d+"(?:\s*"C\d+")*)/g, function(bA, bz, bx) {
10892 var bw = bx.replace(/"C(\d+)"/g, function(bC, bB) {
10893 return bk[bB]
10894 }).replace(/\[\s*\]/g, "[null]").replace(/\s*\]\s*\[\s*/g, ", ");
10895 var by = "{" + bw.substring(1, bw.length - 1) + "}";
10896 var bv = "('" + bz + "', " + bc(by, "A") + ")";
10897 return "$p.createJavaArray" + bc(bv, "B")
10898 });
10899 bt = bt.replace(/(\.\s*length)\s*"B\d+"/g, "$1");
10900 bt = bt.replace(/#([0-9A-Fa-f]{6})\b/g, function(bv, bw) {
10901 return "0xFF" + bw
10902 });
10903 bt = bt.replace(/"B(\d+)"(\s*(?:[\w$']|"B))/g, function(by, bw, bx) {
10904 var bz = bk[bw];
10905 if (!/^\(\s*[A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*\s*(?:"C\d+"\s*)*\)$/.test(bz)) {
10906 return by
10907 }
10908 if (/^\(\s*int\s*\)$/.test(bz)) {
10909 return "(int)" + bx
10910 }
10911 var bv = bz.split(/"C(\d+)"/g);
10912 if (bv.length > 1) {
10913 if (!/^\[\s*\]$/.test(bk[bv[1]])) {
10914 return by
10915 }
10916 }
10917 return "" + bx
10918 });
10919 bt = bt.replace(/\(int\)([^,\]\)\}\?\:\*\+\-\/\^\|\%\&\~<\>\=]+)/g, function(bw, bv) {
10920 var bx = aP(bv);
10921 return bx.untrim("__int_cast(" + bx.middle + ")")
10922 });
10923 bt = bt.replace(/\bsuper(\s*"B\d+")/g, "$$superCstr$1").replace(/\bsuper(\s*\.)/g, "$$super$1");
10924 bt = bt.replace(/\b0+((\d*)(?:\.[\d*])?(?:[eE][\-\+]?\d+)?[fF]?)\b/, function(bx, bw, bv) {
10925 if (bw === bv) {
10926 return bx
10927 }
10928 return bv === "" ? "0" + bw : bw
10929 });
10930 bt = bt.replace(/\b(\.?\d+\.?)[fF]\b/g, "$1");
10931 bt = bt.replace(/([^\s])%([^=\s])/g, "$1 % $2");
10932 bt = bt.replace(/\b(frameRate|keyPressed|mousePressed)\b(?!\s*"B)/g, "__$1");
10933 bt = bt.replace(/\b(boolean|byte|char|float|int)\s*"B/g, function(bw, bv) {
10934 return "parse" + bv.substring(0, 1).toUpperCase() + bv.substring(1) + '"B'
10935 });
10936 bt = bt.replace(/\bpixels\b\s*(("C(\d+)")|\.length)?(\s*=(?!=)([^,\]\)\}]+))?/g, function(bw, bA, bv, bz, by, bB) {
10937 if (bv) {
10938 var bx = bk[bz];
10939 if (by) {
10940 return "pixels.setPixel" + bc("(" + bx.substring(1, bx.length - 1) + "," + bB + ")", "B")
10941 }
10942 return "pixels.getPixel" + bc("(" + bx.substring(1, bx.length - 1) + ")", "B")
10943 }
10944 if (bA) {
10945 return "pixels.getLength" + bc("()", "B")
10946 }
10947 if (by) {
10948 return "pixels.set" + bc("(" + bB + ")", "B")
10949 }
10950 return "pixels.toArray" + bc("()", "B")
10951 });
10952 var bs;
10953
10954 function br(bw, bv, bA, by) {
10955 var bx = bk[by];
10956 bs = true;
10957 var bz = aP(bx.substring(1, bx.length - 1));
10958 return "__" + bA + (bz.middle === "" ? bc("(" + bv.replace(/\.\s*$/, "") + ")", "B") : bc("(" + bv.replace(/\.\s*$/, "") + "," + bz.middle + ")", "B"))
10959 }
10960 do {
10961 bs = false;
10962 bt = bt.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*\.\s*(?:[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*\.\s*)*)(replace|replaceAll|replaceFirst|contains|equals|equalsIgnoreCase|hashCode|toCharArray|printStackTrace|split|startsWith|endsWith|codePointAt|matches)\s*"B(\d+)"/g, br)
10963 } while (bs);
10964
10965 function bq(bx, bv, bw) {
10966 bs = true;
10967 return "__instanceof" + bc("(" + bv + ", " + bw + ")", "B")
10968 }
10969 do {
10970 bs = false;
10971 bt = bt.replace(/((?:'\d+'|\b[A-Za-z_$][\w$]*\s*(?:"[BC]\d+")*)\s*(?:\.\s*[A-Za-z_$][\w$]*\s*(?:"[BC]\d+"\s*)*)*)instanceof\s+([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)/g, bq)
10972 } while (bs);
10973 bt = bt.replace(/\bthis(\s*"B\d+")/g, "$$constr$1");
10974 return bt
10975 }
10976
10977 function aC(br, bq) {
10978 this.baseInterfaceName = br;
10979 this.body = bq;
10980 bq.owner = this
10981 }
10982 aC.prototype.toString = function() {
10983 return "new (" + this.body + ")"
10984 };
10985
10986 function ai(bs) {
10987 var br = (new RegExp(/\bnew\s*([A-Za-z_$][\w$]*\s*(?:\.\s*[A-Za-z_$][\w$]*)*)\s*"B\d+"\s*"A(\d+)"/)).exec(bs);
10988 var bv = a9,
10989 bu = a7();
10990 a9 = bu;
10991 var bq = br[1] + "$" + bu;
10992 var bt = new aC(bq, V(bk[br[2]], bq, "", "implements " + br[1]));
10993 bl(bt, bu, bv);
10994 a9 = bv;
10995 return bt
10996 }
10997
10998 function af(br, bs, bq) {
10999 this.name = br;
11000 this.params = bs;
11001 this.body = bq
11002 }
11003 af.prototype.toString = function() {
11004 var bs = al;
11005 var bt = av({
11006 "this": null
11007 }, this.params.getNames());
11008 al = function(bu) {
11009 return bt.hasOwnProperty(bu.name) ? bu.name : bs(bu)
11010 };
11011 var br = "function";
11012 if (this.name) {
11013 br += " " + this.name
11014 }
11015 var bq = this.params.prependMethodArgs(this.body.toString());
11016 br += this.params + " " + bq;
11017 al = bs;
11018 return br
11019 };
11020
11021 function aK(br) {
11022 var bq = (new RegExp(/\b([A-Za-z_$][\w$]*)\s*"B(\d+)"\s*"A(\d+)"/)).exec(br);
11023 return new af(bq[1] !== "function" ? bq[1] : null, aD(bk[bq[2]]), ap(bk[bq[3]]))
11024 }
11025
11026 function ad(bq) {
11027 this.members = bq
11028 }
11029 ad.prototype.toString = function() {
11030 var bs = al;
11031 al = function(bu) {
11032 return bu.name === "this" ? "this" : bs(bu)
11033 };
11034 var bq = "";
11035 for (var bt = 0, br = this.members.length; bt < br; ++bt) {
11036 if (this.members[bt].label) {
11037 bq += this.members[bt].label + ": "
11038 }
11039 bq += this.members[bt].value.toString() + ", "
11040 }
11041 al = bs;
11042 return bq.substring(0, bq.length - 2)
11043 };
11044
11045 function aF(bt) {
11046 var bq = bt.split(",");
11047 for (var bs = 0; bs < bq.length; ++bs) {
11048 var br = bq[bs].indexOf(":");
11049 if (br < 0) {
11050 bq[bs] = {
11051 value: aZ(bq[bs])
11052 }
11053 } else {
11054 bq[bs] = {
11055 label: a6(bq[bs].substring(0, br)),
11056 value: aZ(a6(bq[bs].substring(br + 1)))
11057 }
11058 }
11059 }
11060 return new ad(bq)
11061 }
11062
11063 function ay(bs) {
11064 if (bs.charAt(0) === "(" || bs.charAt(0) === "[") {
11065 return bs.charAt(0) + ay(bs.substring(1, bs.length - 1)) + bs.charAt(bs.length - 1)
11066 }
11067 if (bs.charAt(0) === "{") {
11068 if (/^\{\s*(?:[A-Za-z_$][\w$]*|'\d+')\s*:/.test(bs)) {
11069 return "{" + bc(bs.substring(1, bs.length - 1), "I") + "}"
11070 }
11071 return "[" + ay(bs.substring(1, bs.length - 1)) + "]"
11072 }
11073 var br = aP(bs);
11074 var bq = aq(br.middle);
11075 bq = bq.replace(/"[ABC](\d+)"/g, function(bu, bt) {
11076 return ay(bk[bt])
11077 });
11078 return br.untrim(bq)
11079 }
11080
11081 function R(bq) {
11082 return bq.replace(/(\.\s*)?((?:\b[A-Za-z_]|\$)[\w$]*)(\s*\.\s*([A-Za-z_$][\w$]*)(\s*\()?)?/g, function(bt, bv, br, bx, bw, bu) {
11083 if (bv) {
11084 return bt
11085 }
11086 var bs = {
11087 name: br,
11088 member: bw,
11089 callSign: !!bu
11090 };
11091 return al(bs) + (bx === t ? "" : bx)
11092 })
11093 }
11094
11095 function bp(br, bq) {
11096 this.expr = br;
11097 this.transforms = bq
11098 }
11099 bp.prototype.toString = function() {
11100 var bq = this.transforms;
11101 var br = R(this.expr);
11102 return br.replace(/"!(\d+)"/g, function(bt, bs) {
11103 return bq[bs].toString()
11104 })
11105 };
11106 aZ = function(bs) {
11107 var br = [];
11108 var bq = ay(bs);
11109 bq = bq.replace(/"H(\d+)"/g, function(bu, bt) {
11110 br.push(aK(bk[bt]));
11111 return '"!' + (br.length - 1) + '"'
11112 });
11113 bq = bq.replace(/"F(\d+)"/g, function(bu, bt) {
11114 br.push(ai(bk[bt]));
11115 return '"!' + (br.length - 1) + '"'
11116 });
11117 bq = bq.replace(/"I(\d+)"/g, function(bu, bt) {
11118 br.push(aF(bk[bt]));
11119 return '"!' + (br.length - 1) + '"'
11120 });
11121 return new bp(bq, br)
11122 };
11123
11124 function a4(bq, bs, br) {
11125 this.name = bq;
11126 this.value = bs;
11127 this.isDefault = br
11128 }
11129 a4.prototype.toString = function() {
11130 return this.name + " = " + this.value
11131 };
11132
11133 function ak(bu, br) {
11134 var bv = bu.indexOf("=");
11135 var bq, bt, bs;
11136 if (bv < 0) {
11137 bq = bu;
11138 bt = br;
11139 bs = true
11140 } else {
11141 bq = bu.substring(0, bv);
11142 bt = aZ(bu.substring(bv + 1));
11143 bs = false
11144 }
11145 return new a4(a6(bq.replace(/(\s*"C\d+")+/g, "")), bt, bs)
11146 }
11147
11148 function aT(bq) {
11149 if (bq === "int" || bq === "float") {
11150 return "0"
11151 }
11152 if (bq === "boolean") {
11153 return "false"
11154 }
11155 if (bq === "color") {
11156 return "0x00000000"
11157 }
11158 return "null"
11159 }
11160
11161 function aI(br, bq) {
11162 this.definitions = br;
11163 this.varType = bq
11164 }
11165 aI.prototype.getNames = function() {
11166 var bs = [];
11167 for (var br = 0, bq = this.definitions.length; br < bq; ++br) {
11168 bs.push(this.definitions[br].name)
11169 }
11170 return bs
11171 };
11172 aI.prototype.toString = function() {
11173 return "var " + this.definitions.join(",")
11174 };
11175
11176 function ah(bq) {
11177 this.expression = bq
11178 }
11179 ah.prototype.toString = function() {
11180 return this.expression.toString()
11181 };
11182
11183 function bn(bu) {
11184 if (aM.test(bu)) {
11185 var bt = W.exec(bu);
11186 var bs = bu.substring(bt[0].length).split(",");
11187 var bq = aT(bt[2]);
11188 for (var br = 0; br < bs.length; ++br) {
11189 bs[br] = ak(bs[br], bq)
11190 }
11191 return new aI(bs, bt[2])
11192 }
11193 return new ah(aZ(bu))
11194 }
11195
11196 function a1(bq, bs, br) {
11197 this.initStatement = bq;
11198 this.condition = bs;
11199 this.step = br
11200 }
11201 a1.prototype.toString = function() {
11202 return "(" + this.initStatement + "; " + this.condition + "; " + this.step + ")"
11203 };
11204
11205 function aS(br, bq) {
11206 this.initStatement = br;
11207 this.container = bq
11208 }
11209 aS.prototype.toString = function() {
11210 var bq = this.initStatement.toString();
11211 if (bq.indexOf("=") >= 0) {
11212 bq = bq.substring(0, bq.indexOf("="))
11213 }
11214 return "(" + bq + " in " + this.container + ")"
11215 };
11216
11217 function aY(br, bq) {
11218 this.initStatement = br;
11219 this.container = bq
11220 }
11221 aY.iteratorId = 0;
11222 aY.prototype.toString = function() {
11223 var bu = this.initStatement.toString();
11224 var br = "$it" + aY.iteratorId++;
11225 var bt = bu.replace(/^\s*var\s*/, "").split("=")[0];
11226 var bs = "var " + br + " = new $p.ObjectIterator(" + this.container + "), " + bt + " = void(0)";
11227 var bq = br + ".hasNext() && ((" + bt + " = " + br + ".next()) || true)";
11228 return "(" + bs + "; " + bq + ";)"
11229 };
11230
11231 function Y(br) {
11232 var bq;
11233 if (/\bin\b/.test(br)) {
11234 bq = br.substring(1, br.length - 1).split(/\bin\b/g);
11235 return new aS(bn(a6(bq[0])), aZ(bq[1]))
11236 }
11237 if (br.indexOf(":") >= 0 && br.indexOf(";") < 0) {
11238 bq = br.substring(1, br.length - 1).split(":");
11239 return new aY(bn(a6(bq[0])), aZ(bq[1]))
11240 }
11241 bq = br.substring(1, br.length - 1).split(";");
11242 return new a1(bn(a6(bq[0])), aZ(bq[1]), aZ(bq[2]))
11243 }
11244
11245 function a2(bq) {
11246 bq.sort(function(bs, br) {
11247 return br.weight - bs.weight
11248 })
11249 }
11250
11251 function ab(bs, bq, br) {
11252 this.name = bs;
11253 this.body = bq;
11254 this.isStatic = br;
11255 bq.owner = this
11256 }
11257 ab.prototype.toString = function() {
11258 return "" + this.body
11259 };
11260
11261 function an(bs, bq, br) {
11262 this.name = bs;
11263 this.body = bq;
11264 this.isStatic = br;
11265 bq.owner = this
11266 }
11267 an.prototype.toString = function() {
11268 return "" + this.body
11269 };
11270
11271 function T(bs) {
11272 var br = O.exec(bs);
11273 O.lastIndex = 0;
11274 var bt = br[1].indexOf("static") >= 0;
11275 var bq = bk[aQ(br[6])],
11276 bv;
11277 var bw = a9,
11278 bu = a7();
11279 a9 = bu;
11280 if (br[2] === "interface") {
11281 bv = new ab(br[3], S(bq, br[3], br[4]), bt)
11282 } else {
11283 bv = new an(br[3], V(bq, br[3], br[4], br[5]), bt)
11284 }
11285 bl(bv, bu, bw);
11286 a9 = bw;
11287 return bv
11288 }
11289
11290 function ac(bs, bt, bq, br) {
11291 this.name = bs;
11292 this.params = bt;
11293 this.body = bq;
11294 this.isStatic = br
11295 }
11296 ac.prototype.toString = function() {
11297 var bt = av({}, this.params.getNames());
11298 var bs = al;
11299 al = function(bu) {
11300 return bt.hasOwnProperty(bu.name) ? bu.name : bs(bu)
11301 };
11302 var br = this.params.prependMethodArgs(this.body.toString());
11303 var bq = "function " + this.methodId + this.params + " " + br + "\n";
11304 al = bs;
11305 return bq
11306 };
11307
11308 function P(bt) {
11309 var br = bb.exec(bt);
11310 bb.lastIndex = 0;
11311 var bs = br[1].indexOf("static") >= 0;
11312 var bq = br[6] !== ";" ? bk[aQ(br[6])] : "{}";
11313 return new ac(br[3], aD(bk[aQ(br[4])]), ap(bq), bs)
11314 }
11315
11316 function am(bs, br, bq) {
11317 this.definitions = bs;
11318 this.fieldType = br;
11319 this.isStatic = bq
11320 }
11321 am.prototype.getNames = function() {
11322 var bs = [];
11323 for (var br = 0, bq = this.definitions.length; br < bq; ++br) {
11324 bs.push(this.definitions[br].name)
11325 }
11326 return bs
11327 };
11328 am.prototype.toString = function() {
11329 var bx = al({
11330 name: "[this]"
11331 });
11332 if (this.isStatic) {
11333 var bw = this.owner.name;
11334 var bu = [];
11335 for (var bv = 0, bt = this.definitions.length; bv < bt; ++bv) {
11336 var bs = this.definitions[bv];
11337 var bq = bs.name,
11338 by = bw + "." + bq;
11339 var br = "if(" + by + " === void(0)) {\n " + by + " = " + bs.value + "; }\n$p.defineProperty(" + bx + ", '" + bq + "', { get: function(){return " + by + ";}, set: function(val){" + by + " = val;} });\n";
11340 bu.push(br)
11341 }
11342 return bu.join("")
11343 }
11344 return bx + "." + this.definitions.join("; " + bx + ".")
11345 };
11346
11347 function bf(bv) {
11348 var bu = W.exec(bv);
11349 var bq = bu[1].indexOf("static") >= 0;
11350 var bt = bv.substring(bu[0].length).split(/,\s*/g);
11351 var br = aT(bu[2]);
11352 for (var bs = 0; bs < bt.length; ++bs) {
11353 bt[bs] = ak(bt[bs], br)
11354 }
11355 return new am(bt, bu[2], bq)
11356 }
11357
11358 function aN(br, bq) {
11359 this.params = br;
11360 this.body = bq
11361 }
11362 aN.prototype.toString = function() {
11363 var bt = av({}, this.params.getNames());
11364 var br = al;
11365 al = function(bu) {
11366 return bt.hasOwnProperty(bu.name) ? bu.name : br(bu)
11367 };
11368 var bs = "function $constr_" + this.params.params.length + this.params.toString();
11369 var bq = this.params.prependMethodArgs(this.body.toString());
11370 if (!/\$(superCstr|constr)\b/.test(bq)) {
11371 bq = "{\n$superCstr();\n" + bq.substring(1)
11372 }
11373 al = br;
11374 return bs + bq + "\n"
11375 };
11376
11377 function at(bs) {
11378 var bq = (new RegExp(/"B(\d+)"\s*"A(\d+)"/)).exec(bs);
11379 var br = aD(bk[bq[1]]);
11380 return new aN(br, ap(bk[bq[2]]))
11381 }
11382
11383 function aO(bs, bv, bu, bq, bw, bx) {
11384 var bt, br;
11385 this.name = bs;
11386 this.interfacesNames = bv;
11387 this.methodsNames = bu;
11388 this.fields = bq;
11389 this.innerClasses = bw;
11390 this.misc = bx;
11391 for (bt = 0, br = bq.length; bt < br; ++bt) {
11392 bq[bt].owner = this
11393 }
11394 }
11395 aO.prototype.getMembers = function(bx, bq, bv) {
11396 if (this.owner.base) {
11397 this.owner.base.body.getMembers(bx, bq, bv)
11398 }
11399 var bu, bt, bs, br;
11400 for (bu = 0, bs = this.fields.length; bu < bs; ++bu) {
11401 var bz = this.fields[bu].getNames();
11402 for (bt = 0, br = bz.length; bt < br; ++bt) {
11403 bx[bz[bt]] = this.fields[bu]
11404 }
11405 }
11406 for (bu = 0, bs = this.methodsNames.length; bu < bs; ++bu) {
11407 var bw = this.methodsNames[bu];
11408 bq[bw] = true
11409 }
11410 for (bu = 0, bs = this.innerClasses.length; bu < bs; ++bu) {
11411 var by = this.innerClasses[bu];
11412 bv[by.name] = by
11413 }
11414 };
11415 aO.prototype.toString = function() {
11416 function br(bH) {
11417 var bG = 0;
11418 while (bH) {
11419 ++bG;
11420 bH = bH.scope
11421 }
11422 return bG
11423 }
11424 var bA = br(this.owner);
11425 var bB = this.name;
11426 var bx = "";
11427 var bC = "";
11428 var bE = {},
11429 bz = {},
11430 by = {};
11431 this.getMembers(bE, bz, by);
11432 var bw, bu, bv, bt;
11433 if (this.owner.interfaces) {
11434 var bq = [],
11435 bs;
11436 for (bw = 0, bu = this.interfacesNames.length; bw < bu; ++bw) {
11437 if (!this.owner.interfaces[bw]) {
11438 continue
11439 }
11440 bs = al({
11441 name: this.interfacesNames[bw]
11442 });
11443 bq.push(bs);
11444 bx += "$p.extendInterfaceMembers(" + bB + ", " + bs + ");\n"
11445 }
11446 bC += bB + ".$interfaces = [" + bq.join(", ") + "];\n"
11447 }
11448 bC += bB + ".$isInterface = true;\n";
11449 bC += bB + ".$methods = ['" + this.methodsNames.join("', '") + "'];\n";
11450 a2(this.innerClasses);
11451 for (bw = 0, bu = this.innerClasses.length; bw < bu; ++bw) {
11452 var bF = this.innerClasses[bw];
11453 if (bF.isStatic) {
11454 bx += bB + "." + bF.name + " = " + bF + ";\n"
11455 }
11456 }
11457 for (bw = 0, bu = this.fields.length; bw < bu; ++bw) {
11458 var bD = this.fields[bw];
11459 if (bD.isStatic) {
11460 bx += bB + "." + bD.definitions.join(";\n" + bB + ".") + ";\n"
11461 }
11462 }
11463 return "(function() {\nfunction " + bB + "() { throw 'Unable to create the interface'; }\n" + bx + bC + "return " + bB + ";\n})()"
11464 };
11465 S = function(bw, br, bB) {
11466 var bC = bw.substring(1, bw.length - 1);
11467 bC = ae(bC);
11468 bC = bd(bC, br);
11469 var bz = [],
11470 bt = [];
11471 bC = bC.replace(/"([DE])(\d+)"/g, function(bF, bE, bD) {
11472 if (bE === "D") {
11473 bz.push(bD)
11474 } else {
11475 if (bE === "E") {
11476 bt.push(bD)
11477 }
11478 }
11479 return ""
11480 });
11481 var bx = bC.split(/;(?:\s*;)*/g);
11482 var bu;
11483 var bv, bs;
11484 if (bB !== t) {
11485 bu = bB.replace(/^\s*extends\s+(.+?)\s*$/g, "$1").split(/\s*,\s*/g)
11486 }
11487 for (bv = 0, bs = bz.length; bv < bs; ++bv) {
11488 var bq = P(bk[bz[bv]]);
11489 bz[bv] = bq.name
11490 }
11491 for (bv = 0, bs = bx.length - 1; bv < bs; ++bv) {
11492 var bA = aP(bx[bv]);
11493 bx[bv] = bf(bA.middle)
11494 }
11495 var by = bx.pop();
11496 for (bv = 0, bs = bt.length; bv < bs; ++bv) {
11497 bt[bv] = T(bk[bt[bv]])
11498 }
11499 return new aO(br, bu, bz, bx, bt, {
11500 tail: by
11501 })
11502 };
11503
11504 function aB(br, by, bx, bw, bs, bz, bA, bu, bq) {
11505 var bv, bt;
11506 this.name = br;
11507 this.baseClassName = by;
11508 this.interfacesNames = bx;
11509 this.functions = bw;
11510 this.methods = bs;
11511 this.fields = bz;
11512 this.cstrs = bA;
11513 this.innerClasses = bu;
11514 this.misc = bq;
11515 for (bv = 0, bt = bz.length; bv < bt; ++bv) {
11516 bz[bv].owner = this
11517 }
11518 }
11519 aB.prototype.getMembers = function(bx, br, bw) {
11520 if (this.owner.base) {
11521 this.owner.base.body.getMembers(bx, br, bw)
11522 }
11523 var bv, bu, bt, bs;
11524 for (bv = 0, bt = this.fields.length; bv < bt; ++bv) {
11525 var bz = this.fields[bv].getNames();
11526 for (bu = 0, bs = bz.length; bu < bs; ++bu) {
11527 bx[bz[bu]] = this.fields[bv]
11528 }
11529 }
11530 for (bv = 0, bt = this.methods.length; bv < bt; ++bv) {
11531 var bq = this.methods[bv];
11532 br[bq.name] = bq
11533 }
11534 for (bv = 0, bt = this.innerClasses.length; bv < bt; ++bv) {
11535 var by = this.innerClasses[bv];
11536 bw[by.name] = by
11537 }
11538 };
11539 aB.prototype.toString = function() {
11540 function bN(bV) {
11541 var bU = 0;
11542 while (bV) {
11543 ++bU;
11544 bV = bV.scope
11545 }
11546 return bU
11547 }
11548 var bB = bN(this.owner);
11549 var bG = "$this_" + bB;
11550 var bs = this.name;
11551 var bx = "var " + bG + " = this;\n";
11552 var bH = "";
11553 var bz = "";
11554 var bS = {},
11555 bT = {},
11556 bJ = {};
11557 this.getMembers(bS, bT, bJ);
11558 var bR = al;
11559 al = function(bV) {
11560 var bU = bV.name;
11561 if (bU === "this") {
11562 return bV.callSign || !bV.member ? bG + ".$self" : bG
11563 }
11564 if (bS.hasOwnProperty(bU)) {
11565 return bS[bU].isStatic ? bs + "." + bU : bG + "." + bU
11566 }
11567 if (bJ.hasOwnProperty(bU)) {
11568 return bG + "." + bU
11569 }
11570 if (bT.hasOwnProperty(bU)) {
11571 return bT[bU].isStatic ? bs + "." + bU : bG + ".$self." + bU
11572 }
11573 return bR(bV)
11574 };
11575 var bA;
11576 if (this.baseClassName) {
11577 bA = bR({
11578 name: this.baseClassName
11579 });
11580 bx += "var $super = { $upcast: " + bG + " };\n";
11581 bx += "function $superCstr(){" + bA + ".apply($super,arguments);if(!('$self' in $super)) $p.extendClassChain($super)}\n";
11582 bz += bs + ".$base = " + bA + ";\n"
11583 } else {
11584 bx += "function $superCstr(){$p.extendClassChain(" + bG + ")}\n"
11585 } if (this.owner.base) {
11586 bH += "$p.extendStaticMembers(" + bs + ", " + bA + ");\n"
11587 }
11588 var bM, bK, bL, bI;
11589 if (this.owner.interfaces) {
11590 var bw = [],
11591 bq;
11592 for (bM = 0, bK = this.interfacesNames.length; bM < bK; ++bM) {
11593 if (!this.owner.interfaces[bM]) {
11594 continue
11595 }
11596 bq = bR({
11597 name: this.interfacesNames[bM]
11598 });
11599 bw.push(bq);
11600 bH += "$p.extendInterfaceMembers(" + bs + ", " + bq + ");\n"
11601 }
11602 bz += bs + ".$interfaces = [" + bw.join(", ") + "];\n"
11603 }
11604 if (this.functions.length > 0) {
11605 bx += this.functions.join("\n") + "\n"
11606 }
11607 a2(this.innerClasses);
11608 for (bM = 0, bK = this.innerClasses.length; bM < bK; ++bM) {
11609 var bD = this.innerClasses[bM];
11610 if (bD.isStatic) {
11611 bH += bs + "." + bD.name + " = " + bD + ";\n";
11612 bx += bG + "." + bD.name + " = " + bs + "." + bD.name + ";\n"
11613 } else {
11614 bx += bG + "." + bD.name + " = " + bD + ";\n"
11615 }
11616 }
11617 for (bM = 0, bK = this.fields.length; bM < bK; ++bM) {
11618 var br = this.fields[bM];
11619 if (br.isStatic) {
11620 bH += bs + "." + br.definitions.join(";\n" + bs + ".") + ";\n";
11621 for (bL = 0, bI = br.definitions.length; bL < bI; ++bL) {
11622 var bu = br.definitions[bL].name,
11623 by = bs + "." + bu;
11624 bx += "$p.defineProperty(" + bG + ", '" + bu + "', {get: function(){return " + by + "}, set: function(val){" + by + " = val}});\n"
11625 }
11626 } else {
11627 bx += bG + "." + br.definitions.join(";\n" + bG + ".") + ";\n"
11628 }
11629 }
11630 var bC = {};
11631 for (bM = 0, bK = this.methods.length; bM < bK; ++bM) {
11632 var bt = this.methods[bM];
11633 var bP = bC[bt.name];
11634 var bv = bt.name + "$" + bt.params.params.length;
11635 var bF = !!bt.params.methodArgsParam;
11636 if (bP) {
11637 ++bP;
11638 bv += "_" + bP
11639 } else {
11640 bP = 1
11641 }
11642 bt.methodId = bv;
11643 bC[bt.name] = bP;
11644 if (bt.isStatic) {
11645 bH += bt;
11646 bH += "$p.addMethod(" + bs + ", '" + bt.name + "', " + bv + ", " + bF + ");\n";
11647 bx += "$p.addMethod(" + bG + ", '" + bt.name + "', " + bv + ", " + bF + ");\n"
11648 } else {
11649 bx += bt;
11650 bx += "$p.addMethod(" + bG + ", '" + bt.name + "', " + bv + ", " + bF + ");\n"
11651 }
11652 }
11653 bx += a6(this.misc.tail);
11654 if (this.cstrs.length > 0) {
11655 bx += this.cstrs.join("\n") + "\n"
11656 }
11657 bx += "function $constr() {\n";
11658 var bQ = [];
11659 for (bM = 0, bK = this.cstrs.length; bM < bK; ++bM) {
11660 var bO = this.cstrs[bM].params.params.length;
11661 var bE = !!this.cstrs[bM].params.methodArgsParam;
11662 bQ.push("if(arguments.length " + (bE ? ">=" : "===") + " " + bO + ") { $constr_" + bO + ".apply(" + bG + ", arguments); }")
11663 }
11664 if (bQ.length > 0) {
11665 bx += bQ.join(" else ") + " else "
11666 }
11667 bx += "$superCstr();\n}\n";
11668 bx += "$constr.apply(null, arguments);\n";
11669 al = bR;
11670 return "(function() {\nfunction " + bs + "() {\n" + bx + "}\n" + bH + bz + "return " + bs + ";\n})()"
11671 };
11672 V = function(bz, br, bq, bC) {
11673 var bE = bz.substring(1, bz.length - 1);
11674 bE = ae(bE);
11675 bE = bd(bE, br);
11676 var bs = [],
11677 bt = [],
11678 bD = [],
11679 bw = [];
11680 bE = bE.replace(/"([DEGH])(\d+)"/g, function(bH, bG, bF) {
11681 if (bG === "D") {
11682 bs.push(bF)
11683 } else {
11684 if (bG === "E") {
11685 bt.push(bF)
11686 } else {
11687 if (bG === "H") {
11688 bw.push(bF)
11689 } else {
11690 bD.push(bF)
11691 }
11692 }
11693 }
11694 return ""
11695 });
11696 var by = bE.replace(/^(?:\s*;)+/, "").split(/;(?:\s*;)*/g);
11697 var bx, bv;
11698 var bu;
11699 if (bq !== t) {
11700 bx = bq.replace(/^\s*extends\s+([A-Za-z_$][\w$]*\b(?:\s*\.\s*[A-Za-z_$][\w$]*\b)*)\s*$/g, "$1")
11701 }
11702 if (bC !== t) {
11703 bv = bC.replace(/^\s*implements\s+(.+?)\s*$/g, "$1").split(/\s*,\s*/g)
11704 }
11705 for (bu = 0; bu < bw.length; ++bu) {
11706 bw[bu] = aK(bk[bw[bu]])
11707 }
11708 for (bu = 0; bu < bs.length; ++bu) {
11709 bs[bu] = P(bk[bs[bu]])
11710 }
11711 for (bu = 0; bu < by.length - 1; ++bu) {
11712 var bB = aP(by[bu]);
11713 by[bu] = bf(bB.middle)
11714 }
11715 var bA = by.pop();
11716 for (bu = 0; bu < bD.length; ++bu) {
11717 bD[bu] = at(bk[bD[bu]])
11718 }
11719 for (bu = 0; bu < bt.length; ++bu) {
11720 bt[bu] = T(bk[bt[bu]])
11721 }
11722 return new aB(br, bx, bv, bw, bs, by, bD, bt, {
11723 tail: bA
11724 })
11725 };
11726
11727 function aw(br, bq) {
11728 this.name = br;
11729 this.body = bq;
11730 bq.owner = this
11731 }
11732 aw.prototype.toString = function() {
11733 return "var " + this.name + " = " + this.body + ";\n$p." + this.name + " = " + this.name + ";\n"
11734 };
11735
11736 function a5(br, bq) {
11737 this.name = br;
11738 this.body = bq;
11739 bq.owner = this
11740 }
11741 a5.prototype.toString = function() {
11742 return "var " + this.name + " = " + this.body + ";\n$p." + this.name + " = " + this.name + ";\n"
11743 };
11744
11745 function bo(bs) {
11746 var br = O.exec(bs);
11747 O.lastIndex = 0;
11748 var bq = bk[aQ(br[6])];
11749 var bv = a9,
11750 bt = a7();
11751 a9 = bt;
11752 var bu;
11753 if (br[2] === "interface") {
11754 bu = new aw(br[3], S(bq, br[3], br[4]))
11755 } else {
11756 bu = new a5(br[3], V(bq, br[3], br[4], br[5]))
11757 }
11758 bl(bu, bt, bv);
11759 a9 = bv;
11760 return bu
11761 }
11762
11763 function aR(br, bs, bq) {
11764 this.name = br;
11765 this.params = bs;
11766 this.body = bq
11767 }
11768 aR.prototype.toString = function() {
11769 var bt = av({}, this.params.getNames());
11770 var bs = al;
11771 al = function(bu) {
11772 return bt.hasOwnProperty(bu.name) ? bu.name : bs(bu)
11773 };
11774 var br = this.params.prependMethodArgs(this.body.toString());
11775 var bq = "function " + this.name + this.params + " " + br + "\n$p." + this.name + " = " + this.name + ";";
11776 al = bs;
11777 return bq
11778 };
11779
11780 function aW(bs) {
11781 var br = bb.exec(bs);
11782 var bq = bb.lastIndex = 0;
11783 return new aR(br[3], aD(bk[aQ(br[4])]), ap(bk[aQ(br[6])]))
11784 }
11785
11786 function ag(bq) {
11787 var br = bq;
11788 br = br.replace(/\b(catch\s*"B\d+"\s*"A\d+")(\s*catch\s*"B\d+"\s*"A\d+")+/g, "$1");
11789 return br
11790 }
11791
11792 function aU(bq, br) {
11793 this.argument = bq;
11794 this.misc = br
11795 }
11796 aU.prototype.toString = function() {
11797 return this.misc.prefix + this.argument.toString()
11798 };
11799
11800 function Q(bq, br) {
11801 this.argument = bq;
11802 this.misc = br
11803 }
11804 Q.prototype.toString = function() {
11805 return this.misc.prefix + this.argument.toString()
11806 };
11807
11808 function ax(bq, br, bs) {
11809 this.name = bq;
11810 this.argument = br;
11811 this.misc = bs
11812 }
11813 ax.prototype.toString = function() {
11814 var bq = this.misc.prefix;
11815 if (this.argument !== t) {
11816 bq += this.argument.toString()
11817 }
11818 return bq
11819 };
11820
11821 function aL(bq) {
11822 this.expr = bq
11823 }
11824 aL.prototype.toString = function() {
11825 return "case " + this.expr + ":"
11826 };
11827
11828 function X(bq) {
11829 this.label = bq
11830 }
11831 X.prototype.toString = function() {
11832 return this.label
11833 };
11834 aV = function(by, bz, bs) {
11835 var bD = new 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);
11836 var bA = [];
11837 by = ag(by);
11838 var bx = 0,
11839 bt, br;
11840 while ((bt = bD.exec(by)) !== null) {
11841 if (bt[1] !== t) {
11842 var bw = by.lastIndexOf('"B', bD.lastIndex);
11843 var bC = by.substring(bx, bw);
11844 if (bt[1] === "for") {
11845 bA.push(new aU(Y(bk[bt[2]]), {
11846 prefix: bC
11847 }))
11848 } else {
11849 if (bt[1] === "catch") {
11850 bA.push(new Q(aD(bk[bt[2]]), {
11851 prefix: bC
11852 }))
11853 } else {
11854 bA.push(new ax(bt[1], aZ(bk[bt[2]]), {
11855 prefix: bC
11856 }))
11857 }
11858 }
11859 } else {
11860 if (bt[3] !== t) {
11861 bA.push(new ax(bt[3], t, {
11862 prefix: by.substring(bx, bD.lastIndex)
11863 }))
11864 } else {
11865 if (bt[4] !== t) {
11866 br = by.substring(bx, bD.lastIndex - bt[4].length);
11867 if (a6(br).length !== 0) {
11868 continue
11869 }
11870 bA.push(br);
11871 var bu = bt[4].charAt(1),
11872 bq = bt[5];
11873 if (bu === "D") {
11874 bA.push(bz(bk[bq]))
11875 } else {
11876 if (bu === "E") {
11877 bA.push(bs(bk[bq]))
11878 } else {
11879 if (bu === "H") {
11880 bA.push(aK(bk[bq]))
11881 } else {
11882 bA.push(ap(bk[bq]))
11883 }
11884 }
11885 }
11886 } else {
11887 if (bt[6] !== t) {
11888 bA.push(new aL(aZ(a6(bt[7]))))
11889 } else {
11890 if (bt[8] !== t) {
11891 br = by.substring(bx, bD.lastIndex - bt[8].length);
11892 if (a6(br).length !== 0) {
11893 continue
11894 }
11895 bA.push(new X(by.substring(bx, bD.lastIndex)))
11896 } else {
11897 var bB = aP(by.substring(bx, bD.lastIndex - 1));
11898 bA.push(bB.left);
11899 bA.push(bn(bB.middle));
11900 bA.push(bB.right + ";")
11901 }
11902 }
11903 }
11904 }
11905 }
11906 bx = bD.lastIndex
11907 }
11908 var bv = aP(by.substring(bx));
11909 bA.push(bv.left);
11910 if (bv.middle !== "") {
11911 bA.push(bn(bv.middle));
11912 bA.push(";" + bv.right)
11913 }
11914 return bA
11915 };
11916
11917 function be(br) {
11918 var bs = [];
11919 for (var bt = 0, bq = br.length; bt < bq; ++bt) {
11920 var bu = br[bt];
11921 if (bu instanceof aI) {
11922 bs = bs.concat(bu.getNames())
11923 } else {
11924 if (bu instanceof aU && bu.argument.initStatement instanceof aI) {
11925 bs = bs.concat(bu.argument.initStatement.getNames())
11926 } else {
11927 if (bu instanceof ab || bu instanceof an || bu instanceof aw || bu instanceof a5 || bu instanceof aR || bu instanceof af) {
11928 bs.push(bu.name)
11929 }
11930 }
11931 }
11932 }
11933 return av({}, bs)
11934 }
11935
11936 function U(bq) {
11937 this.statements = bq
11938 }
11939 U.prototype.toString = function() {
11940 var bs = be(this.statements);
11941 var br = al;
11942 if (!ba(bs)) {
11943 al = function(bt) {
11944 return bs.hasOwnProperty(bt.name) ? bt.name : br(bt)
11945 }
11946 }
11947 var bq = "{\n" + this.statements.join("") + "\n}";
11948 al = br;
11949 return bq
11950 };
11951 ap = function(br) {
11952 var bq = aP(br.substring(1, br.length - 1));
11953 return new U(aV(bq.middle))
11954 };
11955
11956 function aG(bq) {
11957 this.statements = bq
11958 }
11959 aG.prototype.toString = function() {
11960 var bu = [],
11961 bv = [],
11962 bw;
11963 for (var bt = 0, br = this.statements.length; bt < br; ++bt) {
11964 bw = this.statements[bt];
11965 if (bw instanceof a5 || bw instanceof aw) {
11966 bu.push(bw)
11967 } else {
11968 bv.push(bw)
11969 }
11970 }
11971 a2(bu);
11972 var bs = be(this.statements);
11973 al = function(by) {
11974 var bx = by.name;
11975 if (bs.hasOwnProperty(bx)) {
11976 return bx
11977 }
11978 if (aX.hasOwnProperty(bx) || B.hasOwnProperty(bx) || g.hasOwnProperty(bx)) {
11979 return "$p." + bx
11980 }
11981 return bx
11982 };
11983 var bq = "// this code was autogenerated from PJS\n(function($p) {\n" + bu.join("") + "\n" + bv.join("") + "\n})";
11984 al = null;
11985 return bq
11986 };
11987 bi = function() {
11988 var bq = ae(bk[0]);
11989 bq = bq.replace(/\bimport\s+[^;]+;/g, "");
11990 return new aG(aV(bq, aW, bo))
11991 };
11992
11993 function bj(bq) {
11994 var bu = {};
11995 var bs, by;
11996 for (bs in aJ) {
11997 if (aJ.hasOwnProperty(bs)) {
11998 by = aJ[bs];
11999 var bE = by.scopeId,
12000 br = by.name;
12001 if (bE) {
12002 var bD = aJ[bE];
12003 by.scope = bD;
12004 if (bD.inScope === t) {
12005 bD.inScope = {}
12006 }
12007 bD.inScope[br] = by
12008 } else {
12009 bu[br] = by
12010 }
12011 }
12012 }
12013
12014 function bB(bF, bI) {
12015 var bL = bI.split(".");
12016 var bH = bF.scope,
12017 bK;
12018 while (bH) {
12019 if (bH.hasOwnProperty(bL[0])) {
12020 bK = bH[bL[0]];
12021 break
12022 }
12023 bH = bH.scope
12024 }
12025 if (bK === t) {
12026 bK = bu[bL[0]]
12027 }
12028 for (var bJ = 1, bG = bL.length; bJ < bG && bK; ++bJ) {
12029 bK = bK.inScope[bL[bJ]]
12030 }
12031 return bK
12032 }
12033 for (bs in aJ) {
12034 if (aJ.hasOwnProperty(bs)) {
12035 by = aJ[bs];
12036 var bx = by.body.baseClassName;
12037 if (bx) {
12038 var bA = bB(by, bx);
12039 if (bA) {
12040 by.base = bA;
12041 if (!bA.derived) {
12042 bA.derived = []
12043 }
12044 bA.derived.push(by)
12045 }
12046 }
12047 var bw = by.body.interfacesNames,
12048 bC = [],
12049 bv, bt;
12050 if (bw && bw.length > 0) {
12051 for (bv = 0, bt = bw.length; bv < bt; ++bv) {
12052 var bz = bB(by, bw[bv]);
12053 bC.push(bz);
12054 if (!bz) {
12055 continue
12056 }
12057 if (!bz.derived) {
12058 bz.derived = []
12059 }
12060 bz.derived.push(by)
12061 }
12062 if (bC.length > 0) {
12063 by.interfaces = bC
12064 }
12065 }
12066 }
12067 }
12068 }
12069
12070 function a8(bq) {
12071 var bv = [],
12072 bs = {};
12073 var br, by, bw;
12074 for (br in aJ) {
12075 if (aJ.hasOwnProperty(br)) {
12076 bw = aJ[br];
12077 if (!bw.inScope && !bw.derived) {
12078 bv.push(br);
12079 bw.weight = 0
12080 } else {
12081 var bx = [];
12082 if (bw.inScope) {
12083 for (by in bw.inScope) {
12084 if (bw.inScope.hasOwnProperty(by)) {
12085 bx.push(bw.inScope[by])
12086 }
12087 }
12088 }
12089 if (bw.derived) {
12090 bx = bx.concat(bw.derived)
12091 }
12092 bs[br] = bx
12093 }
12094 }
12095 }
12096
12097 function bz(bB, bD) {
12098 var bA = bs[bB];
12099 if (!bA) {
12100 return false
12101 }
12102 var bC = bA.indexOf(bD);
12103 if (bC < 0) {
12104 return false
12105 }
12106 bA.splice(bC, 1);
12107 if (bA.length > 0) {
12108 return false
12109 }
12110 delete bs[bB];
12111 return true
12112 }
12113 while (bv.length > 0) {
12114 br = bv.shift();
12115 bw = aJ[br];
12116 if (bw.scopeId && bz(bw.scopeId, bw)) {
12117 bv.push(bw.scopeId);
12118 aJ[bw.scopeId].weight = bw.weight + 1
12119 }
12120 if (bw.base && bz(bw.base.classId, bw)) {
12121 bv.push(bw.base.classId);
12122 bw.base.weight = bw.weight + 1
12123 }
12124 if (bw.interfaces) {
12125 var bu, bt;
12126 for (bu = 0, bt = bw.interfaces.length; bu < bt; ++bu) {
12127 if (!bw.interfaces[bu] || !bz(bw.interfaces[bu].classId, bw)) {
12128 continue
12129 }
12130 bv.push(bw.interfaces[bu].classId);
12131 bw.interfaces[bu].weight = bw.weight + 1
12132 }
12133 }
12134 }
12135 }
12136 var bh = bi();
12137 bj(bh);
12138 a8(bh);
12139 var a0 = bh.toString();
12140 a0 = a0.replace(/\s*\n(?:[\t ]*\n)+/g, "\n\n");
12141 a0 = a0.replace(/__x([0-9A-F]{4})/g, function(br, bq) {
12142 return String.fromCharCode(parseInt(bq, 16))
12143 });
12144 return aj(a0, N)
12145 }
12146
12147 function z(O, ad) {
12148 var X = (new RegExp(/\/\*\s*@pjs\s+((?:[^\*]|\*+[^\*\/])*)\*\//g)).exec(O);
12149 if (X && X.length === 2) {
12150 var N = [],
12151 Q = X.splice(1, 2)[0].replace(/\{([\s\S]*?)\}/g, function() {
12152 return function(ag, ah) {
12153 N.push(ah);
12154 return "{" + (N.length - 1) + "}"
12155 }
12156 }()).replace("\n", "").replace("\r", "").split(";");
12157 var W = function(ag) {
12158 return ag.replace(/^\s*["']?/, "").replace(/["']?\s*$/, "")
12159 };
12160 for (var aa = 0, Y = Q.length; aa < Y; aa++) {
12161 var U = Q[aa].split("=");
12162 if (U && U.length === 2) {
12163 var af = W(U[0]),
12164 V = W(U[1]),
12165 ae = [];
12166 if (af === "preload") {
12167 ae = V.split(",");
12168 for (var Z = 0, ab = ae.length; Z < ab; Z++) {
12169 var ac = W(ae[Z]);
12170 ad.imageCache.add(ac)
12171 }
12172 } else {
12173 if (af === "font") {
12174 ae = V.split(",");
12175 for (var R = 0, T = ae.length; R < T; R++) {
12176 var S = W(ae[R]),
12177 P = /^\{(\d*?)\}$/.exec(S);
12178 H.preloading.add(P ? JSON.parse("{" + N[P[1]] + "}") : S)
12179 }
12180 } else {
12181 if (af === "pauseOnBlur") {
12182 ad.options.pauseOnBlur = V === "true"
12183 } else {
12184 if (af === "globalKeyEvents") {
12185 ad.options.globalKeyEvents = V === "true"
12186 } else {
12187 if (af.substring(0, 6) === "param-") {
12188 ad.params[af.substring(6)] = V
12189 } else {
12190 ad.options[af] = V
12191 }
12192 }
12193 }
12194 }
12195 }
12196 }
12197 }
12198 }
12199 return O
12200 }
12201 F.compile = function(N) {
12202 var Q = new F.Sketch;
12203 var O = z(N, Q);
12204 var P = c(O);
12205 Q.sourceCode = P;
12206 return Q
12207 };
12208 var j = function() {
12209 var T = {},
12210 Q = "undefined",
12211 R = "function",
12212 N = !1,
12213 S = !0,
12214 O = 512,
12215 P = "log";
12216 if (typeof tinylog !== Q && typeof tinylog[P] === R) {
12217 T[P] = tinylog[P]
12218 } else {
12219 if (typeof d !== Q && !d.fake) {
12220 (function() {
12221 var ao = d,
12222 am = "div",
12223 ac = "style",
12224 ag = "title",
12225 ab = {
12226 zIndex: 10000,
12227 position: "fixed",
12228 bottom: "0px",
12229 width: "100%",
12230 height: "15%",
12231 fontFamily: "sans-serif",
12232 color: "#ccc",
12233 backgroundColor: "black"
12234 },
12235 ae = {
12236 position: "relative",
12237 fontFamily: "monospace",
12238 overflow: "auto",
12239 height: "100%",
12240 paddingTop: "5px"
12241 },
12242 ai = {
12243 height: "5px",
12244 marginTop: "-5px",
12245 cursor: "n-resize",
12246 backgroundColor: "darkgrey"
12247 },
12248 an = {
12249 position: "absolute",
12250 top: "5px",
12251 right: "20px",
12252 color: "#111",
12253 MozBorderRadius: "4px",
12254 webkitBorderRadius: "4px",
12255 borderRadius: "4px",
12256 cursor: "pointer",
12257 fontWeight: "normal",
12258 textAlign: "center",
12259 padding: "3px 5px",
12260 backgroundColor: "#333",
12261 fontSize: "12px"
12262 },
12263 Y = {
12264 minHeight: "16px"
12265 },
12266 af = {
12267 fontSize: "12px",
12268 margin: "0 8px 0 8px",
12269 maxWidth: "100%",
12270 whiteSpace: "pre-wrap",
12271 overflow: "auto"
12272 },
12273 ad = ao.defaultView,
12274 al = ao.documentElement,
12275 U = al[ac],
12276 W = function() {
12277 var aq = arguments.length,
12278 ap, at, ar;
12279 while (aq--) {
12280 at = arguments[aq--];
12281 ap = arguments[aq][ac];
12282 for (ar in at) {
12283 if (at.hasOwnProperty(ar)) {
12284 ap[ar] = at[ar]
12285 }
12286 }
12287 }
12288 },
12289 aj = function(ar, aq, ap) {
12290 if (ar.addEventListener) {
12291 ar.addEventListener(aq, ap, N)
12292 } else {
12293 if (ar.attachEvent) {
12294 ar.attachEvent("on" + aq, ap)
12295 }
12296 }
12297 return [ar, aq, ap]
12298 },
12299 V = function(ar, aq, ap) {
12300 if (ar.removeEventListener) {
12301 ar.removeEventListener(aq, ap, N)
12302 } else {
12303 if (ar.detachEvent) {
12304 ar.detachEvent("on" + aq, ap)
12305 }
12306 }
12307 },
12308 aa = function(aq) {
12309 var ap = aq.childNodes,
12310 ar = ap.length;
12311 while (ar--) {
12312 aq.removeChild(ap.item(0))
12313 }
12314 },
12315 ak = function(aq, ap) {
12316 return aq.appendChild(ap)
12317 },
12318 ah = function(ap) {
12319 return ao.createElement(ap)
12320 },
12321 Z = function(ap) {
12322 return ao.createTextNode(ap)
12323 },
12324 X = T[P] = function(aE) {
12325 var aw, ax = U.paddingBottom,
12326 ar = ah(am),
12327 aB = ar[ac],
12328 aC = ak(ar, ah(am)),
12329 au = ak(ar, ah(am)),
12330 at = ak(ar, ah(am)),
12331 aD = N,
12332 av = N,
12333 aq = N,
12334 ay = 0,
12335 ap = function() {
12336 U.paddingBottom = ar.clientHeight + "px"
12337 },
12338 aA = function(aF) {
12339 var aG = ad.innerHeight,
12340 aH = aC.clientHeight;
12341 if (aF < 0) {
12342 aF = 0
12343 } else {
12344 if (aF + aH > aG) {
12345 aF = aG - aH
12346 }
12347 }
12348 aB.height = aF / aG * 100 + "%";
12349 ap()
12350 },
12351 az = [aj(ao, "mousemove", function(aF) {
12352 if (aD) {
12353 aA(ad.innerHeight - aF.clientY);
12354 au.scrollTop = aq
12355 }
12356 }), aj(ao, "mouseup", function() {
12357 if (aD) {
12358 aD = aq = N
12359 }
12360 }), aj(aC, "dblclick", function(aF) {
12361 aF.preventDefault();
12362 if (av) {
12363 aA(av);
12364 av = N
12365 } else {
12366 av = ar.clientHeight;
12367 aB.height = "0px"
12368 }
12369 }), aj(aC, "mousedown", function(aF) {
12370 aF.preventDefault();
12371 aD = S;
12372 aq = au.scrollTop
12373 }), aj(aC, "contextmenu", function() {
12374 aD = N
12375 }), aj(at, "click", function() {
12376 aw()
12377 })];
12378 aw = function() {
12379 var aF = az.length;
12380 while (aF--) {
12381 V.apply(T, az[aF])
12382 }
12383 al.removeChild(ar);
12384 U.paddingBottom = ax;
12385 aa(au);
12386 aa(ar);
12387 T[P] = X
12388 };
12389 W(ar, ab, au, ae, aC, ai, at, an);
12390 at[ag] = "Close Log";
12391 ak(at, Z("\u2716"));
12392 aC[ag] = "Double-click to toggle log minimization";
12393 al.insertBefore(ar, al.firstChild);
12394 T[P] = function(aH) {
12395 if (ay === O) {
12396 au.removeChild(au.firstChild)
12397 } else {
12398 ay++
12399 }
12400 var aG = ak(au, ah(am)),
12401 aF = ak(aG, ah(am));
12402 aG[ag] = (new Date).toLocaleTimeString();
12403 W(aG, Y, aF, af);
12404 ak(aF, Z(aH));
12405 au.scrollTop = au.scrollHeight
12406 };
12407 T[P](aE);
12408 ap()
12409 }
12410 })()
12411 } else {
12412 if (typeof print === R) {
12413 T[P] = print
12414 }
12415 }
12416 }
12417 return T
12418 }();
12419 F.logger = j;
12420 F.version = "1.4.1";
12421 F.lib = {};
12422 F.registerLibrary = function(N, O) {
12423 F.lib[N] = O;
12424 if (O.hasOwnProperty("init")) {
12425 O.init(g)
12426 }
12427 };
12428 F.instances = k;
12429 F.getInstanceById = function(N) {
12430 return k[J[N]]
12431 };
12432 F.Sketch = function(N) {
12433 this.attachFunction = N;
12434 this.options = {
12435 pauseOnBlur: false,
12436 globalKeyEvents: false
12437 };
12438 this.onLoad = G;
12439 this.onSetup = G;
12440 this.onPause = G;
12441 this.onLoop = G;
12442 this.onFrameStart = G;
12443 this.onFrameEnd = G;
12444 this.onExit = G;
12445 this.params = {};
12446 this.imageCache = {
12447 pending: 0,
12448 images: {},
12449 operaCache: {},
12450 add: function(P, O) {
12451 if (this.images[P]) {
12452 return
12453 }
12454 if (!n) {
12455 this.images[P] = null
12456 }
12457 if (!O) {
12458 O = new Image;
12459 O.onload = function(R) {
12460 return function() {
12461 R.pending--
12462 }
12463 }(this);
12464 this.pending++;
12465 O.src = P
12466 }
12467 this.images[P] = O;
12468 if (D.opera) {
12469 var Q = d.createElement("div");
12470 Q.appendChild(O);
12471 Q.style.position = "absolute";
12472 Q.style.opacity = 0;
12473 Q.style.width = "1px";
12474 Q.style.height = "1px";
12475 if (!this.operaCache[P]) {
12476 d.body.appendChild(Q);
12477 this.operaCache[P] = Q
12478 }
12479 }
12480 }
12481 };
12482 this.sourceCode = undefined;
12483 this.attach = function(P) {
12484 if (typeof this.attachFunction === "function") {
12485 this.attachFunction(P)
12486 } else {
12487 if (this.sourceCode) {
12488 var O = (new Function("return (" + this.sourceCode + ");"))();
12489 O(P);
12490 this.attachFunction = O
12491 } else {
12492 throw "Unable to attach sketch to the processing instance"
12493 }
12494 }
12495 };
12496 this.toString = function() {
12497 var O;
12498 var P = "((function(Sketch) {\n";
12499 P += "var sketch = new Sketch(\n" + this.sourceCode + ");\n";
12500 for (O in this.options) {
12501 if (this.options.hasOwnProperty(O)) {
12502 var Q = this.options[O];
12503 P += "sketch.options." + O + " = " + (typeof Q === "string" ? '"' + Q + '"' : "" + Q) + ";\n"
12504 }
12505 }
12506 for (O in this.imageCache) {
12507 if (this.options.hasOwnProperty(O)) {
12508 P += 'sketch.imageCache.add("' + O + '");\n'
12509 }
12510 }
12511 P += "return sketch;\n})(Processing.Sketch))";
12512 return P
12513 }
12514 };
12515 var v = function(Q, N) {
12516 var O = [],
12517 U = [],
12518 V = N.length,
12519 S = 0;
12520
12521 function T(W, Y) {
12522 var X = new XMLHttpRequest;
12523 X.onreadystatechange = function() {
12524 if (X.readyState === 4) {
12525 var Z;
12526 if (X.status !== 200 && X.status !== 0) {
12527 Z = "Invalid XHR status " + X.status
12528 } else {
12529 if (X.responseText === "") {
12530 if ("withCredentials" in new XMLHttpRequest && (new XMLHttpRequest).withCredentials === false && D.location.protocol === "file:") {
12531 Z = "XMLHttpRequest failure, possibly due to a same-origin policy violation. You can try loading this page in another browser, or load it from http://localhost using a local webserver. See the Processing.js README for a more detailed explanation of this problem and solutions."
12532 } else {
12533 Z = "File is empty."
12534 }
12535 }
12536 }
12537 Y(X.responseText, Z)
12538 }
12539 };
12540 X.open("GET", W, true);
12541 if (X.overrideMimeType) {
12542 X.overrideMimeType("application/json")
12543 }
12544 X.setRequestHeader("If-Modified-Since", "Fri, 01 Jan 1960 00:00:00 GMT");
12545 X.send(null)
12546 }
12547
12548 function P(X, W) {
12549 function Z(ac, aa) {
12550 O[X] = ac;
12551 ++S;
12552 if (aa) {
12553 U.push(W + " ==> " + aa)
12554 }
12555 if (S === V) {
12556 if (U.length === 0) {
12557 try {
12558 return new F(Q, O.join("\n"))
12559 } catch (ab) {
12560 throw "Processing.js: Unable to execute pjs sketch: " + ab
12561 }
12562 } else {
12563 throw "Processing.js: Unable to load pjs sketch files: " + U.join("\n")
12564 }
12565 }
12566 }
12567 if (W.charAt(0) === "#") {
12568 var Y = d.getElementById(W.substring(1));
12569 if (Y) {
12570 Z(Y.text || Y.textContent)
12571 } else {
12572 Z("", "Unable to load pjs sketch: element with id '" + W.substring(1) + "' was not found")
12573 }
12574 return
12575 }
12576 T(W, Z)
12577 }
12578 for (var R = 0; R < V; ++R) {
12579 P(R, N[R])
12580 }
12581 };
12582 var I = function() {
12583 d.removeEventListener("DOMContentLoaded", I, false);
12584 k = [];
12585 var O = d.getElementsByTagName("canvas"),
12586 U;
12587 for (var T = 0, P = O.length; T < P; T++) {
12588 var W = O[T].getAttribute("data-processing-sources");
12589 if (W === null) {
12590 W = O[T].getAttribute("data-src");
12591 if (W === null) {
12592 W = O[T].getAttribute("datasrc")
12593 }
12594 }
12595 if (W) {
12596 U = W.split(/\s+/g);
12597 for (var S = 0; S < U.length;) {
12598 if (U[S]) {
12599 S++
12600 } else {
12601 U.splice(S, 1)
12602 }
12603 }
12604 v(O[T], U)
12605 }
12606 }
12607 var ac, aa, N, Z, ab = d.getElementsByTagName("script"),
12608 Q = [];
12609 for (ac = ab.length - 1; ac >= 0; ac--) {
12610 Q.push(ab[ac])
12611 }
12612 for (ac = 0, aa = Q.length; ac < aa; ac++) {
12613 var Y = Q[ac];
12614 if (!Y.getAttribute) {
12615 continue
12616 }
12617 var X = Y.getAttribute("type");
12618 if (X && (X.toLowerCase() === "text/processing" || X.toLowerCase() === "application/processing")) {
12619 var V = Y.getAttribute("data-processing-target");
12620 O = t;
12621 if (V) {
12622 O = d.getElementById(V)
12623 } else {
12624 var R = Y.nextSibling;
12625 while (R && R.nodeType !== 1) {
12626 R = R.nextSibling
12627 }
12628 if (R && R.nodeName.toLowerCase() === "canvas") {
12629 O = R
12630 }
12631 } if (O) {
12632 if (Y.getAttribute("src")) {
12633 U = Y.getAttribute("src").split(/\s+/);
12634 v(O, U);
12635 continue
12636 }
12637 N = Y.textContent || Y.text;
12638 Z = new F(O, N)
12639 }
12640 }
12641 }
12642 };
12643 F.reload = function() {
12644 if (k.length > 0) {
12645 for (var N = k.length - 1; N >= 0; N--) {
12646 if (k[N]) {
12647 k[N].exit()
12648 }
12649 }
12650 }
12651 I()
12652 };
12653 F.loadSketchFromSources = v;
12654 F.disableInit = function() {
12655 if (n) {
12656 d.removeEventListener("DOMContentLoaded", I, false)
12657 }
12658 };
12659 if (n) {
12660 D.Processing = F;
12661 d.addEventListener("DOMContentLoaded", I, false)
12662 } else {
12663 this.Processing = F
12664 }
12665})(window, window.document, Math); \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)