glimmer-dsl-opal 0.26.2 → 0.28.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2021 Andy Maleh
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
2
  #
3
3
  # Permission is hereby granted, free of charge, to any person obtaining
4
4
  # a copy of this software and associated documentation files (the
@@ -25,11 +25,7 @@ require_relative 'tetris/view/playfield'
25
25
  require_relative 'tetris/view/score_lane'
26
26
  require_relative 'tetris/view/high_score_dialog'
27
27
  require_relative 'tetris/view/tetris_menu_bar'
28
- class Event
29
- def location
30
- `#@native.location`
31
- end
32
- end
28
+
33
29
  class Tetris
34
30
  include Glimmer::UI::CustomShell
35
31
 
@@ -147,7 +143,7 @@ class Tetris
147
143
  def show_about_dialog
148
144
  message_box {
149
145
  text 'Glimmer Tetris'
150
- message "Glimmer Tetris\n\nGlimmer DSL for SWT Sample\n\nUse arrow keys for movement\nand right/left alt/shift keys for rotation\nAlternatively:\nLeft is A\nRight is D\nDown is S\nUp is W\nRotate Left is Q\nRotate Right is E\n\n for Left, Down, Right, Up\n\nCopyright (c) 2007-2021 Andy Maleh"
146
+ message "Glimmer Tetris\n\nGlimmer DSL for SWT Sample\n\nUse arrow keys for movement\nand right/left alt/shift keys for rotation\nAlternatively:\nLeft is A\nRight is D\nDown is S\nUp is W\nRotate Left is Q\nRotate Right is E\n\nCopyright (c) 2007-2021 Andy Maleh"
151
147
  }.open
152
148
  end
153
149
  end
@@ -0,0 +1,86 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class HelloCanvas
23
+ include Glimmer::UI::CustomShell
24
+
25
+ body {
26
+ shell {
27
+ text 'Hello, Canvas!'
28
+ minimum_size 320, 400
29
+
30
+ canvas {
31
+ background :yellow
32
+
33
+ rectangle(0, 0, 220, 400) {
34
+ background rgb(255, 0, 0)
35
+ }
36
+ rectangle(50, 20, 300, 150, 30, 50) {
37
+ background :magenta
38
+ }
39
+ rectangle(50, 20, 300, 150, 30, 50) {
40
+ foreground :yellow
41
+ }
42
+ rectangle(205, 50, 86, 97) {
43
+ foreground :yellow
44
+ }
45
+ rectangle(67, 75, 128, 38) {
46
+ background :yellow
47
+ }
48
+ rectangle(150, 200, 100, 70) {
49
+ background :dark_magenta
50
+ }
51
+ rectangle(50, 200, 30, 70) {
52
+ background :magenta
53
+ }
54
+ oval(110, 310, 100, 100) {
55
+ background :yellow
56
+ }
57
+ arc(210, 210, 100, 100, 30, -77) {
58
+ background :red
59
+ }
60
+ text('Picasso', 67, 103) {
61
+ foreground :dark_magenta
62
+ font name: 'Courier', height: 30
63
+ }
64
+ polygon(250, 210, 260, 170, 270, 210, 290, 230) {
65
+ background :dark_yellow
66
+ }
67
+ polyline(250, 110, 260, 70, 270, 110, 290, 130, 250, 110) {
68
+ foreground :black
69
+ }
70
+ 3.times do |n|
71
+ line(250, 120 + n*10, 270 + n*10, 80 + n*10) {
72
+ foreground :yellow
73
+ }
74
+ end
75
+ 10.times do |n|
76
+ point(220 + n*5, 100 + n*5) {
77
+ foreground :yellow
78
+ }
79
+ end
80
+ }
81
+ }
82
+ }
83
+ end
84
+
85
+ HelloCanvas.launch
86
+
@@ -0,0 +1,149 @@
1
+ # Copyright (c) 2020-2021 Andy Maleh
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining
4
+ # a copy of this software and associated documentation files (the
5
+ # "Software"), to deal in the Software without restriction, including
6
+ # without limitation the rights to use, copy, modify, merge, publish,
7
+ # distribute, sublicense, and/or sell copies of the Software, and to
8
+ # permit persons to whom the Software is furnished to do so, subject to
9
+ # the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be
12
+ # included in all copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ class HelloText
23
+ include Glimmer::UI::CustomShell
24
+
25
+ attr_accessor :default, :no_border, :center, :left, :right, :password, :telephone, :read_only, :wrap, :multi
26
+
27
+ before_body do
28
+ self.default = 'default is :border style'
29
+ self.no_border = 'no border'
30
+ self.center = 'centered'
31
+ self.left = 'left-aligned'
32
+ self.right = 'right-aligned'
33
+ self.password = 'password'
34
+ self.telephone = '555-555-5555'
35
+ self.read_only = 'Telephone area code is 555'
36
+ self.wrap = 'wraps if text content is too long like this example'
37
+ self.multi = "multi-line enables hitting enter,\nbut works like wrap on the web"
38
+ end
39
+
40
+ body {
41
+ shell {
42
+ grid_layout 2, false
43
+
44
+ text 'Hello, Text!'
45
+ minimum_size 350, 100
46
+
47
+ label {
48
+ text 'text'
49
+ }
50
+ text { # includes :border style by default
51
+ layout_data :fill, :center, true, false
52
+ text <=> [self, :default]
53
+ }
54
+
55
+ label {
56
+ text 'text(:none)'
57
+ }
58
+ text(:none) { # no border
59
+ layout_data :fill, :center, true, false
60
+ text <=> [self, :no_border]
61
+ }
62
+
63
+ label {
64
+ text 'text(:center, :border)'
65
+ }
66
+ text(:center, :border) {
67
+ layout_data :fill, :center, true, false
68
+ text <=> [self, :center]
69
+ }
70
+
71
+ label {
72
+ text 'text(:left, :border)'
73
+ }
74
+ text(:left, :border) {
75
+ layout_data :fill, :center, true, false
76
+ text <=> [self, :left]
77
+ }
78
+
79
+ label {
80
+ text 'text(:right, :border)'
81
+ }
82
+ text(:right, :border) {
83
+ layout_data :fill, :center, true, false
84
+ text <=> [self, :right]
85
+ }
86
+
87
+ label {
88
+ text 'text(:password, :border)'
89
+ }
90
+ text(:password, :border) {
91
+ layout_data :fill, :center, true, false
92
+ text <=> [self, :password]
93
+ }
94
+
95
+ label {
96
+ text 'text(:read_only, :border)'
97
+ }
98
+ text(:read_only, :border) {
99
+ layout_data :fill, :center, true, false
100
+ text <= [self, :read_only]
101
+ }
102
+
103
+ label {
104
+ text 'text with event handlers'
105
+ }
106
+ text {
107
+ layout_data :fill, :center, true, false
108
+ text <=> [self, :telephone]
109
+
110
+ # this event kicks in just after the user typed and before modifying the text attribute value
111
+ on_verify_text do |verify_event|
112
+ new_text = verify_event.widget.text.clone
113
+ # new_text[verify_event.start...verify_event.end] = verify_event.text # Opal does not allow string mutation like JRuby in Glimmer DSL for SWT
114
+ new_text = "#{new_text[0...verify_event.start]}#{verify_event.text}#{new_text[verify_event.end..-1]}"
115
+ verify_event.doit = telephone?(new_text)
116
+ end
117
+
118
+ # this event kicks in just after the text widget is verified and modified
119
+ on_modify_text do |modify_event|
120
+ self.read_only = "Telephone area code is #{modify_event.widget.text.gsub(/[^0-9]/, '')[0...3]}"
121
+ end
122
+ }
123
+
124
+ label {
125
+ text 'text(:wrap, :border)'
126
+ }
127
+ text(:wrap, :border) {
128
+ layout_data(:fill, :center, true, false) {
129
+ width_hint 100
130
+ }
131
+ text <=> [self, :wrap]
132
+ }
133
+
134
+ label {
135
+ text 'text(:multi, :border)'
136
+ }
137
+ text(:multi, :border) {
138
+ layout_data :fill, :center, true, false
139
+ text <=> [self, :multi]
140
+ }
141
+ }
142
+ }
143
+
144
+ def telephone?(text)
145
+ !!text.match(/^\d{0,3}[-.\/]?\d{0,3}[-.\/]?\d{0,4}$/)
146
+ end
147
+ end
148
+
149
+ HelloText.launch
@@ -0,0 +1,24 @@
1
+ /*
2
+ MIT License
3
+
4
+ Copyright (c) 2012 - 2021 jonobr1 / http://jonobr1.com
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+ */
24
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Two=t()}(this,(function(){"use strict";var e,t={move:"M",line:"L",curve:"C",arc:"A",close:"Z"};"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self);var i,r=e,s=2*Math.PI,n=.5*Math.PI,a=function(e,t,i,r,s,n){var a;return arguments.length<=1?(a=e.a,t=e.b,i=e.c,r=e.d,s=e.e,n=e.f):a=e,{translateX:s,translateY:n,scaleX:Math.sqrt(a*a+t*t),scaleY:Math.sqrt(i*i+r*r),rotation:180*Math.atan2(t,a)/Math.PI}},o=function(e){i=e},h=function(e,t){t=t&&t.identity()||new i;for(var r=e,s=[];r&&r._matrix;)s.push(r._matrix),r=r.parent;s.reverse();for(var n=0;n<s.length;n++){var a=s[n].elements;t.multiply(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9])}return t},l=function(e,t,i){return i*(t-e)+e},c=[2,4,8,16,32,64,128,256,512,1024,2048,4096],f=function(e){for(var t=0;c[t]&&c[t]<e;)t++;return c[t]},d=function(e,t){for(;e<0;)e+=t;return e%t},_=r.Float32Array||Array,u=Math.floor,g=function(e){return u(1e6*e)/1e6},p=Object.freeze({__proto__:null,decomposeMatrix:a,getComputedMatrix:h,getPoT:f,setMatrix:o,lerp:l,mod:d,NumArray:_,toFixed:g,TWO_PI:s,HALF_PI:n}),m=Array.prototype.slice,y={isNaN:function(e){return"number"==typeof e&&e!==+e},isElement:function(e){return!(!e||1!==e.nodeType)},isObject:function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},extend:function(e){for(var t=m.call(arguments,1),i=0;i<t.length;i++){var r=t[i];for(var s in r)e[s]=r[s]}return e},defaults:function(e){for(var t=m.call(arguments,1),i=0;i<t.length;i++){var r=t[i];for(var s in r)void 0===e[s]&&(e[s]=r[s])}return e},each:function(e,t,i){for(var r=i||this,s=!function(e){if(null==e)return!1;var t=e.length;return"number"==typeof t&&t>=0&&t<4294967296}(e)&&Object.keys(e),n=(s||e).length,a=0;a<n;a++){var o=s?s[a]:a;t.call(r,e[o],o,e)}return e},performance:r.performance&&r.performance.now?r.performance:Date},v={on:b,off:x,trigger:function(e){var t=this;if(!t._events)return t;var i=Array.prototype.slice.call(arguments,1),r=t._events[e];return r&&k(t,r,i),t},listen:function(e,t,i){var r=this;if(e){var s=function(){i.apply(r,arguments)};s.obj=e,s.name=t,s.handler=i,e.on(t,s)}return r},ignore:function(e,t,i){return e.off(t,i),this},Types:{play:"play",pause:"pause",update:"update",render:"render",resize:"resize",change:"change",remove:"remove",insert:"insert",order:"order",load:"load"}};function b(e,t){var i=this;return i._events||(i._events={}),(i._events[e]||(i._events[e]=[])).push(t),i}function x(e,t){var i=this;if(!i._events)return i;if(!e&&!t)return i._events={},i;for(var r=e?[e]:Object.keys(i._events),s=0,n=r.length;s<n;s++){e=r[s];var a=i._events[e];if(a){var o=[];if(t)for(var h=0,l=a.length;h<l;h++){var c=a[h];c=c.handler?c.handler:c,t&&t!==c&&o.push(c)}i._events[e]=o}}return i}function k(e,t,i){var r;switch(i.length){case 0:r=function(r){t[r].call(e,i[0])};break;case 1:r=function(r){t[r].call(e,i[0],i[1])};break;case 2:r=function(r){t[r].call(e,i[0],i[1],i[2])};break;case 3:r=function(r){t[r].call(e,i[0],i[1],i[2],i[3])};break;default:r=function(r){t[r].apply(e,i)}}for(var s=0;s<t.length;s++)r(s)}function w(e,t){this.x=e||0,this.y=t||0}v.bind=b,v.unbind=x,y.extend(w,{zero:new w,add:function(e,t){return new w(e.x+t.x,e.y+t.y)},sub:function(e,t){return new w(e.x-t.x,e.y-t.y)},subtract:function(e,t){return w.sub(e,t)},ratioBetween:function(e,t){return(e.x*t.x+e.y*t.y)/(e.length()*t.length())},angleBetween:function(e,t){var i,r;return arguments.length>=4?(i=arguments[0]-arguments[2],r=arguments[1]-arguments[3],Math.atan2(r,i)):(i=e.x-t.x,r=e.y-t.y,Math.atan2(r,i))},distanceBetween:function(e,t){return Math.sqrt(w.distanceBetweenSquared(e,t))},distanceBetweenSquared:function(e,t){var i=e.x-t.x,r=e.y-t.y;return i*i+r*r},MakeObservable:function(e){e.bind=e.on=function(){return this._bound||(this._x=this.x,this._y=this.y,Object.defineProperty(this,"x",S),Object.defineProperty(this,"y",R),y.extend(this,A),this._bound=!0),v.bind.apply(this,arguments),this}}}),y.extend(w.prototype,v,{constructor:w,set:function(e,t){return this.x=e,this.y=t,this},copy:function(e){return this.x=e.x,this.y=e.y,this},clear:function(){return this.x=0,this.y=0,this},clone:function(){return new w(this.x,this.y)},add:function(e,t){return arguments.length<=0||(arguments.length<=1?"number"==typeof e?(this.x+=e,this.y+=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this.x+=e.x,this.y+=e.y):(this.x+=e,this.y+=t)),this},addSelf:function(e){return this.add.apply(this,arguments)},sub:function(e,t){return arguments.length<=0||(arguments.length<=1?"number"==typeof e?(this.x-=e,this.y-=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this.x-=e.x,this.y-=e.y):(this.x-=e,this.y-=t)),this},subtract:function(){return this.sub.apply(this,arguments)},subSelf:function(e){return this.sub.apply(this,arguments)},subtractSelf:function(e){return this.sub.apply(this,arguments)},multiply:function(e,t){return arguments.length<=0||(arguments.length<=1?"number"==typeof e?(this.x*=e,this.y*=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this.x*=e.x,this.y*=e.y):(this.x*=e,this.y*=t)),this},multiplySelf:function(e){return this.multiply.apply(this,arguments)},multiplyScalar:function(e){return this.multiply(e)},divide:function(e,t){return arguments.length<=0||(arguments.length<=1?"number"==typeof e?(this.x/=e,this.y/=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this.x/=e.x,this.y/=e.y):(this.x/=e,this.y/=t),y.isNaN(this.x)&&(this.x=0),y.isNaN(this.y)&&(this.y=0)),this},divideSelf:function(e){return this.divide.apply(this,arguments)},divideScalar:function(e){return this.divide(e)},negate:function(){return this.multiply(-1)},dot:function(e){return this.x*e.x+this.y*e.y},length:function(){return Math.sqrt(this.lengthSquared())},lengthSquared:function(){return this.x*this.x+this.y*this.y},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,i=this.y-e.y;return t*t+i*i},setLength:function(e){return this.normalize().multiplyScalar(e)},equals:function(e,t){return t=void 0===t?1e-4:t,this.distanceTo(e)<t},lerp:function(e,t){var i=(e.x-this.x)*t+this.x,r=(e.y-this.y)*t+this.y;return this.set(i,r)},isZero:function(e){return e=void 0===e?1e-4:e,this.length()<e},toString:function(){return this.x+", "+this.y},toObject:function(){return{x:this.x,y:this.y}},rotate:function(e){var t=Math.cos(e),i=Math.sin(e);return this.x=this.x*t-this.y*i,this.y=this.x*i+this.y*t,this}});var A={constructor:w,set:function(e,t){return this._x=e,this._y=t,this.trigger(v.Types.change)},copy:function(e){return this._x=e.x,this._y=e.y,this.trigger(v.Types.change)},clear:function(){return this._x=0,this._y=0,this.trigger(v.Types.change)},clone:function(){return new w(this._x,this._y)},add:function(e,t){return arguments.length<=0?this:(arguments.length<=1?"number"==typeof e?(this._x+=e,this._y+=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this._x+=e.x,this._y+=e.y):(this._x+=e,this._y+=t),this.trigger(v.Types.change))},sub:function(e,t){return arguments.length<=0?this:(arguments.length<=1?"number"==typeof e?(this._x-=e,this._y-=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this._x-=e.x,this._y-=e.y):(this._x-=e,this._y-=t),this.trigger(v.Types.change))},multiply:function(e,t){return arguments.length<=0?this:(arguments.length<=1?"number"==typeof e?(this._x*=e,this._y*=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this._x*=e.x,this._y*=e.y):(this._x*=e,this._y*=t),this.trigger(v.Types.change))},divide:function(e,t){return arguments.length<=0?this:(arguments.length<=1?"number"==typeof e?(this._x/=e,this._y/=e):e&&"number"==typeof e.x&&"number"==typeof e.y&&(this._x/=e.x,this._y/=e.y):(this._x/=e,this._y/=t),y.isNaN(this._x)&&(this._x=0),y.isNaN(this._y)&&(this._y=0),this.trigger(v.Types.change))},dot:function(e){return this._x*e.x+this._y*e.y},lengthSquared:function(){return this._x*this._x+this._y*this._y},distanceToSquared:function(e){var t=this._x-e.x,i=this._y-e.y;return t*t+i*i},lerp:function(e,t){var i=(e.x-this._x)*t+this._x,r=(e.y-this._y)*t+this._y;return this.set(i,r)},toString:function(){return this._x+", "+this._y},toObject:function(){return{x:this._x,y:this._y}},rotate:function(e){var t=Math.cos(e),i=Math.sin(e);return this._x=this._x*t-this._y*i,this._y=this._x*i+this._y*t,this}},S={enumerable:!0,get:function(){return this._x},set:function(e){this._x=e,this.trigger(v.Types.change,"x")}},R={enumerable:!0,get:function(){return this._y},set:function(e){this._y=e,this.trigger(v.Types.change,"y")}};function M(e,i,r,s,n,a,o){w.call(this,e,i),this._broadcast=function(){this.trigger(v.Types.change)}.bind(this),this._command=o||t.move,this._relative=!0;var h="number"==typeof r,l="number"==typeof s,c="number"==typeof n,f="number"==typeof a;(h||l||c||f)&&M.AppendCurveProperties(this),h&&(this.controls.left.x=r),l&&(this.controls.left.y=s),c&&(this.controls.right.x=n),f&&(this.controls.right.y=a)}w.MakeObservable(w.prototype),y.extend(M,{AppendCurveProperties:function(e){e.relative=!0,e.controls={},e.controls.left=new w(0,0),e.controls.right=new w(0,0)},MakeObservable:function(e){Object.defineProperty(e,"command",{enumerable:!0,get:function(){return this._command},set:function(e){this._command=e,this._command!==t.curve||y.isObject(this.controls)||M.AppendCurveProperties(this),this.trigger(v.Types.change)}}),Object.defineProperty(e,"relative",{enumerable:!0,get:function(){return this._relative},set:function(e){this._relative!=e&&(this._relative=!!e,this.trigger(v.Types.change))}}),y.extend(e,w.prototype,T),e.bind=e.on=function(){var e=this._bound;w.prototype.bind.apply(this,arguments),e||y.extend(this,T)}}});var T={constructor:M,listen:function(){return y.isObject(this.controls)||M.AppendCurveProperties(this),this.controls.left.bind(v.Types.change,this._broadcast),this.controls.right.bind(v.Types.change,this._broadcast),this},ignore:function(){return this.controls.left.unbind(v.Types.change,this._broadcast),this.controls.right.unbind(v.Types.change,this._broadcast),this},copy:function(e){return this.x=e.x,this.y=e.y,"string"==typeof e.command&&(this.command=e.command),y.isObject(e.controls)&&(y.isObject(this.controls)||M.AppendCurveProperties(this),this.controls.left.copy(e.controls.left),this.controls.right.copy(e.controls.right)),"boolean"==typeof e.relative&&(this.relative=e.relative),this.command===t.arc&&(this.rx=e.rx,this.ry=e.ry,this.xAxisRotation=e.xAxisRotation,this.largeArcFlag=e.largeArcFlag,this.sweepFlag=e.sweepFlag),this},clone:function(){var e=this.controls,t=new M(this.x,this.y,e&&e.left.x,e&&e.left.y,e&&e.right.x,e&&e.right.y,this.command);return t.relative=this._relative,t},toObject:function(){var e={x:this.x,y:this.y};return this._command&&(e.command=this._command),this._relative&&(e.relative=this._relative),this.controls&&(e.controls={left:this.controls.left.toObject(),right:this.controls.right.toObject()}),e},toString:function(){return this.controls?[this._x,this._y,this.controls.left.x,this.controls.left.y,this.controls.right.x,this.controls.right.y,this._command,this._relative?1:0].join(", "):[this._x,this._y].join(", ")}};M.MakeObservable(M.prototype);var O=0,F={nextFrameID:null,Types:{webgl:"WebGLRenderer",svg:"SVGRenderer",canvas:"CanvasRenderer"},Version:"v0.7.9",PublishDate:"2021-08-20T01:48:52.881Z",Identifier:"two-",Resolution:12,AutoCalculateImportedMatrices:!0,Instances:[],uniqueId:function(){return O++}},P={CollinearityEpsilon:Math.pow(10,-30),RecursionLimit:16,CuspLimit:0,Tolerance:{distance:.25,angle:0,epsilon:Number.EPSILON},abscissas:[[.5773502691896257],[0,.7745966692414834],[.33998104358485626,.8611363115940526],[0,.5384693101056831,.906179845938664],[.2386191860831969,.6612093864662645,.932469514203152],[0,.4058451513773972,.7415311855993945,.9491079123427585],[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],[0,.3242534234038089,.6133714327005904,.8360311073266358,.9681602395076261],[.14887433898163122,.4333953941292472,.6794095682990244,.8650633666889845,.9739065285171717],[0,.26954315595234496,.5190961292068118,.7301520055740494,.8870625997680953,.978228658146057],[.1252334085114689,.3678314989981802,.5873179542866175,.7699026741943047,.9041172563704749,.9815606342467192],[0,.2304583159551348,.44849275103644687,.6423493394403402,.8015780907333099,.9175983992229779,.9841830547185881],[.10805494870734367,.31911236892788974,.5152486363581541,.6872929048116855,.827201315069765,.9284348836635735,.9862838086968123],[0,.20119409399743451,.3941513470775634,.5709721726085388,.7244177313601701,.8482065834104272,.937273392400706,.9879925180204854],[.09501250983763744,.2816035507792589,.45801677765722737,.6178762444026438,.755404408355003,.8656312023878318,.9445750230732326,.9894009349916499]],weights:[[1],[.8888888888888888,.5555555555555556],[.6521451548625461,.34785484513745385],[.5688888888888889,.47862867049936647,.23692688505618908],[.46791393457269104,.3607615730481386,.17132449237917036],[.4179591836734694,.3818300505051189,.27970539148927664,.1294849661688697],[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626],[.3302393550012598,.31234707704000286,.26061069640293544,.1806481606948574,.08127438836157441],[.29552422471475287,.26926671930999635,.21908636251598204,.1494513491505806,.06667134430868814],[.2729250867779006,.26280454451024665,.23319376459199048,.18629021092773426,.1255803694649046,.05566856711617366],[.24914704581340277,.2334925365383548,.20316742672306592,.16007832854334622,.10693932599531843,.04717533638651183],[.2325515532308739,.22628318026289723,.2078160475368885,.17814598076194574,.13887351021978725,.09212149983772845,.04048400476531588],[.2152638534631578,.2051984637212956,.18553839747793782,.15720316715819355,.12151857068790319,.08015808715976021,.03511946033175186],[.2025782419255613,.19843148532711158,.1861610000155622,.16626920581699392,.13957067792615432,.10715922046717194,.07036604748810812,.03075324199611727],[.1894506104550685,.18260341504492358,.16915651939500254,.14959598881657674,.12462897125553388,.09515851168249279,.062253523938647894,.027152459411754096]]},E=function(e,t,i,r,s){var n=1-e;return n*n*n*t+3*n*n*e*i+3*n*e*e*r+e*e*e*s},C=function(e,t,i,r,s,n,a,o,h){var l=(h=h||P.RecursionLimit)+1;if(Math.abs(e-a)<.001&&Math.abs(t-o)<.001)return[new M(a,o)];for(var c=[],f=0;f<l;f++){var d=f/l,_=E(d,e,i,s,a),u=E(d,t,r,n,o);c.push(new M(_,u))}return c},L=function(e,t,i,r,s,n,a,o,h){if(e===i&&t===r&&s===a&&n===o){var l=a-e,c=o-t;return Math.sqrt(l*l+c*c)}var f=9*(i-s)+3*(a-e),d=6*(e+s)-12*i,_=3*(i-e),u=9*(r-n)+3*(o-t),g=6*(t+n)-12*r,p=3*(r-t);return I((function(e){var t=(f*e+d)*e+_,i=(u*e+g)*e+p;return Math.sqrt(t*t+i*i)}),0,1,h||P.RecursionLimit)},j=function(e,t,i,r,s,n,a,o){for(var h,l,c,f,d,_,u,g,p=[],m=[[],[]],y=0;y<2;++y)if(0==y?(l=6*e-12*i+6*s,h=-3*e+9*i-9*s+3*a,c=3*i-3*e):(l=6*t-12*r+6*n,h=-3*t+9*r-9*n+3*o,c=3*r-3*t),Math.abs(h)<1e-12){if(Math.abs(l)<1e-12)continue;0<(f=-c/l)&&f<1&&p.push(f)}else u=l*l-4*c*h,g=Math.sqrt(u),u<0||(0<(d=(-l+g)/(2*h))&&d<1&&p.push(d),0<(_=(-l-g)/(2*h))&&_<1&&p.push(_));for(var v,b=p.length,x=b;b--;)v=1-(f=p[b]),m[0][b]=v*v*v*e+3*v*v*f*i+3*v*f*f*s+f*f*f*a,m[1][b]=v*v*v*t+3*v*v*f*r+3*v*f*f*n+f*f*f*o;return m[0][x]=e,m[1][x]=t,m[0][x+1]=a,m[1][x+1]=o,m[0].length=m[1].length=x+2,{min:{x:Math.min.apply(0,m[0]),y:Math.min.apply(0,m[1])},max:{x:Math.max.apply(0,m[0]),y:Math.max.apply(0,m[1])}}},I=function(e,t,i,r){for(var s=P.abscissas[r-2],n=P.weights[r-2],a=.5*(i-t),o=a+t,h=0,l=r+1>>1,c=1&r?n[h++]*e(o):0;h<l;){var f=a*s[h];c+=n[h++]*(e(o+f)+e(o-f))}return a*c},N=function(e,i){for(var r=e.length,s=r-1,n=0;n<r;n++){var a=e[n];y.isObject(a.controls)||M.AppendCurveProperties(a);var o=i?d(n-1,r):Math.max(n-1,0),h=i?d(n+1,r):Math.min(n+1,s),l=e[o],c=a,f=e[h];B(l,c,f),c.command=0===n?t.move:t.curve}},B=function(e,t,i){var r=w.angleBetween(e,t),s=w.angleBetween(i,t),a=w.distanceBetween(e,t),o=w.distanceBetween(i,t),h=(r+s)/2;return a<1e-4||o<1e-4?("boolean"!=typeof t.relative||t.relative||(t.controls.left.copy(t),t.controls.right.copy(t)),t):(a*=.33,o*=.33,s<r?h+=n:h-=n,t.controls.left.x=Math.cos(h)*a,t.controls.left.y=Math.sin(h)*a,h-=Math.PI,t.controls.right.x=Math.cos(h)*o,t.controls.right.y=Math.sin(h)*o,"boolean"!=typeof t.relative||t.relative||(t.controls.left.x+=t.x,t.controls.left.y+=t.y,t.controls.right.x+=t.x,t.controls.right.y+=t.y),t)},V=function(e,t,i){return new w(2*e.x-(t.x+e.x)-(i?e.x:0),2*e.y-(t.y+e.y)-(i?e.y:0))},z=Object.freeze({__proto__:null,Curve:P,getComponentOnCubicBezier:E,subdivide:C,getCurveLength:L,getCurveBoundingBox:j,integrate:I,getCurveFromPoints:N,getControlPoints:B,getReflection:V,getAnchorsFromArcData:function(e,i,r,s,n,a,o){for(var h=F.Resolution,l=0;l<h;l++){var c=(l+1)/h;o&&(c=1-c);var f=c*a+n,d=new M(r*Math.cos(f),s*Math.sin(f));M.AppendCurveProperties(d),d.command=t.line}}}),U=r.devicePixelRatio||1,D=function(e){return U/function(e){return e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1}(e)},X=Math.cos,Y=Math.sin,H=Math.tan,W=[];function G(e,t,i,r,s,n){this.elements=new _(9);var a=e;Array.isArray(a)||(a=Array.prototype.slice.call(arguments)),this.identity(),a.length>0&&this.set(a)}function q(){this.renderer={},this._renderer.flagMatrix=q.FlagMatrix.bind(this),this.isShape=!0,this.id=F.Identifier+F.uniqueId(),this.classList=[],this.matrix=new G,this.translation=new w,this.rotation=0,this.scale=1,this.skewX=0,this.skewY=0}function K(){Array.call(this),arguments[0]&&Array.isArray(arguments[0])?arguments[0].length>0&&Array.prototype.push.apply(this,arguments[0]):arguments.length>0&&Array.prototype.push.apply(this,arguments)}function J(e){K.apply(this,arguments),Object.defineProperty(this,"_events",{value:{},enumerable:!1}),this.ids={},this.attach(Array.isArray(e)?e:Array.prototype.slice.call(arguments)),this.on(v.Types.insert,this.attach),this.on(v.Types.remove,this.detach)}o(G),y.extend(G,{Identity:[1,0,0,0,1,0,0,0,1],Multiply:function(e,t,i){if(t.length<=3){var r=e,s=t[0]||0,n=t[1]||0,a=t[2]||0;return{x:r[0]*s+r[1]*n+r[2]*a,y:r[3]*s+r[4]*n+r[5]*a,z:r[6]*s+r[7]*n+r[8]*a}}var o=e[0],h=e[1],l=e[2],c=e[3],f=e[4],d=e[5],u=e[6],g=e[7],p=e[8],m=t[0],y=t[1],v=t[2],b=t[3],x=t[4],k=t[5],w=t[6],A=t[7],S=t[8];return(i=i||new _(9))[0]=o*m+h*b+l*w,i[1]=o*y+h*x+l*A,i[2]=o*v+h*k+l*S,i[3]=c*m+f*b+d*w,i[4]=c*y+f*x+d*A,i[5]=c*v+f*k+d*S,i[6]=u*m+g*b+p*w,i[7]=u*y+g*x+p*A,i[8]=u*v+g*k+p*S,i}}),y.extend(G.prototype,v,{constructor:G,manual:!1,set:function(e,t,i,r,s,n,a,o,h){var l;return void 0===t&&(e=(l=e)[0],t=l[1],i=l[2],r=l[3],s=l[4],n=l[5],a=l[6],o=l[7],h=l[8]),this.elements[0]=e,this.elements[1]=t,this.elements[2]=i,this.elements[3]=r,this.elements[4]=s,this.elements[5]=n,this.elements[6]=a,this.elements[7]=o,this.elements[8]=h,this.trigger(v.Types.change)},copy:function(e){return this.elements[0]=e.elements[0],this.elements[1]=e.elements[1],this.elements[2]=e.elements[2],this.elements[3]=e.elements[3],this.elements[4]=e.elements[4],this.elements[5]=e.elements[5],this.elements[6]=e.elements[6],this.elements[7]=e.elements[7],this.elements[8]=e.elements[8],this.manual=e.manual,this.trigger(v.Types.change)},identity:function(){return this.elements[0]=G.Identity[0],this.elements[1]=G.Identity[1],this.elements[2]=G.Identity[2],this.elements[3]=G.Identity[3],this.elements[4]=G.Identity[4],this.elements[5]=G.Identity[5],this.elements[6]=G.Identity[6],this.elements[7]=G.Identity[7],this.elements[8]=G.Identity[8],this.trigger(v.Types.change)},multiply:function(e,t,i,r,s,n,a,o,h){if(void 0===t)return this.elements[0]*=e,this.elements[1]*=e,this.elements[2]*=e,this.elements[3]*=e,this.elements[4]*=e,this.elements[5]*=e,this.elements[6]*=e,this.elements[7]*=e,this.elements[8]*=e,this.trigger(v.Types.change);if(void 0===r)return e=e||0,t=t||0,i=i||0,{x:(s=this.elements)[0]*e+s[1]*t+s[2]*i,y:s[3]*e+s[4]*t+s[5]*i,z:s[6]*e+s[7]*t+s[8]*i};var l=this.elements,c=[e,t,i,r,s,n,a,o,h],f=l[0],d=l[1],_=l[2],u=l[3],g=l[4],p=l[5],m=l[6],y=l[7],b=l[8],x=c[0],k=c[1],w=c[2],A=c[3],S=c[4],R=c[5],M=c[6],T=c[7],O=c[8];return this.elements[0]=f*x+d*A+_*M,this.elements[1]=f*k+d*S+_*T,this.elements[2]=f*w+d*R+_*O,this.elements[3]=u*x+g*A+p*M,this.elements[4]=u*k+g*S+p*T,this.elements[5]=u*w+g*R+p*O,this.elements[6]=m*x+y*A+b*M,this.elements[7]=m*k+y*S+b*T,this.elements[8]=m*w+y*R+b*O,this.trigger(v.Types.change)},inverse:function(e){var t=this.elements;e=e||new G;var i=t[0],r=t[1],s=t[2],n=t[3],a=t[4],o=t[5],h=t[6],l=t[7],c=t[8],f=c*a-o*l,d=-c*n+o*h,_=l*n-a*h,u=i*f+r*d+s*_;return u?(u=1/u,e.elements[0]=f*u,e.elements[1]=(-c*r+s*l)*u,e.elements[2]=(o*r-s*a)*u,e.elements[3]=d*u,e.elements[4]=(c*i-s*h)*u,e.elements[5]=(-o*i+s*n)*u,e.elements[6]=_*u,e.elements[7]=(-l*i+r*h)*u,e.elements[8]=(a*i-r*n)*u,e):null},scale:function(e,t){var i=arguments.length;return i<=1&&(t=e),this.multiply(e,0,0,0,t,0,0,0,1)},rotate:function(e){var t=X(e),i=Y(e);return this.multiply(t,-i,0,i,t,0,0,0,1)},translate:function(e,t){return this.multiply(1,0,e,0,1,t,0,0,1)},skewX:function(e){var t=H(e);return this.multiply(1,t,0,0,1,0,0,0,1)},skewY:function(e){var t=H(e);return this.multiply(1,0,0,t,1,0,0,0,1)},toString:function(e){return W.length=0,this.toTransformArray(e,W),W.map(g).join(" ")},toTransformArray:function(e,t){var i=this.elements,r=!!t,s=i[0],n=i[1],a=i[2],o=i[3],h=i[4],l=i[5];if(e){var c=i[6],f=i[7],d=i[8];return r?(t[0]=s,t[1]=o,t[2]=c,t[3]=n,t[4]=h,t[5]=f,t[6]=a,t[7]=l,void(t[8]=d)):[s,o,c,n,h,f,a,l,d]}return r?(t[0]=s,t[1]=o,t[2]=n,t[3]=h,t[4]=a,void(t[5]=l)):[s,o,n,h,a,l]},toArray:function(e,t){var i=this.elements,r=!!t,s=i[0],n=i[1],a=i[2],o=i[3],h=i[4],l=i[5];if(e){var c=i[6],f=i[7],d=i[8];return r?(t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=h,t[5]=l,t[6]=c,t[7]=f,void(t[8]=d)):[s,n,a,o,h,l,c,f,d]}return r?(t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=h,void(t[5]=l)):[s,n,a,o,h,l]},toObject:function(){return{elements:this.toArray(!0),manual:!!this.manual}},clone:function(){return(new G).copy(this)}}),y.extend(q,{FlagMatrix:function(){this._flagMatrix=!0},MakeObservable:function(e){var t={enumerable:!1,get:function(){return this._translation},set:function(e){this._translation&&this._translation.unbind(v.Types.change,this._renderer.flagMatrix),this._translation=e,this._translation.bind(v.Types.change,this._renderer.flagMatrix),q.FlagMatrix.call(this)}};Object.defineProperty(e,"translation",t),Object.defineProperty(e,"position",t),Object.defineProperty(e,"rotation",{enumerable:!0,get:function(){return this._rotation},set:function(e){this._rotation=e,this._flagMatrix=!0}}),Object.defineProperty(e,"scale",{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof w&&this._scale.unbind(v.Types.change,this._renderer.flagMatrix),this._scale=e,this._scale instanceof w&&this._scale.bind(v.Types.change,this._renderer.flagMatrix),this._flagMatrix=!0,this._flagScale=!0}}),Object.defineProperty(e,"skewX",{enumerable:!0,get:function(){return this._skewX},set:function(e){this._skewX=e,this._flagMatrix=!0}}),Object.defineProperty(e,"skewY",{enumerable:!0,get:function(){return this._skewY},set:function(e){this._skewY=e,this._flagMatrix=!0}}),Object.defineProperty(e,"matrix",{enumerable:!0,get:function(){return this._matrix},set:function(e){this._matrix=e,this._flagMatrix=!0}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return this._id},set:function(e){var t=this._id;e!==this._id&&(this._id=e,this._flagId=!0,this.parent&&(delete this.parent.children.ids[t],this.parent.children.ids[this._id]=this))}}),Object.defineProperty(e,"className",{enumerable:!0,get:function(){return this._className},set:function(e){if(this._flagClassName=this._className!==e,this._flagClassName){for(var t=this._className.split(/\s+?/),i=e.split(/\s+?/),r=0;r<t.length;r++){var s=t[r],n=Array.prototype.indexOf.call(this.classList,s);n>=0&&this.classList.splice(n,1)}this.classList=this.classList.concat(i)}this._className=e}}),Object.defineProperty(e,"renderer",{enumerable:!1,get:function(){return this._renderer},set:function(e){this._renderer=e}})}}),y.extend(q.prototype,v,{constructor:q,_flagId:!0,_flagMatrix:!0,_flagScale:!1,_flagClassName:!1,_id:"",_translation:null,_rotation:0,_scale:1,_skewX:0,_skewY:0,_className:"",addTo:function(e){return e.add(this),this},clone:function(e){var t=new q;return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()},_update:function(e){return!this._matrix.manual&&this._flagMatrix&&(this._matrix.identity().translate(this.translation.x,this.translation.y),this._scale instanceof w?this._matrix.scale(this._scale.x,this._scale.y):this._matrix.scale(this._scale),this._matrix.rotate(this.rotation),this._matrix.skewX(this.skewX),this._matrix.skewY(this.skewY)),e&&this.parent&&this.parent._update&&this.parent._update(),this},flagReset:function(){return this._flagId=this._flagMatrix=this._flagScale=this._flagClassName=!1,this}}),q.MakeObservable(q.prototype),K.prototype=new Array,y.extend(K.prototype,v,{constructor:K,pop:function(){var e=Array.prototype.pop.apply(this,arguments);return this.trigger(v.Types.remove,[e]),e},shift:function(){var e=Array.prototype.shift.apply(this,arguments);return this.trigger(v.Types.remove,[e]),e},push:function(){var e=Array.prototype.push.apply(this,arguments);return this.trigger(v.Types.insert,arguments),e},unshift:function(){var e=Array.prototype.unshift.apply(this,arguments);return this.trigger(v.Types.insert,arguments),e},splice:function(){var e,t=Array.prototype.splice.apply(this,arguments);return this.trigger(v.Types.remove,t),arguments.length>2&&(e=this.slice(arguments[0],arguments[0]+arguments.length-2),this.trigger(v.Types.insert,e),this.trigger(v.Types.order)),t},sort:function(){return Array.prototype.sort.apply(this,arguments),this.trigger(v.Types.order),this},reverse:function(){return Array.prototype.reverse.apply(this,arguments),this.trigger(v.Types.order),this},indexOf:function(){return Array.prototype.indexOf.apply(this,arguments)}}),J.prototype=new K,y.extend(J.prototype,{constructor:J,attach:function(e){for(var t=0;t<e.length;t++){var i=e[t];i&&i.id&&(this.ids[i.id]=i)}return this},detach:function(e){for(var t=0;t<e.length;t++)delete this.ids[e[t].id];return this}});var $=Math.min,Z=Math.max;function Q(e){q.call(this,!0),this._renderer.type="group",this.additions=[],this.subtractions=[],this.children=Array.isArray(e)?e:Array.prototype.slice.call(arguments)}function ee(e,t){var i,r=e.parent;function s(){t.subtractions.length>0&&(i=Array.prototype.indexOf.call(t.subtractions,e))>=0&&t.subtractions.splice(i,1),t.additions.length>0&&(i=Array.prototype.indexOf.call(t.additions,e))>=0&&t.additions.splice(i,1),e.parent=t,t.additions.push(e),t._flagAdditions=!0}function n(){(i=Array.prototype.indexOf.call(r.additions,e))>=0&&r.additions.splice(i,1),(i=Array.prototype.indexOf.call(r.subtractions,e))<0&&(r.subtractions.push(e),r._flagSubtractions=!0)}r!==t?(r&&r.children.ids[e.id]&&(i=Array.prototype.indexOf.call(r.children,e),r.children.splice(i,1),n()),t?s():(n(),r._flagAdditions&&0===r.additions.length&&(r._flagAdditions=!1),r._flagSubtractions&&0===r.subtractions.length&&(r._flagSubtractions=!1),delete e.parent)):s()}y.extend(Q,{Children:J,InsertChildren:function(e){for(var t=0;t<e.length;t++)ee.call(this,e[t],this)},RemoveChildren:function(e){for(var t=0;t<e.length;t++)ee.call(this,e[t])},OrderChildren:function(e){this._flagOrder=!0},Properties:["fill","stroke","linewidth","cap","join","miter","closed","curved","automatic"],MakeObservable:function(e){var t=Q.Properties;Object.defineProperty(e,"visible",{enumerable:!0,get:function(){return this._visible},set:function(e){this._flagVisible=this._visible!==e||this._flagVisible,this._visible=e}}),Object.defineProperty(e,"opacity",{enumerable:!0,get:function(){return this._opacity},set:function(e){this._flagOpacity=this._opacity!==e||this._flagOpacity,this._opacity=e}}),Object.defineProperty(e,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(e){this._flagBeginning=this._beginning!==e||this._flagBeginning,this._beginning=e}}),Object.defineProperty(e,"ending",{enumerable:!0,get:function(){return this._ending},set:function(e){this._flagEnding=this._ending!==e||this._flagEnding,this._ending=e}}),Object.defineProperty(e,"length",{enumerable:!0,get:function(){if(this._flagLength||this._length<=0){if(this._length=0,!this.children)return this._length;for(var e=0;e<this.children.length;e++){var t=this.children[e];this._length+=t.length}}return this._length}}),q.MakeObservable(e),Q.MakeGetterSetters(e,t),Object.defineProperty(e,"children",{enumerable:!0,get:function(){return this._children},set:function(e){var t=Q.InsertChildren.bind(this),i=Q.RemoveChildren.bind(this),r=Q.OrderChildren.bind(this);this._children&&(this._children.unbind(),this._children.length>0&&i(this._children)),this._children=new J(e),this._children.bind(v.Types.insert,t),this._children.bind(v.Types.remove,i),this._children.bind(v.Types.order,r),e.length>0&&t(e)}}),Object.defineProperty(e,"mask",{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,e.clip||(e.clip=!0)}})},MakeGetterSetters:function(e,t){Array.isArray(t)||(t=[t]),y.each(t,(function(t){Q.MakeGetterSetter(e,t)}))},MakeGetterSetter:function(e,t){var i="_"+t;Object.defineProperty(e,t,{enumerable:!0,get:function(){return this[i]},set:function(e){this[i]=e;for(var r=0;r<this.children.length;r++){this.children[r][t]=e}}})}}),y.extend(Q.prototype,q.prototype,{constructor:Q,_flagAdditions:!1,_flagSubtractions:!1,_flagOrder:!1,_flagOpacity:!0,_flagBeginning:!1,_flagEnding:!1,_flagLength:!1,_flagMask:!1,_fill:"#fff",_stroke:"#000",_linewidth:1,_opacity:1,_visible:!0,_cap:"round",_join:"round",_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_length:0,_mask:null,clone:function(e){var t=new Q,i=this.children.map((function(e){return e.clone()}));return t.add(i),t.opacity=this.opacity,this.mask&&(t.mask=this.mask),t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.className=this.className,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()},toObject:function(){var e={children:[],translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale instanceof w?this.scale.toObject():this.scale,opacity:this.opacity,className:this.className,mask:this.mask?this.mask.toObject():null};return this.matrix.manual&&(e.matrix=this.matrix.toObject()),y.each(this.children,(function(t,i){e.children[i]=t.toObject()}),this),e},corner:function(){for(var e=this.getBoundingClientRect(!0),t=0;t<this.children.length;t++){var i=this.children[t];i.translation.x-=e.left,i.translation.y-=e.top}return this},center:function(){for(var e=this.getBoundingClientRect(!0),t=e.left+e.width/2-this.translation.x,i=e.top+e.height/2-this.translation.y,r=0;r<this.children.length;r++){var s=this.children[r];s.isShape&&(s.translation.x-=t,s.translation.y-=i)}return this},getById:function(e){var t=null;return function i(r){if(r.id===e)return r;if(r.children)for(var s=0;s<r.children.length;s++)if(t=i(r.children[s]))return t;return null}(this)},getByClassName:function(e){var t=[];return function i(r){if(Array.prototype.indexOf.call(r.classList,e)>=0&&t.push(r),r.children)for(var s=0;s<r.children.length;s++){i(r.children[s])}return t}(this)},getByType:function(e){var t=[];return function i(r){if(r instanceof e&&t.push(r),r.children)for(var s=0;s<r.children.length;s++){i(r.children[s])}return t}(this)},add:function(e){e=e instanceof Array?e.slice():Array.prototype.slice.call(arguments);for(var t=0;t<e.length;t++){var i=e[t];if(i&&i.id){var r=Array.prototype.indexOf.call(this.children,i);r>=0&&this.children.splice(r,1),this.children.push(i)}}return this},remove:function(e){var t=arguments.length,i=this.parent;if(t<=0&&i)return i.remove(this),this;e=e instanceof Array?e.slice():Array.prototype.slice.call(arguments);for(var r=0;r<e.length;r++){var s=e[r];if(s&&this.children.ids[s.id]){var n=this.children.indexOf(s);n>=0&&this.children.splice(n,1)}}return this},getBoundingClientRect:function(e){var t,i,r,s,n,a,o,l,c,f;this._update(!0);var d=1/0,_=-1/0,u=1/0,g=-1/0,p=/texture|gradient/i;i=e?this._matrix:h(this);for(var m=0;m<this.children.length;m++){var v=this.children[m];v.visible&&!p.test(v._renderer.type)&&(o="number"!=typeof(t=v.getBoundingClientRect(e)).top||y.isNaN(t.top)||!isFinite(t.top),l="number"!=typeof t.left||y.isNaN(t.left)||!isFinite(t.left),c="number"!=typeof t.right||y.isNaN(t.right)||!isFinite(t.right),f="number"!=typeof t.bottom||y.isNaN(t.bottom)||!isFinite(t.bottom),o||l||c||f||(u=$(t.top,u),d=$(t.left,d),_=Z(t.right,_),g=Z(t.bottom,g)))}return e&&(r=i.multiply(d,u,1),s=i.multiply(d,g,1),n=i.multiply(_,u,1),a=i.multiply(_,g,1),u=$(r.y,s.y,n.y,a.y),d=$(r.x,s.x,n.x,a.x),_=Z(r.x,s.x,n.x,a.x),g=Z(r.y,s.y,n.y,a.y)),{top:u,left:d,right:_,bottom:g,width:_-d,height:g-u}},noFill:function(){return this.children.forEach((function(e){e.noFill()})),this},noStroke:function(){return this.children.forEach((function(e){e.noStroke()})),this},subdivide:function(){var e=arguments;return this.children.forEach((function(t){t.subdivide.apply(t,e)})),this},_update:function(){var e,t,i;if(this._flagBeginning||this._flagEnding){var r=Math.min(this._beginning,this._ending),s=Math.max(this._beginning,this._ending),n=this.length,a=0,o=r*n,h=s*n;for(e=0;e<this.children.length;e++)o>a+(t=(i=this.children[e]).length)?(i.beginning=1,i.ending=1):h<a?(i.beginning=0,i.ending=0):o>a&&o<a+t?(i.beginning=(o-a)/t,i.ending=1):h>a&&h<a+t?(i.beginning=0,i.ending=(h-a)/t):(i.beginning=0,i.ending=1),a+=t}return q.prototype._update.apply(this,arguments)},flagReset:function(){return this._flagAdditions&&(this.additions.length=0,this._flagAdditions=!1),this._flagSubtractions&&(this.subtractions.length=0,this._flagSubtractions=!1),this._flagOrder=this._flagMask=this._flagOpacity=this._flagBeginning=this._flagEnding=!1,q.prototype.flagReset.call(this),this}}),Q.MakeObservable(Q.prototype);var te=new G,ie=[],re=Math.max,se=Math.min,ne=Math.abs,ae=Math.sin,oe=Math.cos,he=Math.acos,le=Math.sqrt,ce=function(e){return 1==e[0]&&0==e[3]&&0==e[1]&&1==e[4]&&0==e[2]&&0==e[5]},fe={isHidden:/(undefined|none|transparent)/i,alignments:{left:"start",middle:"center",right:"end"},shim:function(e,t){return e.tagName=e.nodeName=t||"canvas",e.nodeType=1,e.getAttribute=function(e){return this[e]},e.setAttribute=function(e,t){return this[e]=t,this},e},group:{renderChild:function(e){fe[e._renderer.type].render.call(e,this.ctx,!0,this.clip)},render:function(e){if(!this._visible)return this;this._update();var t=this._matrix.elements,i=this.parent;this._renderer.opacity=this._opacity*(i&&i._renderer?i._renderer.opacity:1);var r=this._mask,s=ce(t),n=!s||!!r;if(this._renderer.context||(this._renderer.context={}),this._renderer.context.ctx=e,n&&(e.save(),s||e.transform(t[0],t[3],t[1],t[4],t[2],t[5])),r&&fe[r._renderer.type].render.call(r,e,!0),this._opacity>0&&0!==this._scale)for(var a=0;a<this.children.length;a++){var o=this.children[a];fe[o._renderer.type].render.call(o,e)}return n&&e.restore(),this.flagReset()}},path:{render:function(e,i,r){var s,n,a,o,h,l,c,f,_,u,g,p,m,y,v,b,x,k,A,S,R,M,T,O,F,P,E,C,L,j,I,N,B,V,z;if(z=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,j=this._mask,I=this._clip,h=this._opacity*(z||1),l=this._visible,!i&&(!l||I||0===h))return this;this._update(),s=this._matrix.elements,n=this._stroke,a=this._linewidth,o=this._fill,c=this._cap,f=this._join,_=this._miter,u=this._closed,m=(p=(g=this._renderer.vertices).length)-1,N=ce(s),V=this.dashes,N||(e.save(),e.transform(s[0],s[3],s[1],s[4],s[2],s[5])),j&&fe[j._renderer.type].render.call(j,e,!0),o&&("string"==typeof o?e.fillStyle=o:(fe[o._renderer.type].render.call(o,e),e.fillStyle=o._renderer.effect)),n&&("string"==typeof n?e.strokeStyle=n:(fe[n._renderer.type].render.call(n,e),e.strokeStyle=n._renderer.effect),a&&(e.lineWidth=a),_&&(e.miterLimit=_),f&&(e.lineJoin=f),!u&&c&&(e.lineCap=c)),"number"==typeof h&&(e.globalAlpha=h),V&&V.length>0&&(e.lineDashOffset=V.offset||0,e.setLineDash(V)),e.beginPath();for(var U=0;U<p;U++)switch(C=(x=g[U]).x,L=x.y,x.command){case t.close:e.closePath();break;case t.arc:var D=x.rx,X=x.ry,Y=x.xAxisRotation,H=x.largeArcFlag,W=x.sweepFlag,G=(b=g[v=u?d(U-1,p):re(U-1,0)]).x,q=b.y;fe.renderSvgArcCommand(e,G,q,D,X,H,W,Y,C,L);break;case t.curve:v=u?d(U-1,p):Math.max(U-1,0),y=u?d(U+1,p):Math.min(U+1,m),b=g[v],k=g[y],O=b.controls&&b.controls.right||w.zero,F=x.controls&&x.controls.left||w.zero,b._relative?(M=O.x+b.x,T=O.y+b.y):(M=O.x,T=O.y),x._relative?(S=F.x+x.x,R=F.y+x.y):(S=F.x,R=F.y),e.bezierCurveTo(M,T,S,R,C,L),U>=m&&u&&(k=A,P=x.controls&&x.controls.right||w.zero,E=k.controls&&k.controls.left||w.zero,x._relative?(M=P.x+x.x,T=P.y+x.y):(M=P.x,T=P.y),k._relative?(S=E.x+k.x,R=E.y+k.y):(S=E.x,R=E.y),C=k.x,L=k.y,e.bezierCurveTo(M,T,S,R,C,L));break;case t.line:e.lineTo(C,L);break;case t.move:A=x,e.moveTo(C,L)}return u&&e.closePath(),I||r||(fe.isHidden.test(o)||((B=o._renderer&&o._renderer.offset)&&(e.save(),e.translate(-o._renderer.offset.x,-o._renderer.offset.y),e.scale(o._renderer.scale.x,o._renderer.scale.y)),e.fill(),B&&e.restore()),fe.isHidden.test(n)||((B=n._renderer&&n._renderer.offset)&&(e.save(),e.translate(-n._renderer.offset.x,-n._renderer.offset.y),e.scale(n._renderer.scale.x,n._renderer.scale.y),e.lineWidth=a/n._renderer.scale.x),e.stroke(),B&&e.restore())),N||e.restore(),I&&!r&&e.clip(),V&&V.length>0&&e.setLineDash(ie),this.flagReset()}},points:{render:function(e,t,i){var r,n,o,l,c,f,d,_,u,g,p,m,y,v,b,x;if(x=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,c=this._opacity*(x||1),f=this._visible,!(t||f&&0!==c))return this;this._update(),r=this._matrix.elements,n=this._stroke,o=this._linewidth,l=this._fill,u=(_=this._renderer.collection).length,y=ce(r),b=this.dashes,d=this._size,y||(e.save(),e.transform(r[0],r[3],r[1],r[4],r[2],r[5])),l&&("string"==typeof l?e.fillStyle=l:(fe[l._renderer.type].render.call(l,e),e.fillStyle=l._renderer.effect)),n&&("string"==typeof n?e.strokeStyle=n:(fe[n._renderer.type].render.call(n,e),e.strokeStyle=n._renderer.effect),o&&(e.lineWidth=o)),"number"==typeof c&&(e.globalAlpha=c),b&&b.length>0&&(e.lineDashOffset=b.offset||0,e.setLineDash(b)),e.beginPath();var k,w=.5*d;this._sizeAttenuation||(h(this,te),k=te.elements,k=a(k[0],k[3],k[1],k[4],k[2],k[5]),w/=Math.max(k.scaleX,k.scaleY));for(var A=0;A<u;A++)p=(g=_[A]).x,m=g.y,e.moveTo(p+w,m),e.arc(p,m,w,0,s);return i||(fe.isHidden.test(l)||((v=l._renderer&&l._renderer.offset)&&(e.save(),e.translate(-l._renderer.offset.x,-l._renderer.offset.y),e.scale(l._renderer.scale.x,l._renderer.scale.y)),e.fill(),v&&e.restore()),fe.isHidden.test(n)||((v=n._renderer&&n._renderer.offset)&&(e.save(),e.translate(-n._renderer.offset.x,-n._renderer.offset.y),e.scale(n._renderer.scale.x,n._renderer.scale.y),e.lineWidth=o/n._renderer.scale.x),e.stroke(),v&&e.restore())),y||e.restore(),b&&b.length>0&&e.setLineDash(ie),this.flagReset()}},text:{render:function(e,t,i){var r=this.parent&&this.parent._renderer?this.parent._renderer.opacity:1,s=this._opacity*r,n=this._visible,a=this._mask,o=this._clip;if(!t&&(!n||o||0===s))return this;this._update();var h,l,c,f,d,_,u,g,p,m,y,v=this._matrix.elements,b=this._stroke,x=this._linewidth,k=this._fill,w=this._decoration,A=ce(v),S=k._renderer&&k._renderer.offset&&b._renderer&&b._renderer.offset,R=this.dashes,M=fe.alignments[this._alignment]||this._alignment,T=this._baseline;if(A||(e.save(),e.transform(v[0],v[3],v[1],v[4],v[2],v[5])),a&&fe[a._renderer.type].render.call(a,e,!0),S||(e.font=[this._style,this._weight,this._size+"px/"+this._leading+"px",this._family].join(" ")),e.textAlign=M,e.textBaseline=T,k&&("string"==typeof k?e.fillStyle=k:(fe[k._renderer.type].render.call(k,e),e.fillStyle=k._renderer.effect)),b&&("string"==typeof b?e.strokeStyle=b:(fe[b._renderer.type].render.call(b,e),e.strokeStyle=b._renderer.effect),x&&(e.lineWidth=x)),"number"==typeof s&&(e.globalAlpha=s),R&&R.length>0&&(e.lineDashOffset=R.offset||0,e.setLineDash(R)),o||i||(fe.isHidden.test(k)||(k._renderer&&k._renderer.offset?(_=k._renderer.scale.x,u=k._renderer.scale.y,e.save(),e.translate(-k._renderer.offset.x,-k._renderer.offset.y),e.scale(_,u),h=this._size/k._renderer.scale.y,l=this._leading/k._renderer.scale.y,e.font=[this._style,this._weight,h+"px/",l+"px",this._family].join(" "),c=k._renderer.offset.x/k._renderer.scale.x,f=k._renderer.offset.y/k._renderer.scale.y,e.fillText(this.value,c,f),e.restore()):e.fillText(this.value,0,0)),fe.isHidden.test(b)||(b._renderer&&b._renderer.offset?(_=b._renderer.scale.x,u=b._renderer.scale.y,e.save(),e.translate(-b._renderer.offset.x,-b._renderer.offset.y),e.scale(_,u),h=this._size/b._renderer.scale.y,l=this._leading/b._renderer.scale.y,e.font=[this._style,this._weight,h+"px/",l+"px",this._family].join(" "),c=b._renderer.offset.x/b._renderer.scale.x,f=b._renderer.offset.y/b._renderer.scale.y,d=x/b._renderer.scale.x,e.lineWidth=d,e.strokeText(this.value,c,f),e.restore()):e.strokeText(this.value,0,0))),/(underline|strikethrough)/i.test(w)){var O=e.measureText(this.value),F=1;switch(w){case"underline":p=O.actualBoundingBoxAscent,y=O.actualBoundingBoxAscent;break;case"strikethrough":p=0,y=0,F=.5}switch(T){case"top":p+=this._size*F,y+=this._size*F;break;case"baseline":case"bottom":p-=this._size*F,y-=this._size*F}switch(M){case"left":case"start":g=0,m=O.width;break;case"right":case"end":g=-O.width,m=0;break;default:g=-O.width/2,m=O.width/2}e.lineWidth=Math.max(Math.floor(this._size/15),1),e.strokeStyle=e.fillStyle,e.beginPath(),e.moveTo(g,p),e.lineTo(m,y),e.stroke()}return A||e.restore(),o&&!i&&e.clip(),R&&R.length>0&&e.setLineDash(ie),this.flagReset()}},"linear-gradient":{render:function(e){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=e.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var t=0;t<this.stops.length;t++){var i=this.stops[t];this._renderer.effect.addColorStop(i._offset,i._color)}}return this.flagReset()}},"radial-gradient":{render:function(e){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=e.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var t=0;t<this.stops.length;t++){var i=this.stops[t];this._renderer.effect.addColorStop(i._offset,i._color)}}return this.flagReset()}},texture:{render:function(e){this._update();var t=this.image;return(!this._renderer.effect||(this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)&&(this._renderer.effect=e.createPattern(this.image,this._repeat)),(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof w||(this._renderer.offset=new w),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,t&&(this._renderer.offset.x+=t.width/2,this._renderer.offset.y+=t.height/2,this._scale instanceof w?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}},renderSvgArcCommand:function(e,t,i,r,n,a,o,h,l,c){h=h*Math.PI/180,r=ne(r),n=ne(n);var f=(t-l)/2,_=(i-c)/2,u=oe(h)*f+ae(h)*_,g=-ae(h)*f+oe(h)*_,p=r*r,m=n*n,y=u*u,v=g*g,b=y/p+v/m;if(b>1){var x=le(b);p=(r*=x)*r,m=(n*=x)*n}var k=p*v+m*y,w=le(re(0,(p*m-k)/k));a===o&&(w=-w);var A=w*r*g/n,S=-w*n*u/r,R=oe(h)*A-ae(h)*S+(t+l)/2,M=ae(h)*A+oe(h)*S+(i+c)/2,T=_e(1,0,(u-A)/r,(g-S)/n);!function(e,t,i,r,n,a,o,h,l){var c=P.Tolerance.epsilon,f=o-a,_=Math.abs(f)<c;(f=d(f,s))<c&&(f=_?0:s);!0!==h||_||(f===s?f=-s:f-=s);for(var u=0;u<F.Resolution;u++){var g=a+u/(F.Resolution-1)*f,p=t+r*Math.cos(g),m=i+n*Math.sin(g);if(0!==l){var y=Math.cos(l),v=Math.sin(l),b=p-t,x=m-i;p=b*y-x*v+t,m=b*v+x*y+i}e.lineTo(p,m)}}(e,R,M,r,n,T,T+_e((u-A)/r,(g-S)/n,(-u-A)/r,(-g-S)/n)%s,0===o,h)}};function de(e){var t=!1!==e.smoothing;this.domElement=e.domElement||document.createElement("canvas"),this.ctx=this.domElement.getContext("2d"),this.overdraw=e.overdraw||!1,void 0!==this.ctx.imageSmoothingEnabled&&(this.ctx.imageSmoothingEnabled=t),this.scene=new Q,this.scene.parent=this}function _e(e,t,i,r){var s=e*i+t*r,n=le(e*e+t*t)*le(i*i+r*r),a=he(re(-1,se(1,s/n)));return e*r-t*i<0&&(a=-a),a}y.extend(de,{Utils:fe}),y.extend(de.prototype,v,{constructor:de,setSize:function(e,t,i){return this.width=e,this.height=t,this.ratio=void 0===i?D(this.ctx):i,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,this.domElement.style&&y.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this.trigger(v.Types.resize,e,t,i)},render:function(){var e=1===this.ratio;return e||(this.ctx.save(),this.ctx.scale(this.ratio,this.ratio)),this.overdraw||this.ctx.clearRect(0,0,this.width,this.height),fe.group.render.call(this.scene,this.ctx),e||this.ctx.restore(),this}});var ue={Image:null,isHeadless:!1,shim:function(e,t){return de.Utils.shim(e),void 0!==t&&(ue.Image=t),ue.isHeadless=!0,e}},ge={hasEventListeners:"function"==typeof r.addEventListener,bind:function(e,t,i,r){return this.hasEventListeners?e.addEventListener(t,i,!!r):e.attachEvent("on"+t,i),ge},unbind:function(e,t,i,r){return ge.hasEventListeners?e.removeEventListeners(t,i,!!r):e.detachEvent("on"+t,i),ge},getRequestAnimationFrame:function(){var e,t=0,i=["ms","moz","webkit","o"],s=r.requestAnimationFrame;if(!s){for(var n=0;n<i.length;n++)s=r[i[n]+"RequestAnimationFrame"]||s,e=r[i[n]+"CancelAnimationFrame"]||r[i[n]+"CancelRequestAnimationFrame"]||e;s=s||function(e,i){var s=(new Date).getTime(),n=Math.max(0,16-(s-t)),a=r.setTimeout((function(){e(s+n)}),n);return t=s+n,a}}return s}},pe=r.document?r.document.createElement("div"):{};function me(e){this.name="Two.js",this.message=e}pe.id="help-two-load",Object.defineProperty(ge,"temp",{enumerable:!0,get:function(){return y.isElement(pe)&&!r.document.head.contains(pe)&&(y.extend(pe.style,{display:"none"}),r.document.head.appendChild(pe)),pe}}),me.prototype=new Error,y.extend(me.prototype,{constructor:me});var ye,ve=function(e){var t="_"+e,i="_flag"+e.charAt(0).toUpperCase()+e.slice(1);Object.defineProperty(this,e,{enumerable:!0,get:function(){return this[t]},set:function(e){this[t]=e,this[i]=!0}})};function be(){this.map={}}function xe(e,t,i){this.renderer={},this._renderer.type="stop",this.offset="number"==typeof e?e:xe.Index<=0?0:1,this.opacity="number"==typeof i?i:1,this.color="string"==typeof t?t:xe.Index<=0?"#fff":"#000",xe.Index=(xe.Index+1)%2}function ke(e){this.renderer={},this._renderer.type="gradient",this.id=F.Identifier+F.uniqueId(),this.classList=[],this._renderer.flagStops=ke.FlagStops.bind(this),this._renderer.bindStops=ke.BindStops.bind(this),this._renderer.unbindStops=ke.UnbindStops.bind(this),this.spread="pad",e&&(this.stops=e)}function we(e,t,i,r,s){ke.call(this,s),this._renderer.type="linear-gradient";var n=we.FlagEndPoints.bind(this);this.left=(new w).bind(v.Types.change,n),this.right=(new w).bind(v.Types.change,n),"number"==typeof e&&(this.left.x=e),"number"==typeof t&&(this.left.y=t),"number"==typeof i&&(this.right.x=i),"number"==typeof r&&(this.right.y=r)}function Ae(e,t,i,r,s,n){ke.call(this,r),this._renderer.type="radial-gradient",this.center=(new w).bind(v.Types.change,function(){this._flagCenter=!0}.bind(this)),this.radius="number"==typeof i?i:20,this.focal=(new w).bind(v.Types.change,function(){this._flagFocal=!0}.bind(this)),"number"==typeof e&&(this.center.x=e),"number"==typeof t&&(this.center.y=t),this.focal.copy(this.center),"number"==typeof s&&(this.focal.x=s),"number"==typeof n&&(this.focal.y=n)}y.extend(be.prototype,{constructor:be,add:function(e,t){return this.map[e]=t,this},remove:function(e){return delete this.map[e],this},get:function(e){return this.map[e]},contains:function(e){return e in this.map}}),y.extend(xe,{Index:0,Properties:["offset","opacity","color"],MakeObservable:function(e){y.each(xe.Properties,(function(e){var t="_"+e,i="_flag"+e.charAt(0).toUpperCase()+e.slice(1);Object.defineProperty(this,e,{enumerable:!0,get:function(){return this[t]},set:function(e){this[t]=e,this[i]=!0,this.parent&&(this.parent._flagStops=!0)}})}),e),Object.defineProperty(e,"renderer",{enumerable:!1,get:function(){return this._renderer},set:function(e){this._renderer=e}})}}),y.extend(xe.prototype,v,{constructor:xe,clone:function(){var e=new xe;return y.each(xe.Properties,(function(t){e[t]=this[t]}),this),e},toObject:function(){var e={};return y.each(xe.Properties,(function(t){e[t]=this[t]}),this),e},flagReset:function(){return this._flagOffset=this._flagColor=this._flagOpacity=!1,this}}),xe.MakeObservable(xe.prototype),y.extend(ke,{Stop:xe,Properties:["spread"],MakeObservable:function(e){y.each(ke.Properties,ve,e),Object.defineProperty(e,"stops",{enumerable:!0,get:function(){return this._stops},set:function(e){var t=this._renderer.bindStops,i=this._renderer.unbindStops;this._stops&&this._stops.unbind(v.Types.insert,t).unbind(v.Types.remove,i),this._stops=new K((e||[]).slice(0)),this._stops.bind(v.Types.insert,t).bind(v.Types.remove,i),t(this._stops)}}),Object.defineProperty(e,"renderer",{enumerable:!1,get:function(){return this._renderer},set:function(e){this._renderer=e}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return this._id},set:function(e){this._id=e}})},FlagStops:function(){this._flagStops=!0},BindStops:function(e){for(var t=e.length;t--;)e[t].bind(v.Types.change,this._renderer.flagStops),e[t].parent=this;this._renderer.flagStops()},UnbindStops:function(e){for(var t=e.length;t--;)e[t].unbind(v.Types.change,this._renderer.flagStops),delete e[t].parent;this._renderer.flagStops()}}),y.extend(ke.prototype,v,{constructor:ke,_flagId:!1,_flagStops:!1,_flagSpread:!1,_id:"",clone:function(e){var t=new ke(this.stops.map((function(e){return e.clone()})));return y.each(ke.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e={stops:this.stops.map((function(e){return e.toObject()}))};return y.each(ke.Properties,(function(t){e[t]=this[t]}),this),e},_update:function(){return(this._flagSpread||this._flagStops)&&this.trigger(v.Types.change),this},flagReset:function(){return this._flagSpread=this._flagStops=!1,this}}),ke.MakeObservable(ke.prototype),y.extend(we,{Stop:xe,MakeObservable:function(e){ke.MakeObservable(e)},FlagEndPoints:function(){this._flagEndPoints=!0}}),y.extend(we.prototype,ke.prototype,{constructor:we,_flagEndPoints:!1,clone:function(e){var t=this.stops.map((function(e){return e.clone()})),i=new we(this.left._x,this.left._y,this.right._x,this.right._y,t);return y.each(ke.Properties,(function(e){i[e]=this[e]}),this),e&&e.add(i),i},toObject:function(){var e=ke.prototype.toObject.call(this);return e.left=this.left.toObject(),e.right=this.right.toObject(),e},_update:function(){return(this._flagEndPoints||this._flagSpread||this._flagStops)&&this.trigger(v.Types.change),this},flagReset:function(){return this._flagEndPoints=!1,ke.prototype.flagReset.call(this),this}}),we.MakeObservable(we.prototype),y.extend(Ae,{Stop:xe,Properties:["radius"],MakeObservable:function(e){ke.MakeObservable(e),y.each(Ae.Properties,ve,e)}}),y.extend(Ae.prototype,ke.prototype,{constructor:Ae,_flagRadius:!1,_flagCenter:!1,_flagFocal:!1,clone:function(e){var t=this.stops.map((function(e){return e.clone()})),i=new Ae(this.center._x,this.center._y,this._radius,t,this.focal._x,this.focal._y);return y.each(ke.Properties.concat(Ae.Properties),(function(e){i[e]=this[e]}),this),e&&e.add(i),i},toObject:function(){var e=ke.prototype.toObject.call(this);return y.each(Ae.Properties,(function(t){e[t]=this[t]}),this),e.center=this.center.toObject(),e.focal=this.focal.toObject(),e},_update:function(){return(this._flagRadius||this._flatCenter||this._flagFocal||this._flagSpread||this._flagStops)&&this.trigger(v.Types.change),this},flagReset:function(){return this._flagRadius=this._flagCenter=this._flagFocal=!1,ke.prototype.flagReset.call(this),this}}),Ae.MakeObservable(Ae.prototype);var Se={video:/\.(mp4|webm|ogg)$/i,image:/\.(jpe?g|png|gif|tiff|webp)$/i,effect:/texture|gradient/i};function Re(e,t){if(this.renderer={},this._renderer.type="texture",this._renderer.flagOffset=Re.FlagOffset.bind(this),this._renderer.flagScale=Re.FlagScale.bind(this),this.id=F.Identifier+F.uniqueId(),this.classList=[],this.loaded=!1,this.repeat="no-repeat",this.offset=new w,"function"==typeof t){var i=function(){this.unbind(v.Types.load,i),"function"==typeof t&&t()}.bind(this);this.bind(v.Types.load,i)}if("string"==typeof e)this.src=e;else if("object"==typeof e){var r=Object.prototype.toString.call(e);"[object HTMLImageElement]"!==r&&"[object HTMLCanvasElement]"!==r&&"[object HTMLVideoElement]"!==r&&"[object Image]"!==r||(this.image=e)}this._update()}r.document&&(ye=document.createElement("a")),y.extend(Re,{Properties:["id","src","loaded","repeat"],RegularExpressions:Se,ImageRegistry:new be,getAbsoluteURL:function(e){return ye?(ye.href=e,ye.href):e},loadHeadlessBuffer:function(e,t){e.image.onload=t,e.image.src=e.src},getTag:function(e){return e&&e.nodeName&&e.nodeName.toLowerCase()||"img"},getImage:function(e){var t,i=Re.getAbsoluteURL(e);return Re.ImageRegistry.contains(i)?Re.ImageRegistry.get(i):(ue.Image?(t=new ue.Image,de.Utils.shim(t,"img")):r.document?t=Se.video.test(i)?document.createElement("video"):document.createElement("img"):console.warn("Two.js: no prototypical image defined for Two.Texture"),t.crossOrigin="anonymous",t)},Register:{canvas:function(e,t){e._src="#"+e.id,Re.ImageRegistry.add(e.src,e.image),"function"==typeof t&&t()},img:function(e,t){var i=e.image,r=function(e){!ue.isHeadless&&i.removeEventListener&&"function"==typeof i.removeEventListener&&(i.removeEventListener("load",r,!1),i.removeEventListener("error",s,!1)),"function"==typeof t&&t()},s=function(t){throw ue.isHeadless||"function"!=typeof i.removeEventListener||(i.removeEventListener("load",r,!1),i.removeEventListener("error",s,!1)),new me("unable to load "+e.src)};"number"==typeof i.width&&i.width>0&&"number"==typeof i.height&&i.height>0?r():ue.isHeadless||"function"!=typeof i.addEventListener||(i.addEventListener("load",r,!1),i.addEventListener("error",s,!1)),e._src=Re.getAbsoluteURL(e._src),!ue.isHeadless&&i&&i.getAttribute("two-src")||(ue.isHeadless||i.setAttribute("two-src",e.src),Re.ImageRegistry.add(e.src,i),ue.isHeadless?Re.loadHeadlessBuffer(e,r):e.image.src=e.src)},video:function(e,t){if(ue.isHeadless)throw new me("video textures are not implemented in headless environments.");var i=function(s){e.image.removeEventListener("canplaythrough",i,!1),e.image.removeEventListener("error",r,!1),e.image.width=e.image.videoWidth,e.image.height=e.image.videoHeight,"function"==typeof t&&t()},r=function(t){throw e.image.removeEventListener("canplaythrough",i,!1),e.image.removeEventListener("error",r,!1),new me("unable to load "+e.src)};e._src=Re.getAbsoluteURL(e._src),e.image.getAttribute("two-src")||(e.image.setAttribute("two-src",e.src),Re.ImageRegistry.add(e.src,e.image)),e.image.readyState>=4?i():(e.image.addEventListener("canplaythrough",i,!1),e.image.addEventListener("error",r,!1),e.image.src=e.src,e.image.load())}},load:function(e,t){var i=e.image,r=Re.getTag(i);e._flagImage&&(/canvas/i.test(r)?Re.Register.canvas(e,t):(e._src=!ue.isHeadless&&i.getAttribute("two-src")||i.src,Re.Register[r](e,t))),e._flagSrc&&(i||(i=Re.getImage(e.src),e.image=i),r=Re.getTag(i),Re.Register[r](e,t))},FlagOffset:function(){this._flagOffset=!0},FlagScale:function(){this._flagScale=!0},MakeObservable:function(e){y.each(Re.Properties,ve,e),Object.defineProperty(e,"image",{enumerable:!0,get:function(){return this._image},set:function(e){var t;switch(Re.getTag(e)){case"canvas":t="#"+e.id;break;default:t=e.src}Re.ImageRegistry.contains(t)?this._image=Re.ImageRegistry.get(e.src):this._image=e,this._flagImage=!0}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return this._offset},set:function(e){this._offset&&this._offset.unbind(v.Types.change,this._renderer.flagOffset),this._offset=e,this._offset.bind(v.Types.change,this._renderer.flagOffset),this._flagOffset=!0}}),Object.defineProperty(e,"scale",{enumerable:!0,get:function(){return this._scale},set:function(e){this._scale instanceof w&&this._scale.unbind(v.Types.change,this._renderer.flagScale),this._scale=e,this._scale instanceof w&&this._scale.bind(v.Types.change,this._renderer.flagScale),this._flagScale=!0}}),Object.defineProperty(e,"renderer",{enumerable:!1,get:function(){return this._renderer},set:function(e){this._renderer=e}})}}),y.extend(Re.prototype,v,q.prototype,{constructor:Re,_flagId:!1,_flagSrc:!1,_flagImage:!1,_flagVideo:!1,_flagLoaded:!1,_flagRepeat:!1,_flagOffset:!1,_flagScale:!1,_id:"",_src:"",_image:null,_loaded:!1,_repeat:"no-repeat",_scale:1,_offset:null,clone:function(){var e=new Re(this.src);return e.repeat=this.repeat,e.offset.copy(this.origin),e.scale=this.scale,e},toObject:function(){return{src:this.src,repeat:this.repeat,origin:this.origin.toObject(),scale:"number"==typeof this.scale?this.scale:this.scale.toObject()}},_update:function(){return(this._flagSrc||this._flagImage)&&(this.trigger(v.Types.change),(this._flagSrc||this._flagImage)&&(this.loaded=!1,Re.load(this,function(){this.loaded=!0,this.trigger(v.Types.change).trigger(v.Types.load)}.bind(this)))),this._image&&this._image.readyState>=4&&(this._flagVideo=!0),this},flagReset:function(){return this._flagSrc=this._flagImage=this._flagLoaded=this._flagVideo=this._flagScale=this._flagOffset=!1,this}}),Re.MakeObservable(Re.prototype);var Me=Math.min,Te=Math.max,Oe=Math.ceil,Fe=Math.floor;function Pe(e,t,i,r){q.call(this),this._renderer.type="path",this._renderer.flagVertices=Pe.FlagVertices.bind(this),this._renderer.bindVertices=Pe.BindVertices.bind(this),this._renderer.unbindVertices=Pe.UnbindVertices.bind(this),this._renderer.flagFill=Pe.FlagFill.bind(this),this._renderer.flagStroke=Pe.FlagStroke.bind(this),this._renderer.vertices=[],this._renderer.collection=[],this._closed=!!t,this._curved=!!i,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.linewidth=1,this.opacity=1,this.className="",this.visible=!0,this.cap="butt",this.join="miter",this.miter=4,this.vertices=e,this.automatic=!r,this.dashes=[],this.dashes.offset=0}function Ee(e,t){if(0===t||1===t)return!0;for(var i=e._length*t,r=0,s=0;s<e._lengths.length;s++){var n=e._lengths[s];if(r>=i)return i-r>=0;r+=n}return!1}function Ce(e,t){var i=e._length;if(t<=0)return 0;if(t>=i)return e._lengths.length-1;for(var r=0,s=0;r<e._lengths.length;r++){if(s+e._lengths[r]>=t)return t-=s,Math.max(r-1,0)+t/e._lengths[r];s+=e._lengths[r]}return-1}function Le(e,t,i){var r,s,n,a,o,h,l,c,f=t.controls&&t.controls.right,d=e.controls&&e.controls.left;return r=t.x,o=t.y,s=(f||t).x,h=(f||t).y,n=(d||e).x,l=(d||e).y,a=e.x,c=e.y,f&&t._relative&&(s+=t.x,h+=t.y),d&&e._relative&&(n+=e.x,l+=e.y),L(r,o,s,h,n,l,a,c,i)}function je(e,t,i){var r,s,n,a,o,h,l,c,f=t.controls&&t.controls.right,d=e.controls&&e.controls.left;return r=t.x,o=t.y,s=(f||t).x,h=(f||t).y,n=(d||e).x,l=(d||e).y,a=e.x,c=e.y,f&&t._relative&&(s+=t.x,h+=t.y),d&&e._relative&&(n+=e.x,l+=e.y),C(r,o,s,h,n,l,a,c,i)}function Ie(e,t,i,r){Pe.call(this,[new M,new M,new M,new M],!0,!1,!0),this.width=i,this.height=r,this.origin=new w,this.translation.set(e,t),this._update()}function Ne(e,t,i,r,s,n){Pe.call(this,[new M,new M,new M,new M],!0),this.noStroke(),this.noFill(),e instanceof Re?this.texture=e:"string"==typeof e&&(this.texture=new Re(e)),this.origin=new w,this._update(),this.translation.set(t||0,i||0),"number"==typeof r&&(this.columns=r),"number"==typeof s&&(this.rows=s),"number"==typeof n&&(this.frameRate=n),this.index=0}y.extend(Pe,{Properties:["fill","stroke","linewidth","opacity","visible","cap","join","miter","closed","curved","automatic","beginning","ending"],Utils:{getCurveLength:Le},FlagVertices:function(){this._flagVertices=!0,this._flagLength=!0,this.parent&&(this.parent._flagLength=!0)},BindVertices:function(e){for(var t=e.length;t--;)e[t].bind(v.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()},UnbindVertices:function(e){for(var t=e.length;t--;)e[t].unbind(v.Types.change,this._renderer.flagVertices);this._renderer.flagVertices()},FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){q.MakeObservable(e),y.each(Pe.Properties.slice(2,8),ve,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof ke||this._fill instanceof we||this._fill instanceof Ae||this._fill instanceof Re)&&this._fill.unbind(v.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof ke||this._fill instanceof we||this._fill instanceof Ae||this._fill instanceof Re)&&this._fill.bind(v.Types.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof ke||this._stroke instanceof we||this._stroke instanceof Ae||this._stroke instanceof Re)&&this._stroke.unbind(v.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof ke||this._stroke instanceof we||this._stroke instanceof Ae||this._stroke instanceof Re)&&this._stroke.bind(v.Types.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"length",{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(e,"closed",{enumerable:!0,get:function(){return this._closed},set:function(e){this._closed=!!e,this._flagVertices=!0}}),Object.defineProperty(e,"curved",{enumerable:!0,get:function(){return this._curved},set:function(e){this._curved=!!e,this._flagVertices=!0}}),Object.defineProperty(e,"automatic",{enumerable:!0,get:function(){return this._automatic},set:function(e){if(e!==this._automatic){this._automatic=!!e;var t=this._automatic?"ignore":"listen";y.each(this.vertices,(function(e){e[t]()}))}}}),Object.defineProperty(e,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}}),Object.defineProperty(e,"ending",{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}}),Object.defineProperty(e,"vertices",{enumerable:!0,get:function(){return this._collection},set:function(e){var t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(v.Types.insert,t).unbind(v.Types.remove,i),this._collection=e instanceof K?e:new K(e||[]),this._collection.bind(v.Types.insert,t).bind(v.Types.remove,i),t(this._collection)}}),Object.defineProperty(e,"mask",{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,e.clip||(e.clip=!0)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}}),Object.defineProperty(e,"dashes",{enumerable:!0,get:function(){return this._dashes},set:function(e){"number"!=typeof e.offset&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}})}}),y.extend(Pe.prototype,q.prototype,{constructor:Pe,_flagVertices:!0,_flagLength:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagCap:!0,_flagJoin:!0,_flagMiter:!0,_flagMask:!1,_flagClip:!1,_length:0,_fill:"#fff",_stroke:"#000",_linewidth:1,_opacity:1,_visible:!0,_cap:"round",_join:"round",_miter:4,_closed:!0,_curved:!1,_automatic:!0,_beginning:0,_ending:1,_mask:null,_clip:!1,_dashes:null,clone:function(e){for(var t=new Pe,i=0;i<this.vertices.length;i++)t.vertices.push(this.vertices[i].clone());for(var r=0;r<Pe.Properties.length;r++){var s=Pe.Properties[r];t[s]=this[s]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()},toObject:function(){var e={vertices:this.vertices.map((function(e){return e.toObject()}))};return y.each(Pe.Properties,(function(t){e[t]=this[t]}),this),e.className=this.className,e.translation=this.translation.toObject(),e.rotation=this.rotation,e.scale=this.scale instanceof w?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,this.matrix.manual&&(e.matrix=this.matrix.toObject()),e},noFill:function(){return this.fill="transparent",this},noStroke:function(){return this.stroke=void 0,this},corner:function(){for(var e=this.getBoundingClientRect(!0),t=e.width/2,i=e.height/2,r=e.left+e.width/2,s=e.top+e.height/2,n=0;n<this.vertices.length;n++){var a=this.vertices[n];a.x-=r,a.y-=s,a.x+=t,a.y+=i}return this},center:function(){for(var e=this.getBoundingClientRect(!0),t=e.left+e.width/2-this.translation.x,i=e.top+e.height/2-this.translation.y,r=0;r<this.vertices.length;r++){var s=this.vertices[r];s.x-=t,s.y-=i}return this},remove:function(){return this.parent?(this.parent.remove(this),this):this},getBoundingClientRect:function(e){var t,i,r,s,n,a,o,l,c,f,d,_,u,g,p=1/0,m=-1/0,y=1/0,v=-1/0;if(this._update(!0),t=e?this._matrix:h(this),i=(this.linewidth||0)/2,(r=this._renderer.vertices.length)<=0)return{width:0,height:0};for(s=0;s<r;s++)if(a=this._renderer.vertices[s],(n=this._renderer.vertices[(s+r-1)%r]).controls&&a.controls){o=n.controls.right.x,l=n.controls.right.y,n.relative&&(o+=n.x,l+=n.y),c=a.controls.left.x,f=a.controls.left.y,a.relative&&(c+=a.x,f+=a.y);var b=j(n.x,n.y,o,l,c,f,a.x,a.y);y=Me(b.min.y-i,y),p=Me(b.min.x-i,p),m=Te(b.max.x+i,m),v=Te(b.max.y+i,v)}else s<=1&&(y=Me(n.y-i,y),p=Me(n.x-i,p),m=Te(n.x+i,m),v=Te(n.y+i,v)),y=Me(a.y-i,y),p=Me(a.x-i,p),m=Te(a.x+i,m),v=Te(a.y+i,v);return d=t.multiply(p,y,1),_=t.multiply(p,v,1),u=t.multiply(m,y,1),g=t.multiply(m,v,1),{top:y=Me(d.y,_.y,u.y,g.y),left:p=Me(d.x,_.x,u.x,g.x),right:m=Te(d.x,_.x,u.x,g.x),bottom:v=Te(d.y,_.y,u.y,g.y),width:m-p,height:v-y}},getPointAt:function(e,i){for(var r,s,n,a,o,h,c,f,_,u,g,p,m,v,b,x=this.length*Math.min(Math.max(e,0),1),k=this.vertices.length,w=k-1,A=null,S=null,R=0,T=this._lengths.length,O=0;R<T;R++){if(O+this._lengths[R]>=x){this._closed?(r=d(R,k),s=d(R-1,k),0===R&&(r=s,s=R)):(r=R,s=Math.min(Math.max(R-1,0),w)),A=this.vertices[r],S=this.vertices[s],x-=O,e=0!==this._lengths[R]?x/this._lengths[R]:0;break}O+=this._lengths[R]}if(null===A||null===S)return null;if(!A)return S;if(!S)return A;b=S.controls&&S.controls.right,v=A.controls&&A.controls.left,o=S.x,u=S.y,h=(b||S).x,g=(b||S).y,c=(v||A).x,p=(v||A).y,f=A.x,m=A.y,b&&S.relative&&(h+=S.x,g+=S.y),v&&A.relative&&(c+=A.x,p+=A.y),a=E(e,o,h,c,f),_=E(e,u,g,p,m);var F=l(o,h,e),P=l(u,g,e),C=l(h,c,e),L=l(g,p,e),j=l(c,f,e),I=l(p,m,e),N=l(F,C,e),B=l(P,L,e),V=l(C,j,e),z=l(L,I,e);return y.isObject(i)?(i.x=a,i.y=_,y.isObject(i.controls)||M.AppendCurveProperties(i),i.controls.left.x=N,i.controls.left.y=B,i.controls.right.x=V,i.controls.right.y=z,("boolean"===(i.relative,!1)||i.relative)&&(i.controls.left.x-=a,i.controls.left.y-=_,i.controls.right.x-=a,i.controls.right.y-=_),i.t=e,i):((n=new M(a,_,N-a,B-_,V-a,z-_,this._curved?t.curve:t.line)).t=e,n)},plot:function(){if(this.curved)return N(this._collection,this.closed),this;for(var e=0;e<this._collection.length;e++)this._collection[e].command=0===e?t.move:t.line;return this},subdivide:function(e){this._update();var i=this.vertices.length-1,r=this.vertices[i],s=this._closed||this.vertices[i]._command===t.close,n=[];return y.each(this.vertices,(function(a,o){if(o<=0&&!s)r=a;else{if(a.command===t.move)return n.push(new M(r.x,r.y)),o>0&&(n[n.length-1].command=t.line),void(r=a);var h=je(a,r,e);n=n.concat(h),y.each(h,(function(e,i){i<=0&&r.command===t.move?e.command=t.move:e.command=t.line})),o>=i&&(this._closed&&this._automatic?(h=je(a,r=a,e),n=n.concat(h),y.each(h,(function(e,i){i<=0&&r.command===t.move?e.command=t.move:e.command=t.line}))):s&&n.push(new M(a.x,a.y)),n[n.length-1].command=s?t.close:t.line),r=a}}),this),this._automatic=!1,this._curved=!1,this.vertices=n,this},_updateLength:function(e,i){i||this._update();var r=this.vertices.length,s=r-1,n=this.vertices[s],a=0;return void 0===this._lengths&&(this._lengths=[]),y.each(this.vertices,(function(i,r){if(r<=0||i.command===t.move)return n=i,void(this._lengths[r]=0);this._lengths[r]=Le(i,n,e),a+=this._lengths[r],n=i}),this),this._length=a,this._flagLength=!1,this},_update:function(){if(this._flagVertices){this._automatic&&this.plot(),this._flagLength&&this._updateLength(void 0,!0);var e,i,r,s,n,a=this._collection.length,o=this._closed,h=Math.min(this._beginning,this._ending),l=Math.max(this._beginning,this._ending),c=Ce(this,h*this._length),f=Ce(this,l*this._length),d=Oe(c),_=Fe(f);this._renderer.vertices.length=0;for(var u=0;u<a;u++)this._renderer.collection.length<=u&&this._renderer.collection.push(new M),u>_&&!i?((n=this._renderer.collection[u]).copy(this._collection[u]),this.getPointAt(l,n),n.command=this._renderer.collection[u].command,this._renderer.vertices.push(n),i=n,(r=this._collection[u-1])&&r.controls&&(n.controls.right.clear(),this._renderer.collection[u-1].controls.right.clear().lerp(r.controls.right,n.t))):u>=d&&u<=_&&(n=this._renderer.collection[u].copy(this._collection[u]),this._renderer.vertices.push(n),u===_&&Ee(this,l)?(i=n,!o&&i.controls&&i.controls.right.clear()):u===d&&Ee(this,h)&&((e=n).command=t.move,!o&&e.controls&&e.controls.left.clear()));d>0&&!e&&(u=d-1,(n=this._renderer.collection[u]).copy(this._collection[u]),this.getPointAt(h,n),n.command=t.move,this._renderer.vertices.unshift(n),e=n,(s=this._collection[u+1])&&s.controls&&(n.controls.left.clear(),this._renderer.collection[u+1].controls.left.copy(s.controls.left).lerp(w.zero,n.t)))}return q.prototype._update.apply(this,arguments),this},flagReset:function(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagCap=this._flagJoin=this._flagMiter=this._flagClip=!1,q.prototype.flagReset.call(this),this}}),Pe.MakeObservable(Pe.prototype),y.extend(Ie,{Properties:["width","height"],MakeObservable:function(e){Pe.MakeObservable(e),y.each(Ie.Properties,ve,e),Object.defineProperty(e,"origin",{enumerable:!0,get:function(){return this._origin},set:function(e){this._origin&&this._origin.unbind(v.Types.change,this._renderer.flagVertices),this._origin=e,this._origin.bind(v.Types.change,this._renderer.flagVertices),this._renderer.flagVertices()}})}}),y.extend(Ie.prototype,Pe.prototype,{constructor:Ie,_flagWidth:0,_flagHeight:0,_width:0,_height:0,_origin:null,_update:function(){if(this._flagVertices||this._flagWidth||this._flagHeight){var e=this._width/2,i=this._height/2;this._closed||4!==this.vertices.length||this.vertices.push(new M),this.vertices[0].set(-e,-i).add(this._origin).command=t.move,this.vertices[1].set(e,-i).add(this._origin).command=t.line,this.vertices[2].set(e,i).add(this._origin).command=t.line,this.vertices[3].set(-e,i).add(this._origin).command=t.line,this.vertices[4]&&(this.vertices[4].set(-e,-i).add(this._origin).command=t.line)}return Pe.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,Pe.prototype.flagReset.call(this),this},clone:function(e){var t=new Ie(0,0,this.width,this.height);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),y.each(Pe.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e=Pe.prototype.toObject.call(this);return e.width=this.width,e.height=this.height,e.origin=this.origin.toObject(),e}}),Ie.MakeObservable(Ie.prototype),y.extend(Ne,{Properties:["texture","columns","rows","frameRate","index"],MakeObservable:function(e){Ie.MakeObservable(e),y.each(Ne.Properties,ve,e)}}),y.extend(Ne.prototype,Ie.prototype,{constructor:Ne,_flagTexture:!1,_flagColumns:!1,_flagRows:!1,_flagFrameRate:!1,flagIndex:!1,_amount:1,_duration:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_texture:null,_columns:1,_rows:1,_frameRate:0,_index:0,_origin:null,play:function(e,t,i){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=y.performance.now(),"number"==typeof e&&(this._firstFrame=e),"number"==typeof t&&(this._lastFrame=t),"function"==typeof i?this._onLastFrame=i:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=0,this},clone:function(e){var t=new Ne(this.texture,this.translation.x,this.translation.y,this.columns,this.rows,this.frameRate);return this.playing&&(t.play(this._firstFrame,this._lastFrame),t._loop=this._loop),e&&e.add(t),t},toObject:function(){var e=Ie.prototype.toObject.call(this);return e.texture=this.texture.toObject(),e.columns=this.columns,e.rows=this.rows,e.frameRate=this.frameRate,e.index=this.index,e._firstFrame=this._firstFrame,e._lastFrame=this._lastFrame,e._loop=this._loop,e},_update:function(){var e,t,i,r,s,n,a,o,h,c=this._texture,f=this._columns,d=this._rows;if((this._flagColumns||this._flagRows)&&(this._amount=this._columns*this._rows),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._flagTexture&&(this.fill=this._texture),this._texture.loaded){e=(a=c.image.width)/f,t=(o=c.image.height)/d,r=this._amount,this.width!==e&&(this.width=e),this.height!==t&&(this.height=t),this._playing&&this._frameRate>0&&(y.isNaN(this._lastFrame)&&(this._lastFrame=r-1),i=y.performance.now()-this._startTime,s=1e3*((h=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?i%=s:i=Math.min(i,s),n=l(this._firstFrame,h,i/s),(n=Math.floor(n))!==this._index&&(this._index=n,n>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()));var _=-e*(this._index%f)+(a-e)/2,u=-t*Math.floor(this._index/f)+(o-t)/2;_!==c.offset.x&&(c.offset.x=_),u!==c.offset.y&&(c.offset.y=u)}return Ie.prototype._update.call(this),this},flagReset:function(){return this._flagTexture=this._flagColumns=this._flagRows=this._flagFrameRate=!1,Ie.prototype.flagReset.call(this),this}}),Ne.MakeObservable(Ne.prototype);var Be=Math.cos,Ve=Math.sin;function ze(e,t,i,r){for(var s=r?Math.max(r,2):4,n=[],a=0;a<s;a++)n.push(new M(0,0,0,0,0,0));Pe.call(this,n,!0,!0,!0),"number"==typeof i&&(this.radius=i),this._update(),"number"==typeof e&&(this.translation.x=e),"number"==typeof t&&(this.translation.y=t)}y.extend(ze,{Properties:["radius"],MakeObservable:function(e){Pe.MakeObservable(e),y.each(ze.Properties,ve,e)}}),y.extend(ze.prototype,Pe.prototype,{constructor:ze,_flagRadius:!1,_radius:0,_update:function(){if(this._flagVertices||this._flagRadius){var e=this.vertices.length;!this._closed&&e>2&&(e-=1);for(var i=4/3*Math.tan(Math.PI/(2*e)),r=this._radius,a=r*i,o=0;o<this.vertices.length;o++){var h=o/e*s,l=r*Be(h),c=r*Ve(h),f=a*Be(h-n),d=a*Ve(h-n),_=a*Be(h+n),u=a*Ve(h+n),g=this.vertices[o];g.command=0===o?t.move:t.curve,g.set(l,c),g.controls.left.set(f,d),g.controls.right.set(_,u)}}return Pe.prototype._update.call(this),this},flagReset:function(){return this._flagRadius=!1,Pe.prototype.flagReset.call(this),this},clone:function(e){var t=new ze(0,0,this.radius,this.vertices.length);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),y.each(Pe.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e=Pe.prototype.toObject.call(this);return y.each(ze.Properties,(function(t){e[t]=this[t]}),this),e}}),ze.MakeObservable(ze.prototype);var Ue=Math.cos,De=Math.sin;function Xe(e,t,i,r,s){"number"!=typeof r&&"number"==typeof i&&(r=i);for(var n=s?Math.max(s,2):4,a=[],o=0;o<n;o++)a.push(new M);Pe.call(this,a,!0,!0,!0),"number"==typeof i&&(this.width=2*i),"number"==typeof r&&(this.height=2*r),this._update(),this.translation.set(e,t)}function Ye(e,i,r,s){Pe.call(this,[new M(e,i),new M(r,s)]),this.vertices[0].command=t.move,this.vertices[1].command=t.line,this.automatic=!1}function He(e,i,r,s,n){void 0===n&&"number"==typeof r&&"number"==typeof s&&(n=Math.floor(Math.min(r,s)/12));for(var a=[],o=0;o<10;o++)a.push(new M(0,0,0,0,0,0,0===o?t.move:t.curve));Pe.call(this,a),this.closed=!0,this.automatic=!1,this._renderer.flagRadius=He.FlagRadius.bind(this),"number"==typeof r&&(this.width=r),"number"==typeof s&&(this.height=s),"number"==typeof n&&(this.radius=n),this._update(),this.translation.set(e,i)}y.extend(Xe,{Properties:["width","height"],MakeObservable:function(e){Pe.MakeObservable(e),y.each(Xe.Properties,ve,e)}}),y.extend(Xe.prototype,Pe.prototype,{_flagWidth:!1,_flagHeight:!1,_width:0,_height:0,constructor:Xe,_update:function(){if(this._flagVertices||this._flagWidth||this._flagHeight){var e=this.vertices.length;!this._closed&&e>2&&(e-=1);for(var i=4/3*Math.tan(Math.PI/(2*this.vertices.length)),r=this._width/2,a=this._height/2,o=0;o<this.vertices.length;o++){var h=o/e*s,l=r*Ue(h),c=a*De(h),f=r*i*Ue(h-n),d=a*i*De(h-n),_=r*i*Ue(h+n),u=a*i*De(h+n),g=this.vertices[o];g.command=0===o?t.move:t.curve,g.set(l,c),g.controls.left.set(f,d),g.controls.right.set(_,u)}}return Pe.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=!1,Pe.prototype.flagReset.call(this),this},clone:function(e){var t=new Xe(0,0,this.width/2,this.height/2,this.vertices.length);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),y.each(Pe.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e=Pe.prototype.toObject.call(this);return y.each(Xe.Properties,(function(t){e[t]=this[t]}),this),e}}),Xe.MakeObservable(Xe.prototype),y.extend(Ye.prototype,Pe.prototype,{constructor:Ye}),Pe.MakeObservable(Ye.prototype),y.extend(He,{Properties:["width","height"],FlagRadius:function(){this._flagRadius=!0},MakeObservable:function(e){Pe.MakeObservable(e),y.each(He.Properties,ve,e),Object.defineProperty(e,"radius",{enumerable:!0,get:function(){return this._radius},set:function(e){this._radius instanceof w&&this._radius.unbind(v.Types.change,this._renderer.flagRadius),this._radius=e,this._radius instanceof w&&this._radius.bind(v.Types.change,this._renderer.flagRadius),this._flagRadius=!0}})}}),y.extend(He.prototype,Pe.prototype,{constructor:He,_flagWidth:!1,_flagHeight:!1,_flagRadius:!1,_width:0,_height:0,_radius:12,_update:function(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagRadius){var e,t,i,r=this._width,s=this._height;this._radius instanceof w?(e=this._radius.x,t=this._radius.y):(e=this._radius,t=this._radius);var n=r/2,a=s/2;(i=this.vertices[0]).x=-(n-e),i.y=-a,(i=this.vertices[1]).x=n-e,i.y=-a,i.controls.left.clear(),i.controls.right.x=e,i.controls.right.y=0,(i=this.vertices[2]).x=n,i.y=-(a-t),i.controls.right.clear(),i.controls.left.clear(),(i=this.vertices[3]).x=n,i.y=a-t,i.controls.left.clear(),i.controls.right.x=0,i.controls.right.y=t,(i=this.vertices[4]).x=n-e,i.y=a,i.controls.right.clear(),i.controls.left.clear(),(i=this.vertices[5]).x=-(n-e),i.y=a,i.controls.left.clear(),i.controls.right.x=-e,i.controls.right.y=0,(i=this.vertices[6]).x=-n,i.y=a-t,i.controls.left.clear(),i.controls.right.clear(),(i=this.vertices[7]).x=-n,i.y=-(a-t),i.controls.left.clear(),i.controls.right.x=0,i.controls.right.y=-t,(i=this.vertices[8]).x=-(n-e),i.y=-a,i.controls.left.clear(),i.controls.right.clear(),(i=this.vertices[9]).copy(this.vertices[8])}return Pe.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagRadius=!1,Pe.prototype.flagReset.call(this),this},clone:function(e){var t=new He(0,0,this.width,this.height,this.radius);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),y.each(Pe.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e=Pe.prototype.toObject.call(this);return y.each(He.Properties,(function(t){e[t]=this[t]}),this),e.radius="number"==typeof this.radius?this.radius:this.radius.toObject(),e}}),He.MakeObservable(He.prototype);var We=Math.min,Ge=Math.max;function qe(e,t,i,r){if(q.call(this),this._renderer.type="text",this._renderer.flagFill=qe.FlagFill.bind(this),this._renderer.flagStroke=qe.FlagStroke.bind(this),this.value=e,"number"==typeof t&&(this.translation.x=t),"number"==typeof i&&(this.translation.y=i),this.dashes=[],this.dashes.offset=0,!y.isObject(r))return this;y.each(qe.Properties,(function(e){e in r&&(this[e]=r[e])}),this)}y.extend(qe,{Ratio:.6,Properties:["value","family","size","leading","alignment","linewidth","style","weight","decoration","baseline","opacity","visible","className","fill","stroke"],FlagFill:function(){this._flagFill=!0},FlagStroke:function(){this._flagStroke=!0},MakeObservable:function(e){q.MakeObservable(e),y.each(qe.Properties.slice(0,12),ve,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof ke||this._fill instanceof we||this._fill instanceof Ae||this._fill instanceof Re)&&this._fill.unbind(v.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof ke||this._fill instanceof we||this._fill instanceof Ae||this._fill instanceof Re)&&this._fill.bind(v.Types.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof ke||this._stroke instanceof we||this._stroke instanceof Ae||this._stroke instanceof Re)&&this._stroke.unbind(v.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof ke||this._stroke instanceof we||this._stroke instanceof Ae||this._stroke instanceof Re)&&this._stroke.bind(v.Types.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"mask",{enumerable:!0,get:function(){return this._mask},set:function(e){this._mask=e,this._flagMask=!0,e.clip||(e.clip=!0)}}),Object.defineProperty(e,"clip",{enumerable:!0,get:function(){return this._clip},set:function(e){this._clip=e,this._flagClip=!0}}),Object.defineProperty(e,"dashes",{enumerable:!0,get:function(){return this._dashes},set:function(e){"number"!=typeof e.offset&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}})}}),y.extend(qe.prototype,q.prototype,{constructor:qe,_flagValue:!0,_flagFamily:!0,_flagSize:!0,_flagLeading:!0,_flagAlignment:!0,_flagBaseline:!0,_flagStyle:!0,_flagWeight:!0,_flagDecoration:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagClassName:!0,_flagVisible:!0,_flagMask:!1,_flagClip:!1,_value:"",_family:"sans-serif",_size:13,_leading:17,_alignment:"center",_baseline:"middle",_style:"normal",_weight:500,_decoration:"none",_fill:"#000",_stroke:"transparent",_linewidth:1,_opacity:1,_className:"",_visible:!0,_mask:null,_clip:!1,_dashes:null,remove:function(){return this.parent?(this.parent.remove(this),this):this},clone:function(e){var t=new qe(this.value);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,y.each(qe.Properties,(function(e){t[e]=this[e]}),this),this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()},toObject:function(){var e={translation:this.translation.toObject(),rotation:this.rotation,scale:this.scale};return this.matrix.manual&&(e.matrix=this.matrix.toObject()),y.each(qe.Properties,(function(t){e[t]=this[t]}),this),e},noFill:function(){return this.fill="transparent",this},noStroke:function(){return this.stroke=void 0,this.linewidth=void 0,this},getBoundingClientRect:function(e){var t,i,r,s,n,a,o,l,c;this._update(!0),t=e?this._matrix:h(this);var f=this.leading,d=this.value.length*this.size*qe.Ratio,_=(this._linewidth||0)/2;switch(this.alignment){case"left":a=-_,o=d+_;break;case"right":a=-(d+_),o=_;break;default:a=-(d/2+_),o=d/2+_}switch(this.baseline){case"top":l=-_,c=f+_;break;case"bottom":l=-(f+_),c=_;break;default:l=-(f/2+_),c=f/2+_}return i=t.multiply(a,l,1),r=t.multiply(a,c,1),s=t.multiply(o,l,1),n=t.multiply(o,c,1),{top:l=We(i.y,r.y,s.y,n.y),left:a=We(i.x,r.x,s.x,n.x),right:o=Ge(i.x,r.x,s.x,n.x),bottom:c=Ge(i.y,r.y,s.y,n.y),width:o-a,height:c-l}},flagReset:function(){return this._flagValue=this._flagFamily=this._flagSize=this._flagLeading=this._flagAlignment=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagClip=this._flagDecoration=this._flagClassName=this._flagBaseline=this._flagWeight=this._flagStyle=!1,q.prototype.flagReset.call(this),this}}),qe.MakeObservable(qe.prototype);var Ke=/[+-]?(?:\d*\.\d+|\d+)(?:[eE][+-]\d+)?/g,Je={start:"left",middle:"center",end:"right"},$e=function(e){return e.replace(/svg:/gi,"").toLowerCase()},Ze=function(e,t){if(t.x+=e.translateX,t.y+=e.translateY,t.x*=e.scaleX,t.y*=e.scaleY,0!==e.rotation){var i=t.length();t.x=i*Math.cos(e.rotation),t.y=i*Math.sin(e.rotation)}},Qe=function(e,t){var i,r,s,n;t||(t={}),i=e.split(";");for(var a=0;a<i.length;a++)s=(r=i[a].split(":"))[0],n=r[1],void 0!==s&&void 0!==n&&(t[s]=n.replace(/\s/,""));return t},et=function(e){for(var t={},i=tt(e),r=Math.max(i.length,e.style.length),s=0;s<r;s++){var n=e.style[s],a=i[s];n&&(t[n]=e.style[n]),a&&(t[a]=e.getAttribute(a))}return t},tt=function(e){for(var t=e.getAttributeNames(),i=["id","class","transform","xmlns","viewBox"],r=0;r<i.length;r++){var s=i[r],n=Array.prototype.indexOf.call(t,s);n>=0&&t.splice(n,1)}return t},it=function(e,t){var i=t.split(/\s/),r=parseFloat(i[0]),s=parseFloat(i[1]),n=parseFloat(i[2]),a=parseFloat(i[3]),o=Math.min(this.width/n,this.height/a);return e.translation.x-=r*o,e.translation.y-=s*o,e.scale=o,e},rt=function(e,t,i){var s,n,o,h,l,c,f,d,_,u,g,p={},m={},v={};if(r.getComputedStyle){var b=r.getComputedStyle(e);for(s=b.length;s--;)void 0!==(h=b[o=b[s]])&&(p[o]=h)}for(s=0;s<e.attributes.length;s++)l=e.attributes[s],/style/i.test(l.nodeName)?Qe(l.value,v):m[l.nodeName]=l.value;for(o in void 0!==p.opacity&&(p["stroke-opacity"]=p.opacity,p["fill-opacity"]=p.opacity,delete p.opacity),i&&y.defaults(p,i),y.extend(p,v,m),p.visible=!(void 0===p.display&&/none/i.test(p.display))||void 0===p.visibility&&/hidden/i.test(p.visibility),p)switch(h=p[o],o){case"gradientTransform":if(/none/i.test(h))break;if(null===(n=e.gradientTransform&&e.gradientTransform.baseVal&&e.gradientTransform.baseVal.length>0?e.gradientTransform.baseVal[0].matrix:e.getCTM?e.getCTM():null))break;switch(c=a(n),t._renderer.type){case"linear-gradient":Ze(c,t.left),Ze(c,t.right);break;case"radial-gradient":t.center.x+=c.translateX,t.center.y+=c.translateY,t.focal.x+=c.translateX,t.focal.y+=c.translateY,t.radius*=Math.max(c.scaleX,c.scaleY)}break;case"transform":if(/none/i.test(h))break;if(null===(n=e.transform&&e.transform.baseVal&&e.transform.baseVal.length>0?e.transform.baseVal[0].matrix:e.getCTM?e.getCTM():null))break;F.AutoCalculateImportedMatrices?(c=a(n),t.translation.set(c.translateX,c.translateY),t.rotation=Math.PI*(c.rotation/180),t.scale=new w(c.scaleX,c.scaleY),f=parseFloat((p.x+"").replace("px")),d=parseFloat((p.y+"").replace("px")),f&&(t.translation.x=f),d&&(t.translation.y=d)):(n=e.getCTM(),t._matrix.manual=!0,t._matrix.set(n.a,n.b,n.c,n.d,n.e,n.f));break;case"viewBox":it.call(this,t,h);break;case"visible":if(t instanceof Q){t._visible=h;break}t.visible=h;break;case"stroke-linecap":if(t instanceof Q){t._cap=h;break}t.cap=h;break;case"stroke-linejoin":if(t instanceof Q){t._join=h;break}t.join=h;break;case"stroke-miterlimit":if(t instanceof Q){t._miter=h;break}t.miter=h;break;case"stroke-width":if(t instanceof Q){t._linewidth=parseFloat(h);break}t.linewidth=parseFloat(h);break;case"opacity":case"stroke-opacity":case"fill-opacity":if(t instanceof Q){t._opacity=parseFloat(h);break}t.opacity=parseFloat(h);break;case"clip-path":if(/url\(#.*\)/i.test(h)&&(_=h.replace(/url\(#(.*)\)/i,"$1"),at.defs.current&&at.defs.current.contains(_)&&(u=at.defs.current.get(_))&&u.childNodes.length>0))switch(u=u.childNodes[0],g=$e(u.nodeName),t.mask=at[g].call(this,u,{}),t._renderer.type){case"text":case"path":t.position.add(t.mask.position),t.mask.position.clear()}break;case"fill":case"stroke":t instanceof Q&&(o="_"+o),/url\(#.*\)/i.test(h)?(_=h.replace(/url\(#(.*)\)/i,"$1"),at.defs.current&&at.defs.current.contains(_)?(u=at.defs.current.get(_),g=$e(u.nodeName),u=at[g].call(this,u,{})):u=nt(this).getById(_),t[o]=u):t[o]=/none/i.test(h)?"transparent":h;break;case"id":t.id=h,e.id=h+"-"+F.Identifier+"applied";break;case"class":case"className":t.classList=h.split(" ");break;case"x":case"y":if(t instanceof ke||t instanceof we||t instanceof Ae)break;if(h.match("[a-z%]$")&&!h.endsWith("px")){var x=new me("only pixel values are supported with the "+o+" attribute.");console.warn(x.name,x.message)}t.translation[o]=parseFloat(h);break;case"font-family":t instanceof qe&&(t.family=h);break;case"font-size":t instanceof qe&&(t.size=h);break;case"font-weight":t instanceof qe&&(t.weight=h);break;case"font-style":t instanceof qe&&(t.style=h);break;case"text-decoration":t instanceof qe&&(t.decoration=h);break;case"line-height":t instanceof qe&&(t.leading=h)}return p},st=function(e,t){for(var i=0,r=e.childNodes.length;i<r;i++){var s=e.childNodes[i];if(s.id)"#text"!==$e(e.nodeName)&&t.add(s.id,s)}},nt=function(e){for(;e.parent;)e=e.parent;return e.scene},at={svg:function(e){for(var t=at.defs.current=new be,i=e.getElementsByTagName("defs"),r=0;r<i.length;r++)st(i[r],t);var s=at.g.call(this,e);return s.defs=t,delete at.defs.current,s},defs:function(e){return null},use:function(e,t){var i,r=e.getAttribute("href")||e.getAttribute("xlink:href");if(!r)return i=new me("encountered <use /> with no href."),console.warn(i.name,i.message),null;var s=r.slice(1);if(!at.defs.current.contains(s))return i=new me("unable to find element for reference "+r+"."),console.warn(i.name,i.message),null;for(var n=at.defs.current.get(s).cloneNode(!0),a=["x","y","width","height","href","xlink:href"],o=0;o<e.attributes.length;o++){var h=e.attributes[o],l=a.includes(h.nodeName),c=!n.hasAttribute(h.nodeName);(l||c)&&n.setAttribute(h.nodeName,h.value)}var f=$e(n.nodeName);return at[f].call(this,n,t)},g:function(e,t){var i,r=new Q;rt.call(this,e,r,t),this.add(r),i=et.call(this,e);for(var s=0,n=e.childNodes.length;s<n;s++){var a=e.childNodes[s],o=a.nodeName;if(!o)return;var h=$e(o);if(h in at){var l=at[h].call(r,a,i);l&&!l.parent&&r.add(l)}}return r},polygon:function(e,t){var i=e.getAttribute("points"),r=[];i.replace(/(-?[\d.eE-]+)[,|\s](-?[\d.eE-]+)/g,(function(e,t,i){r.push(new M(parseFloat(t),parseFloat(i)))}));var s=new Pe(r,!0).noStroke();return s.fill="black",rt.call(this,e,s,t),s},polyline:function(e,t){var i=at.polygon.call(this,e,t);return i.closed=!1,i},path:function(e,i){var r=e.getAttribute("d"),s=[],n=!1,a=!1;if(r){var o,h,l=new M,c=r.match(/[a-df-z][^a-df-z]*/gi),f=c.length-1;y.each(c.slice(0),(function(e,t){var i,r,s,n,a,o=e.slice(1).trim().match(Ke),h=e[0],l=h.toLowerCase(),f=[];switch(0===t&&(c=[]),l){case"h":case"v":o.length>1&&(i=1);break;case"m":case"l":case"t":o.length>2&&(i=2);break;case"s":case"q":o.length>4&&(i=4);break;case"c":o.length>6&&(i=6);break;case"a":o.length>7&&(i=7)}if(i){for(r=0,s=o.length,a=0;r<s;r+=i){if(n=h,a>0)switch(h){case"m":n="l";break;case"M":n="L"}f.push(n+o.slice(r,r+i).join(" ")),a++}c=Array.prototype.concat.apply(c,f)}else c.push(e)})),y.each(c,(function(e,i){var r,c,d,_,u,g,p,m,v,b,x=e[0],k=x.toLowerCase();switch(h=e.slice(1).trim().match(Ke),a=x===k,k){case"z":if(i>=f)n=!0;else{r=new M(l.x,l.y,void 0,void 0,void 0,void 0,t.close);for(var A=s.length-1;A>=0;A--){var S=s[A];if(/m/i.test(S.command)){l=S;break}}}break;case"m":case"l":o=void 0,r=new M(parseFloat(h[0]),parseFloat(h[1]),void 0,void 0,void 0,void 0,/m/i.test(k)?t.move:t.line),a&&r.addSelf(l),l=r;break;case"h":case"v":var R=/h/i.test(k)?"x":"y",T=/x/i.test(R)?"y":"x";(r=new M(void 0,void 0,void 0,void 0,void 0,void 0,t.line))[R]=parseFloat(h[0]),r[T]=l[T],a&&(r[R]+=l[R]),l=r;break;case"c":case"s":c=l.x,d=l.y,o||(o=new w),/c/i.test(k)?(_=parseFloat(h[0]),u=parseFloat(h[1]),g=parseFloat(h[2]),p=parseFloat(h[3]),m=parseFloat(h[4]),v=parseFloat(h[5])):(_=(b=V(l,o,a)).x,u=b.y,g=parseFloat(h[0]),p=parseFloat(h[1]),m=parseFloat(h[2]),v=parseFloat(h[3])),a&&(_+=c,u+=d,g+=c,p+=d,m+=c,v+=d),y.isObject(l.controls)||M.AppendCurveProperties(l),l.controls.right.set(_-l.x,u-l.y),r=new M(m,v,g-m,p-v,void 0,void 0,t.curve),l=r,o=r.controls.left;break;case"t":case"q":c=l.x,d=l.y,o||(o=new w),/q/i.test(k)?(_=parseFloat(h[0]),u=parseFloat(h[1]),g=parseFloat(h[0]),p=parseFloat(h[1]),m=parseFloat(h[2]),v=parseFloat(h[3])):(_=(b=V(l,o,a)).x,u=b.y,g=b.x,p=b.y,m=parseFloat(h[0]),v=parseFloat(h[1])),a&&(_+=c,u+=d,g+=c,p+=d,m+=c,v+=d),y.isObject(l.controls)||M.AppendCurveProperties(l),l.controls.right.set(.33*(_-l.x),.33*(u-l.y)),r=new M(m,v,g-m,p-v,void 0,void 0,t.curve),l=r,o=r.controls.left;break;case"a":c=l.x,d=l.y;var O=parseFloat(h[0]),F=parseFloat(h[1]),P=parseFloat(h[2]),E=parseFloat(h[3]),C=parseFloat(h[4]);m=parseFloat(h[5]),v=parseFloat(h[6]),a&&(m+=c,v+=d);var L=new M(m,v);L.command=t.arc,L.rx=O,L.ry=F,L.xAxisRotation=P,L.largeArcFlag=E,L.sweepFlag=C,r=L,l=L,o=void 0}r&&(Array.isArray(r)?s=s.concat(r):s.push(r))}))}(r=new Pe(s,n,void 0,!0).noStroke()).fill="black";var d=r.getBoundingClientRect(!0);return d.centroid={x:d.left+d.width/2,y:d.top+d.height/2},y.each(r.vertices,(function(e){e.subSelf(d.centroid)})),rt.call(this,e,r,i),r.translation.addSelf(d.centroid),r},circle:function(e,t){var i=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=new ze(0,0,parseFloat(e.getAttribute("r"))).noStroke();return s.fill="black",rt.call(this,e,s,t),s.translation.x=i,s.translation.y=r,s},ellipse:function(e,t){var i=parseFloat(e.getAttribute("cx")),r=parseFloat(e.getAttribute("cy")),s=new Xe(0,0,parseFloat(e.getAttribute("rx")),parseFloat(e.getAttribute("ry"))).noStroke();return s.fill="black",rt.call(this,e,s,t),s.translation.x=i,s.translation.y=r,s},rect:function(e,t){var i=parseFloat(e.getAttribute("rx")),r=parseFloat(e.getAttribute("ry"));if(!y.isNaN(i)||!y.isNaN(r))return at["rounded-rect"](e);var s=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),a=s/2,o=n/2,h=new Ie(0,0,s,n).noStroke();return h.fill="black",rt.call(this,e,h,t),h.translation.x+=a,h.translation.y+=o,h},"rounded-rect":function(e,t){var i=parseFloat(e.getAttribute("rx"))||0,r=parseFloat(e.getAttribute("ry"))||0,s=parseFloat(e.getAttribute("width")),n=parseFloat(e.getAttribute("height")),a=s/2,o=n/2,h=new He(0,0,s,n,new w(i,r)).noStroke();return h.fill="black",rt.call(this,e,h,t),h.translation.x+=a,h.translation.y+=o,h},line:function(e,t){var i=new Ye(parseFloat(e.getAttribute("x1")),parseFloat(e.getAttribute("y1")),parseFloat(e.getAttribute("x2")),parseFloat(e.getAttribute("y2"))).noFill();return rt.call(this,e,i,t),i},lineargradient:function(e,t){for(var i=parseFloat(e.getAttribute("x1")),r=parseFloat(e.getAttribute("y1")),s=parseFloat(e.getAttribute("x2")),n=parseFloat(e.getAttribute("y2")),a=(s+i)/2,o=(n+r)/2,h=[],l=0;l<e.children.length;l++){var c=e.children[l],f=c.getAttribute("offset");/%/gi.test(f)&&(f=parseFloat(f.replace(/%/gi,""))/100),f=parseFloat(f);var d,_=c.getAttribute("stop-color"),u=c.getAttribute("stop-opacity"),g=c.getAttribute("style");null===_&&(_=(d=!!g&&g.match(/stop-color:\s?([#a-fA-F0-9]*)/))&&d.length>1?d[1]:void 0),u=null===u?(d=!!g&&g.match(/stop-opacity:\s?([0-9.-]*)/))&&d.length>1?parseFloat(d[1]):1:parseFloat(u),h.push(new xe(f,_,u))}var p=new we(i-a,r-o,s-a,n-o,h);return rt.call(this,e,p,t),p},radialgradient:function(e,t){var i=parseFloat(e.getAttribute("cx"))||0,r=parseFloat(e.getAttribute("cy"))||0,s=parseFloat(e.getAttribute("r")),n=parseFloat(e.getAttribute("fx")),a=parseFloat(e.getAttribute("fy"));y.isNaN(n)&&(n=i),y.isNaN(a)&&(a=r);for(var o=Math.abs(i+n)/2,h=Math.abs(r+a)/2,l=[],c=0;c<e.children.length;c++){var f=e.children[c],d=f.getAttribute("offset");/%/gi.test(d)&&(d=parseFloat(d.replace(/%/gi,""))/100),d=parseFloat(d);var _,u=f.getAttribute("stop-color"),g=f.getAttribute("stop-opacity"),p=f.getAttribute("style");null===u&&(u=(_=!!p&&p.match(/stop-color:\s?([#a-fA-F0-9]*)/))&&_.length>1?_[1]:void 0),g=null===g?(_=!!p&&p.match(/stop-opacity:\s?([0-9.-]*)/))&&_.length>1?parseFloat(_[1]):1:parseFloat(g),l.push(new xe(d,u,g))}var m=new Ae(i-o,r-h,s,l,n-o,a-h);return rt.call(this,e,m,t),m},text:function(e,t){var i=function(e){return Je[e]}(e.getAttribute("text-anchor"))||"left",r=function(e){var t=e.getAttribute("dominant-baseline"),i=e.getAttribute("alignment-baseline");return t||i}(e)||"baseline",s=new qe(e.textContent);return rt.call(this,e,s,t),s.alignment=i,s.baseline=r,s},clippath:function(e,t){return at.defs.current&&!at.defs.current.contains(e.id)&&at.defs.current.add(e.id,e),null},image:function(e,t){var i=e.getAttribute("href")||e.getAttribute("xlink:href");if(!i){var r=new me("encountered <image /> with no href.");return console.warn(r.name,r.message),null}var s=parseFloat(e.getAttribute("x"))||0,n=parseFloat(e.getAttribute("y"))||0,a=parseFloat(e.getAttribute("width")),o=parseFloat(e.getAttribute("height")),h=new Ne(i,s,n);return y.isNaN(a)||(h.width=a),y.isNaN(o)||(h.height=o),rt.call(this,e,h,t),h}};function ot(e,t){var i=new XMLHttpRequest;return i.open("GET",e),i.onreadystatechange=function(){4===i.readyState&&200===i.status&&t(i.responseText)},i.send(),i}function ht(e,t,i,r){Pe.call(this,[new M,new M,new M,new M],!0),this._renderer.flagTextures=ht.FlagTextures.bind(this),this._renderer.bindTextures=ht.BindTextures.bind(this),this._renderer.unbindTextures=ht.UnbindTextures.bind(this),this.noStroke(),this.noFill(),Array.isArray(e)?this.textures=e.map(ht.GenerateTexture.bind(this)):this.textures=[ht.GenerateTexture(e)],this.origin=new w,this._update(),this.translation.set(t||0,i||0),this.frameRate="number"==typeof r?r:ht.DefaultFrameRate,this.index=0}function lt(e,t,i,r,s,n,a){for(var o=a||3*F.Resolution,h=[],l=0;l<o;l++)h.push(new M);Pe.call(this,h,!0,!1,!0),"number"==typeof i&&(this.innerRadius=i),"number"==typeof r&&(this.outerRadius=r),"number"==typeof s&&(this.startAngle=s),"number"==typeof n&&(this.endAngle=n),this._update(),"number"==typeof e&&(this.translation.x=e),"number"==typeof t&&(this.translation.y=t)}y.extend(ht,{Properties:["frameRate","index"],DefaultFrameRate:30,FlagTextures:function(){this._flagTextures=!0},BindTextures:function(e){for(var t=e.length;t--;)e[t].bind(v.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()},UnbindTextures:function(e){for(var t=e.length;t--;)e[t].unbind(v.Types.change,this._renderer.flagTextures);this._renderer.flagTextures()},MakeObservable:function(e){Ie.MakeObservable(e),y.each(ht.Properties,ve,e),Object.defineProperty(e,"textures",{enumerable:!0,get:function(){return this._textures},set:function(e){var t=this._renderer.bindTextures,i=this._renderer.unbindTextures;this._textures&&this._textures.unbind(v.Types.insert,t).unbind(v.Types.remove,i),this._textures=new K((e||[]).slice(0)),this._textures.bind(v.Types.insert,t).bind(v.Types.remove,i),t(this._textures)}})},GenerateTexture:function(e){return e instanceof Re?e:"string"==typeof e?new Re(e):void 0}}),y.extend(ht.prototype,Ie.prototype,{constructor:ht,_flagTextures:!1,_flagFrameRate:!1,_flagIndex:!1,_amount:1,_duration:0,_index:0,_startTime:0,_playing:!1,_firstFrame:0,_lastFrame:0,_loop:!0,_textures:null,_frameRate:0,_origin:null,play:function(e,t,i){return this._playing=!0,this._firstFrame=0,this._lastFrame=this.amount-1,this._startTime=y.performance.now(),"number"==typeof e&&(this._firstFrame=e),"number"==typeof t&&(this._lastFrame=t),"function"==typeof i?this._onLastFrame=i:delete this._onLastFrame,this._index!==this._firstFrame&&(this._startTime-=1e3*Math.abs(this._index-this._firstFrame)/this._frameRate),this},pause:function(){return this._playing=!1,this},stop:function(){return this._playing=!1,this._index=this._firstFrame,this},clone:function(e){var t=new ht(this.textures,this.translation.x,this.translation.y,this.frameRate);return t._loop=this._loop,this._playing&&t.play(),e&&e.add(t),t},toObject:function(){var e=Ie.prototype.toObject.call(this);return e.textures=this.textures.map((function(e){return e.toObject()})),e.frameRate=this.frameRate,e.index=this.index,e._firstFrame=this._firstFrame,e._lastFrame=this._lastFrame,e._loop=this._loop,e},_update:function(){var e,t,i,r,s,n,a,o,h=this._textures;return this._flagTextures&&(this._amount=h.length),this._flagFrameRate&&(this._duration=1e3*this._amount/this._frameRate),this._playing&&this._frameRate>0?(r=this._amount,y.isNaN(this._lastFrame)&&(this._lastFrame=r-1),i=y.performance.now()-this._startTime,s=1e3*((o=this._lastFrame+1)-this._firstFrame)/this._frameRate,this._loop?i%=s:i=Math.min(i,s),a=l(this._firstFrame,o,i/s),(a=Math.floor(a))!==this._index&&(this._index=a,(n=h[this._index]).loaded&&(e=n.image.width,t=n.image.height,this.width!==e&&(this.width=e),this.height!==t&&(this.height=t),this.fill=n,a>=this._lastFrame-1&&this._onLastFrame&&this._onLastFrame()))):!this._flagIndex&&this.fill instanceof Re||((n=h[this._index]).loaded&&(e=n.image.width,t=n.image.height,this.width!==e&&(this.width=e),this.height!==t&&(this.height=t)),this.fill=n),Ie.prototype._update.call(this),this},flagReset:function(){return this._flagTextures=this._flagFrameRate=!1,Ie.prototype.flagReset.call(this),this}}),ht.MakeObservable(ht.prototype),y.extend(lt,{Properties:["startAngle","endAngle","innerRadius","outerRadius"],MakeObservable:function(e){Pe.MakeObservable(e),y.each(lt.Properties,ve,e)}}),y.extend(lt.prototype,Pe.prototype,{constructor:lt,_flagStartAngle:!1,_flagEndAngle:!1,_flagInnerRadius:!1,_flagOuterRadius:!1,_startAngle:0,_endAngle:s,_innerRadius:0,_outerRadius:0,_update:function(){if(this._flagVertices||this._flagStartAngle||this._flagEndAngle||this._flagInnerRadius||this._flagOuterRadius){var e,i=this._startAngle,r=this._endAngle,a=this._innerRadius,o=this._outerRadius,h=d(i,s)===d(r,s),l=a>0,c=this.vertices,f=l?c.length/2:c.length,_=0;h?f--:l||(f-=2);for(var u=0,g=f-1;u<f;u++){var p=u/g,m=c[_],y=p*(r-i)+i,v=(r-i)/f,b=o*Math.cos(y),x=o*Math.sin(y);switch(u){case 0:e=t.move;break;default:e=t.curve}if(m.command=e,m.x=b,m.y=x,m.controls.left.clear(),m.controls.right.clear(),m.command===t.curve){var k=o*v/Math.PI;m.controls.left.x=k*Math.cos(y-n),m.controls.left.y=k*Math.sin(y-n),m.controls.right.x=k*Math.cos(y+n),m.controls.right.y=k*Math.sin(y+n),1===u&&m.controls.left.multiplyScalar(2),u===g&&m.controls.right.multiplyScalar(2)}_++}if(l){for(h?(c[_].command=t.close,_++):g=--f-1,u=0;u<f;u++)p=u/g,m=c[_],y=(1-p)*(r-i)+i,v=(r-i)/f,b=a*Math.cos(y),x=a*Math.sin(y),e=t.curve,u<=0&&(e=h?t.move:t.line),m.command=e,m.x=b,m.y=x,m.controls.left.clear(),m.controls.right.clear(),m.command===t.curve&&(k=a*v/Math.PI,m.controls.left.x=k*Math.cos(y+n),m.controls.left.y=k*Math.sin(y+n),m.controls.right.x=k*Math.cos(y-n),m.controls.right.y=k*Math.sin(y-n),1===u&&m.controls.left.multiplyScalar(2),u===g&&m.controls.right.multiplyScalar(2)),_++;c[_].copy(c[0]),c[_].command=t.line}else h||(c[_].command=t.line,c[_].x=0,c[_].y=0,c[++_].copy(c[0]),c[_].command=t.line)}return Pe.prototype._update.call(this),this},flagReset:function(){return Pe.prototype.flagReset.call(this),this._flagStartAngle=this._flagEndAngle=this._flagInnerRadius=this._flagOuterRadius=!1,this},clone:function(e){var t=new lt(0,0,this.innerRadius,this.outerRadius,this.startAngle,this.endAngle,this.vertices.length);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),y.each(Pe.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e=Pe.prototype.toObject.call(this);return y.each(lt.Properties,(function(t){e[t]=this[t]}),this),e}}),lt.MakeObservable(lt.prototype);var ct=Math.ceil,ft=Math.floor;function dt(e){q.call(this),this._renderer.type="points",this._renderer.flagVertices=Pe.FlagVertices.bind(this),this._renderer.bindVertices=Pe.BindVertices.bind(this),this._renderer.unbindVertices=Pe.UnbindVertices.bind(this),this._renderer.flagFill=Pe.FlagFill.bind(this),this._renderer.flagStroke=Pe.FlagStroke.bind(this),this._renderer.vertices=null,this._renderer.collection=null,this.sizeAttenuation=!1,this.beginning=0,this.ending=1,this.fill="#fff",this.stroke="#000",this.className="",this.visible=!0,this.vertices=e,this.dashes=[],this.dashes.offset=0}y.extend(dt,{Properties:["fill","stroke","linewidth","opacity","visible","size","sizeAttenuation","beginning","ending"],MakeObservable:function(e){q.MakeObservable(e),y.each(dt.Properties.slice(2,7),ve,e),Object.defineProperty(e,"fill",{enumerable:!0,get:function(){return this._fill},set:function(e){(this._fill instanceof ke||this._fill instanceof we||this._fill instanceof Ae||this._fill instanceof Re)&&this._fill.unbind(v.Types.change,this._renderer.flagFill),this._fill=e,this._flagFill=!0,(this._fill instanceof ke||this._fill instanceof we||this._fill instanceof Ae||this._fill instanceof Re)&&this._fill.bind(v.Types.change,this._renderer.flagFill)}}),Object.defineProperty(e,"stroke",{enumerable:!0,get:function(){return this._stroke},set:function(e){(this._stroke instanceof ke||this._stroke instanceof we||this._stroke instanceof Ae||this._stroke instanceof Re)&&this._stroke.unbind(v.Types.change,this._renderer.flagStroke),this._stroke=e,this._flagStroke=!0,(this._stroke instanceof ke||this._stroke instanceof we||this._stroke instanceof Ae||this._stroke instanceof Re)&&this._stroke.bind(v.Types.change,this._renderer.flagStroke)}}),Object.defineProperty(e,"length",{get:function(){return this._flagLength&&this._updateLength(),this._length}}),Object.defineProperty(e,"beginning",{enumerable:!0,get:function(){return this._beginning},set:function(e){this._beginning=e,this._flagVertices=!0}}),Object.defineProperty(e,"ending",{enumerable:!0,get:function(){return this._ending},set:function(e){this._ending=e,this._flagVertices=!0}}),Object.defineProperty(e,"vertices",{enumerable:!0,get:function(){return this._collection},set:function(e){var t=this._renderer.bindVertices,i=this._renderer.unbindVertices;this._collection&&this._collection.unbind(v.Types.insert,t).unbind(v.Types.remove,i),this._collection=e instanceof K?e:new K(e||[]),this._collection.bind(v.Types.insert,t).bind(v.Types.remove,i),t(this._collection)}}),Object.defineProperty(e,"dashes",{enumerable:!0,get:function(){return this._dashes},set:function(e){"number"!=typeof e.offset&&(e.offset=this.dashes&&this._dashes.offset||0),this._dashes=e}})}}),y.extend(dt.prototype,q.prototype,{constructor:dt,_flagVertices:!0,_flagLength:!0,_flagFill:!0,_flagStroke:!0,_flagLinewidth:!0,_flagOpacity:!0,_flagVisible:!0,_flagSize:!0,_flagSizeAttenuation:!0,_length:0,_fill:"#fff",_stroke:"#000",_linewidth:1,_opacity:1,_visible:!0,_size:1,_sizeAttenuation:!1,_beginning:0,_ending:1,_dashes:null,clone:function(e){for(var t=new dt,i=0;i<this.vertices.length;i++)t.vertices.push(this.vertices[i].clone());for(var r=0;r<dt.Properties.length;r++){var s=dt.Properties[r];t[s]=this[s]}return t.className=this.className,t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),e&&e.add(t),t._update()},toObject:function(){var e={vertices:this.vertices.map((function(e){return e.toObject()}))};return y.each(dt.Properties,(function(t){e[t]=this[t]}),this),e.className=this.className,e.translation=this.translation.toObject(),e.rotation=this.rotation,e.scale=this.scale instanceof w?this.scale.toObject():this.scale,e.skewX=this.skewX,e.skewY=this.skewY,this.matrix.manual&&(e.matrix=this.matrix.toObject()),e},noFill:Pe.prototype.noFill,noStroke:Pe.prototype.noStroke,corner:Pe.prototype.corner,center:Pe.prototype.center,remove:Pe.prototype.remove,getBoundingClientRect:Pe.prototype.getBoundingClientRect,subdivide:function(e){this._update();for(var t=[],i=0;i<this.vertices.length;i++){var r=this.vertices[i],s=this.vertices[i-1];if(s){var n=r.x,a=r.y,o=s.x,h=s.y,l=C(n,a,n,a,o,h,o,h,e);t=t.concat(l)}}return this.vertices=t,this},_updateLength:Pe.prototype._updateLength,_update:function(){if(this._flagVertices){this._flagLength&&this._updateLength(void 0,!0);var e,t=Math.min(this._beginning,this._ending),i=Math.max(this._beginning,this._ending),r=Ce(this,t*this._length),s=Ce(this,i*this._length),n=ct(r),a=ft(s);this._renderer.vertices=new _(2*(a-n+1)),this._renderer.collection=[];for(var o=n;o<=a;o++){var h=o-n;e=this._collection[o],this._renderer.collection.push(e),this._renderer.vertices[2*h+0]=e.x,this._renderer.vertices[2*h+1]=e.y}}return q.prototype._update.apply(this,arguments),this},flagReset:function(){return this._flagVertices=this._flagLength=this._flagFill=this._flagStroke=this._flagLinewidth=this._flagOpacity=this._flagVisible=this._flagSize=this._flagSizeAttenuation=!1,q.prototype.flagReset.call(this),this}}),dt.MakeObservable(dt.prototype);var _t=Math.cos,ut=Math.sin;function gt(e,t,i,r){r=Math.max(r||0,3),Pe.call(this),this.closed=!0,this.automatic=!1,"number"==typeof i&&(this.width=2*i),"number"==typeof i&&(this.height=2*i),"number"==typeof r&&(this.sides=r),this._update(),"number"==typeof e&&(this.translation.x=e),"number"==typeof t&&(this.translation.y=t)}y.extend(gt,{Properties:["width","height","sides"],MakeObservable:function(e){Pe.MakeObservable(e),y.each(gt.Properties,ve,e)}}),y.extend(gt.prototype,Pe.prototype,{constructor:gt,_flagWidth:!1,_flagHeight:!1,_flagSides:!1,_width:0,_height:0,_sides:0,_update:function(){if(this._flagVertices||this._flagWidth||this._flagHeight||this._flagSides){var e=this._sides,i=e+1,r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(var n=0;n<i;n++){var a=s*((n+.5)/e)+Math.PI/2,o=this._width*_t(a)/2,h=this._height*ut(a)/2;n>=r?this.vertices.push(new M(o,h)):this.vertices[n].set(o,h),this.vertices[n].command=0===n?t.move:t.line}}return Pe.prototype._update.call(this),this},flagReset:function(){return this._flagWidth=this._flagHeight=this._flagSides=!1,Pe.prototype.flagReset.call(this),this},clone:function(e){var t=new gt(0,0,this.radius,this.sides);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),y.each(Pe.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e=Pe.prototype.toObject.call(this);return y.each(gt.Properties,(function(t){e[t]=this[t]}),this),e}}),gt.MakeObservable(gt.prototype);var pt=Math.cos,mt=Math.sin;function yt(e,t,i,r,s){arguments.length<=3&&(i=(r=i)/2),("number"!=typeof s||s<=0)&&(s=5),Pe.call(this),this.closed=!0,this.automatic=!1,"number"==typeof i&&(this.innerRadius=i),"number"==typeof r&&(this.outerRadius=r),"number"==typeof s&&(this.sides=s),this._update(),"number"==typeof e&&(this.translation.x=e),"number"==typeof t&&(this.translation.y=t)}y.extend(yt,{Properties:["innerRadius","outerRadius","sides"],MakeObservable:function(e){Pe.MakeObservable(e),y.each(yt.Properties,ve,e)}}),y.extend(yt.prototype,Pe.prototype,{constructor:yt,_flagInnerRadius:!1,_flagOuterRadius:!1,_flagSides:!1,_innerRadius:0,_outerRadius:0,_sides:0,_update:function(){if(this._flagVertices||this._flagInnerRadius||this._flagOuterRadius||this._flagSides){var e=2*this._sides,i=e+1,r=this.vertices.length;r>e&&(this.vertices.splice(e-1,r-e),r=e);for(var n=0;n<i;n++){var a=s*((n+.5)/e),o=(n%2?this._outerRadius:this._innerRadius)/2,h=o*pt(a),l=o*mt(a);n>=r?this.vertices.push(new M(h,l)):this.vertices[n].set(h,l),this.vertices[n].command=0===n?t.move:t.line}}return Pe.prototype._update.call(this),this},flagReset:function(){return this._flagInnerRadius=this._flagOuterRadius=this._flagSides=!1,Pe.prototype.flagReset.call(this),this},clone:function(e){var t=new yt(0,0,this.innerRadius,this.outerRadius,this.sides);return t.translation.copy(this.translation),t.rotation=this.rotation,t.scale=this.scale,t.skewX=this.skewX,t.skewY=this.skewY,this.matrix.manual&&t.matrix.copy(this.matrix),y.each(Pe.Properties,(function(e){t[e]=this[e]}),this),e&&e.add(t),t},toObject:function(){var e=Pe.prototype.toObject.call(this);return y.each(yt.Properties,(function(t){e[t]=this[t]}),this),e}}),yt.MakeObservable(yt.prototype);var vt=new G,bt={version:1.1,ns:"http://www.w3.org/2000/svg",xlink:"http://www.w3.org/1999/xlink",alignments:{left:"start",center:"middle",right:"end"},createElement:function(e,t){var i=e,r=document.createElementNS(bt.ns,i);return"svg"===i&&(t=y.defaults(t||{},{version:bt.version})),t&&Object.keys(t).length>0&&bt.setAttributes(r,t),r},setAttributes:function(e,t){for(var i=Object.keys(t),r=0;r<i.length;r++)/href/.test(i[r])?e.setAttributeNS(bt.xlink,i[r],t[i[r]]):e.setAttribute(i[r],t[i[r]]);return this},removeAttributes:function(e,t){for(var i in t)e.removeAttribute(i);return this},toString:function(e,i){for(var r,s=e.length,n=s-1,a="",o=0;o<s;o++){var h,l,c,f,_,u,p,m,y,v,b,x,k,A,S=e[o],R=i?d(o-1,s):Math.max(o-1,0),M=i?d(o+1,s):Math.min(o+1,n),T=e[R],O=e[M],F=g(S.x),P=g(S.y);switch(S.command){case t.close:h=t.close;break;case t.arc:v=S.rx,b=S.ry,x=S.xAxisRotation,k=S.largeArcFlag,A=S.sweepFlag,h=t.arc+" "+v+" "+b+" "+x+" "+k+" "+A+" "+F+" "+P;break;case t.curve:u=T.controls&&T.controls.right||w.zero,p=S.controls&&S.controls.left||w.zero,T.relative?(l=g(u.x+T.x),c=g(u.y+T.y)):(l=g(u.x),c=g(u.y)),S.relative?(f=g(p.x+S.x),_=g(p.y+S.y)):(f=g(p.x),_=g(p.y)),h=(0===o?t.move:t.curve)+" "+l+" "+c+" "+f+" "+_+" "+F+" "+P;break;case t.move:r=S,h=t.move+" "+F+" "+P;break;default:h=S.command+" "+F+" "+P}o>=n&&i&&(S.command===t.curve&&(O=r,m=S.controls&&S.controls.right||S,y=O.controls&&O.controls.left||O,S.relative?(l=g(m.x+S.x),c=g(m.y+S.y)):(l=g(m.x),c=g(m.y)),O.relative?(f=g(y.x+O.x),_=g(y.y+O.y)):(f=g(y.x),_=g(y.y)),h+=" C "+l+" "+c+" "+f+" "+_+" "+(F=g(O.x))+" "+(P=g(O.y))),S.command!==t.close&&(h+=" Z")),a+=h+" "}return a},pointsToString:function(e,i){for(var r="",s=.5*i,n=0;n<e.length;n++){var a=e[n].x,o=e[n].y;r+=t.move+" "+a+" "+o+" ",r+="a "+s+" "+s+" 0 1 0 0.01 0 Z"}return r},getClip:function(e,t){var i=e._renderer.clip;return i||(i=e._renderer.clip=bt.createElement("clipPath",{"clip-rule":"nonzero"}),t.defs.appendChild(i)),i},group:{appendChild:function(e){var t=e._renderer.elem;if(t){var i=t.nodeName;!i||/(radial|linear)gradient/i.test(i)||e._clip||this.elem.appendChild(t)}},removeChild:function(e){var t=e._renderer.elem;t&&t.parentNode==this.elem&&(t.nodeName&&(e._clip||this.elem.removeChild(t)))},orderChild:function(e){this.elem.appendChild(e._renderer.elem)},renderChild:function(e){bt[e._renderer.type].render.call(e,this)},render:function(e){if(!this._visible&&!this._flagVisible||0===this._opacity&&!this._flagOpacity)return this;this._update(),this._renderer.elem||(this._renderer.elem=bt.createElement("g",{id:this.id}),e.appendChild(this._renderer.elem));var t=this._matrix.manual||this._flagMatrix,i={domElement:e,elem:this._renderer.elem};t&&this._renderer.elem.setAttribute("transform","matrix("+this._matrix.toString()+")");for(var r=0;r<this.children.length;r++){var s=this.children[r];bt[s._renderer.type].render.call(s,e)}return this._flagId&&this._renderer.elem.setAttribute("id",this._id),this._flagOpacity&&this._renderer.elem.setAttribute("opacity",this._opacity),this._flagVisible&&this._renderer.elem.setAttribute("display",this._visible?"inline":"none"),this._flagClassName&&this._renderer.elem.setAttribute("class",this.classList.join(" ")),this._flagAdditions&&this.additions.forEach(bt.group.appendChild,i),this._flagSubtractions&&this.subtractions.forEach(bt.group.removeChild,i),this._flagOrder&&this.children.forEach(bt.group.orderChild,i),this._flagMask&&(this._mask?(bt[this._mask._renderer.type].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this.flagReset()}},path:{render:function(e){if(0===this._opacity&&!this._flagOpacity)return this;this._update();var t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices){var i=bt.toString(this._renderer.vertices,this._closed);t.d=i}if(this._fill&&this._fill._renderer&&(this._fill._update(),bt[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),bt[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this._flagCap&&(t["stroke-linecap"]=this._cap),this._flagJoin&&(t["stroke-linejoin"]=this._join),this._flagMiter&&(t["stroke-miterlimit"]=this._miter),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?bt.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=bt.createElement("path",t),e.appendChild(this._renderer.elem)),this._flagClip){var r=bt.getClip(this,e),s=this._renderer.elem;this._clip?(s.removeAttribute("id"),r.setAttribute("id",this.id),r.appendChild(s)):(r.removeAttribute("id"),s.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(s))}return this._flagMask&&(this._mask?(bt[this._mask._renderer.type].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this.flagReset()}},points:{render:function(e){if(0===this._opacity&&!this._flagOpacity)return this;this._update();var t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagVertices||this._flagSize||this._flagSizeAttenuation){var i=this._size;if(!this._sizeAttenuation){h(this,vt);var r=vt.elements,s=a(r[0],r[3],r[1],r[4],r[2],r[5]);i/=Math.max(s.scaleX,s.scaleY)}var n=bt.pointsToString(this._renderer.collection,i);t.d=n}return this._fill&&this._fill._renderer&&(this._fill._update(),bt[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),bt[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t["stroke-opacity"]=this._opacity,t["fill-opacity"]=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?bt.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=bt.createElement("path",t),e.appendChild(this._renderer.elem)),this.flagReset()}},text:{render:function(e){this._update();var t={};if((this._matrix.manual||this._flagMatrix)&&(t.transform="matrix("+this._matrix.toString()+")"),this._flagId&&(t.id=this._id),this._flagFamily&&(t["font-family"]=this._family),this._flagSize&&(t["font-size"]=this._size),this._flagLeading&&(t["line-height"]=this._leading),this._flagAlignment&&(t["text-anchor"]=bt.alignments[this._alignment]||this._alignment),this._flagBaseline&&(t["alignment-baseline"]=t["dominant-baseline"]=this._baseline),this._flagStyle&&(t["font-style"]=this._style),this._flagWeight&&(t["font-weight"]=this._weight),this._flagDecoration&&(t["text-decoration"]=this._decoration),this._fill&&this._fill._renderer&&(this._fill._update(),bt[this._fill._renderer.type].render.call(this._fill,e,!0)),this._flagFill&&(t.fill=this._fill&&this._fill.id?"url(#"+this._fill.id+")":this._fill),this._stroke&&this._stroke._renderer&&(this._stroke._update(),bt[this._stroke._renderer.type].render.call(this._stroke,e,!0)),this._flagStroke&&(t.stroke=this._stroke&&this._stroke.id?"url(#"+this._stroke.id+")":this._stroke),this._flagLinewidth&&(t["stroke-width"]=this._linewidth),this._flagOpacity&&(t.opacity=this._opacity),this._flagClassName&&(t.class=this.classList.join(" ")),this._flagVisible&&(t.visibility=this._visible?"visible":"hidden"),this.dashes&&this.dashes.length>0&&(t["stroke-dasharray"]=this.dashes.join(" "),t["stroke-dashoffset"]=this.dashes.offset||0),this._renderer.elem?bt.setAttributes(this._renderer.elem,t):(t.id=this._id,this._renderer.elem=bt.createElement("text",t),e.defs.appendChild(this._renderer.elem)),this._flagClip){var i=bt.getClip(this,e),r=this._renderer.elem;this._clip?(r.removeAttribute("id"),i.setAttribute("id",this.id),i.appendChild(r)):(i.removeAttribute("id"),r.setAttribute("id",this.id),this.parent._renderer.elem.appendChild(r))}return this._flagMask&&(this._mask?(bt[this._mask._renderer.type].render.call(this._mask,e),this._renderer.elem.setAttribute("clip-path","url(#"+this._mask.id+")")):this._renderer.elem.removeAttribute("clip-path")),this._flagValue&&(this._renderer.elem.textContent=this._value),this.flagReset()}},"linear-gradient":{render:function(e,t){t||this._update();var i={};if(this._flagId&&(i.id=this._id),this._flagEndPoints&&(i.x1=this.left._x,i.y1=this.left._y,i.x2=this.right._x,i.y2=this.right._y),this._flagSpread&&(i.spreadMethod=this._spread),this._renderer.elem?bt.setAttributes(this._renderer.elem,i):(i.id=this._id,i.gradientUnits="userSpaceOnUse",this._renderer.elem=bt.createElement("linearGradient",i),e.defs.appendChild(this._renderer.elem)),this._flagStops){var r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(var s=0;s<this.stops.length;s++){var n=this.stops[s],a={};n._flagOffset&&(a.offset=100*n._offset+"%"),n._flagColor&&(a["stop-color"]=n._color),n._flagOpacity&&(a["stop-opacity"]=n._opacity),n._renderer.elem?bt.setAttributes(n._renderer.elem,a):n._renderer.elem=bt.createElement("stop",a),r&&this._renderer.elem.appendChild(n._renderer.elem),n.flagReset()}}return this.flagReset()}},"radial-gradient":{render:function(e,t){t||this._update();var i={};if(this._flagId&&(i.id=this._id),this._flagCenter&&(i.cx=this.center._x,i.cy=this.center._y),this._flagFocal&&(i.fx=this.focal._x,i.fy=this.focal._y),this._flagRadius&&(i.r=this._radius),this._flagSpread&&(i.spreadMethod=this._spread),this._renderer.elem?bt.setAttributes(this._renderer.elem,i):(i.id=this._id,i.gradientUnits="userSpaceOnUse",this._renderer.elem=bt.createElement("radialGradient",i),e.defs.appendChild(this._renderer.elem)),this._flagStops){var r=this._renderer.elem.childNodes.length!==this.stops.length;if(r)for(;this._renderer.elem.lastChild;)this._renderer.elem.removeChild(this._renderer.elem.lastChild);for(var s=0;s<this.stops.length;s++){var n=this.stops[s],a={};n._flagOffset&&(a.offset=100*n._offset+"%"),n._flagColor&&(a["stop-color"]=n._color),n._flagOpacity&&(a["stop-opacity"]=n._opacity),n._renderer.elem?bt.setAttributes(n._renderer.elem,a):n._renderer.elem=bt.createElement("stop",a),r&&this._renderer.elem.appendChild(n._renderer.elem),n.flagReset()}}return this.flagReset()}},texture:{render:function(e,t){t||this._update();var i={},r={x:0,y:0},s=this.image;if(this._flagId&&(i.id=this._id),this._flagLoaded&&this.loaded)switch(s.nodeName.toLowerCase()){case"canvas":r.href=r["xlink:href"]=s.toDataURL("image/png");break;case"img":case"image":r.href=r["xlink:href"]=this.src}if((this._flagOffset||this._flagLoaded||this._flagScale)&&(i.x=this._offset.x,i.y=this._offset.y,s&&(i.x-=s.width/2,i.y-=s.height/2,this._scale instanceof w?(i.x*=this._scale.x,i.y*=this._scale.y):(i.x*=this._scale,i.y*=this._scale)),i.x>0&&(i.x*=-1),i.y>0&&(i.y*=-1)),(this._flagScale||this._flagLoaded||this._flagRepeat)&&(i.width=0,i.height=0,s)){switch(r.width=i.width=s.width,r.height=i.height=s.height,this._repeat){case"no-repeat":i.width+=1,i.height+=1}this._scale instanceof w?(i.width*=this._scale.x,i.height*=this._scale.y):(i.width*=this._scale,i.height*=this._scale)}return(this._flagScale||this._flagLoaded)&&(this._renderer.image?bt.setAttributes(this._renderer.image,r):this._renderer.image=bt.createElement("image",r)),this._renderer.elem?0!==Object.keys(i).length&&bt.setAttributes(this._renderer.elem,i):(i.id=this._id,i.patternUnits="userSpaceOnUse",this._renderer.elem=bt.createElement("pattern",i),e.defs.appendChild(this._renderer.elem)),this._renderer.elem&&this._renderer.image&&!this._renderer.appended&&(this._renderer.elem.appendChild(this._renderer.image),this._renderer.appended=!0),this.flagReset()}}};function xt(e){this.domElement=e.domElement||bt.createElement("svg"),this.scene=new Q,this.scene.parent=this,this.defs=bt.createElement("defs"),this.domElement.appendChild(this.defs),this.domElement.defs=this.defs,this.domElement.style.overflow="hidden"}y.extend(xt,{Utils:bt}),y.extend(xt.prototype,v,{constructor:xt,setSize:function(e,t){return this.width=e,this.height=t,bt.setAttributes(this.domElement,{width:e,height:t}),this.trigger(v.Types.resize,e,t)},render:function(){return bt.group.render.call(this.scene,this.domElement),this}});var kt={create:function(e,t,i){var r,s;if(r=e.createShader(e[i]),e.shaderSource(r,t),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw s=e.getShaderInfoLog(r),e.deleteShader(r),new me("unable to compile shader "+r+": "+s);return r},types:{vertex:"VERTEX_SHADER",fragment:"FRAGMENT_SHADER"},path:{vertex:"\n precision mediump float;\n attribute vec2 a_position;\n\n uniform mat3 u_matrix;\n uniform vec2 u_resolution;\n uniform vec4 u_rect;\n\n varying vec2 v_textureCoords;\n\n void main() {\n vec2 rectCoords = (a_position * (u_rect.zw - u_rect.xy)) + u_rect.xy;\n vec2 projected = (u_matrix * vec3(rectCoords, 1.0)).xy;\n vec2 normal = projected / u_resolution;\n vec2 clipspace = (normal * 2.0) - 1.0;\n\n gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0);\n v_textureCoords = a_position;\n }\n ",fragment:"\n precision mediump float;\n\n uniform sampler2D u_image;\n varying vec2 v_textureCoords;\n\n void main() {\n vec4 texel = texture2D(u_image, v_textureCoords);\n if (texel.a == 0.0) {\n discard;\n }\n gl_FragColor = texel;\n }\n "},points:{vertex:"\n precision mediump float;\n attribute vec2 a_position;\n\n uniform float u_size;\n uniform mat3 u_matrix;\n uniform vec2 u_resolution;\n\n varying vec2 v_textureCoords;\n\n void main() {\n vec2 projected = (u_matrix * vec3(a_position, 1.0)).xy;\n vec2 normal = projected / u_resolution;\n vec2 clipspace = (normal * 2.0) - 1.0;\n\n gl_PointSize = u_size;\n gl_Position = vec4(clipspace * vec2(1.0, -1.0), 0.0, 1.0);\n v_textureCoords = a_position;\n }\n ",fragment:"\n precision mediump float;\n\n uniform sampler2D u_image;\n\n void main() {\n vec4 texel = texture2D(u_image, gl_PointCoord);\n if (texel.a == 0.0) {\n discard;\n }\n gl_FragColor = texel;\n }\n "}},wt=G.Multiply,At=[1,0,0,0,1,0,0,0,1],St=new _(9),Rt=de.Utils,Mt=new _([0,0,1,0,0,1,0,1,1,0,1,1]),Tt={precision:.9,isHidden:/(undefined|none|transparent)/i,canvas:r.document?r.document.createElement("canvas"):{getContext:function(){}},alignments:{left:"start",middle:"center",right:"end"},matrix:new G,group:{removeChild:function(e,t){if(e.children)for(var i=0;i<e.children.length;i++)Tt.group.removeChild(e.children[i],t);e._renderer.texture&&(t.deleteTexture(e._renderer.texture),delete e._renderer.texture),e._renderer.positionBuffer&&(t.deleteBuffer(e._renderer.positionBuffer),delete e._renderer.positionBuffer)},render:function(e,t){if(this._visible){this._update();var i,r=this.parent,s=r._matrix&&r._matrix.manual||r._flagMatrix,n=this._matrix.manual||this._flagMatrix;if((s||n)&&(this._renderer.matrix||(this._renderer.matrix=new _(9)),this._matrix.toTransformArray(!0,St),wt(St,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?(this._renderer.scale.x=this._scale.x,this._renderer.scale.y=this._scale.y):(this._renderer.scale.x=this._scale,this._renderer.scale.y=this._scale),/renderer/i.test(r._renderer.type)||(this._renderer.scale.x*=r._renderer.scale.x,this._renderer.scale.y*=r._renderer.scale.y),s&&(this._flagMatrix=!0)),this._mask&&(e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1),Tt[this._mask._renderer.type].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)),this._flagOpacity=r._flagOpacity||this._flagOpacity,this._renderer.opacity=this._opacity*(r&&r._renderer?r._renderer.opacity:1),this._flagSubtractions)for(i=0;i<this.subtractions.length;i++)Tt.group.removeChild(this.subtractions[i],e);for(i=0;i<this.children.length;i++){var a=this.children[i];Tt[a._renderer.type].render.call(a,e,t)}return this._mask&&e.disable(e.STENCIL_TEST),this.flagReset()}}},path:{updateCanvas:function(e){var i,r,s,n,a,o,h,l,c,f,_,u,g,p,m,y=e._renderer.vertices,v=this.canvas,b=this.ctx,x=e._renderer.scale,k=e._stroke,A=e._linewidth,S=e._fill,R=e._renderer.opacity||e._opacity,M=e._cap,T=e._join,O=e._miter,F=e._closed,P=e.dashes,E=y.length,C=E-1;v.width=Math.max(Math.ceil(e._renderer.rect.width*x.x),1),v.height=Math.max(Math.ceil(e._renderer.rect.height*x.y),1);var L,j=e._renderer.rect.centroid,I=j.x,N=j.y;b.clearRect(0,0,v.width,v.height),S&&("string"==typeof S?b.fillStyle=S:(Tt[S._renderer.type].render.call(S,b,e),b.fillStyle=S._renderer.effect)),k&&("string"==typeof k?b.strokeStyle=k:(Tt[k._renderer.type].render.call(k,b,e),b.strokeStyle=k._renderer.effect),A&&(b.lineWidth=A),O&&(b.miterLimit=O),T&&(b.lineJoin=T),!F&&M&&(b.lineCap=M)),"number"==typeof R&&(b.globalAlpha=R),P&&P.length>0&&(b.lineDashOffset=P.offset||0,b.setLineDash(P)),b.save(),b.scale(x.x,x.y),b.translate(I,N),b.beginPath();for(var B=0;B<y.length;B++){var V=y[B];switch(g=V.x,p=V.y,V.command){case t.close:b.closePath();break;case t.arc:var z=V.rx,U=V.ry,D=V.xAxisRotation,X=V.largeArcFlag,Y=V.sweepFlag,H=(s=y[r=F?d(B-1,E):Math.max(B-1,0)]).x,W=s.y;Rt.renderSvgArcCommand(b,H,W,z,U,X,Y,D,g,p);break;case t.curve:r=F?d(B-1,E):Math.max(B-1,0),i=F?d(B+1,E):Math.min(B+1,C),s=y[r],n=y[i],c=s.controls&&s.controls.right||w.zero,f=V.controls&&V.controls.left||w.zero,s._relative?(h=c.x+s.x,l=c.y+s.y):(h=c.x,l=c.y),V._relative?(a=f.x+V.x,o=f.y+V.y):(a=f.x,o=f.y),b.bezierCurveTo(h,l,a,o,g,p),B>=C&&F&&(n=L,_=V.controls&&V.controls.right||w.zero,u=n.controls&&n.controls.left||w.zero,V._relative?(h=_.x+V.x,l=_.y+V.y):(h=_.x,l=_.y),n._relative?(a=u.x+n.x,o=u.y+n.y):(a=u.x,o=u.y),g=n.x,p=n.y,b.bezierCurveTo(h,l,a,o,g,p));break;case t.line:b.lineTo(g,p);break;case t.move:L=V,b.moveTo(g,p)}}F&&b.closePath(),Tt.isHidden.test(S)||((m=S._renderer&&S._renderer.offset)&&(b.save(),b.translate(-S._renderer.offset.x,-S._renderer.offset.y),b.scale(S._renderer.scale.x,S._renderer.scale.y)),b.fill(),m&&b.restore()),Tt.isHidden.test(k)||((m=k._renderer&&k._renderer.offset)&&(b.save(),b.translate(-k._renderer.offset.x,-k._renderer.offset.y),b.scale(k._renderer.scale.x,k._renderer.scale.y),b.lineWidth=A/k._renderer.scale.x),b.stroke(),m&&b.restore()),b.restore()},getBoundingClientRect:function(e,t,i){var r,s,n=1/0,a=-1/0,o=1/0,h=-1/0;e.forEach((function(e){var t,i,r,s,l,c,f=e.x,d=e.y,_=e.controls;o=Math.min(d,o),n=Math.min(f,n),a=Math.max(f,a),h=Math.max(d,h),e.controls&&(l=_.left,c=_.right,l&&c&&(t=e._relative?l.x+f:l.x,i=e._relative?l.y+d:l.y,r=e._relative?c.x+f:c.x,s=e._relative?c.y+d:c.y,t&&i&&r&&s&&(o=Math.min(i,s,o),n=Math.min(t,r,n),a=Math.max(t,r,a),h=Math.max(i,s,h))))})),"number"==typeof t&&(o-=t,n-=t,a+=t,h+=t),r=a-n,s=h-o,i.top=o,i.left=n,i.right=a,i.bottom=h,i.width=r,i.height=s,i.centroid||(i.centroid={}),i.centroid.x=-n,i.centroid.y=-o},render:function(e,t,i){if(!this._visible||!this._opacity)return this;this._update();var r=i||this.parent,s=t[this._renderer.type],n=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,o=this._renderer.parent!==r,h=this._flagVertices||this._flagFill||this._fill instanceof we&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ae&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Re&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof we&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ae&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Re&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagCap||this._flagJoin||this._flagMiter||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if((n||a||o)&&(this._renderer.matrix||(this._renderer.matrix=new _(9)),this._matrix.toTransformArray(!0,St),wt(St,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?(this._renderer.scale.x=this._scale.x*r._renderer.scale.x,this._renderer.scale.y=this._scale.y*r._renderer.scale.y):(this._renderer.scale.x=this._scale*r._renderer.scale.x,this._renderer.scale.y=this._scale*r._renderer.scale.y),o&&(this._renderer.parent=r)),this._mask&&(e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1),Tt[this._mask._renderer.type].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Tt.path.getBoundingClientRect(this._renderer.vertices,this._linewidth,this._renderer.rect),Tt.updateTexture.call(Tt,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;t.current!==s&&(e.useProgram(s),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(s.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s.position),e.bufferData(e.ARRAY_BUFFER,Mt,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),t.current=s),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);var l=this._renderer.rect;return e.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),e.uniform4f(s.rect,l.left,l.top,l.right,l.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),this.flagReset()}},points:{updateCanvas:function(e){var t,i=this.canvas,r=this.ctx,n=e._stroke,a=e._linewidth,o=e._fill,h=e._renderer.opacity||e._opacity,l=e.dashes,c=e._size,d=c;Tt.isHidden.test(n)||(d+=a),i.width=f(d),i.height=i.width;var _=d/i.width,u=i.width/2,g=i.height/2;r.clearRect(0,0,i.width,i.height),o&&("string"==typeof o?r.fillStyle=o:(Tt[o._renderer.type].render.call(o,r,e),r.fillStyle=o._renderer.effect)),n&&("string"==typeof n?r.strokeStyle=n:(Tt[n._renderer.type].render.call(n,r,e),r.strokeStyle=n._renderer.effect),a&&(r.lineWidth=a/_)),"number"==typeof h&&(r.globalAlpha=h),l&&l.length>0&&(r.lineDashOffset=l.offset||0,r.setLineDash(l)),r.save(),r.translate(u,g),r.scale(Tt.precision,Tt.precision),r.beginPath(),r.arc(0,0,c/_*.5,0,s),r.restore(),closed&&r.closePath(),Tt.isHidden.test(o)||((t=o._renderer&&o._renderer.offset)&&(r.save(),r.translate(-o._renderer.offset.x,-o._renderer.offset.y),r.scale(o._renderer.scale.x,o._renderer.scale.y)),r.fill(),t&&r.restore()),Tt.isHidden.test(n)||((t=n._renderer&&n._renderer.offset)&&(r.save(),r.translate(-n._renderer.offset.x,-n._renderer.offset.y),r.scale(n._renderer.scale.x,n._renderer.scale.y),r.lineWidth=a/n._renderer.scale.x),r.stroke(),t&&r.restore())},render:function(e,t,i){if(!this._visible||!this._opacity)return this;this._update();var r=i||this.parent,s=t[this._renderer.type],n=this._size,a=this._sizeAttenuation,o=this._stroke,h=this._linewidth,l=r._matrix.manual||r._flagMatrix,c=this._matrix.manual||this._flagMatrix,f=this._renderer.parent!==r,d=this._renderer.vertices,u=this._renderer.collection.length,g=this._flagVertices,p=this._flagFill||this._fill instanceof we&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ae&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Re&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof we&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ae&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Re&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this.dashes&&this.dashes.length>0||!this._renderer.texture;if((l||c||f)&&(this._renderer.matrix||(this._renderer.matrix=new _(9)),this._matrix.toTransformArray(!0,St),wt(St,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?(this._renderer.scale.x=this._scale.x*r._renderer.scale.x,this._renderer.scale.y=this._scale.y*r._renderer.scale.y):(this._renderer.scale.x=this._scale*r._renderer.scale.x,this._renderer.scale.y=this._scale*r._renderer.scale.y),f&&(this._renderer.parent=r)),g){var m=this._renderer.positionBuffer;m&&e.deleteBuffer(m),this._renderer.positionBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,this._renderer.positionBuffer),e.vertexAttribPointer(s.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s.position),e.bufferData(e.ARRAY_BUFFER,d,e.STATIC_DRAW)}return p?(this._renderer.opacity=this._opacity*r._renderer.opacity,Tt.updateTexture.call(Tt,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture?this:(Tt.isHidden.test(o)||(n+=h),n/=Tt.precision,a&&(n*=Math.max(this._renderer.scale.x,this._renderer.scale.y)),t.current!==s&&(e.useProgram(s),t.resolution.flagged||e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),t.current=s),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture),e.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),e.uniform1f(s.size,n*t.resolution.ratio),e.drawArrays(e.POINTS,0,u),this.flagReset())}},text:{updateCanvas:function(e){var t=this.canvas,i=this.ctx,r=e._renderer.scale,s=e._stroke,n=e._linewidth*r,a=e._fill,o=e._renderer.opacity||e._opacity,h=e.dashes,l=e._decoration;t.width=Math.max(Math.ceil(e._renderer.rect.width*r.x),1),t.height=Math.max(Math.ceil(e._renderer.rect.height*r.y),1);var c,f,d,_,u,g,p,m,y,v,b,x=e._renderer.rect.centroid,k=x.x,w=x.y,A=a._renderer&&a._renderer.offset&&s._renderer&&s._renderer.offset;if(i.clearRect(0,0,t.width,t.height),A||(i.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" ")),i.textAlign="center",i.textBaseline="middle",a&&("string"==typeof a?i.fillStyle=a:(Tt[a._renderer.type].render.call(a,i,e),i.fillStyle=a._renderer.effect)),s&&("string"==typeof s?i.strokeStyle=s:(Tt[s._renderer.type].render.call(s,i,e),i.strokeStyle=s._renderer.effect),n&&(i.lineWidth=n)),"number"==typeof o&&(i.globalAlpha=o),h&&h.length>0&&(i.lineDashOffset=h.offset||0,i.setLineDash(h)),i.save(),i.scale(r.x,r.y),i.translate(k,w),Tt.isHidden.test(a)||(a._renderer&&a._renderer.offset?(g=a._renderer.scale.x,p=a._renderer.scale.y,i.save(),i.translate(-a._renderer.offset.x,-a._renderer.offset.y),i.scale(g,p),c=e._size/a._renderer.scale.y,f=e._leading/a._renderer.scale.y,i.font=[e._style,e._weight,c+"px/",f+"px",e._family].join(" "),d=a._renderer.offset.x/a._renderer.scale.x,_=a._renderer.offset.y/a._renderer.scale.y,i.fillText(e.value,d,_),i.restore()):i.fillText(e.value,0,0)),Tt.isHidden.test(s)||(s._renderer&&s._renderer.offset?(g=s._renderer.scale.x,p=s._renderer.scale.y,i.save(),i.translate(-s._renderer.offset.x,-s._renderer.offset.y),i.scale(g,p),c=e._size/s._renderer.scale.y,f=e._leading/s._renderer.scale.y,i.font=[e._style,e._weight,c+"px/",f+"px",e._family].join(" "),d=s._renderer.offset.x/s._renderer.scale.x,_=s._renderer.offset.y/s._renderer.scale.y,u=n/s._renderer.scale.x,i.lineWidth=u,i.strokeText(e.value,d,_),i.restore()):i.strokeText(e.value,0,0)),/(underline|strikethrough)/i.test(l)){var S=i.measureText(e.value);switch(l){case"underline":y=S.actualBoundingBoxAscent,b=S.actualBoundingBoxAscent;break;case"strikethrough":y=0,b=0}m=-S.width/2,v=S.width/2,i.lineWidth=Math.max(Math.floor(e._size/15),1),i.strokeStyle=i.fillStyle,i.beginPath(),i.moveTo(m,y),i.lineTo(v,b),i.stroke()}i.restore()},getBoundingClientRect:function(e,t){var i=Tt.ctx;i.font=[e._style,e._weight,e._size+"px/"+e._leading+"px",e._family].join(" "),i.textAlign="center",i.textBaseline=e._baseline;var r=1.25*i.measureText(e._value).width,s=1.25*Math.max(e._size,e._leading);this._linewidth&&!Tt.isHidden.test(this._stroke)&&(r+=2*this._linewidth,s+=2*this._linewidth);var n=r/2,a=s/2;switch(Tt.alignments[e._alignment]||e._alignment){case Tt.alignments.left:t.left=0,t.right=r;break;case Tt.alignments.right:t.left=-r,t.right=0;break;default:t.left=-n,t.right=n}switch(e._baseline){case"bottom":t.top=-s,t.bottom=0;break;case"top":t.top=0,t.bottom=s;break;default:t.top=-a,t.bottom=a}t.width=r,t.height=s,t.centroid||(t.centroid={}),t.centroid.x=n,t.centroid.y=a},render:function(e,t,i){if(!this._visible||!this._opacity)return this;this._update();var r=i||this.parent,s=t[this._renderer.type],n=r._matrix.manual||r._flagMatrix,a=this._matrix.manual||this._flagMatrix,o=this._renderer.parent!==r,h=this._flagVertices||this._flagFill||this._fill instanceof we&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagEndPoints)||this._fill instanceof Ae&&(this._fill._flagSpread||this._fill._flagStops||this._fill._flagRadius||this._fill._flagCenter||this._fill._flagFocal)||this._fill instanceof Re&&(this._fill._flagLoaded&&this._fill.loaded||this._fill._flagImage||this._fill._flagVideo||this._fill._flagRepeat||this._fill._flagOffset||this._fill._flagScale)||this._stroke instanceof we&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagEndPoints)||this._stroke instanceof Ae&&(this._stroke._flagSpread||this._stroke._flagStops||this._stroke._flagRadius||this._stroke._flagCenter||this._stroke._flagFocal)||this._stroke instanceof Re&&(this._stroke._flagLoaded&&this._stroke.loaded||this._stroke._flagImage||this._stroke._flagVideo||this._stroke._flagRepeat||this._stroke._flagOffset||this._fill._flagScale)||this._flagStroke||this._flagLinewidth||this._flagOpacity||r._flagOpacity||this._flagVisible||this._flagScale||this._flagValue||this._flagFamily||this._flagSize||this._flagLeading||this._flagAlignment||this._flagBaseline||this._flagStyle||this._flagWeight||this._flagDecoration||this.dashes&&this.dashes.length>0||!this._renderer.texture;if((n||a||o)&&(this._renderer.matrix||(this._renderer.matrix=new _(9)),this._matrix.toTransformArray(!0,St),wt(St,r._renderer.matrix,this._renderer.matrix),this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?(this._renderer.scale.x=this._scale.x*r._renderer.scale.x,this._renderer.scale.y=this._scale.y*r._renderer.scale.y):(this._renderer.scale.x=this._scale*r._renderer.scale.x,this._renderer.scale.y=this._scale*r._renderer.scale.y),o&&(this._renderer.parent=r)),this._mask&&(e.clear(e.STENCIL_BUFFER_BIT),e.enable(e.STENCIL_TEST),e.stencilFunc(e.ALWAYS,1,0),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE),e.colorMask(!1,!1,!1,!1),Tt[this._mask._renderer.type].render.call(this._mask,e,t,this),e.stencilFunc(e.EQUAL,1,255),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.colorMask(!0,!0,!0,!0)),h?(this._renderer.rect||(this._renderer.rect={}),this._renderer.opacity=this._opacity*r._renderer.opacity,Tt.text.getBoundingClientRect(this,this._renderer.rect),Tt.updateTexture.call(Tt,e,this)):(this._fill&&this._fill._update&&this._fill._update(),this._stroke&&this._stroke._update&&this._stroke._update()),this._clip&&!i||!this._renderer.texture)return this;t.current!==s&&(e.useProgram(s),e.bindBuffer(e.ARRAY_BUFFER,t.buffers.position),e.vertexAttribPointer(s.position,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(s.position),e.bufferData(e.ARRAY_BUFFER,Mt,e.STATIC_DRAW),t.resolution.flagged||e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),t.current=s),t.resolution.flagged&&e.uniform2f(e.getUniformLocation(s,"u_resolution"),t.resolution.width,t.resolution.height),e.bindTexture(e.TEXTURE_2D,this._renderer.texture);var l=this._renderer.rect;return e.uniformMatrix3fv(s.matrix,!1,this._renderer.matrix),e.uniform4f(s.rect,l.left,l.top,l.right,l.bottom),e.drawArrays(e.TRIANGLES,0,6),this._mask&&e.disable(e.STENCIL_TEST),this.flagReset()}},"linear-gradient":{render:function(e,t){if(e.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagEndPoints||this._flagStops){this._renderer.effect=e.createLinearGradient(this.left._x,this.left._y,this.right._x,this.right._y);for(var i=0;i<this.stops.length;i++){var r=this.stops[i];this._renderer.effect.addColorStop(r._offset,r._color)}}return this.flagReset()}}},"radial-gradient":{render:function(e,t){if(e.canvas.getContext("2d")){if(this._update(),!this._renderer.effect||this._flagCenter||this._flagFocal||this._flagRadius||this._flagStops){this._renderer.effect=e.createRadialGradient(this.center._x,this.center._y,0,this.focal._x,this.focal._y,this._radius);for(var i=0;i<this.stops.length;i++){var r=this.stops[i];this._renderer.effect.addColorStop(r._offset,r._color)}}return this.flagReset()}}},texture:{render:function(e,t){if(e.canvas.getContext("2d")){this._update();var i=this.image;if((this._flagLoaded||this._flagImage||this._flagVideo||this._flagRepeat)&&this.loaded)this._renderer.effect=e.createPattern(i,this._repeat);else if(!this._renderer.effect)return this.flagReset();return(this._flagOffset||this._flagLoaded||this._flagScale)&&(this._renderer.offset instanceof w||(this._renderer.offset=new w),this._renderer.offset.x=-this._offset.x,this._renderer.offset.y=-this._offset.y,i&&(this._renderer.offset.x+=i.width/2,this._renderer.offset.y+=i.height/2,this._scale instanceof w?(this._renderer.offset.x*=this._scale.x,this._renderer.offset.y*=this._scale.y):(this._renderer.offset.x*=this._scale,this._renderer.offset.y*=this._scale))),(this._flagScale||this._flagLoaded)&&(this._renderer.scale instanceof w||(this._renderer.scale=new w),this._scale instanceof w?this._renderer.scale.copy(this._scale):this._renderer.scale.set(this._scale,this._scale)),this.flagReset()}}},updateTexture:function(e,t){if(this[t._renderer.type].updateCanvas.call(Tt,t),this.canvas.width<=0||this.canvas.height<=0)return t._renderer.texture&&e.deleteTexture(t._renderer.texture),void delete t._renderer.texture;t._renderer.texture||(t._renderer.texture=e.createTexture()),e.bindTexture(e.TEXTURE_2D,t._renderer.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,this.canvas)},program:{create:function(e,t){var i,r;if(i=e.createProgram(),y.each(t,(function(t){e.attachShader(i,t)})),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw r=e.getProgramInfoLog(i),e.deleteProgram(i),new me("unable to link program: "+r);return i}},TextureRegistry:new be};function Ot(e){var t,i,r,s;if(this.domElement=e.domElement||document.createElement("canvas"),void 0!==e.offscreenElement&&(Tt.canvas=e.offscreenElement,Tt.ctx=Tt.canvas.getContext("2d")),this.scene=new Q,this.scene.parent=this,this._renderer={type:"renderer",matrix:new _(At),scale:1,opacity:1},this._flagMatrix=!0,e=y.defaults(e||{},{antialias:!1,alpha:!0,premultipliedAlpha:!0,stencil:!0,preserveDrawingBuffer:!0,overdraw:!1}),this.overdraw=e.overdraw,t=this.ctx=this.domElement.getContext("webgl",e)||this.domElement.getContext("experimental-webgl",e),!this.ctx)throw new me("unable to create a webgl context. Try using another renderer.");r=kt.create(t,kt.path.vertex,kt.types.vertex),s=kt.create(t,kt.path.fragment,kt.types.fragment),this.programs={current:null,buffers:{position:t.createBuffer()},resolution:{width:0,height:0,ratio:1,flagged:!1}},i=this.programs.path=Tt.program.create(t,[r,s]),this.programs.text=this.programs.path,i.position=t.getAttribLocation(i,"a_position"),i.matrix=t.getUniformLocation(i,"u_matrix"),i.rect=t.getUniformLocation(i,"u_rect");var n=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,n),t.vertexAttribPointer(i.position,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(i.position),t.bufferData(t.ARRAY_BUFFER,Mt,t.STATIC_DRAW),r=kt.create(t,kt.points.vertex,kt.types.vertex),s=kt.create(t,kt.points.fragment,kt.types.fragment),(i=this.programs.points=Tt.program.create(t,[r,s])).position=t.getAttribLocation(i,"a_position"),i.matrix=t.getUniformLocation(i,"u_matrix"),i.size=t.getUniformLocation(i,"u_size"),t.enable(t.BLEND),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA)}function Ft(e){var t=y.defaults(e||{},{fullscreen:!1,fitted:!1,width:640,height:480,type:Ft.Types.svg,autostart:!1});if(y.each(t,(function(e,t){/fullscreen/i.test(t)||/autostart/i.test(t)||(this[t]=e)}),this),y.isElement(t.domElement)){var i=t.domElement.tagName.toLowerCase();/^(CanvasRenderer-canvas|WebGLRenderer-canvas|SVGRenderer-svg)$/.test(this.type+"-"+i)||(this.type=Ft.Types[i])}this.renderer=new Ft[this.type](this),this.setPlaying(t.autostart),this.frameCount=0,t.fullscreen?(this.fit=Pt.bind(this),this.fit.domElement=window,this.fit.attached=!0,y.extend(document.body.style,{overflow:"hidden",margin:0,padding:0,top:0,left:0,right:0,bottom:0,position:"fixed"}),y.extend(this.renderer.domElement.style,{display:"block",top:0,left:0,right:0,bottom:0,position:"fixed"}),ge.bind(this.fit.domElement,"resize",this.fit),this.fit()):t.fitted?(this.fit=Et.bind(this),y.extend(this.renderer.domElement.style,{display:"block"})):y.isElement(t.domElement)||(this.renderer.setSize(t.width,t.height,this.ratio),this.width=t.width,this.height=t.height),this.renderer.bind(v.Types.resize,Ct.bind(this)),this.scene=this.renderer.scene,Ft.Instances.push(this),t.autostart&&Lt.init()}function Pt(){var e=document.body.getBoundingClientRect(),t=this.width=e.width,i=this.height=e.height;this.renderer.setSize(t,i,this.ratio)}function Et(){var e=this.renderer.domElement.parentElement;if(e){var t=e.getBoundingClientRect(),i=this.width=t.width,r=this.height=t.height;this.renderer.setSize(i,r,this.ratio)}else console.warn("Two.js: Attempting to fit to parent, but no parent found.")}function Ct(e,t){this.width=e,this.height=t,this.trigger(v.Types.resize,e,t)}Tt.ctx=Tt.canvas.getContext("2d"),y.extend(Ot,{Utils:Tt}),y.extend(Ot.prototype,v,{constructor:Ot,setSize:function(e,t,i){var r,s,n=this.ctx;return this.width=e,this.height=t,this.ratio=void 0===i?D(n):i,this.domElement.width=e*this.ratio,this.domElement.height=t*this.ratio,y.isObject(this.domElement.style)&&y.extend(this.domElement.style,{width:e+"px",height:t+"px"}),this._renderer.matrix[0]=this._renderer.matrix[4]=this._renderer.scale=this.ratio,this._flagMatrix=!0,r=e*this.ratio,s=t*this.ratio,n.viewport(0,0,r,s),this.programs.resolution.width=r,this.programs.resolution.height=s,this.programs.resolution.ratio=this.ratio,this.programs.resolution.flagged=!0,this.trigger(v.Types.resize,e,t,i)},render:function(){var e=this.ctx;return this.overdraw||e.clear(e.COLOR_BUFFER_BIT),Tt.group.render.call(this.scene,e,this.programs),this._flagMatrix=!1,this.programs.resolution.flagged=!0,this}}),y.extend(Ft,F),y.extend(Ft.prototype,v,{constructor:Ft,type:"",renderer:null,scene:null,width:0,height:0,frameCount:0,timeDelta:0,playing:!1,appendTo:function(e){return e.appendChild(this.renderer.domElement),this.fit&&(this.fit.domElement!==window&&(this.fit.domElement=e,this.fit.attached=!1),this.update()),this},play:function(){return this.playing=!0,Lt.init(),this.trigger(v.Types.play)},pause:function(){return this.playing=!1,this.trigger(v.Types.pause)},setPlaying:function(e){this.playing=e},release:function(e){var t,i,r;if(!y.isObject(e))return this.release(this.scene);if("function"==typeof e.unbind&&e.unbind(),e.vertices)for("function"==typeof e.vertices.unbind&&e.vertices.unbind(),t=0;t<e.vertices.length;t++)"function"==typeof(i=e.vertices[t]).unbind&&i.unbind(),i.controls&&(i.controls.left&&"function"==typeof i.controls.left.unbind&&i.controls.left.unbind(),i.controls.right&&"function"==typeof i.controls.right.unbind&&i.controls.right.unbind());if(e.children){for(t=0;t<e.children.length;t++)r=e.children[t],this.release(r);"function"==typeof e.children.unbind&&e.children.unbind()}return e},update:function(){var e=!!this._lastFrame,t=y.performance.now();e&&(this.timeDelta=parseFloat((t-this._lastFrame).toFixed(3))),this._lastFrame=t,this.fit&&this.fit.domElement&&!this.fit.attached&&(ge.bind(this.fit.domElement,"resize",this.fit),this.fit.attached=!0,this.fit());var i=this.width,r=this.height,s=this.renderer;return i===s.width&&r===s.height||s.setSize(i,r,this.ratio),this.trigger(v.Types.update,this.frameCount,this.timeDelta),this.render()},render:function(){return this.renderer.render(),this.trigger(v.Types.render,this.frameCount++)},add:function(e){var t=e;return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.scene.add(t),this},remove:function(e){var t=e;return t instanceof Array||(t=Array.prototype.slice.call(arguments)),this.scene.remove(t),this},clear:function(){return this.scene.remove(this.scene.children),this},makeLine:function(e,t,i,r){var s=new Ye(e,t,i,r);return this.scene.add(s),s},makeArrow:function(e,i,r,s,n){var a="number"==typeof n?n:10,o=Math.atan2(s-i,r-e),h=new Pe([new M(e,i,void 0,void 0,void 0,void 0,t.move),new M(r,s,void 0,void 0,void 0,void 0,t.line),new M(r-a*Math.cos(o-Math.PI/4),s-a*Math.sin(o-Math.PI/4),void 0,void 0,void 0,void 0,t.line),new M(r,s,void 0,void 0,void 0,void 0,t.move),new M(r-a*Math.cos(o+Math.PI/4),s-a*Math.sin(o+Math.PI/4),void 0,void 0,void 0,void 0,t.line)],!1,!1,!0);return h.noFill(),h.cap="round",h.join="round",this.scene.add(h),h},makeRectangle:function(e,t,i,r){var s=new Ie(e,t,i,r);return this.scene.add(s),s},makeRoundedRectangle:function(e,t,i,r,s){var n=new He(e,t,i,r,s);return this.scene.add(n),n},makeCircle:function(e,t,i,r){var s=new ze(e,t,i,r);return this.scene.add(s),s},makeEllipse:function(e,t,i,r,s){var n=new Xe(e,t,i,r,s);return this.scene.add(n),n},makeStar:function(e,t,i,r,s){var n=new yt(e,t,i,r,s);return this.scene.add(n),n},makeCurve:function(e){var t=arguments.length,i=e;if(!Array.isArray(e)){i=[];for(var r=0;r<t;r+=2){var s=arguments[r];if("number"!=typeof s)break;var n=arguments[r+1];i.push(new M(s,n))}}var a=arguments[t-1],o=new Pe(i,!("boolean"==typeof a?a:void 0),!0),h=o.getBoundingClientRect();return o.center().translation.set(h.left+h.width/2,h.top+h.height/2),this.scene.add(o),o},makePolygon:function(e,t,i,r){var s=new gt(e,t,i,r);return this.scene.add(s),s},makeArcSegment:function(e,t,i,r,s,n,a){var o=new lt(e,t,i,r,s,n,a);return this.scene.add(o),o},makePoints:function(e){var t=arguments.length,i=e;if(!Array.isArray(e)){i=[];for(var r=0;r<t;r+=2){var s=arguments[r];if("number"!=typeof s)break;var n=arguments[r+1];i.push(new w(s,n))}}var a=new dt(i);return this.scene.add(a),a},makePath:function(e){var t=arguments.length,i=e;if(!Array.isArray(e)){i=[];for(var r=0;r<t;r+=2){var s=arguments[r];if("number"!=typeof s)break;var n=arguments[r+1];i.push(new M(s,n))}}var a=arguments[t-1],o=new Pe(i,!("boolean"==typeof a?a:void 0)),h=o.getBoundingClientRect();return"number"==typeof h.top&&"number"==typeof h.left&&"number"==typeof h.right&&"number"==typeof h.bottom&&o.center().translation.set(h.left+h.width/2,h.top+h.height/2),this.scene.add(o),o},makeText:function(e,t,i,r){var s=new qe(e,t,i,r);return this.add(s),s},makeLinearGradient:function(e,t,i,r){var s=Array.prototype.slice.call(arguments,4),n=new we(e,t,i,r,s);return this.add(n),n},makeRadialGradient:function(e,t,i){var r=Array.prototype.slice.call(arguments,3),s=new Ae(e,t,i,r);return this.add(s),s},makeSprite:function(e,t,i,r,s,n,a){var o=new Ne(e,t,i,r,s,n);return a&&o.play(),this.add(o),o},makeImageSequence:function(e,t,i,r,s){var n=new ht(e,t,i,r);return s&&n.play(),this.add(n),n},makeTexture:function(e,t){return new Re(e,t)},makeGroup:function(e){var t=e;t instanceof Array||(t=Array.prototype.slice.call(arguments));var i=new Q;return this.scene.add(i),i.add(t),i},interpret:function(e,t,i){var r=e.tagName.toLowerCase();if(i=void 0===i||i,!(r in at))return null;var s=at[r].call(this,e);return i?this.add(t&&s instanceof Q?s.children:s):s.parent&&s.remove(),s},load:function(e,t){var i,r,s,n,a=new Q,o=function(e){for(ge.temp.innerHTML=e,r=0;r<ge.temp.children.length;r++)if(i=ge.temp.children[r],/svg/i.test(i.nodeName))for(n=this.interpret(i),s=0;s<n.children.length;s++)a.add(n.children[s]);else a.add(this.interpret(i));if("function"==typeof t){var o=ge.temp.children.length<=1?ge.temp.children[0]:ge.temp.children;t(a,o)}}.bind(this);return/.*\.svg/gi.test(e)?(ot(e,o),a):(o(e),a)}});var Lt=ge.getRequestAnimationFrame();function jt(){for(var e=0;e<Ft.Instances.length;e++){var t=Ft.Instances[e];t.playing&&t.update()}Ft.nextFrameID=Lt(jt)}return Lt.init=function(){jt(),Lt.init=function(){}},y.extend(Ft,{Anchor:M,Collection:K,Events:v,Group:Q,Matrix:G,Path:Pe,Registry:be,Shape:q,Text:qe,Vector:w,Gradient:ke,ImageSequence:ht,LinearGradient:we,RadialGradient:Ae,Sprite:Ne,Stop:xe,Texture:Re,ArcSegment:lt,Circle:ze,Ellipse:Xe,Line:Ye,Points:dt,Polygon:gt,Rectangle:Ie,RoundedRectangle:He,Star:yt,CanvasRenderer:de,SVGRenderer:xt,WebGLRenderer:Ot,Commands:t,Utils:y.extend({Error:me,getRatio:D,defineGetterSetter:ve,read:at,xhr:ot},y,ue,z,p)}),Ft}));
@@ -53,6 +53,7 @@ if RUBY_ENGINE == 'opal'
53
53
  require 'cgi'
54
54
  require 'file'
55
55
  require 'display'
56
+ require 'glimmer-dsl-opal/vendor/two.min'
56
57
  require 'glimmer-dsl-opal/vendor/jquery'
57
58
  require 'glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.min'
58
59
  require 'glimmer-dsl-opal/vendor/jquery-ui-timepicker/jquery.ui.timepicker'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.2
4
+ version: 0.28.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-25 00:00:00.000000000 Z
11
+ date: 2021-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glimmer
@@ -300,6 +300,7 @@ files:
300
300
  - lib/glimmer-dsl-opal/samples/hello/hello_button.rb
301
301
  - lib/glimmer-dsl-opal/samples/hello/hello_c_combo.rb
302
302
  - lib/glimmer-dsl-opal/samples/hello/hello_c_tab.rb
303
+ - lib/glimmer-dsl-opal/samples/hello/hello_canvas.rb
303
304
  - lib/glimmer-dsl-opal/samples/hello/hello_checkbox.rb
304
305
  - lib/glimmer-dsl-opal/samples/hello/hello_checkbox_group.rb
305
306
  - lib/glimmer-dsl-opal/samples/hello/hello_combo.rb
@@ -328,6 +329,7 @@ files:
328
329
  - lib/glimmer-dsl-opal/samples/hello/hello_tab.rb
329
330
  - lib/glimmer-dsl-opal/samples/hello/hello_table.rb
330
331
  - lib/glimmer-dsl-opal/samples/hello/hello_table/baseball_park.png
332
+ - lib/glimmer-dsl-opal/samples/hello/hello_text.rb
331
333
  - lib/glimmer-dsl-opal/samples/hello/hello_world.rb
332
334
  - lib/glimmer-dsl-opal/samples/hello/images/denmark.png
333
335
  - lib/glimmer-dsl-opal/samples/hello/images/finland.png
@@ -356,6 +358,7 @@ files:
356
358
  - lib/glimmer-dsl-opal/vendor/jquery-ui/jquery-ui.theme.min.css
357
359
  - lib/glimmer-dsl-opal/vendor/jquery-ui/package.json
358
360
  - lib/glimmer-dsl-opal/vendor/jquery.js
361
+ - lib/glimmer-dsl-opal/vendor/two.min.js
359
362
  - lib/glimmer-dsl-swt.rb
360
363
  - lib/glimmer/config.rb
361
364
  - lib/glimmer/config/opal_logger.rb
@@ -406,6 +409,7 @@ files:
406
409
  - lib/glimmer/swt/c_combo_proxy.rb
407
410
  - lib/glimmer/swt/c_tab_folder_proxy.rb
408
411
  - lib/glimmer/swt/c_tab_item_proxy.rb
412
+ - lib/glimmer/swt/canvas_proxy.rb
409
413
  - lib/glimmer/swt/checkbox_proxy.rb
410
414
  - lib/glimmer/swt/color_proxy.rb
411
415
  - lib/glimmer/swt/combo_proxy.rb
@@ -413,6 +417,15 @@ files:
413
417
  - lib/glimmer/swt/control_editor.rb
414
418
  - lib/glimmer/swt/custom/checkbox_group.rb
415
419
  - lib/glimmer/swt/custom/radio_group.rb
420
+ - lib/glimmer/swt/custom/shape.rb
421
+ - lib/glimmer/swt/custom/shape/arc.rb
422
+ - lib/glimmer/swt/custom/shape/line.rb
423
+ - lib/glimmer/swt/custom/shape/oval.rb
424
+ - lib/glimmer/swt/custom/shape/point.rb
425
+ - lib/glimmer/swt/custom/shape/polygon.rb
426
+ - lib/glimmer/swt/custom/shape/polyline.rb
427
+ - lib/glimmer/swt/custom/shape/rectangle.rb
428
+ - lib/glimmer/swt/custom/shape/text.rb
416
429
  - lib/glimmer/swt/date_time_proxy.rb
417
430
  - lib/glimmer/swt/dialog_proxy.rb
418
431
  - lib/glimmer/swt/display_proxy.rb
@@ -436,6 +449,7 @@ files:
436
449
  - lib/glimmer/swt/progress_bar_proxy.rb
437
450
  - lib/glimmer/swt/property_owner.rb
438
451
  - lib/glimmer/swt/radio_proxy.rb
452
+ - lib/glimmer/swt/rectangle.rb
439
453
  - lib/glimmer/swt/row_layout_proxy.rb
440
454
  - lib/glimmer/swt/scale_proxy.rb
441
455
  - lib/glimmer/swt/scrolled_composite_proxy.rb