rearview 1.2.0-jruby → 1.2.1-jruby

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/rearview/jobs_controller.rb +1 -0
  3. data/app/controllers/rearview/monitor_controller.rb +6 -2
  4. data/lib/generators/templates/README.md +3 -2
  5. data/lib/generators/templates/rearview.rb +1 -1
  6. data/lib/graphite/client.rb +2 -2
  7. data/lib/rearview/version.rb +1 -1
  8. data/public/rearview-src/help/cron.html +34 -0
  9. data/public/rearview-src/js/app.js +2 -1
  10. data/public/rearview-src/js/main.js +2 -2
  11. data/public/rearview-src/js/util/cron.js +50 -0
  12. data/public/rearview-src/js/view/addmonitor.js +111 -19
  13. data/public/rearview-src/js/view/expandedmonitor.js +112 -34
  14. data/public/rearview-src/less/rearview.less +64 -2
  15. data/public/rearview-src/templates/expandedmonitor.hbs +71 -43
  16. data/public/rearview-src/templates/schedulemonitor.hbs +36 -7
  17. data/public/rearview/build.txt +2 -1
  18. data/public/rearview/help/cron.html +34 -0
  19. data/public/rearview/js/app.js +1 -1
  20. data/public/rearview/js/main.js +23 -23
  21. data/public/rearview/js/util/cron.js +1 -0
  22. data/public/rearview/js/view/addmonitor.js +1 -1
  23. data/public/rearview/js/view/expandedmonitor.js +1 -1
  24. data/public/rearview/less/rearview.less +64 -2
  25. data/public/rearview/templates/expandedmonitor.hbs +71 -43
  26. data/public/rearview/templates/schedulemonitor.hbs +36 -7
  27. data/spec/controllers/dashboard_children_controller_spec.rb +4 -4
  28. data/spec/controllers/dashboards_controller_spec.rb +7 -7
  29. data/spec/controllers/jobs_controller_spec.rb +20 -11
  30. data/spec/controllers/monitor_controller_spec.rb +21 -4
  31. data/spec/controllers/user_controller_spec.rb +2 -2
  32. data/spec/dummy/log/development.log +90 -0
  33. data/spec/dummy/log/test.log +16754 -0
  34. data/spec/lib/graphite/client_spec.rb +9 -1
  35. data/spec/views/metric/create.json.jbuilder_spec.rb +31 -0
  36. metadata +8 -2
@@ -109,6 +109,12 @@ input, button, select, textarea {
109
109
 
110
110
  @import "header.less";
111
111
 
112
+ input.parsley-error {
113
+ background-color: #F2DEDE !important;
114
+ border: 1px solid #EED3D7 !important;
115
+ color: #B94A48 !important;
116
+ }
117
+
112
118
  /* alert timeline styles */
113
119
  .alert-timeline {
114
120
  position : relative;
@@ -879,18 +885,64 @@ input, button, select, textarea {
879
885
  }
880
886
  }
881
887
 
888
+ .add-monitor {
889
+ input[disabled] {
890
+ background-color: #EEEEEE;
891
+ cursor: not-allowed;
892
+ }
893
+ .help.label {
894
+ float : right;
895
+ cursor : pointer;
896
+ }
897
+ .tooltip {
898
+ text-transform : none;
899
+
900
+ .tooltip-inner {
901
+ max-width : 500px;
902
+ text-align : left;
903
+ .proxima-regular(12px);
904
+
905
+ table {
906
+ margin : 5px 0;
907
+ text-align : left;
908
+
909
+ tr:nth-child(even) {
910
+ background : #333
911
+ }
912
+
913
+ th {
914
+ padding : 2px;
915
+ width : 200px;
916
+ vertical-align : top;
917
+ font-weight : normal;
918
+ }
919
+ td {
920
+ padding : 2px;
921
+ width : 480px;
922
+ vertical-align : top;
923
+ }
924
+ }
882
925
 
926
+ .cron-help-details {
927
+ text-align : left;
928
+ }
929
+ }
930
+ }
931
+ .tooltip.in {
932
+ opacity : 0.9 !important;
933
+ }
934
+ }
883
935
 
884
936
  .metrics-schedule {
885
937
  .expressions textarea {
886
938
  width : 396px;
887
939
  min-height : 200px;
888
940
  }
889
-
890
941
  .metrics-test .metrics textarea {
891
942
  width : 459px;
892
943
  }
893
944
  }
945
+
894
946
  /* add monitor code mirrors */
895
947
  .CodeMirror.error {
896
948
  border-color : #B94A48 !important;
@@ -985,6 +1037,12 @@ input, button, select, textarea {
985
1037
 
986
1038
  /* edit monitor styles */
987
1039
  .metrics-schedule {
1040
+
1041
+ input[disabled] {
1042
+ background-color: #7E8079;
1043
+ cursor: not-allowed;
1044
+ }
1045
+
988
1046
  .metrics .CodeMirror,
989
1047
  .expressions .CodeMirror {
990
1048
  border-radius : 3px;
@@ -1018,7 +1076,7 @@ input, button, select, textarea {
1018
1076
 
1019
1077
  .tooltip-inner {
1020
1078
  max-width : 500px;
1021
-
1079
+ text-align : left;
1022
1080
  .proxima-regular(12px);
1023
1081
 
1024
1082
  table {
@@ -1046,6 +1104,10 @@ input, button, select, textarea {
1046
1104
  .tooltip.in {
1047
1105
  opacity : 0.9 !important;
1048
1106
  }
1107
+ .parsley-error-list li {
1108
+ font-weight : bold;
1109
+ font-size : larger;
1110
+ }
1049
1111
  }
1050
1112
 
1051
1113
  /* ecosystem styles (application tiles, etc.) */
@@ -104,49 +104,77 @@
104
104
  </form>
105
105
  </div>
106
106
  <div class='tab-pane' id='viewSchedule'>
107
- <div class='monitor-schedule'>
108
- <fieldset class='form-horizontal'>
109
- <div class='control-group'>
110
- <label for='inputMinutes'>Minutes</label>
111
- <input type='text' id='inputMinutes' name='inputMinutes' value='*' class='input-mini'>
112
- </div>
113
- <div class='control-group'>
114
- <label for='inputHours'>Hours</label>
115
- <input type='text' id='inputHours' name='inputHours' value='*' class='input-mini'>
116
- </div>
117
- <div class='control-group'>
118
- <label for='inputDays'>Days</label>
119
- <input type='text' id='inputDays' name='inputDays' value='*' class='input-mini'>
120
- </div>
121
- </fieldset>
122
- <fieldset class='day-month-picker'>
123
- <label>Weekday</label>
124
- <div class='day-picker btn-group' data-toggle='buttons-checkbox'>
125
- <button type='button' class='sun btn btn-inverse' data-value='Sun'>Sun</button>
126
- <button type='button' class='mon btn btn-inverse' data-value='Mon'>Mon</button>
127
- <button type='button' class='tue btn btn-inverse' data-value='Tue'>Tue</button>
128
- <button type='button' class='wed btn btn-inverse' data-value='Wed'>Wed</button>
129
- <button type='button' class='thu btn btn-inverse' data-value='Thu'>Thu</button>
130
- <button type='button' class='fri btn btn-inverse' data-value='Fri'>Fri</button>
131
- <button type='button' class='sat btn btn-inverse' data-value='Sat'>Sat</button>
132
- </div>
133
- <label>Month</label>
134
- <div class='month-picker btn-group' data-toggle='buttons-checkbox'>
135
- <button type='button' class='jan btn btn-inverse' data-value='Jan'>Jan</button>
136
- <button type='button' class='feb btn btn-inverse' data-value='Feb'>Feb</button>
137
- <button type='button' class='mar btn btn-inverse' data-value='Mar'>Mar</button>
138
- <button type='button' class='apr btn btn-inverse' data-value='Apr'>Apr</button>
139
- <button type='button' class='may btn btn-inverse' data-value='May'>May</button>
140
- <button type='button' class='jun btn btn-inverse' data-value='Jun'>Jun</button>
141
- <button type='button' class='jul btn btn-inverse' data-value='Jul'>Jul</button>
142
- <button type='button' class='aug btn btn-inverse' data-value='Aug'>Aug</button>
143
- <button type='button' class='sep btn btn-inverse' data-value='Sep'>Sep</button>
144
- <button type='button' class='oct btn btn-inverse' data-value='Oct'>Oct</button>
145
- <button type='button' class='nov btn btn-inverse' data-value='Nov'>Nov</button>
146
- <button type='button' class='dec btn btn-inverse' data-value='Dec'>Dec</button>
147
- </div>
148
- </fieldset>
149
- </div>
107
+ <form id='cronScheduleFormEdit' class='clearfix'>
108
+ <span title='' data-original-title='' class='help label label-info'><i class='icon-info-sign'></i></span>
109
+ <div class='monitor-schedule'>
110
+ <fieldset class='form-horizontal'>
111
+ <div class='control-group'>
112
+ <label for='inputMinutes'>Minutes</label>
113
+ <input type='text'
114
+ id='inputMinutes'
115
+ name='inputMinutes'
116
+ value='0'
117
+ class='input-mini'
118
+ data-trigger='blur mouseout'
119
+ data-error-message="Not a valid value for cron field 'minutes'"
120
+ data-cronfield='minute'
121
+ required='required'>
122
+ </div>
123
+ <div class='control-group'>
124
+ <label for='inputHours'>Hours</label>
125
+ <input type='text'
126
+ id='inputHours'
127
+ name='inputHours'
128
+ value='*'
129
+ class='input-mini'
130
+ data-trigger='blur mouseout'
131
+ data-error-message="Not a valid value for cron field 'hours'"
132
+ data-cronfield='hour'
133
+ required='required'>
134
+ </div>
135
+ <div class='control-group'>
136
+ <label for='inputDays'>Days</label>
137
+ <input type='text'
138
+ id='inputDays'
139
+ name='inputDays'
140
+ value='*'
141
+ class='input-mini'
142
+ data-trigger='blur mouseout'
143
+ data-error-message="Not a valid value for cron field 'days'"
144
+ data-cronfield='day'
145
+ required='required'>
146
+ </div>
147
+ </fieldset>
148
+ <fieldset class='day-month-picker'>
149
+ <label>Weekday</label>
150
+ <div class='day-picker btn-group'>
151
+ <button type='button' class='sun btn btn-inverse' data-value='1'>Sun</button>
152
+ <button type='button' class='mon btn btn-inverse' data-value='2'>Mon</button>
153
+ <button type='button' class='tue btn btn-inverse' data-value='3'>Tue</button>
154
+ <button type='button' class='wed btn btn-inverse' data-value='4'>Wed</button>
155
+ <button type='button' class='thu btn btn-inverse' data-value='5'>Thu</button>
156
+ <button type='button' class='fri btn btn-inverse' data-value='6'>Fri</button>
157
+ <button type='button' class='sat btn btn-inverse' data-value='7'>Sat</button>
158
+ </div>
159
+ <label>Month</label>
160
+ <div class='month-picker btn-group' data-toggle='buttons-checkbox'>
161
+ <button type='button' class='jan btn btn-inverse' data-value='1'>Jan</button>
162
+ <button type='button' class='feb btn btn-inverse' data-value='2'>Feb</button>
163
+ <button type='button' class='mar btn btn-inverse' data-value='3'>Mar</button>
164
+ <button type='button' class='apr btn btn-inverse' data-value='4'>Apr</button>
165
+ <button type='button' class='may btn btn-inverse' data-value='5'>May</button>
166
+ <button type='button' class='jun btn btn-inverse' data-value='6'>Jun</button>
167
+ <button type='button' class='jul btn btn-inverse' data-value='7'>Jul</button>
168
+ <button type='button' class='aug btn btn-inverse' data-value='8'>Aug</button>
169
+ <button type='button' class='sep btn btn-inverse' data-value='9'>Sep</button>
170
+ <button type='button' class='oct btn btn-inverse' data-value='10'>Oct</button>
171
+ <button type='button' class='nov btn btn-inverse' data-value='11'>Nov</button>
172
+ <button type='button' class='dec btn btn-inverse' data-value='12'>Dec</button>
173
+ </div>
174
+ </fieldset>
175
+ </div>
176
+ </form>
177
+ <div id="cronScheduleFormEditErrors"></div>
150
178
  </div>
151
179
  <div class='tab-pane' id='viewSettings'>
152
180
  <div class='clearfix'>
@@ -11,40 +11,68 @@
11
11
  <textarea rows='3' id='description' name='description'></textarea>
12
12
  </fieldset>
13
13
  <fieldset class='pager-duty control-group'>
14
- <label for='pagerDuty' class='control-label'>Add Alert URIs (Not Required):</label>
14
+ <label for='pagerDuty' class='control-label'>Add Alert URIs (Not Required):
15
+ <span class="help label label-info" data-original-title="" title=""><i class="icon-info-sign"></i></span>
16
+ </label>
15
17
  <textarea rows='3' id='pagerDuty' name='pagerDuty' placeholder='Multiple alert URIs can be entered (separated by a space, comma or new line).'>{{#user.preferences.alertKeys}}{{this}}
16
18
  {{/user.preferences.alertKeys}}</textarea>
17
19
  </fieldset>
18
20
  </form>
19
21
  </div>
20
22
  <div class='hero-unit'>
21
- <form class='clearfix'>
23
+ <form id='cronScheduleForm' class='clearfix'>
22
24
  <fieldset class='set-schedule'>
23
- <label>Set Schedule:</label>
25
+ <label>Set Schedule:
26
+ <span class="help label label-info" data-original-title="" title=""><i class="icon-info-sign"></i></span>
27
+ </label>
24
28
  </fieldset>
25
29
  <fieldset class='form-horizontal'>
26
30
  <div class='control-group'>
27
31
  <label class='control-label' for='inputMinutes'>Minutes</label>
28
32
  <div class='controls'>
29
- <input type='text' id='inputMinutes' name='inputMinutes' value='*' class='input-mini'>
33
+ <input type='text'
34
+ id='inputMinutes'
35
+ name='inputMinutes'
36
+ value='0'
37
+ class='input-mini'
38
+ data-trigger='blur mouseout'
39
+ data-error-message="Not a valid value for cron field 'minutes'"
40
+ data-cronfield='minute'
41
+ required='required'>
30
42
  </div>
31
43
  </div>
32
44
  <div class='control-group'>
33
45
  <label class='control-label' for='inputHours'>Hours</label>
34
46
  <div class='controls'>
35
- <input type='text' id='inputHours' name='inputHours' value='*' class='input-mini'>
47
+ <input type='text'
48
+ id='inputHours'
49
+ name='inputHours'
50
+ value='*'
51
+ class='input-mini'
52
+ data-trigger='blur mouseout'
53
+ data-error-message="Not a valid value for cron field 'hours'"
54
+ data-cronfield='hour'
55
+ required='required'>
36
56
  </div>
37
57
  </div>
38
58
  <div class='control-group'>
39
59
  <label class='control-label' for='inputDays'>Days</label>
40
60
  <div class='controls'>
41
- <input type='text' id='inputDays' name='inputDays' value='*' class='input-mini'>
61
+ <input type='text'
62
+ id='inputDays'
63
+ name='inputDays'
64
+ value='*'
65
+ class='input-mini'
66
+ data-trigger='blur mouseout'
67
+ data-error-message="Not a valid value for cron field 'days'"
68
+ data-cronfield='day'
69
+ required='required'>
42
70
  </div>
43
71
  </div>
44
72
  </fieldset>
45
73
  <fieldset class='day-month-picker'>
46
74
  <label>Weekday</label>
47
- <div class='day-picker btn-group' data-toggle='buttons-checkbox'>
75
+ <div class='day-picker btn-group'>
48
76
  <button type='button' class='sun btn' data-value='Sun'>Sun</button>
49
77
  <button type='button' class='mon btn' data-value='Mon'>Mon</button>
50
78
  <button type='button' class='tue btn' data-value='Tue'>Tue</button>
@@ -70,6 +98,7 @@
70
98
  </div>
71
99
  </fieldset>
72
100
  </form>
101
+ <div id='cronScheduleFormErrors'></div>
73
102
  </div>
74
103
  </div>
75
104
  <div class='modal-footer'>
@@ -254,6 +254,7 @@ vendor/underscore/js/underscore.js
254
254
  vendor/backbone/js/backbone.js
255
255
  vendor/backbone/plugins/backbone-localStorage/js/backbone-localStorage.js
256
256
  js/util/templar.js
257
+ js/util/cron.js
257
258
  vendor/backbone/plugins/backbone-mediator/js/backbone-mediator.js
258
259
  js/route/index.js
259
260
  vendor/handlebars/js/handlebars.js
@@ -270,7 +271,7 @@ js/model/monitor.js
270
271
  vendor/codemirror/lib/codemirror.js
271
272
  vendor/codemirror/mode/ruby/ruby.js
272
273
  vendor/jquery/plugins/jquery.validate.js
273
- vendor/parsley/js/parsley.min.js
274
+ vendor/parsley/js/parsley.js
274
275
  js/view/addmonitor.js
275
276
  js/collection/monitor.js
276
277
  js/view/smallmonitor.js
@@ -0,0 +1,34 @@
1
+ <table>
2
+ <tr>
3
+ <th>field</th>
4
+ <td>description</td>
5
+ </tr>
6
+ <tr>
7
+ <th>minutes</th>
8
+ <td>0-59 [, - * /]</td>
9
+ </tr>
10
+ <tr>
11
+ <th>hours</th>
12
+ <td>0-23 [, - * /]</td>
13
+ </tr>
14
+ <tr>
15
+ <th>days</th>
16
+ <td>1-31 [, - * ? / L W]</td>
17
+ </tr>
18
+ <tr>
19
+ <th>weekday</th>
20
+ <td>select which days to run (otherwise it will run everyday)</td>
21
+ </tr>
22
+ <tr>
23
+ <th>month</th>
24
+ <td>select which month to run (otherwise it will run everymonth)</td>
25
+ </tr>
26
+ </table>
27
+ <div class="cron-help-details">
28
+ <p>The '*' character is used to specify all values. For example, "*" in the minute field means "every minute".</p>
29
+ <p>The '?' character is allowed for the days field. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the weekday field.</p>
30
+ <p>The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12".</p>
31
+ <p>The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday".</p>
32
+ <p>The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45".</p>
33
+ <a href="http://quartz-scheduler.org/api/2.1.0/org/quartz/CronExpression.html" target="_new">more about cron schedules</a>
34
+ </div>
@@ -1 +1 @@
1
- define(["jquery","underscore","backbone","util/templar","route/index","view/alert","view/primarynav","view/header","view/addmonitor","view/dashboard","view/adddashboard","view/addcategory","view/ecosystem","view/secondarynav","view/settings","model/user","model/dashboard","collection/monitor","collection/dashboard","backbone-mediator","jquery-timepicker","bootstrap"],function(e,r,t,a,i,s,o,n,d,h,l,u,c,p,w,m,b,v,y){var f=function(){};return r.extend(f,{initialize:function(){r.bindAll(this),this.auth(),this.alert(),this.primaryNav(),this.header(),this.secondaryNav(),this.addCategory(),t.Mediator.pub("controller:app:init"),this.controllerInit=!0,t.history.start()},addCategory:function(){new u({el:e(".add-category-wrap"),templar:this.templar,user:this.user})},alert:function(){this.auth(),this.alertView=new s({el:e(".alert-wrap"),templar:this.templar})},header:function(){this.auth(),new n({el:e(".header-wrap"),templar:this.templar}).render()},primaryNav:function(){this.auth(),new o({el:e(".primary-nav-wrap"),collection:this.dashboardCollection,user:this.user,templar:this.templar}).render(),new w({el:e(".settings-wrap"),user:this.user,templar:this.templar}).render()},secondaryNav:function(){this.auth(),new p({el:e(".secondary-nav-wrap"),templar:this.templar}).render()},category:function(r,a,i){var s=[];this.auth(),this.destroyViews();var o=new v(null,{dashboardId:r});s.push(new h({el:e(".monitor-panel"),collection:o,dashboardId:r,user:this.user,templar:this.templar,router:this.indexRouter,categoryId:a})),this.renderViews(s),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:i,dashboardId:r})},dashboard:function(r,a){var i=[];this.auth(),this.destroyViews();var s=new v(null,{dashboardId:r});i.push(new h({el:e(".monitor-panel"),collection:s,dashboardId:r,user:this.user,templar:this.templar,router:this.indexRouter})),this.renderViews(i),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:a,dashboardId:r})},ecosystem:function(){var r=[];this.auth(),this.destroyViews(),r.push(new c({el:e(".ecosystem-dashboard-wrap"),collection:this.dashboardCollection,templar:this.templar}));var a=new b;r.push(new l({el:e(".add-dashboard-wrap"),templar:this.templar,model:a,collection:this.dashboardCollection,user:this.user})),this.renderViews(r),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!1}})},destroyViews:function(){if(this.currentView)for(;this.currentView.length>0;)this.currentView.pop().destructor()},renderViews:function(e){this.currentView=e;for(var r=this.currentView.length-1;r>=0;r--)this.currentView[r].render()},auth:function(){this.indexRouter=this.indexRouter?this.indexRouter:new i({app:this}),this.user=this.user?this.user:new m,this.dashboardCollection=this.dashboardCollection?this.dashboardCollection:new y,this.templar=this.templar?this.templar:new a(["addcategory","adddashboard","addmonitor","alert","dashboard","dashboardtile","deletemonitor","expandedmonitor","header","primarynav","schedulemonitor","secondarynav","setmetrics","settings","smallmonitor"],{url:rearview.path+"/templates/",version:r.isUndefined(rearview.version)?"0.0.1":rearview.version,cache:r.isUndefined(rearview.cache)?!0:!1})}}),f});
1
+ define(["jquery","underscore","backbone","util/templar","util/cron","route/index","view/alert","view/primarynav","view/header","view/addmonitor","view/dashboard","view/adddashboard","view/addcategory","view/ecosystem","view/secondarynav","view/settings","model/user","model/dashboard","collection/monitor","collection/dashboard","backbone-mediator","jquery-timepicker","bootstrap"],function(e,r,t,a,i,s,o,n,d,h,l,u,c,p,w,m,b,v,y,f){var V=function(){};return r.extend(V,{initialize:function(){r.bindAll(this),this.auth(),this.alert(),this.primaryNav(),this.header(),this.secondaryNav(),this.addCategory(),t.Mediator.pub("controller:app:init"),this.controllerInit=!0,t.history.start()},addCategory:function(){new c({el:e(".add-category-wrap"),templar:this.templar,user:this.user})},alert:function(){this.auth(),this.alertView=new o({el:e(".alert-wrap"),templar:this.templar})},header:function(){this.auth(),new d({el:e(".header-wrap"),templar:this.templar}).render()},primaryNav:function(){this.auth(),new n({el:e(".primary-nav-wrap"),collection:this.dashboardCollection,user:this.user,templar:this.templar}).render(),new m({el:e(".settings-wrap"),user:this.user,templar:this.templar}).render()},secondaryNav:function(){this.auth(),new w({el:e(".secondary-nav-wrap"),templar:this.templar}).render()},category:function(r,a,i){var s=[];this.auth(),this.destroyViews();var o=new y(null,{dashboardId:r});s.push(new l({el:e(".monitor-panel"),collection:o,dashboardId:r,user:this.user,templar:this.templar,router:this.indexRouter,categoryId:a})),this.renderViews(s),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:i,dashboardId:r})},dashboard:function(r,a){var i=[];this.auth(),this.destroyViews();var s=new y(null,{dashboardId:r});i.push(new l({el:e(".monitor-panel"),collection:s,dashboardId:r,user:this.user,templar:this.templar,router:this.indexRouter})),this.renderViews(i),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:a,dashboardId:r})},ecosystem:function(){var r=[];this.auth(),this.destroyViews(),r.push(new p({el:e(".ecosystem-dashboard-wrap"),collection:this.dashboardCollection,templar:this.templar}));var a=new v;r.push(new u({el:e(".add-dashboard-wrap"),templar:this.templar,model:a,collection:this.dashboardCollection,user:this.user})),this.renderViews(r),t.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!1}})},destroyViews:function(){if(this.currentView)for(;this.currentView.length>0;)this.currentView.pop().destructor()},renderViews:function(e){this.currentView=e;for(var r=this.currentView.length-1;r>=0;r--)this.currentView[r].render()},auth:function(){this.indexRouter=this.indexRouter?this.indexRouter:new s({app:this}),this.user=this.user?this.user:new b,this.dashboardCollection=this.dashboardCollection?this.dashboardCollection:new f,this.templar=this.templar?this.templar:new a(["addcategory","adddashboard","addmonitor","alert","dashboard","dashboardtile","deletemonitor","expandedmonitor","header","primarynav","schedulemonitor","secondarynav","setmetrics","settings","smallmonitor"],{url:rearview.path+"/templates/",version:r.isUndefined(rearview.version)?"0.0.1":rearview.version,cache:r.isUndefined(rearview.cache)?!0:!1})}}),V});
@@ -377,26 +377,26 @@
377
377
  * limitations under the License.
378
378
  * ========================================================== */
379
379
 
380
- !function(t,e){function i(t){var e=fe[t]={};return Z.each(t.split(ee),function(t,i){e[i]=!0}),e}function n(t,i,n){if(n===e&&1===t.nodeType){var s="data-"+i.replace(ge,"-$1").toLowerCase();if(n=t.getAttribute(s),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:me.test(n)?Z.parseJSON(n):n}catch(r){}Z.data(t,i,n)}else n=e}return n}function s(t){var e;for(e in t)if(("data"!==e||!Z.isEmptyObject(t[e]))&&"toJSON"!==e)return!1;return!0}function r(){return!1}function o(){return!0}function a(t){return!t||!t.parentNode||11===t.parentNode.nodeType}function l(t,e){do t=t[e];while(t&&1!==t.nodeType);return t}function h(t,e,i){if(e=e||0,Z.isFunction(e))return Z.grep(t,function(t,n){var s=!!e.call(t,n,t);return s===i});if(e.nodeType)return Z.grep(t,function(t){return t===e===i});if("string"==typeof e){var n=Z.grep(t,function(t){return 1===t.nodeType});if(ze.test(e))return Z.filter(e,n,!i);e=Z.filter(e,n)}return Z.grep(t,function(t){return Z.inArray(t,e)>=0===i})}function c(t){var e=He.split("|"),i=t.createDocumentFragment();if(i.createElement)for(;e.length;)i.createElement(e.pop());return i}function u(t,e){return t.getElementsByTagName(e)[0]||t.appendChild(t.ownerDocument.createElement(e))}function d(t,e){if(1===e.nodeType&&Z.hasData(t)){var i,n,s,r=Z._data(t),o=Z._data(e,r),a=r.events;if(a){delete o.handle,o.events={};for(i in a)for(n=0,s=a[i].length;s>n;n++)Z.event.add(e,i,a[i][n])}o.data&&(o.data=Z.extend({},o.data))}}function p(t,e){var i;1===e.nodeType&&(e.clearAttributes&&e.clearAttributes(),e.mergeAttributes&&e.mergeAttributes(t),i=e.nodeName.toLowerCase(),"object"===i?(e.parentNode&&(e.outerHTML=t.outerHTML),Z.support.html5Clone&&t.innerHTML&&!Z.trim(e.innerHTML)&&(e.innerHTML=t.innerHTML)):"input"===i&&Xe.test(t.type)?(e.defaultChecked=e.checked=t.checked,e.value!==t.value&&(e.value=t.value)):"option"===i?e.selected=t.defaultSelected:"input"===i||"textarea"===i?e.defaultValue=t.defaultValue:"script"===i&&e.text!==t.text&&(e.text=t.text),e.removeAttribute(Z.expando))}function f(t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName("*"):"undefined"!=typeof t.querySelectorAll?t.querySelectorAll("*"):[]}function m(t){Xe.test(t.type)&&(t.defaultChecked=t.checked)}function g(t,e){if(e in t)return e;for(var i=e.charAt(0).toUpperCase()+e.slice(1),n=e,s=vi.length;s--;)if(e=vi[s]+i,e in t)return e;return n}function v(t,e){return t=e||t,"none"===Z.css(t,"display")||!Z.contains(t.ownerDocument,t)}function y(t,e){for(var i,n,s=[],r=0,o=t.length;o>r;r++)i=t[r],i.style&&(s[r]=Z._data(i,"olddisplay"),e?(s[r]||"none"!==i.style.display||(i.style.display=""),""===i.style.display&&v(i)&&(s[r]=Z._data(i,"olddisplay",k(i.nodeName)))):(n=ii(i,"display"),s[r]||"none"===n||Z._data(i,"olddisplay",n)));for(r=0;o>r;r++)i=t[r],i.style&&(e&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=e?s[r]||"":"none"));return t}function b(t,e,i){var n=ci.exec(e);return n?Math.max(0,n[1]-(i||0))+(n[2]||"px"):e}function x(t,e,i,n){for(var s=i===(n?"border":"content")?4:"width"===e?1:0,r=0;4>s;s+=2)"margin"===i&&(r+=Z.css(t,i+gi[s],!0)),n?("content"===i&&(r-=parseFloat(ii(t,"padding"+gi[s]))||0),"margin"!==i&&(r-=parseFloat(ii(t,"border"+gi[s]+"Width"))||0)):(r+=parseFloat(ii(t,"padding"+gi[s]))||0,"padding"!==i&&(r+=parseFloat(ii(t,"border"+gi[s]+"Width"))||0));return r}function w(t,e,i){var n="width"===e?t.offsetWidth:t.offsetHeight,s=!0,r=Z.support.boxSizing&&"border-box"===Z.css(t,"boxSizing");if(0>=n||null==n){if(n=ii(t,e),(0>n||null==n)&&(n=t.style[e]),ui.test(n))return n;s=r&&(Z.support.boxSizingReliable||n===t.style[e]),n=parseFloat(n)||0}return n+x(t,e,i||(r?"border":"content"),s)+"px"}function k(t){if(pi[t])return pi[t];var e=Z("<"+t+">").appendTo(j.body),i=e.css("display");return e.remove(),("none"===i||""===i)&&(ni=j.body.appendChild(ni||Z.extend(j.createElement("iframe"),{frameBorder:0,width:0,height:0})),si&&ni.createElement||(si=(ni.contentWindow||ni.contentDocument).document,si.write("<!doctype html><html><body>"),si.close()),e=si.body.appendChild(si.createElement(t)),i=ii(e,"display"),j.body.removeChild(ni)),pi[t]=i,i}function _(t,e,i,n){var s;if(Z.isArray(e))Z.each(e,function(e,s){i||xi.test(t)?n(t,s):_(t+"["+("object"==typeof s?e:"")+"]",s,i,n)});else if(i||"object"!==Z.type(e))n(t,e);else for(s in e)_(t+"["+s+"]",e[s],i,n)}function C(t){return function(e,i){"string"!=typeof e&&(i=e,e="*");var n,s,r,o=e.toLowerCase().split(ee),a=0,l=o.length;if(Z.isFunction(i))for(;l>a;a++)n=o[a],r=/^\+/.test(n),r&&(n=n.substr(1)||"*"),s=t[n]=t[n]||[],s[r?"unshift":"push"](i)}}function D(t,i,n,s,r,o){r=r||i.dataTypes[0],o=o||{},o[r]=!0;for(var a,l=t[r],h=0,c=l?l.length:0,u=t===zi;c>h&&(u||!a);h++)a=l[h](i,n,s),"string"==typeof a&&(!u||o[a]?a=e:(i.dataTypes.unshift(a),a=D(t,i,n,s,a,o)));return!u&&a||o["*"]||(a=D(t,i,n,s,"*",o)),a}function M(t,i){var n,s,r=Z.ajaxSettings.flatOptions||{};for(n in i)i[n]!==e&&((r[n]?t:s||(s={}))[n]=i[n]);s&&Z.extend(!0,t,s)}function T(t,i,n){var s,r,o,a,l=t.contents,h=t.dataTypes,c=t.responseFields;for(r in c)r in n&&(i[c[r]]=n[r]);for(;"*"===h[0];)h.shift(),s===e&&(s=t.mimeType||i.getResponseHeader("content-type"));if(s)for(r in l)if(l[r]&&l[r].test(s)){h.unshift(r);break}if(h[0]in n)o=h[0];else{for(r in n){if(!h[0]||t.converters[r+" "+h[0]]){o=r;break}a||(a=r)}o=o||a}return o?(o!==h[0]&&h.unshift(o),n[o]):void 0}function S(t,e){var i,n,s,r,o=t.dataTypes.slice(),a=o[0],l={},h=0;if(t.dataFilter&&(e=t.dataFilter(e,t.dataType)),o[1])for(i in t.converters)l[i.toLowerCase()]=t.converters[i];for(;s=o[++h];)if("*"!==s){if("*"!==a&&a!==s){if(i=l[a+" "+s]||l["* "+s],!i)for(n in l)if(r=n.split(" "),r[1]===s&&(i=l[a+" "+r[0]]||l["* "+r[0]])){i===!0?i=l[n]:l[n]!==!0&&(s=r[0],o.splice(h--,0,s));break}if(i!==!0)if(i&&t["throws"])e=i(e);else try{e=i(e)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+a+" to "+s}}}a=s}return{state:"success",data:e}}function A(){try{return new t.XMLHttpRequest}catch(e){}}function E(){try{return new t.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function F(){return setTimeout(function(){Gi=e},0),Gi=Z.now()}function I(t,e){Z.each(e,function(e,i){for(var n=(Qi[e]||[]).concat(Qi["*"]),s=0,r=n.length;r>s;s++)if(n[s].call(t,e,i))return})}function L(t,e,i){var n,s=0,r=Zi.length,o=Z.Deferred().always(function(){delete a.elem}),a=function(){for(var e=Gi||F(),i=Math.max(0,l.startTime+l.duration-e),n=1-(i/l.duration||0),s=0,r=l.tweens.length;r>s;s++)l.tweens[s].run(n);return o.notifyWith(t,[l,n,i]),1>n&&r?i:(o.resolveWith(t,[l]),!1)},l=o.promise({elem:t,props:Z.extend({},e),opts:Z.extend(!0,{specialEasing:{}},i),originalProperties:e,originalOptions:i,startTime:Gi||F(),duration:i.duration,tweens:[],createTween:function(e,i){var n=Z.Tween(t,l.opts,e,i,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){for(var i=0,n=e?l.tweens.length:0;n>i;i++)l.tweens[i].run(1);return e?o.resolveWith(t,[l,e]):o.rejectWith(t,[l,e]),this}}),h=l.props;for(N(h,l.opts.specialEasing);r>s;s++)if(n=Zi[s].call(l,t,h,l.opts))return n;return I(l,h),Z.isFunction(l.opts.start)&&l.opts.start.call(t,l),Z.fx.timer(Z.extend(a,{anim:l,queue:l.opts.queue,elem:t})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function N(t,e){var i,n,s,r,o;for(i in t)if(n=Z.camelCase(i),s=e[n],r=t[i],Z.isArray(r)&&(s=r[1],r=t[i]=r[0]),i!==n&&(t[n]=r,delete t[i]),o=Z.cssHooks[n],o&&"expand"in o){r=o.expand(r),delete t[n];for(i in r)i in t||(t[i]=r[i],e[i]=s)}else e[n]=s}function $(t,e,i){var n,s,r,o,a,l,h,c,u=this,d=t.style,p={},f=[],m=t.nodeType&&v(t);i.queue||(h=Z._queueHooks(t,"fx"),null==h.unqueued&&(h.unqueued=0,c=h.empty.fire,h.empty.fire=function(){h.unqueued||c()}),h.unqueued++,u.always(function(){u.always(function(){h.unqueued--,Z.queue(t,"fx").length||h.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(i.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===Z.css(t,"display")&&"none"===Z.css(t,"float")&&(Z.support.inlineBlockNeedsLayout&&"inline"!==k(t.nodeName)?d.zoom=1:d.display="inline-block")),i.overflow&&(d.overflow="hidden",Z.support.shrinkWrapBlocks||u.done(function(){d.overflow=i.overflow[0],d.overflowX=i.overflow[1],d.overflowY=i.overflow[2]}));for(n in e)if(r=e[n],Xi.exec(r)){if(delete e[n],r===(m?"hide":"show"))continue;f.push(n)}if(o=f.length)for(a=Z._data(t,"fxshow")||Z._data(t,"fxshow",{}),m?Z(t).show():u.done(function(){Z(t).hide()}),u.done(function(){var e;Z.removeData(t,"fxshow",!0);for(e in p)Z.style(t,e,p[e])}),n=0;o>n;n++)s=f[n],l=u.createTween(s,m?a[s]:0),p[s]=a[s]||Z.style(t,s),s in a||(a[s]=l.start,m&&(l.end=l.start,l.start="width"===s||"height"===s?1:0))}function z(t,e,i,n,s){return new z.prototype.init(t,e,i,n,s)}function P(t,e){var i,n={height:t},s=0;for(e=e?1:0;4>s;s+=2-e)i=gi[s],n["margin"+i]=n["padding"+i]=t;return e&&(n.opacity=n.width=t),n}function O(t){return Z.isWindow(t)?t:9===t.nodeType?t.defaultView||t.parentWindow:!1}var H,W,j=t.document,R=t.location,B=t.navigator,Y=t.jQuery,V=t.$,U=Array.prototype.push,G=Array.prototype.slice,q=Array.prototype.indexOf,X=Object.prototype.toString,K=Object.prototype.hasOwnProperty,J=String.prototype.trim,Z=function(t,e){return new Z.fn.init(t,e,H)},Q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,te=/\S/,ee=/\s+/,ie=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ne=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,se=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,re=/^[\],:{}\s]*$/,oe=/(?:^|:|,)(?:\s*\[)+/g,ae=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,le=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,he=/^-ms-/,ce=/-([\da-z])/gi,ue=function(t,e){return(e+"").toUpperCase()},de=function(){j.addEventListener?(j.removeEventListener("DOMContentLoaded",de,!1),Z.ready()):"complete"===j.readyState&&(j.detachEvent("onreadystatechange",de),Z.ready())},pe={};Z.fn=Z.prototype={constructor:Z,init:function(t,i,n){var s,r,o;if(!t)return this;if(t.nodeType)return this.context=this[0]=t,this.length=1,this;if("string"==typeof t){if(s="<"===t.charAt(0)&&">"===t.charAt(t.length-1)&&t.length>=3?[null,t,null]:ne.exec(t),!s||!s[1]&&i)return!i||i.jquery?(i||n).find(t):this.constructor(i).find(t);if(s[1])return i=i instanceof Z?i[0]:i,o=i&&i.nodeType?i.ownerDocument||i:j,t=Z.parseHTML(s[1],o,!0),se.test(s[1])&&Z.isPlainObject(i)&&this.attr.call(t,i,!0),Z.merge(this,t);if(r=j.getElementById(s[2]),r&&r.parentNode){if(r.id!==s[2])return n.find(t);this.length=1,this[0]=r}return this.context=j,this.selector=t,this}return Z.isFunction(t)?n.ready(t):(t.selector!==e&&(this.selector=t.selector,this.context=t.context),Z.makeArray(t,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return G.call(this)},get:function(t){return null==t?this.toArray():0>t?this[this.length+t]:this[t]},pushStack:function(t,e,i){var n=Z.merge(this.constructor(),t);return n.prevObject=this,n.context=this.context,"find"===e?n.selector=this.selector+(this.selector?" ":"")+i:e&&(n.selector=this.selector+"."+e+"("+i+")"),n},each:function(t,e){return Z.each(this,t,e)},ready:function(t){return Z.ready.promise().done(t),this},eq:function(t){return t=+t,-1===t?this.slice(t):this.slice(t,t+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(t){return this.pushStack(Z.map(this,function(e,i){return t.call(e,i,e)}))},end:function(){return this.prevObject||this.constructor(null)},push:U,sort:[].sort,splice:[].splice},Z.fn.init.prototype=Z.fn,Z.extend=Z.fn.extend=function(){var t,i,n,s,r,o,a=arguments[0]||{},l=1,h=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},l=2),"object"==typeof a||Z.isFunction(a)||(a={}),h===l&&(a=this,--l);h>l;l++)if(null!=(t=arguments[l]))for(i in t)n=a[i],s=t[i],a!==s&&(c&&s&&(Z.isPlainObject(s)||(r=Z.isArray(s)))?(r?(r=!1,o=n&&Z.isArray(n)?n:[]):o=n&&Z.isPlainObject(n)?n:{},a[i]=Z.extend(c,o,s)):s!==e&&(a[i]=s));return a},Z.extend({noConflict:function(e){return t.$===Z&&(t.$=V),e&&t.jQuery===Z&&(t.jQuery=Y),Z},isReady:!1,readyWait:1,holdReady:function(t){t?Z.readyWait++:Z.ready(!0)},ready:function(t){if(t===!0?!--Z.readyWait:!Z.isReady){if(!j.body)return setTimeout(Z.ready,1);Z.isReady=!0,t!==!0&&--Z.readyWait>0||(W.resolveWith(j,[Z]),Z.fn.trigger&&Z(j).trigger("ready").off("ready"))}},isFunction:function(t){return"function"===Z.type(t)},isArray:Array.isArray||function(t){return"array"===Z.type(t)},isWindow:function(t){return null!=t&&t==t.window},isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},type:function(t){return null==t?String(t):pe[X.call(t)]||"object"},isPlainObject:function(t){if(!t||"object"!==Z.type(t)||t.nodeType||Z.isWindow(t))return!1;try{if(t.constructor&&!K.call(t,"constructor")&&!K.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(i){return!1}var n;for(n in t);return n===e||K.call(t,n)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},error:function(t){throw new Error(t)},parseHTML:function(t,e,i){var n;return t&&"string"==typeof t?("boolean"==typeof e&&(i=e,e=0),e=e||j,(n=se.exec(t))?[e.createElement(n[1])]:(n=Z.buildFragment([t],e,i?null:[]),Z.merge([],(n.cacheable?Z.clone(n.fragment):n.fragment).childNodes))):null},parseJSON:function(e){return e&&"string"==typeof e?(e=Z.trim(e),t.JSON&&t.JSON.parse?t.JSON.parse(e):re.test(e.replace(ae,"@").replace(le,"]").replace(oe,""))?new Function("return "+e)():(Z.error("Invalid JSON: "+e),void 0)):null},parseXML:function(i){var n,s;if(!i||"string"!=typeof i)return null;try{t.DOMParser?(s=new DOMParser,n=s.parseFromString(i,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(i))}catch(r){n=e}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||Z.error("Invalid XML: "+i),n},noop:function(){},globalEval:function(e){e&&te.test(e)&&(t.execScript||function(e){t.eval.call(t,e)})(e)},camelCase:function(t){return t.replace(he,"ms-").replace(ce,ue)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,i,n){var s,r=0,o=t.length,a=o===e||Z.isFunction(t);if(n)if(a){for(s in t)if(i.apply(t[s],n)===!1)break}else for(;o>r&&i.apply(t[r++],n)!==!1;);else if(a){for(s in t)if(i.call(t[s],s,t[s])===!1)break}else for(;o>r&&i.call(t[r],r,t[r++])!==!1;);return t},trim:J&&!J.call(" ")?function(t){return null==t?"":J.call(t)}:function(t){return null==t?"":(t+"").replace(ie,"")},makeArray:function(t,e){var i,n=e||[];return null!=t&&(i=Z.type(t),null==t.length||"string"===i||"function"===i||"regexp"===i||Z.isWindow(t)?U.call(n,t):Z.merge(n,t)),n},inArray:function(t,e,i){var n;if(e){if(q)return q.call(e,t,i);for(n=e.length,i=i?0>i?Math.max(0,n+i):i:0;n>i;i++)if(i in e&&e[i]===t)return i}return-1},merge:function(t,i){var n=i.length,s=t.length,r=0;if("number"==typeof n)for(;n>r;r++)t[s++]=i[r];else for(;i[r]!==e;)t[s++]=i[r++];return t.length=s,t},grep:function(t,e,i){var n,s=[],r=0,o=t.length;for(i=!!i;o>r;r++)n=!!e(t[r],r),i!==n&&s.push(t[r]);return s},map:function(t,i,n){var s,r,o=[],a=0,l=t.length,h=t instanceof Z||l!==e&&"number"==typeof l&&(l>0&&t[0]&&t[l-1]||0===l||Z.isArray(t));if(h)for(;l>a;a++)s=i(t[a],a,n),null!=s&&(o[o.length]=s);else for(r in t)s=i(t[r],r,n),null!=s&&(o[o.length]=s);return o.concat.apply([],o)},guid:1,proxy:function(t,i){var n,s,r;return"string"==typeof i&&(n=t[i],i=t,t=n),Z.isFunction(t)?(s=G.call(arguments,2),r=function(){return t.apply(i,s.concat(G.call(arguments)))},r.guid=t.guid=t.guid||Z.guid++,r):e},access:function(t,i,n,s,r,o,a){var l,h=null==n,c=0,u=t.length;if(n&&"object"==typeof n){for(c in n)Z.access(t,i,c,n[c],1,o,s);r=1}else if(s!==e){if(l=a===e&&Z.isFunction(s),h&&(l?(l=i,i=function(t,e,i){return l.call(Z(t),i)}):(i.call(t,s),i=null)),i)for(;u>c;c++)i(t[c],n,l?s.call(t[c],c,i(t[c],n)):s,a);r=1}return r?t:h?i.call(t):u?i(t[0],n):o},now:function(){return(new Date).getTime()}}),Z.ready.promise=function(e){if(!W)if(W=Z.Deferred(),"complete"===j.readyState)setTimeout(Z.ready,1);else if(j.addEventListener)j.addEventListener("DOMContentLoaded",de,!1),t.addEventListener("load",Z.ready,!1);else{j.attachEvent("onreadystatechange",de),t.attachEvent("onload",Z.ready);var i=!1;try{i=null==t.frameElement&&j.documentElement}catch(n){}i&&i.doScroll&&!function s(){if(!Z.isReady){try{i.doScroll("left")}catch(t){return setTimeout(s,50)}Z.ready()}}()}return W.promise(e)},Z.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(t,e){pe["[object "+e+"]"]=e.toLowerCase()}),H=Z(j);var fe={};Z.Callbacks=function(t){t="string"==typeof t?fe[t]||i(t):Z.extend({},t);var n,s,r,o,a,l,h=[],c=!t.once&&[],u=function(e){for(n=t.memory&&e,s=!0,l=o||0,o=0,a=h.length,r=!0;h&&a>l;l++)if(h[l].apply(e[0],e[1])===!1&&t.stopOnFalse){n=!1;break}r=!1,h&&(c?c.length&&u(c.shift()):n?h=[]:d.disable())},d={add:function(){if(h){var e=h.length;!function i(e){Z.each(e,function(e,n){var s=Z.type(n);"function"!==s||t.unique&&d.has(n)?n&&n.length&&"string"!==s&&i(n):h.push(n)})}(arguments),r?a=h.length:n&&(o=e,u(n))}return this},remove:function(){return h&&Z.each(arguments,function(t,e){for(var i;(i=Z.inArray(e,h,i))>-1;)h.splice(i,1),r&&(a>=i&&a--,l>=i&&l--)}),this},has:function(t){return Z.inArray(t,h)>-1},empty:function(){return h=[],this},disable:function(){return h=c=n=e,this},disabled:function(){return!h},lock:function(){return c=e,n||d.disable(),this},locked:function(){return!c},fireWith:function(t,e){return e=e||[],e=[t,e.slice?e.slice():e],!h||s&&!c||(r?c.push(e):u(e)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!s}};return d},Z.extend({Deferred:function(t){var e=[["resolve","done",Z.Callbacks("once memory"),"resolved"],["reject","fail",Z.Callbacks("once memory"),"rejected"],["notify","progress",Z.Callbacks("memory")]],i="pending",n={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var t=arguments;return Z.Deferred(function(i){Z.each(e,function(e,n){var r=n[0],o=t[e];s[n[1]](Z.isFunction(o)?function(){var t=o.apply(this,arguments);t&&Z.isFunction(t.promise)?t.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[r+"With"](this===s?i:this,[t])}:i[r])}),t=null}).promise()},promise:function(t){return null!=t?Z.extend(t,n):n}},s={};return n.pipe=n.then,Z.each(e,function(t,r){var o=r[2],a=r[3];n[r[1]]=o.add,a&&o.add(function(){i=a},e[1^t][2].disable,e[2][2].lock),s[r[0]]=o.fire,s[r[0]+"With"]=o.fireWith}),n.promise(s),t&&t.call(s,s),s},when:function(t){var e,i,n,s=0,r=G.call(arguments),o=r.length,a=1!==o||t&&Z.isFunction(t.promise)?o:0,l=1===a?t:Z.Deferred(),h=function(t,i,n){return function(s){i[t]=this,n[t]=arguments.length>1?G.call(arguments):s,n===e?l.notifyWith(i,n):--a||l.resolveWith(i,n)}};if(o>1)for(e=new Array(o),i=new Array(o),n=new Array(o);o>s;s++)r[s]&&Z.isFunction(r[s].promise)?r[s].promise().done(h(s,n,r)).fail(l.reject).progress(h(s,i,e)):--a;return a||l.resolveWith(n,r),l.promise()}}),Z.support=function(){var e,i,n,s,r,o,a,l,h,c,u,d=j.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",i=d.getElementsByTagName("*"),n=d.getElementsByTagName("a")[0],n.style.cssText="top:1px;float:left;opacity:.5",!i||!i.length)return{};s=j.createElement("select"),r=s.appendChild(j.createElement("option")),o=d.getElementsByTagName("input")[0],e={leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(n.getAttribute("style")),hrefNormalized:"/a"===n.getAttribute("href"),opacity:/^0.5/.test(n.style.opacity),cssFloat:!!n.style.cssFloat,checkOn:"on"===o.value,optSelected:r.selected,getSetAttribute:"t"!==d.className,enctype:!!j.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==j.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===j.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},o.checked=!0,e.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,e.optDisabled=!r.disabled;try{delete d.test}catch(p){e.deleteExpando=!1}if(!d.addEventListener&&d.attachEvent&&d.fireEvent&&(d.attachEvent("onclick",u=function(){e.noCloneEvent=!1}),d.cloneNode(!0).fireEvent("onclick"),d.detachEvent("onclick",u)),o=j.createElement("input"),o.value="t",o.setAttribute("type","radio"),e.radioValue="t"===o.value,o.setAttribute("checked","checked"),o.setAttribute("name","t"),d.appendChild(o),a=j.createDocumentFragment(),a.appendChild(d.lastChild),e.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,e.appendChecked=o.checked,a.removeChild(o),a.appendChild(d),d.attachEvent)for(h in{submit:!0,change:!0,focusin:!0})l="on"+h,c=l in d,c||(d.setAttribute(l,"return;"),c="function"==typeof d[l]),e[h+"Bubbles"]=c;return Z(function(){var i,n,s,r,o="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=j.getElementsByTagName("body")[0];a&&(i=j.createElement("div"),i.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(i,a.firstChild),n=j.createElement("div"),i.appendChild(n),n.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=n.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=0===s[0].offsetHeight,s[0].style.display="",s[1].style.display="none",e.reliableHiddenOffsets=c&&0===s[0].offsetHeight,n.innerHTML="",n.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",e.boxSizing=4===n.offsetWidth,e.doesNotIncludeMarginInBodyOffset=1!==a.offsetTop,t.getComputedStyle&&(e.pixelPosition="1%"!==(t.getComputedStyle(n,null)||{}).top,e.boxSizingReliable="4px"===(t.getComputedStyle(n,null)||{width:"4px"}).width,r=j.createElement("div"),r.style.cssText=n.style.cssText=o,r.style.marginRight=r.style.width="0",n.style.width="1px",n.appendChild(r),e.reliableMarginRight=!parseFloat((t.getComputedStyle(r,null)||{}).marginRight)),"undefined"!=typeof n.style.zoom&&(n.innerHTML="",n.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",e.inlineBlockNeedsLayout=3===n.offsetWidth,n.style.display="block",n.style.overflow="visible",n.innerHTML="<div></div>",n.firstChild.style.width="5px",e.shrinkWrapBlocks=3!==n.offsetWidth,i.style.zoom=1),a.removeChild(i),i=n=s=r=null)}),a.removeChild(d),i=n=s=r=o=a=d=null,e}();var me=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,ge=/([A-Z])/g;Z.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Z.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(t){return t=t.nodeType?Z.cache[t[Z.expando]]:t[Z.expando],!!t&&!s(t)},data:function(t,i,n,s){if(Z.acceptData(t)){var r,o,a=Z.expando,l="string"==typeof i,h=t.nodeType,c=h?Z.cache:t,u=h?t[a]:t[a]&&a;if(u&&c[u]&&(s||c[u].data)||!l||n!==e)return u||(h?t[a]=u=Z.deletedIds.pop()||Z.guid++:u=a),c[u]||(c[u]={},h||(c[u].toJSON=Z.noop)),("object"==typeof i||"function"==typeof i)&&(s?c[u]=Z.extend(c[u],i):c[u].data=Z.extend(c[u].data,i)),r=c[u],s||(r.data||(r.data={}),r=r.data),n!==e&&(r[Z.camelCase(i)]=n),l?(o=r[i],null==o&&(o=r[Z.camelCase(i)])):o=r,o}},removeData:function(t,e,i){if(Z.acceptData(t)){var n,r,o,a=t.nodeType,l=a?Z.cache:t,h=a?t[Z.expando]:Z.expando;if(l[h]){if(e&&(n=i?l[h]:l[h].data)){Z.isArray(e)||(e in n?e=[e]:(e=Z.camelCase(e),e=e in n?[e]:e.split(" ")));for(r=0,o=e.length;o>r;r++)delete n[e[r]];if(!(i?s:Z.isEmptyObject)(n))return}(i||(delete l[h].data,s(l[h])))&&(a?Z.cleanData([t],!0):Z.support.deleteExpando||l!=l.window?delete l[h]:l[h]=null)}}},_data:function(t,e,i){return Z.data(t,e,i,!0)},acceptData:function(t){var e=t.nodeName&&Z.noData[t.nodeName.toLowerCase()];return!e||e!==!0&&t.getAttribute("classid")===e}}),Z.fn.extend({data:function(t,i){var s,r,o,a,l,h=this[0],c=0,u=null;if(t===e){if(this.length&&(u=Z.data(h),1===h.nodeType&&!Z._data(h,"parsedAttrs"))){for(o=h.attributes,l=o.length;l>c;c++)a=o[c].name,a.indexOf("data-")||(a=Z.camelCase(a.substring(5)),n(h,a,u[a]));Z._data(h,"parsedAttrs",!0)}return u}return"object"==typeof t?this.each(function(){Z.data(this,t)}):(s=t.split(".",2),s[1]=s[1]?"."+s[1]:"",r=s[1]+"!",Z.access(this,function(i){return i===e?(u=this.triggerHandler("getData"+r,[s[0]]),u===e&&h&&(u=Z.data(h,t),u=n(h,t,u)),u===e&&s[1]?this.data(s[0]):u):(s[1]=i,this.each(function(){var e=Z(this);e.triggerHandler("setData"+r,s),Z.data(this,t,i),e.triggerHandler("changeData"+r,s)}),void 0)},null,i,arguments.length>1,null,!1))},removeData:function(t){return this.each(function(){Z.removeData(this,t)})}}),Z.extend({queue:function(t,e,i){var n;return t?(e=(e||"fx")+"queue",n=Z._data(t,e),i&&(!n||Z.isArray(i)?n=Z._data(t,e,Z.makeArray(i)):n.push(i)),n||[]):void 0},dequeue:function(t,e){e=e||"fx";var i=Z.queue(t,e),n=i.length,s=i.shift(),r=Z._queueHooks(t,e),o=function(){Z.dequeue(t,e)};"inprogress"===s&&(s=i.shift(),n--),s&&("fx"===e&&i.unshift("inprogress"),delete r.stop,s.call(t,o,r)),!n&&r&&r.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return Z._data(t,i)||Z._data(t,i,{empty:Z.Callbacks("once memory").add(function(){Z.removeData(t,e+"queue",!0),Z.removeData(t,i,!0)})})}}),Z.fn.extend({queue:function(t,i){var n=2;return"string"!=typeof t&&(i=t,t="fx",n--),arguments.length<n?Z.queue(this[0],t):i===e?this:this.each(function(){var e=Z.queue(this,t,i);Z._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&Z.dequeue(this,t)})},dequeue:function(t){return this.each(function(){Z.dequeue(this,t)})},delay:function(t,e){return t=Z.fx?Z.fx.speeds[t]||t:t,e=e||"fx",this.queue(e,function(e,i){var n=setTimeout(e,t);i.stop=function(){clearTimeout(n)}})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,i){var n,s=1,r=Z.Deferred(),o=this,a=this.length,l=function(){--s||r.resolveWith(o,[o])};for("string"!=typeof t&&(i=t,t=e),t=t||"fx";a--;)n=Z._data(o[a],t+"queueHooks"),n&&n.empty&&(s++,n.empty.add(l));return l(),r.promise(i)}});var ve,ye,be,xe=/[\t\r\n]/g,we=/\r/g,ke=/^(?:button|input)$/i,_e=/^(?:button|input|object|select|textarea)$/i,Ce=/^a(?:rea|)$/i,De=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,Me=Z.support.getSetAttribute;Z.fn.extend({attr:function(t,e){return Z.access(this,Z.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){Z.removeAttr(this,t)})},prop:function(t,e){return Z.access(this,Z.prop,t,e,arguments.length>1)},removeProp:function(t){return t=Z.propFix[t]||t,this.each(function(){try{this[t]=e,delete this[t]}catch(i){}})},addClass:function(t){var e,i,n,s,r,o,a;if(Z.isFunction(t))return this.each(function(e){Z(this).addClass(t.call(this,e,this.className))});if(t&&"string"==typeof t)for(e=t.split(ee),i=0,n=this.length;n>i;i++)if(s=this[i],1===s.nodeType)if(s.className||1!==e.length){for(r=" "+s.className+" ",o=0,a=e.length;a>o;o++)r.indexOf(" "+e[o]+" ")<0&&(r+=e[o]+" ");s.className=Z.trim(r)}else s.className=t;return this},removeClass:function(t){var i,n,s,r,o,a,l;if(Z.isFunction(t))return this.each(function(e){Z(this).removeClass(t.call(this,e,this.className))});if(t&&"string"==typeof t||t===e)for(i=(t||"").split(ee),a=0,l=this.length;l>a;a++)if(s=this[a],1===s.nodeType&&s.className){for(n=(" "+s.className+" ").replace(xe," "),r=0,o=i.length;o>r;r++)for(;n.indexOf(" "+i[r]+" ")>=0;)n=n.replace(" "+i[r]+" "," ");s.className=t?Z.trim(n):""}return this},toggleClass:function(t,e){var i=typeof t,n="boolean"==typeof e;return Z.isFunction(t)?this.each(function(i){Z(this).toggleClass(t.call(this,i,this.className,e),e)}):this.each(function(){if("string"===i)for(var s,r=0,o=Z(this),a=e,l=t.split(ee);s=l[r++];)a=n?a:!o.hasClass(s),o[a?"addClass":"removeClass"](s);else("undefined"===i||"boolean"===i)&&(this.className&&Z._data(this,"__className__",this.className),this.className=this.className||t===!1?"":Z._data(this,"__className__")||"")})},hasClass:function(t){for(var e=" "+t+" ",i=0,n=this.length;n>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(xe," ").indexOf(e)>=0)return!0;return!1},val:function(t){var i,n,s,r=this[0];{if(arguments.length)return s=Z.isFunction(t),this.each(function(n){var r,o=Z(this);1===this.nodeType&&(r=s?t.call(this,n,o.val()):t,null==r?r="":"number"==typeof r?r+="":Z.isArray(r)&&(r=Z.map(r,function(t){return null==t?"":t+""})),i=Z.valHooks[this.type]||Z.valHooks[this.nodeName.toLowerCase()],i&&"set"in i&&i.set(this,r,"value")!==e||(this.value=r))});if(r)return i=Z.valHooks[r.type]||Z.valHooks[r.nodeName.toLowerCase()],i&&"get"in i&&(n=i.get(r,"value"))!==e?n:(n=r.value,"string"==typeof n?n.replace(we,""):null==n?"":n)}}}),Z.extend({valHooks:{option:{get:function(t){var e=t.attributes.value;return!e||e.specified?t.value:t.text}},select:{get:function(t){var e,i,n,s,r=t.selectedIndex,o=[],a=t.options,l="select-one"===t.type;if(0>r)return null;for(i=l?r:0,n=l?r+1:a.length;n>i;i++)if(s=a[i],!(!s.selected||(Z.support.optDisabled?s.disabled:null!==s.getAttribute("disabled"))||s.parentNode.disabled&&Z.nodeName(s.parentNode,"optgroup"))){if(e=Z(s).val(),l)return e;o.push(e)}return l&&!o.length&&a.length?Z(a[r]).val():o},set:function(t,e){var i=Z.makeArray(e);return Z(t).find("option").each(function(){this.selected=Z.inArray(Z(this).val(),i)>=0}),i.length||(t.selectedIndex=-1),i}}},attrFn:{},attr:function(t,i,n,s){var r,o,a,l=t.nodeType;if(t&&3!==l&&8!==l&&2!==l)return s&&Z.isFunction(Z.fn[i])?Z(t)[i](n):"undefined"==typeof t.getAttribute?Z.prop(t,i,n):(a=1!==l||!Z.isXMLDoc(t),a&&(i=i.toLowerCase(),o=Z.attrHooks[i]||(De.test(i)?ye:ve)),n!==e?null===n?(Z.removeAttr(t,i),void 0):o&&"set"in o&&a&&(r=o.set(t,n,i))!==e?r:(t.setAttribute(i,n+""),n):o&&"get"in o&&a&&null!==(r=o.get(t,i))?r:(r=t.getAttribute(i),null===r?e:r))},removeAttr:function(t,e){var i,n,s,r,o=0;if(e&&1===t.nodeType)for(n=e.split(ee);o<n.length;o++)s=n[o],s&&(i=Z.propFix[s]||s,r=De.test(s),r||Z.attr(t,s,""),t.removeAttribute(Me?s:i),r&&i in t&&(t[i]=!1))},attrHooks:{type:{set:function(t,e){if(ke.test(t.nodeName)&&t.parentNode)Z.error("type property can't be changed");else if(!Z.support.radioValue&&"radio"===e&&Z.nodeName(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}},value:{get:function(t,e){return ve&&Z.nodeName(t,"button")?ve.get(t,e):e in t?t.value:null},set:function(t,e,i){return ve&&Z.nodeName(t,"button")?ve.set(t,e,i):(t.value=e,void 0)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(t,i,n){var s,r,o,a=t.nodeType;if(t&&3!==a&&8!==a&&2!==a)return o=1!==a||!Z.isXMLDoc(t),o&&(i=Z.propFix[i]||i,r=Z.propHooks[i]),n!==e?r&&"set"in r&&(s=r.set(t,n,i))!==e?s:t[i]=n:r&&"get"in r&&null!==(s=r.get(t,i))?s:t[i]},propHooks:{tabIndex:{get:function(t){var i=t.getAttributeNode("tabindex");return i&&i.specified?parseInt(i.value,10):_e.test(t.nodeName)||Ce.test(t.nodeName)&&t.href?0:e}}}}),ye={get:function(t,i){var n,s=Z.prop(t,i);return s===!0||"boolean"!=typeof s&&(n=t.getAttributeNode(i))&&n.nodeValue!==!1?i.toLowerCase():e},set:function(t,e,i){var n;return e===!1?Z.removeAttr(t,i):(n=Z.propFix[i]||i,n in t&&(t[n]=!0),t.setAttribute(i,i.toLowerCase())),i}},Me||(be={name:!0,id:!0,coords:!0},ve=Z.valHooks.button={get:function(t,i){var n;return n=t.getAttributeNode(i),n&&(be[i]?""!==n.value:n.specified)?n.value:e},set:function(t,e,i){var n=t.getAttributeNode(i);return n||(n=j.createAttribute(i),t.setAttributeNode(n)),n.value=e+""}},Z.each(["width","height"],function(t,e){Z.attrHooks[e]=Z.extend(Z.attrHooks[e],{set:function(t,i){return""===i?(t.setAttribute(e,"auto"),i):void 0
381
- }})}),Z.attrHooks.contenteditable={get:ve.get,set:function(t,e,i){""===e&&(e="false"),ve.set(t,e,i)}}),Z.support.hrefNormalized||Z.each(["href","src","width","height"],function(t,i){Z.attrHooks[i]=Z.extend(Z.attrHooks[i],{get:function(t){var n=t.getAttribute(i,2);return null===n?e:n}})}),Z.support.style||(Z.attrHooks.style={get:function(t){return t.style.cssText.toLowerCase()||e},set:function(t,e){return t.style.cssText=e+""}}),Z.support.optSelected||(Z.propHooks.selected=Z.extend(Z.propHooks.selected,{get:function(t){var e=t.parentNode;return e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex),null}})),Z.support.enctype||(Z.propFix.enctype="encoding"),Z.support.checkOn||Z.each(["radio","checkbox"],function(){Z.valHooks[this]={get:function(t){return null===t.getAttribute("value")?"on":t.value}}}),Z.each(["radio","checkbox"],function(){Z.valHooks[this]=Z.extend(Z.valHooks[this],{set:function(t,e){return Z.isArray(e)?t.checked=Z.inArray(Z(t).val(),e)>=0:void 0}})});var Te=/^(?:textarea|input|select)$/i,Se=/^([^\.]*|)(?:\.(.+)|)$/,Ae=/(?:^|\s)hover(\.\S+|)\b/,Ee=/^key/,Fe=/^(?:mouse|contextmenu)|click/,Ie=/^(?:focusinfocus|focusoutblur)$/,Le=function(t){return Z.event.special.hover?t:t.replace(Ae,"mouseenter$1 mouseleave$1")};Z.event={add:function(t,i,n,s,r){var o,a,l,h,c,u,d,p,f,m,g;if(3!==t.nodeType&&8!==t.nodeType&&i&&n&&(o=Z._data(t))){for(n.handler&&(f=n,n=f.handler,r=f.selector),n.guid||(n.guid=Z.guid++),l=o.events,l||(o.events=l={}),a=o.handle,a||(o.handle=a=function(t){return"undefined"==typeof Z||t&&Z.event.triggered===t.type?e:Z.event.dispatch.apply(a.elem,arguments)},a.elem=t),i=Z.trim(Le(i)).split(" "),h=0;h<i.length;h++)c=Se.exec(i[h])||[],u=c[1],d=(c[2]||"").split(".").sort(),g=Z.event.special[u]||{},u=(r?g.delegateType:g.bindType)||u,g=Z.event.special[u]||{},p=Z.extend({type:u,origType:c[1],data:s,handler:n,guid:n.guid,selector:r,needsContext:r&&Z.expr.match.needsContext.test(r),namespace:d.join(".")},f),m=l[u],m||(m=l[u]=[],m.delegateCount=0,g.setup&&g.setup.call(t,s,d,a)!==!1||(t.addEventListener?t.addEventListener(u,a,!1):t.attachEvent&&t.attachEvent("on"+u,a))),g.add&&(g.add.call(t,p),p.handler.guid||(p.handler.guid=n.guid)),r?m.splice(m.delegateCount++,0,p):m.push(p),Z.event.global[u]=!0;t=null}},global:{},remove:function(t,e,i,n,s){var r,o,a,l,h,c,u,d,p,f,m,g=Z.hasData(t)&&Z._data(t);if(g&&(d=g.events)){for(e=Z.trim(Le(e||"")).split(" "),r=0;r<e.length;r++)if(o=Se.exec(e[r])||[],a=l=o[1],h=o[2],a){for(p=Z.event.special[a]||{},a=(n?p.delegateType:p.bindType)||a,f=d[a]||[],c=f.length,h=h?new RegExp("(^|\\.)"+h.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,u=0;u<f.length;u++)m=f[u],!s&&l!==m.origType||i&&i.guid!==m.guid||h&&!h.test(m.namespace)||n&&n!==m.selector&&("**"!==n||!m.selector)||(f.splice(u--,1),m.selector&&f.delegateCount--,p.remove&&p.remove.call(t,m));0===f.length&&c!==f.length&&(p.teardown&&p.teardown.call(t,h,g.handle)!==!1||Z.removeEvent(t,a,g.handle),delete d[a])}else for(a in d)Z.event.remove(t,a+e[r],i,n,!0);Z.isEmptyObject(d)&&(delete g.handle,Z.removeData(t,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(i,n,s,r){if(!s||3!==s.nodeType&&8!==s.nodeType){var o,a,l,h,c,u,d,p,f,m,g=i.type||i,v=[];if(!Ie.test(g+Z.event.triggered)&&(g.indexOf("!")>=0&&(g=g.slice(0,-1),a=!0),g.indexOf(".")>=0&&(v=g.split("."),g=v.shift(),v.sort()),s&&!Z.event.customEvent[g]||Z.event.global[g]))if(i="object"==typeof i?i[Z.expando]?i:new Z.Event(g,i):new Z.Event(g),i.type=g,i.isTrigger=!0,i.exclusive=a,i.namespace=v.join("."),i.namespace_re=i.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,u=g.indexOf(":")<0?"on"+g:"",s){if(i.result=e,i.target||(i.target=s),n=null!=n?Z.makeArray(n):[],n.unshift(i),d=Z.event.special[g]||{},!d.trigger||d.trigger.apply(s,n)!==!1){if(f=[[s,d.bindType||g]],!r&&!d.noBubble&&!Z.isWindow(s)){for(m=d.delegateType||g,h=Ie.test(m+g)?s:s.parentNode,c=s;h;h=h.parentNode)f.push([h,m]),c=h;c===(s.ownerDocument||j)&&f.push([c.defaultView||c.parentWindow||t,m])}for(l=0;l<f.length&&!i.isPropagationStopped();l++)h=f[l][0],i.type=f[l][1],p=(Z._data(h,"events")||{})[i.type]&&Z._data(h,"handle"),p&&p.apply(h,n),p=u&&h[u],p&&Z.acceptData(h)&&p.apply&&p.apply(h,n)===!1&&i.preventDefault();return i.type=g,r||i.isDefaultPrevented()||d._default&&d._default.apply(s.ownerDocument,n)!==!1||"click"===g&&Z.nodeName(s,"a")||!Z.acceptData(s)||u&&s[g]&&("focus"!==g&&"blur"!==g||0!==i.target.offsetWidth)&&!Z.isWindow(s)&&(c=s[u],c&&(s[u]=null),Z.event.triggered=g,s[g](),Z.event.triggered=e,c&&(s[u]=c)),i.result}}else{o=Z.cache;for(l in o)o[l].events&&o[l].events[g]&&Z.event.trigger(i,n,o[l].handle.elem,!0)}}},dispatch:function(i){i=Z.event.fix(i||t.event);var n,s,r,o,a,l,h,c,u,d=(Z._data(this,"events")||{})[i.type]||[],p=d.delegateCount,f=G.call(arguments),m=!i.exclusive&&!i.namespace,g=Z.event.special[i.type]||{},v=[];if(f[0]=i,i.delegateTarget=this,!g.preDispatch||g.preDispatch.call(this,i)!==!1){if(p&&(!i.button||"click"!==i.type))for(r=i.target;r!=this;r=r.parentNode||this)if(r.disabled!==!0||"click"!==i.type){for(a={},h=[],n=0;p>n;n++)c=d[n],u=c.selector,a[u]===e&&(a[u]=c.needsContext?Z(u,this).index(r)>=0:Z.find(u,this,null,[r]).length),a[u]&&h.push(c);h.length&&v.push({elem:r,matches:h})}for(d.length>p&&v.push({elem:this,matches:d.slice(p)}),n=0;n<v.length&&!i.isPropagationStopped();n++)for(l=v[n],i.currentTarget=l.elem,s=0;s<l.matches.length&&!i.isImmediatePropagationStopped();s++)c=l.matches[s],(m||!i.namespace&&!c.namespace||i.namespace_re&&i.namespace_re.test(c.namespace))&&(i.data=c.data,i.handleObj=c,o=((Z.event.special[c.origType]||{}).handle||c.handler).apply(l.elem,f),o!==e&&(i.result=o,o===!1&&(i.preventDefault(),i.stopPropagation())));return g.postDispatch&&g.postDispatch.call(this,i),i.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){return null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode),t}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,i){var n,s,r,o=i.button,a=i.fromElement;return null==t.pageX&&null!=i.clientX&&(n=t.target.ownerDocument||j,s=n.documentElement,r=n.body,t.pageX=i.clientX+(s&&s.scrollLeft||r&&r.scrollLeft||0)-(s&&s.clientLeft||r&&r.clientLeft||0),t.pageY=i.clientY+(s&&s.scrollTop||r&&r.scrollTop||0)-(s&&s.clientTop||r&&r.clientTop||0)),!t.relatedTarget&&a&&(t.relatedTarget=a===t.target?i.toElement:a),t.which||o===e||(t.which=1&o?1:2&o?3:4&o?2:0),t}},fix:function(t){if(t[Z.expando])return t;var e,i,n=t,s=Z.event.fixHooks[t.type]||{},r=s.props?this.props.concat(s.props):this.props;for(t=Z.Event(n),e=r.length;e;)i=r[--e],t[i]=n[i];return t.target||(t.target=n.srcElement||j),3===t.target.nodeType&&(t.target=t.target.parentNode),t.metaKey=!!t.metaKey,s.filter?s.filter(t,n):t},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(t,e,i){Z.isWindow(this)&&(this.onbeforeunload=i)},teardown:function(t,e){this.onbeforeunload===e&&(this.onbeforeunload=null)}}},simulate:function(t,e,i,n){var s=Z.extend(new Z.Event,i,{type:t,isSimulated:!0,originalEvent:{}});n?Z.event.trigger(s,null,e):Z.event.dispatch.call(e,s),s.isDefaultPrevented()&&i.preventDefault()}},Z.event.handle=Z.event.dispatch,Z.removeEvent=j.removeEventListener?function(t,e,i){t.removeEventListener&&t.removeEventListener(e,i,!1)}:function(t,e,i){var n="on"+e;t.detachEvent&&("undefined"==typeof t[n]&&(t[n]=null),t.detachEvent(n,i))},Z.Event=function(t,e){return this instanceof Z.Event?(t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||t.returnValue===!1||t.getPreventDefault&&t.getPreventDefault()?o:r):this.type=t,e&&Z.extend(this,e),this.timeStamp=t&&t.timeStamp||Z.now(),this[Z.expando]=!0,void 0):new Z.Event(t,e)},Z.Event.prototype={preventDefault:function(){this.isDefaultPrevented=o;var t=this.originalEvent;t&&(t.preventDefault?t.preventDefault():t.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=o;var t=this.originalEvent;t&&(t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=o,this.stopPropagation()},isDefaultPrevented:r,isPropagationStopped:r,isImmediatePropagationStopped:r},Z.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(t,e){Z.event.special[t]={delegateType:e,bindType:e,handle:function(t){var i,n=this,s=t.relatedTarget,r=t.handleObj;return r.selector,(!s||s!==n&&!Z.contains(n,s))&&(t.type=r.origType,i=r.handler.apply(this,arguments),t.type=e),i}}}),Z.support.submitBubbles||(Z.event.special.submit={setup:function(){return Z.nodeName(this,"form")?!1:(Z.event.add(this,"click._submit keypress._submit",function(t){var i=t.target,n=Z.nodeName(i,"input")||Z.nodeName(i,"button")?i.form:e;n&&!Z._data(n,"_submit_attached")&&(Z.event.add(n,"submit._submit",function(t){t._submit_bubble=!0}),Z._data(n,"_submit_attached",!0))}),void 0)},postDispatch:function(t){t._submit_bubble&&(delete t._submit_bubble,this.parentNode&&!t.isTrigger&&Z.event.simulate("submit",this.parentNode,t,!0))},teardown:function(){return Z.nodeName(this,"form")?!1:(Z.event.remove(this,"._submit"),void 0)}}),Z.support.changeBubbles||(Z.event.special.change={setup:function(){return Te.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(Z.event.add(this,"propertychange._change",function(t){"checked"===t.originalEvent.propertyName&&(this._just_changed=!0)}),Z.event.add(this,"click._change",function(t){this._just_changed&&!t.isTrigger&&(this._just_changed=!1),Z.event.simulate("change",this,t,!0)})),!1):(Z.event.add(this,"beforeactivate._change",function(t){var e=t.target;Te.test(e.nodeName)&&!Z._data(e,"_change_attached")&&(Z.event.add(e,"change._change",function(t){!this.parentNode||t.isSimulated||t.isTrigger||Z.event.simulate("change",this.parentNode,t,!0)}),Z._data(e,"_change_attached",!0))}),void 0)},handle:function(t){var e=t.target;return this!==e||t.isSimulated||t.isTrigger||"radio"!==e.type&&"checkbox"!==e.type?t.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return Z.event.remove(this,"._change"),!Te.test(this.nodeName)}}),Z.support.focusinBubbles||Z.each({focus:"focusin",blur:"focusout"},function(t,e){var i=0,n=function(t){Z.event.simulate(e,t.target,Z.event.fix(t),!0)};Z.event.special[e]={setup:function(){0===i++&&j.addEventListener(t,n,!0)},teardown:function(){0===--i&&j.removeEventListener(t,n,!0)}}}),Z.fn.extend({on:function(t,i,n,s,o){var a,l;if("object"==typeof t){"string"!=typeof i&&(n=n||i,i=e);for(l in t)this.on(l,i,n,t[l],o);return this}if(null==n&&null==s?(s=i,n=i=e):null==s&&("string"==typeof i?(s=n,n=e):(s=n,n=i,i=e)),s===!1)s=r;else if(!s)return this;return 1===o&&(a=s,s=function(t){return Z().off(t),a.apply(this,arguments)},s.guid=a.guid||(a.guid=Z.guid++)),this.each(function(){Z.event.add(this,t,s,n,i)})},one:function(t,e,i,n){return this.on(t,e,i,n,1)},off:function(t,i,n){var s,o;if(t&&t.preventDefault&&t.handleObj)return s=t.handleObj,Z(t.delegateTarget).off(s.namespace?s.origType+"."+s.namespace:s.origType,s.selector,s.handler),this;if("object"==typeof t){for(o in t)this.off(o,i,t[o]);return this}return(i===!1||"function"==typeof i)&&(n=i,i=e),n===!1&&(n=r),this.each(function(){Z.event.remove(this,t,n,i)})},bind:function(t,e,i){return this.on(t,null,e,i)},unbind:function(t,e){return this.off(t,null,e)},live:function(t,e,i){return Z(this.context).on(t,this.selector,e,i),this},die:function(t,e){return Z(this.context).off(t,this.selector||"**",e),this},delegate:function(t,e,i,n){return this.on(e,t,i,n)},undelegate:function(t,e,i){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",i)},trigger:function(t,e){return this.each(function(){Z.event.trigger(t,e,this)})},triggerHandler:function(t,e){return this[0]?Z.event.trigger(t,e,this[0],!0):void 0},toggle:function(t){var e=arguments,i=t.guid||Z.guid++,n=0,s=function(i){var s=(Z._data(this,"lastToggle"+t.guid)||0)%n;return Z._data(this,"lastToggle"+t.guid,s+1),i.preventDefault(),e[s].apply(this,arguments)||!1};for(s.guid=i;n<e.length;)e[n++].guid=i;return this.click(s)},hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),Z.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){Z.fn[e]=function(t,i){return null==i&&(i=t,t=null),arguments.length>0?this.on(e,null,t,i):this.trigger(e)},Ee.test(e)&&(Z.event.fixHooks[e]=Z.event.keyHooks),Fe.test(e)&&(Z.event.fixHooks[e]=Z.event.mouseHooks)}),function(t,e){function i(t,e,i,n){i=i||[],e=e||F;var s,r,o,a,l=e.nodeType;if(!t||"string"!=typeof t)return i;if(1!==l&&9!==l)return[];if(o=w(e),!o&&!n&&(s=ie.exec(t)))if(a=s[1]){if(9===l){if(r=e.getElementById(a),!r||!r.parentNode)return i;if(r.id===a)return i.push(r),i}else if(e.ownerDocument&&(r=e.ownerDocument.getElementById(a))&&k(e,r)&&r.id===a)return i.push(r),i}else{if(s[2])return z.apply(i,P.call(e.getElementsByTagName(t),0)),i;if((a=s[3])&&de&&e.getElementsByClassName)return z.apply(i,P.call(e.getElementsByClassName(a),0)),i}return m(t.replace(J,"$1"),e,i,n,o)}function n(t){return function(e){var i=e.nodeName.toLowerCase();return"input"===i&&e.type===t}}function s(t){return function(e){var i=e.nodeName.toLowerCase();return("input"===i||"button"===i)&&e.type===t}}function r(t){return H(function(e){return e=+e,H(function(i,n){for(var s,r=t([],i.length,e),o=r.length;o--;)i[s=r[o]]&&(i[s]=!(n[s]=i[s]))})})}function o(t,e,i){if(t===e)return i;for(var n=t.nextSibling;n;){if(n===e)return-1;n=n.nextSibling}return 1}function a(t,e){var n,s,r,o,a,l,h,c=R[A][t];if(c)return e?0:c.slice(0);for(a=t,l=[],h=b.preFilter;a;){(!n||(s=Q.exec(a)))&&(s&&(a=a.slice(s[0].length)),l.push(r=[])),n=!1,(s=te.exec(a))&&(r.push(n=new E(s.shift())),a=a.slice(n.length),n.type=s[0].replace(J," "));for(o in b.filter)!(s=ae[o].exec(a))||h[o]&&!(s=h[o](s,F,!0))||(r.push(n=new E(s.shift())),a=a.slice(n.length),n.type=o,n.matches=s);if(!n)break}return e?a.length:a?i.error(t):R(t,l).slice(0)}function l(t,e,i){var n=e.dir,s=i&&"parentNode"===e.dir,r=N++;return e.first?function(e,i,r){for(;e=e[n];)if(s||1===e.nodeType)return t(e,i,r)}:function(e,i,o){if(o){for(;e=e[n];)if((s||1===e.nodeType)&&t(e,i,o))return e}else for(var a,l=L+" "+r+" ",h=l+v;e=e[n];)if(s||1===e.nodeType){if((a=e[A])===h)return e.sizset;if("string"==typeof a&&0===a.indexOf(l)){if(e.sizset)return e}else{if(e[A]=h,t(e,i,o))return e.sizset=!0,e;e.sizset=!1}}}}function h(t){return t.length>1?function(e,i,n){for(var s=t.length;s--;)if(!t[s](e,i,n))return!1;return!0}:t[0]}function c(t,e,i,n,s){for(var r,o=[],a=0,l=t.length,h=null!=e;l>a;a++)(r=t[a])&&(!i||i(r,n,s))&&(o.push(r),h&&e.push(a));return o}function u(t,e,i,n,s,r){return n&&!n[A]&&(n=u(n)),s&&!s[A]&&(s=u(s,r)),H(function(r,o,a,l){if(!r||!s){var h,u,d,p=[],m=[],g=o.length,v=r||f(e||"*",a.nodeType?[a]:a,[],r),y=!t||!r&&e?v:c(v,p,t,a,l),b=i?s||(r?t:g||n)?[]:o:y;if(i&&i(y,b,a,l),n)for(d=c(b,m),n(d,[],a,l),h=d.length;h--;)(u=d[h])&&(b[m[h]]=!(y[m[h]]=u));if(r)for(h=t&&b.length;h--;)(u=b[h])&&(r[p[h]]=!(o[p[h]]=u));else b=c(b===o?b.splice(g,b.length):b),s?s(null,o,b,l):z.apply(o,b)}})}function d(t){for(var e,i,n,s=t.length,r=b.relative[t[0].type],o=r||b.relative[" "],a=r?1:0,c=l(function(t){return t===e},o,!0),p=l(function(t){return O.call(e,t)>-1},o,!0),f=[function(t,i,n){return!r&&(n||i!==M)||((e=i).nodeType?c(t,i,n):p(t,i,n))}];s>a;a++)if(i=b.relative[t[a].type])f=[l(h(f),i)];else{if(i=b.filter[t[a].type].apply(null,t[a].matches),i[A]){for(n=++a;s>n&&!b.relative[t[n].type];n++);return u(a>1&&h(f),a>1&&t.slice(0,a-1).join("").replace(J,"$1"),i,n>a&&d(t.slice(a,n)),s>n&&d(t=t.slice(n)),s>n&&t.join(""))}f.push(i)}return h(f)}function p(t,e){var n=e.length>0,s=t.length>0,r=function(o,a,l,h,u){var d,p,f,m=[],g=0,y="0",x=o&&[],w=null!=u,k=M,_=o||s&&b.find.TAG("*",u&&a.parentNode||a),C=L+=null==k?1:Math.E;for(w&&(M=a!==F&&a,v=r.el);null!=(d=_[y]);y++){if(s&&d){for(p=0;f=t[p];p++)if(f(d,a,l)){h.push(d);break}w&&(L=C,v=++r.el)}n&&((d=!f&&d)&&g--,o&&x.push(d))}if(g+=y,n&&y!==g){for(p=0;f=e[p];p++)f(x,m,a,l);if(o){if(g>0)for(;y--;)x[y]||m[y]||(m[y]=$.call(h));m=c(m)}z.apply(h,m),w&&!o&&m.length>0&&g+e.length>1&&i.uniqueSort(h)}return w&&(L=C,M=k),x};return r.el=0,n?H(r):r}function f(t,e,n,s){for(var r=0,o=e.length;o>r;r++)i(t,e[r],n,s);return n}function m(t,e,i,n,s){var r,o,l,h,c,u=a(t);if(u.length,!n&&1===u.length){if(o=u[0]=u[0].slice(0),o.length>2&&"ID"===(l=o[0]).type&&9===e.nodeType&&!s&&b.relative[o[1].type]){if(e=b.find.ID(l.matches[0].replace(oe,""),e,s)[0],!e)return i;t=t.slice(o.shift().length)}for(r=ae.POS.test(t)?-1:o.length-1;r>=0&&(l=o[r],!b.relative[h=l.type]);r--)if((c=b.find[h])&&(n=c(l.matches[0].replace(oe,""),ne.test(o[0].type)&&e.parentNode||e,s))){if(o.splice(r,1),t=n.length&&o.join(""),!t)return z.apply(i,P.call(n,0)),i;break}}return _(t,u)(n,e,s,i,ne.test(t)),i}function g(){}var v,y,b,x,w,k,_,C,D,M,T=!0,S="undefined",A=("sizcache"+Math.random()).replace(".",""),E=String,F=t.document,I=F.documentElement,L=0,N=0,$=[].pop,z=[].push,P=[].slice,O=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(this[e]===t)return e;return-1},H=function(t,e){return t[A]=null==e||e,t},W=function(){var t={},e=[];return H(function(i,n){return e.push(i)>b.cacheLength&&delete t[e.shift()],t[i]=n},t)},j=W(),R=W(),B=W(),Y="[\\x20\\t\\r\\n\\f]",V="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",U=V.replace("w","w#"),G="([*^$|!~]?=)",q="\\["+Y+"*("+V+")"+Y+"*(?:"+G+Y+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+U+")|)|)"+Y+"*\\]",X=":("+V+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+q+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Y+"*((?:-\\d)?\\d*)"+Y+"*\\)|)(?=[^-]|$)",J=new RegExp("^"+Y+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Y+"+$","g"),Q=new RegExp("^"+Y+"*,"+Y+"*"),te=new RegExp("^"+Y+"*([\\x20\\t\\r\\n\\f>+~])"+Y+"*"),ee=new RegExp(X),ie=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,ne=/[\x20\t\r\n\f]*[+~]/,se=/h\d/i,re=/input|select|textarea|button/i,oe=/\\(?!\\)/g,ae={ID:new RegExp("^#("+V+")"),CLASS:new RegExp("^\\.("+V+")"),NAME:new RegExp("^\\[name=['\"]?("+V+")['\"]?\\]"),TAG:new RegExp("^("+V.replace("w","w*")+")"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+X),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+Y+"*(even|odd|(([+-]|)(\\d*)n|)"+Y+"*(?:([+-]|)"+Y+"*(\\d+)|))"+Y+"*\\)|)","i"),needsContext:new RegExp("^"+Y+"*[>+~]|"+K,"i")},le=function(t){var e=F.createElement("div");try{return t(e)}catch(i){return!1}finally{e=null}},he=le(function(t){return t.appendChild(F.createComment("")),!t.getElementsByTagName("*").length}),ce=le(function(t){return t.innerHTML="<a href='#'></a>",t.firstChild&&typeof t.firstChild.getAttribute!==S&&"#"===t.firstChild.getAttribute("href")}),ue=le(function(t){t.innerHTML="<select></select>";var e=typeof t.lastChild.getAttribute("multiple");return"boolean"!==e&&"string"!==e}),de=le(function(t){return t.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",t.getElementsByClassName&&t.getElementsByClassName("e").length?(t.lastChild.className="e",2===t.getElementsByClassName("e").length):!1}),pe=le(function(t){t.id=A+0,t.innerHTML="<a name='"+A+"'></a><div name='"+A+"'></div>",I.insertBefore(t,I.firstChild);var e=F.getElementsByName&&F.getElementsByName(A).length===2+F.getElementsByName(A+0).length;return y=!F.getElementById(A),I.removeChild(t),e});try{P.call(I.childNodes,0)[0].nodeType}catch(fe){P=function(t){for(var e,i=[];e=this[t];t++)i.push(e);return i}}i.matches=function(t,e){return i(t,null,null,e)},i.matchesSelector=function(t,e){return i(e,null,null,[t]).length>0},x=i.getText=function(t){var e,i="",n=0,s=t.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)i+=x(t)}else if(3===s||4===s)return t.nodeValue}else for(;e=t[n];n++)i+=x(e);return i},w=i.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1},k=i.contains=I.contains?function(t,e){var i=9===t.nodeType?t.documentElement:t,n=e&&e.parentNode;return t===n||!!(n&&1===n.nodeType&&i.contains&&i.contains(n))}:I.compareDocumentPosition?function(t,e){return e&&!!(16&t.compareDocumentPosition(e))}:function(t,e){for(;e=e.parentNode;)if(e===t)return!0;return!1},i.attr=function(t,e){var i,n=w(t);return n||(e=e.toLowerCase()),(i=b.attrHandle[e])?i(t):n||ue?t.getAttribute(e):(i=t.getAttributeNode(e),i?"boolean"==typeof t[e]?t[e]?e:null:i.specified?i.value:null:null)},b=i.selectors={cacheLength:50,createPseudo:H,match:ae,attrHandle:ce?{}:{href:function(t){return t.getAttribute("href",2)},type:function(t){return t.getAttribute("type")}},find:{ID:y?function(t,e,i){if(typeof e.getElementById!==S&&!i){var n=e.getElementById(t);return n&&n.parentNode?[n]:[]}}:function(t,i,n){if(typeof i.getElementById!==S&&!n){var s=i.getElementById(t);return s?s.id===t||typeof s.getAttributeNode!==S&&s.getAttributeNode("id").value===t?[s]:e:[]}},TAG:he?function(t,e){return typeof e.getElementsByTagName!==S?e.getElementsByTagName(t):void 0}:function(t,e){var i=e.getElementsByTagName(t);if("*"===t){for(var n,s=[],r=0;n=i[r];r++)1===n.nodeType&&s.push(n);return s}return i},NAME:pe&&function(t,e){return typeof e.getElementsByName!==S?e.getElementsByName(name):void 0},CLASS:de&&function(t,e,i){return typeof e.getElementsByClassName===S||i?void 0:e.getElementsByClassName(t)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(oe,""),t[3]=(t[4]||t[5]||"").replace(oe,""),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1]?(t[2]||i.error(t[0]),t[3]=+(t[3]?t[4]+(t[5]||1):2*("even"===t[2]||"odd"===t[2])),t[4]=+(t[6]+t[7]||"odd"===t[2])):t[2]&&i.error(t[0]),t},PSEUDO:function(t){var e,i;return ae.CHILD.test(t[0])?null:(t[3]?t[2]=t[3]:(e=t[4])&&(ee.test(e)&&(i=a(e,!0))&&(i=e.indexOf(")",e.length-i)-e.length)&&(e=e.slice(0,i),t[0]=t[0].slice(0,i)),t[2]=e),t.slice(0,3))}},filter:{ID:y?function(t){return t=t.replace(oe,""),function(e){return e.getAttribute("id")===t}}:function(t){return t=t.replace(oe,""),function(e){var i=typeof e.getAttributeNode!==S&&e.getAttributeNode("id");return i&&i.value===t}},TAG:function(t){return"*"===t?function(){return!0}:(t=t.replace(oe,"").toLowerCase(),function(e){return e.nodeName&&e.nodeName.toLowerCase()===t})},CLASS:function(t){var e=j[A][t];return e||(e=j(t,new RegExp("(^|"+Y+")"+t+"("+Y+"|$)"))),function(t){return e.test(t.className||typeof t.getAttribute!==S&&t.getAttribute("class")||"")}},ATTR:function(t,e,n){return function(s){var r=i.attr(s,t);return null==r?"!="===e:e?(r+="","="===e?r===n:"!="===e?r!==n:"^="===e?n&&0===r.indexOf(n):"*="===e?n&&r.indexOf(n)>-1:"$="===e?n&&r.substr(r.length-n.length)===n:"~="===e?(" "+r+" ").indexOf(n)>-1:"|="===e?r===n||r.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(t,e,i,n){return"nth"===t?function(t){var e,s,r=t.parentNode;if(1===i&&0===n)return!0;if(r)for(s=0,e=r.firstChild;e&&(1!==e.nodeType||(s++,t!==e));e=e.nextSibling);return s-=n,s===i||0===s%i&&s/i>=0}:function(e){var i=e;switch(t){case"only":case"first":for(;i=i.previousSibling;)if(1===i.nodeType)return!1;if("first"===t)return!0;i=e;case"last":for(;i=i.nextSibling;)if(1===i.nodeType)return!1;return!0}}},PSEUDO:function(t,e){var n,s=b.pseudos[t]||b.setFilters[t.toLowerCase()]||i.error("unsupported pseudo: "+t);return s[A]?s(e):s.length>1?(n=[t,t,"",e],b.setFilters.hasOwnProperty(t.toLowerCase())?H(function(t,i){for(var n,r=s(t,e),o=r.length;o--;)n=O.call(t,r[o]),t[n]=!(i[n]=r[o])}):function(t){return s(t,0,n)}):s}},pseudos:{not:H(function(t){var e=[],i=[],n=_(t.replace(J,"$1"));return n[A]?H(function(t,e,i,s){for(var r,o=n(t,null,s,[]),a=t.length;a--;)(r=o[a])&&(t[a]=!(e[a]=r))}):function(t,s,r){return e[0]=t,n(e,null,r,i),!i.pop()}}),has:H(function(t){return function(e){return i(t,e).length>0}}),contains:H(function(t){return function(e){return(e.textContent||e.innerText||x(e)).indexOf(t)>-1}}),enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,t.selected===!0},parent:function(t){return!b.pseudos.empty(t)},empty:function(t){var e;for(t=t.firstChild;t;){if(t.nodeName>"@"||3===(e=t.nodeType)||4===e)return!1;t=t.nextSibling}return!0},header:function(t){return se.test(t.nodeName)},text:function(t){var e,i;return"input"===t.nodeName.toLowerCase()&&"text"===(e=t.type)&&(null==(i=t.getAttribute("type"))||i.toLowerCase()===e)},radio:n("radio"),checkbox:n("checkbox"),file:n("file"),password:n("password"),image:n("image"),submit:s("submit"),reset:s("reset"),button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},input:function(t){return re.test(t.nodeName)},focus:function(t){var e=t.ownerDocument;return!(t!==e.activeElement||e.hasFocus&&!e.hasFocus()||!t.type&&!t.href)},active:function(t){return t===t.ownerDocument.activeElement},first:r(function(){return[0]}),last:r(function(t,e){return[e-1]}),eq:r(function(t,e,i){return[0>i?i+e:i]}),even:r(function(t,e){for(var i=0;e>i;i+=2)t.push(i);return t}),odd:r(function(t,e){for(var i=1;e>i;i+=2)t.push(i);return t}),lt:r(function(t,e,i){for(var n=0>i?i+e:i;--n>=0;)t.push(n);return t}),gt:r(function(t,e,i){for(var n=0>i?i+e:i;++n<e;)t.push(n);return t})}},C=I.compareDocumentPosition?function(t,e){return t===e?(D=!0,0):(t.compareDocumentPosition&&e.compareDocumentPosition?4&t.compareDocumentPosition(e):t.compareDocumentPosition)?-1:1}:function(t,e){if(t===e)return D=!0,0;if(t.sourceIndex&&e.sourceIndex)return t.sourceIndex-e.sourceIndex;var i,n,s=[],r=[],a=t.parentNode,l=e.parentNode,h=a;if(a===l)return o(t,e);if(!a)return-1;if(!l)return 1;for(;h;)s.unshift(h),h=h.parentNode;for(h=l;h;)r.unshift(h),h=h.parentNode;i=s.length,n=r.length;for(var c=0;i>c&&n>c;c++)if(s[c]!==r[c])return o(s[c],r[c]);return c===i?o(t,r[c],-1):o(s[c],e,1)},[0,0].sort(C),T=!D,i.uniqueSort=function(t){var e,i=1;if(D=T,t.sort(C),D)for(;e=t[i];i++)e===t[i-1]&&t.splice(i--,1);return t},i.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},_=i.compile=function(t,e){var i,n=[],s=[],r=B[A][t];if(!r){for(e||(e=a(t)),i=e.length;i--;)r=d(e[i]),r[A]?n.push(r):s.push(r);r=B(t,p(s,n))}return r},F.querySelectorAll&&!function(){var t,e=m,n=/'|\\/g,s=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,r=[":focus"],o=[":active",":focus"],l=I.matchesSelector||I.mozMatchesSelector||I.webkitMatchesSelector||I.oMatchesSelector||I.msMatchesSelector;le(function(t){t.innerHTML="<select><option selected=''></option></select>",t.querySelectorAll("[selected]").length||r.push("\\["+Y+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),t.querySelectorAll(":checked").length||r.push(":checked")}),le(function(t){t.innerHTML="<p test=''></p>",t.querySelectorAll("[test^='']").length&&r.push("[*^$]="+Y+"*(?:\"\"|'')"),t.innerHTML="<input type='hidden'/>",t.querySelectorAll(":enabled").length||r.push(":enabled",":disabled")}),r=new RegExp(r.join("|")),m=function(t,i,s,o,l){if(!(o||l||r&&r.test(t))){var h,c,u=!0,d=A,p=i,f=9===i.nodeType&&t;if(1===i.nodeType&&"object"!==i.nodeName.toLowerCase()){for(h=a(t),(u=i.getAttribute("id"))?d=u.replace(n,"\\$&"):i.setAttribute("id",d),d="[id='"+d+"'] ",c=h.length;c--;)h[c]=d+h[c].join("");p=ne.test(t)&&i.parentNode||i,f=h.join(",")}if(f)try{return z.apply(s,P.call(p.querySelectorAll(f),0)),s}catch(m){}finally{u||i.removeAttribute("id")}}return e(t,i,s,o,l)},l&&(le(function(e){t=l.call(e,"div");try{l.call(e,"[test!='']:sizzle"),o.push("!=",X)}catch(i){}}),o=new RegExp(o.join("|")),i.matchesSelector=function(e,n){if(n=n.replace(s,"='$1']"),!(w(e)||o.test(n)||r&&r.test(n)))try{var a=l.call(e,n);if(a||t||e.document&&11!==e.document.nodeType)return a}catch(h){}return i(n,null,null,[e]).length>0})}(),b.pseudos.nth=b.pseudos.eq,b.filters=g.prototype=b.pseudos,b.setFilters=new g,i.attr=Z.attr,Z.find=i,Z.expr=i.selectors,Z.expr[":"]=Z.expr.pseudos,Z.unique=i.uniqueSort,Z.text=i.getText,Z.isXMLDoc=i.isXML,Z.contains=i.contains}(t);var Ne=/Until$/,$e=/^(?:parents|prev(?:Until|All))/,ze=/^.[^:#\[\.,]*$/,Pe=Z.expr.match.needsContext,Oe={children:!0,contents:!0,next:!0,prev:!0};Z.fn.extend({find:function(t){var e,i,n,s,r,o,a=this;if("string"!=typeof t)return Z(t).filter(function(){for(e=0,i=a.length;i>e;e++)if(Z.contains(a[e],this))return!0});for(o=this.pushStack("","find",t),e=0,i=this.length;i>e;e++)if(n=o.length,Z.find(t,this[e],o),e>0)for(s=n;s<o.length;s++)for(r=0;n>r;r++)if(o[r]===o[s]){o.splice(s--,1);break}return o},has:function(t){var e,i=Z(t,this),n=i.length;return this.filter(function(){for(e=0;n>e;e++)if(Z.contains(this,i[e]))return!0})},not:function(t){return this.pushStack(h(this,t,!1),"not",t)},filter:function(t){return this.pushStack(h(this,t,!0),"filter",t)},is:function(t){return!!t&&("string"==typeof t?Pe.test(t)?Z(t,this.context).index(this[0])>=0:Z.filter(t,this).length>0:this.filter(t).length>0)},closest:function(t,e){for(var i,n=0,s=this.length,r=[],o=Pe.test(t)||"string"!=typeof t?Z(t,e||this.context):0;s>n;n++)for(i=this[n];i&&i.ownerDocument&&i!==e&&11!==i.nodeType;){if(o?o.index(i)>-1:Z.find.matchesSelector(i,t)){r.push(i);break}i=i.parentNode}return r=r.length>1?Z.unique(r):r,this.pushStack(r,"closest",t)},index:function(t){return t?"string"==typeof t?Z.inArray(this[0],Z(t)):Z.inArray(t.jquery?t[0]:t,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(t,e){var i="string"==typeof t?Z(t,e):Z.makeArray(t&&t.nodeType?[t]:t),n=Z.merge(this.get(),i);return this.pushStack(a(i[0])||a(n[0])?n:Z.unique(n))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),Z.fn.andSelf=Z.fn.addBack,Z.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return Z.dir(t,"parentNode")},parentsUntil:function(t,e,i){return Z.dir(t,"parentNode",i)},next:function(t){return l(t,"nextSibling")},prev:function(t){return l(t,"previousSibling")},nextAll:function(t){return Z.dir(t,"nextSibling")},prevAll:function(t){return Z.dir(t,"previousSibling")},nextUntil:function(t,e,i){return Z.dir(t,"nextSibling",i)},prevUntil:function(t,e,i){return Z.dir(t,"previousSibling",i)},siblings:function(t){return Z.sibling((t.parentNode||{}).firstChild,t)},children:function(t){return Z.sibling(t.firstChild)},contents:function(t){return Z.nodeName(t,"iframe")?t.contentDocument||t.contentWindow.document:Z.merge([],t.childNodes)}},function(t,e){Z.fn[t]=function(i,n){var s=Z.map(this,e,i);return Ne.test(t)||(n=i),n&&"string"==typeof n&&(s=Z.filter(n,s)),s=this.length>1&&!Oe[t]?Z.unique(s):s,this.length>1&&$e.test(t)&&(s=s.reverse()),this.pushStack(s,t,G.call(arguments).join(","))}}),Z.extend({filter:function(t,e,i){return i&&(t=":not("+t+")"),1===e.length?Z.find.matchesSelector(e[0],t)?[e[0]]:[]:Z.find.matches(t,e)},dir:function(t,i,n){for(var s=[],r=t[i];r&&9!==r.nodeType&&(n===e||1!==r.nodeType||!Z(r).is(n));)1===r.nodeType&&s.push(r),r=r[i];return s},sibling:function(t,e){for(var i=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&i.push(t);return i}});var He="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",We=/ jQuery\d+="(?:null|\d+)"/g,je=/^\s+/,Re=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Be=/<([\w:]+)/,Ye=/<tbody/i,Ve=/<|&#?\w+;/,Ue=/<(?:script|style|link)/i,Ge=/<(?:script|object|embed|option|style)/i,qe=new RegExp("<(?:"+He+")[\\s/>]","i"),Xe=/^(?:checkbox|radio)$/,Ke=/checked\s*(?:[^=]|=\s*.checked.)/i,Je=/\/(java|ecma)script/i,Ze=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Qe={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ti=c(j),ei=ti.appendChild(j.createElement("div"));
382
- Qe.optgroup=Qe.option,Qe.tbody=Qe.tfoot=Qe.colgroup=Qe.caption=Qe.thead,Qe.th=Qe.td,Z.support.htmlSerialize||(Qe._default=[1,"X<div>","</div>"]),Z.fn.extend({text:function(t){return Z.access(this,function(t){return t===e?Z.text(this):this.empty().append((this[0]&&this[0].ownerDocument||j).createTextNode(t))},null,t,arguments.length)},wrapAll:function(t){if(Z.isFunction(t))return this.each(function(e){Z(this).wrapAll(t.call(this,e))});if(this[0]){var e=Z(t,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstChild&&1===t.firstChild.nodeType;)t=t.firstChild;return t}).append(this)}return this},wrapInner:function(t){return Z.isFunction(t)?this.each(function(e){Z(this).wrapInner(t.call(this,e))}):this.each(function(){var e=Z(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=Z.isFunction(t);return this.each(function(i){Z(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(){return this.parent().each(function(){Z.nodeName(this,"body")||Z(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(t){(1===this.nodeType||11===this.nodeType)&&this.appendChild(t)})},prepend:function(){return this.domManip(arguments,!0,function(t){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(t,this.firstChild)})},before:function(){if(!a(this[0]))return this.domManip(arguments,!1,function(t){this.parentNode.insertBefore(t,this)});if(arguments.length){var t=Z.clean(arguments);return this.pushStack(Z.merge(t,this),"before",this.selector)}},after:function(){if(!a(this[0]))return this.domManip(arguments,!1,function(t){this.parentNode.insertBefore(t,this.nextSibling)});if(arguments.length){var t=Z.clean(arguments);return this.pushStack(Z.merge(this,t),"after",this.selector)}},remove:function(t,e){for(var i,n=0;null!=(i=this[n]);n++)(!t||Z.filter(t,[i]).length)&&(e||1!==i.nodeType||(Z.cleanData(i.getElementsByTagName("*")),Z.cleanData([i])),i.parentNode&&i.parentNode.removeChild(i));return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)for(1===t.nodeType&&Z.cleanData(t.getElementsByTagName("*"));t.firstChild;)t.removeChild(t.firstChild);return this},clone:function(t,e){return t=null==t?!1:t,e=null==e?t:e,this.map(function(){return Z.clone(this,t,e)})},html:function(t){return Z.access(this,function(t){var i=this[0]||{},n=0,s=this.length;if(t===e)return 1===i.nodeType?i.innerHTML.replace(We,""):e;if(!("string"!=typeof t||Ue.test(t)||!Z.support.htmlSerialize&&qe.test(t)||!Z.support.leadingWhitespace&&je.test(t)||Qe[(Be.exec(t)||["",""])[1].toLowerCase()])){t=t.replace(Re,"<$1></$2>");try{for(;s>n;n++)i=this[n]||{},1===i.nodeType&&(Z.cleanData(i.getElementsByTagName("*")),i.innerHTML=t);i=0}catch(r){}}i&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(t){return a(this[0])?this.length?this.pushStack(Z(Z.isFunction(t)?t():t),"replaceWith",t):this:Z.isFunction(t)?this.each(function(e){var i=Z(this),n=i.html();i.replaceWith(t.call(this,e,n))}):("string"!=typeof t&&(t=Z(t).detach()),this.each(function(){var e=this.nextSibling,i=this.parentNode;Z(this).remove(),e?Z(e).before(t):Z(i).append(t)}))},detach:function(t){return this.remove(t,!0)},domManip:function(t,i,n){t=[].concat.apply([],t);var s,r,o,a,l=0,h=t[0],c=[],d=this.length;if(!Z.support.checkClone&&d>1&&"string"==typeof h&&Ke.test(h))return this.each(function(){Z(this).domManip(t,i,n)});if(Z.isFunction(h))return this.each(function(s){var r=Z(this);t[0]=h.call(this,s,i?r.html():e),r.domManip(t,i,n)});if(this[0]){if(s=Z.buildFragment(t,this,c),o=s.fragment,r=o.firstChild,1===o.childNodes.length&&(o=r),r)for(i=i&&Z.nodeName(r,"tr"),a=s.cacheable||d-1;d>l;l++)n.call(i&&Z.nodeName(this[l],"table")?u(this[l],"tbody"):this[l],l===a?o:Z.clone(o,!0,!0));o=r=null,c.length&&Z.each(c,function(t,e){e.src?Z.ajax?Z.ajax({url:e.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Z.error("no ajax"):Z.globalEval((e.text||e.textContent||e.innerHTML||"").replace(Ze,"")),e.parentNode&&e.parentNode.removeChild(e)})}return this}}),Z.buildFragment=function(t,i,n){var s,r,o,a=t[0];return i=i||j,i=!i.nodeType&&i[0]||i,i=i.ownerDocument||i,!(1===t.length&&"string"==typeof a&&a.length<512&&i===j&&"<"===a.charAt(0))||Ge.test(a)||!Z.support.checkClone&&Ke.test(a)||!Z.support.html5Clone&&qe.test(a)||(r=!0,s=Z.fragments[a],o=s!==e),s||(s=i.createDocumentFragment(),Z.clean(t,i,s,n),r&&(Z.fragments[a]=o&&s)),{fragment:s,cacheable:r}},Z.fragments={},Z.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){Z.fn[t]=function(i){var n,s=0,r=[],o=Z(i),a=o.length,l=1===this.length&&this[0].parentNode;if((null==l||l&&11===l.nodeType&&1===l.childNodes.length)&&1===a)return o[e](this[0]),this;for(;a>s;s++)n=(s>0?this.clone(!0):this).get(),Z(o[s])[e](n),r=r.concat(n);return this.pushStack(r,t,o.selector)}}),Z.extend({clone:function(t,e,i){var n,s,r,o;if(Z.support.html5Clone||Z.isXMLDoc(t)||!qe.test("<"+t.nodeName+">")?o=t.cloneNode(!0):(ei.innerHTML=t.outerHTML,ei.removeChild(o=ei.firstChild)),!(Z.support.noCloneEvent&&Z.support.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||Z.isXMLDoc(t)))for(p(t,o),n=f(t),s=f(o),r=0;n[r];++r)s[r]&&p(n[r],s[r]);if(e&&(d(t,o),i))for(n=f(t),s=f(o),r=0;n[r];++r)d(n[r],s[r]);return n=s=null,o},clean:function(t,e,i,n){var s,r,o,a,l,h,u,d,p,f,g,v=e===j&&ti,y=[];for(e&&"undefined"!=typeof e.createDocumentFragment||(e=j),s=0;null!=(o=t[s]);s++)if("number"==typeof o&&(o+=""),o){if("string"==typeof o)if(Ve.test(o)){for(v=v||c(e),u=e.createElement("div"),v.appendChild(u),o=o.replace(Re,"<$1></$2>"),a=(Be.exec(o)||["",""])[1].toLowerCase(),l=Qe[a]||Qe._default,h=l[0],u.innerHTML=l[1]+o+l[2];h--;)u=u.lastChild;if(!Z.support.tbody)for(d=Ye.test(o),p="table"!==a||d?"<table>"!==l[1]||d?[]:u.childNodes:u.firstChild&&u.firstChild.childNodes,r=p.length-1;r>=0;--r)Z.nodeName(p[r],"tbody")&&!p[r].childNodes.length&&p[r].parentNode.removeChild(p[r]);!Z.support.leadingWhitespace&&je.test(o)&&u.insertBefore(e.createTextNode(je.exec(o)[0]),u.firstChild),o=u.childNodes,u.parentNode.removeChild(u)}else o=e.createTextNode(o);o.nodeType?y.push(o):Z.merge(y,o)}if(u&&(o=u=v=null),!Z.support.appendChecked)for(s=0;null!=(o=y[s]);s++)Z.nodeName(o,"input")?m(o):"undefined"!=typeof o.getElementsByTagName&&Z.grep(o.getElementsByTagName("input"),m);if(i)for(f=function(t){return!t.type||Je.test(t.type)?n?n.push(t.parentNode?t.parentNode.removeChild(t):t):i.appendChild(t):void 0},s=0;null!=(o=y[s]);s++)Z.nodeName(o,"script")&&f(o)||(i.appendChild(o),"undefined"!=typeof o.getElementsByTagName&&(g=Z.grep(Z.merge([],o.getElementsByTagName("script")),f),y.splice.apply(y,[s+1,0].concat(g)),s+=g.length));return y},cleanData:function(t,e){for(var i,n,s,r,o=0,a=Z.expando,l=Z.cache,h=Z.support.deleteExpando,c=Z.event.special;null!=(s=t[o]);o++)if((e||Z.acceptData(s))&&(n=s[a],i=n&&l[n])){if(i.events)for(r in i.events)c[r]?Z.event.remove(s,r):Z.removeEvent(s,r,i.handle);l[n]&&(delete l[n],h?delete s[a]:s.removeAttribute?s.removeAttribute(a):s[a]=null,Z.deletedIds.push(n))}}}),function(){var t,e;Z.uaMatch=function(t){t=t.toLowerCase();var e=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:e[1]||"",version:e[2]||"0"}},t=Z.uaMatch(B.userAgent),e={},t.browser&&(e[t.browser]=!0,e.version=t.version),e.chrome?e.webkit=!0:e.webkit&&(e.safari=!0),Z.browser=e,Z.sub=function(){function t(e,i){return new t.fn.init(e,i)}Z.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(i,n){return n&&n instanceof Z&&!(n instanceof t)&&(n=t(n)),Z.fn.init.call(this,i,n,e)},t.fn.init.prototype=t.fn;var e=t(j);return t}}();var ii,ni,si,ri=/alpha\([^)]*\)/i,oi=/opacity=([^)]*)/,ai=/^(top|right|bottom|left)$/,li=/^(none|table(?!-c[ea]).+)/,hi=/^margin/,ci=new RegExp("^("+Q+")(.*)$","i"),ui=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),di=new RegExp("^([-+])=("+Q+")","i"),pi={},fi={position:"absolute",visibility:"hidden",display:"block"},mi={letterSpacing:0,fontWeight:400},gi=["Top","Right","Bottom","Left"],vi=["Webkit","O","Moz","ms"],yi=Z.fn.toggle;Z.fn.extend({css:function(t,i){return Z.access(this,function(t,i,n){return n!==e?Z.style(t,i,n):Z.css(t,i)},t,i,arguments.length>1)},show:function(){return y(this,!0)},hide:function(){return y(this)},toggle:function(t,e){var i="boolean"==typeof t;return Z.isFunction(t)&&Z.isFunction(e)?yi.apply(this,arguments):this.each(function(){(i?t:v(this))?Z(this).show():Z(this).hide()})}}),Z.extend({cssHooks:{opacity:{get:function(t,e){if(e){var i=ii(t,"opacity");return""===i?"1":i}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Z.support.cssFloat?"cssFloat":"styleFloat"},style:function(t,i,n,s){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var r,o,a,l=Z.camelCase(i),h=t.style;if(i=Z.cssProps[l]||(Z.cssProps[l]=g(h,l)),a=Z.cssHooks[i]||Z.cssHooks[l],n===e)return a&&"get"in a&&(r=a.get(t,!1,s))!==e?r:h[i];if(o=typeof n,"string"===o&&(r=di.exec(n))&&(n=(r[1]+1)*r[2]+parseFloat(Z.css(t,i)),o="number"),!(null==n||"number"===o&&isNaN(n)||("number"!==o||Z.cssNumber[l]||(n+="px"),a&&"set"in a&&(n=a.set(t,n,s))===e)))try{h[i]=n}catch(c){}}},css:function(t,i,n,s){var r,o,a,l=Z.camelCase(i);return i=Z.cssProps[l]||(Z.cssProps[l]=g(t.style,l)),a=Z.cssHooks[i]||Z.cssHooks[l],a&&"get"in a&&(r=a.get(t,!0,s)),r===e&&(r=ii(t,i)),"normal"===r&&i in mi&&(r=mi[i]),n||s!==e?(o=parseFloat(r),n||Z.isNumeric(o)?o||0:r):r},swap:function(t,e,i){var n,s,r={};for(s in e)r[s]=t.style[s],t.style[s]=e[s];n=i.call(t);for(s in e)t.style[s]=r[s];return n}}),t.getComputedStyle?ii=function(e,i){var n,s,r,o,a=t.getComputedStyle(e,null),l=e.style;return a&&(n=a[i],""!==n||Z.contains(e.ownerDocument,e)||(n=Z.style(e,i)),ui.test(n)&&hi.test(i)&&(s=l.width,r=l.minWidth,o=l.maxWidth,l.minWidth=l.maxWidth=l.width=n,n=a.width,l.width=s,l.minWidth=r,l.maxWidth=o)),n}:j.documentElement.currentStyle&&(ii=function(t,e){var i,n,s=t.currentStyle&&t.currentStyle[e],r=t.style;return null==s&&r&&r[e]&&(s=r[e]),ui.test(s)&&!ai.test(e)&&(i=r.left,n=t.runtimeStyle&&t.runtimeStyle.left,n&&(t.runtimeStyle.left=t.currentStyle.left),r.left="fontSize"===e?"1em":s,s=r.pixelLeft+"px",r.left=i,n&&(t.runtimeStyle.left=n)),""===s?"auto":s}),Z.each(["height","width"],function(t,e){Z.cssHooks[e]={get:function(t,i,n){return i?0===t.offsetWidth&&li.test(ii(t,"display"))?Z.swap(t,fi,function(){return w(t,e,n)}):w(t,e,n):void 0},set:function(t,i,n){return b(t,i,n?x(t,e,n,Z.support.boxSizing&&"border-box"===Z.css(t,"boxSizing")):0)}}}),Z.support.opacity||(Z.cssHooks.opacity={get:function(t,e){return oi.test((e&&t.currentStyle?t.currentStyle.filter:t.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":e?"1":""},set:function(t,e){var i=t.style,n=t.currentStyle,s=Z.isNumeric(e)?"alpha(opacity="+100*e+")":"",r=n&&n.filter||i.filter||"";i.zoom=1,e>=1&&""===Z.trim(r.replace(ri,""))&&i.removeAttribute&&(i.removeAttribute("filter"),n&&!n.filter)||(i.filter=ri.test(r)?r.replace(ri,s):r+" "+s)}}),Z(function(){Z.support.reliableMarginRight||(Z.cssHooks.marginRight={get:function(t,e){return Z.swap(t,{display:"inline-block"},function(){return e?ii(t,"marginRight"):void 0})}}),!Z.support.pixelPosition&&Z.fn.position&&Z.each(["top","left"],function(t,e){Z.cssHooks[e]={get:function(t,i){if(i){var n=ii(t,e);return ui.test(n)?Z(t).position()[e]+"px":n}}}})}),Z.expr&&Z.expr.filters&&(Z.expr.filters.hidden=function(t){return 0===t.offsetWidth&&0===t.offsetHeight||!Z.support.reliableHiddenOffsets&&"none"===(t.style&&t.style.display||ii(t,"display"))},Z.expr.filters.visible=function(t){return!Z.expr.filters.hidden(t)}),Z.each({margin:"",padding:"",border:"Width"},function(t,e){Z.cssHooks[t+e]={expand:function(i){var n,s="string"==typeof i?i.split(" "):[i],r={};for(n=0;4>n;n++)r[t+gi[n]+e]=s[n]||s[n-2]||s[0];return r}},hi.test(t)||(Z.cssHooks[t+e].set=b)});var bi=/%20/g,xi=/\[\]$/,wi=/\r?\n/g,ki=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,_i=/^(?:select|textarea)/i;Z.fn.extend({serialize:function(){return Z.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Z.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||_i.test(this.nodeName)||ki.test(this.type))}).map(function(t,e){var i=Z(this).val();return null==i?null:Z.isArray(i)?Z.map(i,function(t){return{name:e.name,value:t.replace(wi,"\r\n")}}):{name:e.name,value:i.replace(wi,"\r\n")}}).get()}}),Z.param=function(t,i){var n,s=[],r=function(t,e){e=Z.isFunction(e)?e():null==e?"":e,s[s.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(i===e&&(i=Z.ajaxSettings&&Z.ajaxSettings.traditional),Z.isArray(t)||t.jquery&&!Z.isPlainObject(t))Z.each(t,function(){r(this.name,this.value)});else for(n in t)_(n,t[n],i,r);return s.join("&").replace(bi,"+")};var Ci,Di,Mi=/#.*$/,Ti=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Si=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Ai=/^(?:GET|HEAD)$/,Ei=/^\/\//,Fi=/\?/,Ii=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Li=/([?&])_=[^&]*/,Ni=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,$i=Z.fn.load,zi={},Pi={},Oi=["*/"]+["*"];try{Di=R.href}catch(Hi){Di=j.createElement("a"),Di.href="",Di=Di.href}Ci=Ni.exec(Di.toLowerCase())||[],Z.fn.load=function(t,i,n){if("string"!=typeof t&&$i)return $i.apply(this,arguments);if(!this.length)return this;var s,r,o,a=this,l=t.indexOf(" ");return l>=0&&(s=t.slice(l,t.length),t=t.slice(0,l)),Z.isFunction(i)?(n=i,i=e):i&&"object"==typeof i&&(r="POST"),Z.ajax({url:t,type:r,dataType:"html",data:i,complete:function(t,e){n&&a.each(n,o||[t.responseText,e,t])}}).done(function(t){o=arguments,a.html(s?Z("<div>").append(t.replace(Ii,"")).find(s):t)}),this},Z.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(t,e){Z.fn[e]=function(t){return this.on(e,t)}}),Z.each(["get","post"],function(t,i){Z[i]=function(t,n,s,r){return Z.isFunction(n)&&(r=r||s,s=n,n=e),Z.ajax({type:i,url:t,data:n,success:s,dataType:r})}}),Z.extend({getScript:function(t,i){return Z.get(t,e,i,"script")},getJSON:function(t,e,i){return Z.get(t,e,i,"json")},ajaxSetup:function(t,e){return e?M(t,Z.ajaxSettings):(e=t,t=Z.ajaxSettings),M(t,e),t},ajaxSettings:{url:Di,isLocal:Si.test(Ci[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Oi},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":t.String,"text html":!0,"text json":Z.parseJSON,"text xml":Z.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:C(zi),ajaxTransport:C(Pi),ajax:function(t,i){function n(t,i,n,o){var h,u,y,b,w,_=i;2!==x&&(x=2,l&&clearTimeout(l),a=e,r=o||"",k.readyState=t>0?4:0,n&&(b=T(d,k,n)),t>=200&&300>t||304===t?(d.ifModified&&(w=k.getResponseHeader("Last-Modified"),w&&(Z.lastModified[s]=w),w=k.getResponseHeader("Etag"),w&&(Z.etag[s]=w)),304===t?(_="notmodified",h=!0):(h=S(d,b),_=h.state,u=h.data,y=h.error,h=!y)):(y=_,(!_||t)&&(_="error",0>t&&(t=0))),k.status=t,k.statusText=(i||_)+"",h?m.resolveWith(p,[u,_,k]):m.rejectWith(p,[k,_,y]),k.statusCode(v),v=e,c&&f.trigger("ajax"+(h?"Success":"Error"),[k,d,h?u:y]),g.fireWith(p,[k,_]),c&&(f.trigger("ajaxComplete",[k,d]),--Z.active||Z.event.trigger("ajaxStop")))}"object"==typeof t&&(i=t,t=e),i=i||{};var s,r,o,a,l,h,c,u,d=Z.ajaxSetup({},i),p=d.context||d,f=p!==d&&(p.nodeType||p instanceof Z)?Z(p):Z.event,m=Z.Deferred(),g=Z.Callbacks("once memory"),v=d.statusCode||{},y={},b={},x=0,w="canceled",k={readyState:0,setRequestHeader:function(t,e){if(!x){var i=t.toLowerCase();t=b[i]=b[i]||t,y[t]=e}return this},getAllResponseHeaders:function(){return 2===x?r:null},getResponseHeader:function(t){var i;if(2===x){if(!o)for(o={};i=Ti.exec(r);)o[i[1].toLowerCase()]=i[2];i=o[t.toLowerCase()]}return i===e?null:i},overrideMimeType:function(t){return x||(d.mimeType=t),this},abort:function(t){return t=t||w,a&&a.abort(t),n(0,t),this}};if(m.promise(k),k.success=k.done,k.error=k.fail,k.complete=g.add,k.statusCode=function(t){if(t){var e;if(2>x)for(e in t)v[e]=[v[e],t[e]];else e=t[k.status],k.always(e)}return this},d.url=((t||d.url)+"").replace(Mi,"").replace(Ei,Ci[1]+"//"),d.dataTypes=Z.trim(d.dataType||"*").toLowerCase().split(ee),null==d.crossDomain&&(h=Ni.exec(d.url.toLowerCase())||!1,d.crossDomain=h&&h.join(":")+(h[3]?"":"http:"===h[1]?80:443)!==Ci.join(":")+(Ci[3]?"":"http:"===Ci[1]?80:443)),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=Z.param(d.data,d.traditional)),D(zi,d,i,k),2===x)return k;if(c=d.global,d.type=d.type.toUpperCase(),d.hasContent=!Ai.test(d.type),c&&0===Z.active++&&Z.event.trigger("ajaxStart"),!d.hasContent&&(d.data&&(d.url+=(Fi.test(d.url)?"&":"?")+d.data,delete d.data),s=d.url,d.cache===!1)){var _=Z.now(),C=d.url.replace(Li,"$1_="+_);d.url=C+(C===d.url?(Fi.test(d.url)?"&":"?")+"_="+_:"")}(d.data&&d.hasContent&&d.contentType!==!1||i.contentType)&&k.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(s=s||d.url,Z.lastModified[s]&&k.setRequestHeader("If-Modified-Since",Z.lastModified[s]),Z.etag[s]&&k.setRequestHeader("If-None-Match",Z.etag[s])),k.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Oi+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)k.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(p,k,d)===!1||2===x))return k.abort();w="abort";for(u in{success:1,error:1,complete:1})k[u](d[u]);if(a=D(Pi,d,i,k)){k.readyState=1,c&&f.trigger("ajaxSend",[k,d]),d.async&&d.timeout>0&&(l=setTimeout(function(){k.abort("timeout")},d.timeout));try{x=1,a.send(y,n)}catch(M){if(!(2>x))throw M;n(-1,M)}}else n(-1,"No Transport");return k},active:0,lastModified:{},etag:{}});var Wi=[],ji=/\?/,Ri=/(=)\?(?=&|$)|\?\?/,Bi=Z.now();Z.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Wi.pop()||Z.expando+"_"+Bi++;return this[t]=!0,t}}),Z.ajaxPrefilter("json jsonp",function(i,n,s){var r,o,a,l=i.data,h=i.url,c=i.jsonp!==!1,u=c&&Ri.test(h),d=c&&!u&&"string"==typeof l&&!(i.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ri.test(l);return"jsonp"===i.dataTypes[0]||u||d?(r=i.jsonpCallback=Z.isFunction(i.jsonpCallback)?i.jsonpCallback():i.jsonpCallback,o=t[r],u?i.url=h.replace(Ri,"$1"+r):d?i.data=l.replace(Ri,"$1"+r):c&&(i.url+=(ji.test(h)?"&":"?")+i.jsonp+"="+r),i.converters["script json"]=function(){return a||Z.error(r+" was not called"),a[0]},i.dataTypes[0]="json",t[r]=function(){a=arguments},s.always(function(){t[r]=o,i[r]&&(i.jsonpCallback=n.jsonpCallback,Wi.push(r)),a&&Z.isFunction(o)&&o(a[0]),a=o=e}),"script"):void 0}),Z.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(t){return Z.globalEval(t),t}}}),Z.ajaxPrefilter("script",function(t){t.cache===e&&(t.cache=!1),t.crossDomain&&(t.type="GET",t.global=!1)}),Z.ajaxTransport("script",function(t){if(t.crossDomain){var i,n=j.head||j.getElementsByTagName("head")[0]||j.documentElement;return{send:function(s,r){i=j.createElement("script"),i.async="async",t.scriptCharset&&(i.charset=t.scriptCharset),i.src=t.url,i.onload=i.onreadystatechange=function(t,s){(s||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,n&&i.parentNode&&n.removeChild(i),i=e,s||r(200,"success"))},n.insertBefore(i,n.firstChild)},abort:function(){i&&i.onload(0,1)}}}});var Yi,Vi=t.ActiveXObject?function(){for(var t in Yi)Yi[t](0,1)}:!1,Ui=0;Z.ajaxSettings.xhr=t.ActiveXObject?function(){return!this.isLocal&&A()||E()}:A,function(t){Z.extend(Z.support,{ajax:!!t,cors:!!t&&"withCredentials"in t})}(Z.ajaxSettings.xhr()),Z.support.ajax&&Z.ajaxTransport(function(i){if(!i.crossDomain||Z.support.cors){var n;return{send:function(s,r){var o,a,l=i.xhr();if(i.username?l.open(i.type,i.url,i.async,i.username,i.password):l.open(i.type,i.url,i.async),i.xhrFields)for(a in i.xhrFields)l[a]=i.xhrFields[a];i.mimeType&&l.overrideMimeType&&l.overrideMimeType(i.mimeType),i.crossDomain||s["X-Requested-With"]||(s["X-Requested-With"]="XMLHttpRequest");try{for(a in s)l.setRequestHeader(a,s[a])}catch(h){}l.send(i.hasContent&&i.data||null),n=function(t,s){var a,h,c,u,d;try{if(n&&(s||4===l.readyState))if(n=e,o&&(l.onreadystatechange=Z.noop,Vi&&delete Yi[o]),s)4!==l.readyState&&l.abort();else{a=l.status,c=l.getAllResponseHeaders(),u={},d=l.responseXML,d&&d.documentElement&&(u.xml=d);try{u.text=l.responseText}catch(t){}try{h=l.statusText}catch(p){h=""}a||!i.isLocal||i.crossDomain?1223===a&&(a=204):a=u.text?200:404}}catch(f){s||r(-1,f)}u&&r(a,h,u,c)},i.async?4===l.readyState?setTimeout(n,0):(o=++Ui,Vi&&(Yi||(Yi={},Z(t).unload(Vi)),Yi[o]=n),l.onreadystatechange=n):n()},abort:function(){n&&n(0,1)}}}});var Gi,qi,Xi=/^(?:toggle|show|hide)$/,Ki=new RegExp("^(?:([-+])=|)("+Q+")([a-z%]*)$","i"),Ji=/queueHooks$/,Zi=[$],Qi={"*":[function(t,e){var i,n,s=this.createTween(t,e),r=Ki.exec(e),o=s.cur(),a=+o||0,l=1,h=20;if(r){if(i=+r[2],n=r[3]||(Z.cssNumber[t]?"":"px"),"px"!==n&&a){a=Z.css(s.elem,t,!0)||i||1;do l=l||".5",a/=l,Z.style(s.elem,t,a+n);while(l!==(l=s.cur()/o)&&1!==l&&--h)}s.unit=n,s.start=a,s.end=r[1]?a+(r[1]+1)*i:i}return s}]};Z.Animation=Z.extend(L,{tweener:function(t,e){Z.isFunction(t)?(e=t,t=["*"]):t=t.split(" ");for(var i,n=0,s=t.length;s>n;n++)i=t[n],Qi[i]=Qi[i]||[],Qi[i].unshift(e)},prefilter:function(t,e){e?Zi.unshift(t):Zi.push(t)}}),Z.Tween=z,z.prototype={constructor:z,init:function(t,e,i,n,s,r){this.elem=t,this.prop=i,this.easing=s||"swing",this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=r||(Z.cssNumber[i]?"":"px")},cur:function(){var t=z.propHooks[this.prop];return t&&t.get?t.get(this):z.propHooks._default.get(this)},run:function(t){var e,i=z.propHooks[this.prop];return this.pos=e=this.options.duration?Z.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):z.propHooks._default.set(this),this}},z.prototype.init.prototype=z.prototype,z.propHooks={_default:{get:function(t){var e;return null==t.elem[t.prop]||t.elem.style&&null!=t.elem.style[t.prop]?(e=Z.css(t.elem,t.prop,!1,""),e&&"auto"!==e?e:0):t.elem[t.prop]},set:function(t){Z.fx.step[t.prop]?Z.fx.step[t.prop](t):t.elem.style&&(null!=t.elem.style[Z.cssProps[t.prop]]||Z.cssHooks[t.prop])?Z.style(t.elem,t.prop,t.now+t.unit):t.elem[t.prop]=t.now}}},z.propHooks.scrollTop=z.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},Z.each(["toggle","show","hide"],function(t,e){var i=Z.fn[e];Z.fn[e]=function(n,s,r){return null==n||"boolean"==typeof n||!t&&Z.isFunction(n)&&Z.isFunction(s)?i.apply(this,arguments):this.animate(P(e,!0),n,s,r)}}),Z.fn.extend({fadeTo:function(t,e,i,n){return this.filter(v).css("opacity",0).show().end().animate({opacity:e},t,i,n)},animate:function(t,e,i,n){var s=Z.isEmptyObject(t),r=Z.speed(e,i,n),o=function(){var e=L(this,Z.extend({},t),r);s&&e.stop(!0)};return s||r.queue===!1?this.each(o):this.queue(r.queue,o)},stop:function(t,i,n){var s=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=i,i=t,t=e),i&&t!==!1&&this.queue(t||"fx",[]),this.each(function(){var e=!0,i=null!=t&&t+"queueHooks",r=Z.timers,o=Z._data(this);if(i)o[i]&&o[i].stop&&s(o[i]);else for(i in o)o[i]&&o[i].stop&&Ji.test(i)&&s(o[i]);for(i=r.length;i--;)r[i].elem!==this||null!=t&&r[i].queue!==t||(r[i].anim.stop(n),e=!1,r.splice(i,1));(e||!n)&&Z.dequeue(this,t)})}}),Z.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){Z.fn[t]=function(t,i,n){return this.animate(e,t,i,n)}}),Z.speed=function(t,e,i){var n=t&&"object"==typeof t?Z.extend({},t):{complete:i||!i&&e||Z.isFunction(t)&&t,duration:t,easing:i&&e||e&&!Z.isFunction(e)&&e};return n.duration=Z.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in Z.fx.speeds?Z.fx.speeds[n.duration]:Z.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(){Z.isFunction(n.old)&&n.old.call(this),n.queue&&Z.dequeue(this,n.queue)},n},Z.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2}},Z.timers=[],Z.fx=z.prototype.init,Z.fx.tick=function(){for(var t,e=Z.timers,i=0;i<e.length;i++)t=e[i],t()||e[i]!==t||e.splice(i--,1);e.length||Z.fx.stop()},Z.fx.timer=function(t){t()&&Z.timers.push(t)&&!qi&&(qi=setInterval(Z.fx.tick,Z.fx.interval))},Z.fx.interval=13,Z.fx.stop=function(){clearInterval(qi),qi=null},Z.fx.speeds={slow:600,fast:200,_default:400},Z.fx.step={},Z.expr&&Z.expr.filters&&(Z.expr.filters.animated=function(t){return Z.grep(Z.timers,function(e){return t===e.elem}).length});var tn=/^(?:body|html)$/i;Z.fn.offset=function(t){if(arguments.length)return t===e?this:this.each(function(e){Z.offset.setOffset(this,t,e)});var i,n,s,r,o,a,l,h={top:0,left:0},c=this[0],u=c&&c.ownerDocument;if(u)return(n=u.body)===c?Z.offset.bodyOffset(c):(i=u.documentElement,Z.contains(i,c)?("undefined"!=typeof c.getBoundingClientRect&&(h=c.getBoundingClientRect()),s=O(u),r=i.clientTop||n.clientTop||0,o=i.clientLeft||n.clientLeft||0,a=s.pageYOffset||i.scrollTop,l=s.pageXOffset||i.scrollLeft,{top:h.top+a-r,left:h.left+l-o}):h)},Z.offset={bodyOffset:function(t){var e=t.offsetTop,i=t.offsetLeft;return Z.support.doesNotIncludeMarginInBodyOffset&&(e+=parseFloat(Z.css(t,"marginTop"))||0,i+=parseFloat(Z.css(t,"marginLeft"))||0),{top:e,left:i}},setOffset:function(t,e,i){var n=Z.css(t,"position");"static"===n&&(t.style.position="relative");var s,r,o=Z(t),a=o.offset(),l=Z.css(t,"top"),h=Z.css(t,"left"),c=("absolute"===n||"fixed"===n)&&Z.inArray("auto",[l,h])>-1,u={},d={};c?(d=o.position(),s=d.top,r=d.left):(s=parseFloat(l)||0,r=parseFloat(h)||0),Z.isFunction(e)&&(e=e.call(t,i,a)),null!=e.top&&(u.top=e.top-a.top+s),null!=e.left&&(u.left=e.left-a.left+r),"using"in e?e.using.call(t,u):o.css(u)}},Z.fn.extend({position:function(){if(this[0]){var t=this[0],e=this.offsetParent(),i=this.offset(),n=tn.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(Z.css(t,"marginTop"))||0,i.left-=parseFloat(Z.css(t,"marginLeft"))||0,n.top+=parseFloat(Z.css(e[0],"borderTopWidth"))||0,n.left+=parseFloat(Z.css(e[0],"borderLeftWidth"))||0,{top:i.top-n.top,left:i.left-n.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||j.body;t&&!tn.test(t.nodeName)&&"static"===Z.css(t,"position");)t=t.offsetParent;return t||j.body})}}),Z.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var n=/Y/.test(i);Z.fn[t]=function(s){return Z.access(this,function(t,s,r){var o=O(t);return r===e?o?i in o?o[i]:o.document.documentElement[s]:t[s]:(o?o.scrollTo(n?Z(o).scrollLeft():r,n?r:Z(o).scrollTop()):t[s]=r,void 0)},t,s,arguments.length,null)}}),Z.each({Height:"height",Width:"width"},function(t,i){Z.each({padding:"inner"+t,content:i,"":"outer"+t},function(n,s){Z.fn[s]=function(s,r){var o=arguments.length&&(n||"boolean"!=typeof s),a=n||(s===!0||r===!0?"margin":"border");return Z.access(this,function(i,n,s){var r;return Z.isWindow(i)?i.document.documentElement["client"+t]:9===i.nodeType?(r=i.documentElement,Math.max(i.body["scroll"+t],r["scroll"+t],i.body["offset"+t],r["offset"+t],r["client"+t])):s===e?Z.css(i,n,s,a):Z.style(i,n,s,a)},i,o?s:e,o,null)}})}),t.jQuery=t.$=Z,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Z})}(window),function(){var t=this,e=t._,i={},n=Array.prototype,s=Object.prototype,r=Function.prototype,o=n.push,a=n.slice,l=n.concat,h=s.toString,c=s.hasOwnProperty,u=n.forEach,d=n.map,p=n.reduce,f=n.reduceRight,m=n.filter,g=n.every,v=n.some,y=n.indexOf,b=n.lastIndexOf,x=Array.isArray,w=Object.keys,k=r.bind,_=function(t){return t instanceof _?t:this instanceof _?(this._wrapped=t,void 0):new _(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=_),exports._=_):t._=_,_.VERSION="1.4.4";var C=_.each=_.forEach=function(t,e,n){if(null!=t)if(u&&t.forEach===u)t.forEach(e,n);else if(t.length===+t.length){for(var s=0,r=t.length;r>s;s++)if(e.call(n,t[s],s,t)===i)return}else for(var o in t)if(_.has(t,o)&&e.call(n,t[o],o,t)===i)return};_.map=_.collect=function(t,e,i){var n=[];return null==t?n:d&&t.map===d?t.map(e,i):(C(t,function(t,s,r){n[n.length]=e.call(i,t,s,r)}),n)};var D="Reduce of empty array with no initial value";_.reduce=_.foldl=_.inject=function(t,e,i,n){var s=arguments.length>2;if(null==t&&(t=[]),p&&t.reduce===p)return n&&(e=_.bind(e,n)),s?t.reduce(e,i):t.reduce(e);if(C(t,function(t,r,o){s?i=e.call(n,i,t,r,o):(i=t,s=!0)}),!s)throw new TypeError(D);return i},_.reduceRight=_.foldr=function(t,e,i,n){var s=arguments.length>2;if(null==t&&(t=[]),f&&t.reduceRight===f)return n&&(e=_.bind(e,n)),s?t.reduceRight(e,i):t.reduceRight(e);var r=t.length;if(r!==+r){var o=_.keys(t);r=o.length}if(C(t,function(a,l,h){l=o?o[--r]:--r,s?i=e.call(n,i,t[l],l,h):(i=t[l],s=!0)}),!s)throw new TypeError(D);return i},_.find=_.detect=function(t,e,i){var n;return M(t,function(t,s,r){return e.call(i,t,s,r)?(n=t,!0):void 0}),n},_.filter=_.select=function(t,e,i){var n=[];return null==t?n:m&&t.filter===m?t.filter(e,i):(C(t,function(t,s,r){e.call(i,t,s,r)&&(n[n.length]=t)}),n)},_.reject=function(t,e,i){return _.filter(t,function(t,n,s){return!e.call(i,t,n,s)},i)},_.every=_.all=function(t,e,n){e||(e=_.identity);var s=!0;return null==t?s:g&&t.every===g?t.every(e,n):(C(t,function(t,r,o){return(s=s&&e.call(n,t,r,o))?void 0:i}),!!s)};var M=_.some=_.any=function(t,e,n){e||(e=_.identity);var s=!1;return null==t?s:v&&t.some===v?t.some(e,n):(C(t,function(t,r,o){return s||(s=e.call(n,t,r,o))?i:void 0}),!!s)};_.contains=_.include=function(t,e){return null==t?!1:y&&t.indexOf===y?-1!=t.indexOf(e):M(t,function(t){return t===e})},_.invoke=function(t,e){var i=a.call(arguments,2),n=_.isFunction(e);return _.map(t,function(t){return(n?e:t[e]).apply(t,i)})},_.pluck=function(t,e){return _.map(t,function(t){return t[e]})},_.where=function(t,e,i){return _.isEmpty(e)?i?null:[]:_[i?"find":"filter"](t,function(t){for(var i in e)if(e[i]!==t[i])return!1;return!0})},_.findWhere=function(t,e){return _.where(t,e,!0)},_.max=function(t,e,i){if(!e&&_.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&_.isEmpty(t))return-1/0;var n={computed:-1/0,value:-1/0};return C(t,function(t,s,r){var o=e?e.call(i,t,s,r):t;o>=n.computed&&(n={value:t,computed:o})}),n.value},_.min=function(t,e,i){if(!e&&_.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&_.isEmpty(t))return 1/0;var n={computed:1/0,value:1/0};return C(t,function(t,s,r){var o=e?e.call(i,t,s,r):t;o<n.computed&&(n={value:t,computed:o})}),n.value},_.shuffle=function(t){var e,i=0,n=[];return C(t,function(t){e=_.random(i++),n[i-1]=n[e],n[e]=t}),n};var T=function(t){return _.isFunction(t)?t:function(e){return e[t]}};_.sortBy=function(t,e,i){var n=T(e);return _.pluck(_.map(t,function(t,e,s){return{value:t,index:e,criteria:n.call(i,t,e,s)}}).sort(function(t,e){var i=t.criteria,n=e.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(n>i||void 0===n)return-1}return t.index<e.index?-1:1}),"value")};var S=function(t,e,i,n){var s={},r=T(e||_.identity);return C(t,function(e,o){var a=r.call(i,e,o,t);n(s,a,e)}),s};_.groupBy=function(t,e,i){return S(t,e,i,function(t,e,i){(_.has(t,e)?t[e]:t[e]=[]).push(i)})},_.countBy=function(t,e,i){return S(t,e,i,function(t,e){_.has(t,e)||(t[e]=0),t[e]++
383
- })},_.sortedIndex=function(t,e,i,n){i=null==i?_.identity:T(i);for(var s=i.call(n,e),r=0,o=t.length;o>r;){var a=r+o>>>1;i.call(n,t[a])<s?r=a+1:o=a}return r},_.toArray=function(t){return t?_.isArray(t)?a.call(t):t.length===+t.length?_.map(t,_.identity):_.values(t):[]},_.size=function(t){return null==t?0:t.length===+t.length?t.length:_.keys(t).length},_.first=_.head=_.take=function(t,e,i){return null==t?void 0:null==e||i?t[0]:a.call(t,0,e)},_.initial=function(t,e,i){return a.call(t,0,t.length-(null==e||i?1:e))},_.last=function(t,e,i){return null==t?void 0:null==e||i?t[t.length-1]:a.call(t,Math.max(t.length-e,0))},_.rest=_.tail=_.drop=function(t,e,i){return a.call(t,null==e||i?1:e)},_.compact=function(t){return _.filter(t,_.identity)};var A=function(t,e,i){return C(t,function(t){_.isArray(t)?e?o.apply(i,t):A(t,e,i):i.push(t)}),i};_.flatten=function(t,e){return A(t,e,[])},_.without=function(t){return _.difference(t,a.call(arguments,1))},_.uniq=_.unique=function(t,e,i,n){_.isFunction(e)&&(n=i,i=e,e=!1);var s=i?_.map(t,i,n):t,r=[],o=[];return C(s,function(i,n){(e?n&&o[o.length-1]===i:_.contains(o,i))||(o.push(i),r.push(t[n]))}),r},_.union=function(){return _.uniq(l.apply(n,arguments))},_.intersection=function(t){var e=a.call(arguments,1);return _.filter(_.uniq(t),function(t){return _.every(e,function(e){return _.indexOf(e,t)>=0})})},_.difference=function(t){var e=l.apply(n,a.call(arguments,1));return _.filter(t,function(t){return!_.contains(e,t)})},_.zip=function(){for(var t=a.call(arguments),e=_.max(_.pluck(t,"length")),i=new Array(e),n=0;e>n;n++)i[n]=_.pluck(t,""+n);return i},_.object=function(t,e){if(null==t)return{};for(var i={},n=0,s=t.length;s>n;n++)e?i[t[n]]=e[n]:i[t[n][0]]=t[n][1];return i},_.indexOf=function(t,e,i){if(null==t)return-1;var n=0,s=t.length;if(i){if("number"!=typeof i)return n=_.sortedIndex(t,e),t[n]===e?n:-1;n=0>i?Math.max(0,s+i):i}if(y&&t.indexOf===y)return t.indexOf(e,i);for(;s>n;n++)if(t[n]===e)return n;return-1},_.lastIndexOf=function(t,e,i){if(null==t)return-1;var n=null!=i;if(b&&t.lastIndexOf===b)return n?t.lastIndexOf(e,i):t.lastIndexOf(e);for(var s=n?i:t.length;s--;)if(t[s]===e)return s;return-1},_.range=function(t,e,i){arguments.length<=1&&(e=t||0,t=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((e-t)/i),0),s=0,r=new Array(n);n>s;)r[s++]=t,t+=i;return r},_.bind=function(t,e){if(t.bind===k&&k)return k.apply(t,a.call(arguments,1));var i=a.call(arguments,2);return function(){return t.apply(e,i.concat(a.call(arguments)))}},_.partial=function(t){var e=a.call(arguments,1);return function(){return t.apply(this,e.concat(a.call(arguments)))}},_.bindAll=function(t){var e=a.call(arguments,1);return 0===e.length&&(e=_.functions(t)),C(e,function(e){t[e]=_.bind(t[e],t)}),t},_.memoize=function(t,e){var i={};return e||(e=_.identity),function(){var n=e.apply(this,arguments);return _.has(i,n)?i[n]:i[n]=t.apply(this,arguments)}},_.delay=function(t,e){var i=a.call(arguments,2);return setTimeout(function(){return t.apply(null,i)},e)},_.defer=function(t){return _.delay.apply(_,[t,1].concat(a.call(arguments,1)))},_.throttle=function(t,e){var i,n,s,r,o=0,a=function(){o=new Date,s=null,r=t.apply(i,n)};return function(){var l=new Date,h=e-(l-o);return i=this,n=arguments,0>=h?(clearTimeout(s),s=null,o=l,r=t.apply(i,n)):s||(s=setTimeout(a,h)),r}},_.debounce=function(t,e,i){var n,s;return function(){var r=this,o=arguments,a=function(){n=null,i||(s=t.apply(r,o))},l=i&&!n;return clearTimeout(n),n=setTimeout(a,e),l&&(s=t.apply(r,o)),s}},_.once=function(t){var e,i=!1;return function(){return i?e:(i=!0,e=t.apply(this,arguments),t=null,e)}},_.wrap=function(t,e){return function(){var i=[t];return o.apply(i,arguments),e.apply(this,i)}},_.compose=function(){var t=arguments;return function(){for(var e=arguments,i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},_.after=function(t,e){return 0>=t?e():function(){return--t<1?e.apply(this,arguments):void 0}},_.keys=w||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var i in t)_.has(t,i)&&(e[e.length]=i);return e},_.values=function(t){var e=[];for(var i in t)_.has(t,i)&&e.push(t[i]);return e},_.pairs=function(t){var e=[];for(var i in t)_.has(t,i)&&e.push([i,t[i]]);return e},_.invert=function(t){var e={};for(var i in t)_.has(t,i)&&(e[t[i]]=i);return e},_.functions=_.methods=function(t){var e=[];for(var i in t)_.isFunction(t[i])&&e.push(i);return e.sort()},_.extend=function(t){return C(a.call(arguments,1),function(e){if(e)for(var i in e)t[i]=e[i]}),t},_.pick=function(t){var e={},i=l.apply(n,a.call(arguments,1));return C(i,function(i){i in t&&(e[i]=t[i])}),e},_.omit=function(t){var e={},i=l.apply(n,a.call(arguments,1));for(var s in t)_.contains(i,s)||(e[s]=t[s]);return e},_.defaults=function(t){return C(a.call(arguments,1),function(e){if(e)for(var i in e)null==t[i]&&(t[i]=e[i])}),t},_.clone=function(t){return _.isObject(t)?_.isArray(t)?t.slice():_.extend({},t):t},_.tap=function(t,e){return e(t),t};var E=function(t,e,i,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof _&&(t=t._wrapped),e instanceof _&&(e=e._wrapped);var s=h.call(t);if(s!=h.call(e))return!1;switch(s){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var r=i.length;r--;)if(i[r]==t)return n[r]==e;i.push(t),n.push(e);var o=0,a=!0;if("[object Array]"==s){if(o=t.length,a=o==e.length)for(;o--&&(a=E(t[o],e[o],i,n)););}else{var l=t.constructor,c=e.constructor;if(l!==c&&!(_.isFunction(l)&&l instanceof l&&_.isFunction(c)&&c instanceof c))return!1;for(var u in t)if(_.has(t,u)&&(o++,!(a=_.has(e,u)&&E(t[u],e[u],i,n))))break;if(a){for(u in e)if(_.has(e,u)&&!o--)break;a=!o}}return i.pop(),n.pop(),a};_.isEqual=function(t,e){return E(t,e,[],[])},_.isEmpty=function(t){if(null==t)return!0;if(_.isArray(t)||_.isString(t))return 0===t.length;for(var e in t)if(_.has(t,e))return!1;return!0},_.isElement=function(t){return!(!t||1!==t.nodeType)},_.isArray=x||function(t){return"[object Array]"==h.call(t)},_.isObject=function(t){return t===Object(t)},C(["Arguments","Function","String","Number","Date","RegExp"],function(t){_["is"+t]=function(e){return h.call(e)=="[object "+t+"]"}}),_.isArguments(arguments)||(_.isArguments=function(t){return!(!t||!_.has(t,"callee"))}),"function"!=typeof/./&&(_.isFunction=function(t){return"function"==typeof t}),_.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},_.isNaN=function(t){return _.isNumber(t)&&t!=+t},_.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==h.call(t)},_.isNull=function(t){return null===t},_.isUndefined=function(t){return void 0===t},_.has=function(t,e){return c.call(t,e)},_.noConflict=function(){return t._=e,this},_.identity=function(t){return t},_.times=function(t,e,i){for(var n=Array(t),s=0;t>s;s++)n[s]=e.call(i,s);return n},_.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var F={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};F.unescape=_.invert(F.escape);var I={escape:new RegExp("["+_.keys(F.escape).join("")+"]","g"),unescape:new RegExp("("+_.keys(F.unescape).join("|")+")","g")};_.each(["escape","unescape"],function(t){_[t]=function(e){return null==e?"":(""+e).replace(I[t],function(e){return F[t][e]})}}),_.result=function(t,e){if(null==t)return null;var i=t[e];return _.isFunction(i)?i.call(t):i},_.mixin=function(t){C(_.functions(t),function(e){var i=_[e]=t[e];_.prototype[e]=function(){var t=[this._wrapped];return o.apply(t,arguments),P.call(this,i.apply(_,t))}})};var L=0;_.uniqueId=function(t){var e=++L+"";return t?t+e:e},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,$={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;_.template=function(t,e,i){var n;i=_.defaults({},i,_.templateSettings);var s=new RegExp([(i.escape||N).source,(i.interpolate||N).source,(i.evaluate||N).source].join("|")+"|$","g"),r=0,o="__p+='";t.replace(s,function(e,i,n,s,a){return o+=t.slice(r,a).replace(z,function(t){return"\\"+$[t]}),i&&(o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(o+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),s&&(o+="';\n"+s+"\n__p+='"),r=a+e.length,e}),o+="';\n",i.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{n=new Function(i.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(e)return n(e,_);var l=function(t){return n.call(this,t,_)};return l.source="function("+(i.variable||"obj")+"){\n"+o+"}",l},_.chain=function(t){return _(t).chain()};var P=function(t){return this._chain?_(t).chain():t};_.mixin(_),C(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=n[t];_.prototype[t]=function(){var i=this._wrapped;return e.apply(i,arguments),"shift"!=t&&"splice"!=t||0!==i.length||delete i[0],P.call(this,i)}}),C(["concat","join","slice"],function(t){var e=n[t];_.prototype[t]=function(){return P.call(this,e.apply(this._wrapped,arguments))}}),_.extend(_.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(t){return function(){var e;return e||t._}}(this)),function(){var t,e=this,i=e.Backbone,n=Array.prototype.slice,s=Array.prototype.splice;t="undefined"!=typeof exports?exports:e.Backbone={},t.VERSION="0.9.2";var r=e._;r||"undefined"==typeof require||(r=require("underscore"));var o=e.jQuery||e.Zepto||e.ender;t.setDomLibrary=function(t){o=t},t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var a=/\s+/,l=t.Events={on:function(t,e,i){var n,s,r,o,l;if(!e)return this;for(t=t.split(a),n=this._callbacks||(this._callbacks={});s=t.shift();)l=n[s],r=l?l.tail:{},r.next=o={},r.context=i,r.callback=e,n[s]={tail:o,next:l?l.next:r};return this},off:function(t,e,i){var n,s,o,l,h,c;if(s=this._callbacks){if(!(t||e||i))return delete this._callbacks,this;for(t=t?t.split(a):r.keys(s);n=t.shift();)if(o=s[n],delete s[n],o&&(e||i))for(l=o.tail;(o=o.next)!==l;)h=o.callback,c=o.context,(e&&h!==e||i&&c!==i)&&this.on(n,h,c);return this}},trigger:function(t){var e,i,s,r,o,l,h;if(!(s=this._callbacks))return this;for(l=s.all,t=t.split(a),h=n.call(arguments,1);e=t.shift();){if(i=s[e])for(r=i.tail;(i=i.next)!==r;)i.callback.apply(i.context||this,h);if(i=l)for(r=i.tail,o=[e].concat(h);(i=i.next)!==r;)i.callback.apply(i.context||this,o)}return this}};l.bind=l.on,l.unbind=l.off;var h=t.Model=function(t,e){var i;t||(t={}),e&&e.parse&&(t=this.parse(t)),(i=M(this,"defaults"))&&(t=r.extend({},i,t)),e&&e.collection&&(this.collection=e.collection),this.attributes={},this._escapedAttributes={},this.cid=r.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(t,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=r.clone(this.attributes),this.initialize.apply(this,arguments)};r.extend(h.prototype,l,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return r.clone(this.attributes)},get:function(t){return this.attributes[t]},escape:function(t){var e;if(e=this._escapedAttributes[t])return e;var i=this.get(t);return this._escapedAttributes[t]=r.escape(null==i?"":""+i)},has:function(t){return null!=this.get(t)},set:function(t,e,i){var n,s,o;if(r.isObject(t)||null==t?(n=t,i=e):(n={},n[t]=e),i||(i={}),!n)return this;if(n instanceof h&&(n=n.attributes),i.unset)for(s in n)n[s]=void 0;if(!this._validate(n,i))return!1;this.idAttribute in n&&(this.id=n[this.idAttribute]);var a=i.changes={},l=this.attributes,c=this._escapedAttributes,u=this._previousAttributes||{};for(s in n)o=n[s],(!r.isEqual(l[s],o)||i.unset&&r.has(l,s))&&(delete c[s],(i.silent?this._silent:a)[s]=!0),i.unset?delete l[s]:l[s]=o,r.isEqual(u[s],o)&&r.has(l,s)==r.has(u,s)?(delete this.changed[s],delete this._pending[s]):(this.changed[s]=o,i.silent||(this._pending[s]=!0));return i.silent||this.change(i),this},unset:function(t,e){return(e||(e={})).unset=!0,this.set(t,null,e)},clear:function(t){return(t||(t={})).unset=!0,this.set(r.clone(this.attributes),t)},fetch:function(e){e=e?r.clone(e):{};var i=this,n=e.success;return e.success=function(t,s,r){return i.set(i.parse(t,r),e)?(n&&n(i,t),void 0):!1},e.error=t.wrapError(e.error,i,e),(this.sync||t.sync).call(this,"read",this,e)},save:function(e,i,n){var s,o;if(r.isObject(e)||null==e?(s=e,n=i):(s={},s[e]=i),n=n?r.clone(n):{},n.wait){if(!this._validate(s,n))return!1;o=r.clone(this.attributes)}var a=r.extend({},n,{silent:!0});if(s&&!this.set(s,n.wait?a:n))return!1;var l=this,h=n.success;n.success=function(t,e,i){var o=l.parse(t,i);return n.wait&&(delete n.wait,o=r.extend(s||{},o)),l.set(o,n)?(h?h(l,t):l.trigger("sync",l,t,n),void 0):!1},n.error=t.wrapError(n.error,l,n);var c=this.isNew()?"create":"update",u=(this.sync||t.sync).call(this,c,this,n);return n.wait&&this.set(o,a),u},destroy:function(e){e=e?r.clone(e):{};var i=this,n=e.success,s=function(){i.trigger("destroy",i,i.collection,e)};if(this.isNew())return s(),!1;e.success=function(t){e.wait&&s(),n?n(i,t):i.trigger("sync",i,t,e)},e.error=t.wrapError(e.error,i,e);var o=(this.sync||t.sync).call(this,"delete",this,e);return e.wait||s(),o},url:function(){var t=M(this,"urlRoot")||M(this.collection,"url")||T();return this.isNew()?t:t+("/"==t.charAt(t.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(t){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(t){t||(t={});var e=this._changing;this._changing=!0;for(var i in this._silent)this._pending[i]=!0;var n=r.extend({},t.changes,this._silent);this._silent={};for(var i in n)this.trigger("change:"+i,this,this.get(i),t);if(e)return this;for(;!r.isEmpty(this._pending);){this._pending={},this.trigger("change",this,t);for(var i in this.changed)this._pending[i]||this._silent[i]||delete this.changed[i];this._previousAttributes=r.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(t){return arguments.length?r.has(this.changed,t):!r.isEmpty(this.changed)},changedAttributes:function(t){if(!t)return this.hasChanged()?r.clone(this.changed):!1;var e,i=!1,n=this._previousAttributes;for(var s in t)r.isEqual(n[s],e=t[s])||((i||(i={}))[s]=e);return i},previous:function(t){return arguments.length&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return r.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(t,e){if(e.silent||!this.validate)return!0;t=r.extend({},this.attributes,t);var i=this.validate(t,e);return i?(e&&e.error?e.error(this,i,e):this.trigger("error",this,i,e),!1):!0}});var c=t.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,{silent:!0,parse:e.parse})};r.extend(c.prototype,l,{model:h,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},add:function(t,e){var i,n,o,a,l,h,c={},u={},d=[];for(e||(e={}),t=r.isArray(t)?t.slice():[t],i=0,o=t.length;o>i;i++){if(!(a=t[i]=this._prepareModel(t[i],e)))throw new Error("Can't add an invalid model to a collection");l=a.cid,h=a.id,c[l]||this._byCid[l]||null!=h&&(u[h]||this._byId[h])?d.push(i):c[l]=u[h]=a}for(i=d.length;i--;)t.splice(d[i],1);for(i=0,o=t.length;o>i;i++)(a=t[i]).on("all",this._onModelEvent,this),this._byCid[a.cid]=a,null!=a.id&&(this._byId[a.id]=a);if(this.length+=o,n=null!=e.at?e.at:this.models.length,s.apply(this.models,[n,0].concat(t)),this.comparator&&this.sort({silent:!0}),e.silent)return this;for(i=0,o=this.models.length;o>i;i++)c[(a=this.models[i]).cid]&&(e.index=i,a.trigger("add",a,this,e));return this},remove:function(t,e){var i,n,s,o;for(e||(e={}),t=r.isArray(t)?t.slice():[t],i=0,n=t.length;n>i;i++)o=this.getByCid(t[i])||this.get(t[i]),o&&(delete this._byId[o.id],delete this._byCid[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,e.silent||(e.index=s,o.trigger("remove",o,this,e)),this._removeReference(o));return this},push:function(t,e){return t=this._prepareModel(t,e),this.add(t,e),t},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t),e},unshift:function(t,e){return t=this._prepareModel(t,e),this.add(t,r.extend({at:0},e)),t},shift:function(t){var e=this.at(0);return this.remove(e,t),e},get:function(t){return null==t?void 0:this._byId[null!=t.id?t.id:t]},getByCid:function(t){return t&&this._byCid[t.cid||t]},at:function(t){return this.models[t]},where:function(t){return r.isEmpty(t)?[]:this.filter(function(e){for(var i in t)if(t[i]!==e.get(i))return!1;return!0})},sort:function(t){if(t||(t={}),!this.comparator)throw new Error("Cannot sort a set without a comparator");var e=r.bind(this.comparator,this);return 1==this.comparator.length?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("reset",this,t),this},pluck:function(t){return r.map(this.models,function(e){return e.get(t)})},reset:function(t,e){t||(t=[]),e||(e={});for(var i=0,n=this.models.length;n>i;i++)this._removeReference(this.models[i]);return this._reset(),this.add(t,r.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),this},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var i=this,n=e.success;return e.success=function(t,s,r){i[e.add?"add":"reset"](i.parse(t,r),e),n&&n(i,t)},e.error=t.wrapError(e.error,i,e),(this.sync||t.sync).call(this,"read",this,e)},create:function(t,e){var i=this;if(e=e?r.clone(e):{},t=this._prepareModel(t,e),!t)return!1;e.wait||i.add(t,e);var n=e.success;return e.success=function(s,r){e.wait&&i.add(s,e),n?n(s,r):s.trigger("sync",t,r,e)},t.save(null,e),t},parse:function(t){return t},chain:function(){return r(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(t,e){if(e||(e={}),t instanceof h)t.collection||(t.collection=this);else{var i=t;e.collection=this,t=new this.model(i,e),t._validate(t.attributes,e)||(t=!1)}return t},_removeReference:function(t){this==t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,n){("add"!=t&&"remove"!=t||i==this)&&("destroy"==t&&this.remove(e,n),e&&t==="change:"+e.idAttribute&&(delete this._byId[e.previous(e.idAttribute)],this._byId[e.id]=e),this.trigger.apply(this,arguments))}});var u=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"];r.each(u,function(t){c.prototype[t]=function(){return r[t].apply(r,[this.models].concat(r.toArray(arguments)))}});var d=t.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},p=/:\w+/g,f=/\*\w+/g,m=/[-[\]{}()+?.,\\^$|#\s]/g;r.extend(d.prototype,l,{initialize:function(){},route:function(e,i,n){return t.history||(t.history=new g),r.isRegExp(e)||(e=this._routeToRegExp(e)),n||(n=this[i]),t.history.route(e,r.bind(function(s){var r=this._extractParameters(e,s);n&&n.apply(this,r),this.trigger.apply(this,["route:"+i].concat(r)),t.history.trigger("route",this,i,r)},this)),this},navigate:function(e,i){t.history.navigate(e,i)},_bindRoutes:function(){if(this.routes){var t=[];for(var e in this.routes)t.unshift([e,this.routes[e]]);for(var i=0,n=t.length;n>i;i++)this.route(t[i][0],t[i][1],this[t[i][1]])}},_routeToRegExp:function(t){return t=t.replace(m,"\\$&").replace(p,"([^/]+)").replace(f,"(.*?)"),new RegExp("^"+t+"$")},_extractParameters:function(t,e){return t.exec(e).slice(1)}});var g=t.History=function(){this.handlers=[],r.bindAll(this,"checkUrl")},v=/^[#\/]/,y=/msie [\w.]+/;g.started=!1,r.extend(g.prototype,l,{interval:50,getHash:function(t){var e=t?t.location:window.location,i=e.href.match(/#(.*)$/);return i?i[1]:""},getFragment:function(t,e){if(null==t)if(this._hasPushState||e){t=window.location.pathname;var i=window.location.search;i&&(t+=i)}else t=this.getHash();return t.indexOf(this.options.root)||(t=t.substr(this.options.root.length)),t.replace(v,"")},start:function(t){if(g.started)throw new Error("Backbone.history has already been started");g.started=!0,this.options=r.extend({},{root:"/"},this.options,t),this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&window.history&&window.history.pushState);var e=this.getFragment(),i=document.documentMode,n=y.exec(navigator.userAgent.toLowerCase())&&(!i||7>=i);n&&(this.iframe=o('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(e)),this._hasPushState?o(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!n?o(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=e;var s=window.location,a=s.pathname==this.options.root;return this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!a?(this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0):(this._wantsPushState&&this._hasPushState&&a&&s.hash&&(this.fragment=this.getHash().replace(v,""),window.history.replaceState({},document.title,s.protocol+"//"+s.host+this.options.root+this.fragment)),this.options.silent?void 0:this.loadUrl())},stop:function(){o(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),g.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(){var t=this.getFragment();return t==this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe))),t==this.fragment?!1:(this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash()),void 0)},loadUrl:function(t){var e=this.fragment=this.getFragment(t),i=r.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0});return i},navigate:function(t,e){if(!g.started)return!1;e&&e!==!0||(e={trigger:e});var i=(t||"").replace(v,"");this.fragment!=i&&(this._hasPushState?(0!=i.indexOf(this.options.root)&&(i=this.options.root+i),this.fragment=i,window.history[e.replace?"replaceState":"pushState"]({},document.title,i)):this._wantsHashChange?(this.fragment=i,this._updateHash(window.location,i,e.replace),this.iframe&&i!=this.getFragment(this.getHash(this.iframe))&&(e.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,i,e.replace))):window.location.assign(this.options.root+t),e.trigger&&this.loadUrl(t))},_updateHash:function(t,e,i){i?t.replace(t.toString().replace(/(javascript:|#).*$/,"")+"#"+e):t.hash=e}});var b=t.View=function(t){this.cid=r.uniqueId("view"),this._configure(t||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},x=/^(\S+)\s*(.*)$/,w=["model","collection","el","id","attributes","className","tagName"];r.extend(b.prototype,l,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(t,e,i){var n=document.createElement(t);return e&&o(n).attr(e),i&&o(n).html(i),n},setElement:function(t,e){return this.$el&&this.undelegateEvents(),this.$el=t instanceof o?t:o(t),this.el=this.$el[0],e!==!1&&this.delegateEvents(),this},delegateEvents:function(t){if(t||(t=M(this,"events"))){this.undelegateEvents();for(var e in t){var i=t[e];if(r.isFunction(i)||(i=this[t[e]]),!i)throw new Error('Method "'+t[e]+'" does not exist');var n=e.match(x),s=n[1],o=n[2];i=r.bind(i,this),s+=".delegateEvents"+this.cid,""===o?this.$el.bind(s,i):this.$el.delegate(o,s,i)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(t){this.options&&(t=r.extend({},this.options,t));for(var e=0,i=w.length;i>e;e++){var n=w[e];t[n]&&(this[n]=t[n])}this.options=t},_ensureElement:function(){if(this.el)this.setElement(this.el,!1);else{var t=M(this,"attributes")||{};this.id&&(t.id=this.id),this.className&&(t["class"]=this.className),this.setElement(this.make(this.tagName,t),!1)}}});var k=function(t,e){var i=D(this,t,e);return i.extend=this.extend,i};h.extend=c.extend=d.extend=b.extend=k;var _={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};t.sync=function(e,i,n){var s=_[e];n||(n={});var a={type:s,dataType:"json"};return n.url||(a.url=M(i,"url")||T()),n.data||!i||"create"!=e&&"update"!=e||(a.contentType="application/json",a.data=JSON.stringify(i.toJSON())),t.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),t.emulateHTTP&&("PUT"===s||"DELETE"===s)&&(t.emulateJSON&&(a.data._method=s),a.type="POST",a.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",s)}),"GET"===a.type||t.emulateJSON||(a.processData=!1),o.ajax(r.extend(a,n))},t.wrapError=function(t,e,i){return function(n,s){s=n===e?s:n,t?t(e,s,i):e.trigger("error",e,s,i)}};var C=function(){},D=function(t,e,i){var n;return n=e&&e.hasOwnProperty("constructor")?e.constructor:function(){t.apply(this,arguments)},r.extend(n,t),C.prototype=t.prototype,n.prototype=new C,e&&r.extend(n.prototype,e),i&&r.extend(n,i),n.prototype.constructor=n,n.__super__=t.prototype,n},M=function(t,e){return t&&t[e]?r.isFunction(t[e])?t[e]():t[e]:null},T=function(){throw new Error('A "url" property or function must be specified')}}.call(this),define("backbone",["underscore","jquery"],function(t){return function(){var e;return e||t.Backbone}}(this)),function(t,e){function i(){return(0|65536*(1+Math.random())).toString(16).substring(1)}function n(){return i()+i()+"-"+i()+"-"+i()+"-"+i()+"-"+i()+i()+i()}e.LocalStorage=window.Store=function(t){this.name=t;var e=this.localStorage().getItem(this.name);this.records=e&&e.split(",")||[]},t.extend(e.LocalStorage.prototype,{save:function(){this.localStorage().setItem(this.name,this.records.join(","))},create:function(t){return t.id||(t.id=n(),t.set(t.idAttribute,t.id)),this.localStorage().setItem(this.name+"-"+t.id,JSON.stringify(t)),this.records.push(t.id.toString()),this.save(),t.toJSON()},update:function(e){return this.localStorage().setItem(this.name+"-"+e.id,JSON.stringify(e)),t.include(this.records,e.id.toString())||this.records.push(e.id.toString()),this.save(),e.toJSON()},find:function(t){return JSON.parse(this.localStorage().getItem(this.name+"-"+t.id))},findAll:function(){return t(this.records).chain().map(function(t){return JSON.parse(this.localStorage().getItem(this.name+"-"+t))},this).compact().value()},destroy:function(e){return this.localStorage().removeItem(this.name+"-"+e.id),this.records=t.reject(this.records,function(t){return t==e.id.toString()}),this.save(),e},localStorage:function(){return localStorage}}),e.LocalStorage.sync=window.Store.sync=e.localSync=function(t,e,i){var n,s=e.localStorage||e.collection.localStorage,r=$.Deferred&&$.Deferred();switch(t){case"read":n=void 0!=e.id?s.find(e):s.findAll();break;case"create":n=s.create(e);break;case"update":n=s.update(e);break;case"delete":n=s.destroy(e)}return n?(i&&i.success&&i.success(n),r&&r.resolve()):(i&&i.error&&i.error("Record not found"),r&&r.reject()),r&&r.promise()},e.ajaxSync=e.sync,e.getSyncMethod=function(t){return t.localStorage||t.collection&&t.collection.localStorage?e.localSync:e.ajaxSync},e.sync=function(t,i,n){return e.getSyncMethod(i).apply(this,[t,i,n])}}(_,Backbone),define("backbone-localStorage",["backbone"],function(t){return function(){var e;return e||t.Backbone.LocalStorage}}(this)),function(t){"function"==typeof define&&define.amd?define("util/templar",["underscore","backbone","backbone-localStorage"],t):t(_,Backbone)}(function(t,e){var i={url:"public/templates/",ext:".hbs",version:"0.0.1",cache:!0,storage:new e.LocalStorage("Templar")};return e.Templar=function(n,s){var s="undefined"==typeof s?{}:s,r=s.ext?s.ext:i.ext,o=s.url?s.url:i.url,a=s.version?s.version:i.version,l="undefined"!=typeof s.cache?s.cache:i.cache,h=s.storage?s.storage:i.storage;this.render=function(t){if(!t.path)throw new Error("A template path is required.");t.el=t.el?t.el:document.body,c._render(t)},this.add=function(){if(!s.path)throw new Error("A template path is required.");c._add(s)};var c=new(e.Collection.extend({initialize:function(){this._loadTemplates()},templates:n,model:e.Model.extend({defaults:function(){return{path:null,content:null,version:a}},url:function(){var t=this.get("path")&&"undefined"!==this.get("path")?this.get("path"):"";return o+t+r},parse:function(t){return{content:t}}}),localStorage:h,_loadTemplates:function(){var e=this,i=this.localStorage.findAll();if(i.length>0&&i[0].version!==a&&(l=!1),l)for(var n=0;n<i.length;n++)this.add(i[n]);else t.each(i,function(t){e.localStorage.destroy(t)});if(this.templates)for(var n=0;n<this.templates.length;n++)this._add({path:this.templates[n]})},_createModel:function(t){var e=new this.model({path:t});return e},_add:function(t,e){var i=this.where({path:t.path});0==i.length&&(templateModel=this._createModel(t.path),$.ajax({url:o+t.path+r,async:!1,success:function(e){templateModel.set({content:e,path:t.path})}}),this.add(templateModel),this.create(templateModel.toJSON()),"function"==typeof e&&e())},_compile:function(t,e,i,n,s){var i=i?i:!1,r=Handlebars.compile(t);i?e.append(r(n)):e.html(r(n)),"function"==typeof s&&s()},_render:function(e){var i=this,n=this.where({path:e.path,version:a});n.length>0?this._compile(n[0].get("content"),e.el,e.append,e.data,e.cb):this._add(e,t.bind(function(){i._compile(templateModel.get("content"),e.el,e.append,e.data,e.cb)},this))}}))},e.Templar}),function(t){"function"==typeof define&&define.amd?define("backbone-mediator",["underscore","backbone"],t):t(_,Backbone)}(function(t,e){var i,n={},s=e.View.prototype.delegateEvents,r=e.View.prototype.undelegateEvents;return e.Mediator={subscribe:function(t,e,i,s){n[t]||(n[t]=[]),n[t].push({fn:e,context:i||this,once:s})},publish:function(t){if(n[t])for(var i,s=[].slice.call(arguments,1),r=0,o=n[t].length;o>r;r++)i=n[t][r],i.fn.apply(i.context,s),i.once&&(e.Mediator.unsubscribe(t,i.fn,i.context),r--)},unsubscribe:function(t,e,i){if(n[t])for(var s,r=0;r<n[t].length;r++)s=n[t][r],s.fn===e&&s.context===i&&(n[t].splice(r,1),r--)},unsubscribeChannel:function(t){if(n[t])for(var e,i=0;i<n[t].length;i++)e=n[t][i],n[t].splice(i,1),i--},subscribeOnce:function(t,i,n){e.Mediator.subscribe(t,i,n,!0)}},i={delegateEvents:function(){s.apply(this,arguments),this.setSubscriptions()},undelegateEvents:function(){r.apply(this,arguments),this.unsetSubscriptions()},subscriptions:{},setSubscriptions:function(i){i&&t.extend(this.subscriptions||{},i),i=i||this.subscriptions,i&&!t.isEmpty(i)&&(this.unsetSubscriptions(i),t.each(i,function(i,n){var s;i.$once&&(i=i.$once,s=!0),t.isString(i)&&(i=this[i]),e.Mediator.subscribe(n,i,this,s)},this))},unsetSubscriptions:function(i){i=i||this.subscriptions,i&&!t.isEmpty(i)&&t.each(i,function(i,n){t.isString(i)&&(i=this[i]),e.Mediator.unsubscribe(n,i.$once||i,this)},this)}},t.extend(e.View.prototype,i),t.extend(e.Mediator,{pub:e.Mediator.publish,sub:e.Mediator.subscribe}),e}),define("route/index",["backbone","backbone-mediator"],function(t){var e=t.Router.extend({initialize:function(t){this.app=t.app},routes:{"":"ecosystem",ecosystem:"ecosystem","dash/:id":"dashboard","dash/:id/expand/:mid":"dashboard","dash/:id/category/:cid":"category"},category:function(t,e){t=t?parseInt(t):t,e=e?parseInt(e):e,t&&this.app.category(t,e)},dashboard:function(t,e){t=t?parseInt(t):t,e=e?parseInt(e):e,t&&this.app.dashboard(t,e)
384
- },ecosystem:function(){this.navigate("ecosystem",{replace:!0}),this.app.ecosystem()}});return e}),this.Handlebars={},function(t){t.VERSION="1.0.rc.1",t.helpers={},t.partials={},t.registerHelper=function(t,e,i){i&&(e.not=i),this.helpers[t]=e},t.registerPartial=function(t,e){this.partials[t]=e},t.registerHelper("helperMissing",function(t){if(2===arguments.length)return void 0;throw new Error("Could not find property '"+t+"'")});var e=Object.prototype.toString,i="[object Function]";t.registerHelper("blockHelperMissing",function(n,s){var r=s.inverse||function(){},o=s.fn,a=e.call(n);return a===i&&(n=n.call(this)),n===!0?o(this):n===!1||null==n?r(this):"[object Array]"===a?n.length>0?t.helpers.each(n,s):r(this):o(n)}),t.K=function(){},t.createFrame=Object.create||function(e){t.K.prototype=e;var i=new t.K;return t.K.prototype=null,i},t.registerHelper("each",function(e,i){var n,s=i.fn,r=i.inverse,o="";if(i.data&&(n=t.createFrame(i.data)),e&&e.length>0)for(var a=0,l=e.length;l>a;a++)n&&(n.index=a),o+=s(e[a],{data:n});else o=r(this);return o}),t.registerHelper("if",function(n,s){var r=e.call(n);return r===i&&(n=n.call(this)),!n||t.Utils.isEmpty(n)?s.inverse(this):s.fn(this)}),t.registerHelper("unless",function(e,i){var n=i.fn,s=i.inverse;return i.fn=s,i.inverse=n,t.helpers["if"].call(this,e,i)}),t.registerHelper("with",function(t,e){return e.fn(t)}),t.registerHelper("log",function(e){t.log(e)})}(this.Handlebars);var handlebars=function(){function t(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,DATA:27,param:28,STRING:29,INTEGER:30,BOOLEAN:31,hashSegments:32,hashSegment:33,ID:34,EQUALS:35,pathSegments:36,SEP:37,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",27:"DATA",29:"STRING",30:"INTEGER",31:"BOOLEAN",34:"ID",35:"EQUALS",37:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[17,1],[25,2],[25,1],[28,1],[28,1],[28,1],[28,1],[28,1],[26,1],[32,2],[32,1],[33,3],[33,3],[33,3],[33,3],[33,3],[21,1],[36,3],[36,1]],performAction:function(t,e,i,n,s,r){var o=r.length-1;switch(s){case 1:return r[o-1];case 2:this.$=new n.ProgramNode(r[o-2],r[o]);break;case 3:this.$=new n.ProgramNode(r[o]);break;case 4:this.$=new n.ProgramNode([]);break;case 5:this.$=[r[o]];break;case 6:r[o-1].push(r[o]),this.$=r[o-1];break;case 7:this.$=new n.BlockNode(r[o-2],r[o-1].inverse,r[o-1],r[o]);break;case 8:this.$=new n.BlockNode(r[o-2],r[o-1],r[o-1].inverse,r[o]);break;case 9:this.$=r[o];break;case 10:this.$=r[o];break;case 11:this.$=new n.ContentNode(r[o]);break;case 12:this.$=new n.CommentNode(r[o]);break;case 13:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1]);break;case 14:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1]);break;case 15:this.$=r[o-1];break;case 16:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1]);break;case 17:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1],!0);break;case 18:this.$=new n.PartialNode(r[o-1]);break;case 19:this.$=new n.PartialNode(r[o-2],r[o-1]);break;case 20:break;case 21:this.$=[[r[o-2]].concat(r[o-1]),r[o]];break;case 22:this.$=[[r[o-1]].concat(r[o]),null];break;case 23:this.$=[[r[o-1]],r[o]];break;case 24:this.$=[[r[o]],null];break;case 25:this.$=[[new n.DataNode(r[o])],null];break;case 26:r[o-1].push(r[o]),this.$=r[o-1];break;case 27:this.$=[r[o]];break;case 28:this.$=r[o];break;case 29:this.$=new n.StringNode(r[o]);break;case 30:this.$=new n.IntegerNode(r[o]);break;case 31:this.$=new n.BooleanNode(r[o]);break;case 32:this.$=new n.DataNode(r[o]);break;case 33:this.$=new n.HashNode(r[o]);break;case 34:r[o-1].push(r[o]),this.$=r[o-1];break;case 35:this.$=[r[o]];break;case 36:this.$=[r[o-2],r[o]];break;case 37:this.$=[r[o-2],new n.StringNode(r[o])];break;case 38:this.$=[r[o-2],new n.IntegerNode(r[o])];break;case 39:this.$=[r[o-2],new n.BooleanNode(r[o])];break;case 40:this.$=[r[o-2],new n.DataNode(r[o])];break;case 41:this.$=new n.IdNode(r[o]);break;case 42:r[o-2].push(r[o]),this.$=r[o-2];break;case 43:this.$=[r[o]]}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,27:[1,24],34:[1,26],36:25},{17:27,21:23,27:[1,24],34:[1,26],36:25},{17:28,21:23,27:[1,24],34:[1,26],36:25},{17:29,21:23,27:[1,24],34:[1,26],36:25},{21:30,34:[1,26],36:25},{1:[2,1]},{6:31,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,32],21:23,27:[1,24],34:[1,26],36:25},{10:33,20:[1,34]},{10:35,20:[1,34]},{18:[1,36]},{18:[2,24],21:41,25:37,26:38,27:[1,45],28:39,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,25]},{18:[2,41],27:[2,41],29:[2,41],30:[2,41],31:[2,41],34:[2,41],37:[1,48]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],37:[2,43]},{18:[1,49]},{18:[1,50]},{18:[1,51]},{18:[1,52],21:53,34:[1,26],36:25},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:54,34:[1,26],36:25},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:41,26:55,27:[1,45],28:56,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,23]},{18:[2,27],27:[2,27],29:[2,27],30:[2,27],31:[2,27],34:[2,27]},{18:[2,33],33:57,34:[1,58]},{18:[2,28],27:[2,28],29:[2,28],30:[2,28],31:[2,28],34:[2,28]},{18:[2,29],27:[2,29],29:[2,29],30:[2,29],31:[2,29],34:[2,29]},{18:[2,30],27:[2,30],29:[2,30],30:[2,30],31:[2,30],34:[2,30]},{18:[2,31],27:[2,31],29:[2,31],30:[2,31],31:[2,31],34:[2,31]},{18:[2,32],27:[2,32],29:[2,32],30:[2,32],31:[2,32],34:[2,32]},{18:[2,35],34:[2,35]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],35:[1,59],37:[2,43]},{34:[1,60]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,61]},{18:[1,62]},{18:[2,21]},{18:[2,26],27:[2,26],29:[2,26],30:[2,26],31:[2,26],34:[2,26]},{18:[2,34],34:[2,34]},{35:[1,59]},{21:63,27:[1,67],29:[1,64],30:[1,65],31:[1,66],34:[1,26],36:25},{18:[2,42],27:[2,42],29:[2,42],30:[2,42],31:[2,42],34:[2,42],37:[2,42]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,36],34:[2,36]},{18:[2,37],34:[2,37]},{18:[2,38],34:[2,38]},{18:[2,39],34:[2,39]},{18:[2,40],34:[2,40]}],defaultActions:{16:[2,1],24:[2,25],38:[2,23],55:[2,21]},parseError:function(t){throw new Error(t)},parse:function(t){function e(){var t;return t=i.lexer.lex()||1,"number"!=typeof t&&(t=i.symbols_[t]||t),t}var i=this,n=[0],s=[null],r=[],o=this.table,a="",l=0,h=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var u=this.lexer.yylloc;r.push(u);var d=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,m,g,v,y,b,x,w,k={};;){if(m=n[n.length-1],this.defaultActions[m]?g=this.defaultActions[m]:((null===p||"undefined"==typeof p)&&(p=e()),g=o[m]&&o[m][p]),"undefined"==typeof g||!g.length||!g[0]){var _="";if(!c){w=[];for(y in o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");_=this.lexer.showPosition?"Parse error on line "+(l+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(_,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:u,expected:w})}}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(h=this.lexer.yyleng,a=this.lexer.yytext,l=this.lexer.yylineno,u=this.lexer.yylloc,c>0&&c--);break;case 2:if(b=this.productions_[g[1]][1],k.$=s[s.length-b],k._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},d&&(k._$.range=[r[r.length-(b||1)].range[0],r[r.length-1].range[1]]),v=this.performAction.call(k,a,h,l,this.yy,g[1],s,r),"undefined"!=typeof v)return v;b&&(n=n.slice(0,2*-1*b),s=s.slice(0,-1*b),r=r.slice(0,-1*b)),n.push(this.productions_[g[1]][0]),s.push(k.$),r.push(k._$),x=o[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}},i=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===n.length?this.yylloc.first_column:0)+n[n.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,i,n,s;this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),o=0;o<r.length&&(i=this._input.match(this.rules[r[o]]),!i||e&&!(i[0].length>e[0].length)||(e=i,n=o,this.options.flex));o++);return e?(s=e[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,r[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t?t:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return"undefined"!=typeof t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return t.options={},t.performAction=function(t,e,i,n){switch(i){case 0:if("\\"!==e.yytext.slice(-1)&&this.begin("mu"),"\\"===e.yytext.slice(-1)&&(e.yytext=e.yytext.substr(0,e.yyleng-1),this.begin("emu")),e.yytext)return 14;break;case 1:return 14;case 2:return"\\"!==e.yytext.slice(-1)&&this.popState(),"\\"===e.yytext.slice(-1)&&(e.yytext=e.yytext.substr(0,e.yyleng-1)),14;case 3:return 24;case 4:return 16;case 5:return 20;case 6:return 19;case 7:return 19;case 8:return 23;case 9:return 23;case 10:return e.yytext=e.yytext.substr(3,e.yyleng-5),this.popState(),15;case 11:return 22;case 12:return 35;case 13:return 34;case 14:return 34;case 15:return 37;case 16:break;case 17:return this.popState(),18;case 18:return this.popState(),18;case 19:return e.yytext=e.yytext.substr(1,e.yyleng-2).replace(/\\"/g,'"'),29;case 20:return e.yytext=e.yytext.substr(1,e.yyleng-2).replace(/\\"/g,'"'),29;case 21:return e.yytext=e.yytext.substr(1),27;case 22:return 31;case 23:return 31;case 24:return 30;case 25:return 34;case 26:return e.yytext=e.yytext.substr(1,e.yyleng-2),34;case 27:return"INVALID";case 28:return 5}},t.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],t.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],inclusive:!1},emu:{rules:[2],inclusive:!1},INITIAL:{rules:[0,1,28],inclusive:!0}},t}();return e.lexer=i,t.prototype=e,e.Parser=t,new t}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=handlebars,exports.Parser=handlebars.Parser,exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");var e;return e="undefined"!=typeof process?require("fs").readFileSync(require("path").resolve(t[1]),"utf8"):require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"}),exports.parser.parse(e)},"undefined"!=typeof module&&require.main===module&&exports.main("undefined"!=typeof process?process.argv.slice(1):require("system").args)),Handlebars.Parser=handlebars,Handlebars.parse=function(t){return Handlebars.Parser.yy=Handlebars.AST,Handlebars.Parser.parse(t)},Handlebars.print=function(t){return(new Handlebars.PrintVisitor).accept(t)},Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(){}},Handlebars.log=function(t,e){Handlebars.logger.log(t,e)},function(){Handlebars.AST={},Handlebars.AST.ProgramNode=function(t,e){this.type="program",this.statements=t,e&&(this.inverse=new Handlebars.AST.ProgramNode(e))},Handlebars.AST.MustacheNode=function(t,e,i){this.type="mustache",this.escaped=!i,this.hash=e;var n=this.id=t[0],s=this.params=t.slice(1),r=this.eligibleHelper=n.isSimple;this.isHelper=r&&(s.length||e)},Handlebars.AST.PartialNode=function(t,e){this.type="partial",this.id=t,this.context=e};var t=function(t,e){if(t.original!==e.original)throw new Handlebars.Exception(t.original+" doesn't match "+e.original)};Handlebars.AST.BlockNode=function(e,i,n,s){t(e.id,s),this.type="block",this.mustache=e,this.program=i,this.inverse=n,this.inverse&&!this.program&&(this.isInverse=!0)},Handlebars.AST.ContentNode=function(t){this.type="content",this.string=t},Handlebars.AST.HashNode=function(t){this.type="hash",this.pairs=t},Handlebars.AST.IdNode=function(t){this.type="ID",this.original=t.join(".");for(var e=[],i=0,n=0,s=t.length;s>n;n++){var r=t[n];".."===r?i++:"."===r||"this"===r?this.isScoped=!0:e.push(r)}this.parts=e,this.string=e.join("."),this.depth=i,this.isSimple=1===t.length&&!this.isScoped&&0===i},Handlebars.AST.DataNode=function(t){this.type="DATA",this.id=t},Handlebars.AST.StringNode=function(t){this.type="STRING",this.string=t},Handlebars.AST.IntegerNode=function(t){this.type="INTEGER",this.integer=t},Handlebars.AST.BooleanNode=function(t){this.type="BOOLEAN",this.bool=t},Handlebars.AST.CommentNode=function(t){this.type="comment",this.comment=t}}(),Handlebars.Exception=function(){var t=Error.prototype.constructor.apply(this,arguments);for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);this.message=t.message},Handlebars.Exception.prototype=new Error,Handlebars.SafeString=function(t){this.string=t},Handlebars.SafeString.prototype.toString=function(){return this.string.toString()},function(){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},e=/[&<>"'`]/g,i=/[&<>"'`]/,n=function(e){return t[e]||"&amp;"};Handlebars.Utils={escapeExpression:function(t){return t instanceof Handlebars.SafeString?t.toString():null==t||t===!1?"":i.test(t)?t.replace(e,n):t},isEmpty:function(t){return"undefined"==typeof t?!0:null===t?!0:t===!1?!0:"[object Array]"===Object.prototype.toString.call(t)&&0===t.length?!0:!1}}}(),Handlebars.Compiler=function(){},Handlebars.JavaScriptCompiler=function(){},function(t,e){t.prototype={compiler:t,disassemble:function(){for(var t,e,i,n=this.opcodes,s=[],r=0,o=n.length;o>r;r++)if(t=n[r],"DECLARE"===t.opcode)s.push("DECLARE "+t.name+"="+t.value);else{e=[];for(var a=0;a<t.args.length;a++)i=t.args[a],"string"==typeof i&&(i='"'+i.replace("\n","\\n")+'"'),e.push(i);s.push(t.opcode+" "+e.join(" "))}return s.join("\n")},guid:0,compile:function(t,e){this.children=[],this.depths={list:[]},this.options=e;var i=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},i)for(var n in i)this.options.knownHelpers[n]=i[n];return this.program(t)},accept:function(t){return this[t.type](t)},program:function(t){var e,i=t.statements;this.opcodes=[];for(var n=0,s=i.length;s>n;n++)e=i[n],this[e.type](e);return this.isSimple=1===s,this.depths.list=this.depths.list.sort(function(t,e){return t-e}),this},compileProgram:function(t){var e,i=(new this.compiler).compile(t,this.options),n=this.guid++;this.usePartial=this.usePartial||i.usePartial,this.children[n]=i;for(var s=0,r=i.depths.list.length;r>s;s++)e=i.depths.list[s],2>e||this.addDepth(e-1);return n},block:function(t){var e=t.mustache,i=t.program,n=t.inverse;i&&(i=this.compileProgram(i)),n&&(n=this.compileProgram(n));var s=this.classifyMustache(e);"helper"===s?this.helperMustache(e,i,n):"simple"===s?(this.simpleMustache(e),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("pushLiteral","{}"),this.opcode("blockValue")):(this.ambiguousMustache(e,i,n),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("pushLiteral","{}"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(t){var e,i,n=t.pairs;this.opcode("push","{}");for(var s=0,r=n.length;r>s;s++)e=n[s],i=e[1],this.accept(i),this.opcode("assignToHash",e[0])},partial:function(t){var e=t.id;this.usePartial=!0,t.context?this.ID(t.context):this.opcode("push","depth0"),this.opcode("invokePartial",e.original),this.opcode("append")},content:function(t){this.opcode("appendContent",t.string)},mustache:function(t){var e=this.options,i=this.classifyMustache(t);"simple"===i?this.simpleMustache(t):"helper"===i?this.helperMustache(t):this.ambiguousMustache(t),t.escaped&&!e.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(t,e,i){var n=t.id,s=n.parts[0];this.opcode("getContext",n.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),this.opcode("invokeAmbiguous",s)},simpleMustache:function(t){var e=t.id;"DATA"===e.type?this.DATA(e):e.parts.length?this.ID(e):(this.addDepth(e.depth),this.opcode("getContext",e.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperMustache:function(t,e,i){var n=this.setupFullMustacheParams(t,e,i),s=t.id.parts[0];if(this.options.knownHelpers[s])this.opcode("invokeKnownHelper",n.length,s);else{if(this.knownHelpersOnly)throw new Error("You specified knownHelpersOnly, but used the unknown helper "+s);this.opcode("invokeHelper",n.length,s)}},ID:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0];e?this.opcode("lookupOnContext",t.parts[0]):this.opcode("pushContext");for(var i=1,n=t.parts.length;n>i;i++)this.opcode("lookup",t.parts[i])},DATA:function(t){this.options.data=!0,this.opcode("lookupData",t.id)},STRING:function(t){this.opcode("pushString",t.string)},INTEGER:function(t){this.opcode("pushLiteral",t.integer)},BOOLEAN:function(t){this.opcode("pushLiteral",t.bool)},comment:function(){},opcode:function(t){this.opcodes.push({opcode:t,args:[].slice.call(arguments,1)})},declare:function(t,e){this.opcodes.push({opcode:"DECLARE",name:t,value:e})},addDepth:function(t){if(isNaN(t))throw new Error("EWOT");0!==t&&(this.depths[t]||(this.depths[t]=!0,this.depths.list.push(t)))},classifyMustache:function(t){var e=t.isHelper,i=t.eligibleHelper,n=this.options;if(i&&!e){var s=t.id.parts[0];n.knownHelpers[s]?e=!0:n.knownHelpersOnly&&(i=!1)}return e?"helper":i?"ambiguous":"simple"},pushParams:function(t){for(var e,i=t.length;i--;)e=t[i],this.options.stringParams?(e.depth&&this.addDepth(e.depth),this.opcode("getContext",e.depth||0),this.opcode("pushStringParam",e.string)):this[e.type](e)},setupMustacheParams:function(t){var e=t.params;return this.pushParams(e),t.hash?this.hash(t.hash):this.opcode("pushLiteral","{}"),e},setupFullMustacheParams:function(t,e,i){var n=t.params;return this.pushParams(n),this.opcode("pushProgram",e),this.opcode("pushProgram",i),t.hash?this.hash(t.hash):this.opcode("pushLiteral","{}"),n}};var i=function(t){this.value=t};e.prototype={nameLookup:function(t,i){return/^[0-9]+$/.test(i)?t+"["+i+"]":e.isValidJavaScriptVariableName(i)?t+"."+i:t+"['"+i+"']"},appendToBuffer:function(t){return this.environment.isSimple?"return "+t+";":"buffer += "+t+";"},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(t,e,i,n){this.environment=t,this.options=e||{},Handlebars.log(Handlebars.logger.DEBUG,this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!i,this.context=i||{programs:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.compileStack=[],this.compileChildren(t,e);var s,r=t.opcodes;for(this.i=0,o=r.length;this.i<o;this.i++)s=r[this.i],"DECLARE"===s.opcode?this[s.name]=s.value:this[s.opcode].apply(this,s.args);return this.createFunctionContext(n)},nextOpcode:function(){var t=this.environment.opcodes;return t[this.i+1],t[this.i+1]},eat:function(){this.i=this.i+1},preamble:function(){var t=[];if(this.isChild)t.push("");else{var e=this.namespace,i="helpers = helpers || "+e+".helpers;";this.environment.usePartial&&(i=i+" partials = partials || "+e+".partials;"),this.options.data&&(i+=" data = data || {};"),t.push(i)}this.environment.isSimple?t.push(""):t.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=t},createFunctionContext:function(t){var e=this.stackVars.concat(this.registers.list);if(e.length>0&&(this.source[1]=this.source[1]+", "+e.join(", ")),!this.isChild)for(var i in this.context.aliases)this.source[1]=this.source[1]+", "+i+"="+this.context.aliases[i];this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");for(var n=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"],s=0,r=this.environment.depths.list.length;r>s;s++)n.push("depth"+this.environment.depths.list[s]);if(t)return n.push(this.source.join("\n ")),Function.apply(this,n);var o="function "+(this.name||"")+"("+n.join(",")+") {\n "+this.source.join("\n ")+"}";return Handlebars.log(Handlebars.logger.DEBUG,o+"\n\n"),o},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var t=["depth0"];this.setupParams(0,t),this.replaceStack(function(e){return t.splice(1,0,e),e+" = blockHelperMissing.call("+t.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var t=["depth0"];this.setupParams(0,t);var e=this.topStack();t.splice(1,0,e),this.source.push("if (!"+this.lastHelper+") { "+e+" = blockHelperMissing.call("+t.join(", ")+"); }")},appendContent:function(t){this.source.push(this.appendToBuffer(this.quotedString(t)))},append:function(){var t=this.popStack();this.source.push("if("+t+" || "+t+" === 0) { "+this.appendToBuffer(t)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){var t=this.nextOpcode(),e="";this.context.aliases.escapeExpression="this.escapeExpression",t&&"appendContent"===t.opcode&&(e=" + "+this.quotedString(t.args[0]),this.eat(t)),this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+e))},getContext:function(t){this.lastContext!==t&&(this.lastContext=t)},lookupOnContext:function(t){this.pushStack(this.nameLookup("depth"+this.lastContext,t,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(t){return"typeof "+t+" === functionType ? "+t+"() : "+t})},lookup:function(t){this.replaceStack(function(e){return e+" == null || "+e+" === false ? "+e+" : "+this.nameLookup(e,t,"context")})},lookupData:function(t){this.pushStack(this.nameLookup("data",t,"data"))},pushStringParam:function(t){this.pushStackLiteral("depth"+this.lastContext),this.pushString(t)},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},push:function(t){this.pushStack(t)},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){null!=t?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},invokeHelper:function(t,e){this.context.aliases.helperMissing="helpers.helperMissing";var i=this.lastHelper=this.setupHelper(t,e);this.register("foundHelper",i.name),this.pushStack("foundHelper ? foundHelper.call("+i.callParams+") "+": helperMissing.call("+i.helperMissingParams+")")},invokeKnownHelper:function(t,e){var i=this.setupHelper(t,e);this.pushStack(i.name+".call("+i.callParams+")")},invokeAmbiguous:function(t){this.context.aliases.functionType='"function"',this.pushStackLiteral("{}");var e=this.setupHelper(0,t),i=this.lastHelper=this.nameLookup("helpers",t,"helper");this.register("foundHelper",i);var n=this.nameLookup("depth"+this.lastContext,t,"context"),s=this.nextStack();this.source.push("if (foundHelper) { "+s+" = foundHelper.call("+e.callParams+"); }"),this.source.push("else { "+s+" = "+n+"; "+s+" = typeof "+s+" === functionType ? "+s+"() : "+s+"; }")},invokePartial:function(t){var e=[this.nameLookup("partials",t,"partial"),"'"+t+"'",this.popStack(),"helpers","partials"];this.options.data&&e.push("data"),this.context.aliases.self="this",this.pushStack("self.invokePartial("+e.join(", ")+");")},assignToHash:function(t){var e=this.popStack(),i=this.topStack();this.source.push(i+"['"+t+"'] = "+e+";")},compiler:e,compileChildren:function(t,e){for(var i,n,s=t.children,r=0,o=s.length;o>r;r++){i=s[r],n=new this.compiler,this.context.programs.push("");var a=this.context.programs.length;i.index=a,i.name="program"+a,this.context.programs[a]=n.compile(i,e,this.context)}},programExpression:function(t){if(this.context.aliases.self="this",null==t)return"self.noop";for(var e,i=this.environment.children[t],n=i.depths.list,s=[i.index,i.name,"data"],r=0,o=n.length;o>r;r++)e=n[r],1===e?s.push("depth0"):s.push("depth"+(e-1));return 0===n.length?"self.program("+s.join(", ")+")":(s.shift(),"self.programWithDepth("+s.join(", ")+")")},register:function(t,e){this.useRegister(t),this.source.push(t+" = "+e+";")},useRegister:function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},pushStackLiteral:function(t){return this.compileStack.push(new i(t)),t},pushStack:function(t){return this.source.push(this.incrStack()+" = "+t+";"),this.compileStack.push("stack"+this.stackSlot),"stack"+this.stackSlot},replaceStack:function(t){var e=t.call(this,this.topStack());return this.source.push(this.topStack()+" = "+e+";"),"stack"+this.stackSlot},nextStack:function(){var t=this.incrStack();return this.compileStack.push("stack"+this.stackSlot),t},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),"stack"+this.stackSlot},popStack:function(){var t=this.compileStack.pop();return t instanceof i?t.value:(this.stackSlot--,t)},topStack:function(){var t=this.compileStack[this.compileStack.length-1];return t instanceof i?t.value:t},quotedString:function(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'},setupHelper:function(t,e){var i=[];this.setupParams(t,i);var n=this.nameLookup("helpers",e,"helper");return{params:i,name:n,callParams:["depth0"].concat(i).join(", "),helperMissingParams:["depth0",this.quotedString(e)].concat(i).join(", ")}},setupParams:function(t,e){var i,n,s,r=[],o=[];r.push("hash:"+this.popStack()),n=this.popStack(),s=this.popStack(),(s||n)&&(s||(this.context.aliases.self="this",s="self.noop"),n||(this.context.aliases.self="this",n="self.noop"),r.push("inverse:"+n),r.push("fn:"+s));for(var a=0;t>a;a++)i=this.popStack(),e.push(i),this.options.stringParams&&o.push(this.popStack());return this.options.stringParams&&r.push("contexts:["+o.join(",")+"]"),this.options.data&&r.push("data:data"),e.push("{"+r.join(",")+"}"),e.join(", ")}};for(var n="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),s=e.RESERVED_WORDS={},r=0,o=n.length;o>r;r++)s[n[r]]=!0;
385
- e.isValidJavaScriptVariableName=function(t){return!e.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(t)?!0:!1}}(Handlebars.Compiler,Handlebars.JavaScriptCompiler),Handlebars.precompile=function(t,e){e=e||{};var i=Handlebars.parse(t),n=(new Handlebars.Compiler).compile(i,e);return(new Handlebars.JavaScriptCompiler).compile(n,e)},Handlebars.compile=function(t,e){function i(){var i=Handlebars.parse(t),n=(new Handlebars.Compiler).compile(i,e),s=(new Handlebars.JavaScriptCompiler).compile(n,e,void 0,!0);return Handlebars.template(s)}e=e||{};var n;return function(t,e){return n||(n=i()),n.call(this,t,e)}},Handlebars.VM={template:function(t){var e={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(t,e,i){var n=this.programs[t];return i?Handlebars.VM.program(e,i):n?n:n=this.programs[t]=Handlebars.VM.program(e)},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(i,n){return n=n||{},t.call(e,Handlebars,i,n.helpers,n.partials,n.data)}},programWithDepth:function(t,e){var i=Array.prototype.slice.call(arguments,2);return function(n,s){return s=s||{},t.apply(this,[n,s.data||e].concat(i))}},program:function(t,e){return function(i,n){return n=n||{},t(i,n.data||e)}},noop:function(){return""},invokePartial:function(t,e,i,n,s,r){var o={helpers:n,partials:s,data:r};if(void 0===t)throw new Handlebars.Exception("The partial "+e+" could not be found");if(t instanceof Function)return t(i,o);if(Handlebars.compile)return s[e]=Handlebars.compile(t,{data:void 0!==r}),s[e](i,o);throw new Handlebars.Exception("The partial "+e+" could not be compiled when running in runtime-only mode")}},Handlebars.template=Handlebars.VM.template,define("handlebars",function(t){return function(){var e;return e||t.Handlebars}}(this)),define("highcharts",["jquery"],function(){return function(){function t(t,e){var i;t||(t={});for(i in e)t[i]=e[i];return t}function e(){for(var t=0,e=arguments,i=e.length,n={};i>t;t++)n[e[t++]]=e[t];return n}function i(t,e){return parseInt(t,e||10)}function n(t){return"string"==typeof t}function s(t){return"object"==typeof t}function r(t){return"[object Array]"===Object.prototype.toString.call(t)}function o(t){return"number"==typeof t}function a(t){return he.log(t)/he.LN10}function l(t){return he.pow(10,t)}function h(t,e){for(var i=t.length;i--;)if(t[i]===e){t.splice(i,1);break}}function c(t){return t!==j&&null!==t}function u(t,e,i){var r,o;if(n(e))c(i)?t.setAttribute(e,i):t&&t.getAttribute&&(o=t.getAttribute(e));else if(c(e)&&s(e))for(r in e)t.setAttribute(r,e[r]);return o}function d(t){return r(t)?t:[t]}function p(){var t,e,i=arguments,n=i.length;for(t=0;n>t;t++)if(e=i[t],"undefined"!=typeof e&&null!==e)return e}function f(e,i){ke&&i&&i.opacity!==j&&(i.filter="alpha(opacity="+100*i.opacity+")"),t(e.style,i)}function m(e,i,n,s,r){return e=ae.createElement(e),i&&t(e,i),r&&f(e,{padding:0,border:$e,margin:0}),n&&f(e,n),s&&s.appendChild(e),e}function g(e,i){var n=function(){};return n.prototype=new e,t(n.prototype,i),n}function v(t,e,n,s){var r=Y.lang,o=t;-1===e?(e=(t||0).toString(),t=e.indexOf(".")>-1?e.split(".")[1].length:0):t=isNaN(e=me(e))?2:e;var e=t,n=void 0===n?r.decimalPoint:n,s=void 0===s?r.thousandsSep:s,r=0>o?"-":"",t=String(i(o=me(+o||0).toFixed(e))),a=t.length>3?t.length%3:0;return r+(a?t.substr(0,a)+s:"")+t.substr(a).replace(/(\d{3})(?=\d)/g,"$1"+s)+(e?n+me(o-t).toFixed(e).slice(2):"")}function y(t,e){return Array((e||2)+1-String(t).length).join(0)+t}function b(t,e,i,n){var s,i=p(i,1);for(s=t/i,e||(e=[1,2,2.5,5,10],n&&n.allowDecimals===!1&&(1===i?e=[1,2,5,10]:.1>=i&&(e=[1/i]))),n=0;n<e.length&&(t=e[n],!(s<=(e[n]+(e[n+1]||e[n]))/2));n++);return t*=i}function x(t,e){var i,n=e||[[Pe,[1,2,5,10,20,25,50,100,200,500]],[Oe,[1,2,5,10,15,30]],[He,[1,2,5,10,15,30]],[We,[1,2,3,4,6,8,12]],[je,[1,2]],[Re,[1,2]],[Be,[1,2,3,4,6]],[Ye,null]],s=n[n.length-1],r=q[s[0]],o=s[1];for(i=0;i<n.length&&(s=n[i],r=q[s[0]],o=s[1],!(n[i+1]&&t<=(r*o[o.length-1]+q[n[i+1][0]])/2));i++);return r===q[Ye]&&5*r>t&&(o=[1,2,5]),r===q[Ye]&&5*r>t&&(o=[1,2,5]),n=b(t/r,o),{unitRange:r,count:n,unitName:s[0]}}function w(e,i,n,s){var r,o=[],a={},l=Y.global.useUTC,h=new Date(i),i=e.unitRange,c=e.count;i>=q[Oe]&&(h.setMilliseconds(0),h.setSeconds(i>=q[He]?0:c*ue(h.getSeconds()/c))),i>=q[He]&&h[ie](i>=q[We]?0:c*ue(h[K]()/c)),i>=q[We]&&h[ne](i>=q[je]?0:c*ue(h[J]()/c)),i>=q[je]&&h[se](i>=q[Be]?1:c*ue(h[Q]()/c)),i>=q[Be]&&(h[re](i>=q[Ye]?0:c*ue(h[te]()/c)),r=h[ee]()),i>=q[Ye]&&(r-=r%c,h[oe](r)),i===q[Re]&&h[se](h[Q]()-h[Z]()+p(s,1)),s=1,r=h[ee]();for(var u=h.getTime(),d=h[te](),f=h[Q](),h=l?0:(864e5+6e4*h.getTimezoneOffset())%864e5;n>u;)o.push(u),i===q[Ye]?u=X(r+s*c,0):i===q[Be]?u=X(r,d+s*c):l||i!==q[je]&&i!==q[Re]?(u+=i*c,i<=q[We]&&u%q[je]===h&&(a[u]=je)):u=X(r,d,f+s*c*(i===q[je]?1:7)),s++;return o.push(u),o.info=t(e,{higherRanks:a,totalRange:i*c}),o}function k(){this.symbol=this.color=0}function _(t,e){var i,n,s=t.length;for(n=0;s>n;n++)t[n].ss_i=n;for(t.sort(function(t,n){return i=e(t,n),0===i?t.ss_i-n.ss_i:i}),n=0;s>n;n++)delete t[n].ss_i}function C(t){for(var e=t.length,i=t[0];e--;)t[e]<i&&(i=t[e]);return i}function D(t){for(var e=t.length,i=t[0];e--;)t[e]>i&&(i=t[e]);return i}function M(t,e){for(var i in t)t[i]&&t[i]!==e&&t[i].destroy&&t[i].destroy(),delete t[i]}function T(t){B||(B=m(Ne)),t&&B.appendChild(t),B.innerHTML=""}function S(t,e){var i="Highcharts error #"+t+": www.highcharts.com/errors/"+t;if(e)throw i;le.console&&console.log(i)}function A(t){return parseFloat(t.toPrecision(14))}function E(t,e){U=p(t,e.animation)}function F(){var t=Y.global.useUTC,e=t?"getUTC":"get",i=t?"setUTC":"set";X=t?Date.UTC:function(t,e,i,n,s,r){return new Date(t,e,p(i,1),p(n,0),p(s,0),p(r,0)).getTime()},K=e+"Minutes",J=e+"Hours",Z=e+"Day",Q=e+"Date",te=e+"Month",ee=e+"FullYear",ie=i+"Minutes",ne=i+"Hours",se=i+"Date",re=i+"Month",oe=i+"FullYear"}function I(){}function L(t,e,i){this.axis=t,this.pos=e,this.type=i||"",this.isNew=!0,i||this.addLabel()}function N(t,e){return this.axis=t,e&&(this.options=e,this.id=e.id),this}function $(t,e,i,n,s,r){var o=t.chart.inverted;this.axis=t,this.isNegative=i,this.options=e,this.x=n,this.stack=s,this.percent="percent"===r,this.alignOptions={align:e.align||(o?i?"left":"right":"center"),verticalAlign:e.verticalAlign||(o?"middle":i?"bottom":"top"),y:p(e.y,o?4:i?14:-6),x:p(e.x,o?i?-6:6:0)},this.textAlign=e.textAlign||(o?i?"right":"left":"center")}function z(){this.init.apply(this,arguments)}function P(t,e){var n=e.borderWidth,s=e.style,r=i(s.padding);this.chart=t,this.options=e,this.crosshairs=[],this.now={x:0,y:0},this.isHidden=!0,this.label=t.renderer.label("",0,0,e.shape,null,null,e.useHTML,null,"tooltip").attr({padding:r,fill:e.backgroundColor,"stroke-width":n,r:e.borderRadius,zIndex:8}).css(s).css({padding:0}).hide().add(),Ae||this.label.shadow(e.shadow),this.shared=e.shared}function O(t,e){var i=Ae?"":e.chart.zoomType;this.zoomX=/x/.test(i),this.zoomY=/y/.test(i),this.options=e,this.chart=t,this.init(t,e.tooltip)}function H(t){this.init(t)}function W(t,e){var i,n=t.series;t.series=null,i=ei(Y,t),i.series=t.series=n;var n=i.chart,r=n.margin,r=s(r)?r:[r,r,r,r];this.optionsMarginTop=p(n.marginTop,r[0]),this.optionsMarginRight=p(n.marginRight,r[1]),this.optionsMarginBottom=p(n.marginBottom,r[2]),this.optionsMarginLeft=p(n.marginLeft,r[3]),this.runChartClick=(r=n.events)&&!!r.click,this.callback=e,this.isResizing=0,this.options=i,this.axes=[],this.series=[],this.hasCartesianSeries=n.showAxes,this.init(r)}var j,R,B,Y,V,U,G,q,X,K,J,Z,Q,te,ee,ie,ne,se,re,oe,ae=document,le=window,he=Math,ce=he.round,ue=he.floor,de=he.ceil,pe=he.max,fe=he.min,me=he.abs,ge=he.cos,ve=he.sin,ye=he.PI,be=2*ye/360,xe=navigator.userAgent,we=le.opera,ke=/msie/i.test(xe)&&!we,_e=8===ae.documentMode,Ce=/AppleWebKit/.test(xe),De=/Firefox/.test(xe),Me="http://www.w3.org/2000/svg",Te=!!ae.createElementNS&&!!ae.createElementNS(Me,"svg").createSVGRect,Se=De&&parseInt(xe.split("Firefox/")[1],10)<4,Ae=!Te&&!ke&&!!ae.createElement("canvas").getContext,Ee=ae.documentElement.ontouchstart!==j,Fe={},Ie=0,Le=function(){},Ne="div",$e="none",ze="rgba(192,192,192,"+(Te?1e-6:.002)+")",Pe="millisecond",Oe="second",He="minute",We="hour",je="day",Re="week",Be="month",Ye="year",Ve={};le.Highcharts={},V=function(t,e,i){if(!c(e)||isNaN(e))return"Invalid date";var n,t=p(t,"%Y-%m-%d %H:%M:%S"),s=new Date(e),r=s[J](),o=s[Z](),a=s[Q](),l=s[te](),h=s[ee](),u=Y.lang,d=u.weekdays,e={a:d[o].substr(0,3),A:d[o],d:y(a),e:a,b:u.shortMonths[l],B:u.months[l],m:y(l+1),y:h.toString().substr(2,2),Y:h,H:y(r),I:y(r%12||12),l:r%12||12,M:y(s[K]()),p:12>r?"AM":"PM",P:12>r?"am":"pm",S:y(s.getSeconds()),L:y(ce(e%1e3),3)};for(n in e)t=t.replace("%"+n,e[n]);return i?t.substr(0,1).toUpperCase()+t.substr(1):t},k.prototype={wrapColor:function(t){this.color>=t&&(this.color=0)},wrapSymbol:function(t){this.symbol>=t&&(this.symbol=0)}},q=e(Pe,1,Oe,1e3,He,6e4,We,36e5,je,864e5,Re,6048e5,Be,2592e6,Ye,31556952e3),G={init:function(t,e,i){var n,s,r,e=e||"",o=t.shift,a=e.indexOf("C")>-1,l=a?7:3,e=e.split(" "),i=[].concat(i),h=function(t){for(n=t.length;n--;)"M"===t[n]&&t.splice(n+1,0,t[n+1],t[n+2],t[n+1],t[n+2])};if(a&&(h(e),h(i)),t.isArea&&(s=e.splice(e.length-6,6),r=i.splice(i.length-6,6)),o<=i.length/l)for(;o--;)i=[].concat(i).splice(0,l).concat(i);if(t.shift=0,e.length)for(t=i.length;e.length<t;)o=[].concat(e).splice(e.length-l,l),a&&(o[l-6]=o[l-2],o[l-5]=o[l-1]),e=e.concat(o);return s&&(e=e.concat(s),i=i.concat(r)),[e,i]},step:function(t,e,i,n){var s=[],r=t.length;if(1===i)s=n;else if(r===e.length&&1>i)for(;r--;)n=parseFloat(t[r]),s[r]=isNaN(n)?t[r]:i*parseFloat(e[r]-n)+n;else s=e;return s}},function(e){le.HighchartsAdapter=le.HighchartsAdapter||e&&{init:function(t){var i,n=e.fx,s=n.step,r=e.Tween,o=r&&r.propHooks;e.extend(e.easing,{easeOutQuad:function(t,e,i,n,s){return-n*(e/=s)*(e-2)+i}}),e.each(["cur","_default","width","height"],function(t,e){var i,a,l=s;"cur"===e?l=n.prototype:"_default"===e&&r&&(l=o[e],e="set"),(i=l[e])&&(l[e]=function(n){return n=t?n:this,a=n.elem,a.attr?a.attr(n.prop,"cur"===e?j:n.now):i.apply(this,arguments)})}),i=function(e){var i,n=e.elem;e.started||(i=t.init(n,n.d,n.toD),e.start=i[0],e.end=i[1],e.started=!0),n.attr("d",t.step(e.start,e.end,e.pos,n.toD))},r?o.d={set:i}:s.d=i,this.each=Array.prototype.forEach?function(t,e){return Array.prototype.forEach.call(t,e)}:function(t,e){for(var i=0,n=t.length;n>i;i++)if(e.call(t[i],t[i],i,t)===!1)return i}},getScript:e.getScript,inArray:e.inArray,adapterRun:function(t,i){return e(t)[i]()},grep:e.grep,map:function(t,e){for(var i=[],n=0,s=t.length;s>n;n++)i[n]=e.call(t[n],t[n],n,t);return i},merge:function(){var t=arguments;return e.extend(!0,null,t[0],t[1],t[2],t[3])},offset:function(t){return e(t).offset()},addEvent:function(t,i,n){e(t).bind(i,n)},removeEvent:function(t,i,n){var s=ae.removeEventListener?"removeEventListener":"detachEvent";ae[s]&&!t[s]&&(t[s]=function(){}),e(t).unbind(i,n)},fireEvent:function(i,n,s,r){var o,a=e.Event(n),l="detached"+n;!ke&&s&&(delete s.layerX,delete s.layerY),t(a,s),i[n]&&(i[l]=i[n],i[n]=null),e.each(["preventDefault","stopPropagation"],function(t,e){var i=a[e];a[e]=function(){try{i.call(a)}catch(t){"preventDefault"===e&&(o=!0)}}}),e(i).trigger(a),i[l]&&(i[n]=i[l],i[l]=null),r&&!a.isDefaultPrevented()&&!o&&r(a)},washMouseEvent:function(t){var e=t.originalEvent||t;return e.pageX===j&&(e.pageX=t.pageX,e.pageY=t.pageY),e},animate:function(t,i,n){var s=e(t);i.d&&(t.toD=i.d,i.d=1),s.stop(),s.animate(i,n)},stop:function(t){e(t).stop()}}}(le.jQuery);var Ue=le.HighchartsAdapter,Ge=Ue||{};Ue&&Ue.init.call(Ue,G);var qe=Ge.adapterRun,Xe=Ge.getScript,Ke=Ge.inArray,Je=Ge.each,Ze=Ge.grep,Qe=Ge.offset,ti=Ge.map,ei=Ge.merge,ii=Ge.addEvent,ni=Ge.removeEvent,si=Ge.fireEvent,ri=Ge.washMouseEvent,oi=Ge.animate,ai=Ge.stop,Ge={enabled:!0,align:"center",x:0,y:15,style:{color:"#666",fontSize:"11px",lineHeight:"14px"}};Y={colors:"#4572A7,#AA4643,#89A54E,#80699B,#3D96AE,#DB843D,#92A8CD,#A47D7C,#B5CA92".split(","),symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),decimalPoint:".",numericSymbols:"k,M,G,T,P,E".split(","),resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:","},global:{useUTC:!0,canvasToolsURL:"http://code.highcharts.com/2.3.3/modules/canvas-tools.js",VMLRadialGradientURL:"http://code.highcharts.com/2.3.3/gfx/vml-radial-gradient.png"},chart:{borderColor:"#4572A7",borderRadius:5,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacingTop:10,spacingRight:10,spacingBottom:15,spacingLeft:10,style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0",resetZoomButton:{theme:{zIndex:20},position:{align:"right",x:-10,y:10}}},title:{text:"Chart title",align:"center",y:15,style:{color:"#3E576F",fontSize:"16px"}},subtitle:{text:"",align:"center",y:30,style:{color:"#6D869F"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1e3},events:{},lineWidth:2,shadow:!0,marker:{enabled:!0,lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{enabled:!0},select:{fillColor:"#FFFFFF",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:ei(Ge,{enabled:!1,formatter:function(){return this.y},verticalAlign:"bottom",y:0}),cropThreshold:300,pointRange:0,showInLegend:!0,states:{hover:{marker:{}},select:{marker:{}}},stickyTracking:!0}},labels:{style:{position:"absolute",color:"#3E576F"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderWidth:1,borderColor:"#909090",borderRadius:5,navigation:{activeColor:"#3E576F",inactiveColor:"#CCC"},shadow:!1,itemStyle:{cursor:"pointer",color:"#3E576F",fontSize:"12px"},itemHoverStyle:{color:"#000"},itemHiddenStyle:{color:"#CCC"},itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},symbolWidth:16,symbolPadding:5,verticalAlign:"bottom",x:0,y:0},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"1em"},style:{position:"absolute",backgroundColor:"white",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,backgroundColor:"rgba(255, 255, 255, .85)",borderWidth:2,borderRadius:5,dateTimeLabelFormats:{millisecond:"%A, %b %e, %H:%M:%S.%L",second:"%A, %b %e, %H:%M:%S",minute:"%A, %b %e, %H:%M",hour:"%A, %b %e, %H:%M",day:"%A, %b %e, %Y",week:"Week from %A, %b %e, %Y",month:"%B %Y",year:"%Y"},headerFormat:'<span style="font-size: 10px">{point.key}</span><br/>',pointFormat:'<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',shadow:!0,shared:Ae,snap:Ee?25:10,style:{color:"#333333",fontSize:"12px",padding:"5px",whiteSpace:"nowrap"}},credits:{enabled:!0,text:"Highcharts.com",href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"10px"}}};var li=Y.plotOptions,Ue=li.line;F();var hi=function(t){var e,n=[];return function(t){(e=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(t))?n=[i(e[1]),i(e[2]),i(e[3]),parseFloat(e[4],10)]:(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(t))&&(n=[i(e[1],16),i(e[2],16),i(e[3],16),1])}(t),{get:function(e){return n&&!isNaN(n[0])?"rgb"===e?"rgb("+n[0]+","+n[1]+","+n[2]+")":"a"===e?n[3]:"rgba("+n.join(",")+")":t},brighten:function(t){if(o(t)&&0!==t){var e;for(e=0;3>e;e++)n[e]+=i(255*t),n[e]<0&&(n[e]=0),n[e]>255&&(n[e]=255)}return this},setOpacity:function(t){return n[3]=t,this}}};I.prototype={init:function(t,e){this.element="span"===e?m(e):ae.createElementNS(Me,e),this.renderer=t,this.attrSetters={}},animate:function(t,e,i){e=p(e,U,!0),ai(this),e?(e=ei(e),i&&(e.complete=i),oi(this,t,e)):(this.attr(t),i&&i())},attr:function(t,e){var s,r,o,a,l,h,d,p=this.element,f=p.nodeName.toLowerCase(),m=this.renderer,g=this.attrSetters,v=this.shadows,y=this;if(n(t)&&c(e)&&(s=t,t={},t[s]=e),n(t))s=t,"circle"===f?s={x:"cx",y:"cy"}[s]||s:"strokeWidth"===s&&(s="stroke-width"),y=u(p,s)||this[s]||0,"d"!==s&&"visibility"!==s&&(y=parseFloat(y));else for(s in t)if(l=!1,r=t[s],o=g[s]&&g[s].call(this,r,s),o!==!1){if(o!==j&&(r=o),"d"===s)r&&r.join&&(r=r.join(" ")),/(NaN| {2}|^$)/.test(r)&&(r="M 0 0");else if("x"===s&&"text"===f){for(o=0;o<p.childNodes.length;o++)a=p.childNodes[o],u(a,"x")===u(p,"x")&&u(a,"x",r);this.rotation&&u(p,"transform","rotate("+this.rotation+" "+r+" "+i(t.y||u(p,"y"))+")")}else if("fill"===s)r=m.color(r,p,s);else if("circle"!==f||"x"!==s&&"y"!==s)if("rect"===f&&"r"===s)u(p,{rx:r,ry:r}),l=!0;else if("translateX"===s||"translateY"===s||"rotation"===s||"verticalAlign"===s)l=d=!0;else if("stroke"===s)r=m.color(r,p,s);else if("dashstyle"===s){if(s="stroke-dasharray",r=r&&r.toLowerCase(),"solid"===r)r=$e;else if(r){for(r=r.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(","),o=r.length;o--;)r[o]=i(r[o])*t["stroke-width"];r=r.join(",")}}else"isTracker"===s?this[s]=r:"width"===s?r=i(r):"align"===s?(s="text-anchor",r={left:"start",center:"middle",right:"end"}[r]):"title"===s&&(o=p.getElementsByTagName("title")[0],o||(o=ae.createElementNS(Me,"title"),p.appendChild(o)),o.textContent=r);else s={x:"cx",y:"cy"}[s]||s;if("strokeWidth"===s&&(s="stroke-width"),Ce&&"stroke-width"===s&&0===r&&(r=1e-6),this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(s)&&(h||(this.symbolAttr(t),h=!0),l=!0),v&&/^(width|height|visibility|x|y|d|transform)$/.test(s))for(o=v.length;o--;)u(v[o],s,"height"===s?pe(r-(v[o].cutHeight||0),0):r);("width"===s||"height"===s)&&"rect"===f&&0>r&&(r=0),this[s]=r,d&&this.updateTransform(),"text"===s?(r!==this.textStr&&delete this.bBox,this.textStr=r,this.added&&m.buildText(this)):l||u(p,s,r)}return y},symbolAttr:function(t){var e=this;Je("x,y,r,start,end,width,height,innerR,anchorX,anchorY".split(","),function(i){e[i]=p(t[i],e[i])}),e.attr({d:e.renderer.symbols[e.symbolName](e.x,e.y,e.width,e.height,e)})},clip:function(t){return this.attr("clip-path",t?"url("+this.renderer.url+"#"+t.id+")":$e)},crisp:function(t,e,i,n,s){var r,o,a={},l={},t=t||this.strokeWidth||this.attr&&this.attr("stroke-width")||0;o=ce(t)%2/2,l.x=ue(e||this.x||0)+o,l.y=ue(i||this.y||0)+o,l.width=ue((n||this.width||0)-2*o),l.height=ue((s||this.height||0)-2*o),l.strokeWidth=t;for(r in l)this[r]!==l[r]&&(this[r]=a[r]=l[r]);return a},css:function(e){var i,n=this.element,n=e&&e.width&&"text"===n.nodeName.toLowerCase(),s="",r=function(t,e){return"-"+e.toLowerCase()};if(e&&e.color&&(e.fill=e.color),this.styles=e=t(this.styles,e),Ae&&n&&delete e.width,ke&&!Te)n&&delete e.width,f(this.element,e);else{for(i in e)s+=i.replace(/([A-Z])/g,r)+":"+e[i]+";";this.attr({style:s})}return n&&this.added&&this.renderer.buildText(this),this},on:function(t,e){var i=e;return Ee&&"click"===t&&(t="touchstart",i=function(t){t.preventDefault(),e()}),this.element["on"+t]=i,this},setRadialReference:function(t){return this.element.radialReference=t,this},translate:function(t,e){return this.attr({translateX:t,translateY:e})},invert:function(){return this.inverted=!0,this.updateTransform(),this},htmlCss:function(e){var i=this.element;return(i=e&&"SPAN"===i.tagName&&e.width)&&(delete e.width,this.textWidth=i,this.updateTransform()),this.styles=t(this.styles,e),f(this.element,e),this},htmlGetBBox:function(){var t=this.element,e=this.bBox;return e||("text"===t.nodeName&&(t.style.position="absolute"),e=this.bBox={x:t.offsetLeft,y:t.offsetTop,width:t.offsetWidth,height:t.offsetHeight}),e},htmlUpdateTransform:function(){if(this.added){var t=this.renderer,e=this.element,n=this.translateX||0,s=this.translateY||0,r=this.x||0,o=this.y||0,a=this.textAlign||"left",l={left:0,center:.5,right:1}[a],h=a&&"left"!==a,u=this.shadows;if((n||s)&&(f(e,{marginLeft:n,marginTop:s}),u&&Je(u,function(t){f(t,{marginLeft:n+1,marginTop:s+1})})),this.inverted&&Je(e.childNodes,function(i){t.invertChild(i,e)}),"SPAN"===e.tagName){var d,m,g,v,u=this.rotation,y=0,b=1,y=0;g=i(this.textWidth);var x=this.xCorr||0,w=this.yCorr||0,k=[u,a,e.innerHTML,this.textWidth].join(",");d={},k!==this.cTT&&(c(u)&&(t.isSVG?(x=ke?"-ms-transform":Ce?"-webkit-transform":De?"MozTransform":we?"-o-transform":"",d[x]=d.transform="rotate("+u+"deg)"):(y=u*be,b=ge(y),y=ve(y),d.filter=u?["progid:DXImageTransform.Microsoft.Matrix(M11=",b,", M12=",-y,", M21=",y,", M22=",b,", sizingMethod='auto expand')"].join(""):$e),f(e,d)),d=p(this.elemWidth,e.offsetWidth),m=p(this.elemHeight,e.offsetHeight),d>g&&/[ \-]/.test(e.innerText)&&(f(e,{width:g+"px",display:"block",whiteSpace:"normal"}),d=g),g=t.fontMetrics(e.style.fontSize).b,x=0>b&&-d,w=0>y&&-m,v=0>b*y,x+=y*g*(v?1-l:l),w-=b*g*(u?v?l:1-l:1),h&&(x-=d*l*(0>b?-1:1),u&&(w-=m*l*(0>y?-1:1)),f(e,{textAlign:a})),this.xCorr=x,this.yCorr=w),f(e,{left:r+x+"px",top:o+w+"px"}),this.cTT=k}}else this.alignOnAdd=!0},updateTransform:function(){var t=this.translateX||0,e=this.translateY||0,i=this.inverted,n=this.rotation,s=[];i&&(t+=this.attr("width"),e+=this.attr("height")),(t||e)&&s.push("translate("+t+","+e+")"),i?s.push("rotate(90) scale(-1,1)"):n&&s.push("rotate("+n+" "+(this.x||0)+" "+(this.y||0)+")"),s.length&&u(this.element,"transform",s.join(" "))},toFront:function(){var t=this.element;return t.parentNode.appendChild(t),this},align:function(t,e,i){t?(this.alignOptions=t,this.alignByTranslate=e,i||this.renderer.alignedObjects.push(this)):(t=this.alignOptions,e=this.alignByTranslate);var i=p(i,this.renderer),n=t.align,s=t.verticalAlign,r=(i.x||0)+(t.x||0),o=(i.y||0)+(t.y||0),a={};return("right"===n||"center"===n)&&(r+=(i.width-(t.width||0))/{right:1,center:2}[n]),a[e?"translateX":"x"]=ce(r),("bottom"===s||"middle"===s)&&(o+=(i.height-(t.height||0))/({bottom:1,middle:2}[s]||1)),a[e?"translateY":"y"]=ce(o),this[this.placed?"animate":"attr"](a),this.placed=!0,this.alignAttr=a,this},getBBox:function(){var e,i=this.bBox,n=this.renderer,s=this.rotation,r=this.element,o=this.styles,a=s*be;if(!i){if(r.namespaceURI===Me||n.forExport){try{i=r.getBBox?t({},r.getBBox()):{width:r.offsetWidth,height:r.offsetHeight}}catch(l){}(!i||i.width<0)&&(i={width:0,height:0})}else i=this.htmlGetBBox();n.isSVG&&(n=i.width,e=i.height,s)&&(i.width=me(e*ve(a))+me(n*ge(a)),i.height=me(e*ge(a))+me(n*ve(a))),ke&&o&&"11px"===o.fontSize&&22.700000762939453===e&&(i.height=14),this.bBox=i}return i},show:function(){return this.attr({visibility:"visible"})},hide:function(){return this.attr({visibility:"hidden"})},add:function(t){var e,n=this.renderer,s=t||n,r=s.element||n.box,o=r.childNodes,a=this.element,l=u(a,"zIndex");if(t&&(this.parentGroup=t),this.parentInverted=t&&t.inverted,void 0!==this.textStr&&n.buildText(this),l&&(s.handleZ=!0,l=i(l)),s.handleZ)for(s=0;s<o.length;s++)if(t=o[s],n=u(t,"zIndex"),t!==a&&(i(n)>l||!c(l)&&c(n))){r.insertBefore(a,t),e=!0;break}return e||r.appendChild(a),this.added=!0,si(this,"add"),this},safeRemoveChild:function(t){var e=t.parentNode;e&&e.removeChild(t)},destroy:function(){var t,e,i=this,n=i.element||{},s=i.shadows;if(n.onclick=n.onmouseout=n.onmouseover=n.onmousemove=null,ai(i),i.clipPath&&(i.clipPath=i.clipPath.destroy()),i.stops){for(e=0;e<i.stops.length;e++)i.stops[e]=i.stops[e].destroy();i.stops=null}i.safeRemoveChild(n),s&&Je(s,function(t){i.safeRemoveChild(t)}),h(i.renderer.alignedObjects,i);for(t in i)delete i[t];return null},empty:function(){for(var t=this.element,e=t.childNodes,i=e.length;i--;)t.removeChild(e[i])},shadow:function(t,e,i){var n,s,r,o,a,l,h=[],c=this.element;if(t){for(o=p(t.width,3),a=(t.opacity||.15)/o,l=this.parentInverted?"(-1,-1)":"("+p(t.offsetX,1)+", "+p(t.offsetY,1)+")",n=1;o>=n;n++)s=c.cloneNode(0),r=2*o+1-2*n,u(s,{isShadow:"true",stroke:t.color||"black","stroke-opacity":a*n,"stroke-width":r,transform:"translate"+l,fill:$e}),i&&(u(s,"height",pe(u(s,"height")-r,0)),s.cutHeight=r),e?e.element.appendChild(s):c.parentNode.insertBefore(s,c),h.push(s);this.shadows=h}return this}};var ci=function(){this.init.apply(this,arguments)};ci.prototype={Element:I,init:function(t,e,i,n){var s,r=location;s=this.createElement("svg").attr({xmlns:Me,version:"1.1"}),t.appendChild(s.element),this.isSVG=!0,this.box=s.element,this.boxWrapper=s,this.alignedObjects=[],this.url=(De||Ce)&&ae.getElementsByTagName("base").length?r.href.replace(/#.*?$/,"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20"):"",this.defs=this.createElement("defs").add(),this.forExport=n,this.gradients={},this.setSize(e,i,!1);var o;De&&t.getBoundingClientRect&&(this.subPixelFix=e=function(){f(t,{left:0,top:0}),o=t.getBoundingClientRect(),f(t,{left:de(o.left)-o.left+"px",top:de(o.top)-o.top+"px"})},e(),ii(le,"resize",e))},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var t=this.defs;return this.box=null,this.boxWrapper=this.boxWrapper.destroy(),M(this.gradients||{}),this.gradients=null,t&&(this.defs=t.destroy()),this.subPixelFix&&ni(le,"resize",this.subPixelFix),this.alignedObjects=null},createElement:function(t){var e=new this.Element;return e.init(this,t),e},draw:function(){},buildText:function(t){for(var e,n=t.element,s=p(t.textStr,"").toString().replace(/<(b|strong)>/g,'<span style="font-weight:bold">').replace(/<(i|em)>/g,'<span style="font-style:italic">').replace(/<a/g,"<span").replace(/<\/(b|strong|i|em|a)>/g,"</span>").split(/<br.*?>/g),r=n.childNodes,o=/style="([^"]+)"/,a=/href="([^"]+)"/,l=u(n,"x"),h=t.styles,c=h&&h.width&&i(h.width),d=h&&h.lineHeight,h=r.length,m=[];h--;)n.removeChild(r[h]);c&&!t.added&&this.box.appendChild(n),""===s[s.length-1]&&s.pop(),Je(s,function(s,r){var h,p,g=0,s=s.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||");h=s.split("|||"),Je(h,function(s){if(""!==s||1===h.length){var v,y={},b=ae.createElementNS(Me,"tspan");if(o.test(s)&&(v=s.match(o)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),u(b,"style",v)),a.test(s)&&(u(b,"onclick",'location.href="'+s.match(a)[1]+'"'),f(b,{cursor:"pointer"})),s=(s.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">"),b.appendChild(ae.createTextNode(s)),g?y.dx=3:y.x=l,!g){if(r){if(!Te&&t.renderer.forExport&&f(b,{display:"block"}),p=le.getComputedStyle&&i(le.getComputedStyle(e,null).getPropertyValue("line-height")),!p||isNaN(p)){var x;(x=d)||(x=e.offsetHeight)||(m[r]=n.getBBox?n.getBBox().height:t.renderer.fontMetrics(n.style.fontSize).h,x=ce(m[r]-(m[r-1]||0))||18),p=x}u(b,"dy",p)}e=b}if(u(b,y),n.appendChild(b),g++,c)for(var s=s.replace(/([^\^])-/g,"$1- ").split(" "),w=[];s.length||w.length;)delete t.bBox,x=t.getBBox().width,y=x>c,y&&1!==s.length?(b.removeChild(b.firstChild),w.unshift(s.pop())):(s=w,w=[],s.length&&(b=ae.createElementNS(Me,"tspan"),u(b,{dy:d||16,x:l}),v&&u(b,"style",v),n.appendChild(b),x>c&&(c=x))),s.length&&b.appendChild(ae.createTextNode(s.join(" ").replace(/- /g,"-")))}})})},button:function(i,n,s,r,o,a,l){var h,c,u,d,p,f=this.label(i,n,s),m=0,i={x1:0,y1:0,x2:0,y2:1},o=ei(e("stroke-width",1,"stroke","#999","fill",e("linearGradient",i,"stops",[[0,"#FFF"],[1,"#DDD"]]),"r",3,"padding",3,"style",e("color","black")),o);return u=o.style,delete o.style,a=ei(o,e("stroke","#68A","fill",e("linearGradient",i,"stops",[[0,"#FFF"],[1,"#ACF"]])),a),d=a.style,delete a.style,l=ei(o,e("stroke","#68A","fill",e("linearGradient",i,"stops",[[0,"#9BD"],[1,"#CDF"]])),l),p=l.style,delete l.style,ii(f.element,"mouseenter",function(){f.attr(a).css(d)}),ii(f.element,"mouseleave",function(){h=[o,a,l][m],c=[u,d,p][m],f.attr(h).css(c)}),f.setState=function(t){(m=t)?2===t&&f.attr(l).css(p):f.attr(o).css(u)},f.on("click",function(){r.call(f)}).attr(o).css(t({cursor:"default"},u))},crispLine:function(t,e){return t[1]===t[4]&&(t[1]=t[4]=ce(t[1])-e%2/2),t[2]===t[5]&&(t[2]=t[5]=ce(t[2])+e%2/2),t},path:function(e){var i={fill:$e};return r(e)?i.d=e:s(e)&&t(i,e),this.createElement("path").attr(i)},circle:function(t,e,i){return t=s(t)?t:{x:t,y:e,r:i},this.createElement("circle").attr(t)},arc:function(t,e,i,n,r,o){return s(t)&&(e=t.y,i=t.r,n=t.innerR,r=t.start,o=t.end,t=t.x),this.symbol("arc",t||0,e||0,i||0,i||0,{innerR:n||0,start:r||0,end:o||0})},rect:function(t,e,i,n,r,o){return r=s(t)?t.r:r,r=this.createElement("rect").attr({rx:r,ry:r,fill:$e}),r.attr(s(t)?t:r.crisp(o,t,e,pe(i,0),pe(n,0)))},setSize:function(t,e,i){var n=this.alignedObjects,s=n.length;for(this.width=t,this.height=e,this.boxWrapper[p(i,!0)?"animate":"attr"]({width:t,height:e});s--;)n[s].align()},g:function(t){var e=this.createElement("g");return c(t)?e.attr({"class":"highcharts-"+t}):e},image:function(e,i,n,s,r){var o={preserveAspectRatio:$e};return arguments.length>1&&t(o,{x:i,y:n,width:s,height:r}),o=this.createElement("image").attr(o),o.element.setAttributeNS?o.element.setAttributeNS("http://www.w3.org/1999/xlink","href",e):o.element.setAttribute("hc-svg-href",e),o},symbol:function(e,i,n,s,r,o){var a,l,h,c=this.symbols[e],c=c&&c(ce(i),ce(n),s,r,o),u=/^url\((.*?)\)$/;return c?(a=this.path(c),t(a,{symbolName:e,x:i,y:n,width:s,height:r}),o&&t(a,o)):u.test(e)&&(h=function(t,e){t.attr({width:e[0],height:e[1]}),t.alignByTranslate||t.translate(-ce(e[0]/2),-ce(e[1]/2))},l=e.match(u)[1],e=Fe[l],a=this.image(l).attr({x:i,y:n}),e?h(a,e):(a.attr({width:0,height:0}),m("img",{onload:function(){h(a,Fe[l]=[this.width,this.height])},src:l}))),a},symbols:{circle:function(t,e,i,n){var s=.166*i;return["M",t+i/2,e,"C",t+i+s,e,t+i+s,e+n,t+i/2,e+n,"C",t-s,e+n,t-s,e,t+i/2,e,"Z"]},square:function(t,e,i,n){return["M",t,e,"L",t+i,e,t+i,e+n,t,e+n,"Z"]},triangle:function(t,e,i,n){return["M",t+i/2,e,"L",t+i,e+n,t,e+n,"Z"]},"triangle-down":function(t,e,i,n){return["M",t,e,"L",t+i,e,t+i/2,e+n,"Z"]},diamond:function(t,e,i,n){return["M",t+i/2,e,"L",t+i,e+n/2,t+i/2,e+n,t,e+n/2,"Z"]},arc:function(t,e,i,n,s){var r=s.start,i=s.r||i||n,o=s.end-1e-6,n=s.innerR,a=s.open,l=ge(r),h=ve(r),c=ge(o),o=ve(o),s=s.end-r<ye?0:1;return["M",t+i*l,e+i*h,"A",i,i,0,s,1,t+i*c,e+i*o,a?"M":"L",t+n*c,e+n*o,"A",n,n,0,s,0,t+n*l,e+n*h,a?"":"Z"]}},clipRect:function(t,e,i,n){var s="highcharts-"+Ie++,r=this.createElement("clipPath").attr({id:s}).add(this.defs),t=this.rect(t,e,i,n,0).add(r);return t.id=s,t.clipPath=r,t},color:function(e,i,n){var s,o,a=this,l=/^rgba/;if(e&&e.linearGradient?o="linearGradient":e&&e.radialGradient&&(o="radialGradient"),o){var h,d,p,n=e[o],f=a.gradients,i=i.radialReference;return n.id&&f[n.id]||(r(n)&&(e[o]=n={x1:n[0],y1:n[1],x2:n[2],y2:n[3],gradientUnits:"userSpaceOnUse"}),"radialGradient"===o&&i&&!c(n.gradientUnits)&&t(n,{cx:i[0]-i[2]/2+n.cx*i[2],cy:i[1]-i[2]/2+n.cy*i[2],r:n.r*i[2],gradientUnits:"userSpaceOnUse"}),n.id="highcharts-"+Ie++,f[n.id]=h=a.createElement(o).attr(n).add(a.defs),h.stops=[],Je(e.stops,function(t){l.test(t[1])?(s=hi(t[1]),d=s.get("rgb"),p=s.get("a")):(d=t[1],p=1),t=a.createElement("stop").attr({offset:t[0],"stop-color":d,"stop-opacity":p}).add(h),h.stops.push(t)})),"url("+a.url+"#"+n.id+")"}return l.test(e)?(s=hi(e),u(i,n+"-opacity",s.get("a")),s.get("rgb")):(i.removeAttribute(n+"-opacity"),e)},text:function(t,e,i,n){var s=Y.chart.style,r=Ae||!Te&&this.forExport;return n&&!this.forExport?this.html(t,e,i):(e=ce(p(e,0)),i=ce(p(i,0)),t=this.createElement("text").attr({x:e,y:i,text:t}).css({fontFamily:s.fontFamily,fontSize:s.fontSize}),r&&t.css({position:"absolute"}),t.x=e,t.y=i,t)},html:function(e,i,n){var s=Y.chart.style,r=this.createElement("span"),o=r.attrSetters,a=r.element,l=r.renderer;return o.text=function(t){return t!==a.innerHTML&&delete this.bBox,a.innerHTML=t,!1},o.x=o.y=o.align=function(t,e){return"align"===e&&(e="textAlign"),r[e]=t,r.htmlUpdateTransform(),!1},r.attr({text:e,x:ce(i),y:ce(n)}).css({position:"absolute",whiteSpace:"nowrap",fontFamily:s.fontFamily,fontSize:s.fontSize}),r.css=r.htmlCss,l.isSVG&&(r.add=function(e){var i,n=l.box.parentNode,s=[];
386
- if(e){if(i=e.div,!i){for(;e;)s.push(e),e=e.parentGroup;Je(s.reverse(),function(e){var s;i=e.div=e.div||m(Ne,{className:u(e.element,"class")},{position:"absolute",left:(e.translateX||0)+"px",top:(e.translateY||0)+"px"},i||n),s=i.style,t(e.attrSetters,{translateX:function(t){s.left=t+"px"},translateY:function(t){s.top=t+"px"},visibility:function(t,e){s[e]=t}})})}}else i=n;return i.appendChild(a),r.added=!0,r.alignOnAdd&&r.htmlUpdateTransform(),r}),r},fontMetrics:function(t){var t=i(t||11),t=24>t?t+4:ce(1.2*t),e=ce(.8*t);return{h:t,b:e}},label:function(e,i,n,s,r,o,a,l,h){function u(){var t,e=k.styles,e=e&&e.textAlign,i=D*(1-C);t=l?0:x,!c(g)||"center"!==e&&"right"!==e||(i+={center:.5,right:1}[e]*(g-m.width)),(i!==_.x||t!==_.y)&&_.attr({x:i,y:t}),_.x=i,_.y=t}function d(t,e){f?f.attr(t,e):T[t]=e}function p(){_.add(k),k.attr({text:e,x:i,y:n}),c(r)&&k.attr({anchorX:r,anchorY:o})}var f,m,g,v,y,b,x,w=this,k=w.g(h),_=w.text("",0,0,a).attr({zIndex:1}),C=0,D=3,M=0,T={},a=k.attrSetters;ii(k,"add",p),a.width=function(t){return g=t,!1},a.height=function(t){return v=t,!1},a.padding=function(t){return c(t)&&t!==D&&(D=t,u()),!1},a.align=function(t){return C={left:0,center:.5,right:1}[t],!1},a.text=function(t,e){_.attr(e,t);var i;return i=_.element.style,m=(void 0===g||void 0===v||k.styles.textAlign)&&_.getBBox(),k.width=(g||m.width||0)+2*D,k.height=(v||m.height||0)+2*D,x=D+w.fontMetrics(i&&i.fontSize).b,f||(i=l?-x:0,k.box=f=s?w.symbol(s,-C*D,i,k.width,k.height):w.rect(-C*D,i,k.width,k.height,0,T["stroke-width"]),f.add(k)),f.attr(ei({width:k.width,height:k.height},T)),T=null,u(),!1},a["stroke-width"]=function(t,e){return M=t%2/2,d(e,t),!1},a.stroke=a.fill=a.r=function(t,e){return d(e,t),!1},a.anchorX=function(t,e){return r=t,d(e,t+M-y),!1},a.anchorY=function(t,e){return o=t,d(e,t-b),!1},a.x=function(t){return k.x=t,t-=C*((g||m.width)+D),y=ce(t),k.attr("translateX",y),!1},a.y=function(t){return b=k.y=ce(t),k.attr("translateY",t),!1};var S=k.css;return t(k,{css:function(t){if(t){var e={},t=ei({},t);Je("fontSize,fontWeight,fontFamily,color,lineHeight,width".split(","),function(i){t[i]!==j&&(e[i]=t[i],delete t[i])}),_.css(e)}return S.call(k,t)},getBBox:function(){return f.getBBox()},shadow:function(t){return f.shadow(t),k},destroy:function(){ni(k,"add",p),ni(k.element,"mouseenter"),ni(k.element,"mouseleave"),_&&(_=_.destroy()),f&&(f=f.destroy()),I.prototype.destroy.call(k)}})}},R=ci;var ui;if(!Te&&!Ae){ui={init:function(t,e){var i=["<",e,' filled="f" stroked="f"'],n=["position: ","absolute",";"];("shape"===e||e===Ne)&&n.push("left:0;top:0;width:1px;height:1px;"),_e&&n.push("visibility: ",e===Ne?"hidden":"visible"),i.push(' style="',n.join(""),'"/>'),e&&(i=e===Ne||"span"===e||"img"===e?i.join(""):t.prepVML(i),this.element=m(i)),this.renderer=t,this.attrSetters={}},add:function(t){var e=this.renderer,i=this.element,n=e.box,n=t?t.element||t:n;return t&&t.inverted&&e.invertChild(i,n),n.appendChild(i),this.added=!0,this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform(),si(this,"add"),this},updateTransform:I.prototype.htmlUpdateTransform,attr:function(t,e){var i,s,r,a,l,h=this.element||{},d=h.style,p=h.nodeName,f=this.renderer,g=this.symbolName,v=this.shadows,y=this.attrSetters,b=this;if(n(t)&&c(e)&&(i=t,t={},t[i]=e),n(t))i=t,b="strokeWidth"===i||"stroke-width"===i?this.strokeweight:this[i];else for(i in t)if(s=t[i],l=!1,r=y[i]&&y[i].call(this,s,i),r!==!1&&null!==s){if(r!==j&&(s=r),g&&/^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(i))a||(this.symbolAttr(t),a=!0),l=!0;else if("d"===i){for(s=s||[],this.d=s.join(" "),r=s.length,l=[];r--;)l[r]=o(s[r])?ce(10*s[r])-5:"Z"===s[r]?"x":s[r];if(s=l.join(" ")||"x",h.path=s,v)for(r=v.length;r--;)v[r].path=v[r].cutOff?this.cutOffPath(s,v[r].cutOff):s;l=!0}else if("visibility"===i){if(v)for(r=v.length;r--;)v[r].style[i]=s;"DIV"===p&&(s="hidden"===s?"-999em":0,i="top"),d[i]=s,l=!0}else"zIndex"===i?(s&&(d[i]=s),l=!0):"width"===i||"height"===i?(s=pe(0,s),this[i]=s,this.updateClipping?(this[i]=s,this.updateClipping()):d[i]=s,l=!0):"x"===i||"y"===i?(this[i]=s,d[{x:"left",y:"top"}[i]]=s):"class"===i?h.className=s:"stroke"===i?(s=f.color(s,h,i),i="strokecolor"):"stroke-width"===i||"strokeWidth"===i?(h.stroked=s?!0:!1,i="strokeweight",this[i]=s,o(s)&&(s+="px")):"dashstyle"===i?((h.getElementsByTagName("stroke")[0]||m(f.prepVML(["<stroke/>"]),null,null,h))[i]=s||"solid",this.dashstyle=s,l=!0):"fill"===i?"SPAN"===p?d.color=s:(h.filled=s!==$e?!0:!1,s=f.color(s,h,i,this),i="fillcolor"):"shape"===p&&"rotation"===i?(this[i]=s,h.style.left=-ce(ve(s*be)+1)+"px",h.style.top=ce(ge(s*be))+"px"):"translateX"===i||"translateY"===i||"rotation"===i?(this[i]=s,this.updateTransform(),l=!0):"text"===i&&(this.bBox=null,h.innerHTML=s,l=!0);l||(_e?h[i]=s:u(h,i,s))}return b},clip:function(t){var e,i=this,n=i.element,s=n.parentNode;return t?(e=t.members,e.push(i),i.destroyClip=function(){h(e,i)},s&&"highcharts-tracker"===s.className&&!_e&&f(n,{visibility:"hidden"}),t=t.getCSS(i)):(i.destroyClip&&i.destroyClip(),t={clip:_e?"inherit":"rect(auto)"}),i.css(t)},css:I.prototype.htmlCss,safeRemoveChild:function(t){t.parentNode&&T(t)},destroy:function(){return this.destroyClip&&this.destroyClip(),I.prototype.destroy.apply(this)},empty:function(){for(var t,e=this.element.childNodes,i=e.length;i--;)t=e[i],t.parentNode.removeChild(t)},on:function(t,e){return this.element["on"+t]=function(){var t=le.event;t.target=t.srcElement,e(t)},this},cutOffPath:function(t,e){var n,t=t.split(/[ ,]/);return n=t.length,(9===n||11===n)&&(t[n-4]=t[n-2]=i(t[n-2])-10*e),t.join(" ")},shadow:function(t,e,n){var s,r,o,a,l,h,c,u=[],d=this.element,f=this.renderer,g=d.style,v=d.path;if(v&&"string"!=typeof v.value&&(v="x"),l=v,t){for(h=p(t.width,3),c=(t.opacity||.15)/h,s=1;3>=s;s++)a=2*h+1-2*s,n&&(l=this.cutOffPath(v.value,a+.5)),o=['<shape isShadow="true" strokeweight="',a,'" filled="false" path="',l,'" coordsize="10 10" style="',d.style.cssText,'" />'],r=m(f.prepVML(o),null,{left:i(g.left)+p(t.offsetX,1),top:i(g.top)+p(t.offsetY,1)}),n&&(r.cutOff=a+1),o=['<stroke color="',t.color||"black",'" opacity="',c*s,'"/>'],m(f.prepVML(o),null,null,r),e?e.element.appendChild(r):d.parentNode.insertBefore(r,d),u.push(r);this.shadows=u}return this}},ui=g(I,ui);var di={Element:ui,isIE8:xe.indexOf("MSIE 8.0")>-1,init:function(t,e,i){var n,s;this.alignedObjects=[],n=this.createElement(Ne),s=n.element,s.style.position="relative",t.appendChild(n.element),this.box=s,this.boxWrapper=n,this.setSize(e,i,!1),ae.namespaces.hcv||(ae.namespaces.add("hcv","urn:schemas-microsoft-com:vml"),ae.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } ")},isHidden:function(){return!this.box.offsetWidth},clipRect:function(e,i,n,r){var o=this.createElement(),a=s(e);return t(o,{members:[],left:a?e.x:e,top:a?e.y:i,width:a?e.width:n,height:a?e.height:r,getCSS:function(e){var i=e.inverted,n=this.top,s=this.left,r=s+this.width,o=n+this.height,n={clip:"rect("+ce(i?s:n)+"px,"+ce(i?o:r)+"px,"+ce(i?r:o)+"px,"+ce(i?n:s)+"px)"};return!i&&_e&&"IMG"!==e.element.nodeName&&t(n,{width:r+"px",height:o+"px"}),n},updateClipping:function(){Je(o.members,function(t){t.css(o.getCSS(t))})}})},color:function(t,e,i,n){var s,r,o,a=this,l=/^rgba/,h=$e;if(t&&t.linearGradient?o="gradient":t&&t.radialGradient&&(o="pattern"),o){var c,u,d,p,f,g,v,y,b=t.linearGradient||t.radialGradient,x="",t=t.stops,w=[],k=function(){r=['<fill colors="'+w.join(",")+'" opacity="',f,'" o:opacity2="',p,'" type="',o,'" ',x,'focus="100%" method="any" />'],m(a.prepVML(r),null,null,e)};if(d=t[0],y=t[t.length-1],d[0]>0&&t.unshift([0,d[1]]),y[0]<1&&t.push([1,y[1]]),Je(t,function(t,e){l.test(t[1])?(s=hi(t[1]),c=s.get("rgb"),u=s.get("a")):(c=t[1],u=1),w.push(100*t[0]+"% "+c),e?(f=u,g=c):(p=u,v=c)}),"fill"===i)if("gradient"===o)i=b.x1||b[0]||0,t=b.y1||b[1]||0,d=b.x2||b[2]||0,b=b.y2||b[3]||0,x='angle="'+(90-180*he.atan((b-t)/(d-i))/ye)+'"',k();else{var _,h=b.r,C=2*h,D=2*h,M=b.cx,T=b.cy,S=e.radialReference,h=function(){S&&(_=n.getBBox(),M+=(S[0]-_.x)/_.width-.5,T+=(S[1]-_.y)/_.height-.5,C*=S[2]/_.width,D*=S[2]/_.height),x='src="'+Y.global.VMLRadialGradientURL+'" size="'+C+","+D+'" origin="0.5,0.5" position="'+M+","+T+'" color2="'+v+'" ',k()};n.added?h():ii(n,"add",h),h=g}else h=c}else l.test(t)&&"IMG"!==e.tagName?(s=hi(t),r=["<",i,' opacity="',s.get("a"),'"/>'],m(this.prepVML(r),null,null,e),h=s.get("rgb")):(h=e.getElementsByTagName(i),h.length&&(h[0].opacity=1),h=t);return h},prepVML:function(t){var e=this.isIE8,t=t.join("");return e?(t=t.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),t=-1===t.indexOf('style="')?t.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):t.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):t=t.replace("<","<hcv:"),t},text:ci.prototype.html,path:function(e){var i={coordsize:"10 10"};return r(e)?i.d=e:s(e)&&t(i,e),this.createElement("shape").attr(i)},circle:function(t,e,i){return this.symbol("circle").attr({x:t-i,y:e-i,width:2*i,height:2*i})},g:function(t){var e;return t&&(e={className:"highcharts-"+t,"class":"highcharts-"+t}),this.createElement(Ne).attr(e)},image:function(t,e,i,n,s){var r=this.createElement("img").attr({src:t});return arguments.length>1&&r.attr({x:e,y:i,width:n,height:s}),r},rect:function(t,e,i,n,r,o){s(t)&&(e=t.y,i=t.width,n=t.height,o=t.strokeWidth,t=t.x);var a=this.symbol("rect");return a.r=r,a.attr(a.crisp(o,t,e,pe(i,0),pe(n,0)))},invertChild:function(t,e){var n=e.style;f(t,{flip:"x",left:i(n.width)-1,top:i(n.height)-1,rotation:-90})},symbols:{arc:function(t,e,i,n,s){var r=s.start,o=s.end,a=s.r||i||n,i=ge(r),n=ve(r),l=ge(o),h=ve(o),c=s.innerR,u=.08/a,d=c&&.1/c||0;return 0===o-r?["x"]:(u>2*ye-o+r?l=-u:d>o-r&&(l=ge(r+d)),r=["wa",t-a,e-a,t+a,e+a,t+a*i,e+a*n,t+a*l,e+a*h],s.open&&!c&&r.push("e","M",t,e),r.push("at",t-c,e-c,t+c,e+c,t+c*l,e+c*h,t+c*i,e+c*n,"x","e"),r)},circle:function(t,e,i,n){return["wa",t,e,t+i,e+n,t+i,e+n/2,t+i,e+n/2,"e"]},rect:function(t,e,i,n,s){var r,o=t+i,a=e+n;return c(s)&&s.r?(r=fe(s.r,i,n),o=["M",t+r,e,"L",o-r,e,"wa",o-2*r,e,o,e+2*r,o-r,e,o,e+r,"L",o,a-r,"wa",o-2*r,a-2*r,o,a,o,a-r,o-r,a,"L",t+r,a,"wa",t,a-2*r,t+2*r,a,t+r,a,t,a-r,"L",t,e+r,"wa",t,e,t+2*r,e+2*r,t,e+r,t+r,e,"x","e"]):o=ci.prototype.symbols.square.apply(0,arguments),o}}};ui=function(){this.init.apply(this,arguments)},ui.prototype=ei(ci.prototype,di),R=ui}var pi,fi;Ae&&(pi=function(){Me="http://www.w3.org/1999/xhtml"},pi.prototype.symbols={},fi=function(){function t(){var t,i=e.length;for(t=0;i>t;t++)e[t]();e=[]}var e=[];return{push:function(i,n){0===e.length&&Xe(n,t),e.push(i)}}}()),R=ui||pi||ci,L.prototype={addLabel:function(){var e,i=this.axis,n=i.options,s=i.chart,r=i.horiz,a=i.categories,h=this.pos,u=n.labels,d=i.tickPositions,r=a&&r&&a.length&&!u.step&&!u.staggerLines&&!u.rotation&&s.plotWidth/d.length||!r&&s.plotWidth/2,p=h===d[0],f=h===d[d.length-1],m=a&&c(a[h])?a[h]:h,a=this.label,d=d.info;i.isDatetimeAxis&&d&&(e=n.dateTimeLabelFormats[d.higherRanks[h]||d.unitName]),this.isFirst=p,this.isLast=f,n=i.labelFormatter.call({axis:i,chart:s,isFirst:p,isLast:f,dateTimeLabelFormat:e,value:i.isLog?A(l(m)):m}),h=r&&{width:pe(1,ce(r-2*(u.padding||10)))+"px"},h=t(h,u.style),c(a)?a&&a.attr({text:n}).css(h):(r={align:u.align},o(u.rotation)&&(r.rotation=u.rotation),this.label=c(n)&&u.enabled?s.renderer.text(n,0,0,u.useHTML).attr(r).css(h).add(i.labelGroup):null)},getLabelSize:function(){var t=this.label,e=this.axis;return t?(this.labelBBox=t.getBBox())[e.horiz?"height":"width"]:0},getLabelSides:function(){var t=this.axis.options.labels,e=this.labelBBox.width,t=e*{left:0,center:.5,right:1}[t.align]-t.x;return[-t,e-t]},handleOverflow:function(t,e){var i=!0,n=this.axis,s=n.chart,r=this.isFirst,o=this.isLast,a=e.x,l=n.reversed,h=n.tickPositions;if(r||o){var c=this.getLabelSides(),u=c[0],c=c[1],s=s.plotLeft,d=s+n.len,h=(n=n.ticks[h[t+(r?1:-1)]])&&n.label.xy&&n.label.xy.x+n.getLabelSides()[r?0:1];r&&!l||o&&l?s>a+u&&(a=s-u,n&&a+c>h&&(i=!1)):a+c>d&&(a=d-c,n&&h>a+u&&(i=!1)),e.x=a}return i},getPosition:function(t,e,i,n){var s=this.axis,r=s.chart,o=n&&r.oldChartHeight||r.chartHeight;return{x:t?s.translate(e+i,null,null,n)+s.transB:s.left+s.offset+(s.opposite?(n&&r.oldChartWidth||r.chartWidth)-s.right-s.left:0),y:t?o-s.bottom+s.offset-(s.opposite?s.height:0):o-s.translate(e+i,null,null,n)-s.transB}},getLabelPosition:function(t,e,n,s,r,o,a,l){var h=this.axis,u=h.transA,d=h.reversed,h=h.staggerLines,t=t+r.x-(o&&s?o*u*(d?-1:1):0),e=e+r.y-(o&&!s?o*u*(d?1:-1):0);return c(r.y)||(e+=.9*i(n.styles.lineHeight)-n.getBBox().height/2),h&&(e+=16*(a/(l||1)%h)),{x:t,y:e}},getMarkPath:function(t,e,i,n,s,r){return r.crispLine(["M",t,e,"L",t+(s?0:-i),e+(s?i:0)],n)},render:function(t,e){var i=this.axis,n=i.options,s=i.chart.renderer,r=i.horiz,o=this.type,a=this.label,l=this.pos,h=n.labels,c=this.gridLine,u=o?o+"Grid":"grid",d=o?o+"Tick":"tick",f=n[u+"LineWidth"],m=n[u+"LineColor"],g=n[u+"LineDashStyle"],v=n[d+"Length"],u=n[d+"Width"]||0,y=n[d+"Color"],b=n[d+"Position"],d=this.mark,x=h.step,w=!0,k=i.tickmarkOffset,_=this.getPosition(r,l,k,e),C=_.x,_=_.y,D=i.staggerLines;f&&(l=i.getPlotLinePath(l+k,f,e),c===j&&(c={stroke:m,"stroke-width":f},g&&(c.dashstyle=g),o||(c.zIndex=1),this.gridLine=c=f?s.path(l).attr(c).add(i.gridGroup):null),!e&&c&&l&&c[this.isNew?"attr":"animate"]({d:l})),u&&v&&("inside"===b&&(v=-v),i.opposite&&(v=-v),o=this.getMarkPath(C,_,v,u,r,s),d?d.animate({d:o}):this.mark=s.path(o).attr({stroke:y,"stroke-width":u}).add(i.axisGroup)),a&&!isNaN(C)&&(a.xy=_=this.getLabelPosition(C,_,a,r,h,k,t,x),this.isFirst&&!p(n.showFirstLabel,1)||this.isLast&&!p(n.showLastLabel,1)?w=!1:!D&&r&&"justify"===h.overflow&&!this.handleOverflow(t,_)&&(w=!1),x&&t%x&&(w=!1),w?(a[this.isNew?"attr":"animate"](_),a.show(),this.isNew=!1):a.hide())},destroy:function(){M(this,this.axis)}},N.prototype={render:function(){var t,e=this,i=e.axis,n=i.horiz,s=(i.pointRange||0)/2,r=e.options,o=r.label,l=e.label,h=r.width,u=r.to,d=r.from,f=c(d)&&c(u),m=r.value,g=r.dashStyle,v=e.svgElem,y=[],b=r.color,x=r.zIndex,w=r.events,k=i.chart.renderer;if(i.isLog&&(d=a(d),u=a(u),m=a(m)),h)y=i.getPlotLinePath(m,h),s={stroke:b,"stroke-width":h},g&&(s.dashstyle=g);else{if(!f)return;d=pe(d,i.min-s),u=fe(u,i.max+s),y=i.getPlotBandPath(d,u,r),s={fill:b},r.borderWidth&&(s.stroke=r.borderColor,s["stroke-width"]=r.borderWidth)}if(c(x)&&(s.zIndex=x),v)y?v.animate({d:y},null,v.onGetPath):(v.hide(),v.onGetPath=function(){v.show()});else if(y&&y.length&&(e.svgElem=v=k.path(y).attr(s).add(),w))for(t in r=function(t){v.on(t,function(i){w[t].apply(e,[i])})},w)r(t);return o&&c(o.text)&&y&&y.length&&i.width>0&&i.height>0?(o=ei({align:n&&f&&"center",x:n?!f&&4:10,verticalAlign:!n&&f&&"middle",y:n?f?16:10:f?6:-4,rotation:n&&!f&&90},o),l||(e.label=l=k.text(o.text,0,0).attr({align:o.textAlign||o.align,rotation:o.rotation,zIndex:x}).css(o.style).add()),i=[y[1],y[4],p(y[6],y[1])],y=[y[2],y[5],p(y[7],y[2])],n=C(i),f=C(y),l.align(o,!1,{x:n,y:f,width:D(i)-n,height:D(y)-f}),l.show()):l&&l.hide(),e},destroy:function(){h(this.axis.plotLinesAndBands,this),M(this,this.axis)}},$.prototype={destroy:function(){M(this,this.axis)},setTotal:function(t){this.cum=this.total=t},render:function(t){var e=this.options.formatter.call(this);this.label?this.label.attr({text:e,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(e,0,0).css(this.options.style).attr({align:this.textAlign,rotation:this.options.rotation,visibility:"hidden"}).add(t)},setOffset:function(t,e){var i=this.axis,n=i.chart,s=n.inverted,r=this.isNegative,o=i.translate(this.percent?100:this.total,0,0,0,1),i=i.translate(0),i=me(o-i),a=n.xAxis[0].translate(this.x)+t,l=n.plotHeight,r={x:s?r?o:o-i:a,y:s?l-a-e:r?l-o-i:l-o,width:s?i:e,height:s?e:i};(s=this.label)&&(s.align(this.alignOptions,null,r),r=s.alignAttr,s.attr({visibility:this.options.crop===!1||n.isInsidePlot(r.x,r.y)?Te?"inherit":"visible":"hidden"}))}},z.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:Ge,lineColor:"#C0D0E0",lineWidth:1,minPadding:.01,maxPadding:.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:5,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#6D869F",fontWeight:"bold"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{align:"right",x:-8,y:3},lineWidth:0,maxPadding:.05,minPadding:.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Y-values"},stackLabels:{enabled:!1,formatter:function(){return this.total},style:Ge.style}},defaultLeftAxisOptions:{labels:{align:"right",x:-8,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{align:"left",x:8,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{align:"center",x:0,y:14},title:{rotation:0}},defaultTopAxisOptions:{labels:{align:"center",x:0,y:-5},title:{rotation:0}},init:function(t,e){var i=e.isX;this.horiz=t.inverted?!i:i,this.xOrY=(this.isXAxis=i)?"x":"y",this.opposite=e.opposite,this.side=this.horiz?this.opposite?0:2:this.opposite?1:3,this.setOptions(e);var n=this.options,s=n.type,r="datetime"===s;this.labelFormatter=n.labels.formatter||this.defaultLabelFormatter,this.staggerLines=this.horiz&&n.labels.staggerLines,this.userOptions=e,this.minPixelPadding=0,this.chart=t,this.reversed=n.reversed,this.categories=n.categories,this.isLog="logarithmic"===s,this.isLinked=c(n.linkedTo),this.isDatetimeAxis=r,this.tickmarkOffset=n.categories&&"between"===n.tickmarkPlacement?.5:0,this.ticks={},this.minorTicks={},this.plotLinesAndBands=[],this.alternateBands={},this.len=0,this.minRange=this.userMinRange=n.minRange||n.maxZoom,this.range=n.range,this.offset=n.offset||0,this.stacks={},this.min=this.max=null;var o,n=this.options.events;t.axes.push(this),t[i?"xAxis":"yAxis"].push(this),this.series=[],t.inverted&&i&&this.reversed===j&&(this.reversed=!0),this.removePlotLine=this.removePlotBand=this.removePlotBandOrLine,this.addPlotLine=this.addPlotBand=this.addPlotBandOrLine;for(o in n)ii(this,o,n[o]);this.isLog&&(this.val2lin=a,this.lin2val=l)},setOptions:function(t){this.options=ei(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],ei(Y[this.isXAxis?"xAxis":"yAxis"],t))},defaultLabelFormatter:function(){var t,e=this.axis,i=this.value,n=this.dateTimeLabelFormat,s=Y.lang.numericSymbols,r=s&&s.length,o=e.isLog?i:e.tickInterval;if(e.categories)t=i;else if(n)t=V(n,i);else if(r&&o>=1e3)for(;r--&&t===j;)e=Math.pow(1e3,r+1),o>=e&&null!==s[r]&&(t=v(i/e,-1)+s[r]);return t===j&&(t=i>=1e3?v(i,0):v(i,-1)),t},getSeriesExtremes:function(){var t,e=this,i=e.chart,n=e.stacks,s=[],r=[];e.hasVisibleSeries=!1,e.dataMin=e.dataMax=null,Je(e.series,function(o){if(o.visible||!i.options.chart.ignoreHiddenSeries){var a,l,h,u,d,f,m,g,v,y,b=o.options,x=b.threshold,w=[],k=0;if(e.hasVisibleSeries=!0,e.isLog&&0>=x&&(x=b.threshold=null),e.isXAxis)b=o.xData,b.length&&(e.dataMin=fe(p(e.dataMin,b[0]),C(b)),e.dataMax=pe(p(e.dataMax,b[0]),D(b)));else{var _,M,T,S=o.cropped,E=o.xAxis.getExtremes(),F=!!o.modifyValue;for(a=b.stacking,e.usePercentage="percent"===a,a&&(d=b.stack,u=o.type+p(d,""),f="-"+u,o.stackKey=u,l=s[u]||[],s[u]=l,h=r[f]||[],r[f]=h),e.usePercentage&&(e.dataMin=0,e.dataMax=99),b=o.processedXData,m=o.processedYData,y=m.length,t=0;y>t;t++)if(g=b[t],v=m[t],a&&(M=(_=x>v)?h:l,T=_?f:u,v=M[g]=c(M[g])?A(M[g]+v):v,n[T]||(n[T]={}),n[T][g]||(n[T][g]=new $(e,e.options.stackLabels,_,g,d,a)),n[T][g].setTotal(v)),null!==v&&v!==j&&(F&&(v=o.modifyValue(v)),S||(b[t+1]||g)>=E.min&&(b[t-1]||g)<=E.max))if(g=v.length)for(;g--;)null!==v[g]&&(w[k++]=v[g]);else w[k++]=v;!e.usePercentage&&w.length&&(e.dataMin=fe(p(e.dataMin,w[0]),C(w)),e.dataMax=pe(p(e.dataMax,w[0]),D(w))),c(x)&&(e.dataMin>=x?(e.dataMin=x,e.ignoreMinPadding=!0):e.dataMax<x&&(e.dataMax=x,e.ignoreMaxPadding=!0))}}})},translate:function(t,e,i,n,s,r){var o=this.len,a=1,l=0,h=n?this.oldTransA:this.transA,n=n?this.oldMin:this.min,s=this.options.ordinal||this.isLog&&s;return h||(h=this.transA),i&&(a*=-1,l=o),this.reversed&&(a*=-1,l-=a*o),e?(this.reversed&&(t=o-t),t=t/h+n,s&&(t=this.lin2val(t))):(s&&(t=this.val2lin(t)),t=a*(t-n)*h+l+a*this.minPixelPadding+(r?h*this.pointRange/2:0)),t},getPlotLinePath:function(t,e,i){var n,s,r,o,a=this.chart,l=this.left,h=this.top,t=this.translate(t,null,null,i),c=i&&a.oldChartHeight||a.chartHeight,u=i&&a.oldChartWidth||a.chartWidth;return n=this.transB,i=s=ce(t+n),n=r=ce(c-t-n),isNaN(t)?o=!0:this.horiz?(n=h,r=c-this.bottom,(l>i||i>l+this.width)&&(o=!0)):(i=l,s=u-this.right,(h>n||n>h+this.height)&&(o=!0)),o?null:a.renderer.crispLine(["M",i,n,"L",s,r],e||0)},getPlotBandPath:function(t,e){var i=this.getPlotLinePath(e),n=this.getPlotLinePath(t);return n&&i?n.push(i[4],i[5],i[1],i[2]):n=null,n},getLinearTickPositions:function(t,e,i){for(var n,e=A(ue(e/t)*t),i=A(de(i/t)*t),s=[];i>=e&&(s.push(e),e=A(e+t),e!==n);)n=e;return s},getLogTickPositions:function(t,e,i,n){var s=this.options,r=this.len,o=[];if(n||(this._minorAutoInterval=null),t>=.5)t=ce(t),o=this.getLinearTickPositions(t,e,i);else if(t>=.08)for(var h,c,u,d,f,r=ue(e),s=t>.3?[1,2,4]:t>.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];i+1>r&&!f;r++)for(c=s.length,h=0;c>h&&!f;h++)u=a(l(r)*s[h]),u>e&&o.push(d),d>i&&(f=!0),d=u;else e=l(e),i=l(i),t=s[n?"minorTickInterval":"tickInterval"],t=p("auto"===t?null:t,this._minorAutoInterval,(i-e)*(s.tickPixelInterval/(n?5:1))/((n?r/this.tickPositions.length:r)||1)),t=b(t,null,he.pow(10,ue(he.log(t)/he.LN10))),o=ti(this.getLinearTickPositions(t,e,i),a),n||(this._minorAutoInterval=t/5);return n||(this.tickInterval=t),o},getMinorTickPositions:function(){var t,e,i=this.tickPositions,n=this.minorTickInterval,s=[];if(this.isLog)for(e=i.length,t=1;e>t;t++)s=s.concat(this.getLogTickPositions(n,i[t-1],i[t],!0));else for(i=this.min+(i[0]-this.min)%n;i<=this.max;i+=n)s.push(i);return s},adjustForMinRange:function(){var t,e,i,n,s,r,o=this.options,a=this.min,l=this.max,h=this.dataMax-this.dataMin>=this.minRange;if(this.isXAxis&&this.minRange===j&&!this.isLog&&(c(o.min)||c(o.max)?this.minRange=null:(Je(this.series,function(t){for(s=t.xData,i=r=t.xIncrement?1:s.length-1;i>0;i--)n=s[i]-s[i-1],(e===j||e>n)&&(e=n)}),this.minRange=fe(5*e,this.dataMax-this.dataMin))),l-a<this.minRange){var u=this.minRange;t=(u-l+a)/2,t=[a-t,p(o.min,a-t)],h&&(t[2]=this.dataMin),a=D(t),l=[a+u,p(o.max,a+u)],h&&(l[2]=this.dataMax),l=C(l),u>l-a&&(t[0]=l-u,t[1]=p(o.min,l-u),a=D(t))}this.min=a,this.max=l},setAxisTranslation:function(){var t,e=this.max-this.min,i=0,n=0,s=0,r=this.linkedParent,o=this.transA;this.isXAxis&&(r?(n=r.minPointOffset,s=r.pointRangePadding):Je(this.series,function(e){var r=e.pointRange,o=e.options.pointPlacement,a=e.closestPointRange;i=pe(i,r),n=pe(n,o?0:r/2),s=pe(s,"on"===o?0:r),!e.noSharedTooltip&&c(a)&&(t=c(t)?fe(t,a):a)}),this.minPointOffset=n,this.pointRangePadding=s,this.pointRange=i,this.closestPointRange=t),this.oldTransA=o,this.translationSlope=this.transA=o=this.len/(e+s||1),this.transB=this.horiz?this.left:this.bottom,this.minPixelPadding=o*n},setTickPositions:function(t){var e=this,i=e.chart,n=e.options,s=e.isLog,r=e.isDatetimeAxis,o=e.isXAxis,l=e.isLinked,h=e.options.tickPositioner,u=n.maxPadding,d=n.minPadding,f=n.tickInterval,m=n.minTickInterval,g=n.tickPixelInterval,v=e.categories;l?(e.linkedParent=i[o?"xAxis":"yAxis"][n.linkedTo],i=e.linkedParent.getExtremes(),e.min=p(i.min,i.dataMin),e.max=p(i.max,i.dataMax),n.type!==e.linkedParent.options.type&&S(11,1)):(e.min=p(e.userMin,n.min,e.dataMin),e.max=p(e.userMax,n.max,e.dataMax)),s&&(!t&&fe(e.min,p(e.dataMin,e.min))<=0&&S(10,1),e.min=A(a(e.min)),e.max=A(a(e.max))),e.range&&(e.userMin=e.min=pe(e.min,e.max-e.range),e.userMax=e.max,t)&&(e.range=null),e.adjustForMinRange(),v||e.usePercentage||l||!c(e.min)||!c(e.max)||(i=e.max-e.min||1,c(n.min)||c(e.userMin)||!d||!(e.dataMin<0)&&e.ignoreMinPadding||(e.min-=i*d),c(n.max)||c(e.userMax)||!u||!(e.dataMax>0)&&e.ignoreMaxPadding||(e.max+=i*u)),e.tickInterval=e.min===e.max||void 0===e.min||void 0===e.max?1:l&&!f&&g===e.linkedParent.options.tickPixelInterval?e.linkedParent.tickInterval:p(f,v?1:(e.max-e.min)*g/(e.len||1)),o&&!t&&Je(e.series,function(t){t.processData(e.min!==e.oldMin||e.max!==e.oldMax)}),e.setAxisTranslation(t),e.beforeSetTickPositions&&e.beforeSetTickPositions(),e.postProcessTickInterval&&(e.tickInterval=e.postProcessTickInterval(e.tickInterval)),!f&&e.tickInterval<m&&(e.tickInterval=m),r||s||(t=he.pow(10,ue(he.log(e.tickInterval)/he.LN10)),f)||(e.tickInterval=b(e.tickInterval,null,t,n)),e.minorTickInterval="auto"===n.minorTickInterval&&e.tickInterval?e.tickInterval/5:n.minorTickInterval,e.tickPositions=h=n.tickPositions||h&&h.apply(e,[e.min,e.max]),h||(h=r?(e.getNonLinearTimeTicks||w)(x(e.tickInterval,n.units),e.min,e.max,n.startOfWeek,e.ordinalPositions,e.closestPointRange,!0):s?e.getLogTickPositions(e.tickInterval,e.min,e.max):e.getLinearTickPositions(e.tickInterval,e.min,e.max),e.tickPositions=h),l||(s=h[0],r=h[h.length-1],l=e.minPointOffset||0,n.startOnTick?e.min=s:e.min-l>s&&h.shift(),n.endOnTick?e.max=r:e.max+l<r&&h.pop())},setMaxTicks:function(){var t=this.chart,e=t.maxTicks,i=this.tickPositions,n=this.xOrY;e||(e={x:0,y:0}),!this.isLinked&&!this.isDatetimeAxis&&i.length>e[n]&&this.options.alignTicks!==!1&&(e[n]=i.length),t.maxTicks=e},adjustTickAmount:function(){var t=this.xOrY,e=this.tickPositions,i=this.chart.maxTicks;if(i&&i[t]&&!this.isDatetimeAxis&&!this.categories&&!this.isLinked&&this.options.alignTicks!==!1){var n=this.tickAmount,s=e.length;if(this.tickAmount=t=i[t],t>s){for(;e.length<t;)e.push(A(e[e.length-1]+this.tickInterval));this.transA*=(s-1)/(t-1),this.max=e[e.length-1]}c(n)&&t!==n&&(this.isDirty=!0)}},setScale:function(){var t,e,i,n,s=this.stacks;if(this.oldMin=this.min,this.oldMax=this.max,this.oldAxisLength=this.len,this.setAxisSize(),n=this.len!==this.oldAxisLength,Je(this.series,function(t){(t.isDirtyData||t.isDirty||t.xAxis.isDirty)&&(i=!0)}),(n||i||this.isLinked||this.userMin!==this.oldUserMin||this.userMax!==this.oldUserMax)&&(this.getSeriesExtremes(),this.setTickPositions(),this.oldUserMin=this.userMin,this.oldUserMax=this.userMax,this.isDirty||(this.isDirty=n||this.min!==this.oldMin||this.max!==this.oldMax)),!this.isXAxis)for(t in s)for(e in s[t])s[t][e].cum=s[t][e].total;this.setMaxTicks()},setExtremes:function(e,i,n,s,r){var o=this,a=o.chart,n=p(n,!0),r=t(r,{min:e,max:i});si(o,"setExtremes",r,function(){o.userMin=e,o.userMax=i,o.isDirtyExtremes=!0,n&&a.redraw(s)})},zoom:function(t,e){return this.setExtremes(t,e,!1,j,{trigger:"zoom"}),!0},setAxisSize:function(){var t=this.chart,e=this.options,i=e.offsetLeft||0,n=e.offsetRight||0;this.left=p(e.left,t.plotLeft+i),this.top=p(e.top,t.plotTop),this.width=p(e.width,t.plotWidth-i+n),this.height=p(e.height,t.plotHeight),this.bottom=t.chartHeight-this.height-this.top,this.right=t.chartWidth-this.width-this.left,this.len=pe(this.horiz?this.width:this.height,0)},getExtremes:function(){var t=this.isLog;return{min:t?A(l(this.min)):this.min,max:t?A(l(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(t){var e=this.isLog,i=e?l(this.min):this.min,e=e?l(this.max):this.max;return i>t||null===t?t=i:t>e&&(t=e),this.translate(t,0,1,0,1)},addPlotBandOrLine:function(t){return t=new N(this,t).render(),this.plotLinesAndBands.push(t),t},getOffset:function(){var t,e,i,n=this,s=n.chart,r=s.renderer,o=n.options,a=n.tickPositions,l=n.ticks,h=n.horiz,u=n.side,d=0,f=0,m=o.title,g=o.labels,v=0,y=s.axisOffset,b=[-1,1,1,-1][u];if(n.hasData=s=n.hasVisibleSeries||c(n.min)&&c(n.max)&&!!a,n.showAxis=t=s||p(o.showEmpty,!0),n.axisGroup||(n.gridGroup=r.g("grid").attr({zIndex:o.gridZIndex||1}).add(),n.axisGroup=r.g("axis").attr({zIndex:o.zIndex||2}).add(),n.labelGroup=r.g("axis-labels").attr({zIndex:g.zIndex||7}).add()),s||n.isLinked)Je(a,function(t){l[t]?l[t].addLabel():l[t]=new L(n,t)}),Je(a,function(t){(0===u||2===u||{1:"left",3:"right"}[u]===g.align)&&(v=pe(l[t].getLabelSize(),v))}),n.staggerLines&&(v+=16*(n.staggerLines-1));else for(i in l)l[i].destroy(),delete l[i];m&&m.text&&(n.axisTitle||(n.axisTitle=r.text(m.text,0,0,m.useHTML).attr({zIndex:7,rotation:m.rotation||0,align:m.textAlign||{low:"left",middle:"center",high:"right"}[m.align]}).css(m.style).add(n.axisGroup),n.axisTitle.isNew=!0),t&&(d=n.axisTitle.getBBox()[h?"height":"width"],f=p(m.margin,h?5:10),e=m.offset),n.axisTitle[t?"show":"hide"]()),n.offset=b*p(o.offset,y[u]),n.axisTitleMargin=p(e,v+f+(2!==u&&v&&b*o.labels[h?"y":"x"])),y[u]=pe(y[u],n.axisTitleMargin+d+b*n.offset)},getLinePath:function(t){var e=this.chart,i=this.opposite,n=this.offset,s=this.horiz,r=this.left+(i?this.width:0)+n;return this.lineTop=i=e.chartHeight-this.bottom-(i?this.height:0)+n,e.renderer.crispLine(["M",s?this.left:r,s?i:this.top,"L",s?e.chartWidth-this.right:r,s?i:e.chartHeight-this.bottom],t)},getTitlePosition:function(){var t=this.horiz,e=this.left,n=this.top,s=this.len,r=this.options.title,o=t?e:n,a=this.opposite,l=this.offset,h=i(r.style.fontSize||12),s={low:o+(t?0:s),middle:o+s/2,high:o+(t?s:0)}[r.align],e=(t?n+this.height:e)+(t?1:-1)*(a?-1:1)*this.axisTitleMargin+(2===this.side?h:0);return{x:t?s:e+(a?this.width:0)+l+(r.x||0),y:t?e-(a?this.height:0)+l:s+(r.y||0)}},render:function(){var t,e,i,n=this,s=n.chart,r=s.renderer,o=n.options,a=n.isLog,h=n.isLinked,u=n.tickPositions,d=n.axisTitle,p=n.stacks,f=n.ticks,m=n.minorTicks,g=n.alternateBands,v=o.stackLabels,y=o.alternateGridColor,b=n.tickmarkOffset,x=o.lineWidth,w=s.hasRendered&&c(n.oldMin)&&!isNaN(n.oldMin),k=n.showAxis;if((n.hasData||h)&&(n.minorTickInterval&&!n.categories&&Je(n.getMinorTickPositions(),function(t){m[t]||(m[t]=new L(n,t,"minor")),w&&m[t].isNew&&m[t].render(null,!0),m[t].isActive=!0,m[t].render()}),Je(u.slice(1).concat([u[0]]),function(t,e){e=e===u.length-1?0:e+1,(!h||t>=n.min&&t<=n.max)&&(f[t]||(f[t]=new L(n,t)),w&&f[t].isNew&&f[t].render(e,!0),f[t].isActive=!0,f[t].render(e))}),y&&Je(u,function(t,s){0===s%2&&t<n.max&&(g[t]||(g[t]=new N(n)),e=t+b,i=u[s+1]!==j?u[s+1]+b:n.max,g[t].options={from:a?l(e):e,to:a?l(i):i,color:y},g[t].render(),g[t].isActive=!0)}),n._addedPlotLB||(Je((o.plotLines||[]).concat(o.plotBands||[]),function(t){n.addPlotBandOrLine(t)}),n._addedPlotLB=!0)),Je([f,m,g],function(t){for(var e in t)t[e].isActive?t[e].isActive=!1:(t[e].destroy(),delete t[e])}),x&&(t=n.getLinePath(x),n.axisLine?n.axisLine.animate({d:t}):n.axisLine=r.path(t).attr({stroke:o.lineColor,"stroke-width":x,zIndex:7}).add(n.axisGroup),n.axisLine[k?"show":"hide"]()),d&&k&&(d[d.isNew?"attr":"animate"](n.getTitlePosition()),d.isNew=!1),v&&v.enabled){var _,C,o=n.stackTotalGroup;o||(n.stackTotalGroup=o=r.g("stack-labels").attr({visibility:"visible",zIndex:6}).add()),o.translate(s.plotLeft,s.plotTop);for(_ in p)for(C in s=p[_])s[C].render(o)}n.isDirty=!1},removePlotBandOrLine:function(t){for(var e=this.plotLinesAndBands,i=e.length;i--;)e[i].id===t&&e[i].destroy()},setTitle:function(t,e){var i=this.chart,n=this.options,s=this.axisTitle;n.title=ei(n.title,t),this.axisTitle=s&&s.destroy(),this.isDirty=!0,p(e,!0)&&i.redraw()},redraw:function(){var t=this.chart;t.tracker.resetTracker&&t.tracker.resetTracker(!0),this.render(),Je(this.plotLinesAndBands,function(t){t.render()}),Je(this.series,function(t){t.isDirty=!0})},setCategories:function(t,e){var i=this.chart;this.categories=this.userOptions.categories=t,Je(this.series,function(t){t.translate(),t.setTooltipPoints(!0)}),this.isDirty=!0,p(e,!0)&&i.redraw()},destroy:function(){var t,e=this,i=e.stacks;ni(e);for(t in i)M(i[t]),i[t]=null;Je([e.ticks,e.minorTicks,e.alternateBands,e.plotLinesAndBands],function(t){M(t)}),Je("stackTotalGroup,axisLine,axisGroup,gridGroup,labelGroup,axisTitle".split(","),function(t){e[t]&&(e[t]=e[t].destroy())
387
- })}},P.prototype={destroy:function(){Je(this.crosshairs,function(t){t&&t.destroy()}),this.label&&(this.label=this.label.destroy())},move:function(e,i,n,s){var r=this,o=r.now,a=r.options.animation!==!1&&!r.isHidden;t(o,{x:a?(2*o.x+e)/3:e,y:a?(o.y+i)/2:i,anchorX:a?(2*o.anchorX+n)/3:n,anchorY:a?(o.anchorY+s)/2:s}),r.label.attr(o),a&&(me(e-o.x)>1||me(i-o.y)>1)&&(clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){r&&r.move(e,i,n,s)},32))},hide:function(){if(!this.isHidden){var t=this.chart.hoverPoints;this.label.hide(),t&&Je(t,function(t){t.setState()}),this.chart.hoverPoints=null,this.isHidden=!0}},hideCrosshairs:function(){Je(this.crosshairs,function(t){t&&t.hide()})},getAnchor:function(t,e){var i,n,s=this.chart,r=s.inverted,o=0,a=0,t=d(t);return i=t[0].tooltipPos,i||(Je(t,function(t){n=t.series.yAxis,o+=t.plotX,a+=(t.plotLow?(t.plotLow+t.plotHigh)/2:t.plotY)+(!r&&n?n.top-s.plotTop:0)}),o/=t.length,a/=t.length,i=[r?s.plotWidth-a:o,this.shared&&!r&&t.length>1&&e?e.chartY-s.plotTop:r?s.plotHeight-o:a]),ti(i,ce)},getPosition:function(t,e,i){var n,s=this.chart,r=s.plotLeft,o=s.plotTop,a=s.plotWidth,l=s.plotHeight,h=p(this.options.distance,12),c=i.plotX,i=i.plotY,s=c+r+(s.inverted?h:-t-h),u=i-e+o+15;return 7>s&&(s=r+pe(c,0)+h),s+t>r+a&&(s-=s+t-(r+a),u=i-e+o-h,n=!0),o+5>u&&(u=o+5,n&&i>=u&&u+e>=i&&(u=i+o+h)),u+e>o+l&&(u=pe(o,o+l-e-h)),{x:s,y:u}},refresh:function(t,e){function i(){var t,e=this.points||d(this),i=e[0].series;return t=[i.tooltipHeaderFormatter(e[0].key)],Je(e,function(e){i=e.series,t.push(i.tooltipFormatter&&i.tooltipFormatter(e)||e.point.tooltipFormatter(i.tooltipOptions.pointFormat))}),t.push(h.footerFormat||""),t.join("")}var n,s,r,o,a=this.chart,l=this.label,h=this.options,c={},u=[];o=h.formatter||i;var f,c=a.hoverPoints,m=h.crosshairs;if(r=this.shared,s=this.getAnchor(t,e),n=s[0],s=s[1],!r||t.series&&t.series.noSharedTooltip?c=t.getLabelConfig():(a.hoverPoints=t,c&&Je(c,function(t){t.setState()}),Je(t,function(t){t.setState("hover"),u.push(t.getLabelConfig())}),c={x:t[0].category,y:t[0].y},c.points=u,t=t[0]),o=o.call(c),c=t.series,r=r||!c.isCartesian||c.tooltipOutsidePlot||a.isInsidePlot(n,s),o!==!1&&r?(this.isHidden&&l.show(),l.attr({text:o}),f=h.borderColor||t.color||c.color||"#606060",l.attr({stroke:f}),l=(h.positioner||this.getPosition).call(this,l.width,l.height,{plotX:n,plotY:s}),this.move(ce(l.x),ce(l.y),n+a.plotLeft,s+a.plotTop),this.isHidden=!1):this.hide(),m)for(m=d(m),l=m.length;l--;)r=t.series[l?"yAxis":"xAxis"],m[l]&&r&&(r=r.getPlotLinePath(l?p(t.stackY,t.y):t.x,1),this.crosshairs[l]?this.crosshairs[l].attr({d:r,visibility:"visible"}):(c={"stroke-width":m[l].width||1,stroke:m[l].color||"#C0C0C0",zIndex:m[l].zIndex||2},m[l].dashStyle&&(c.dashstyle=m[l].dashStyle),this.crosshairs[l]=a.renderer.path(r).attr(c).add()));si(a,"tooltipRefresh",{text:o,x:n+a.plotLeft,y:s+a.plotTop,borderColor:f})}},O.prototype={normalizeMouseEvent:function(e){var i,n,s,e=e||le.event;return e.target||(e.target=e.srcElement),e=ri(e),s=e.touches?e.touches.item(0):e,this.chartPosition=i=Qe(this.chart.container),s.pageX===j?(n=e.x,i=e.y):(n=s.pageX-i.left,i=s.pageY-i.top),t(e,{chartX:ce(n),chartY:ce(i)})},getMouseCoordinates:function(t){var e={xAxis:[],yAxis:[]},i=this.chart;return Je(i.axes,function(n){var s=n.isXAxis;e[s?"xAxis":"yAxis"].push({axis:n,value:n.translate(((i.inverted?!s:s)?t.chartX-i.plotLeft:n.top+n.len-t.chartY)-n.minPixelPadding,!0)})}),e},getIndex:function(t){var e=this.chart;return e.inverted?e.plotHeight+e.plotTop-t.chartY:t.chartX-e.plotLeft},onmousemove:function(t){var e,i,n,s=this.chart,r=s.series,o=s.tooltip,a=s.hoverPoint,l=s.hoverSeries,h=s.chartWidth,c=this.getIndex(t);if(o&&this.options.tooltip.shared&&(!l||!l.noSharedTooltip)){for(e=[],i=r.length,n=0;i>n;n++)r[n].visible&&r[n].options.enableMouseTracking!==!1&&!r[n].noSharedTooltip&&r[n].tooltipPoints.length&&(s=r[n].tooltipPoints[c],s._dist=me(c-s[r[n].xAxis.tooltipPosName||"plotX"]),h=fe(h,s._dist),e.push(s));for(i=e.length;i--;)e[i]._dist>h&&e.splice(i,1);e.length&&e[0].plotX!==this.hoverX&&(o.refresh(e,t),this.hoverX=e[0].plotX)}l&&l.tracker&&(s=l.tooltipPoints[c])&&s!==a&&s.onMouseOver()},resetTracker:function(t){var e=this.chart,i=e.hoverSeries,n=e.hoverPoint,s=e.tooltip,e=s&&s.shared?e.hoverPoints:n;(t=t&&s&&e)&&d(e)[0].plotX===j&&(t=!1),t?s.refresh(e):(n&&n.onMouseOut(),i&&i.onMouseOut(),s&&(s.hide(),s.hideCrosshairs()),this.hoverX=null)},setDOMEvents:function(){function e(){if(n.selectionMarker){var t,o={xAxis:[],yAxis:[]},a=n.selectionMarker.getBBox(),l=a.x-s.plotLeft,h=a.y-s.plotTop;i&&(Je(s.axes,function(e){if(e.options.zoomEnabled!==!1){var i=e.isXAxis,n=s.inverted?!i:i,r=e.translate(n?l:s.plotHeight-h-a.height,!0,0,0,1),n=e.translate((n?l+a.width:s.plotHeight-h)-2*e.minPixelPadding,!0,0,0,1);!isNaN(r)&&!isNaN(n)&&(o[i?"xAxis":"yAxis"].push({axis:e,min:fe(r,n),max:pe(r,n)}),t=!0)}}),t&&si(s,"selection",o,function(t){s.zoom(t)})),n.selectionMarker=n.selectionMarker.destroy()}s&&(f(r,{cursor:"auto"}),s.cancelClick=i,s.mouseIsDown=i=!1),ni(ae,Ee?"touchend":"mouseup",e)}var i,n=this,s=n.chart,r=s.container,o=n.zoomX&&!s.inverted||n.zoomY&&s.inverted,a=n.zoomY&&!s.inverted||n.zoomX&&s.inverted;n.hideTooltipOnMouseMove=function(t){t=ri(t),n.chartPosition&&s.hoverSeries&&s.hoverSeries.isCartesian&&!s.isInsidePlot(t.pageX-n.chartPosition.left-s.plotLeft,t.pageY-n.chartPosition.top-s.plotTop)&&n.resetTracker()},n.hideTooltipOnMouseLeave=function(){n.resetTracker(),n.chartPosition=null},r.onmousedown=function(t){t=n.normalizeMouseEvent(t),!Ee&&t.preventDefault&&t.preventDefault(),s.mouseIsDown=!0,s.cancelClick=!1,s.mouseDownX=n.mouseDownX=t.chartX,n.mouseDownY=t.chartY,ii(ae,Ee?"touchend":"mouseup",e)};var l=function(t){if(!(t&&t.touches&&t.touches.length>1)){t=n.normalizeMouseEvent(t),Ee||(t.returnValue=!1);var e=t.chartX,r=t.chartY,l=!s.isInsidePlot(e-s.plotLeft,r-s.plotTop);if(Ee&&"touchstart"===t.type&&(u(t.target,"isTracker")?s.runTrackerClick||t.preventDefault():!s.runChartClick&&!l&&t.preventDefault()),l&&(e<s.plotLeft?e=s.plotLeft:e>s.plotLeft+s.plotWidth&&(e=s.plotLeft+s.plotWidth),r<s.plotTop?r=s.plotTop:r>s.plotTop+s.plotHeight&&(r=s.plotTop+s.plotHeight)),s.mouseIsDown&&"touchstart"!==t.type&&(i=Math.sqrt(Math.pow(n.mouseDownX-e,2)+Math.pow(n.mouseDownY-r,2)),i>10)){var h=s.isInsidePlot(n.mouseDownX-s.plotLeft,n.mouseDownY-s.plotTop);if(s.hasCartesianSeries&&(n.zoomX||n.zoomY)&&h&&!n.selectionMarker&&(n.selectionMarker=s.renderer.rect(s.plotLeft,s.plotTop,o?1:s.plotWidth,a?1:s.plotHeight,0).attr({fill:n.options.chart.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add()),n.selectionMarker&&o){var c=e-n.mouseDownX;n.selectionMarker.attr({width:me(c),x:(c>0?0:c)+n.mouseDownX})}n.selectionMarker&&a&&(r-=n.mouseDownY,n.selectionMarker.attr({height:me(r),y:(r>0?0:r)+n.mouseDownY})),h&&!n.selectionMarker&&n.options.chart.panning&&s.pan(e)}return l||n.onmousemove(t),l||!s.hasCartesianSeries}};r.onmousemove=l,ii(r,"mouseleave",n.hideTooltipOnMouseLeave),ii(ae,"mousemove",n.hideTooltipOnMouseMove),r.ontouchstart=function(t){(n.zoomX||n.zoomY)&&r.onmousedown(t),l(t)},r.ontouchmove=l,r.ontouchend=function(){i&&n.resetTracker()},r.onclick=function(e){var i,r,o=s.hoverPoint,e=n.normalizeMouseEvent(e);e.cancelBubble=!0,s.cancelClick||(o&&(u(e.target,"isTracker")||u(e.target.parentNode,"isTracker"))?(i=o.plotX,r=o.plotY,t(o,{pageX:n.chartPosition.left+s.plotLeft+(s.inverted?s.plotWidth-r:i),pageY:n.chartPosition.top+s.plotTop+(s.inverted?s.plotHeight-i:r)}),si(o.series,"click",t(e,{point:o})),o.firePointEvent("click",e)):(t(e,n.getMouseCoordinates(e)),s.isInsidePlot(e.chartX-s.plotLeft,e.chartY-s.plotTop)&&si(s,"click",e)))}},destroy:function(){var t=this.chart,e=t.container;t.trackerGroup&&(t.trackerGroup=t.trackerGroup.destroy()),ni(e,"mouseleave",this.hideTooltipOnMouseLeave),ni(ae,"mousemove",this.hideTooltipOnMouseMove),e.onclick=e.onmousedown=e.onmousemove=e.ontouchstart=e.ontouchend=e.ontouchmove=null,clearInterval(this.tooltipTimeout)},init:function(t,e){t.trackerGroup||(t.trackerGroup=t.renderer.g("tracker").attr({zIndex:9}).add()),e.enabled&&(t.tooltip=new P(t,e)),this.setDOMEvents()}},H.prototype={init:function(t){var e=this,n=e.options=t.options.legend;if(n.enabled){var s=n.itemStyle,r=p(n.padding,8),o=n.itemMarginTop||0;e.baseline=i(s.fontSize)+3+o,e.itemStyle=s,e.itemHiddenStyle=ei(s,n.itemHiddenStyle),e.itemMarginTop=o,e.padding=r,e.initialItemX=r,e.initialItemY=r-5,e.maxItemWidth=0,e.chart=t,e.itemHeight=0,e.lastLineHeight=0,e.render(),ii(e.chart,"endResize",function(){e.positionCheckboxes()})}},colorizeItem:function(t,e){var i,n=this.options,s=t.legendItem,r=t.legendLine,o=t.legendSymbol,a=this.itemHiddenStyle.color,n=e?n.itemStyle.color:a,l=e?t.color:a,a=t.options&&t.options.marker,h={stroke:l,fill:l};if(s&&s.css({fill:n}),r&&r.attr({stroke:l}),o){if(a)for(i in a=t.convertAttribs(a))s=a[i],s!==j&&(h[i]=s);o.attr(h)}},positionItem:function(t){var e=this.options,i=e.symbolPadding,e=!e.rtl,n=t._legendItemPos,s=n[0],n=n[1],r=t.checkbox;t.legendGroup&&t.legendGroup.translate(e?s:this.legendWidth-s-2*i-4,n),r&&(r.x=s,r.y=n)},destroyItem:function(t){var e=t.checkbox;Je(["legendItem","legendLine","legendSymbol","legendGroup"],function(e){t[e]&&t[e].destroy()}),e&&T(t.checkbox)},destroy:function(){var t=this.group,e=this.box;e&&(this.box=e.destroy()),t&&(this.group=t.destroy())},positionCheckboxes:function(){var t=this;Je(t.allItems,function(e){var i=e.checkbox,n=t.group.alignAttr;i&&f(i,{left:n.translateX+e.legendItemWidth+i.x-20+"px",top:n.translateY+i.y+3+"px"})})},renderItem:function(t){var e,i=this,n=i.chart,s=n.renderer,r=i.options,o="horizontal"===r.layout,a=r.symbolWidth,l=r.symbolPadding,h=i.itemStyle,c=i.itemHiddenStyle,u=i.padding,d=!r.rtl,p=r.width,f=r.itemMarginBottom||0,g=i.itemMarginTop,v=i.initialItemX,y=t.legendItem,b=t.series||t,x=b.options,w=x.showCheckbox;!y&&(t.legendGroup=s.g("legend-item").attr({zIndex:1}).add(i.scrollGroup),b.drawLegendSymbol(i,t),t.legendItem=y=s.text(r.labelFormatter.call(t),d?a+l:-l,i.baseline,r.useHTML).css(ei(t.visible?h:c)).attr({align:d?"left":"right",zIndex:2}).add(t.legendGroup),t.legendGroup.on("mouseover",function(){t.setState("hover"),y.css(i.options.itemHoverStyle)}).on("mouseout",function(){y.css(t.visible?h:c),t.setState()}).on("click",function(e){var i=function(){t.setVisible()},e={browserEvent:e};t.firePointEvent?t.firePointEvent("legendItemClick",e,i):si(t,"legendItemClick",e,i)}),i.colorizeItem(t,t.visible),x&&w)&&(t.checkbox=m("input",{type:"checkbox",checked:t.selected,defaultChecked:t.selected},r.itemCheckboxStyle,n.container),ii(t.checkbox,"click",function(e){si(t,"checkboxClick",{checked:e.target.checked},function(){t.select()})})),s=y.getBBox(),e=t.legendItemWidth=r.itemWidth||a+l+s.width+u+(w?20:0),r=e,i.itemHeight=a=s.height,o&&i.itemX-v+r>(p||n.chartWidth-2*u-v)&&(i.itemX=v,i.itemY+=g+i.lastLineHeight+f,i.lastLineHeight=0),i.maxItemWidth=pe(i.maxItemWidth,r),i.lastItemY=g+i.itemY+f,i.lastLineHeight=pe(a,i.lastLineHeight),t._legendItemPos=[i.itemX,i.itemY],o?i.itemX+=r:(i.itemY+=g+a+f,i.lastLineHeight=a),i.offsetWidth=p||pe(o?i.itemX-v:r,i.offsetWidth)},render:function(){var e,i,n,s,r=this,o=r.chart,a=o.renderer,l=r.group,h=r.box,c=r.options,u=r.padding,d=c.borderWidth,p=c.backgroundColor;r.itemX=r.initialItemX,r.itemY=r.initialItemY,r.offsetWidth=0,r.lastItemY=0,l||(r.group=l=a.g("legend").attr({zIndex:7}).add(),r.contentGroup=a.g().attr({zIndex:1}).add(l),r.scrollGroup=a.g().add(r.contentGroup),r.clipRect=a.clipRect(0,0,9999,o.chartHeight),r.contentGroup.clip(r.clipRect)),e=[],Je(o.series,function(t){var i=t.options;i.showInLegend&&(e=e.concat(t.legendItems||("point"===i.legendType?t.data:t)))}),_(e,function(t,e){return(t.options&&t.options.legendIndex||0)-(e.options&&e.options.legendIndex||0)}),c.reversed&&e.reverse(),r.allItems=e,r.display=i=!!e.length,Je(e,function(t){r.renderItem(t)}),n=c.width||r.offsetWidth,s=r.lastItemY+r.lastLineHeight,s=r.handleOverflow(s),(d||p)&&(n+=u,s+=u,h?n>0&&s>0&&(h[h.isNew?"attr":"animate"](h.crisp(null,null,null,n,s)),h.isNew=!1):(r.box=h=a.rect(0,0,n,s,c.borderRadius,d||0).attr({stroke:c.borderColor,"stroke-width":d||0,fill:p||$e}).add(l).shadow(c.shadow),h.isNew=!0),h[i?"show":"hide"]()),r.legendWidth=n,r.legendHeight=s,Je(e,function(t){r.positionItem(t)}),i&&l.align(t({width:n,height:s},c),!0,o.spacingBox),o.isResizing||this.positionCheckboxes()},handleOverflow:function(t){var e=this,i=this.chart,n=i.renderer,s=this.options,r=s.y,r=i.spacingBox.height+("top"===s.verticalAlign?-r:r)-this.padding,o=s.maxHeight,a=this.clipRect,l=s.navigation,h=p(l.animation,!0),c=l.arrowSize||12,u=this.nav;return"horizontal"===s.layout&&(r/=2),o&&(r=fe(r,o)),t>r?(this.clipHeight=i=r-20,this.pageCount=de(t/i),this.currentPage=p(this.currentPage,1),this.fullHeight=t,a.attr({height:i}),u||(this.nav=u=n.g().attr({zIndex:1}).add(this.group),this.up=n.symbol("triangle",0,0,c,c).on("click",function(){e.scroll(-1,h)}).add(u),this.pager=n.text("",15,10).css(l.style).add(u),this.down=n.symbol("triangle-down",0,0,c,c).on("click",function(){e.scroll(1,h)}).add(u)),e.scroll(0),t=r):u&&(a.attr({height:i.chartHeight}),u.hide(),this.scrollGroup.attr({translateY:1})),t},scroll:function(t,e){var i=this.pageCount,n=this.currentPage+t,s=this.clipHeight,r=this.options.navigation,o=r.activeColor,r=r.inactiveColor,a=this.pager,l=this.padding;n>i&&(n=i),n>0&&(e!==j&&E(e,this.chart),this.nav.attr({translateX:l,translateY:s+7,visibility:"visible"}),this.up.attr({fill:1===n?r:o}).css({cursor:1===n?"default":"pointer"}),a.attr({text:n+"/"+this.pageCount}),this.down.attr({x:18+this.pager.getBBox().width,fill:n===i?r:o}).css({cursor:n===i?"default":"pointer"}),this.scrollGroup.animate({translateY:-fe(s*(n-1),this.fullHeight-s+l)+1}),a.attr({text:n+"/"+i}),this.currentPage=n)}},W.prototype={initSeries:function(t){var e=this.options.chart,e=new Ve[t.type||e.type||e.defaultSeriesType];return e.init(this,t),e},addSeries:function(t,e,i){var n,s=this;return t&&(E(i,s),e=p(e,!0),si(s,"addSeries",{options:t},function(){n=s.initSeries(t),s.isDirtyLegend=!0,e&&s.redraw()})),n},isInsidePlot:function(t,e,i){var n=i?e:t,t=i?t:e;return n>=0&&n<=this.plotWidth&&t>=0&&t<=this.plotHeight},adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&Je(this.axes,function(t){t.adjustTickAmount()}),this.maxTicks=null},redraw:function(t){var e,i=this.axes,n=this.series,s=this.tracker,r=this.legend,o=this.isDirtyLegend,a=this.isDirtyBox,l=n.length,h=l,c=this.renderer,u=c.isHidden(),d=[];for(E(t,this),u&&this.cloneRenderTo();h--;)if(t=n[h],t.isDirty&&t.options.stacking){e=!0;break}if(e)for(h=l;h--;)t=n[h],t.options.stacking&&(t.isDirty=!0);Je(n,function(t){t.isDirty&&"point"===t.options.legendType&&(o=!0)}),o&&r.options.enabled&&(r.render(),this.isDirtyLegend=!1),this.hasCartesianSeries&&(this.isResizing||(this.maxTicks=null,Je(i,function(t){t.setScale()})),this.adjustTickAmounts(),this.getMargins(),Je(i,function(t){t.isDirtyExtremes&&(t.isDirtyExtremes=!1,d.push(function(){si(t,"afterSetExtremes",t.getExtremes())})),(t.isDirty||a||e)&&(t.redraw(),a=!0)})),a&&this.drawChartBox(),Je(n,function(t){t.isDirty&&t.visible&&(!t.isCartesian||t.xAxis)&&t.redraw()}),s&&s.resetTracker&&s.resetTracker(!0),c.draw(),si(this,"redraw"),u&&this.cloneRenderTo(!0),Je(d,function(t){t.call()})},showLoading:function(e){var i=this.options,n=this.loadingDiv,s=i.loading;n||(this.loadingDiv=n=m(Ne,{className:"highcharts-loading"},t(s.style,{left:this.plotLeft+"px",top:this.plotTop+"px",width:this.plotWidth+"px",height:this.plotHeight+"px",zIndex:10,display:$e}),this.container),this.loadingSpan=m("span",null,s.labelStyle,n)),this.loadingSpan.innerHTML=e||i.lang.loading,this.loadingShown||(f(n,{opacity:0,display:""}),oi(n,{opacity:s.style.opacity},{duration:s.showDuration||0}),this.loadingShown=!0)},hideLoading:function(){var t=this.options,e=this.loadingDiv;e&&oi(e,{opacity:0},{duration:t.loading.hideDuration||100,complete:function(){f(e,{display:$e})}}),this.loadingShown=!1},get:function(t){var e,i,n=this.axes,s=this.series;for(e=0;e<n.length;e++)if(n[e].options.id===t)return n[e];for(e=0;e<s.length;e++)if(s[e].options.id===t)return s[e];for(e=0;e<s.length;e++)for(i=s[e].points||[],n=0;n<i.length;n++)if(i[n].id===t)return i[n];return null},getAxes:function(){var t=this,e=this.options,i=e.xAxis||{},e=e.yAxis||{},i=d(i);Je(i,function(t,e){t.index=e,t.isX=!0}),e=d(e),Je(e,function(t,e){t.index=e}),i=i.concat(e),Je(i,function(e){new z(t,e)}),t.adjustTickAmounts()},getSelectedPoints:function(){var t=[];return Je(this.series,function(e){t=t.concat(Ze(e.points,function(t){return t.selected}))}),t},getSelectedSeries:function(){return Ze(this.series,function(t){return t.selected})},showResetZoom:function(){var t=this,e=Y.lang,i=t.options.chart.resetZoomButton,n=i.theme,s=n.states,r="chart"===i.relativeTo?null:"plotBox";this.resetZoomButton=t.renderer.button(e.resetZoom,null,null,function(){t.zoomOut()},n,s&&s.hover).attr({align:i.position.align,title:e.resetZoomTitle}).add().align(i.position,!1,t[r]),this.resetZoomButton.alignTo=r},zoomOut:function(){var t=this,e=t.resetZoomButton;si(t,"selection",{resetSelection:!0},function(){t.zoom()}),e&&(t.resetZoomButton=e.destroy())},zoom:function(t){var e,i=this;!t||t.resetSelection?Je(i.axes,function(t){e=t.zoom()}):Je(t.xAxis.concat(t.yAxis),function(t){var n=t.axis;i.tracker[n.isXAxis?"zoomX":"zoomY"]&&(e=n.zoom(t.min,t.max))}),i.resetZoomButton||i.showResetZoom(),e&&i.redraw(p(i.options.chart.animation,i.pointCount<100))},pan:function(t){var e=this.xAxis[0],i=this.mouseDownX,n=e.pointRange/2,s=e.getExtremes(),r=e.translate(i-t,!0)+n,i=e.translate(i+this.plotWidth-t,!0)-n;(n=this.hoverPoints)&&Je(n,function(t){t.setState()}),e.series.length&&r>fe(s.dataMin,s.min)&&i<pe(s.dataMax,s.max)&&e.setExtremes(r,i,!0,!1,{trigger:"pan"}),this.mouseDownX=t,f(this.container,{cursor:"move"})},setTitle:function(t,e){var i,n=this,s=n.options;n.chartTitleOptions=i=ei(s.title,t),n.chartSubtitleOptions=s=ei(s.subtitle,e),Je([["title",t,i],["subtitle",e,s]],function(t){var e=t[0],i=n[e],s=t[1],t=t[2];i&&s&&(n[e]=i=i.destroy()),t&&t.text&&!i&&(n[e]=n.renderer.text(t.text,0,0,t.useHTML).attr({align:t.align,"class":"highcharts-"+e,zIndex:t.zIndex||4}).css(t.style).add().align(t,!1,n.spacingBox))})},getChartSize:function(){var t=this.options.chart,e=this.renderToClone||this.renderTo;this.containerWidth=qe(e,"width"),this.containerHeight=qe(e,"height"),this.chartWidth=t.width||this.containerWidth||600,this.chartHeight=t.height||(this.containerHeight>19?this.containerHeight:400)},cloneRenderTo:function(t){var e=this.renderToClone,i=this.container;t?e&&(this.renderTo.appendChild(i),T(e),delete this.renderToClone):(i&&this.renderTo.removeChild(i),this.renderToClone=e=this.renderTo.cloneNode(0),f(e,{position:"absolute",top:"-9999px",display:"block"}),ae.body.appendChild(e),i&&e.appendChild(i))},getContainer:function(){var e,i,s,r,o=this.options.chart;this.renderTo=e=o.renderTo,r="highcharts-"+Ie++,n(e)&&(this.renderTo=e=ae.getElementById(e)),e||S(13,!0),e.innerHTML="",e.offsetWidth||this.cloneRenderTo(),this.getChartSize(),i=this.chartWidth,s=this.chartHeight,this.container=e=m(Ne,{className:"highcharts-container"+(o.className?" "+o.className:""),id:r},t({position:"relative",overflow:"hidden",width:i+"px",height:s+"px",textAlign:"left",lineHeight:"normal",zIndex:0},o.style),this.renderToClone||e),this.renderer=o.forExport?new ci(e,i,s,!0):new R(e,i,s),Ae&&this.renderer.create(this,e,i,s)},getMargins:function(){var t,e=this.options.chart,i=e.spacingTop,n=e.spacingRight,s=e.spacingBottom,e=e.spacingLeft,r=this.legend,o=this.optionsMarginTop,a=this.optionsMarginLeft,l=this.optionsMarginRight,h=this.optionsMarginBottom,u=this.chartTitleOptions,d=this.chartSubtitleOptions,f=this.options.legend,m=p(f.margin,10),g=f.x,v=f.y,y=f.align,b=f.verticalAlign;this.resetMargins(),t=this.axisOffset,!this.title&&!this.subtitle||c(this.optionsMarginTop)||(d=pe(this.title&&!u.floating&&!u.verticalAlign&&u.y||0,this.subtitle&&!d.floating&&!d.verticalAlign&&d.y||0))&&(this.plotTop=pe(this.plotTop,d+p(u.margin,15)+i)),r.display&&!f.floating&&("right"===y?c(l)||(this.marginRight=pe(this.marginRight,r.legendWidth-g+m+n)):"left"===y?c(a)||(this.plotLeft=pe(this.plotLeft,r.legendWidth+g+m+e)):"top"===b?c(o)||(this.plotTop=pe(this.plotTop,r.legendHeight+v+m+i)):"bottom"!==b||c(h)||(this.marginBottom=pe(this.marginBottom,r.legendHeight-v+m+s))),this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin),this.extraTopMargin&&(this.plotTop+=this.extraTopMargin),this.hasCartesianSeries&&Je(this.axes,function(t){t.getOffset()}),c(a)||(this.plotLeft+=t[3]),c(o)||(this.plotTop+=t[0]),c(h)||(this.marginBottom+=t[2]),c(l)||(this.marginRight+=t[1]),this.setChartSize()},initReflow:function(){function t(t){var r=n.width||qe(s,"width"),o=n.height||qe(s,"height"),t=t?t.target:le;r&&o&&(t===le||t===ae)&&((r!==i.containerWidth||o!==i.containerHeight)&&(clearTimeout(e),i.reflowTimeout=e=setTimeout(function(){i.container&&i.resize(r,o,!1)},100)),i.containerWidth=r,i.containerHeight=o)}var e,i=this,n=i.options.chart,s=i.renderTo;ii(le,"resize",t),ii(i,"destroy",function(){ni(le,"resize",t)})},resize:function(t,e,i){var n,s,r,o=this,a=o.resetZoomButton,l=o.title,h=o.subtitle;o.isResizing+=1,r=function(){o&&si(o,"endResize",null,function(){o.isResizing-=1})},E(i,o),o.oldChartHeight=o.chartHeight,o.oldChartWidth=o.chartWidth,c(t)&&(o.chartWidth=n=ce(t)),c(e)&&(o.chartHeight=s=ce(e)),f(o.container,{width:n+"px",height:s+"px"}),o.renderer.setSize(n,s,i),o.plotWidth=n-o.plotLeft-o.marginRight,o.plotHeight=s-o.plotTop-o.marginBottom,o.maxTicks=null,Je(o.axes,function(t){t.isDirty=!0,t.setScale()}),Je(o.series,function(t){t.isDirty=!0}),o.isDirtyLegend=!0,o.isDirtyBox=!0,o.getMargins(),t=o.spacingBox,l&&l.align(null,null,t),h&&h.align(null,null,t),a&&a.align&&a.align(null,null,o[a.alignTo]),o.redraw(i),o.oldChartHeight=null,si(o,"resize"),U===!1?r():setTimeout(r,U&&U.duration||500)},setChartSize:function(){var t,e,i,n,s=this.inverted,r=this.chartWidth,o=this.chartHeight,a=this.options.chart,l=a.spacingTop,h=a.spacingRight,c=a.spacingBottom,u=a.spacingLeft;this.plotLeft=t=ce(this.plotLeft),this.plotTop=e=ce(this.plotTop),this.plotWidth=i=ce(r-t-this.marginRight),this.plotHeight=n=ce(o-e-this.marginBottom),this.plotSizeX=s?n:i,this.plotSizeY=s?i:n,this.plotBorderWidth=s=a.plotBorderWidth||0,this.spacingBox={x:u,y:l,width:r-u-h,height:o-l-c},this.plotBox={x:t,y:e,width:i,height:n},this.clipBox={x:s/2,y:s/2,width:this.plotSizeX-s,height:this.plotSizeY-s},Je(this.axes,function(t){t.setAxisSize(),t.setAxisTranslation()})},resetMargins:function(){var t=this.options.chart,e=t.spacingRight,i=t.spacingBottom,n=t.spacingLeft;this.plotTop=p(this.optionsMarginTop,t.spacingTop),this.marginRight=p(this.optionsMarginRight,e),this.marginBottom=p(this.optionsMarginBottom,i),this.plotLeft=p(this.optionsMarginLeft,n),this.axisOffset=[0,0,0,0]},drawChartBox:function(){var t,e=this.options.chart,i=this.renderer,n=this.chartWidth,s=this.chartHeight,r=this.chartBackground,o=this.plotBackground,a=this.plotBorder,l=this.plotBGImage,h=e.borderWidth||0,c=e.backgroundColor,u=e.plotBackgroundColor,d=e.plotBackgroundImage,p=e.plotBorderWidth||0,f=this.plotLeft,m=this.plotTop,g=this.plotWidth,v=this.plotHeight,y=this.plotBox,b=this.clipRect,x=this.clipBox;t=h+(e.shadow?8:0),(h||c)&&(r?r.animate(r.crisp(null,null,null,n-t,s-t)):(r={fill:c||$e},h&&(r.stroke=e.borderColor,r["stroke-width"]=h),this.chartBackground=i.rect(t/2,t/2,n-t,s-t,e.borderRadius,h).attr(r).add().shadow(e.shadow))),u&&(o?o.animate(y):this.plotBackground=i.rect(f,m,g,v,0).attr({fill:u}).add().shadow(e.plotShadow)),d&&(l?l.animate(y):this.plotBGImage=i.image(d,f,m,g,v).add()),b?b.animate({width:x.width,height:x.height}):this.clipRect=i.clipRect(x),p&&(a?a.animate(a.crisp(null,f,m,g,v)):this.plotBorder=i.rect(f,m,g,v,0,p).attr({stroke:e.plotBorderColor,"stroke-width":p,zIndex:1}).add()),this.isDirtyBox=!1},propFromSeries:function(){var t,e,i,n=this,s=n.options.chart,r=n.options.series;Je(["inverted","angular","polar"],function(o){for(t=Ve[s.type||s.defaultSeriesType],i=n[o]||s[o]||t&&t.prototype[o],e=r&&r.length;!i&&e--;)(t=Ve[r[e].type])&&t.prototype[o]&&(i=!0);n[o]=i})},render:function(){var e,n=this,s=n.axes,r=n.renderer,o=n.options,a=o.labels,o=o.credits;n.setTitle(),n.legend=new H(n),Je(s,function(t){t.setScale()}),n.getMargins(),n.maxTicks=null,Je(s,function(t){t.setTickPositions(!0),t.setMaxTicks()}),n.adjustTickAmounts(),n.getMargins(),n.drawChartBox(),n.hasCartesianSeries&&Je(s,function(t){t.render()}),n.seriesGroup||(n.seriesGroup=r.g("series-group").attr({zIndex:3}).add()),Je(n.series,function(t){t.translate(),t.setTooltipPoints(),t.render()}),a.items&&Je(a.items,function(e){var s=t(a.style,e.style),o=i(s.left)+n.plotLeft,l=i(s.top)+n.plotTop+12;delete s.left,delete s.top,r.text(e.html,o,l).attr({zIndex:2}).css(s).add()}),o.enabled&&!n.credits&&(e=o.href,n.credits=r.text(o.text,0,0).on("click",function(){e&&(location.href=e)}).attr({align:o.position.align,zIndex:8}).css(o.style).add().align(o.position)),n.hasRendered=!0},destroy:function(){var t,e=this,i=e.axes,n=e.series,s=e.container,r=s&&s.parentNode;for(si(e,"destroy"),ni(e),t=i.length;t--;)i[t]=i[t].destroy();for(t=n.length;t--;)n[t]=n[t].destroy();Je("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,tracker,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","),function(t){var i=e[t];i&&i.destroy&&(e[t]=i.destroy())}),s&&(s.innerHTML="",ni(s),r&&T(s));for(t in e)delete e[t]},firstRender:function(){var t=this,e=t.options,i=t.callback;!Te&&le==le.top&&"complete"!==ae.readyState||Ae&&!le.canvg?Ae?fi.push(function(){t.firstRender()},e.global.canvasToolsURL):ae.attachEvent("onreadystatechange",function(){ae.detachEvent("onreadystatechange",t.firstRender),"complete"===ae.readyState&&t.firstRender()}):(t.getContainer(),si(t,"init"),Highcharts.RangeSelector&&e.rangeSelector.enabled&&(t.rangeSelector=new Highcharts.RangeSelector(t)),t.resetMargins(),t.setChartSize(),t.propFromSeries(),t.getAxes(),Je(e.series||[],function(e){t.initSeries(e)}),Highcharts.Scroller&&(e.navigator.enabled||e.scrollbar.enabled)&&(t.scroller=new Highcharts.Scroller(t)),t.tracker=new O(t,e),t.render(),t.renderer.draw(),i&&i.apply(t,[t]),Je(t.callbacks,function(e){e.apply(t,[t])}),t.cloneRenderTo(!0),si(t,"load"))},init:function(t){var e,i=this.options.chart;if(i.reflow!==!1&&ii(this,"load",this.initReflow),t)for(e in t)ii(this,e,t[e]);this.xAxis=[],this.yAxis=[],this.animation=Ae?!1:p(i.animation,!0),this.setSize=this.resize,this.pointCount=0,this.counters=new k,this.firstRender()}},W.prototype.callbacks=[];var mi=function(){};mi.prototype={init:function(t,e,i){var n=t.chart.counters;return this.series=t,this.applyOptions(e,i),this.pointAttr={},t.options.colorByPoint&&(e=t.chart.options.colors,this.color=this.color||e[n.color++],n.wrapColor(e.length)),t.chart.pointCount++,this},applyOptions:function(e,i){var n=this.series,s=typeof e;this.config=e,"number"===s||null===e?this.y=e:"number"==typeof e[0]?(this.x=e[0],this.y=e[1]):"object"===s&&"number"!=typeof e.length?(t(this,e),this.options=e,e.dataLabels&&(n._hasPointLabels=!0),e.marker&&(n._hasPointMarkers=!0)):"string"==typeof e[0]&&(this.name=e[0],this.y=e[1]),this.x===j&&(this.x=i===j?n.autoIncrement():i)},destroy:function(){var t,e=this.series.chart,i=e.hoverPoints;e.pointCount--,i&&(this.setState(),h(i,this),!i.length)&&(e.hoverPoints=null),this===e.hoverPoint&&this.onMouseOut(),(this.graphic||this.dataLabel)&&(ni(this),this.destroyElements()),this.legendItem&&e.legend.destroyItem(this);for(t in this)this[t]=null},destroyElements:function(){for(var t,e="graphic,tracker,dataLabel,group,connector,shadowGroup".split(","),i=6;i--;)t=e[i],this[t]&&(this[t]=this[t].destroy())},getLabelConfig:function(){return{x:this.category,y:this.y,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},select:function(t,e){var i=this,n=i.series.chart,t=p(t,!i.selected);i.firePointEvent(t?"select":"unselect",{accumulate:e},function(){i.selected=t,i.setState(t&&"select"),e||Je(n.getSelectedPoints(),function(t){t.selected&&t!==i&&(t.selected=!1,t.setState(""),t.firePointEvent("unselect"))})})},onMouseOver:function(){var t=this.series,e=t.chart,i=e.tooltip,n=e.hoverPoint;n&&n!==this&&n.onMouseOut(),this.firePointEvent("mouseOver"),i&&(!i.shared||t.noSharedTooltip)&&i.refresh(this),this.setState("hover"),e.hoverPoint=this},onMouseOut:function(){var t=this.series.chart,e=t.hoverPoints;e&&-1!==Ke(this,e)||(this.firePointEvent("mouseOut"),this.setState(),t.hoverPoint=null)},tooltipFormatter:function(t){var e,i,s,r,o=this.series,a=o.tooltipOptions,l=t.match(/\{(series|point)\.[a-zA-Z]+\}/g),h=/[{\.}]/,c={y:0,open:0,high:0,low:0,close:0,percentage:1,total:1};a.valuePrefix=a.valuePrefix||a.yPrefix,a.valueDecimals=a.valueDecimals||a.yDecimals,a.valueSuffix=a.valueSuffix||a.ySuffix;for(r in l)i=l[r],n(i)&&i!==t&&(s=(" "+i).split(h),e={point:this,series:o}[s[1]],s=s[2],e===this&&c.hasOwnProperty(s)?(e=c[s]?s:"value",e=(a[e+"Prefix"]||"")+v(this[s],p(a[e+"Decimals"],-1))+(a[e+"Suffix"]||"")):e=e[s],t=t.replace(i,e));return t},update:function(t,e,i){var n,r=this,o=r.series,a=r.graphic,l=o.data,h=l.length,c=o.chart,e=p(e,!0);r.firePointEvent("update",{options:t},function(){for(r.applyOptions(t),s(t)&&(o.getAttribs(),a&&a.attr(r.pointAttr[o.state])),n=0;h>n;n++)if(l[n]===r){o.xData[n]=r.x,o.yData[n]=r.y,o.options.data[n]=t;break}o.isDirty=!0,o.isDirtyData=!0,e&&c.redraw(i)})},remove:function(t,e){var i,n=this,s=n.series,r=s.chart,o=s.data,a=o.length;E(e,r),t=p(t,!0),n.firePointEvent("remove",null,function(){for(i=0;a>i;i++)if(o[i]===n){o.splice(i,1),s.options.data.splice(i,1),s.xData.splice(i,1),s.yData.splice(i,1);break}n.destroy(),s.isDirty=!0,s.isDirtyData=!0,t&&r.redraw()})},firePointEvent:function(t,e,i){var n=this,s=this.series.options;(s.point.events[t]||n.options&&n.options.events&&n.options.events[t])&&this.importEvents(),"click"===t&&s.allowPointSelect&&(i=function(t){n.select(null,t.ctrlKey||t.metaKey||t.shiftKey)}),si(this,t,e,i)},importEvents:function(){if(!this.hasImportedEvents){var t,e=ei(this.series.options.point,this.options).events;this.events=e;for(t in e)ii(this,t,e[t]);this.hasImportedEvents=!0}},setState:function(t){var e=this.plotX,i=this.plotY,n=this.series,s=n.options.states,r=li[n.type].marker&&n.options.marker,o=r&&!r.enabled,a=r&&r.states[t],l=a&&a.enabled===!1,h=n.stateMarkerGraphic,c=n.chart,u=this.pointAttr,t=t||"";t===this.state||this.selected&&"select"!==t||s[t]&&s[t].enabled===!1||t&&(l||o&&!a.enabled)||(this.graphic?(s=r&&this.graphic.symbolName&&u[t].r,this.graphic.attr(ei(u[t],s?{x:e-s,y:i-s,width:2*s,height:2*s}:{}))):(t&&a&&(s=a.radius,h?h.attr({x:e-s,y:i-s}):n.stateMarkerGraphic=h=c.renderer.symbol(n.symbol,e-s,i-s,2*s,2*s).attr(u[t]).add(n.markerGroup)),h&&h[t&&c.isInsidePlot(e,i)?"show":"hide"]()),this.state=t)}};var gi=function(){};gi.prototype={isCartesian:!0,type:"line",pointClass:mi,sorted:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},init:function(e,i){var n,s;this.chart=e,this.options=i=this.setOptions(i),this.bindAxes(),t(this,{name:i.name,state:"",pointAttr:{},visible:i.visible!==!1,selected:i.selected===!0}),Ae&&(i.animation=!1),s=i.events;for(n in s)ii(this,n,s[n]);(s&&s.click||i.point&&i.point.events&&i.point.events.click||i.allowPointSelect)&&(e.runTrackerClick=!0),this.getColor(),this.getSymbol(),this.setData(i.data,!1),this.isCartesian&&(e.hasCartesianSeries=!0),e.series.push(this),_(e.series,function(t,e){return(t.options.index||0)-(e.options.index||0)}),Je(e.series,function(t,e){t.index=e,t.name=t.name||"Series "+(e+1)})},bindAxes:function(){var t,e=this,i=e.options,n=e.chart;e.isCartesian&&Je(["xAxis","yAxis"],function(s){Je(n[s],function(n){t=n.options,(i[s]===t.index||i[s]===j&&0===t.index)&&(n.series.push(e),e[s]=n,n.isDirty=!0)
388
- })})},autoIncrement:function(){var t=this.options,e=this.xIncrement,e=p(e,t.pointStart,0);return this.pointInterval=p(this.pointInterval,t.pointInterval,1),this.xIncrement=e+this.pointInterval,e},getSegments:function(){var t,e=-1,i=[],n=this.points,s=n.length;if(s)if(this.options.connectNulls){for(t=s;t--;)null===n[t].y&&n.splice(t,1);n.length&&(i=[n])}else Je(n,function(t,r){null===t.y?(r>e+1&&i.push(n.slice(e+1,r)),e=r):r===s-1&&i.push(n.slice(e+1,r+1))});this.segments=i},setOptions:function(t){var e=this.chart.options,i=e.plotOptions,n=i[this.type],s=t.data;return t.data=null,i=ei(n,i.series,t),i.data=t.data=s,this.tooltipOptions=ei(e.tooltip,i.tooltip),null===n.marker&&delete i.marker,i},getColor:function(){var t=this.options,e=this.chart.options.colors,i=this.chart.counters;this.color=t.color||!t.colorByPoint&&e[i.color++]||"gray",i.wrapColor(e.length)},getSymbol:function(){var t=this.options.marker,e=this.chart,i=e.options.symbols,e=e.counters;this.symbol=t.symbol||i[e.symbol++],/^url/.test(this.symbol)&&(t.radius=0),e.wrapSymbol(i.length)},drawLegendSymbol:function(t){var e,i=this.options,n=i.marker,s=t.options.symbolWidth,r=this.chart.renderer,o=this.legendGroup,t=t.baseline;i.lineWidth&&(e={"stroke-width":i.lineWidth},i.dashStyle&&(e.dashstyle=i.dashStyle),this.legendLine=r.path(["M",0,t-4,"L",s,t-4]).attr(e).add(o)),n&&n.enabled&&(i=n.radius,this.legendSymbol=r.symbol(this.symbol,s/2-i,t-4-i,2*i,2*i).add(o))},addPoint:function(t,e,i,n){var s=this.data,r=this.graph,o=this.area,a=this.chart,l=this.xData,h=this.yData,c=r&&r.shift||0,u=this.options.data,d=this.pointClass.prototype;E(n,a),r&&i&&(r.shift=c+1),o&&(i&&(o.shift=c+1),o.isArea=!0),e=p(e,!0),n={series:this},d.applyOptions.apply(n,[t]),l.push(n.x),h.push(d.toYData?d.toYData.call(n):n.y),u.push(t),i&&(s[0]&&s[0].remove?s[0].remove(!1):(s.shift(),l.shift(),h.shift(),u.shift())),this.getAttribs(),this.isDirtyData=this.isDirty=!0,e&&a.redraw()},setData:function(t,e){var i,s=this.points,a=this.options,l=this.initialColor,h=this.chart,u=null,d=this.xAxis,f=this.pointClass.prototype;this.xIncrement=null,this.pointRange=d&&d.categories?1:a.pointRange,c(l)&&(h.counters.color=l);var l=[],m=[],g=t?t.length:[],v=(i=this.pointArrayMap)&&i.length;if(g>(a.turboThreshold||1e3)){for(i=0;null===u&&g>i;)u=t[i],i++;if(o(u)){for(f=p(a.pointStart,0),a=p(a.pointInterval,1),i=0;g>i;i++)l[i]=f,m[i]=t[i],f+=a;this.xIncrement=f}else if(r(u))if(v)for(i=0;g>i;i++)a=t[i],l[i]=a[0],m[i]=a.slice(1,v+1);else for(i=0;g>i;i++)a=t[i],l[i]=a[0],m[i]=a[1]}else for(i=0;g>i;i++)a={series:this},f.applyOptions.apply(a,[t[i]]),l[i]=a.x,m[i]=f.toYData?f.toYData.call(a):a.y;for(n(m[0])&&S(14,!0),this.data=[],this.options.data=t,this.xData=l,this.yData=m,i=s&&s.length||0;i--;)s[i]&&s[i].destroy&&s[i].destroy();d&&(d.minRange=d.userMinRange),this.isDirty=this.isDirtyData=h.isDirtyBox=!0,p(e,!0)&&h.redraw(!1)},remove:function(t,e){var i=this,n=i.chart,t=p(t,!0);i.isRemoving||(i.isRemoving=!0,si(i,"remove",null,function(){i.destroy(),n.isDirtyLegend=n.isDirtyBox=!0,t&&n.redraw(e)})),i.isRemoving=!1},processData:function(t){var e,i,n=this.xData,s=this.yData,r=n.length,o=0,a=r,l=this.xAxis,h=this.options,c=h.cropThreshold,u=this.isCartesian;if(u&&!this.isDirty&&!l.isDirty&&!this.yAxis.isDirty&&!t)return!1;if(u&&this.sorted&&(!c||r>c||this.forceCrop))if(t=l.getExtremes(),l=t.min,c=t.max,n[r-1]<l||n[0]>c)n=[],s=[];else if(n[0]<l||n[r-1]>c){for(t=0;r>t;t++)if(n[t]>=l){o=pe(0,t-1);break}for(;r>t;t++)if(n[t]>c){a=t+1;break}n=n.slice(o,a),s=s.slice(o,a),e=!0}for(t=n.length-1;t>0;t--)r=n[t]-n[t-1],r>0&&(i===j||i>r)&&(i=r);this.cropped=e,this.cropStart=o,this.processedXData=n,this.processedYData=s,null===h.pointRange&&(this.pointRange=i||1),this.closestPointRange=i},generatePoints:function(){var t,e,i,n,s=this.options.data,r=this.data,o=this.processedXData,a=this.processedYData,l=this.pointClass,h=o.length,c=this.cropStart||0,u=this.hasGroupedData,p=[];for(r||u||(r=[],r.length=s.length,r=this.data=r),n=0;h>n;n++)e=c+n,u?p[n]=(new l).init(this,[o[n]].concat(d(a[n]))):(r[e]?i=r[e]:s[e]!==j&&(r[e]=i=(new l).init(this,s[e],o[n])),p[n]=i);if(r&&(h!==(t=r.length)||u))for(n=0;t>n;n++)n===c&&!u&&(n+=h),r[n]&&(r[n].destroyElements(),r[n].plotX=j);this.data=r,this.points=p},translate:function(){this.processedXData||this.processData(),this.generatePoints();for(var t,e=this.chart,i=this.options,n=i.stacking,s=this.xAxis,r=s.categories,o=this.yAxis,a=this.points,l=a.length,h=!!this.modifyValue,u=o.series,d=u.length,f="between"===i.pointPlacement;d--;)if(u[d].visible){u[d]===this&&(t=!0);break}for(d=0;l>d;d++){var u=a[d],m=u.x,g=u.y,v=u.low,y=o.stacks[(g<i.threshold?"-":"")+this.stackKey];u.plotX=s.translate(m,0,0,0,1,f),n&&this.visible&&y&&y[m]&&(v=y[m],m=v.total,v.cum=v=v.cum-g,g=v+g,t&&(v=p(i.threshold,o.min)),o.isLog&&0>=v&&(v=null),"percent"===n&&(v=m?100*v/m:0,g=m?100*g/m:0),u.percentage=m?100*u.y/m:0,u.total=u.stackTotal=m,u.stackY=g),u.yBottom=c(v)?o.translate(v,0,1,0,1):null,h&&(g=this.modifyValue(g,u)),u.plotY="number"==typeof g?ce(10*o.translate(g,0,1,0,1))/10:j,u.clientX=e.inverted?e.plotHeight-u.plotX:u.plotX,u.category=r&&r[u.x]!==j?r[u.x]:u.x}this.getSegments()},setTooltipPoints:function(t){var e,i,n,s,r=[],o=(e=this.xAxis)?e.tooltipLen||e.len:this.chart.plotSizeX,a=e&&e.tooltipPosName||"plotX",l=[];if(this.options.enableMouseTracking!==!1){for(t&&(this.tooltipPoints=null),Je(this.segments||this.points,function(t){r=r.concat(t)}),e&&e.reversed&&(r=r.reverse()),t=r.length,s=0;t>s;s++)for(n=r[s],e=r[s-1]?i+1:0,i=r[s+1]?pe(0,ue((n[a]+(r[s+1]?r[s+1][a]:o))/2)):o;e>=0&&i>=e;)l[e++]=n;this.tooltipPoints=l}},tooltipHeaderFormatter:function(t){var e,i=this.tooltipOptions,n=i.xDateFormat,s=this.xAxis,r=s&&"datetime"===s.options.type;if(r&&!n)for(e in q)if(q[e]>=s.closestPointRange){n=i.dateTimeLabelFormats[e];break}return i.headerFormat.replace("{point.key}",r&&o(t)?V(n,t):t).replace("{series.name}",this.name).replace("{series.color}",this.color)},onMouseOver:function(){var t=this.chart,e=t.hoverSeries;e&&e!==this&&e.onMouseOut(),this.options.events.mouseOver&&si(this,"mouseOver"),this.setState("hover"),t.hoverSeries=this},onMouseOut:function(){var t=this.options,e=this.chart,i=e.tooltip,n=e.hoverPoint;n&&n.onMouseOut(),this&&t.events.mouseOut&&si(this,"mouseOut"),i&&!t.stickyTracking&&!i.shared&&i.hide(),this.setState(),e.hoverSeries=null},animate:function(e){var i,n=this,r=n.chart,o=r.renderer;i=n.options.animation;var a,l=r.clipBox,h=r.inverted;i&&!s(i)&&(i=li[n.type].animation),a="_sharedClip"+i.duration+i.easing,e?(e=r[a],i=r[a+"m"],e||(r[a]=e=o.clipRect(t(l,{width:0})),r[a+"m"]=i=o.clipRect(-99,h?-r.plotLeft:-r.plotTop,99,h?r.chartWidth:r.chartHeight)),n.group.clip(e),n.markerGroup.clip(i),n.sharedClipKey=a):((e=r[a])&&(e.animate({width:r.plotSizeX},i),r[a+"m"].animate({width:r.plotSizeX+99},i)),n.animate=null,n.animationTimeout=setTimeout(function(){n.afterAnimate()},i.duration))},afterAnimate:function(){var t=this.chart,e=this.sharedClipKey,i=this.group;i&&this.options.clip!==!1&&(i.clip(t.clipRect),this.markerGroup.clip()),setTimeout(function(){e&&t[e]&&(t[e]=t[e].destroy(),t[e+"m"]=t[e+"m"].destroy())},100)},drawPoints:function(){var e,i,n,s,r,o,a,l,h,c,u=this.points,d=this.chart,f=this.options.marker,m=this.markerGroup;if(f.enabled||this._hasPointMarkers)for(s=u.length;s--;)r=u[s],i=r.plotX,n=r.plotY,h=r.graphic,a=r.marker||{},e=f.enabled&&a.enabled===j||a.enabled,c=d.isInsidePlot(i,n,d.inverted),e&&n!==j&&!isNaN(n)?(e=r.pointAttr[r.selected?"select":""],o=e.r,a=p(a.symbol,this.symbol),l=0===a.indexOf("url"),h?h.attr({visibility:c?Te?"inherit":"visible":"hidden"}).animate(t({x:i-o,y:n-o},h.symbolName?{width:2*o,height:2*o}:{})):c&&(o>0||l)&&(r.graphic=d.renderer.symbol(a,i-o,n-o,2*o,2*o).attr(e).add(m))):h&&(r.graphic=h.destroy())},convertAttribs:function(t,e,i,n){var s,r,o=this.pointAttrToOptions,a={},t=t||{},e=e||{},i=i||{},n=n||{};for(s in o)r=o[s],a[s]=p(t[r],e[s],i[s],n[s]);return a},getAttribs:function(){var e,i,n,s=this,r=li[s.type].marker?s.options.marker:s.options,o=r.states,a=o.hover,l=s.color,h={stroke:l,fill:l},u=s.points||[],d=[],p=s.pointAttrToOptions;for(s.options.marker?(a.radius=a.radius||r.radius+2,a.lineWidth=a.lineWidth||r.lineWidth+1):a.color=a.color||hi(a.color||l).brighten(a.brightness).get(),d[""]=s.convertAttribs(r,h),Je(["hover","select"],function(t){d[t]=s.convertAttribs(o[t],d[""])}),s.pointAttr=d,l=u.length;l--;){if(h=u[l],(r=h.options&&h.options.marker||h.options)&&r.enabled===!1&&(r.radius=0),e=s.options.colorByPoint,h.options)for(n in p)c(r[p[n]])&&(e=!0);e?(r=r||{},i=[],o=r.states||{},e=o.hover=o.hover||{},s.options.marker||(e.color=hi(e.color||h.color).brighten(e.brightness||a.brightness).get()),i[""]=s.convertAttribs(t({color:h.color},r),d[""]),i.hover=s.convertAttribs(o.hover,d.hover,i[""]),i.select=s.convertAttribs(o.select,d.select,i[""])):i=d,h.pointAttr=i}},destroy:function(){var t,e,i,n,s,r=this,o=r.chart,a=/AppleWebKit\/533/.test(xe),l=r.data||[];for(si(r,"destroy"),ni(r),Je(["xAxis","yAxis"],function(t){(s=r[t])&&(h(s.series,r),s.isDirty=!0)}),r.legendItem&&r.chart.legend.destroyItem(r),e=l.length;e--;)(i=l[e])&&i.destroy&&i.destroy();r.points=null,clearTimeout(r.animationTimeout),Je("area,graph,dataLabelsGroup,group,markerGroup,tracker,trackerGroup".split(","),function(e){r[e]&&(t=a&&"group"===e?"hide":"destroy",r[e][t]())}),o.hoverSeries===r&&(o.hoverSeries=null),h(o.series,r);for(n in r)delete r[n]},drawDataLabels:function(){var t,e,i,n,s=this,r=s.options.dataLabels,o=s.points;(r.enabled||s._hasPointLabels)&&(s.dlProcessOptions&&s.dlProcessOptions(r),n=s.plotGroup("dataLabelsGroup","data-labels",s.visible?"visible":"hidden",6),e=r,Je(o,function(o){var a,l,h=o.dataLabel,u=!0;if(t=o.options&&o.options.dataLabels,a=e.enabled||t&&t.enabled,h&&!a)o.dataLabel=h.destroy();else if(a){if(a=r.rotation,r=ei(e,t),i=r.formatter.call(o.getLabelConfig(),r),r.style.color=p(r.color,r.style.color,s.color,"black"),h)h.attr({text:i}),u=!1;else if(c(i)){h={fill:r.backgroundColor,stroke:r.borderColor,"stroke-width":r.borderWidth,r:r.borderRadius||0,rotation:a,padding:r.padding,zIndex:1};for(l in h)h[l]===j&&delete h[l];h=o.dataLabel=s.chart.renderer[a?"text":"label"](i,0,-999,null,null,null,r.useHTML).attr(h).css(r.style).add(n).shadow(r.shadow)}h&&s.alignDataLabel(o,h,r,null,u)}}))},alignDataLabel:function(e,i,n,s,r){var o=this.chart,a=o.inverted,l=p(e.plotX,-999),e=p(e.plotY,-999),h=i.getBBox(),s=t({x:a?o.plotWidth-e:l,y:ce(a?o.plotHeight-l:e),width:0,height:0},s);t(n,{width:h.width,height:h.height}),n.rotation?(s={align:n.align,x:s.x+n.x+s.width/2,y:s.y+n.y+s.height/2},i[r?"attr":"animate"](s)):(i.align(n,null,s),s=i.alignAttr),i.attr({visibility:n.crop===!1||o.isInsidePlot(s.x,s.y)||o.isInsidePlot(l,e,a)?Te?"inherit":"visible":"hidden"})},getSegmentPath:function(t){var e=this,i=[];return Je(t,function(n,s){e.getPointSpline?i.push.apply(i,e.getPointSpline(t,n,s)):(i.push(s?"L":"M"),s&&e.options.step&&i.push(n.plotX,t[s-1].plotY),i.push(n.plotX,n.plotY))}),i},getGraphPath:function(){var t,e=this,i=[],n=[];return Je(e.segments,function(s){t=e.getSegmentPath(s),s.length>1?i=i.concat(t):n.push(s[0])}),e.singlePoints=n,e.graphPath=i},drawGraph:function(){var t=this.options,e=this.graph,i=this.group,n=t.lineColor||this.color,s=t.lineWidth,r=t.dashStyle,o=this.getGraphPath();e?(ai(e),e.animate({d:o})):s&&(e={stroke:n,"stroke-width":s,zIndex:1},r&&(e.dashstyle=r),this.graph=this.chart.renderer.path(o).attr(e).add(i).shadow(t.shadow))},invertGroups:function(){function t(){var t={width:e.yAxis.len,height:e.xAxis.len};Je(["group","trackerGroup","markerGroup"],function(i){e[i]&&e[i].attr(t).invert()})}var e=this,i=e.chart;ii(i,"resize",t),ii(e,"destroy",function(){ni(i,"resize",t)}),t(),e.invertGroups=t},plotGroup:function(t,e,i,n,s){var r=this[t],o=this.chart,a=this.xAxis,l=this.yAxis;return r||(this[t]=r=o.renderer.g(e).attr({visibility:i,zIndex:n||.1}).add(s)),r.translate(a?a.left:o.plotLeft,l?l.top:o.plotTop),r},render:function(){var t,e=this.chart,i=this.options,n=i.animation&&!!this.animate,s=this.visible?"visible":"hidden",r=i.zIndex,o=this.hasRendered,a=e.seriesGroup;t=this.plotGroup("group","series",s,r,a),this.markerGroup=this.plotGroup("markerGroup","markers",s,r,a),n&&this.animate(!0),this.getAttribs(),t.inverted=e.inverted,this.drawGraph&&this.drawGraph(),this.drawPoints(),this.drawDataLabels(),this.options.enableMouseTracking!==!1&&this.drawTracker(),e.inverted&&this.invertGroups(),i.clip!==!1&&!this.sharedClipKey&&!o&&(t.clip(e.clipRect),this.trackerGroup&&this.trackerGroup.clip(e.clipRect)),n?this.animate():o||this.afterAnimate(),this.isDirty=this.isDirtyData=!1,this.hasRendered=!0},redraw:function(){var t=this.chart,e=this.isDirtyData,i=this.group;i&&(t.inverted&&i.attr({width:t.plotWidth,height:t.plotHeight}),i.animate({translateX:this.xAxis.left,translateY:this.yAxis.top})),this.translate(),this.setTooltipPoints(!0),this.render(),e&&si(this,"updatedData")},setState:function(t){var e=this.options,i=this.graph,n=e.states,e=e.lineWidth,t=t||"";this.state!==t&&(this.state=t,n[t]&&n[t].enabled===!1||(t&&(e=n[t].lineWidth||e+1),i&&!i.dashstyle&&i.attr({"stroke-width":e},t?0:500)))},setVisible:function(t,e){var i,n=this.chart,s=this.legendItem,r=this.group,o=this.tracker,a=this.dataLabelsGroup,l=this.markerGroup,h=this.points,c=n.options.chart.ignoreHiddenSeries;if(i=this.visible,i=(this.visible=t=t===j?!i:t)?"show":"hide",r&&r[i](),l&&l[i](),o)o[i]();else if(h)for(r=h.length;r--;)o=h[r],o.tracker&&o.tracker[i]();a&&a[i](),s&&n.legend.colorizeItem(this,t),this.isDirty=!0,this.options.stacking&&Je(n.series,function(t){t.options.stacking&&t.visible&&(t.isDirty=!0)}),c&&(n.isDirtyBox=!0),e!==!1&&n.redraw(),si(this,i)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(t){this.selected=t=t===j?!this.selected:t,this.checkbox&&(this.checkbox.checked=t),si(this,t?"select":"unselect")},drawTracker:function(){var t,e=this,i=e.options,n=i.trackByArea,s=[].concat(n?e.areaPath:e.graphPath),r=s.length,o=e.chart,a=o.renderer,l=o.options.tooltip.snap,h=e.tracker,c=i.cursor,c=c&&{cursor:c},u=e.singlePoints,d=this.isCartesian&&this.plotGroup("trackerGroup",null,"visible",i.zIndex||1,o.trackerGroup);if(r&&!n)for(t=r+1;t--;)"M"===s[t]&&s.splice(t+1,0,s[t+1]-l,s[t+2],"L"),(t&&"M"===s[t]||t===r)&&s.splice(t,0,"L",s[t-2]+l,s[t-1]);for(t=0;t<u.length;t++)r=u[t],s.push("M",r.plotX-l,r.plotY,"L",r.plotX+l,r.plotY);h?h.attr({d:s}):e.tracker=a.path(s).attr({isTracker:!0,"stroke-linejoin":"bevel",visibility:e.visible?"visible":"hidden",stroke:ze,fill:n?ze:$e,"stroke-width":i.lineWidth+(n?0:2*l)}).on(Ee?"touchstart":"mouseover",function(){o.hoverSeries!==e&&e.onMouseOver()}).on("mouseout",function(){i.stickyTracking||e.onMouseOut()}).css(c).add(d)}},Ge=g(gi),Ve.line=Ge,li.area=ei(Ue,{threshold:0}),Ge=g(gi,{type:"area",getSegmentPath:function(t){var e,i=gi.prototype.getSegmentPath.call(this,t),n=[].concat(i),s=this.options;if(3===i.length&&n.push("L",i[1],i[2]),s.stacking&&!this.closedStacks)for(e=t.length-1;e>=0;e--)e<t.length-1&&s.step&&n.push(t[e+1].plotX,t[e].yBottom),n.push(t[e].plotX,t[e].yBottom);else this.closeSegment(n,t);return this.areaPath=this.areaPath.concat(n),i},closeSegment:function(t,e){var i=this.yAxis.getThreshold(this.options.threshold);t.push("L",e[e.length-1].plotX,i,"L",e[0].plotX,i)},drawGraph:function(){this.areaPath=[],gi.prototype.drawGraph.apply(this);var t=this.areaPath,e=this.options,i=this.area;i?i.animate({d:t}):this.area=this.chart.renderer.path(t).attr({fill:p(e.fillColor,hi(this.color).setOpacity(e.fillOpacity||.75).get()),zIndex:0}).add(this.group)},drawLegendSymbol:function(t,e){e.legendSymbol=this.chart.renderer.rect(0,t.baseline-11,t.options.symbolWidth,12,2).attr({zIndex:3}).add(e.legendGroup)}}),Ve.area=Ge,li.spline=ei(Ue),di=g(gi,{type:"spline",getPointSpline:function(t,e,i){var n,s,r,o,a=e.plotX,l=e.plotY,h=t[i-1],c=t[i+1];if(h&&c){t=h.plotY,r=c.plotX;var u,c=c.plotY;n=(1.5*a+h.plotX)/2.5,s=(1.5*l+t)/2.5,r=(1.5*a+r)/2.5,o=(1.5*l+c)/2.5,u=(o-s)*(r-a)/(r-n)+l-o,s+=u,o+=u,s>t&&s>l?(s=pe(t,l),o=2*l-s):t>s&&l>s&&(s=fe(t,l),o=2*l-s),o>c&&o>l?(o=pe(c,l),s=2*l-o):c>o&&l>o&&(o=fe(c,l),s=2*l-o),e.rightContX=r,e.rightContY=o}return i?(e=["C",h.rightContX||h.plotX,h.rightContY||h.plotY,n||a,s||l,a,l],h.rightContX=h.rightContY=null):e=["M",a,l],e}}),Ve.spline=di,li.areaspline=ei(li.area);var vi=Ge.prototype,di=g(di,{type:"areaspline",closedStacks:!0,getSegmentPath:vi.getSegmentPath,closeSegment:vi.closeSegment,drawGraph:vi.drawGraph});Ve.areaspline=di,li.column=ei(Ue,{borderColor:"#FFFFFF",borderWidth:1,borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:.1,shadow:!1},select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},threshold:0}),di=g(gi,{type:"column",tooltipOutsidePlot:!0,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",r:"borderRadius"},init:function(){gi.prototype.init.apply(this,arguments);var t=this,e=t.chart;e.hasRendered&&Je(e.series,function(e){e.type===t.type&&(e.isDirty=!0)})},translate:function(){var t,e,i=this,n=i.chart,s=i.options,r=s.stacking,o=s.borderWidth,a=0,l=i.xAxis,h=l.reversed,u={};gi.prototype.translate.apply(i),s.grouping===!1?a=1:Je(n.series,function(n){var s=n.options;n.type===i.type&&n.visible&&i.options.group===s.group&&(s.stacking?(t=n.stackKey,u[t]===j&&(u[t]=a++),e=u[t]):s.grouping!==!1&&(e=a++),n.columnIndex=e)});var d=i.points,l=me(l.transA)*(l.ordinalSlope||s.pointRange||l.closestPointRange||1),f=l*s.groupPadding,m=(l-2*f)/a,g=s.pointWidth,v=c(g)?(m-g)/2:m*s.pointPadding,y=p(g,m-2*v),b=de(pe(y,1+2*o)),x=v+(f+((h?a-i.columnIndex:i.columnIndex)||0)*m-l/2)*(h?-1:1),w=i.translatedThreshold=i.yAxis.getThreshold(s.threshold),k=p(s.minPointLength,5);Je(d,function(t){var e=t.plotY,s=p(t.yBottom,w),a=t.plotX+x,l=de(fe(e,s)),h=de(pe(e,s)-l),c=i.yAxis.stacks[(t.y<0?"-":"")+i.stackKey];r&&i.visible&&c&&c[t.x]&&c[t.x].setOffset(x,b),me(h)<k&&k&&(h=k,l=me(l-w)>k?s-k:w-(w>=e?k:0)),t.barX=a,t.pointWidth=y,t.shapeType="rect",t.shapeArgs=e=n.renderer.Element.prototype.crisp.call(0,o,a,l,b,h),o%2&&(e.y-=1,e.height+=1),t.trackerArgs=me(h)<3&&ei(t.shapeArgs,{height:6,y:l-3})})},getSymbol:Le,drawLegendSymbol:Ge.prototype.drawLegendSymbol,drawGraph:Le,drawPoints:function(){var t,e=this,i=e.options,n=e.chart.renderer;Je(e.points,function(s){var r=s.plotY,o=s.graphic;r===j||isNaN(r)||null===s.y?o&&(s.graphic=o.destroy()):(t=s.shapeArgs,o?(ai(o),o.animate(ei(t))):s.graphic=n[s.shapeType](t).attr(s.pointAttr[s.selected?"select":""]).add(e.group).shadow(i.shadow,null,i.stacking&&!i.borderRadius))})},drawTracker:function(){var t,e,i,n,s,r=this,o=r.chart,a=o.renderer,l=+new Date,h=r.options,c=h.cursor,d=c&&{cursor:c},p=r.isCartesian&&r.plotGroup("trackerGroup",null,"visible",h.zIndex||1,o.trackerGroup);Je(r.points,function(c){e=c.tracker,t=c.trackerArgs||c.shapeArgs,n=c.plotY,s=!r.isCartesian||n!==j&&!isNaN(n),delete t.strokeWidth,null!==c.y&&s&&(e?e.attr(t):c.tracker=a[c.shapeType](t).attr({isTracker:l,fill:ze,visibility:r.visible?"visible":"hidden"}).on(Ee?"touchstart":"mouseover",function(t){i=t.relatedTarget||t.fromElement,o.hoverSeries!==r&&u(i,"isTracker")!==l&&r.onMouseOver(),c.onMouseOver()}).on("mouseout",function(t){h.stickyTracking||(i=t.relatedTarget||t.toElement,u(i,"isTracker")===l)||r.onMouseOut()}).css(d).add(c.group||p))})},alignDataLabel:function(t,e,i,n,s){var r=this.chart,o=r.inverted,a=t.below||t.plotY>(this.translatedThreshold||r.plotSizeY),l=this.options.stacking||i.inside;t.shapeArgs&&(n=ei(t.shapeArgs),o&&(n={x:r.plotWidth-n.y-n.height,y:r.plotHeight-n.x-n.width,width:n.height,height:n.width}),!l)&&(o?(n.x+=a?0:n.width,n.width=0):(n.y+=a?n.height:0,n.height=0)),i.align=p(i.align,!o||l?"center":a?"right":"left"),i.verticalAlign=p(i.verticalAlign,o||l?"middle":a?"top":"bottom"),gi.prototype.alignDataLabel.call(this,t,e,i,n,s)},animate:function(t){var e=this,i=e.points,n=e.options;t||(Je(i,function(t){var i=t.graphic,t=t.shapeArgs,s=e.yAxis,r=n.threshold;i&&(i.attr({height:0,y:c(r)?s.getThreshold(r):s.translate(s.getExtremes().min,0,1,0,1)}),i.animate({height:t.height,y:t.y},n.animation))}),e.animate=null)},remove:function(){var t=this,e=t.chart;e.hasRendered&&Je(e.series,function(e){e.type===t.type&&(e.isDirty=!0)}),gi.prototype.remove.apply(t,arguments)}}),Ve.column=di,li.bar=ei(li.column),vi=g(di,{type:"bar",inverted:!0}),Ve.bar=vi,li.scatter=ei(Ue,{lineWidth:0,states:{hover:{lineWidth:0}},tooltip:{headerFormat:'<span style="font-size: 10px; color:{series.color}">{series.name}</span><br/>',pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"}}),vi=g(gi,{type:"scatter",sorted:!1,translate:function(){var t=this;gi.prototype.translate.apply(t),Je(t.points,function(e){e.shapeType="circle",e.shapeArgs={x:e.plotX,y:e.plotY,r:t.chart.options.tooltip.snap}})},drawTracker:function(){for(var t,e=this,i=e.options.cursor,i=i&&{cursor:i},n=e.points,s=n.length;s--;)(t=n[s].graphic)&&(t.element._i=s);e._hasTracking?e._hasTracking=!0:e.markerGroup.attr({isTracker:!0}).on(Ee?"touchstart":"mouseover",function(t){e.onMouseOver(),t.target._i!==j&&n[t.target._i].onMouseOver()}).on("mouseout",function(){e.options.stickyTracking||e.onMouseOut()}).css(i)}}),Ve.scatter=vi,li.pie=ei(Ue,{borderColor:"#FFFFFF",borderWidth:1,center:["50%","50%"],colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name}},legendType:"point",marker:null,size:"75%",showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}}}),Le={type:"pie",isCartesian:!1,pointClass:g(mi,{init:function(){mi.prototype.init.apply(this,arguments);var e,i=this;return t(i,{visible:i.visible!==!1,name:p(i.name,"Slice")}),e=function(){i.slice()},ii(i,"select",e),ii(i,"unselect",e),i},setVisible:function(t){var e,i=this.series,n=i.chart,s=this.tracker,r=this.dataLabel,o=this.connector,a=this.shadowGroup;e=(this.visible=t=t===j?!this.visible:t)?"show":"hide",this.group[e](),s&&s[e](),r&&r[e](),o&&o[e](),a&&a[e](),this.legendItem&&n.legend.colorizeItem(this,t),!i.isDirty&&i.options.ignoreHiddenPoint&&(i.isDirty=!0,n.redraw())},slice:function(t,e,i){var n=this.series.chart,s=this.slicedTranslation;E(i,n),p(e,!0),t=this.sliced=c(t)?t:!this.sliced,t={translateX:t?s[0]:n.plotLeft,translateY:t?s[1]:n.plotTop},this.group.animate(t),this.shadowGroup&&this.shadowGroup.animate(t)}}),pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},getColor:function(){this.initialColor=this.chart.counters.color},animate:function(){var t=this;Je(t.points,function(e){var i=e.graphic,e=e.shapeArgs,n=-ye/2;i&&(i.attr({r:0,start:n,end:n}),i.animate({r:e.r,start:e.start,end:e.end},t.options.animation))}),t.animate=null},setData:function(t,e){gi.prototype.setData.call(this,t,!1),this.processData(),this.generatePoints(),p(e,!0)&&this.chart.redraw()},getCenter:function(){var t,e=this.options,n=this.chart,s=n.plotWidth,r=n.plotHeight,e=e.center.concat([e.size,e.innerSize||0]),o=fe(s,r);return ti(e,function(e,n){return(t=/%$/.test(e))?[s,r,o,o][n]*i(e)/100:e})},translate:function(){this.generatePoints();var t,e,i,n,s,r,o=0,a=-.25,l=this.options,h=l.slicedOffset,c=h+l.borderWidth,u=this.chart,d=this.points,p=2*ye,f=l.dataLabels.distance,m=l.ignoreHiddenPoint,g=d.length;for(this.center=t=this.getCenter(),this.getX=function(e,i){return n=he.asin((e-t[1])/(t[2]/2+f)),t[0]+(i?-1:1)*ge(n)*(t[2]/2+f)},s=0;g>s;s++)r=d[s],o+=m&&!r.visible?0:r.y;for(s=0;g>s;s++)r=d[s],l=o?r.y/o:0,e=ce(1e3*a*p)/1e3,(!m||r.visible)&&(a+=l),i=ce(1e3*a*p)/1e3,r.shapeType="arc",r.shapeArgs={x:t[0],y:t[1],r:t[2]/2,innerR:t[3]/2,start:e,end:i},n=(i+e)/2,r.slicedTranslation=ti([ge(n)*h+u.plotLeft,ve(n)*h+u.plotTop],ce),e=ge(n)*t[2]/2,i=ve(n)*t[2]/2,r.tooltipPos=[t[0]+.7*e,t[1]+.7*i],r.labelPos=[t[0]+e+ge(n)*f,t[1]+i+ve(n)*f,t[0]+e+ge(n)*c,t[1]+i+ve(n)*c,t[0]+e,t[1]+i,0>f?"center":p/4>n?"left":"right",n],r.percentage=100*l,r.total=o;this.setTooltipPoints()},render:function(){this.getAttribs(),this.drawPoints(),this.options.enableMouseTracking!==!1&&this.drawTracker(),this.drawDataLabels(),this.options.animation&&this.animate&&this.animate(),this.isDirty=!1},drawPoints:function(){var e,i,n,s,r,o=this,a=o.chart,l=a.renderer,h=o.options.shadow;Je(o.points,function(c){i=c.graphic,r=c.shapeArgs,n=c.group,s=c.shadowGroup,h&&!s&&(s=c.shadowGroup=l.g("shadow").attr({zIndex:4}).add()),n||(n=c.group=l.g("point").attr({zIndex:5}).add()),e=c.sliced?c.slicedTranslation:[a.plotLeft,a.plotTop],n.translate(e[0],e[1]),s&&s.translate(e[0],e[1]),i?i.animate(r):c.graphic=i=l.arc(r).setRadialReference(o.center).attr(t(c.pointAttr[""],{"stroke-linejoin":"round"})).add(c.group).shadow(h,s),c.visible===!1&&c.setVisible(!1)})},drawDataLabels:function(){var t,e,i,n,s,r,o,a,l=this.data,h=this.chart,c=this.options.dataLabels,u=p(c.connectorPadding,10),d=p(c.connectorWidth,1),f=p(c.softConnector,!0),m=c.distance,g=this.center,v=g[2]/2,y=g[1],b=m>0,x=[[],[]],w=2;if(c.enabled||this._hasPointLabels)for(gi.prototype.drawDataLabels.apply(this),Je(l,function(t){t.dataLabel&&x[t.labelPos[7]<ye/2?0:1].push(t)}),x[1].reverse(),o=function(t,e){return e.y-t.y},l=x[0][0]&&x[0][0].dataLabel&&(x[0][0].dataLabel.getBBox().height||21);w--;){var k,_=[],C=[],D=x[w],M=D.length;if(m>0){for(a=y-v-m;y+v+m>=a;a+=l)_.push(a);if(r=_.length,M>r){for(i=[].concat(D),i.sort(o),a=M;a--;)i[a].rank=a;for(a=M;a--;)D[a].rank>=r&&D.splice(a,1);M=D.length}for(a=0;M>a;a++){for(t=D[a],i=t.labelPos,t=9999,s=0;r>s;s++)e=me(_[s]-i[1]),t>e&&(t=e,k=s);if(a>k&&null!==_[a])k=a;else for(M-a+k>r&&null!==_[a]&&(k=r-M+a);null===_[k];)k++;C.push({i:k,y:_[k]}),_[k]=null}C.sort(o)}for(a=0;M>a;a++)t=D[a],i=t.labelPos,e=t.dataLabel,r=t.visible===!1?"hidden":"visible",n=i[1],m>0?(s=C.pop(),k=s.i,s=s.y,(n>s&&null!==_[k+1]||s>n&&null!==_[k-1])&&(s=n)):s=n,n=c.justify?g[0]+(w?-1:1)*(v+m):this.getX(0===k||k===_.length-1?n:s,w),e.attr({visibility:r,align:i[6]})[e.moved?"animate":"attr"]({x:n+c.x+({left:u,right:-u}[i[6]]||0),y:s+c.y-10}),e.moved=!0,b&&d&&(e=t.connector,i=f?["M",n+("left"===i[6]?5:-5),s,"C",n,s,2*i[2]-i[4],2*i[3]-i[5],i[2],i[3],"L",i[4],i[5]]:["M",n+("left"===i[6]?5:-5),s,"L",i[2],i[3],"L",i[4],i[5]],e?(e.animate({d:i}),e.attr("visibility",r)):t.connector=e=this.chart.renderer.path(i).attr({"stroke-width":d,stroke:c.connectorColor||t.color||"#606060",visibility:r,zIndex:3}).translate(h.plotLeft,h.plotTop).add())}},alignDataLabel:Le,drawTracker:di.prototype.drawTracker,drawLegendSymbol:Ge.prototype.drawLegendSymbol,getSymbol:function(){}},Le=g(gi,Le),Ve.pie=Le,t(Highcharts,{Axis:z,CanVGRenderer:pi,Chart:W,Color:hi,Legend:H,MouseTracker:O,Point:mi,Tick:L,Tooltip:P,Renderer:R,Series:gi,SVGRenderer:ci,VMLRenderer:ui,dateFormat:V,pathAnim:G,getOptions:function(){return Y},hasBidiBug:Se,numberFormat:v,seriesTypes:Ve,setOptions:function(t){return Y=ei(Y,t),F(),Y},addEvent:ii,removeEvent:ni,createElement:m,discardElement:T,css:f,each:Je,extend:t,map:ti,merge:ei,pick:p,splat:d,extendClass:g,pInt:i,wrap:function(t,e,i){var n=t[e];t[e]=function(){var t=Array.prototype.slice.call(arguments);return t.unshift(n),i.apply(this,t)}},svg:Te,canvas:Ae,vml:!Te&&!Ae,product:"Highcharts",version:"2.3.3"})}(),window.Highcharts}),!function(t,e){var i=e.prototype.trim,n=e.prototype.trimRight,s=e.prototype.trimLeft,r=function(t){return 1*t||0},o=function(t,e){if(1>e)return"";for(var i="";e>0;)1&e&&(i+=t),e>>=1,t+=t;return i},a=[].slice,l=function(t){return null==t?"\\s":t.source?t.source:"["+p.escapeRegExp(t)+"]"},h={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},c={};for(var u in h)c[h[u]]=u;c["'"]="#39";var d=function(){function t(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}var i=o,n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};return n.format=function(n,s){var r,o,a,l,h,c,u,p=1,f=n.length,m="",g=[];for(o=0;f>o;o++)if(m=t(n[o]),"string"===m)g.push(n[o]);else if("array"===m){if(l=n[o],l[2])for(r=s[p],a=0;a<l[2].length;a++){if(!r.hasOwnProperty(l[2][a]))throw new Error(d('[_.sprintf] property "%s" does not exist',l[2][a]));r=r[l[2][a]]}else r=l[1]?s[l[1]]:s[p++];if(/[^s]/.test(l[8])&&"number"!=t(r))throw new Error(d("[_.sprintf] expecting number but found %s",t(r)));switch(l[8]){case"b":r=r.toString(2);break;case"c":r=e.fromCharCode(r);break;case"d":r=parseInt(r,10);break;case"e":r=l[7]?r.toExponential(l[7]):r.toExponential();break;case"f":r=l[7]?parseFloat(r).toFixed(l[7]):parseFloat(r);break;case"o":r=r.toString(8);break;case"s":r=(r=e(r))&&l[7]?r.substring(0,l[7]):r;break;case"u":r=Math.abs(r);break;case"x":r=r.toString(16);break;case"X":r=r.toString(16).toUpperCase()}r=/[def]/.test(l[8])&&l[3]&&r>=0?"+"+r:r,c=l[4]?"0"==l[4]?"0":l[4].charAt(1):" ",u=l[6]-e(r).length,h=l[6]?i(c,u):"",g.push(l[5]?r+h:h+r)}return g.join("")},n.cache={},n.parse=function(t){for(var e=t,i=[],n=[],s=0;e;){if(null!==(i=/^[^\x25]+/.exec(e)))n.push(i[0]);else if(null!==(i=/^\x25{2}/.exec(e)))n.push("%");else{if(null===(i=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(e)))throw new Error("[_.sprintf] huh?");if(i[2]){s|=1;var r=[],o=i[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(o)))throw new Error("[_.sprintf] huh?");for(r.push(a[1]);""!==(o=o.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(o)))r.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(o)))throw new Error("[_.sprintf] huh?");r.push(a[1])}i[2]=r}else s|=2;if(3===s)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");n.push(i)}e=e.substring(i[0].length)}return n},n}(),p={VERSION:"2.3.0",isBlank:function(t){return null==t&&(t=""),/^\s*$/.test(t)},stripTags:function(t){return null==t?"":e(t).replace(/<\/?[^>]+>/g,"")},capitalize:function(t){return t=null==t?"":e(t),t.charAt(0).toUpperCase()+t.slice(1)},chop:function(t,i){return null==t?[]:(t=e(t),i=~~i,i>0?t.match(new RegExp(".{1,"+i+"}","g")):[t])},clean:function(t){return p.strip(t).replace(/\s+/g," ")},count:function(t,i){if(null==t||null==i)return 0;t=e(t),i=e(i);for(var n=0,s=0,r=i.length;;){if(s=t.indexOf(i,s),-1===s)break;n++,s+=r}return n},chars:function(t){return null==t?[]:e(t).split("")},swapCase:function(t){return null==t?"":e(t).replace(/\S/g,function(t){return t===t.toUpperCase()?t.toLowerCase():t.toUpperCase()})},escapeHTML:function(t){return null==t?"":e(t).replace(/[&<>"']/g,function(t){return"&"+c[t]+";"})},unescapeHTML:function(t){return null==t?"":e(t).replace(/\&([^;]+);/g,function(t,i){var n;return i in h?h[i]:(n=i.match(/^#x([\da-fA-F]+)$/))?e.fromCharCode(parseInt(n[1],16)):(n=i.match(/^#(\d+)$/))?e.fromCharCode(~~n[1]):t})},escapeRegExp:function(t){return null==t?"":e(t).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(t,e,i,n){var s=p.chars(t);return s.splice(~~e,~~i,n),s.join("")},insert:function(t,e,i){return p.splice(t,e,0,i)},include:function(t,i){return""===i?!0:null==t?!1:-1!==e(t).indexOf(i)},join:function(){var t=a.call(arguments),e=t.shift();return null==e&&(e=""),t.join(e)},lines:function(t){return null==t?[]:e(t).split("\n")},reverse:function(t){return p.chars(t).reverse().join("")},startsWith:function(t,i){return""===i?!0:null==t||null==i?!1:(t=e(t),i=e(i),t.length>=i.length&&t.slice(0,i.length)===i)},endsWith:function(t,i){return""===i?!0:null==t||null==i?!1:(t=e(t),i=e(i),t.length>=i.length&&t.slice(t.length-i.length)===i)},succ:function(t){return null==t?"":(t=e(t),t.slice(0,-1)+e.fromCharCode(t.charCodeAt(t.length-1)+1))},titleize:function(t){return null==t?"":e(t).replace(/(?:^|\s)\S/g,function(t){return t.toUpperCase()})},camelize:function(t){return p.trim(t).replace(/[-_\s]+(.)?/g,function(t,e){return e.toUpperCase()})},underscored:function(t){return p.trim(t).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(t){return p.trim(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()
389
- },classify:function(t){return p.titleize(e(t).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(t){return p.capitalize(p.underscored(t).replace(/_id$/,"").replace(/_/g," "))},trim:function(t,n){return null==t?"":!n&&i?i.call(t):(n=l(n),e(t).replace(new RegExp("^"+n+"+|"+n+"+$","g"),""))},ltrim:function(t,i){return null==t?"":!i&&s?s.call(t):(i=l(i),e(t).replace(new RegExp("^"+i+"+"),""))},rtrim:function(t,i){return null==t?"":!i&&n?n.call(t):(i=l(i),e(t).replace(new RegExp(i+"+$"),""))},truncate:function(t,i,n){return null==t?"":(t=e(t),n=n||"...",i=~~i,t.length>i?t.slice(0,i)+n:t)},prune:function(t,i,n){if(null==t)return"";if(t=e(t),i=~~i,n=null!=n?e(n):"...",t.length<=i)return t;var s=function(t){return t.toUpperCase()!==t.toLowerCase()?"A":" "},r=t.slice(0,i+1).replace(/.(?=\W*\w*$)/g,s);return r=r.slice(r.length-2).match(/\w\w/)?r.replace(/\s*\S+$/,""):p.rtrim(r.slice(0,r.length-1)),(r+n).length>t.length?t:t.slice(0,r.length)+n},words:function(t,e){return p.isBlank(t)?[]:p.trim(t,e).split(e||/\s+/)},pad:function(t,i,n,s){t=null==t?"":e(t),i=~~i;var r=0;switch(n?n.length>1&&(n=n.charAt(0)):n=" ",s){case"right":return r=i-t.length,t+o(n,r);case"both":return r=i-t.length,o(n,Math.ceil(r/2))+t+o(n,Math.floor(r/2));default:return r=i-t.length,o(n,r)+t}},lpad:function(t,e,i){return p.pad(t,e,i)},rpad:function(t,e,i){return p.pad(t,e,i,"right")},lrpad:function(t,e,i){return p.pad(t,e,i,"both")},sprintf:d,vsprintf:function(t,e){return e.unshift(t),d.apply(null,e)},toNumber:function(t,e){return t?(t=p.trim(t),t.match(/^-?\d+(?:\.\d+)?$/)?r(r(t).toFixed(~~e)):0/0):0},numberFormat:function(t,e,i,n){if(isNaN(t)||null==t)return"";t=t.toFixed(~~e),n="string"==typeof n?n:",";var s=t.split("."),r=s[0],o=s[1]?(i||".")+s[1]:"";return r.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+n)+o},strRight:function(t,i){if(null==t)return"";t=e(t),i=null!=i?e(i):i;var n=i?t.indexOf(i):-1;return~n?t.slice(n+i.length,t.length):t},strRightBack:function(t,i){if(null==t)return"";t=e(t),i=null!=i?e(i):i;var n=i?t.lastIndexOf(i):-1;return~n?t.slice(n+i.length,t.length):t},strLeft:function(t,i){if(null==t)return"";t=e(t),i=null!=i?e(i):i;var n=i?t.indexOf(i):-1;return~n?t.slice(0,n):t},strLeftBack:function(t,e){if(null==t)return"";t+="",e=null!=e?""+e:e;var i=t.lastIndexOf(e);return~i?t.slice(0,i):t},toSentence:function(t,e,i,n){e=e||", ",i=i||" and ";var s=t.slice(),r=s.pop();return t.length>2&&n&&(i=p.rtrim(e)+i),s.length?s.join(e)+i+r:r},toSentenceSerial:function(){var t=a.call(arguments);return t[3]=!0,p.toSentence.apply(p,t)},slugify:function(t){if(null==t)return"";var i="ąàáäâãåæćęèéëêìíïîłńòóöôõøśùúüûñçżź",n="aaaaaaaaceeeeeiiiilnoooooosuuuunczz",s=new RegExp(l(i),"g");return t=e(t).toLowerCase().replace(s,function(t){var e=i.indexOf(t);return n.charAt(e)||"-"}),p.dasherize(t.replace(/[^\w\s-]/g,""))},surround:function(t,e){return[e,t,e].join("")},quote:function(t){return p.surround(t,'"')},exports:function(){var t={};for(var e in this)this.hasOwnProperty(e)&&!e.match(/^(?:include|contains|reverse)$/)&&(t[e]=this[e]);return t},repeat:function(t,i,n){if(null==t)return"";if(i=~~i,null==n)return o(e(t),i);for(var s=[];i>0;s[--i]=t);return s.join(n)},naturalCmp:function(t,i){if(t==i)return 0;if(!t)return-1;if(!i)return 1;for(var n=/(\.\d+)|(\d+)|(\D+)/g,s=e(t).toLowerCase().match(n),r=e(i).toLowerCase().match(n),o=Math.min(s.length,r.length),a=0;o>a;a++){var l=s[a],h=r[a];if(l!==h){var c=parseInt(l,10);if(!isNaN(c)){var u=parseInt(h,10);if(!isNaN(u)&&c-u)return c-u}return h>l?-1:1}}return s.length===r.length?s.length-r.length:i>t?-1:1},levenshtein:function(t,i){if(null==t&&null==i)return 0;if(null==t)return e(i).length;if(null==i)return e(t).length;t=e(t),i=e(i);for(var n,s,r=[],o=0;o<=i.length;o++)for(var a=0;a<=t.length;a++)s=o&&a?t.charAt(a-1)===i.charAt(o-1)?n:Math.min(r[a],r[a-1],n)+1:o+a,n=r[a],r[a]=s;return r.pop()}};p.strip=p.trim,p.lstrip=p.ltrim,p.rstrip=p.rtrim,p.center=p.lrpad,p.rjust=p.lpad,p.ljust=p.rpad,p.contains=p.include,p.q=p.quote,"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(module.exports=p),exports._s=p),"function"==typeof define&&define.amd&&define("underscore.string",[],function(){return p}),t._=t._||{},t._.string=t._.str=p}(this,String),define("underscore-string",function(t){return function(){var e;return e||t._.str}}(this)),define("highcharts-theme",["jquery","highcharts"],function(t,e){return e.theme={colors:["#DDDF0D","#7798BF","#55BF3B","#DF5353","#aaeeee","#ff0066","#eeaaee","#55BF3B","#DF5353","#7798BF","#aaeeee"],chart:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"rgb(96, 96, 96)"],[1,"rgb(16, 16, 16)"]]},borderWidth:0,borderRadius:15,plotBackgroundColor:null,plotShadow:!1,plotBorderWidth:0},title:{style:{color:"#FFF",font:"16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}},subtitle:{style:{color:"#DDD",font:"12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}},xAxis:{gridLineWidth:0,lineColor:"#999",tickColor:"#999",labels:{style:{color:"#999",fontWeight:"bold"}},title:{style:{color:"#AAA",font:"bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}}},yAxis:{alternateGridColor:null,minorTickInterval:null,gridLineColor:"rgba(255, 255, 255, .1)",lineWidth:0,tickWidth:0,labels:{style:{color:"#999",fontWeight:"bold"}},title:{style:{color:"#AAA",font:"bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}}},legend:{itemStyle:{color:"#CCC"},itemHoverStyle:{color:"#FFF"},itemHiddenStyle:{color:"#333"}},labels:{style:{color:"#CCC"}},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"rgba(96, 96, 96, .8)"],[1,"rgba(16, 16, 16, .8)"]]},borderWidth:0,style:{color:"#FFF"}},plotOptions:{line:{dataLabels:{color:"#CCC"},marker:{lineColor:"#333"}},spline:{marker:{lineColor:"#333"}},scatter:{marker:{lineColor:"#333"}},candlestick:{lineColor:"white"}},toolbar:{itemStyle:{color:"#CCC"}},navigation:{buttonOptions:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#606060"],[.6,"#333333"]]},borderColor:"#000000",symbolStroke:"#C0C0C0",hoverSymbolStroke:"#FFFFFF"}},exporting:{buttons:{exportButton:{symbolFill:"#55BE3B"},printButton:{symbolFill:"#7797BE"}}},rangeSelector:{buttonTheme:{fill:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#888"],[.6,"#555"]]},stroke:"#000000",style:{color:"#CCC",fontWeight:"bold"},states:{hover:{fill:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#BBB"],[.6,"#888"]]},stroke:"#000000",style:{color:"white"}},select:{fill:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.1,"#000"],[.3,"#333"]]},stroke:"#000000",style:{color:"yellow"}}}},inputStyle:{backgroundColor:"#333",color:"silver"},labelStyle:{color:"silver"}},navigator:{handles:{backgroundColor:"#666",borderColor:"#AAA"},outlineColor:"#CCC",maskFill:"rgba(16, 16, 16, 0.5)",series:{color:"#7798BF",lineColor:"#A6C7ED"}},scrollbar:{barBackgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#888"],[.6,"#555"]]},barBorderColor:"#CCC",buttonArrowColor:"#CCC",buttonBackgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#888"],[.6,"#555"]]},buttonBorderColor:"#CCC",rifleColor:"#FFF",trackBackgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#000"],[1,"#333"]]},trackBorderColor:"#666"},legendBackgroundColor:"rgba(48, 48, 48, 0.8)",legendBackgroundColorSolid:"rgb(70, 70, 70)",dataLabelsColor:"#444",textColor:"#E0E0E0",maskColor:"rgba(255,255,255,0.3)"},e.setOptions(e.theme),e.theme});var XDate=function(t,e,i,n){function s(){return r(this instanceof s?this:new s,arguments)}function r(e,i){var n,r=i.length;if(z(i[r-1])&&(n=i[--r],i=I(i,0,r)),r)if(1==r){var o=i[0];o instanceof t||$(o)?e[0]=new t(+o):o instanceof s?e[0]=C(o):N(o)&&(e[0]=new t(0),e=m(o,n||!1,e))}else e[0]=new t(ee.apply(t,i)),n||(e[0]=S(e[0]));else e[0]=new t;return z(n)&&a(e,n),e}function o(t){return t[0].toString===ie}function a(e,i,n){return i?o(e)||(n&&(e[0]=T(e[0])),e[0].toString=ie):o(e)&&(e[0]=n?S(e[0]):new t(+e[0])),e}function l(t,e,i,n,s){var r=F(D,t[0],s),o=F(M,t[0],s),a=e==W?i%12:r(W),l=!1;2==n.length&&z(n[1])&&(l=n[1],n=[i]),o(e,n),l&&r(W)!=a&&(o(W,[r(W)-1]),o(j,[A(r(H),r(W))]))}function h(t,i,n,s){n=Number(n);var r=e.floor(n);t["set"+J[i]](t["get"+J[i]]()+r,s||!1),r!=n&&V>i&&h(t,i+1,(n-r)*Q[i],s)}function c(t,i,n){t=t.clone().setUTCMode(!0,!0),i=s(i).setUTCMode(!0,!0);var r=0;if(n==H||n==W){for(var o=V;o>=n;o--)r/=Q[o],r+=D(i,!1,o)-D(t,!1,o);n==W&&(r+=12*(i.getFullYear()-t.getFullYear()))}else if(n==j){var a=t.toDate().setUTCHours(0,0,0,0),l=i.toDate().setUTCHours(0,0,0,0);r=e.round((l-a)/q)+(i-l-(t-a))/q}else r=(i-t)/[36e5,6e4,1e3,1][n-3];return r}function u(t){return d(t(H),t(W),t(j))}function d(i,n,s){var r=new t(ee(i,n,s)),o=p(i),a=o;if(o>r)a=p(i-1);else{var l=p(i+1);r>=l&&(a=l)}return e.floor(e.round((r-a)/q)/7)+1}function p(e){var i=new t(ee(e,0,4));return i.setUTCDate(i.getUTCDate()-(i.getUTCDay()+6)%7),i}function f(t,e,i,s){var r=F(D,t,s),o=F(M,t,s),a=p(i===n?r(H):i);s||(a=S(a)),t.setTime(+a),o(j,[r(j)+7*(e-1)])}function m(e,i,n){for(var r,o=s.parsers,a=0;a<o.length;a++)if(r=o[a](e,i,n))return r;return n[0]=new t(e),n}function g(e,i,n){var s=e.match(/^(\d{4})(-(\d{2})(-(\d{2})([T ](\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/);if(s){var r=new t(ee(s[1],s[3]?s[3]-1:0,s[5]||1,s[7]||0,s[8]||0,s[10]||0,s[12]?1e3*Number("0."+s[12]):0));return s[13]?s[14]&&r.setUTCMinutes(r.getUTCMinutes()+("-"==s[15]?1:-1)*(60*Number(s[16])+(s[18]?Number(s[18]):0))):i||(r=S(r)),n.setTime(+r)}}function v(t,e,i,n,r){function o(t){return i[t]||h[t]}function a(t){if(n)for(var e=(t==U?j:t)-1;e>=0;e--)n.push(c(e));return c(t)}var l=s.locales,h=l[s.defaultLocale]||{},c=F(D,t,r);return i=(N(i)?l[i]:i)||{},y(t,e,a,o,r)}function y(t,e,i,n,s){for(var r,o,a="";r=e.match(te);)a+=e.substr(0,r.index),r[1]?a+=b(t,r[1],i,n,s):r[3]?(o=y(t,r[4],i,n,s),parseInt(o.replace(/\D/g,""),10)&&(a+=o)):a+=r[7]||"'",e=e.substr(r.index+r[0].length);return a+e}function b(t,e,i,s,r){for(var o,a=e.length,l="";a>0;)o=x(t,e.substr(0,a),i,s,r),o!==n?(l+=o,e=e.substr(a),a=e.length):a--;return l+e}function x(t,e,i,n,r){var o=s.formatters[e];if(N(o))return y(t,o,i,n,r);if(P(o))return o(t,r||!1,n);switch(e){case"fff":return O(i(V),3);case"s":return i(Y);case"ss":return O(i(Y));case"m":return i(B);case"mm":return O(i(B));case"h":return i(R)%12||12;case"hh":return O(i(R)%12||12);case"H":return i(R);case"HH":return O(i(R));case"d":return i(j);case"dd":return O(i(j));case"ddd":return n("dayNamesShort")[i(U)]||"";case"dddd":return n("dayNames")[i(U)]||"";case"M":return i(W)+1;case"MM":return O(i(W)+1);case"MMM":return n("monthNamesShort")[i(W)]||"";case"MMMM":return n("monthNames")[i(W)]||"";case"yy":return(i(H)+"").substring(2);case"yyyy":return i(H);case"t":return k(i,n).substr(0,1).toLowerCase();case"tt":return k(i,n).toLowerCase();case"T":return k(i,n).substr(0,1);case"TT":return k(i,n);case"z":case"zz":case"zzz":return r?"Z":w(t,e);case"w":return u(i);case"ww":return O(u(i));case"S":var a=i(j);return a>10&&20>a?"th":["st","nd","rd"][a%10-1]||"th"}}function w(t,i){var n=t.getTimezoneOffset(),s=0>n?"+":"-",r=e.floor(e.abs(n)/60),o=e.abs(n)%60,a=r;return"zz"==i?a=O(r):"zzz"==i&&(a=O(r)+":"+O(o)),s+a}function k(t,e){return t(R)<12?e("amDesignator"):e("pmDesignator")}function _(t){return!isNaN(+t[0])}function C(e){var i=new t(+e[0]);return o(e)&&(i.toString=ie),i}function D(t,e,i){return t["get"+(e?"UTC":"")+J[i]]()}function M(t,e,i,n){t["set"+(e?"UTC":"")+J[i]].apply(t,n)}function T(e){return new t(ee(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))}function S(e){return new t(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())}function A(e,i){return 32-new t(ee(e,i,32)).getUTCDate()}function E(t){return function(){return t.apply(n,[this].concat(I(arguments)))}}function F(t){var e=I(arguments,1);return function(){return t.apply(n,e.concat(I(arguments)))}}function I(t,e,s){return i.prototype.slice.call(t,e||0,s===n?t.length:s)}function L(t,e){for(var i=0;i<t.length;i++)e(t[i],i)}function N(t){return"string"==typeof t}function $(t){return"number"==typeof t}function z(t){return"boolean"==typeof t}function P(t){return"function"==typeof t}function O(t,e){for(e=e||2,t+="";t.length<e;)t="0"+t;return t}var H=0,W=1,j=2,R=3,B=4,Y=5,V=6,U=7,G=8,q=864e5,X="yyyy-MM-dd'T'HH:mm:ss(.fff)",K=X+"zzz",J=["FullYear","Month","Date","Hours","Minutes","Seconds","Milliseconds","Day","Year"],Z=["Years","Months","Days"],Q=[12,31,24,60,60,1e3,1],te=new RegExp("(([a-zA-Z])\\2*)|(\\((('.*?'|\\(.*?\\)|.)*?)\\))|('(.*?)')"),ee=t.UTC,ie=t.prototype.toUTCString,ne=s.prototype;return ne.length=1,ne.splice=i.prototype.splice,ne.getUTCMode=E(o),ne.setUTCMode=E(a),ne.getTimezoneOffset=function(){return o(this)?0:this[0].getTimezoneOffset()},L(J,function(t,e){ne["get"+t]=function(){return D(this[0],o(this),e)},e!=G&&(ne["getUTC"+t]=function(){return D(this[0],!0,e)}),e!=U&&(ne["set"+t]=function(t){return l(this,e,t,arguments,o(this)),this},e!=G&&(ne["setUTC"+t]=function(t){return l(this,e,t,arguments,!0),this},ne["add"+(Z[e]||t)]=function(t,i){return h(this,e,t,i),this},ne["diff"+(Z[e]||t)]=function(t){return c(this,t,e)}))}),ne.getWeek=function(){return u(F(D,this,!1))},ne.getUTCWeek=function(){return u(F(D,this,!0))},ne.setWeek=function(t,e){return f(this,t,e,!1),this},ne.setUTCWeek=function(t,e){return f(this,t,e,!0),this},ne.addWeeks=function(t){return this.addDays(7*Number(t))},ne.diffWeeks=function(t){return c(this,t,j)/7},s.parsers=[g],s.parse=function(t){return+s(""+t)},ne.toString=function(t,e,i){return t!==n&&_(this)?v(this,t,e,i,o(this)):this[0].toString()},ne.toUTCString=ne.toGMTString=function(t,e,i){return t!==n&&_(this)?v(this,t,e,i,!0):this[0].toUTCString()},ne.toISOString=function(){return this.toUTCString(K)},s.defaultLocale="",s.locales={"":{monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],amDesignator:"AM",pmDesignator:"PM"}},s.formatters={i:X,u:K},L(["getTime","valueOf","toDateString","toTimeString","toLocaleString","toLocaleDateString","toLocaleTimeString","toJSON"],function(t){ne[t]=function(){return this[0][t]()}}),ne.setTime=function(t){return this[0].setTime(t),this},ne.valid=E(_),ne.clone=function(){return new s(this)},ne.clearTime=function(){return this.setHours(0,0,0,0)},ne.toDate=function(){return new t(+this[0])},s.now=function(){return+new t},s.today=function(){return(new s).clearTime()},s.UTC=ee,s.getDaysInMonth=A,"undefined"!=typeof module&&module.exports&&(module.exports=s),s}(Date,Math,Array);define("xdate",function(){}),define("view/base",["jquery","underscore","backbone","handlebars","highcharts","underscore-string","highcharts-theme","xdate","backbone-mediator"],function(t,e,i,n){var s=i.View.extend({assetRoot:"public/",intervalDiviser:4,infiniteTimes:[],infiniteLabels:[],infiniteTimesInt:[],addHelpers:function(){n.registerHelper("nl2br",function(t){var e=(t+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2");return new n.SafeString(e)})},destroySubscriptions:function(){for(sub in this.subscriptions)i.Mediator.unsubscribe(sub,this[this.subscriptions[sub]],this)},drawAsInfinite:function(t){var i=t.match(/^drawAsInfinite\((.*)\)$/);return i?e.last(i):null},formatGraphData:function(t){var i=e.reduce(e.keys(t),function(i,n){var s=t[n];return t[n]={},t[n].graphite=s,t[n].xInt=[],t[n].x=[],t[n].y=[],e.each(t[n].graphite,function(e){t[n].x.push(new XDate(1e3*e[0]).toUTCString("HH:mm")),t[n].y.push(e[1]),t[n].xInt.push(e[0])}),t},[]);return i},focusFirst:function(){this.$el.find("input[type=text]:first").focus()},initGraph:function(t){var e=this;return e.chart=new Highcharts.Chart({exporting:{buttons:{exportButton:{enabled:!1},printButton:{enabled:!1}}},credits:{enabled:!1},chart:{zoomType:"x",spacingRight:24,animation:!0,renderTo:t,type:"line",borderRadius:3,backgroundColor:{stops:[[0,"rgb(16, 16, 16)"],[1,"rgb(16, 16, 16)"]]}},title:{text:null},xAxis:{minTickInterval:this,title:{text:null}},yAxis:{title:{text:null}},plotOptions:{column:{animation:!0},series:{animation:!1,marker:{enabled:!1}}},tooltip:{animation:!0}}),e.chart},keyOrder:function(t){var i=[];return i=e.keys(t),i=e.sortBy(i,function(t){return t.toLowerCase()})},renderGraphData:function(t,i){for(var n=this,s=[],r=["#4572A7","#AA4643","#89A54E","#80699B","#3D96AE","#DB843D","#92A8CD","#A47D7C","#B5CA92"];t.series.length>0;)t.series[0].remove(!0);t.xAxis[0].removePlotLine("plotLine"),n.infiniteTimes=[],n.infiniteTimesInt=[],n.infiniteLabels=[],e.each(i,function(t,e){if(n.drawAsInfinite(e)){for(var s=[],r=[],o=0;o<t.xInt.length;o++)t.y[o]&&(s.push(t.x[o]),r.push(t.xInt[o]));n.infiniteTimes.push(s),n.infiniteTimesInt.push(r),n.infiniteLabels.push(n.drawAsInfinite(e)),delete i[e]}});for(var o=n.keyOrder(i),a=0;a<o.length;a++){var l=i[o[a]];t.xAxis[0].setCategories(l.x),t.xAxis[0].options.tickInterval=parseInt(l.x.length/n.intervalDiviser,10),t.xAxis[0].setExtremes(null,null),t.addSeries({name:o[a],data:l.y,animation:!1,color:r[a]}),s=e.union(s,l.xInt)}if(n.infiniteTimes.length)for(var h=n.infiniteTimes.length-1,a=h;a>=0;a--){var c=n.infiniteTimesInt[a];if(c.length)for(var u=0;u<c.length;u++){var d=e.sortedIndex(s,c[u]);e.isNull(d)||t.xAxis[0].addPlotLine({id:"plotLine",value:d,color:"green",dashStyle:"shortdash",width:2,label:{text:n.infiniteLabels[a],style:{color:"#ccc"}}})}}},formatServerDateTime:function(t,e){var i=t.toString().length;return 10==i?new XDate(1e3*parseInt(t,10),e):new XDate(parseInt(t,10),e)},parseAlertKeys:function(t){var i=[],n=t.split("\n");return e.each(n,function(t){i.push(e.str.words(t,/([ \,])/))}),i=e.flatten(i),i=e.filter(i,function(t){return!e.str.isBlank(t)&&","!==t})},resizeModal:function(e,i,n){var s=t(window).width(),r=t(window).height(),o=.8;switch(i){case"small":widthMultipler=.3;break;case"medium":widthMultipler=.6;break;case"large":widthMultipler=.9;break;default:widthMultipler=.6}return e.css({width:s*widthMultipler,marginLeft:-(s*(widthMultipler/2))}),n||(e.css({height:r*o}),e.find(".modal-body").css({maxHeight:r*o-140,height:r*o-149})),e.each(function(){t(this).css({marginTop:-(t(this).height()/2)})}),e.addClass("modal-"+i),{height:e.height(),width:e.width(),body:{height:e.find(".modal-body").height(),width:e.find(".modal-body").width()}}},_processRadioControl:function(i,n){var s=e.map(i,function(e){return t(e).attr("data-value")});return s.length>0?s.join(","):n?n:""},_createCronExpr:function(){var t=this;return[0,t.$el.find("#inputMinutes").val(),t.$el.find("#inputHours").val(),t.$el.find("#inputDays").val(),t._processRadioControl(t.$el.find(".month-picker button.active"),"*"),t._processRadioControl(t.$el.find(".day-picker button.active"),"?")].join(" ")},showOverlay:function(e,i,n){var s=this;if(e=t(e),!s.overlay){var n=n?n:"";s.overlay=t("<div class='overlay "+n+"'><h1></h1></div>"),e.append(s.overlay)}s.overlay.find("h1").html(i),s.overlay.show()},hideOverlay:function(){var t=this;t.overlay.hide()},_toggleFullscreen:function(e,i,n,s){var r=t(e);r.hasClass("fullscreen")?(n&&s&&(n.show(),s.hide()),r.removeClass("fullscreen"),r.height(r.data("beforeFullscreen").height),r.width(r.data("beforeFullscreen").width),i.refresh()):(n&&s&&(n.hide(),s.show()),r.data("beforeFullscreen",{height:r.height(),width:r.width()}),r.addClass("fullscreen"),r.width("100%"),r.height("100%"),i.setSize("100%","100%"),i.refresh())},_validateMirror:function(e){var i=this,n=t(e.getWrapperElement());return i._isNonblank(e.getValue())?(n.removeClass("error"),!0):(n.addClass("error"),!1)},_isNonblank:function(t){var e=/\S/;return-1!=String(t).search(e)},getPositions:function(e){var i=t(e).offset(),n=t(e).width(),s=t(e).height();return[[i.left,i.left+n],[i.top,i.top+s]]},comparePositions:function(t,e){var i=t[0]<e[0]?t:e,n=t[0]<e[0]?e:t;return i[1]>n[0]||i[0]===n[0]},overlaps:function(t,e){var i=this,n=i.getPositions(t),s=i.getPositions(e);return i.comparePositions(n[0],s[0])&&i.comparePositions(n[1],s[1])}});return s.prototype.destructor=function(){this.destroySubscriptions(),this.onDestruct&&this.onDestruct(),this.off(),this.remove(),this.$el.empty()},s}),define("view/alert",["view/base"],function(t){var e=t.extend({subscriptions:{"view:adddashboard:save":"render","view:addcategory:save":"render","view:addmonitor:save":"render","view:addmonitor:test":"render","view:expandedmonitor:delete":"render","view:expandedmonitor:save":"render","view:expandedmonitor:test":"render","view:smallmonitor:save":"render","view:dashboard:save":"render","view:resetmonitor:reset":"render"},initialize:function(t){_.bindAll(this,"render","activate","deactivate"),this.templar=t.templar},render:function(t){if(t.tryJSON)try{t.errors=JSON.parse(t.tryJSON).errors}catch(e){t.raw=t.tryJSON}this.templar.render({path:"alert",el:this.$el,data:t}),this.activate()},activate:function(){this.$el.addClass("active"),_.delay(this.deactivate,2e4)},deactivate:function(){this.$el.removeClass("active")}});return e}),define("view/primarynav",["view/base"],function(t){var e=t.extend({subscriptions:{"view:dashboard:save":"render","view:adddashboard:save":"render","view:addcategory:save":"render"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.user=t.user,Backbone.history.bind("all",function(){this.setNav()}.bind(this))},render:function(){this.$el.empty(),this.collection.fetch({success:function(){this.collection.sort(),this.templar.render({path:"primarynav",el:this.$el,data:{nav:this.collection.toJSON(),user:this.user.toJSON()}})}.bind(this)}),this.$el.find(".user").tooltip({placement:"bottom"})},setNav:function(){var t=Backbone.history.fragment;switch(this.$el.find("li").removeClass("active"),t){case"ecosystem":this.$el.find(".nav > li:first-child").addClass("active")}}});return e}),define("view/header",["view/base"],function(t){var e=t.extend({initialize:function(t){_.bindAll(this,"render"),this.templar=t.templar,this.currentNav={header:{title:"Ecosystem",subtitle:"",date:new XDate(Date.now()).toUTCString("MMM dd, yyyy"),nav:{back:!1}}},Backbone.Mediator.sub("view:ecosystem:render",this.render,this),Backbone.Mediator.sub("view:dashboard:render",this.render,this),this.render()},render:function(t){this.previous=this.currentNav,_.extend(this.currentNav.header,t),this.templar.render({path:"header",el:this.$el,data:this.currentNav})}});return e}),define("model/base",["underscore","backbone"],function(t,e){var i=e.Model.extend({url:"",formatServerDateTime:function(t){var e=t.toString().length;return 10==e?1e3*parseInt(t,10):parseInt(t,10)}});return i}),define("model/monitor",["model/base"],function(t){var e=t.extend({url:function(){return this.get("id")?"/jobs/"+this.get("id"):"/jobs.json"},parse:function(t){return t.createdAt=t.createdAt?this.formatServerDateTime(t.createdAt):t.createdAt,t.modifiedAt=t.modifiedAt?this.formatServerDateTime(t.modifiedAt):t.modifiedAt,t},defaults:{id:null,dashboardId:1,userId:null,name:"",active:!0,jobType:"monitor",version:2,alertKeys:[],cronExpr:"",errorTimeout:60,minutes:1,metrics:[],monitorExpr:"",toDate:null,createdAt:null,modifiedAt:null}});return e}),window.CodeMirror=function(){function t(o,l){function h(t){tn.onDragEvent&&tn.onDragEvent(ns,D(t))||S(t)}function f(t){return t>=0&&t<Dn.size}function m(t){return b(Dn,t)}function C(t,e){zn=!0;for(var i=e-t.height,n=t;n;n=n.parent)n.height+=i}function T(t,e){return t.styles||t.highlight(wn,t.stateAfter=Gi(x(t)),tn.tabSize),t.getContent(tn.tabSize,e,tn.lineWrapping)}function N(t){var e={line:0,ch:0};Ee(e,{line:Dn.size-1,ch:m(Dn.size-1).text.length},xe(t),e,e),Fn=!0}function U(t){var e=[];return Dn.iter(0,Dn.size,function(t){e.push(t.text)}),e.join(t||"\n")}function Z(){an.scrollTop!=Wn&&(Wn=yn.scrollTop=an.scrollTop,Qe([]))}function Q(){tn.fixedGutter&&mn.style.left!=yn.scrollLeft+"px"&&(mn.style.left=yn.scrollLeft+"px"),yn.scrollTop!=Wn&&(Wn=yn.scrollTop,an.scrollTop!=Wn&&(an.scrollTop=Wn),Qe([])),tn.onScroll&&tn.onScroll(ns)}function ee(t){function e(e){he&&(yn.draggable=!1),En=!1,d(),p(),Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)<10&&(M(e),li(o.line,o.ch,!0),Ge())}function i(t){if("single"==l)ri(o,t);else if("double"==l){var e=mi(t);j(t,f)?ri(e.from,m):ri(f,e.to)}else"triple"==l&&(j(t,f)?ri(m,ci({line:t.line,ch:0})):ri(f,ci({line:t.line+1,ch:0})))}function n(t){var e=Ri(t,!0);if(e&&!W(e,u)){kn||Se(),u=e,i(e),Fn=!1;var s=Ze();(e.line>=s.to||e.line<s.from)&&(c=setTimeout(Zi(function(){n(t)}),150))}}function s(t){clearTimeout(c);var e=Ri(t);e&&i(e),M(t),Ge(),Fn=!0,g(),d()}si(F(t,"shiftKey"));for(var r=A(t);r!=bn;r=r.parentNode)if(r.parentNode==vn&&r!=gn)return;for(var r=A(t);r!=bn;r=r.parentNode)if(r.parentNode==fn)return tn.onGutterClick&&tn.onGutterClick(ns,q(fn.childNodes,r)+Yn,t),M(t);var o=Ri(t);switch(E(t)){case 3:return se&&Bi(t),void 0;case 2:return o&&li(o.line,o.ch,!0),setTimeout(Ge,20),M(t),void 0}if(!o)return A(t)==yn&&M(t),void 0;kn||Se();var a=+new Date,l="single";if(An&&An.time>a-400&&W(An.pos,o))l="triple",M(t),setTimeout(Ge,20),gi(o.line);else if(Sn&&Sn.time>a-400&&W(Sn.pos,o)){l="double",An={time:a,pos:o},M(t);var h=mi(o);ri(h.from,h.to)}else Sn={time:a,pos:o};var c,u=o;if(tn.dragDrop&&ve&&!tn.readOnly&&!W(Hn.from,Hn.to)&&!j(o,Hn.from)&&!j(Hn.to,o)&&"single"==l){he&&(yn.draggable=!0);var d=I(document,"mouseup",Zi(e),!0),p=I(yn,"drop",Zi(e),!0);return En=!0,yn.dragDrop&&yn.dragDrop(),void 0}M(t),"single"==l&&li(o.line,o.ch,!0);var f=Hn.from,m=Hn.to,g=I(document,"mousemove",Zi(function(t){clearTimeout(c),M(t),re||E(t)?n(t):s(t)}),!0),d=I(document,"mouseup",Zi(s),!0)}function ce(t){for(var e=A(t);e!=bn;e=e.parentNode)if(e.parentNode==fn)return M(t);M(t)}function de(t){if(!tn.onDragEvent||!tn.onDragEvent(ns,D(t))){M(t);var e=Ri(t,!0),i=t.dataTransfer.files;if(e&&!tn.readOnly)if(i&&i.length&&window.FileReader&&window.File)for(var n=i.length,s=Array(n),r=0,o=function(t,i){var o=new FileReader;o.onload=function(){s[i]=o.result,++r==n&&(e=ci(e),Zi(function(){var t=Oe(s.join(""),e,e);ri(e,t)})())},o.readAsText(t)},a=0;n>a;++a)o(i[a],a);else{if(En&&!j(e,Hn.from)&&!j(Hn.to,e))return;try{var s=t.dataTransfer.getData("Text");s&&Qi(function(){var t=Hn.from,i=Hn.to;ri(e,e),En&&Oe("",t,i),He(s),Ge()})}catch(t){}}}}function me(t){var e=Re();t.dataTransfer.setData("Text",e),t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(B("img"),0,0)}function be(t,e){if("string"==typeof t&&(t=ie[t],!t))return!1;var i=Tn;try{tn.readOnly&&(Rn=!0),e&&(Tn=null),t(ns)}catch(n){if(n!=ge)throw n;return!1}finally{Tn=i,Rn=!1}return!0}function _e(t){function s(){c=!0}var r=e(tn.keyMap),o=r.auto;clearTimeout(is),o&&!n(t)&&(is=setTimeout(function(){e(tn.keyMap)==r&&(tn.keyMap=o.call?o.call(null,ns):o)},50));var a=ke[F(t,"keyCode")],l=!1,h=ue&&J;if(null==a||t.altGraphKey)return!1;F(t,"altKey")&&(a="Alt-"+a),F(t,h?"metaKey":"ctrlKey")&&(a="Ctrl-"+a),F(t,h?"ctrlKey":"metaKey")&&(a="Cmd-"+a);var c=!1;return l=F(t,"shiftKey")?i("Shift-"+a,tn.extraKeys,tn.keyMap,function(t){return be(t,!0)},s)||i(a,tn.extraKeys,tn.keyMap,function(t){return"string"==typeof t&&/^go[A-Z]/.test(t)?be(t):void 0},s):i(a,tn.extraKeys,tn.keyMap,be,s),c&&(l=!1),l&&(M(t),Yi(),re&&(t.oldKeyCode=t.keyCode,t.keyCode=0)),l}function Ce(t,e){var n=i("'"+e+"'",tn.extraKeys,tn.keyMap,function(t){return be(t,!0)});return n&&(M(t),Yi()),n}function De(t){if(kn||Se(),re&&27==t.keyCode&&(t.returnValue=!1),Kn&&Ve()&&(Kn=!1),!tn.onKeyEvent||!tn.onKeyEvent(ns,D(t))){var e=F(t,"keyCode");si(16==e||F(t,"shiftKey"));var i=_e(t);ue&&(ss=i?e:null,!i&&88==e&&F(t,J?"metaKey":"ctrlKey")&&He(""))}}function Me(t){if(Kn&&Ve(),!tn.onKeyEvent||!tn.onKeyEvent(ns,D(t))){var e=F(t,"keyCode"),i=F(t,"charCode");if(ue&&e==ss)return ss=null,M(t),void 0;if(!(ue&&(!t.which||t.which<10)||pe)||!_e(t)){var n=String.fromCharCode(null==i?e:i);tn.electricChars&&wn.electricChars&&tn.smartIndent&&!tn.readOnly&&wn.electricChars.indexOf(n)>-1&&setTimeout(Zi(function(){yi(Hn.to.line,"smart")}),75),Ce(t,n)||Ye()}}}function Te(t){tn.onKeyEvent&&tn.onKeyEvent(ns,D(t))||16==F(t,"keyCode")&&(Tn=null)}function Se(){"nocursor"!=tn.readOnly&&(kn||(tn.onFocus&&tn.onFocus(ns),kn=!0,-1==yn.className.search(/\bCodeMirror-focused\b/)&&(yn.className+=" CodeMirror-focused")),Be(),Yi())}function Ae(){kn&&(tn.onBlur&&tn.onBlur(ns),kn=!1,On&&Zi(function(){On&&(On(),On=null)})(),yn.className=yn.className.replace(" CodeMirror-focused","")),clearInterval(xn),setTimeout(function(){kn||(Tn=null)},150)}function Ee(t,e,i,n,s){if(!Rn){var r=[];if(Dn.iter(t.line,e.line+1,function(t){r.push(p(t.text,t.markedSpans))}),Zn)for(Zn.addChange(t.line,i.length,r);Zn.done.length>tn.undoDepth;)Zn.done.shift();var o=c(d(r[0]),d(O(r)),t.ch,e.ch,i);Ne(t,e,o,n,s)}}function Fe(t,e){if(t.length){for(var i=t.pop(),n=[],s=i.length-1;s>=0;s-=1){var r=i[s],o=[],a=r.start+r.added;Dn.iter(r.start,a,function(t){o.push(p(t.text,t.markedSpans))}),n.push({start:r.start,added:r.old.length,old:o});var l={line:r.start+r.old.length-1,ch:G(u(O(o)),u(O(r.old)))};Ne({line:r.start,ch:0},{line:a-1,ch:m(a-1).text.length},r.old,l,l)}Fn=!0,e.push(n)}}function Ie(){Fe(Zn.done,Zn.undone)}function Le(){Fe(Zn.undone,Zn.done)}function Ne(t,e,i,n,s){function r(t){return t<=Math.min(e.line,e.line+x)?t:t+x}if(!Rn){var o=!1,a=Gn.text.length;tn.lineWrapping||Dn.iter(t.line,e.line+1,function(t){return t.hidden||t.text.length!=a?void 0:(o=!0,!0)}),(t.line!=e.line||i.length>1)&&(zn=!0);var l=e.line-t.line,h=m(t.line),c=m(e.line),p=O(i);if(0==t.ch&&0==e.ch&&""==u(p)){for(var f=[],v=0,y=i.length-1;y>v;++v)f.push(new g(u(i[v]),d(i[v])));c.update(c.text,d(p)),l&&Dn.remove(t.line,l,Pn),f.length&&Dn.insert(t.line,f)}else if(h==c)if(1==i.length)h.update(h.text.slice(0,t.ch)+u(i[0])+h.text.slice(e.ch),d(i[0]));else{for(var f=[],v=1,y=i.length-1;y>v;++v)f.push(new g(u(i[v]),d(i[v])));f.push(new g(u(p)+h.text.slice(e.ch),d(p))),h.update(h.text.slice(0,t.ch)+u(i[0]),d(i[0])),Dn.insert(t.line+1,f)}else if(1==i.length)h.update(h.text.slice(0,t.ch)+u(i[0])+c.text.slice(e.ch),d(i[0])),Dn.remove(t.line+1,l,Pn);else{var f=[];h.update(h.text.slice(0,t.ch)+u(i[0]),d(i[0])),c.update(u(p)+c.text.slice(e.ch),d(p));for(var v=1,y=i.length-1;y>v;++v)f.push(new g(u(i[v]),d(i[v])));l>1&&Dn.remove(t.line+1,l-1,Pn),Dn.insert(t.line+1,f)}if(tn.lineWrapping){var b=Math.max(5,yn.clientWidth/Hi()-3);Dn.iter(t.line,t.line+i.length,function(t){if(!t.hidden){var e=Math.ceil(t.text.length/b)||1;e!=t.height&&C(t,e)}})}else Dn.iter(t.line,t.line+i.length,function(t){var e=t.text;!t.hidden&&e.length>a&&(Gn=t,a=e.length,Xn=!0,o=!1)}),o&&(qn=!0);Mn=Math.min(Mn,t.line),Xi(400);var x=i.length-l-1;if(Ln.push({from:t.line,to:e.line+1,diff:x}),tn.onChange){for(var v=0;v<i.length;++v)"string"!=typeof i[v]&&(i[v]=i[v].text);var w={from:t,to:e,text:i};if(Nn){for(var k=Nn;k.next;k=k.next);k.next=w}else Nn=w}oi(ci(n),ci(s),r(Hn.from.line),r(Hn.to.line))}}function $e(){var t=Dn.height*Oi()+2*Wi();return.99*t>yn.offsetHeight?t:!1}function ze(t){var e=$e();an.style.display=e?"block":"none",e?(on.style.height=vn.style.minHeight=e+"px",an.style.height=yn.clientHeight+"px",null!=t&&(an.scrollTop=yn.scrollTop=t,he&&setTimeout(function(){an.scrollTop==t&&(an.scrollTop=t+(t?-1:1),an.scrollTop=t)},0))):vn.style.minHeight="",gn.style.top=Bn*Oi()+"px"}function Pe(){Gn=m(0),Xn=!0;var t=Gn.text.length;Dn.iter(1,Dn.size,function(e){var i=e.text;!e.hidden&&i.length>t&&(t=i.length,Gn=e)}),qn=!1}function Oe(t,e,i){function n(n){if(j(n,e))return n;if(!j(i,n))return s;var r=n.line+t.length-(i.line-e.line)-1,o=n.ch;return n.line==i.line&&(o+=O(t).length-(i.ch-(i.line==e.line?e.ch:0))),{line:r,ch:o}}e=ci(e),i=i?ci(i):e,t=xe(t);var s;return We(t,e,i,function(t){return s=t,{from:n(Hn.from),to:n(Hn.to)}}),s}function He(t,e){We(xe(t),Hn.from,Hn.to,function(t){return"end"==e?{from:t,to:t}:"start"==e?{from:Hn.from,to:Hn.from}:{from:Hn.from,to:t}
390
- })}function We(t,e,i,n){var s=1==t.length?t[0].length+e.ch:O(t).length,r=n({line:e.line+t.length-1,ch:s});Ee(e,i,t,r.from,r.to)}function je(t,e,i){var n=t.line,s=e.line;if(n==s)return m(n).text.slice(t.ch,e.ch);var r=[m(n).text.slice(t.ch)];return Dn.iter(n+1,s,function(t){r.push(t.text)}),r.push(m(s).text.slice(0,e.ch)),r.join(i||"\n")}function Re(t){return je(Hn.from,Hn.to,t)}function Be(){Kn||_n.set(tn.pollInterval,function(){Ve(),kn&&Be()})}function Ye(){function t(){var i=Ve();i||e?(Kn=!1,Be()):(e=!0,_n.set(60,t))}var e=!1;Kn=!0,_n.set(20,t)}function Ve(){if(!kn||we(sn)||tn.readOnly)return!1;var t=sn.value;if(t==rs)return!1;ps||Ki(),Tn=null;for(var e=0,i=Math.min(rs.length,t.length);i>e&&rs[e]==t[e];)++e;return e<rs.length?Hn.from={line:Hn.from.line,ch:Hn.from.ch-(rs.length-e)}:jn&&W(Hn.from,Hn.to)&&(Hn.to={line:Hn.to.line,ch:Math.min(m(Hn.to.line).text.length,Hn.to.ch+(t.length-e))}),He(t.slice(e),"end"),t.length>1e3?sn.value=rs="":rs=t,ps||Ji(),!0}function Ue(t){W(Hn.from,Hn.to)?t&&(rs=sn.value=""):(rs="",sn.value=Re(),kn&&H(sn))}function Ge(){"nocursor"!=tn.readOnly&&sn.focus()}function qe(){var t=Xe();if(Ke(t.x,t.y,t.x,t.yBot),kn){var e=vn.getBoundingClientRect(),i=null;if(t.y+e.top<0?i=!0:t.y+e.top+Oi()>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i){var n="none"==cn.style.display;n&&(cn.style.display="",cn.style.left=t.x+"px",cn.style.top=t.y-Bn+"px"),cn.scrollIntoView(i),n&&(cn.style.display="none")}}}function Xe(){var t=$i(Hn.inverted?Hn.from:Hn.to),e=tn.lineWrapping?Math.min(t.x,pn.offsetWidth):t.x;return{x:e,y:t.y,yBot:t.yBot}}function Ke(t,e,i,n){var s=Je(t,e,i,n);null!=s.scrollLeft&&(yn.scrollLeft=s.scrollLeft),null!=s.scrollTop&&(an.scrollTop=yn.scrollTop=s.scrollTop)}function Je(t,e,i,n){var s=ji(),r=Wi();e+=r,n+=r,t+=s,i+=s;var o=yn.clientHeight,a=an.scrollTop,l={},h=$e()||1/0,c=r+10>e,u=n+r>h-10;a>e?l.scrollTop=c?0:Math.max(0,e):n>a+o&&(l.scrollTop=(u?h:n)-o);var d=yn.clientWidth,p=yn.scrollLeft,f=tn.fixedGutter?mn.clientWidth:0,m=f+s+10>t;return p+f>t||m?(m&&(t=0),l.scrollLeft=Math.max(0,t-10-f)):i>d+p-3&&(l.scrollLeft=i+10-d),l}function Ze(t){var e=Oi(),i=(null!=t?t:an.scrollTop)-Wi(),n=Math.max(0,Math.floor(i/e)),s=Math.ceil((i+yn.clientHeight)/e);return{from:w(Dn,n),to:w(Dn,s)}}function Qe(t,e,i){function n(){var t=ln.firstChild,e=!1;return Dn.iter(Yn,Vn,function(i){if(t){if(!i.hidden){var n=Math.round(t.offsetHeight/u)||1;i.height!=n&&(C(i,n),zn=e=!0)}t=t.nextSibling}}),e}if(!yn.clientWidth)return Yn=Vn=Bn=0,void 0;var s=Ze(i);if(t!==!0&&0==t.length&&s.from>Yn&&s.to<Vn)return ze(i),void 0;var r=Math.max(s.from-100,0),o=Math.min(Dn.size,s.to+100);r>Yn&&20>r-Yn&&(r=Yn),Vn>o&&20>Vn-o&&(o=Math.min(Dn.size,Vn));for(var a=t===!0?[]:ti([{from:Yn,to:Vn,domStart:0}],t),l=0,h=0;h<a.length;++h){var c=a[h];c.from<r&&(c.domStart+=r-c.from,c.from=r),c.to>o&&(c.to=o),c.from>=c.to?a.splice(h--,1):l+=c.to-c.from}if(l==o-r&&r==Yn&&o==Vn)return ze(i),void 0;a.sort(function(t,e){return t.domStart-e.domStart});var u=Oi(),d=mn.style.display;ln.style.display="none",ei(r,o,a),ln.style.display=mn.style.display="";var p=r!=Yn||o!=Vn||Un!=yn.clientHeight+u;if(p&&(Un=yn.clientHeight+u),(r!=Yn||o!=Vn&&tn.onViewportChange)&&setTimeout(function(){tn.onViewportChange&&tn.onViewportChange(ns,r,o)}),Yn=r,Vn=o,Bn=k(Dn,r),Xi(100),ln.childNodes.length!=Vn-Yn)throw new Error("BAD PATCH! "+JSON.stringify(a)+" size="+(Vn-Yn)+" nodes="+ln.childNodes.length);return tn.lineWrapping&&n(),mn.style.display=d,(p||zn)&&ii()&&tn.lineWrapping&&n()&&ii(),ze(i),ni(),!e&&tn.onUpdate&&tn.onUpdate(ns),!0}function ti(t,e){for(var i=0,n=e.length||0;n>i;++i){for(var s=e[i],r=[],o=s.diff||0,a=0,l=t.length;l>a;++a){var h=t[a];s.to<=h.from&&s.diff?r.push({from:h.from+o,to:h.to+o,domStart:h.domStart}):s.to<=h.from||s.from>=h.to?r.push(h):(s.from>h.from&&r.push({from:h.from,to:s.from,domStart:h.domStart}),s.to<h.to&&r.push({from:s.to+o,to:h.to+o,domStart:h.domStart+(s.to-h.from)}))}t=r}return t}function ei(t,e,i){function n(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}if(i.length){for(var s=0,r=ln.firstChild,o=0;o<i.length;++o){for(var a=i[o];a.domStart>s;)r=n(r),s++;for(var l=0,h=a.to-a.from;h>l;++l)r=r.nextSibling,s++}for(;r;)r=n(r)}else Y(ln);var c=i.shift(),r=ln.firstChild,l=t;Dn.iter(t,e,function(t){if(c&&c.to==l&&(c=i.shift()),!c||c.from>l){if(t.hidden)var e=B("pre");else{var e=T(t);if(t.className&&(e.className=t.className),t.bgClassName){var n=B("pre"," ",t.bgClassName,"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2");e=B("div",[n,e],null,"position: relative")}}ln.insertBefore(e,r)}else r=r.nextSibling;++l})}function ii(){if(tn.gutter||tn.lineNumbers){var t=gn.offsetHeight,e=yn.clientHeight;mn.style.height=(2>t-e?e:t)+"px";var i,n=document.createDocumentFragment(),s=Yn;if(Dn.iter(Yn,Math.max(Vn,Yn+1),function(t){if(t.hidden)n.appendChild(B("pre"));else{var e=t.gutterMarker,r=tn.lineNumbers?tn.lineNumberFormatter(s+tn.firstLineNumber):null;e&&e.text?r=e.text.replace("%N%",null!=r?r:""):null==r&&(r=" ");var o=n.appendChild(B("pre",null,e&&e.style));o.innerHTML=r;for(var a=1;a<t.height;++a)o.appendChild(B("br")),o.appendChild(document.createTextNode(" "));e||(i=s)}++s}),mn.style.display="none",V(fn,n),null!=i&&tn.lineNumbers){for(var r=fn.childNodes[i-Yn],o=String(Dn.size).length,a=z(r.firstChild),l="";a.length+l.length<o;)l+=" ";l&&r.insertBefore(document.createTextNode(l),r.firstChild)}mn.style.display="";var h=Math.abs((parseInt(pn.style.marginLeft)||0)-mn.offsetWidth)>2;return pn.style.marginLeft=mn.offsetWidth+"px",zn=!1,h}}function ni(){var t=W(Hn.from,Hn.to),e=$i(Hn.from,!0),i=t?e:$i(Hn.to,!0),n=Hn.inverted?e:i,s=Oi(),r=$(bn),o=$(ln);if(rn.style.top=Math.max(0,Math.min(yn.offsetHeight,n.y+o.top-r.top))+"px",rn.style.left=Math.max(0,Math.min(yn.offsetWidth,n.x+o.left-r.left))+"px",t)cn.style.top=n.y+"px",cn.style.left=(tn.lineWrapping?Math.min(n.x,pn.offsetWidth):n.x)+"px",cn.style.display="",hn.style.display="none";else{var a=e.y==i.y,l=document.createDocumentFragment(),h=pn.clientWidth||pn.offsetWidth,c=pn.clientHeight||pn.offsetHeight,u=function(t,e,i,n){var s=le?"width: "+(i?h-i-t:h)+"px":"right: "+i+"px";l.appendChild(B("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; "+s+"; height: "+n+"px"))};if(Hn.from.ch&&e.y>=0){var d=a?h-i.x:0;u(e.x,e.y,d,s)}var p=Math.max(0,e.y+(Hn.from.ch?s:0)),f=Math.min(i.y,c)-p;f>.2*s&&u(0,p,0,f),a&&Hn.from.ch||!(i.y<c-.5*s)||u(0,i.y,h-i.x,s),V(hn,l),cn.style.display="none",hn.style.display=""}}function si(t){Tn=t?Tn||(Hn.inverted?Hn.to:Hn.from):null}function ri(t,e){var i=Tn&&ci(Tn);i&&(j(i,t)?t=i:j(e,i)&&(e=i)),oi(t,e),In=!0}function oi(t,e,i,n){if(Jn=null,null==i&&(i=Hn.from.line,n=Hn.to.line),!W(Hn.from,t)||!W(Hn.to,e)){if(j(e,t)){var s=e;e=t,t=s}if(t.line!=i){var r=ai(t,i,Hn.from.ch);r?t=r:Ii(t.line,!1)}if(e.line!=n&&(e=ai(e,n,Hn.to.ch)),W(t,e)?Hn.inverted=!1:W(t,Hn.to)?Hn.inverted=!1:W(e,Hn.from)&&(Hn.inverted=!0),tn.autoClearEmptyLines&&W(Hn.from,Hn.to)){var o=Hn.inverted?t:e;if(o.line!=Hn.from.line&&Hn.from.line<Dn.size){var a=m(Hn.from.line);/^\s+$/.test(a.text)&&setTimeout(Zi(function(){if(a.parent&&/^\s+$/.test(a.text)){var t=x(a);Oe("",{line:t,ch:0},{line:t,ch:a.text.length})}},10))}}Hn.from=t,Hn.to=e,$n=!0}}function ai(t,e,i){function n(e){for(var n=t.line+e,s=1==e?Dn.size:-1;n!=s;){var o=m(n);if(!o.hidden){var a=t.ch;return(r||a>i||a>o.text.length)&&(a=o.text.length),{line:n,ch:a}}n+=e}}var s=m(t.line),r=t.ch==s.text.length&&t.ch!=i;return s.hidden?t.line>=e?n(1)||n(-1):n(-1)||n(1):t}function li(t,e,i){var n=ci({line:t,ch:e||0});(i?ri:oi)(n,n)}function hi(t){return Math.max(0,Math.min(t,Dn.size-1))}function ci(t){if(t.line<0)return{line:0,ch:0};if(t.line>=Dn.size)return{line:Dn.size-1,ch:m(Dn.size-1).text.length};var e=t.ch,i=m(t.line).text.length;return null==e||e>i?{line:t.line,ch:i}:0>e?{line:t.line,ch:0}:t}function ui(t,e){function i(){for(var e=r+t,i=0>t?-1:Dn.size;e!=i;e+=t){var n=m(e);if(!n.hidden)return r=e,a=n,!0}}function n(e){if(o==(0>t?0:a.text.length)){if(e||!i())return!1;o=0>t?a.text.length:0}else o+=t;return!0}var s=Hn.inverted?Hn.from:Hn.to,r=s.line,o=s.ch,a=m(r);if("char"==e)n();else if("column"==e)n(!0);else if("word"==e)for(var l=!1;!(0>t)||n();){if(X(a.text.charAt(o)))l=!0;else if(l){0>t&&(t=1,n());break}if(t>0&&!n())break}return{line:r,ch:o}}function di(t,e){var i=0>t?Hn.from:Hn.to;(Tn||W(Hn.from,Hn.to))&&(i=ui(t,e)),li(i.line,i.ch,!0)}function pi(t,e){W(Hn.from,Hn.to)?0>t?Oe("",ui(t,e),Hn.to):Oe("",Hn.from,ui(t,e)):Oe("",Hn.from,Hn.to),In=!0}function fi(t,e){var i=$i(Hn.inverted?Hn.from:Hn.to,!0);if(null!=Jn&&(i.x=Jn),"page"==e)var n=Math.min(yn.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=zi(i.x,i.y+n*t);else if("line"==e)var r=Oi(),s=zi(i.x,i.y+.5*r+t*r);"page"==e&&(an.scrollTop+=$i(s,!0).y-i.y),li(s.line,s.ch,!0),Jn=i.x}function mi(t){var e=m(t.line).text,i=t.ch,n=t.ch;if(e){t.after===!1||n==e.length?--i:++n;for(var s=e.charAt(i),r=X(s)?X:/\s/.test(s)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!X(t)};i>0&&r(e.charAt(i-1));)--i;for(;n<e.length&&r(e.charAt(n));)++n}return{from:{line:t.line,ch:i},to:{line:t.line,ch:n}}}function gi(t){ri({line:t,ch:0},ci({line:t+1,ch:0}))}function vi(t){if(W(Hn.from,Hn.to))return yi(Hn.from.line,t);for(var e=Hn.to.line-(Hn.to.ch?0:1),i=Hn.from.line;e>=i;++i)yi(i,t)}function yi(t,e){if(e||(e="add"),"smart"==e)if(wn.indent)var i=Gi(t);else e="prev";var n,s=m(t),r=s.indentation(tn.tabSize),o=s.text.match(/^\s*/)[0];"smart"==e&&(n=wn.indent(i,s.text.slice(o.length),s.text),n==ge&&(e="prev")),"prev"==e?n=t?m(t-1).indentation(tn.tabSize):0:"add"==e?n=r+tn.indentUnit:"subtract"==e&&(n=r-tn.indentUnit),n=Math.max(0,n);var a="",l=0;if(tn.indentWithTabs)for(var h=Math.floor(n/tn.tabSize);h;--h)l+=tn.tabSize,a+=" ";n>l&&(a+=P(n-l)),a!=o&&Oe(a,{line:t,ch:0},{line:t,ch:o.length})}function bi(){wn=t.getMode(tn,tn.mode),Dn.iter(0,Dn.size,function(t){t.stateAfter=null}),Mn=0,Xi(100)}function xi(){var t=tn.gutter||tn.lineNumbers;mn.style.display=t?"":"none",t?zn=!0:ln.parentNode.style.marginLeft=0}function wi(){if(tn.lineWrapping){bn.className+=" CodeMirror-wrap";var t=yn.clientWidth/Hi()-3;Dn.iter(0,Dn.size,function(e){if(!e.hidden){var i=Math.ceil(e.text.length/t)||1;1!=i&&C(e,i)}}),pn.style.minWidth=un.style.left=""}else bn.className=bn.className.replace(" CodeMirror-wrap",""),Pe(),Dn.iter(0,Dn.size,function(t){1==t.height||t.hidden||C(t,1)});Ln.push({from:0,to:Dn.size})}function ki(){yn.className=yn.className.replace(/\s*cm-s-\S+/g,"")+tn.theme.replace(/(^|\s)\s*/g," cm-s-")}function _i(){var t=ne[tn.keyMap].style;bn.className=bn.className.replace(/\s*cm-keymap-\S+/g,"")+(t?" cm-keymap-"+t:"")}function Ci(t,e){this.lines=[],this.type=t,e&&(this.style=e)}function Di(t,e,i,n){t=ci(t),e=ci(e);var s=new Ci("range",i);if(n)for(var r in n)n.hasOwnProperty(r)&&(s[r]=n[r]);var o=t.line;return Dn.iter(o,e.line+1,function(i){var n={from:o==t.line?t.ch:null,to:o==e.line?e.ch:null,marker:s};(i.markedSpans||(i.markedSpans=[])).push(n),s.lines.push(i),++o}),Ln.push({from:t.line,to:e.line+1}),s}function Mi(t){t=ci(t);var e=new Ci("bookmark"),i=m(t.line),n={from:t.ch,to:t.ch,marker:e};return(i.markedSpans||(i.markedSpans=[])).push(n),e.lines.push(i),e}function Ti(t){t=ci(t);var e=[],i=m(t.line).markedSpans;if(i)for(var n=0;n<i.length;++n){var s=i[n];(null==s.from||s.from<=t.ch)&&(null==s.to||s.to>=t.ch)&&e.push(s.marker)}return e}function Si(t,e,i){return"number"==typeof t&&(t=m(hi(t))),t.gutterMarker={text:e,style:i},zn=!0,t}function Ai(t){"number"==typeof t&&(t=m(hi(t))),t.gutterMarker=null,zn=!0}function Ei(t,e){var i=t,n=t;return"number"==typeof t?n=m(hi(t)):i=x(t),null==i?null:e(n,i)?(Ln.push({from:i,to:i+1}),n):null}function Fi(t,e,i){return Ei(t,function(t){return t.className!=e||t.bgClassName!=i?(t.className=e,t.bgClassName=i,!0):void 0})}function Ii(t,e){return Ei(t,function(t,i){if(t.hidden!=e){t.hidden=e,tn.lineWrapping||(e&&t.text.length==Gn.text.length?qn=!0:!e&&t.text.length>Gn.text.length&&(Gn=t,qn=!1)),C(t,e?0:1);var n=Hn.from.line,s=Hn.to.line;if(e&&(n==i||s==i)){var r=n==i?ai({line:n,ch:0},n,0):Hn.from,o=s==i?ai({line:s,ch:0},s,0):Hn.to;if(!o)return;oi(r,o)}return zn=!0}})}function Li(t){if("number"==typeof t){if(!f(t))return null;var e=t;if(t=m(t),!t)return null}else{var e=x(t);if(null==e)return null}var i=t.gutterMarker;return{line:e,handle:t,text:t.text,markerText:i&&i.text,markerClass:i&&i.style,lineClass:t.className,bgClass:t.bgClassName}}function Ni(t,e){if(0==e)return{top:0,left:0};tn.lineWrapping&&e<t.text.length&&ye.test(t.text.slice(e-1,e+1));var i=T(t,e);V(dn,i);var n=i.anchor,s=n.offsetTop,r=n.offsetLeft;if(re&&0==s&&0==r){var o=B("span","x");n.parentNode.insertBefore(o,n.nextSibling),s=o.offsetTop}return{top:s,left:r}}function $i(t,e){var i,n=Oi(),s=n*(k(Dn,t.line)-(e?Bn:0));if(0==t.ch)i=0;else{var r=Ni(m(t.line),t.ch);i=r.left,tn.lineWrapping&&(s+=Math.max(0,r.top))}return{x:i,y:s,yBot:s+n}}function zi(t,e){function i(t){var e=Ni(a,t);if(h){var i=Math.round(e.top/n);return d=i!=c,Math.max(0,e.left+(i-c)*yn.clientWidth)}return e.left}var n=Oi(),s=Hi(),r=Bn+Math.floor(e/n);if(0>r)return{line:0,ch:0};var o=w(Dn,r);if(o>=Dn.size)return{line:Dn.size-1,ch:m(Dn.size-1).text.length};var a=m(o),l=a.text,h=tn.lineWrapping,c=h?r-k(Dn,o):0;if(0>=t&&0==c)return{line:o,ch:0};for(var u,d=!1,p=0,f=0,g=l.length,v=Math.min(g,Math.ceil((t+.9*c*yn.clientWidth)/s));;){var y=i(v);if(!(t>=y&&g>v)){u=y,g=v;break}v=Math.min(g,Math.ceil(1.2*v))}if(t>u)return{line:o,ch:g};for(v=Math.floor(.8*g),y=i(v),t>y&&(p=v,f=y);;){if(1>=g-p){var b=u-t>t-f;return{line:o,ch:b?p:g,after:b}}var x=Math.ceil((p+g)/2),_=i(x);_>t?(g=x,u=_,d&&(u+=1e3)):(p=x,f=_)}}function Pi(t){var e=$i(t,!0),i=$(pn);return{x:i.left+e.x,y:i.top+e.y,yBot:i.top+e.yBot}}function Oi(){if(null==ls){ls=B("pre");for(var t=0;49>t;++t)ls.appendChild(document.createTextNode("x")),ls.appendChild(B("br"));ls.appendChild(document.createTextNode("x"))}var e=ln.clientHeight;return e==as?os:(as=e,V(dn,ls.cloneNode(!0)),os=dn.firstChild.offsetHeight/50||1,Y(dn),os)}function Hi(){if(yn.clientWidth==us)return hs;us=yn.clientWidth;var t=B("span","x"),e=B("pre",[t]);return V(dn,e),hs=t.offsetWidth||10}function Wi(){return pn.offsetTop}function ji(){return pn.offsetLeft}function Ri(t,e){var i,n,s=$(yn,!0);try{i=t.clientX,n=t.clientY}catch(t){return null}if(!e&&(i-s.left>yn.clientWidth||n-s.top>yn.clientHeight))return null;var r=$(pn,!0);return zi(i-r.left,n-r.top)}function Bi(t){function e(){if(rn.style.position="relative",sn.style.cssText=s,ae&&(an.scrollTop=n),Be(),null!=sn.selectionStart){clearTimeout(cs);var t=sn.value=" "+(W(Hn.from,Hn.to)?"":sn.value),e=0;rs=" ",sn.selectionStart=1,sn.selectionEnd=t.length,cs=setTimeout(function i(){" "==rs&&0==sn.selectionStart?Zi(ie.selectAll)(ns):e++<10?cs=setTimeout(i,500):Ue()},200)}}var i=Ri(t),n=an.scrollTop;if(i&&!ue){(W(Hn.from,Hn.to)||j(i,Hn.from)||!j(i,Hn.to))&&Zi(li)(i.line,i.ch);var s=sn.style.cssText;if(rn.style.position="absolute",sn.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Ge(),Ue(!0),W(Hn.from,Hn.to)&&(sn.value=rs=" "),se){S(t);var r=I(window,"mouseup",function(){r(),setTimeout(e,20)},!0)}else setTimeout(e,50)}}function Yi(){clearInterval(xn);var t=!0;cn.style.visibility="",xn=setInterval(function(){cn.style.visibility=(t=!t)?"":"hidden"},tn.cursorBlinkRate)}function Vi(t){function e(t,e,i){if(t.text)for(var n,s=t.styles,r=o?0:t.text.length-1,l=o?0:s.length-2,h=o?s.length:-2;l!=h;l+=2*a){var c=s[l];if(s[l+1]==d){for(var u=o?0:c.length-1,m=o?c.length:-1;u!=m;u+=a,r+=a)if(r>=e&&i>r&&f.test(n=c.charAt(u))){var g=ds[n];if(">"==g.charAt(1)==o)p.push(n);else{if(p.pop()!=g.charAt(0))return{pos:r,match:!1};if(!p.length)return{pos:r,match:!0}}}}else r+=a*c.length}}var i=Hn.inverted?Hn.from:Hn.to,n=m(i.line),s=i.ch-1,r=s>=0&&ds[n.text.charAt(s)]||ds[n.text.charAt(++s)];if(r){for(var o=(r.charAt(0),">"==r.charAt(1)),a=o?1:-1,l=n.styles,h=s+1,c=0,u=l.length;u>c;c+=2)if((h-=l[c].length)<=0){var d=l[c+1];break}for(var p=[n.text.charAt(s)],f=/[(){}[\]]/,c=i.line,u=o?Math.min(c+100,Dn.size):Math.max(-1,c-100);c!=u;c+=a){var n=m(c),g=c==i.line,v=e(n,g&&o?s+1:0,g&&!o?s:n.text.length);if(v)break}v||(v={pos:null,match:!1});var d=v.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",y=Di({line:i.line,ch:s},{line:i.line,ch:s+1},d),b=null!=v.pos&&Di({line:c,ch:v.pos},{line:c,ch:v.pos+1},d),x=Zi(function(){y.clear(),b&&b.clear()});t?setTimeout(x,800):On=x}}function Ui(t){for(var e,i,n=t,s=t-40;n>s;--n){if(0==n)return 0;var r=m(n-1);if(r.stateAfter)return n;var o=r.indentation(tn.tabSize);(null==i||e>o)&&(i=n-1,e=o)}return i}function Gi(t){var e=Ui(t),i=e&&m(e-1).stateAfter;return i=i?s(wn,i):r(wn),Dn.iter(e,t,function(n){n.process(wn,i,tn.tabSize),n.stateAfter=e==t-1||0==e%5?s(wn,i):null}),i}function qi(){if(!(Mn>=Vn)){var t=+new Date+tn.workTime,e=s(wn,Gi(Mn)),i=Mn;Dn.iter(Mn,Vn,function(i){return Mn>=Yn?(i.highlight(wn,e,tn.tabSize),i.stateAfter=s(wn,e)):(i.process(wn,e,tn.tabSize),i.stateAfter=0==Mn%5?s(wn,e):null),++Mn,+new Date>t?(Xi(tn.workDelay),!0):void 0}),Vn>i&&Mn>=Yn&&Zi(function(){Ln.push({from:i,to:Mn})})()}}function Xi(t){Vn>Mn&&Cn.set(t,qi)}function Ki(){Fn=In=Nn=null,Ln=[],$n=!1,Pn=[]}function Ji(){if(qn&&Pe(),Xn&&!tn.lineWrapping){var t=un.offsetWidth,e=Ni(Gn,Gn.text.length).left;oe||(un.style.left=e+"px",pn.style.minWidth=e+t+"px"),Xn=!1}var i,n;if($n){var s=Xe();i=Je(s.x,s.y,s.x,s.yBot)}(Ln.length||i&&null!=i.scrollTop)&&(n=Qe(Ln,!0,i&&i.scrollTop)),n||($n&&ni(),zn&&ii()),i&&qe(),$n&&Yi(),kn&&(Fn===!0||Fn!==!1&&$n)&&Ue(In),$n&&tn.matchBrackets&&setTimeout(Zi(function(){On&&(On(),On=null),W(Hn.from,Hn.to)&&Vi(!1)}),20);var r=$n,o=Pn;Nn&&tn.onChange&&ns&&tn.onChange(ns,Nn),r&&tn.onCursorActivity&&tn.onCursorActivity(ns);for(var a=0;a<o.length;++a)o[a](ns);n&&tn.onUpdate&&tn.onUpdate(ns)}function Zi(t){return function(){ps++||Ki();try{var e=t.apply(this,arguments)}finally{--ps||Ji()}return e}}function Qi(t){Zn.startCompound();try{return t()}finally{Zn.endCompound()}}var tn={},en=t.defaults;for(var nn in en)en.hasOwnProperty(nn)&&(tn[nn]=(l&&l.hasOwnProperty(nn)?l:en)[nn]);var sn=B("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em");sn.setAttribute("wrap","off"),sn.setAttribute("autocorrect","off"),sn.setAttribute("autocapitalize","off");var rn=B("div",[sn],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),on=B("div",null,"CodeMirror-scrollbar-inner"),an=B("div",[on],"CodeMirror-scrollbar"),ln=B("div"),hn=B("div",null,null,"position: relative; z-index: -1"),cn=B("pre"," ","CodeMirror-cursor"),un=B("pre"," ","CodeMirror-cursor","visibility: hidden"),dn=B("div",null,null,"position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"),pn=B("div",[dn,cn,un,hn,ln],null,"position: relative; z-index: 0"),fn=B("div",null,"CodeMirror-gutter-text"),mn=B("div",[fn],"CodeMirror-gutter"),gn=B("div",[mn,B("div",[pn],"CodeMirror-lines")],null,"position: relative"),vn=B("div",[gn],null,"position: relative"),yn=B("div",[vn],"CodeMirror-scroll");yn.setAttribute("tabIndex","-1");var bn=B("div",[rn,an,yn],"CodeMirror"+(tn.lineWrapping?" CodeMirror-wrap":""));o.appendChild?o.appendChild(bn):o(bn),ki(),_i(),K&&(sn.style.width="0px"),he||(yn.draggable=!0),pn.style.outline="none",null!=tn.tabindex&&(sn.tabIndex=tn.tabindex),tn.autofocus&&Ge(),tn.gutter||tn.lineNumbers||(mn.style.display="none"),pe&&(rn.style.height="1px",rn.style.position="absolute"),fe?(an.style.zIndex=-2,an.style.visibility="hidden"):oe&&(an.style.minWidth="18px");var xn,wn,kn,_n=new L,Cn=new L,Dn=new y([new v([new g("")])]),Mn=0;bi();var Tn,Sn,An,En,Fn,In,Ln,Nn,$n,zn,Pn,On,Hn={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},Wn=0,jn=!1,Rn=!1,Bn=0,Yn=0,Vn=0,Un=0,Gn=m(0),qn=!1,Xn=!0,Kn=!1,Jn=null;Zi(function(){N(tn.value||""),Fn=!1})();var Zn=new _;I(yn,"mousedown",Zi(ee)),I(yn,"dblclick",Zi(ce)),I(pn,"selectstart",M),se||I(yn,"contextmenu",Bi),I(yn,"scroll",Q),I(an,"scroll",Z),I(an,"mousedown",function(){kn&&setTimeout(Ge,0)});var Qn=I(window,"resize",function(){bn.parentNode?Qe(!0):Qn()},!0);I(sn,"keyup",Zi(Te)),I(sn,"input",Ye),I(sn,"keydown",Zi(De)),I(sn,"keypress",Zi(Me)),I(sn,"focus",Se),I(sn,"blur",Ae),tn.dragDrop&&(I(yn,"dragstart",me),I(yn,"dragenter",h),I(yn,"dragover",h),I(yn,"drop",Zi(de))),I(yn,"paste",function(){Ge(),Ye()}),I(sn,"paste",Ye),I(sn,"cut",Zi(function(){tn.readOnly||He("")})),pe&&I(vn,"mouseup",function(){document.activeElement==sn&&sn.blur(),Ge()});var ts;try{ts=document.activeElement==sn}catch(es){}ts||tn.autofocus?setTimeout(Se,20):Ae();var is,ns=bn.CodeMirror={getValue:U,setValue:Zi(N),getSelection:Re,replaceSelection:Zi(He),focus:function(){window.focus(),Ge(),Se(),Ye()},setOption:function(t,e){var i=tn[t];tn[t]=e,"mode"==t||"indentUnit"==t?bi():"readOnly"==t&&"nocursor"==e?(Ae(),sn.blur()):"readOnly"!=t||e?"theme"==t?ki():"lineWrapping"==t&&i!=e?Zi(wi)():"tabSize"==t?Qe(!0):"keyMap"==t&&_i():Ue(!0),("lineNumbers"==t||"gutter"==t||"firstLineNumber"==t||"theme"==t||"lineNumberFormatter"==t)&&(xi(),Qe(!0))},getOption:function(t){return tn[t]},getMode:function(){return wn},undo:Zi(Ie),redo:Zi(Le),indentLine:Zi(function(t,e){"string"!=typeof e&&(e=null==e?tn.smartIndent?"smart":"prev":e?"add":"subtract"),f(t)&&yi(t,e)}),indentSelection:Zi(vi),historySize:function(){return{undo:Zn.done.length,redo:Zn.undone.length}},clearHistory:function(){Zn=new _},setHistory:function(t){Zn=new _,Zn.done=t.done,Zn.undone=t.undone},getHistory:function(){function t(t){for(var e,i=0,n=[];i<t.length;++i){n.push(e=[]);for(var s=0,r=t[i];s<r.length;++s){var o=[],a=r[s];e.push({start:a.start,added:a.added,old:o});for(var l=0;l<a.old.length;++l)o.push(u(a.old[l]))}}return n}return{done:t(Zn.done),undone:t(Zn.undone)}},matchBrackets:Zi(function(){Vi(!0)}),getTokenAt:Zi(function(t){return t=ci(t),m(t.line).getTokenAt(wn,Gi(t.line),tn.tabSize,t.ch)}),getStateAfter:function(t){return t=hi(null==t?Dn.size-1:t),Gi(t+1)},cursorCoords:function(t,e){return null==t&&(t=Hn.inverted),this.charCoords(t?Hn.from:Hn.to,e)},charCoords:function(t,e){return t=ci(t),"local"==e?$i(t,!1):"div"==e?$i(t,!0):Pi(t)},coordsChar:function(t){var e=$(pn);return zi(t.x-e.left,t.y-e.top)},markText:Zi(Di),setBookmark:Mi,findMarksAt:Ti,setMarker:Zi(Si),clearMarker:Zi(Ai),setLineClass:Zi(Fi),hideLine:Zi(function(t){return Ii(t,!0)}),showLine:Zi(function(t){return Ii(t,!1)}),onDeleteLine:function(t,e){if("number"==typeof t){if(!f(t))return null;t=m(t)}return(t.handlers||(t.handlers=[])).push(e),t},lineInfo:Li,getViewport:function(){return{from:Yn,to:Vn}},addWidget:function(t,e,i,n,s){t=$i(ci(t));var r=t.yBot,o=t.x;if(e.style.position="absolute",vn.appendChild(e),"over"==n)r=t.y;else if("near"==n){var a=Math.max(yn.offsetHeight,Dn.height*Oi()),l=Math.max(vn.clientWidth,pn.clientWidth)-ji();t.yBot+e.offsetHeight>a&&t.y>e.offsetHeight&&(r=t.y-e.offsetHeight),o+e.offsetWidth>l&&(o=l-e.offsetWidth)}e.style.top=r+Wi()+"px",e.style.left=e.style.right="","right"==s?(o=vn.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==s?o=0:"middle"==s&&(o=(vn.clientWidth-e.offsetWidth)/2),e.style.left=o+ji()+"px"),i&&Ke(o,r,o+e.offsetWidth,r+e.offsetHeight)},lineCount:function(){return Dn.size},clipPos:ci,getCursor:function(t){return null==t&&(t=Hn.inverted),R(t?Hn.from:Hn.to)},somethingSelected:function(){return!W(Hn.from,Hn.to)},setCursor:Zi(function(t,e,i){null==e&&"number"==typeof t.line?li(t.line,t.ch,i):li(t,e,i)}),setSelection:Zi(function(t,e,i){(i?ri:oi)(ci(t),ci(e||t))}),getLine:function(t){return f(t)?m(t).text:void 0},getLineHandle:function(t){return f(t)?m(t):void 0},setLine:Zi(function(t,e){f(t)&&Oe(e,{line:t,ch:0},{line:t,ch:m(t).text.length})}),removeLine:Zi(function(t){f(t)&&Oe("",{line:t,ch:0},ci({line:t+1,ch:0}))}),replaceRange:Zi(Oe),getRange:function(t,e,i){return je(ci(t),ci(e),i)},triggerOnKeyDown:Zi(De),execCommand:function(t){return ie[t](ns)},moveH:Zi(di),deleteH:Zi(pi),moveV:Zi(fi),toggleOverwrite:function(){jn?(jn=!1,cn.className=cn.className.replace(" CodeMirror-overwrite","")):(jn=!0,cn.className+=" CodeMirror-overwrite")},posFromIndex:function(t){var e,i=0;return Dn.iter(0,Dn.size,function(n){var s=n.text.length+1;return s>t?(e=t,!0):(t-=s,++i,void 0)}),ci({line:i,ch:e})},indexFromPos:function(t){if(t.line<0||t.ch<0)return 0;var e=t.ch;return Dn.iter(0,t.line,function(t){e+=t.text.length+1}),e},scrollTo:function(t,e){null!=t&&(yn.scrollLeft=t),null!=e&&(an.scrollTop=yn.scrollTop=e),Qe([])},getScrollInfo:function(){return{x:yn.scrollLeft,y:an.scrollTop,height:an.scrollHeight,width:yn.scrollWidth}},setSize:function(t,e){function i(t){return t=String(t),/^\d+$/.test(t)?t+"px":t}null!=t&&(bn.style.width=i(t)),null!=e&&(yn.style.height=i(e)),ns.refresh()},operation:function(t){return Zi(t)()},compoundChange:function(t){return Qi(t)},refresh:function(){Qe(!0,null,Wn),an.scrollHeight>Wn&&(an.scrollTop=Wn)},getInputField:function(){return sn},getWrapperElement:function(){return bn},getScrollerElement:function(){return yn},getGutterElement:function(){return mn}},ss=null,rs="";Ci.prototype.clear=Zi(function(){for(var t=1/0,e=-1/0,i=0;i<this.lines.length;++i){var n=this.lines[i],s=a(n.markedSpans,this,!0);if(null!=s.from||null!=s.to){var r=x(n);t=Math.min(t,r),e=Math.max(e,r)}}1/0!=t&&Ln.push({from:t,to:e+1}),this.lines.length=0}),Ci.prototype.find=function(){for(var t,e,i=0;i<this.lines.length;++i){var n=this.lines[i],s=a(n.markedSpans,this);if(null!=s.from||null!=s.to){var r=x(n);null!=s.from&&(t={line:r,ch:s.from}),null!=s.to&&(e={line:r,ch:s.to})}}return"bookmark"==this.type?t:t&&{from:t,to:e}};var os,as,ls,hs,cs,us=0,ds={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},ps=0;for(var fs in te)te.propertyIsEnumerable(fs)&&!ns.propertyIsEnumerable(fs)&&(ns[fs]=te[fs]);return ns}function e(t){return"string"==typeof t?ne[t]:t}function i(t,i,n,s,r){function o(i){i=e(i);var n=i[t];if(n===!1)return r&&r(),!0;if(null!=n&&s(n))return!0;if(i.nofallthrough)return r&&r(),!0;var a=i.fallthrough;if(null==a)return!1;if("[object Array]"!=Object.prototype.toString.call(a))return o(a);for(var l=0,h=a.length;h>l;++l)if(o(a[l]))return!0;return!1}return i&&o(i)?!0:o(n)}function n(t){var e=ke[F(t,"keyCode")];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function s(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var i={};for(var n in e){var s=e[n];s instanceof Array&&(s=s.concat([])),i[n]=s}return i}function r(t,e,i){return t.startState?t.startState(e,i):!0}function o(t,e){this.pos=this.start=0,this.string=t,this.tabSize=e||8}function a(t,e,i){if(t)for(var n=0;n<t.length;++n){var s=t[n];if(s.marker==e)return i&&t.splice(n,1),s}}function l(t,e,i){if(t)for(var n,s=0;s<t.length;++s){var r=t[s],o=r.marker,a=null==r.from||(o.inclusiveLeft?r.from<=e:r.from<e);if(a||"bookmark"==o.type&&r.from==e&&r.from!=i){var l=null==r.to||(o.inclusiveRight?r.to>=e:r.to>e);(n||(n=[])).push({from:r.from,to:l?null:r.to,marker:o})}}return n}function h(t,e){if(t)for(var i,n=0;n<t.length;++n){var s=t[n],r=s.marker,o=null==s.to||(r.inclusiveRight?s.to>=e:s.to>e);if(o||"bookmark"==r.type&&s.from==e){var a=null==s.from||(r.inclusiveLeft?s.from<=e:s.from<e);(i||(i=[])).push({from:a?null:s.from-e,to:null==s.to?null:s.to-e,marker:r})}}return i}function c(t,e,i,n,s){if(!t&&!e)return s;var r=l(t,i),o=h(e,n),c=1==s.length,u=O(s).length+(c?i:0);if(r)for(var d=0;d<r.length;++d){var f=r[d];if(null==f.to){var m=a(o,f.marker);m?c&&(f.to=null==m.to?null:m.to+u):f.to=i}}if(o)for(var d=0;d<o.length;++d){var f=o[d];if(null!=f.to&&(f.to+=u),null==f.from){var m=a(r,f.marker);m||(f.from=u,c&&(r||(r=[])).push(f))}else f.from+=u,c&&(r||(r=[])).push(f)}var g=[p(s[0],r)];if(!c){var v,y=s.length-2;if(y>0&&r)for(var d=0;d<r.length;++d)null==r[d].to&&(v||(v=[])).push({from:null,to:null,marker:r[d].marker});for(var d=0;y>d;++d)g.push(p(s[d+1],v));g.push(p(O(s),o))}return g}function u(t){return"string"==typeof t?t:t.text}function d(t){return"string"==typeof t?null:t.markedSpans}function p(t,e){return e?{text:t,markedSpans:e}:t}function f(t){var e=t.markedSpans;if(e){for(var i=0;i<e.length;++i){var n=e[i].marker.lines,s=q(n,t);n.splice(s,1)}t.markedSpans=null}}function m(t,e){if(e){for(var i=0;i<e.length;++i)e[i].marker.lines.push(t);t.markedSpans=e}}function g(t,e){this.text=t,this.height=1,m(this,e)}function v(t){this.lines=t,this.parent=null;for(var e=0,i=t.length,n=0;i>e;++e)t[e].parent=this,n+=t[e].height;this.height=n}function y(t){this.children=t;for(var e=0,i=0,n=0,s=t.length;s>n;++n){var r=t[n];e+=r.chunkSize(),i+=r.height,r.parent=this}this.size=e,this.height=i,this.parent=null}function b(t,e){for(;!t.lines;)for(var i=0;;++i){var n=t.children[i],s=n.chunkSize();if(s>e){t=n;break}e-=s}return t.lines[e]}function x(t){if(null==t.parent)return null;for(var e=t.parent,i=q(e.lines,t),n=e.parent;n;e=n,n=n.parent){var s=0;for(n.children.length;n.children[s]!=e;++s)i+=n.children[s].chunkSize()}return i}function w(t,e){var i=0;t:do{for(var n=0,s=t.children.length;s>n;++n){var r=t.children[n],o=r.height;if(o>e){t=r;continue t}e-=o,i+=r.chunkSize()}return i}while(!t.lines);for(var n=0,s=t.lines.length;s>n;++n){var a=t.lines[n],l=a.height;if(l>e)break;e-=l}return i+n}function k(t,e){var i=0;t:do{for(var n=0,s=t.children.length;s>n;++n){var r=t.children[n],o=r.chunkSize();if(o>e){t=r;continue t}e-=o,i+=r.height}return i}while(!t.lines);for(var n=0;e>n;++n)i+=t.lines[n].height;return i}function _(){this.time=0,this.done=[],this.undone=[],this.compound=0,this.closed=!1}function C(){S(this)}function D(t){return t.stop||(t.stop=C),t}function M(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function T(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function S(t){M(t),T(t)}function A(t){return t.target||t.srcElement}function E(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),J&&t.ctrlKey&&1==e&&(e=3),e}function F(t,e){var i=t.override&&t.override.hasOwnProperty(e);return i?t.override[e]:t[e]}function I(t,e,i,n){if("function"==typeof t.addEventListener){if(t.addEventListener(e,i,!1),n)return function(){t.removeEventListener(e,i,!1)}}else{var s=function(t){i(t||window.event)};if(t.attachEvent("on"+e,s),n)return function(){t.detachEvent("on"+e,s)}}}function L(){this.id=null}function N(t,e,i){null==e&&(e=t.search(/[^\s\u00a0]/),-1==e&&(e=t.length));for(var n=0,s=0;e>n;++n)" "==t.charAt(n)?s+=i-s%i:++s;return s}function $(t,e){try{var i=t.getBoundingClientRect();i={top:i.top,left:i.left}}catch(n){i={top:0,left:0}}if(!e)if(null==window.pageYOffset){var s=document.documentElement||document.body.parentNode;null==s.scrollTop&&(s=document.body),i.top+=s.scrollTop,i.left+=s.scrollLeft}else i.top+=window.pageYOffset,i.left+=window.pageXOffset;return i}function z(t){return t.textContent||t.innerText||t.nodeValue||""}function P(t){for(;be.length<=t;)be.push(O(be)+" ");return be[t]}function O(t){return t[t.length-1]}function H(t){K?(t.selectionStart=0,t.selectionEnd=t.value.length):t.select()}function W(t,e){return t.line==e.line&&t.ch==e.ch}function j(t,e){return t.line<e.line||t.line==e.line&&t.ch<e.ch}function R(t){return{line:t.line,ch:t.ch}}function B(t,e,i,n){var s=document.createElement(t);if(i&&(s.className=i),n&&(s.style.cssText=n),"string"==typeof e)U(s,e);else if(e)for(var r=0;r<e.length;++r)s.appendChild(e[r]);return s}function Y(t){return t.innerHTML="",t}function V(t,e){Y(t).appendChild(e)}function U(t,e){ae?(t.innerHTML="",t.appendChild(document.createTextNode(e))):t.textContent=e}function G(t,e){if(!e)return 0;if(!t)return e.length;for(var i=t.length,n=e.length;i>=0&&n>=0&&t.charAt(i)==e.charAt(n);--i,--n);return n+1}function q(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0,n=t.length;n>i;++i)if(t[i]==e)return i;return-1}function X(t){return/\w/.test(t)||t.toUpperCase()!=t.toLowerCase()}t.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onViewportChange:null,onGutterClick:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,cursorBlinkRate:530,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null,lineNumberFormatter:function(t){return t
391
- }};var K=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),J=K||/Mac/.test(navigator.platform);/Win/.test(navigator.platform);var Z=t.modes={},Q=t.mimeModes={};t.defineMode=function(e,i){if(t.defaults.mode||"null"==e||(t.defaults.mode=e),arguments.length>2){i.dependencies=[];for(var n=2;n<arguments.length;++n)i.dependencies.push(arguments[n])}Z[e]=i},t.defineMIME=function(t,e){Q[t]=e},t.resolveMode=function(e){if("string"==typeof e&&Q.hasOwnProperty(e))e=Q[e];else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return t.resolveMode("application/xml");return"string"==typeof e?{name:e}:e||{name:"null"}},t.getMode=function(e,i){var i=t.resolveMode(i),n=Z[i.name];if(!n)return t.getMode(e,"text/plain");var s=n(e,i);if(ee.hasOwnProperty(i.name)){var r=ee[i.name];for(var o in r)r.hasOwnProperty(o)&&(s[o]=r[o])}return s.name=i.name,s},t.listModes=function(){var t=[];for(var e in Z)Z.propertyIsEnumerable(e)&&t.push(e);return t},t.listMIMEs=function(){var t=[];for(var e in Q)Q.propertyIsEnumerable(e)&&t.push({mime:e,mode:Q[e]});return t};var te=t.extensions={};t.defineExtension=function(t,e){te[t]=e};var ee=t.modeExtensions={};t.extendMode=function(t,e){var i=ee.hasOwnProperty(t)?ee[t]:ee[t]={};for(var n in e)e.hasOwnProperty(n)&&(i[n]=e[n])};var ie=t.commands={selectAll:function(t){t.setSelection({line:0,ch:0},{line:t.lineCount()-1})},killLine:function(t){var e=t.getCursor(!0),i=t.getCursor(!1),n=!W(e,i);n||t.getLine(e.line).length!=e.ch?t.replaceRange("",e,n?i:{line:e.line}):t.replaceRange("",e,{line:e.line+1,ch:0})},deleteLine:function(t){var e=t.getCursor().line;t.replaceRange("",{line:e,ch:0},{line:e})},undo:function(t){t.undo()},redo:function(t){t.redo()},goDocStart:function(t){t.setCursor(0,0,!0)},goDocEnd:function(t){t.setSelection({line:t.lineCount()-1},null,!0)},goLineStart:function(t){t.setCursor(t.getCursor().line,0,!0)},goLineStartSmart:function(t){var e=t.getCursor(),i=t.getLine(e.line),n=Math.max(0,i.search(/\S/));t.setCursor(e.line,e.ch<=n&&e.ch?0:n,!0)},goLineEnd:function(t){t.setSelection({line:t.getCursor().line},null,!0)},goLineUp:function(t){t.moveV(-1,"line")},goLineDown:function(t){t.moveV(1,"line")},goPageUp:function(t){t.moveV(-1,"page")},goPageDown:function(t){t.moveV(1,"page")},goCharLeft:function(t){t.moveH(-1,"char")},goCharRight:function(t){t.moveH(1,"char")},goColumnLeft:function(t){t.moveH(-1,"column")},goColumnRight:function(t){t.moveH(1,"column")},goWordLeft:function(t){t.moveH(-1,"word")},goWordRight:function(t){t.moveH(1,"word")},delCharLeft:function(t){t.deleteH(-1,"char")},delCharRight:function(t){t.deleteH(1,"char")},delWordLeft:function(t){t.deleteH(-1,"word")},delWordRight:function(t){t.deleteH(1,"word")},indentAuto:function(t){t.indentSelection("smart")},indentMore:function(t){t.indentSelection("add")},indentLess:function(t){t.indentSelection("subtract")},insertTab:function(t){t.replaceSelection(" ","end")},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.replaceSelection(" ","end")},transposeChars:function(t){var e=t.getCursor(),i=t.getLine(e.line);e.ch>0&&e.ch<i.length-1&&t.replaceRange(i.charAt(e.ch)+i.charAt(e.ch-1),{line:e.line,ch:e.ch-1},{line:e.line,ch:e.ch+1})},newlineAndIndent:function(t){t.replaceSelection("\n","end"),t.indentLine(t.getCursor().line)},toggleOverwrite:function(t){t.toggleOverwrite()}},ne=t.keyMap={};ne.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},ne.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},ne.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]},ne["default"]=J?ne.macDefault:ne.pcDefault,ne.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},t.fromTextArea=function(e,i){function n(){e.value=l.getValue()}if(i||(i={}),i.value=e.value,!i.tabindex&&e.tabindex&&(i.tabindex=e.tabindex),null==i.autofocus){var s=document.body;try{s=document.activeElement}catch(r){}i.autofocus=s==e||null!=e.getAttribute("autofocus")&&s==document.body}if(e.form){var o=I(e.form,"submit",n,!0);if("function"==typeof e.form.submit){var a=e.form.submit;e.form.submit=function h(){n(),e.form.submit=a,e.form.submit(),e.form.submit=h}}}e.style.display="none";var l=t(function(t){e.parentNode.insertBefore(t,e.nextSibling)},i);return l.save=n,l.getTextArea=function(){return e},l.toTextArea=function(){n(),e.parentNode.removeChild(l.getWrapperElement()),e.style.display="",e.form&&(o(),"function"==typeof e.form.submit&&(e.form.submit=a))},l};var se=/gecko\/\d{7}/i.test(navigator.userAgent),re=/MSIE \d/.test(navigator.userAgent),oe=/MSIE [1-7]\b/.test(navigator.userAgent),ae=/MSIE [1-8]\b/.test(navigator.userAgent),le=re&&5==document.documentMode,he=/WebKit\//.test(navigator.userAgent),ce=/Chrome\//.test(navigator.userAgent),ue=/Opera\//.test(navigator.userAgent),de=/Apple Computer/.test(navigator.vendor),pe=/KHTML\//.test(navigator.userAgent),fe=/Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);t.copyState=s,t.startState=r,t.innerMode=function(t,e){for(;t.innerMode;){var i=t.innerMode(e);e=i.state,t=i.mode}return i||{mode:t,state:e}},o.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t)var i=e==t;else var i=e&&(t.test?t.test(e):t(e));return i?(++this.pos,e):void 0},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);return e>-1?(this.pos=e,!0):void 0},backUp:function(t){this.pos-=t},column:function(){return N(this.string,this.start,this.tabSize)},indentation:function(){return N(this.string,null,this.tabSize)},match:function(t,e,i){if("string"!=typeof t){var n=this.string.slice(this.pos).match(t);return n&&n.index>0?null:(n&&e!==!1&&(this.pos+=n[0].length),n)}var s=function(t){return i?t.toLowerCase():t};return s(this.string).indexOf(s(t),this.pos)==this.pos?(e!==!1&&(this.pos+=t.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},t.StringStream=o;var me=" ";se||re&&!oe?me="​":ue&&(me=""),g.prototype={update:function(t,e){this.text=t,this.stateAfter=this.styles=null,f(this),m(this,e)},highlight:function(t,e,i){var n=new o(this.text,i),s=this.styles||(this.styles=[]),r=s.length=0;for(""==this.text&&t.blankLine&&t.blankLine(e);!n.eol();){var a=t.token(n,e),l=n.current();if(n.start=n.pos,r&&s[r-1]==a?s[r-2]+=l:l&&(s[r++]=l,s[r++]=a),n.pos>5e3){s[r++]=this.text.slice(n.pos),s[r++]=null;break}}},process:function(t,e,i){var n=new o(this.text,i);for(""==this.text&&t.blankLine&&t.blankLine(e);!n.eol()&&n.pos<=5e3;)t.token(n,e),n.start=n.pos},getTokenAt:function(t,e,i,n){for(var s=this.text,r=new o(s,i);r.pos<n&&!r.eol();){r.start=r.pos;var a=t.token(r,e)}return{start:r.start,end:r.pos,string:r.current(),className:a||null,state:e}},indentation:function(t){return N(this.text,null,t)},getContent:function(t,e,i){function n(e,i,n){if(i){if(r&&re&&" "==i.charAt(0)&&(i=" "+i.slice(1)),r=!1,a.test(i))for(var s=document.createDocumentFragment(),l=0;;){a.lastIndex=l;var h=a.exec(i),c=h?h.index-l:i.length-l;if(c&&(s.appendChild(document.createTextNode(i.slice(l,l+c))),o+=c),!h)break;if(l+=c+1," "==h[0]){var u=t-o%t;s.appendChild(B("span",P(u),"cm-tab")),o+=u}else{var d=B("span","•","cm-invalidchar");d.title="\\u"+h[0].charCodeAt(0).toString(16),s.appendChild(d),o+=1}}else{o+=i.length;var s=document.createTextNode(i)}n?e.appendChild(B("span",[s],n)):e.appendChild(s)}}function s(t){return t?"cm-"+t.replace(/ +/g," cm-"):null}var r=!0,o=0,a=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g,l=B("pre"),h=n;if(null!=e){var c=0,u=l.anchor=B("span");h=function(t,s,r){var o=s.length;if(e>=c&&c+o>e){e>c&&(n(t,s.slice(0,e-c),r),i&&t.appendChild(B("wbr"))),t.appendChild(u);var a=e-c;n(u,ue?s.slice(a,a+1):s.slice(a),r),ue&&n(t,s.slice(a+1),r),e--,c+=o}else c+=o,n(t,s,r),c==e&&c==m?(U(u,me),t.appendChild(u)):c>e+10&&/\s/.test(s)&&(h=function(){})}}var d=this.styles,p=this.text,f=this.markedSpans,m=p.length;if(p||null!=e)if(f&&f.length){f.sort(function(t,e){return t.from-e.from});for(var g,v=0,y=0,b="",x=f[0].from||0,w=[],k=0,_=function(){for(var t;k<f.length&&((t=f[k]).from==v||null==t.from);)"range"==t.marker.type&&w.push(t),++k;x=k<f.length?f[k].from:1/0;for(var e=0;e<w.length;++e){var i=w[e].to;null==i&&(i=1/0),i==v?w.splice(e--,1):x=Math.min(i,x)}};m>v;){x==v&&_();for(var C=Math.min(m,x);;){if(b){for(var D=v+b.length,M=g,T=0;T<w.length;++T){var S=w[T];M=(M?M+" ":"")+S.marker.style,S.marker.endStyle&&S.to===Math.min(D,C)&&(M+=" "+S.marker.endStyle),S.marker.startStyle&&S.from===v&&(M+=" "+S.marker.startStyle)}if(h(l,D>C?b.slice(0,C-v):b,M),D>=C){b=b.slice(C-v),v=C;break}v=D}b=d[y++],g=s(d[y++])}}}else for(var y=0,A=0;m>A;y+=2){var E=d[y],g=d[y+1],F=E.length;A+F>m&&(E=E.slice(0,m-A)),A+=F,h(l,E,s(g))}else h(l," ");return l},cleanUp:function(){this.parent=null,f(this)}},v.prototype={chunkSize:function(){return this.lines.length},remove:function(t,e,i){for(var n=t,s=t+e;s>n;++n){var r=this.lines[n];if(this.height-=r.height,r.cleanUp(),r.handlers)for(var o=0;o<r.handlers.length;++o)i.push(r.handlers[o])}this.lines.splice(t,e)},collapse:function(t){t.splice.apply(t,[t.length,0].concat(this.lines))},insertHeight:function(t,e,i){this.height+=i,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var n=0,s=e.length;s>n;++n)e[n].parent=this},iterN:function(t,e,i){for(var n=t+e;n>t;++t)if(i(this.lines[t]))return!0}},y.prototype={chunkSize:function(){return this.size},remove:function(t,e,i){this.size-=e;for(var n=0;n<this.children.length;++n){var s=this.children[n],r=s.chunkSize();if(r>t){var o=Math.min(e,r-t),a=s.height;if(s.remove(t,o,i),this.height-=a-s.height,r==o&&(this.children.splice(n--,1),s.parent=null),0==(e-=o))break;t=0}else t-=r}if(this.size-e<25){var l=[];this.collapse(l),this.children=[new v(l)],this.children[0].parent=this}},collapse:function(t){for(var e=0,i=this.children.length;i>e;++e)this.children[e].collapse(t)},insert:function(t,e){for(var i=0,n=0,s=e.length;s>n;++n)i+=e[n].height;this.insertHeight(t,e,i)},insertHeight:function(t,e,i){this.size+=e.length,this.height+=i;for(var n=0,s=this.children.length;s>n;++n){var r=this.children[n],o=r.chunkSize();if(o>=t){if(r.insertHeight(t,e,i),r.lines&&r.lines.length>50){for(;r.lines.length>50;){var a=r.lines.splice(r.lines.length-25,25),l=new v(a);r.height-=l.height,this.children.splice(n+1,0,l),l.parent=this}this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),i=new y(e);if(t.parent){t.size-=i.size,t.height-=i.height;var n=q(t.parent.children,t);t.parent.children.splice(n+1,0,i)}else{var s=new y(t.children);s.parent=t,t.children=[s,i],t=s}i.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iter:function(t,e,i){this.iterN(t,e-t,i)},iterN:function(t,e,i){for(var n=0,s=this.children.length;s>n;++n){var r=this.children[n],o=r.chunkSize();if(o>t){var a=Math.min(e,o-t);if(r.iterN(t,a,i))return!0;if(0==(e-=a))break;t=0}else t-=o}}},_.prototype={addChange:function(t,e,i){this.undone.length=0;var n=+new Date,s=O(this.done),r=s&&O(s),o=n-this.time;if(this.compound&&s&&!this.closed)s.push({start:t,added:e,old:i});else if(o>400||!r||this.closed||r.start>t+i.length||r.start+r.added<t)this.done.push([{start:t,added:e,old:i}]),this.closed=!1;else{for(var a=Math.max(0,r.start-t),l=Math.max(0,t+i.length-(r.start+r.added)),h=a;h>0;--h)r.old.unshift(i[h-1]);for(var h=l;h>0;--h)r.old.push(i[i.length-h]);a&&(r.start=t),r.added+=e-(i.length-a-l)}this.time=n},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}},t.e_stop=S,t.e_preventDefault=M,t.e_stopPropagation=T,t.connect=I,L.prototype={set:function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)}};var ge=t.Pass={toString:function(){return"CodeMirror.Pass"}},ve=function(){if(ae)return!1;var t=B("div");return"draggable"in t||"dragDrop"in t}();!function(){var t=B("textarea");return t.value="foo\nbar",t.value.indexOf("\r")>-1?"\r\n":"\n"}();var ye=/^$/;se?ye=/$'/:de?ye=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:ce&&(ye=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var be=[""],xe=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,i=[],n=t.length;n>=e;){var s=t.indexOf("\n",e);-1==s&&(s=t.length);var r=t.slice(e,"\r"==t.charAt(s-1)?s-1:s),o=r.indexOf("\r");-1!=o?(i.push(r.slice(0,o)),e+=o+1):(i.push(r),e=s+1)}return i}:function(t){return t.split(/\r\n?|\n/)};t.splitLines=xe;var we=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(i){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1};t.defineMode("null",function(){return{token:function(t){t.skipToEnd()}}}),t.defineMIME("text/plain","null");var ke={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return t.keyNames=ke,function(){for(var t=0;10>t;t++)ke[t+48]=String(t);for(var t=65;90>=t;t++)ke[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)ke[t+111]=ke[t+63235]="F"+t}(),t.version="2.34",t}(),define("codemirror",function(t){return function(){var e;return e||t.CodeMirror}}(this)),CodeMirror.defineMode("ruby",function(t){function e(t){for(var e={},i=0,n=t.length;n>i;++i)e[t[i]]=!0;return e}function i(t,e,i){return i.tokenize.push(t),t(e,i)}function n(t,e){if(l=null,t.sol()&&t.match("=begin")&&t.eol())return e.tokenize.push(a),"comment";if(t.eatSpace())return null;var n,s=t.next();if("`"==s||"'"==s||'"'==s||"/"==s&&!t.eol()&&" "!=t.peek())return i(r(s,"string",'"'==s||"`"==s),t,e);if("%"==s){var h,c=!1;t.eat("s")?h="atom":t.eat(/[WQ]/)?(h="string",c=!0):t.eat(/[wxqr]/)&&(h="string");var u=t.eat(/[^\w\s]/);return u?(d.propertyIsEnumerable(u)&&(u=d[u]),i(r(u,h,c,!0),t,e)):"operator"}if("#"==s)return t.skipToEnd(),"comment";if("<"==s&&(n=t.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return i(o(n[1]),t,e);if("0"==s)return t.eat("x")?t.eatWhile(/[\da-fA-F]/):t.eat("b")?t.eatWhile(/[01]/):t.eatWhile(/[0-7]/),"number";if(/\d/.test(s))return t.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==s){for(;t.match(/^\\[CM]-/););return t.eat("\\")?t.eatWhile(/\w/):t.next(),"string"}return":"==s?t.eat("'")?i(r("'","atom",!1),t,e):t.eat('"')?i(r('"',"atom",!0),t,e):(t.eatWhile(/[\w\?]/),"atom"):"@"==s?(t.eat("@"),t.eatWhile(/[\w\?]/),"variable-2"):"$"==s?(t.next(),t.eatWhile(/[\w\?]/),"variable-3"):/\w/.test(s)?(t.eatWhile(/[\w\?]/),t.eat(":")?"atom":"ident"):"|"!=s||!e.varList&&"{"!=e.lastTok&&"do"!=e.lastTok?/[\(\)\[\]{}\\;]/.test(s)?(l=s,null):"-"==s&&t.eat(">")?"arrow":/[=+\-\/*:\.^%<>~|]/.test(s)?(t.eatWhile(/[=+\-\/*:\.^%<>~|]/),"operator"):null:(l="|",null)}function s(){var t=1;return function(e,i){if("}"==e.peek()){if(t--,0==t)return i.tokenize.pop(),i.tokenize[i.tokenize.length-1](e,i)}else"{"==e.peek()&&t++;return n(e,i)}}function r(t,e,i,n){return function(r,o){for(var a,l=!1;null!=(a=r.next());){if(a==t&&(n||!l)){o.tokenize.pop();break}if(i&&"#"==a&&!l&&r.eat("{")){o.tokenize.push(s(arguments.callee));break}l=!l&&"\\"==a}return e}}function o(t){return function(e,i){return e.match(t)?i.tokenize.pop():e.skipToEnd(),"string"}}function a(t,e){return t.sol()&&t.match("=end")&&t.eol()&&e.tokenize.pop(),t.skipToEnd(),"comment"}var l,h=e(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload"]),c=e(["def","class","case","for","while","do","module","then","catch","loop","proc","begin"]),u=e(["end","until"]),d={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-t.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(t,e){t.sol()&&(e.indented=t.indentation());var i,n=e.tokenize[e.tokenize.length-1](t,e);if("ident"==n){var s=t.current();n=h.propertyIsEnumerable(t.current())?"keyword":/^[A-Z]/.test(s)?"tag":"def"==e.lastTok||"class"==e.lastTok||e.varList?"def":"variable",c.propertyIsEnumerable(s)?i="indent":u.propertyIsEnumerable(s)?i="dedent":"if"!=s&&"unless"!=s||t.column()!=t.indentation()||(i="indent")}return(l||n&&"comment"!=n)&&(e.lastTok=s||l||n),"|"==l&&(e.varList=!e.varList),"indent"==i||/[\(\[\{]/.test(l)?e.context={prev:e.context,type:l||n,indented:e.indented}:("dedent"==i||/[\)\]\}]/.test(l))&&e.context.prev&&(e.context=e.context.prev),t.eol()&&(e.continuedLine="\\"==l||"operator"==n),n},indent:function(e,i){if(e.tokenize[e.tokenize.length-1]!=n)return 0;var s=i&&i.charAt(0),r=e.context,o=r.type==d[s]||"keyword"==r.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(i);return r.indented+(o?0:t.indentUnit)+(e.continuedLine?t.indentUnit:0)},electricChars:"}de"}}),CodeMirror.defineMIME("text/x-ruby","ruby"),define("codemirror-ruby",["codemirror"],function(){}),function(t){t.extend(t.fn,{validate:function(e){if(this.length){var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(e=this.find("input, button"),e.filter(".cancel").click(function(){i.cancelSubmit=!0}),i.settings.submitHandler&&e.filter(":submit").click(function(){i.submitButton=this}),this.submit(function(e){function n(){if(i.settings.submitHandler){if(i.submitButton)var e=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(i.submitButton.value).appendTo(i.currentForm);return i.settings.submitHandler.call(i,i.currentForm),i.submitButton&&e.remove(),!1}return!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,n()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):n():(i.focusInvalid(),!1)})),i)}e&&e.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e&=i.element(this)}),e},removeAttrs:function(e){var i={},n=this;return t.each(e.split(/\s/),function(t,e){i[e]=n.attr(e),n.removeAttr(e)}),i},rules:function(e,i){var n=this[0];if(e){var s=t.data(n.form,"validator").settings,r=s.rules,o=t.validator.staticRules(n);switch(e){case"add":t.extend(o,t.validator.normalizeRule(i)),r[n.name]=o,i.messages&&(s.messages[n.name]=t.extend(s.messages[n.name],i.messages));break;case"remove":if(!i)return delete r[n.name],o;var a={};return t.each(i.split(/\s/),function(t,e){a[e]=o[e],delete o[e]}),a}}return n=t.validator.normalizeRules(t.extend({},t.validator.metadataRules(n),t.validator.classRules(n),t.validator.attributeRules(n),t.validator.staticRules(n)),n),n.required&&(s=n.required,delete n.required,n=t.extend({required:s},n)),n}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+e.value)},filled:function(e){return!!t.trim(""+e.value)},unchecked:function(t){return!t.checked}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1==arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!=Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!=Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),i)}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t){(t.name in this.submitted||t==this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,n){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(n):t(e).addClass(i).removeClass(n)},unhighlight:function(e,i,n){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(n):t(e).removeClass(i).addClass(n)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),n="on"+e.type.replace(/^validate/,"");i.settings[n]&&i.settings[n].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,n){t.each(n.split(/\s/),function(t,n){i[n]=e})});var n=this.settings.rules;t.each(n,function(e,i){n[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){this.lastElement=e=this.validationTargetFor(this.clean(e)),this.prepareElement(e),this.currentElements=t(e);var i=this.check(e);return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e,i=0;for(e in t)i++;return i},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0==this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1==t.grep(this.errorList,function(t){return t.element.name==e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:i[this.name]=!0})},clean:function(e){return t(e)[0]},errors:function(){return t(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},check:function(e){e=this.validationTargetFor(this.clean(e));var i,n=t(e).rules(),s=!1;for(i in n){var r={method:i,parameters:n[i]};try{var o=t.validator.methods[i].call(this,e.value.replace(/\r/g,""),e,r.parameters);if("dependency-mismatch"==o)s=!0;else{if(s=!1,"pending"==o)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!o)return this.formatAndAdd(e,r),!1}}catch(a){throw this.settings.debug&&window.console&&console.log("exception occured when checking element "+e.id+", check the '"+r.method+"' method",a),a}}return s?void 0:(this.objectLength(n)&&this.successList.push(e),!0)},customMetaMessage:function(e,i){if(t.metadata){var n=this.settings.meta?t(e).metadata()[this.settings.meta]:t(e).metadata();return n&&n.messages&&n.messages[i]}},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor==String?i:i[e])},findDefined:function(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customMetaMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(t,e){var i=this.defaultMessage(t,e.method),n=/\$?\{(\d+)\}/g;"function"==typeof i?i=i.call(this,e.parameters,t):n.test(i)&&(i=jQuery.format(i.replace(n,"{$1}"),e.parameters)),this.errorList.push({message:i,element:t}),this.errorMap[t.name]=i,this.submitted[t.name]=i},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){for(var t=0;this.errorList[t];t++){var e=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,e.element,this.settings.errorClass,this.settings.validClass),this.showLabel(e.element,e.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var n=this.errorsFor(e);n.length?(n.removeClass(this.settings.validClass).addClass(this.settings.errorClass),n.attr("generated")&&n.html(i)):(n=t("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(e),generated:!0}).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(n=n.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(n).length||(this.settings.errorPlacement?this.settings.errorPlacement(n,t(e)):n.insertAfter(e))),!i&&this.settings.success&&(n.text(""),"string"==typeof this.settings.success?n.addClass(this.settings.success):this.settings.success(n)),this.toShow=this.toShow.add(n)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")==i})},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){var i=this.currentForm;return t(document.getElementsByName(e)).map(function(t,n){return n.form==i&&n.name==e&&n||null})},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){return!t.validator.methods.required.call(this,t.trim(e.value),e)&&"dependency-mismatch"
392
- },startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[e.name],i&&0==this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0==this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},dateDE:{dateDE:!0},number:{number:!0},numberDE:{numberDE:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor==String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={};return(e=t(e).attr("class"))&&t.each(e.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={};e=t(e);for(var n in t.validator.methods){var s;(s="required"===n&&"function"==typeof t.fn.prop?e.prop(n):e.attr(n))?i[n]=s:e[0].getAttribute("type")===n&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},metadataRules:function(e){if(!t.metadata)return{};var i=t.data(e.form,"validator").settings.meta;return i?t(e).metadata()[i]:t(e).metadata()},staticRules:function(e){var i={},n=t.data(e.form,"validator");return n.settings.rules&&(i=t.validator.normalizeRule(n.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(n,s){if(s===!1)delete e[n];else if(s.param||s.depends){var r=!0;switch(typeof s.depends){case"string":r=!!t(s.depends,i.form).length;break;case"function":r=s.depends.call(i,i)}r?e[n]=void 0!==s.param?s.param:!0:delete e[n]}}),t.each(e,function(n,s){e[n]=t.isFunction(s)?s(i):s}),t.each(["minlength","maxlength","min","max"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){e[this]&&(e[this]=[Number(e[this][0]),Number(e[this][1])])}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e.messages&&delete e.messages,e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,n){t.validator.methods[e]=i,t.validator.messages[e]=void 0!=n?n:t.validator.messages[e],i.length<3&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,n){if(!this.depend(n,i))return"dependency-mismatch";switch(i.nodeName.toLowerCase()){case"select":return(e=t(i).val())&&e.length>0;case"input":if(this.checkable(i))return this.getLength(e,i)>0;default:return t.trim(e).length>0}},remote:function(e,i,n){if(this.optional(i))return"dependency-mismatch";var s=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),s.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=s.message,n="string"==typeof n&&{url:n}||n,this.pending[i.name])return"pending";if(s.old===e)return s.valid;s.old=e;var r=this;this.startRequest(i);var o={};return o[i.name]=e,t.ajax(t.extend(!0,{url:n,mode:"abort",port:"validate"+i.name,dataType:"json",data:o,success:function(n){r.settings.messages[i.name].remote=s.originalMessage;var o=n===!0;if(o){var a=r.formSubmitted;r.prepareElement(i),r.formSubmitted=a,r.successList.push(i),r.showErrors()}else a={},n=n||r.defaultMessage(i,"remote"),a[i.name]=s.message=t.isFunction(n)?n(e):n,r.showErrors(a);s.valid=o,r.stopRequest(i,o)}},n)),"pending"},minlength:function(e,i,n){return this.optional(i)||this.getLength(t.trim(e),i)>=n},maxlength:function(e,i,n){return this.optional(i)||this.getLength(t.trim(e),i)<=n},rangelength:function(e,i,n){return e=this.getLength(t.trim(e),i),this.optional(i)||e>=n[0]&&e<=n[1]},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&t<=i[1]},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 -]+/.test(t))return!1;var i=0,n=0,s=!1;t=t.replace(/\D/g,"");for(var r=t.length-1;r>=0;r--)n=t.charAt(r),n=parseInt(n,10),s&&(n*=2)>9&&(n-=9),i+=n,s=!s;return 0==i%10},accept:function(t,e,i){return i="string"==typeof i?i.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(e)||t.match(RegExp(".("+i+")$","i"))},equalTo:function(e,i,n){return n=t(n).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e==n.val()}}}),t.format=t.validator.format}(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,n){i=t.port,"abort"==t.mode&&(e[i]&&e[i].abort(),e[i]=n)});else{var i=t.ajax;t.ajax=function(n){var s=("port"in n?n:t.ajaxSettings).port;return"abort"==("mode"in n?n:t.ajaxSettings).mode?(e[s]&&e[s].abort(),e[s]=i.apply(this,arguments)):i.apply(this,arguments)}}}(jQuery),function(t){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&t.each({focus:"focusin",blur:"focusout"},function(e,i){function n(e){return e=t.event.fix(e),e.type=i,t.event.handle.call(this,e)}t.event.special[i]={setup:function(){this.addEventListener(e,n,!0)},teardown:function(){this.removeEventListener(e,n,!0)},handler:function(e){return arguments[0]=t.event.fix(e),arguments[0].type=i,t.event.handle.apply(this,arguments)}}}),t.extend(t.fn,{validateDelegate:function(e,i,n){return this.bind(i,function(i){var s=t(i.target);return s.is(e)?n.apply(s,arguments):void 0})}})}(jQuery),define("jquery-validate",["jquery"],function(){}),!function(t){var e=function(t){this.messages={defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",urlstrict:"This value should be a valid url.",number:"This value should be a valid number.",digits:"This value should be digits.",dateIso:"This value should be a valid date (YYYY-MM-DD).",alphanum:"This value should be alphanumeric."},notnull:"This value should not be null.",notblank:"This value should not be blank.",required:"This value is required.",regexp:"This value seems to be invalid.",min:"This value should be greater than %s.",max:"This value should be lower than %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or less.",rangelength:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or less.",rangecheck:"You must select between %s and %s choices.",equalto:"This value should be the same."},this.init(t)};e.prototype={constructor:e,validators:{notnull:function(t){return 0<t.length},notblank:function(t){return null!==t&&""!==t.replace(/^\s+/g,"").replace(/\s+$/g,"")},required:function(t){if("object"==typeof t){for(var e in t)if(this.required(t[e]))return!0;return!1}return this.notnull(t)&&this.notblank(t)},type:function(t,e){var i;switch(e){case"number":i=/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/;break;case"digits":i=/^\d+$/;break;case"alphanum":i=/^\w+$/;break;case"email":i=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;break;case"url":t=/(https?|s?ftp|git)/i.test(t)?t:"http://"+t;case"urlstrict":i=/^(https?|s?ftp|git):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;break;case"dateIso":i=/^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$/;break;default:return!1}return""!==t?i.test(t):!1},regexp:function(t,e){return RegExp(e,"i").test(t)},minlength:function(t,e){return t.length>=e},maxlength:function(t,e){return t.length<=e},rangelength:function(t,e){return this.minlength(t,e[0])&&this.maxlength(t,e[1])},min:function(t,e){return Number(t)>=e},max:function(t,e){return Number(t)<=e},range:function(t,e){return t>=e[0]&&t<=e[1]},equalto:function(e,i){return e===t(i).val()},remote:function(e,i,n){var s={},r={};s[n.$element.attr("name")]=e,"undefined"!=typeof n.options.remoteDatatype&&(r={dataType:n.options.remoteDatatype});var o=function(t){n.updateConstraint("remote","isValid",t),n.manageValidationResult()};return t.ajax(t.extend({},{url:i,data:s,async:n.async,method:n.options.remoteMethod||"GET",success:function(t){o("1"===t||"true"==t||"object"==typeof t&&"undefined"!=typeof t.success||/success/i.test(t))},error:function(){o(!1)}},r)),n.async&&o(null),null},mincheck:function(t,e){return this.minlength(t,e)},maxcheck:function(t,e){return this.maxlength(t,e)},rangecheck:function(t,e){return this.rangelength(t,e)}},init:function(t){var e=t.validators;t=t.messages;for(var i in e)this.addValidator(i,e[i]);for(i in t)this.addMessage(i,t[i])},formatMesssage:function(t,e){if("object"==typeof e){for(var i in e)t=this.formatMesssage(t,e[i]);return t}return t.replace(/%s/i,e)},addValidator:function(t,e){this.validators[t]=e},addMessage:function(t,e,i){if("undefined"!=typeof i&&!0===i)this.messages.type[t]=e;else if("type"===t)for(var n in e)this.messages.type[n]=e[n];else this.messages[t]=e}};var i=function(t,i,n){this.options=i,this.Validator=new e(i),this.init(t,n||"ParsleyField")};i.prototype={constructor:i,init:function(e,i){this.type=i,this.isValid=!0,this.element=e,this.validatedOnce=!1,this.$element=t(e),this.val=this.$element.val(),this.isRequired=!1,this.constraints=[],"undefined"==typeof this.isRadioOrCheckbox&&(this.isRadioOrCheckbox=!1,this.hash=this.generateHash(),this.errorClassHandler=this.options.errors.classHandler(e)||this.$element),this.ulErrorManagement(),this.bindHtml5Constraints(),this.addConstraints(),this.constraints.length&&this.bindValidationEvents()},bindHtml5Constraints:function(){(this.$element.hasClass("required")||this.$element.attr("required"))&&(this.options.required=!0),"undefined"!=typeof this.$element.attr("type")&&RegExp(this.$element.attr("type"),"i").test("email url number range")&&(this.options.type=this.$element.attr("type"),RegExp(this.options.type,"i").test("number range")&&(this.options.type="number","undefined"!=typeof this.$element.attr("min")&&this.$element.attr("min").length&&(this.options.min=this.$element.attr("min")),"undefined"!=typeof this.$element.attr("max")&&this.$element.attr("max").length&&(this.options.max=this.$element.attr("max"))))},addConstraints:function(){for(var t in this.options)t=t.toLowerCase(),"function"==typeof this.Validator.validators[t]&&(this.constraints.push({name:t,requirements:this.options[t],isValid:null}),"required"===t&&(this.isRequired=!0),this.addCustomConstraintMessage(t))},addCustomConstraintMessage:function(t){var e=t+("type"===t?this.options[t].charAt(0).toUpperCase()+this.options[t].substr(1):"")+"Message";"undefined"!=typeof this.options[e]&&this.Validator.addMessage("type"===t?this.options[t]:t,this.options[e],"type"===t)},bindValidationEvents:function(){this.$element.addClass("parsley-validated");var e=this.options.trigger+(/key/i.test(this.options.trigger)?"":" keyup");this.options.remote&&(e+=/change/i.test(e)?"":" change"),e&&this.$element.on((e+" ").split(" ").join("."+this.type+" "),!1,t.proxy(this.eventValidation,this))},generateHash:function(){return"parsley-"+(Math.random()+"").substring(2)},getHash:function(){return this.hash},getVal:function(){return this.$element.val()},eventValidation:function(t){var e=this.getVal();return"keyup"===t.type&&!/keyup/i.test(this.options.trigger)&&!this.validatedOnce||e.length<this.options.validationMinlength&&!this.validatedOnce?!0:(this.validate(!0,!1),void 0)},isFieldValid:function(){return this.validate(!1,!1)},validate:function(t,e){var i=this.getVal(),n=null;return this.options.listeners.onFieldValidate(this.element,this)||""===i&&!this.isRequired?(this.reset(),null):this.needsValidation(i)?(this.errorBubbling="undefined"!=typeof t?t:!0,this.async="undefined"!=typeof e?e:!0,n=this.applyValidators(),this.errorBubbling&&this.manageValidationResult(),n):this.isValid},needsValidation:function(t){return null!==this.isValid&&this.val===t&&this.validatedOnce?!1:(this.val=t,this.validatedOnce=!0)},applyValidators:function(){for(var t=null,e=0;e<this.constraints.length;e++){var i=this.Validator.validators[this.constraints[e].name](this.val,this.constraints[e].requirements,this);!1===i?(t=!1,this.constraints[e].isValid=t):!0===i&&(this.constraints[e].isValid=!0,t=!1!==t)}return t},updateConstraint:function(t,e,i){for(var n=0;n<this.constraints.length;n++)if(this.constraints[n].name===t){this.constraints[n][e]=i;break}},manageValidationResult:function(){for(var t=null,e=0;e<this.constraints.length;e++)!1===this.constraints[e].isValid?(this.addError(this.constraints[e]),t=!1):!0===this.constraints[e].isValid&&(this.removeError(this.constraints[e].name),t=!1!==t);return this.isValid=t,!0===this.isValid?(this.removeErrors(),this.errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass),this.options.listeners.onFieldSuccess(this.element,this.constraints,this),!0):!1===this.isValid?(this.errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass),this.options.listeners.onFieldError(this.element,this.constraints,this),!1):t},ulErrorManagement:function(){this.ulError="#"+this.hash,this.ulTemplate=t(this.options.errors.errorsWrapper).attr("id",this.hash).addClass("parsley-error-list")},removeError:function(e){e=this.ulError+" ."+e,this.ulError&&t(e).remove()&&0===t(this.ulError).children().length&&t(this.ulError).remove()},removeErrors:function(){t(this.ulError).remove()},reset:function(){return this.isValid=null,this.removeErrors(),this.errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass),this},addError:function(e){t(this.ulError).length||this.options.errors.container(this.element,this.ulTemplate,this.isRadioOrCheckbox)||(this.isRadioOrCheckbox?this.$element.parent().after(this.ulTemplate):this.$element.after(this.ulTemplate));var i=e.name,n=!1!==this.options.errorMessage?"custom-error-message":i,s=this.ulError+" ."+n,n=t(this.options.errors.errorElem).addClass(n);e=!1!==this.options.errorMessage?this.options.errorMessage:"type"===e.name?this.Validator.messages[i][e.requirements]:"undefined"==typeof this.Validator.messages[i]?this.Validator.messages.defaultMessage:this.Validator.formatMesssage(this.Validator.messages[i],e.requirements),t(s).length||t(this.ulError).append(t(n).text(e))},addListener:function(t){for(var e in t)this.options.listeners[e]=t[e]},destroy:function(){this.$element.removeClass("parsley-validated"),this.reset().$element.off("."+this.type).removeData(this.type)}};var n=function(t,e){this.initMultiple(t,e),this.inherit(t,e),this.init(t,e)};n.prototype={constructor:n,initMultiple:function(e,i){this.element=e,this.$element=t(e),this.hash=this.getName(),this.isRadioOrCheckbox=!0,this.isRadio=this.$element.is("input[type=radio]"),this.isCheckbox=this.$element.is("input[type=checkbox]"),this.siblings='input[name="'+this.$element.attr("name")+'"]',this.$siblings=t(this.siblings),this.errorClassHandler=i.errors.classHandler(e)||this.$element.parent()},inherit:function(t,e){var n,s=new i(t,e);for(n in s)"undefined"==typeof this[n]&&(this[n]=s[n])},getName:function(){return"parsley-"+this.$element.attr("name").replace(/(:|\.|\[|\])/g,"")},getVal:function(){if(this.isRadio)return t(this.siblings+":checked").val()||"";if(this.isCheckbox){var e=[];return t(this.siblings+":checked").each(function(){e.push(t(this).val())}),e}}};var s=function(t,e){this.init("parsleyForm",t,e)};s.prototype={constructor:s,init:function(e,i,n){this.type=e,this.items=[],this.$element=t(i),this.options=n;var s,r=this;this.$element.find(n.inputs).each(function(){s=t(this).parsley(n),null!==s&&r.items.push(s)}),this.$element.on("submit."+this.type,!1,t.proxy(this.validate,this))},addListener:function(t){for(var e in t)if(/Field/.test(e))for(var i=0;i<this.items.length;i++)this.items[i].addListener(t);else this.options.listeners[e]=t[e]},validate:function(t){var e=!0;this.focusedField=!1;for(var i=0;i<this.items.length;i++)!1===this.items[i].validate()&&(e=!1,!this.focusedField&&"first"===this.options.focus||"last"===this.options.focus)&&(this.focusedField=this.items[i].$element);return this.focusedField&&!e&&this.focusedField.focus(),this.options.listeners.onFormSubmit(e,t,this),e},removeErrors:function(){for(var t=0;t<this.items.length;t++)this.items[t].parsley("reset")},destroy:function(){for(var t=0;t<this.items.length;t++)this.items[t].destroy();this.$element.off("."+this.type).removeData(this.type)}},t.fn.parsley=function(e,r){function o(o,l){var h=t(o).data(l);if(!h){switch(l){case"parsleyForm":h=new s(o,a);break;case"parsleyField":h=new i(o,a);break;case"parsleyFieldMultiple":h=new n(o,a);break;default:return}t(o).data(l,h)}return"string"==typeof e&&"function"==typeof h[e]?h[e](r):h}var a=t.extend(!0,{},t.fn.parsley.defaults,"undefined"!=typeof window.ParsleyConfig?window.ParsleyConfig:{},e,this.data()),l=null;return t(this).is("form")?l=o(t(this),"parsleyForm"):t(this).is(a.inputs)&&!t(this).is(a.excluded)&&(l=o(t(this),t(this).is("input[type=radio], input[type=checkbox]")?"parsleyFieldMultiple":"parsleyField")),"function"==typeof r?r():l},t.fn.parsley.Constructor=s,t.fn.parsley.defaults={inputs:"input, textarea, select",excluded:"input[type=hidden], :disabled",trigger:!1,focus:"first",validationMinlength:3,successClass:"parsley-success",errorClass:"parsley-error",errorMessage:!1,validators:{},messages:{},errors:{classHandler:function(){},container:function(){},errorsWrapper:"<ul></ul>",errorElem:"<li></li>"},listeners:{onFieldValidate:function(){return!1},onFormSubmit:function(){},onFieldError:function(){},onFieldSuccess:function(){}}},t(window).on("load",function(){t('[data-validate="parsley"]').each(function(){t(this).parsley()})})}(window.jQuery||window.Zepto),define("parsley",["jquery"],function(){}),define("view/addmonitor",["view/base","model/monitor","codemirror","codemirror-ruby","jquery-validate","parsley"],function(t,e,i){var n=t.extend({scheduleViewInitialized:!1,metricsViewInitialized:!1,scheduleView:!0,el:".add-monitor-wrap",subscriptions:{"view:dashboard:category":"updateDashboardId","view:settings:save":"render"},events:{"click .setMetrics":"advanceToMetrics","click .testGraph":"testMetrics","click .nameSchedule":"backToSchedule","click .saveFinish":"saveFinish","click .back":"exitFullScreen","hide #addMonitor":"modalClose","show #addMonitor":"modalShow","shown #addMonitor":"focusFirst"},initialize:function(t){_.bindAll(this),this.user=t.user,this.dashboardId=t.dashboardId,this.templar=t.templar;var e=_.debounce(this.adjustModalLayout,500);$(window).resize(e),this.render()},render:function(){this.setElement($(".add-monitor-wrap")),this.templar.render({path:"addmonitor",el:this.$el,data:{}}),this.templar.render({path:"schedulemonitor",el:this.$el.find(".content-wrap"),data:{user:this.user.toJSON()}}),this.scheduleViewInitialized=!0,this.setScheduleValidation(),this.$modal=this.$el.find(".add-monitor"),this.resizeModal($("#addMonitor"),"large")},updateDashboardId:function(t){this.dashboardId=t,this.model.set({dashboardId:this.dashboardId})},adjustModalLayout:function(){var t=$("#addMonitor"),e=this.resizeModal(t,"large"),i=325,n=80,s=150,r=80;if(!this.scheduleView){var o=e.body.height-n>i?e.body.height-n:i;t.find(".hero-unit").css({height:o});var a=Math.floor((o-s)/2);this.expressionsMirror.setSize(null,a),this.metricsMirror.setSize(null,a);var l=Math.floor((o-r)/2);t.find(".graph").css({height:l}),this.chart.setSize(null,l),t.find("#outputView").css({height:l})}},advanceToMetrics:function(){this.scheduleForm.parsley("validate")},backToSchedule:function(){this._setupScheduleView()},exitFullScreen:function(){var t=this.$el.find("button.close"),e=this.$el.find("button.back"),i=$(".add-monitor .metrics .CodeMirror"),n=$(".add-monitor .expressions .CodeMirror");t.show(),e.hide(),i.removeClass("fullscreen"),i.data("beforeFullscreen")&&(i.height(i.data("beforeFullscreen").height),i.width(i.data("beforeFullscreen").width)),this.metricsMirror.refresh(),n.removeClass("fullscreen"),n.data("beforeFullscreen")&&(n.height(n.data("beforeFullscreen").height),n.width(n.data("beforeFullscreen").width)),this.expressionsMirror.refresh()},setScheduleValidation:function(){this.scheduleForm=$("#namePagerForm"),this.scheduleForm.parsley({listeners:{onFormSubmit:function(t){t&&(this._setSchedule(),this._setupMetricsView())}.bind(this)}})},setMetricsValidation:function(){$.validator.addMethod("code",function(t,e){var i=$(e).data("CodeMirror");return $(i.getWrapperElement()),this._validateMirror(i)}.bind(this),"This field is required."),$.validator.addMethod("metric-ruby",function(){var t=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(e){"success"==e.status&&(t=!0)}}),t},"Your metrics code does not validate."),$.validator.addMethod("expression-ruby",function(t){var e=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(i){("success"==i.status||""==t)&&(e=!0)}}),e}.bind(this),"Your expression code does not validate."),this.metricsForm=$("#metricsExpressionsForm"),this.metricsForm.validate({rules:{inputMetrics:{code:!0,"expression-ruby":!0},inputExpressions:{"expression-ruby":!0}},errorPlacement:function(t,e){var i=$(e).data("CodeMirror");if(i){var n=$(i.getWrapperElement());this._validateMirror(i),t.insertAfter(n)}else t.insertAfter(e)}.bind(this),highlight:function(t){$(t).closest(".control-group").addClass("error"),$(t).closest("fieldset").addClass("error")},success:function(t){$(t).closest(".control-group").removeClass("error"),$(t).closest("fieldset").removeClass("error"),$(t).remove()},submitHandler:function(){this._saveMonitor(function(){this._closeModal()}.bind(this))}.bind(this)})},testMetrics:function(){this._setMetrics(),$.post("/monitor.json",this.model.toJSON(),function(t){if(t.graph_data){var e=this.formatGraphData(t.graph_data);this.renderGraphData(this.chart,e),$("#outputView").val(t.output)}"error"===t.status&&Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:t.errors,raw:t.output,attention:"Monitor Test Error!",status:"error"})}.bind(this)).error(function(t){Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:t.errors,raw:t.output,attention:"Monitor Test Error!",status:"error"})}.bind(this))},modalClose:function(t){$(t.target).hasClass("add-monitor")&&(t.stopPropagation(),this.metricsViewInitialized&&(this.backToSchedule(),this.metricsViewInitialized=!1),Backbone.Mediator.pub("view:addmonitor:close"))},modalShow:function(){Backbone.Mediator.pub("view:addmonitor:show")},resize:function(){return _.debounce(this.adjustModalLayout,500)},saveFinish:function(){this._setMetrics(),$("#inputMetrics").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),$("#inputExpressions").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),this.metricsForm.submit()},setHelp:function(){var t="";$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(e){t=e}});var e=this.$el.find(".help");e.tooltip({container:".expressions-metrics",trigger:"manual",html:!0,placement:"right",delay:{show:100,hide:200},title:t}).click(function(t){t.stopPropagation(),$(this).tooltip("toggle")})},destructor:function(){this.metricsViewInitialized=!1,this.scheduleViewInitialized=!1,this.metricsMonitorFooter=null,this.scheduleMonitorBody=null,this.scheduleMonitorFooter=null;var t=this.$el.prev();this.$template&&this.$template.off(),this.remove(),this.off(),$("<section class='add-monitor-wrap'></section>").insertAfter(t)},_closeModal:function(){this.$modal.modal("hide")},_getTemplateMetaData:function(t){$.ajax({url:rearview.path+"/monitors/index.json",success:function(e){"function"==typeof t&&t(e)}})},_initCodeMirror:function(){var t=this.$el.find("#inputExpressions")[0],e=".add-monitor .expressions .CodeMirror",n=this.$el.find("#inputMetrics")[0],s=".add-monitor .metrics .CodeMirror",r=this.$el.find("button.close"),o=this.$el.find("button.back");this.expressionsMirror=i.fromTextArea(t,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(t,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),this._toggleFullscreen(e,this.expressionsMirror,r,o)):void 0}.bind(this)}),$(t).data("CodeMirror",this.expressionsMirror),this.metricsMirror=i.fromTextArea(n,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(t,e){return 70==e.keyCode&&e.ctrlKey&&"keydown"==e.type?(e.stop(),this._toggleFullscreen(s,this.metricsMirror,r,o)):void 0}.bind(this)}),$(n).data("CodeMirror",this.metricsMirror)},_initDatePicker:function(){this.fromDatePicker=$("#fromDatePicker").datetimepicker()},_setTemplateSelect:function(t){this.$template=this.$el.find("#selectTemplate"),this.$template.data("template",t),this.$template.on("change",function(){var t=this.$template.data("template");if(this.selectedIndex>0){var e=this.selectedIndex-1,i=t[e];i.path&&$.ajax({url:i.path,success:function(t){i.metrics&&i.metrics.length>0&&this.metricsMirror.setValue(i.metrics.join("\n")),this.expressionsMirror.setValue(t)}.bind(this)})}}.bind(this))},_setSchedule:function(){this.model.set({userId:this.user.get("id"),name:this.$el.find("#monitorName").val(),description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find("#pagerDuty").val()),cronExpr:this._createCronExpr()})},_setMetrics:function(){this.model.set({userId:this.user.get("id"),monitorExpr:this.expressionsMirror.getValue(),metrics:this.metricsMirror.getValue().split("\n"),minutes:parseInt(this.$el.find("#minutesBack").val()),toDate:this.$el.find("#fromDatePicker").val()})},_setupScheduleView:function(){this.metricsMonitorBody=$(".add-monitor .modal-body").detach(),this.metricsMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.scheduleMonitorBody),$(".add-monitor").append(this.scheduleMonitorFooter),this.scheduleView=!0,this.adjustModalLayout()},_setupMetricsView:function(){var t=$(".add-monitor");this.metricsViewInitialized?(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.metricsMonitorBody),$(".add-monitor").append(this.metricsMonitorFooter)):(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),this._getTemplateMetaData(function(e){this.templar.render({path:"setmetrics",el:t,append:!0,data:{monitor:{templates:e}}}),this._setTemplateSelect(e),this._initCodeMirror(),this._initDatePicker(),this.initGraph(t.find(".graph")[0]),this.setHelp(),this.setMetricsValidation(),this.metricsViewInitialized=!0,this.scheduleView=!1,this.adjustModalLayout()}.bind(this)))},_saveMonitor:function(t){this._setMetrics(),this.model.save({id:null,userId:this.user.get("id")},{success:function(i){"function"==typeof t&&t(),Backbone.Mediator.pub("view:addmonitor:save",{model:i,message:"The monitor '"+i.get("name")+"' was added.",attention:"Monitor Saved!",status:"success"}),this.model=new e
393
- }.bind(this),error:function(t,e){Backbone.Mediator.pub("view:addmonitor:save",{model:t,tryJSON:e.responseText,attention:"Monitor Save Error!",status:"error"})}})}});return n}),define("collection/monitor",["jquery","underscore","backbone","model/monitor"],function(t,e,i,n){var s=i.Collection.extend({model:n,url:function(){return this.dashboardId?"/dashboards/"+this.dashboardId+"/jobs.json":"/jobs.json"},initialize:function(t,i){e.bindAll(this,"url"),this.dashboardId=i.dashboardId,this.cb=i.cb,this.fetch({success:function(t){this.cb&&this.cb(t)}.bind(this),async:!1})},filterById:function(t){var i=[];return e.each(t,function(t){e.isUndefined(this.get(t))||i.push(t)},this),this.reset(e.map(i,function(t){return this.get(t)},this))}});return s}),define("view/smallmonitor",["view/base"],function(t){var e=t.extend({el:".small-monitor",events:{"click .header-name":"editMonitor","click .settings .btn":"monitorSettings","click .save":"monitorSettings","click .monitor-inactive":"deactivateMonitor","click .monitor-active":"activateMonitor","click button.reset":"resetMonitor"},initialize:function(t){_.bindAll(this,"editMonitor","expandMonitor","monitorTitle","monitorSettings","deactivateMonitor","activateMonitor","resetMonitor","setupDrag"),this.templar=t.templar,this.user=t.user?t.user:null,this.dashboardId=t.dashboardId?t.dashboardId:null,this.addHelpers(),this.intervalLength=t.intervalLength?t.intervalLength:60,Backbone.Mediator.sub("controller:dashboard:init",this.expandMonitor,this);var e=_.debounce(this.monitorTitle,500);$(window).resize(e)},render:function(){return this.templar.render({path:"smallmonitor",el:this.$el,append:!0,data:{monitor:this.model.toJSON()}}),this.initMonitor(),this},initMonitor:function(){this.$el.data("view",this),this.$monitor=this.$el.find("#smallMonitor"+this.model.get("id")),this.$wrap=this.$monitor.parent(),this.$graph=this.$monitor.find(".graph")[0],this.$monitor.find("h1").tooltip(),this.chart=this.initGraph(this.$graph),this.updateGraph(),this.interval=setInterval(function(){this.updateGraph(!0)}.bind(this),1e3*this.intervalLength),this.setupDrag()},setupDrag:function(){this.$monitor.draggable({handle:this.$el.find(".drag-handle"),containment:"body",snap:".small-monitor-drag",snapMode:"inner",snapTolerance:30,appendTo:".monitor-wrap",scroll:!0,revert:"invalid",start:function(t,e){var i=e.helper;e.offset,i.draggable("option","revert",!0),$("body").removeAttr("style"),i.parent().css({"z-index":"9999"}),this.currentOrder=this.getMonitorOrder()}.bind(this),stop:function(t,e){var i=e.helper,n=(e.offset,i.attr("id")),s=!0;i.parent().css({"z-index":"1"}),$(".small-monitor").each(function(t,e){var r=$(e).attr("id");n!==r&&this.overlaps(i,e)&&(this.setorder(i.parent(),$(e).parent(),!0),i.css({left:0,top:0}),s=!1)}.bind(this)),s&&i.css({left:0,top:0})}.bind(this),drag:function(t,e){e.helper,e.offset}.bind(this)})},setorder:function(t,e,i){t=$(t),e=$(e),i=!!i;var n=(t.parent(),e.parent()),s=n.attr("data-order"),r=this.currentOrder?this.currentOrder:this.getMonitorOrder(),o=t.data("view"),a=o.model.get("id"),l=_.indexOf(r,a);r.splice(l,1),r.splice(s,0,a),this.currentOrder=r,this.reorder(),i&&this.setDashboardPreferences()},updateGraph:function(t){var e=!1;t?t&&this.model.get("active")&&(e=!0):e=!0,e&&(this.errorState=!0,this.showOverlay(this.$graph,"Loading...","small-monitor-overlay"),$.ajax({url:"/jobs/"+this.model.get("id")+"/data",success:function(t){"error"===t.status?(this.hideOverlay(),_.isEmpty(t.graph_data)?this.showOverlay(this.$graph,"Monitor Error - No Data","small-monitor-error-overlay"):this.showOverlay(this.$graph,"Monitor Error","small-monitor-error-overlay"),this._setErrorState()):"failed"===t.status?(this.hideOverlay(),this.formattedGraphData=this.formatGraphData(t.graph_data),this.renderGraphData(this.chart,this.formattedGraphData),this._setErrorState(),this.model.set("output",t.output)):"graphite_error"===t.status?(this.hideOverlay(),this.showOverlay(this.$graph,"Graphite Error","small-monitor-error-overlay"),this._setErrorState()):"graphite_metric_error"===t.status?(this.hideOverlay(),this.showOverlay(this.$graph,"Graphite Metrics Error","small-monitor-error-overlay"),this._setErrorState()):t.graph_data?(this.hideOverlay(),this.errorState=!1,this.formattedGraphData=this.formatGraphData(t.graph_data),this.renderGraphData(this.chart,this.formattedGraphData),this.model.set("output",t.output),this._setErrorState(!0)):(this.hideOverlay(),this.showOverlay(this.$graph,"Unexpected Error","small-monitor-error-overlay"),this._setErrorState())}.bind(this),error:function(){this.hideOverlay(),this.showOverlay(this.$graph,"Waiting For Next Run","small-monitor-error-overlay")}.bind(this)}))},deactivateMonitor:function(t){$(t.target).hasClass("active")||this.model.save({active:!1},{error:function(t){Backbone.Mediator.pub("view:smallmonitor:save",{model:this.model,message:"The monitor '"+t.get("name")+"' caused an error on deactivation, please check your monitor code.",attention:"Monitor Deactivate Error!",status:"error"})}})},activateMonitor:function(t){$(t.target).hasClass("active")||this.model.save({active:!0},{error:function(){Backbone.Mediator.pub("view:smallmonitor:save",{model:this.model,message:"The monitor '"+this.model.get("name")+"' caused an error on activation, please check your monitor code.",attention:"Monitor Activate Error!",status:"error"})}.bind(this)})},resetMonitor:function(){this.$monitor.find("#resetMonitor").toggle("show"),Backbone.Mediator.pub("view:smallmonitor:reset",{model:this.model})},expandMonitor:function(t){t.monitorId==this.model.get("id")&&this.editMonitor()},editMonitor:function(){Backbone.Mediator.pub("view:smallmonitor:edit",this.model.get("id"),this)},monitorSettings:function(){this.$monitor.toggleClass("flipped")},monitorTitle:function(){var t=140,e=this.$monitor.width();this.$header=this.$monitor.find(".header-name"),this.$titleText=this.$monitor.find(".header-name p"),this.$header.css("width",e-t),this.$titleText.width()>this.$header.width()?this.$header.addClass("truncated"):this.$header.removeClass("truncated")},nextRun:function(){this.hideOverlay(),this.showOverlay(this.$graph,"Waiting For Next Run","small-monitor-error-overlay")},reorder:function(){var t=$(".dashboard-"+this.model.get("dashboardId")+" .small-monitor-drag");t.each(function(t,e){$(e).prepend($("#smallMonitor"+this.currentOrder[t]).parent())}.bind(this))},setDashboardPreferences:function(){var t=this.user.get("preferences")?this.user.get("preferences"):{},e=t&&t.dashboards?t.dashboards:{};e[this.model.get("dashboardId")]={order:this.currentOrder},t.dashboards=e,this.user.updatePrefs(t)},getMonitorOrder:function(){var t=$(".dashboard-"+this.model.get("dashboardId")+" .small-monitor-wrap"),e=[];return t.each(function(t,i){var n=$(i).data("view");e.push(n.model.get("id"))}),e},destructor:function(){clearInterval(this.interval),this.model.unbind(),this.unbind(),this.off(),this.undelegateEvents(),Backbone.Mediator.unsubscribe("view:smallmonitor:edit",this.editMonitor),Backbone.Mediator.unsubscribe("controller:dashboard:init",this.expandMonitor,this),this.remove(),this.$el.remove()},_setErrorState:function(t){t?this.$el.children(":first").removeClass("red"):this.$el.children(":first").addClass("red")}});return e}),define("view/deletemonitor",["view/base"],function(t){var e=t.extend({events:{"click button.cancel":"closeModal","click button.delete":"delete"},initialize:function(t){var e=this;e.templar=t.templar,e.render()},render:function(){var t=this;t.templar.render({path:"deletemonitor",el:t.$el,data:{}}),t.modalEl=t.$el.find(".delete-monitor"),t.resizeModal($("#deleteMonitor"),"small",!0)},"delete":function(){var t=this;t.closeModal(),Backbone.Mediator.pub("view:deletemonitor:delete")},closeModal:function(){var t=this;t.modalEl.modal("hide")},destructor:function(){var t=this,e=t.$el.prev();t.remove(),t.unbind(),t.onDestruct&&t.onDestruct(),t.$el=$("<section class='delete-monitor-wrap'></section>").insertAfter(e)}});return e}),define("view/expandedmonitor",["view/base","view/deletemonitor","model/monitor"],function(t,e,i){var n=t.extend({events:{"click .name-save":"updateMonitorName","click .schedule-tab":"_setExpandedViewHeight","change #selectPreviousError":"_setErrorDropDown"},subscriptions:{"view:dashboard:init":"exit","view:deletemonitor:delete":"deleteMonitor"},initialize:function(t){_.bindAll(this),this.user=t.user,this.router=t.router,this.templar=t.templar,this.deleteMonitorView=new e({el:$(".delete-monitor-wrap"),templar:this.templar});var i=_.debounce(this._setExpandedViewHeight,500);$(window).resize(i)},render:function(t,e,i,n){this.monitorId=t,this.categories=e,this.categoryId=i,this.dashboardId=n,this.initMonitor()},initMonitor:function(){var t=this;t.getMonitor(t.monitorId,function(e){t.model=e,_.bind(t.updateMonitor,t,t.model),_.each(t.categories,function(e){e.selected=e.id===t.model.get("dashboardId")?!0:!1}),t.getGraphData(t.monitorId,function(){t._initErrorsList(function(e){t.templar.render({path:"expandedmonitor",el:t.$el,data:{monitor:t.model.toJSON(),errors:e,alerts:e,output:t.model.get("output"),categories:t.categories}}),t.$monitor=t.$el.find(".expanded-monitor"),t.$el.html(t.$monitor),t._setAlertsHistory(),t.chart=t.initGraph(t.$monitor.find(".graph")[0]),t._setErrorState(),t.updateGraph(t.model,function(e){t._initializeCodeMirror(),t._initializeDatePicker(".input-from-date"),t._setErrorDropDown(),t._setScheduleData(),t._setEditNameField(),t.$el.find(".save-changes").click({model:t.model},t.updateMonitor),t.$el.find(".cancel-changes").click(function(){t.exit()}),t.$el.find(".test-in-graph button").click({model:new i,output:e},t.testMonitor,t),t.open()},t.formattedGraphData),t.setHelp(),t._setExpandedViewHeight()},t.model)})})},getGraphData:function(t,e){var i=this;$.ajax({url:"/jobs/"+t+"/data",success:function(t){t.graph_data&&(i.formattedGraphData=i.formatGraphData(t.graph_data)),_.isUndefined(e)||e(t)},error:function(t){_.isUndefined(e)||e(t)}})},getMonitor:function(t,e){var n=this;n.model=new i({id:t}),n.model.fetch({success:function(t){_.isUndefined(e)||e(t)}})},getErrorStatus:function(t){var e=!1;switch(t){case"error":e=!0;break;case"failed":e=!0;break;case"graphite_error":e=!0;break;case"graphite_metric_error":e=!0;break;case"security_error":e=!0}return e},setHelp:function(){var t=this,e="";$alertContent="",$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(t){e=t}}),$.ajax({url:rearview.path+"/help/alert.html",async:!1,success:function(t){$alertContent=t}}),t.$el.find(".help:nth-child(2)").tooltip({trigger:"click",html:!0,placement:"right",delay:{show:100,hide:200},title:e}),t.$el.find(".help:nth-child(1)").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$alertContent})},open:function(){this.$el.addClass("active"),Backbone.Mediator.pub("view:expandedmonitor:open",{nav:{back:!0}}),this.router.navigate("dash/"+this.dashboardId+"/expand/"+this.model.get("id"))},exit:function(t){var e=this;e.$el.removeClass("active"),e.model&&e.router.navigate("dash/"+e.model.get("dashboardId")),Backbone.Mediator.pub("view:expandedmonitor:exit",{status:"delete"})},updateGraph:function(t,e,i){var n=this;i?(n.renderGraphData(n.chart,i),"function"==typeof e&&e()):$.ajax({url:"/monitor.json",type:"POST",data:t.toJSON(),success:function(t){if(t.graph_data){var i=n.formatGraphData(t.graph_data);n.renderGraphData(n.chart,i),n.$el.find("textarea.output-view").val(t.output)}"error"===t.status&&Backbone.Mediator.pub("view:expandedmonitor:test",{model:this.model,errors:t.errors,raw:t.output,attention:"Monitor Test Error!",status:"error"}),"function"==typeof e&&e(t.output)},failure:function(){}})},testMonitor:function(t){var e=this,i=t.data.model,n=t.data.output,s=$(t.target);s.button("loading"),i=e._setMetrics(i),i=e._setSchedule(i),e.$el.find("textarea.output-view").val(n),e.$el.find(".output-tab").tab("show"),e.updateGraph(i,function(){s.button("reset")})},viewErrorInGraph:function(t){var e=this,i=t.data.model,n=t.data.output,s=t.data.toDate;i.set("toDate",s),i=e._setMetrics(i,!0),i=e._setSchedule(i),e.$el.find("textarea.output-view").val(n),e.$el.find(".output-tab").tab("show"),e.updateGraph(i)},updateMonitor:function(t){var e=this,i=t.data.model;t.data.test,t.data.toDate,t.data.output,i=e._setMetrics(i),i=e._setSchedule(i),i=e._setSettings(i),i.save(null,{success:function(t){Backbone.Mediator.pub("view:expandedmonitor:save",{model:e.model,message:"The monitor '"+t.get("name")+"' was saved.",attention:"Monitor Saved!",status:"success"}),e.exit(i),e.updateGraph(i)},error:function(t,i){Backbone.Mediator.pub("view:expandedmonitor:save",{model:e.model,tryJSON:i.responseText,attention:"Monitor Saved Error!",status:"error"})}})},deleteMonitor:function(){var t=this;t.model.destroy({success:function(e){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:t.model,message:"The monitor '"+e.get("name")+"' was removed from the current dashboard.",attention:"Monitor Deleted!"})},error:function(e){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:t.model,message:"The monitor '"+e.get("name")+"' produced an error during the process of deletion.",attention:"Monitor Delete Error!",status:"error"})}}),t.exit()},updateMonitorName:function(){var t=this,e=t.$el.find(".name-field");e.prev().html(),t.model.set({name:e.find("input").val()}),e.prev().html(t.model.get("name")),e.hide(),e.prev().show()},resize:function(){var t=this;return _.debounce(t._setExpandedViewHeight,500)},destructor:function(){var t=this,e=t.$el.prev();t.deleteMonitorView.destructor(),t.destroySubscriptions(),t.remove(),t.unbind(),t.off(),e.after("<div class='edit-monitor-wrap clearfix'>")},_setExpandedViewHeight:function(){var t=580,e=6,i=4,n=this.$el.find("#viewMetrics")?this.$el.find("#viewMetrics").height():null;n&&this.$el.find("#viewSchedule, #viewSettings").css({height:n+"px"}),this.$el.find(".output-view").css({height:$(window).height()-t-i+"px"}),this.$el.find(".alerts-history ul").css({height:$(window).height()-t-e+"px"}),this.$el.find(".graph").css({height:$(window).height()-t+"px"});var s=$(window).height()-t>150?$(window).height()-t:150;this.chart&&s>150&&this.chart.setSize(null,s)},_setErrorState:function(){var t=this.getErrorStatus(this.model.get("status"));t?this.$monitor.addClass("red"):this.$monitor.removeClass("red")},_initErrorsList:function(t){var e=this,i=e.model.get("id");$.get("/jobs/"+i+"/errors",function(i){i=_.map(i,function(t){return{label:e.formatServerDateTime(t.date,!0).toString("MM/dd/yyyy HH:mm"),value:t.date,message:t.message,id:t.id}}),t(i)})},_setErrorDropDown:function(){var t=this,e=this.$el.find("#selectPreviousError");if(""!==e.find("option:selected").val()){var i=e.find("option:selected").html();t.fromDatePicker.datetimepicker("setDate",i)}},_setEditNameField:function(){var t=this,e=t.$el.find(".name-field");e.prev().click(function(){e.prev().hide(),e.show(),e.find("input").focus()})},_initializeCodeMirror:function(){var t=this,e=t.$el.find("#inputExpressions")[0],i=t.$el.find("#inputMetrics")[0];t.expressionsMirror=CodeMirror.fromTextArea(e,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(e,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),t._toggleFullscreen(".expanded-monitor .expressions .CodeMirror",t.expressionsMirror)):void 0}}),t.metricsMirror=CodeMirror.fromTextArea(i,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(e,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),t._toggleFullscreen(".expanded-monitor .metrics .CodeMirror",t.metricsMirror)):void 0}})},_initializeDatePicker:function(t){var e=this;e.fromDatePicker=e.$el.find(t).datetimepicker()},_setScheduleData:function(){var t=this,e=t.model.get("cronExpr").split(" ");t.$el.find("#inputSeconds").val(e[0]),t.$el.find("#inputMinutes").val(e[1]),t.$el.find("#inputHours").val(e[2]),t.$el.find("#inputDays").val(e[3]);var i=e[4].split(","),n=e[5].split(",");t._setButtonGroup(t.$el.find(".day-picker button"),n),t._setButtonGroup(t.$el.find(".month-picker button"),i)},_setButtonGroup:function(t,e){t.each(function(t,i){i=$(i);var n=_.indexOf(e,i.attr("data-value"));n>-1&&i.addClass("active")})},_setMetrics:function(t,e){var i=this;return t.set({userId:i.user.get("id"),monitorExpr:i.expressionsMirror.getValue(),metrics:i.metricsMirror.getValue().split("\n"),minutes:parseInt(i.$el.find(".input-minutes-back").val()),toDate:e?t.get("toDate"):i.$el.find(".input-from-date").val()}),t},_setSchedule:function(t){var e=this.$el.find(".monitor-name")[0]?this.$el.find(".monitor-name").val():t.get("name");return t.set({userId:this.user.get("id"),name:e,description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find(".pager-duty textarea").val()),cronExpr:this._createCronExpr()}),t},_setSettings:function(t){return t.set({dashboardId:parseInt(this.$el.find("#selectCategory").val(),10)}),t},_setAlertsHistory:function(){var t=this;t.$monitor.find(".alerts-history ul").delegate("li button","click",function(e){t.viewErrorInGraph({data:{model:new i,test:!0,toDate:$(e.target).attr("data-date")}}),t.fromDatePicker.datetimepicker("setDate",$(e.target).attr("data-date"))})}});return n}),define("view/resetmonitor",["view/base"],function(t){var e=t.extend({subscriptions:{"view:smallmonitor:reset":"setCurrentMonitor"},events:{"click button.cancel":"closeModal","click button.reset":"resetMonitor"},initialize:function(t){_.bindAll(this,"setCurrentMonitor","resetMonitor","closeModal"),this.templar=t.templar,this.render()},render:function(){this.templar.render({path:"resetmonitor",el:this.$el,data:{}}),this.$modal=this.$el.find(".reset-monitor"),this.resizeModal($("#resetMonitor"),"small",!0)},setCurrentMonitor:function(t){this.model=t.model},resetMonitor:function(){this.closeModal(),$.ajax({url:"/jobs/"+this.model.get("id")+"/reset.json",type:"post",data:{_method:"PUT"},success:function(){Backbone.Mediator.pub("view:resetmonitor:reset",{model:this.model,message:"The '"+this.model.get("name")+"' monitor's history and data were reset.",attention:"Monitor Reset Successful!"})}.bind(this),error:function(){Backbone.Mediator.pub("view:resetmonitor:reset",{model:this.model,message:"The monitor '"+this.model.get("name")+"' caused an error on reset, please check your monitor code.",attention:"Monitor Activate Error!",status:"error"})}.bind(this)})},closeModal:function(){this.$modal.modal("hide")},destructor:function(){var t=this.$el.prev();this.destroySubscriptions(),this.remove(),this.unbind(),this.onDestruct&&this.onDestruct(),this.$el=$("<section class='reset-monitor-wrap'></section>").insertAfter(t)}});return e}),function(t){"function"==typeof define&&define.amd?define("timeline",t):t()}(function(){var t=function(e){this.dom={},this.conversion={},this.eventParams={},this.groups=[],this.groupIndexes={},this.items=[],this.selection=void 0,this.listeners={},this.size={actualHeight:0,axis:{characterMajorHeight:0,characterMajorWidth:0,characterMinorHeight:0,characterMinorWidth:0,height:0,labelMajorTop:0,labelMinorTop:0,line:0,lineMajorWidth:0,lineMinorHeight:0,lineMinorTop:0,lineMinorWidth:0,top:0},contentHeight:0,contentLeft:0,contentWidth:0,dataChanged:!1,frameHeight:0,frameWidth:0,groupsLeft:0,groupsWidth:0,items:{top:0}},this.dom.container=e,this.options={utc:!1,width:"100%",height:"auto",minHeight:0,autoHeight:!0,eventMargin:10,eventMarginAxis:20,dragAreaWidth:10,min:void 0,max:void 0,intervalMin:10,intervalMax:31536e10,moveable:!0,zoomable:!0,selectable:!0,editable:!1,snapEvents:!0,groupChangeable:!0,showCurrentTime:!0,showCustomTime:!1,showMajorLabels:!0,showNavigation:!0,showButtonAdd:!0,groupsOnRight:!1,axisOnTop:!1,stackEvents:!0,animate:!0,animateZoom:!0,style:"box"},this.clientTimeOffset=3600;for(var i=this.dom;i.container.hasChildNodes();)i.container.removeChild(i.container.firstChild);this.step=new t.StepDate(this.options),this.data=[],this.firstDraw=!0,this.setVisibleChartRange(void 0,void 0,!1),this.redrawFrame(),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){for(var e=0;e<this.length;e++)if(this[e]==t)return e;return-1}),this.trigger("ready")};return t.prototype.draw=function(t,e){this.setOptions(e),this.setData(t),e&&e.start&&e.end?this.setVisibleChartRange(e.start,e.end):this.firstDraw&&this.setVisibleChartRangeAuto(),this.firstDraw=!1},t.prototype.setOptions=function(t){if(t)for(var e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e]);this.options.autoHeight="auto"===this.options.height},t.getOptions=function(){return this.options},t.prototype.setData=function(e){this.unselectItem(),e||(e=[]),this.items=[],this.data=e;var i=this.items;if(this.options,this.setGroups(e),!t.isArray(e))throw"Unknown data type. DataTable or Array expected.";for(var n=0,s=e.length;s>n;n++){var r=e[n],o=this.createItem(r);i.push(o)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(!1),this.redrawFrame(),this.size.dataChanged=!1},t.prototype.setGroups=function(e){if(this.deleteGroups(),this.groups,this.groupIndexes,!t.isArray(e))throw"Unknown data type. DataTable or Array expected.";for(var i=0,n=e.length;n>i;i++){var s=e[i],r=s.group;r&&this.addGroup(r)}},t.prototype.getData=function(){return this.data},t.prototype.updateData=function(e,i){var n=this.data;if(!t.isArray(n))throw"Cannot update data, unknown type of data";var s=n[e];void 0==s&&(s={},n[e]=s),i.start&&(s.start=i.start),i.end&&(s.end=i.end),i.content&&(s.content=i.content),i.group&&(s.group=i.group)},t.prototype.getItemIndex=function(t){for(var e=t,i=this.dom,n=this.items,s=void 0;e.parentNode&&e.parentNode!==i.items.frame;)e=e.parentNode;if(e.parentNode===i.items.frame)for(var r=0,o=n.length;o>r;r++)if(n[r].dom===e){s=r;break}return s},t.prototype.setSize=function(t,e){t&&(this.options.width=t,this.dom.frame.style.width=t),e&&(this.options.height=e,this.options.autoHeight="auto"===this.options.height,"auto"!==e&&(this.dom.frame.style.height=e)),this.recalcSize(),this.stackEvents(!1),this.redrawFrame()},t.prototype.setVisibleChartRange=function(t,e,i){void 0==t&&(t=new Date,t.setDate(t.getDate()-3)),void 0==e&&(e=new Date,e.setDate(t.getDate()+4)),e.valueOf()<=t.valueOf()&&(e=new Date(t),e.setDate(e.getDate()+7));var n=this.options.min?this.options.min.valueOf():void 0;n&&t.valueOf()<n&&(t=new Date(n));var s=this.options.max?this.options.max.valueOf():void 0;s&&e.valueOf()>s&&(e=new Date(s)),this.applyRange(t,e),void 0==i||1==i?(this.recalcSize(),this.stackEvents(!1),this.redrawFrame()):this.recalcConversion()},t.prototype.setVisibleChartRangeAuto=function(){var t=this.items;startMin=void 0,endMax=void 0;for(var e=0,i=t.length;i>e;e++){var n=t[e],s=n.start?n.start.valueOf():void 0,r=n.end?n.end.valueOf():s;startMin=void 0!==startMin&&void 0!==s?Math.min(startMin,s):s,endMax=void 0!==endMax&&void 0!==r?Math.max(endMax,r):r}if(void 0!==startMin&&void 0!==endMax){var o=endMax-startMin;o=0,startMin-=.05*o,endMax+=.05*o,this.setVisibleChartRange(new XDate(startMin),new XDate(endMax))}else this.setVisibleChartRange(void 0,void 0)},t.prototype.setVisibleChartRangeNow=function(){var t=new Date,e=this.end.getTime()-this.start.getTime(),i=new Date(t.getTime()-e/2),n=new Date(i.getTime()+e);this.setVisibleChartRange(i,n)},t.prototype.getVisibleChartRange=function(){var t={start:new Date(this.start),end:new Date(this.end)};return t},t.prototype.redrawFrame=function(){var t=this.dom,e=this.options,i=this.size;t.frame||(t.frame=document.createElement("DIV"),t.frame.className="timeline-frame",t.frame.style.position="relative",t.frame.style.overflow="hidden",t.container.appendChild(t.frame)),t.frame.style.height=e.autoHeight?i.frameHeight+"px":e.height||"100%",t.frame.style.width=e.width||"100%",this.redrawContent(),this.redrawGroups(),this.redrawCurrentTime(),this.redrawCustomTime(),this.redrawNavigation()},t.prototype.redrawContent=function(){var e=this.dom,i=this.size;if(!e.content){e.content=document.createElement("DIV"),e.content.style.position="relative",e.content.style.overflow="hidden",e.frame.appendChild(e.content);var n=document.createElement("DIV");n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.height="100%",n.style.width="0px",e.content.appendChild(n),e.contentTimelines=n;var s=this.eventParams,r=this;s.onMouseDown||(s.onMouseDown=function(t){r.onMouseDown(t)},t.addEventListener(e.content,"mousedown",s.onMouseDown)),s.onTouchStart||(s.onTouchStart=function(t){r.onTouchStart(t)},t.addEventListener(e.content,"touchstart",s.onTouchStart)),s.onMouseWheel||(s.onMouseWheel=function(t){r.onMouseWheel(t)},t.addEventListener(e.content,"mousewheel",s.onMouseWheel)),s.onDblClick||(s.onDblClick=function(t){r.onDblClick(t)},t.addEventListener(e.content,"dblclick",s.onDblClick))}e.content.style.left=i.contentLeft+"px",e.content.style.top="0px",e.content.style.width=i.contentWidth+"px",e.content.style.height=i.frameHeight+"px",this.redrawAxis(),this.redrawItems(),this.redrawDeleteButton(),this.redrawDragAreas()},t.prototype.redrawAxis=function(){var t=this.dom,e=this.options,i=this.size,n=this.step,s=t.axis;s||(s={},t.axis=s),void 0===i.axis.properties&&(i.axis.properties={}),void 0===s.minorTexts&&(s.minorTexts=[]),void 0===s.minorLines&&(s.minorLines=[]),void 0===s.majorTexts&&(s.majorTexts=[]),void 0===s.majorLines&&(s.majorLines=[]),s.frame||(s.frame=document.createElement("DIV"),s.frame.style.position="absolute",s.frame.style.left="0px",s.frame.style.top="0px",t.content.appendChild(s.frame)),t.content.removeChild(s.frame),s.frame.style.width=i.contentWidth+"px",s.frame.style.height=i.axis.height+"px";var r=this.screenToTime(0),o=this.screenToTime(i.contentWidth),a=i.contentWidth;this.minimumStep=this.screenToTime(6*i.axis.characterMinorWidth).valueOf()-this.screenToTime(0).valueOf(),n.setRange(r,o,this.minimumStep),this.redrawAxisCharacters(),this.redrawAxisStartOverwriting(),n.start();for(var l=void 0;!n.end();){var h=n.getCurrent(),c=this.timeToScreen(h),u=n.isMajor();this.redrawAxisMinorText(c,n.getLabelMinor()),u&&e.showMajorLabels?(c>0&&(void 0===l&&(l=c),this.redrawAxisMajorText(c,n.getLabelMajor())),this.redrawAxisMajorLine(c)):this.redrawAxisMinorLine(c),n.next()}if(e.showMajorLabels){var d=this.screenToTime(0),p=this.step.getLabelMajor(d),a=p.length*i.axis.characterMajorWidth+10;(void 0===l||l>a)&&this.redrawAxisMajorText(0,p,d)}this.redrawAxisHorizontal(),this.redrawAxisEndOverwriting(),t.content.insertBefore(s.frame,t.content.firstChild)},t.prototype.redrawAxisCharacters=function(){var t=this.dom,e=t.axis;if(!e.characterMinor){var i=document.createTextNode("0"),n=document.createElement("DIV");n.className="timeline-axis-text timeline-axis-text-minor",n.appendChild(i),n.style.position="absolute",n.style.visibility="hidden",n.style.paddingLeft="0px",n.style.paddingRight="0px",e.frame.appendChild(n),e.characterMinor=n}if(!e.characterMajor){var i=document.createTextNode("0"),s=document.createElement("DIV");s.className="timeline-axis-text timeline-axis-text-major",s.appendChild(i),s.style.position="absolute",s.style.visibility="hidden",s.style.paddingLeft="0px",s.style.paddingRight="0px",e.frame.appendChild(s),e.characterMajor=s}},t.prototype.redrawAxisStartOverwriting=function(){var t=this.size.axis.properties;t.minorTextNum=0,t.minorLineNum=0,t.majorTextNum=0,t.majorLineNum=0},t.prototype.redrawAxisEndOverwriting=function(){for(var t=this.dom,e=this.size.axis.properties,i=this.dom.axis.frame,n=t.axis.minorTexts,s=e.minorTextNum;n.length>s;){var r=n[s];i.removeChild(r),n.splice(s,1)}for(var o=t.axis.minorLines,s=e.minorLineNum;o.length>s;){var a=o[s];i.removeChild(a),o.splice(s,1)}for(var l=t.axis.majorTexts,s=e.majorTextNum;l.length>s;){var h=l[s];i.removeChild(h),l.splice(s,1)}for(var c=t.axis.majorLines,s=e.majorLineNum;c.length>s;){var u=c[s];i.removeChild(u),c.splice(s,1)}},t.prototype.redrawAxisHorizontal=function(){var t=this.dom.axis,e=this.size;if(!t.backgroundLine){var i=document.createElement("DIV");i.className="timeline-axis",i.style.position="absolute",i.style.left="0px",i.style.width="100%",i.style.border="none",t.frame.insertBefore(i,t.frame.firstChild),t.backgroundLine=i}if(t.backgroundLine.style.top=e.axis.top+"px",t.backgroundLine.style.height=e.axis.height+"px",t.line){var n=t.frame.removeChild(t.line);t.frame.appendChild(n)}else{var n=document.createElement("DIV");n.className="timeline-axis",n.style.position="absolute",n.style.left="0px",n.style.width="100%",n.style.height="0px",t.frame.appendChild(n),t.line=n}t.line.style.top=e.axis.line+"px"},t.prototype.redrawAxisMinorText=function(t,e){var i,n=this.size,s=this.dom,r=n.axis.properties,o=s.axis.frame,a=s.axis.minorTexts,l=r.minorTextNum;if(l<a.length)i=a[l];else{var h=document.createTextNode(""),i=document.createElement("DIV");i.appendChild(h),i.className="timeline-axis-text timeline-axis-text-minor",i.style.position="absolute",o.appendChild(i),a.push(i)}i.childNodes[0].nodeValue=e,i.style.left=t+"px",i.style.top=n.axis.labelMinorTop+"px",r.minorTextNum++},t.prototype.redrawAxisMinorLine=function(t){var e,i=this.size.axis,n=this.dom,s=i.properties,r=n.axis.frame,o=n.axis.minorLines,a=s.minorLineNum;a<o.length?e=o[a]:(e=document.createElement("DIV"),e.className="timeline-axis-grid timeline-axis-grid-minor",e.style.position="absolute",e.style.width="0px",r.appendChild(e),o.push(e)),e.style.top=i.lineMinorTop+"px",e.style.height=i.lineMinorHeight+"px",e.style.left=t-i.lineMinorWidth/2+"px",s.minorLineNum++},t.prototype.redrawAxisMajorText=function(t,e){var i,n=this.size,s=n.axis.properties,r=this.dom.axis.frame,o=this.dom.axis.majorTexts,a=s.majorTextNum;if(a<o.length)i=o[a];else{var l=document.createTextNode(e);i=document.createElement("DIV"),i.className="timeline-axis-text timeline-axis-text-major",i.appendChild(l),i.style.position="absolute",i.style.top="0px",r.appendChild(i),o.push(i)}i.childNodes[0].nodeValue=e,i.style.top=n.axis.labelMajorTop+"px",i.style.left=t+"px",s.majorTextNum++},t.prototype.redrawAxisMajorLine=function(t){var e,i=this.size,n=i.axis.properties,s=this.size.axis,r=this.dom.axis.frame,o=this.dom.axis.majorLines,a=n.majorLineNum;if(a<o.length)var e=o[a];else e=document.createElement("DIV"),e.className="timeline-axis-grid timeline-axis-grid-major",e.style.position="absolute",e.style.top="0px",e.style.width="0px",r.appendChild(e),o.push(e);e.style.left=t-s.lineMajorWidth/2+"px",e.style.height=i.frameHeight+"px",n.majorLineNum++},t.prototype.redrawItems=function(){var t=this.dom,e=this.options,i=e.box&&e.box.align?e.box.align:void 0;size=this.size,contentWidth=size.contentWidth,items=this.items,t.items||(t.items={});var n=t.items.frame;n||(n=document.createElement("DIV"),n.style.position="relative",t.content.appendChild(n),t.items.frame=n),n.style.left="0px",n.style.top=size.items.top+"px",n.style.height=size.frameHeight-size.axis.height+"px";var s=t.items.ranges;s||(s=[],t.items.ranges=s);var r=t.items.boxes;r||(r=[],t.items.boxes=r);var o=t.items.dots;if(o||(o=[],t.items.dots=o),t.content.removeChild(n),size.dataChanged){for(var a=s.length,l=r.length,h=o.length,c=(items.length,0),u=0,d=0,p=0,f=items.length;f>p;p++){var m=items[p];switch(m.type){case"range":if(a>c){var g=s[c];g.firstChild.innerHTML=m.content,g.style.display="",m.dom=g,c++}else{var g=this.createEventRange(m.content,m.groupId,m.id);s[c]=g,n.appendChild(g),m.dom=g,c++,a++}break;case"box":if(l>u){var g=r[u];g.firstChild.innerHTML=m.content,g.style.display="",m.dom=g,u++}else{var g=this.createEventBox(m.content);r[u]=g,n.appendChild(g),n.insertBefore(g.line,n.firstChild),n.appendChild(g.dot),m.dom=g,u++,l++}break;case"dot":if(h>d){var g=o[d];g.firstChild.innerHTML=m.content,g.style.display="",m.dom=g,d++}else{var g=this.createEventDot(m.content);o[d]=g,n.appendChild(g),m.dom=g,d++,h++}}}for(var p=c;a>p;p++)n.removeChild(s[p]);s.splice(c,a-c);for(var p=u;l>p;p++){var v=r[p];n.removeChild(v.line),n.removeChild(v.dot),n.removeChild(v)}r.splice(u,l-u);for(var p=d;h>p;p++)n.removeChild(o[p]);
394
- o.splice(d,h-d)}for(var p=0,f=items.length;f>p;p++){var m=items[p],g=m.dom;switch(m.type){case"range":var y=this.timeToScreen(m.start),b=this.timeToScreen(m.end);-contentWidth>y&&(y=-contentWidth),b>2*contentWidth&&(b=2*contentWidth);var x=b>-contentWidth&&2*contentWidth>y;x||size.dataChanged?(m.hidden&&(m.hidden=!1,g.style.display=""),g.style.top=m.top+"px",g.style.left=y+"px",g.style.width=Math.max(b-y,1)+"px"):m.hidden||(g.style.display="none",m.hidden=!0);break;case"box":var y=this.timeToScreen(m.start),w=e.axisOnTop,k=(size.axis.height,size.axis.top),x=y+m.width/2>-contentWidth&&y-m.width/2<2*contentWidth;if(x||size.dataChanged){m.hidden&&(m.hidden=!1,g.style.display="",g.line.style.display="",g.dot.style.display=""),g.style.top=m.top+"px",g.style.left="right"==i?y-m.width+"px":"left"==i?y+"px":y-m.width/2+"px";var _=g.line;_.style.left=y-m.lineWidth/2+"px",w?(_.style.top="0px",_.style.height=Math.max(m.top,0)+"px"):(_.style.top=m.top+m.height+"px",_.style.height=Math.max(k-m.top-m.height,0)+"px");var C=g.dot;C.style.left=y-m.dotWidth/2+"px",C.style.top=k-m.dotHeight/2+"px"}else m.hidden||(g.style.display="none",g.line.style.display="none",g.dot.style.display="none",m.hidden=!0);break;case"dot":var y=this.timeToScreen(m.start),w=e.axisOnTop,k=(size.axis.height,size.axis.top),x=y+m.width>-contentWidth&&2*contentWidth>y;x||size.dataChanged?(m.hidden&&(m.hidden=!1,g.style.display=""),g.style.top=m.top+"px",g.style.left=y-m.dotWidth/2+"px",g.content.style.marginLeft=1.5*m.dotWidth+"px",g.dot.style.top=(m.height-m.dotHeight)/2+"px"):m.hidden||(g.style.display="none",m.hidden=!0)}}if(this.selection){var m=this.selection.item;n.removeChild(m),n.appendChild(m)}t.content.appendChild(n)},t.prototype.createEventBox=function(t){var e=document.createElement("DIV");e.style.position="absolute",e.style.left="0px",e.style.top="0px",e.className="timeline-event timeline-event-box";var i=document.createElement("DIV");i.className="timeline-event-content",i.innerHTML=t,e.appendChild(i);var n=document.createElement("DIV");n.style.position="absolute",n.style.width="0px",n.className="timeline-event timeline-event-line",e.line=n;var s=document.createElement("DIV");return s.style.position="absolute",s.style.width="0px",s.style.height="0px",s.className="timeline-event timeline-event-dot",e.dot=s,e},t.prototype.createEventDot=function(t){var e=document.createElement("DIV");e.style.position="absolute";var i=document.createElement("DIV");i.className="timeline-event-content",i.innerHTML=t,e.appendChild(i);var n=document.createElement("DIV");return n.style.position="absolute",n.className="timeline-event timeline-event-dot",n.style.width="0px",n.style.height="0px",e.appendChild(n),e.content=i,e.dot=n,e},t.prototype.createEventRange=function(t,e,i){var n=document.createElement("DIV"),s=e?" timeline-group-"+e:"",r=i?" timeline-event-"+i:"";n.style.position="absolute",n.className="timeline-event timeline-event-range"+s+r;var o=document.createElement("DIV");return o.className="timeline-event-content",o.innerHTML=t,n.appendChild(o),n},t.prototype.redrawGroups=function(){var t=this.dom,e=this.options,i=this.size,n=this.groups;void 0===t.groups&&(t.groups={});var s=t.groups.labels;s||(s=[],t.groups.labels=s);var r=t.groups.labelLines;r||(r=[],t.groups.labelLines=r);var o=t.groups.itemLines;o||(o=[],t.groups.itemLines=o);var a=t.groups.frame;if(!a){var a=document.createElement("DIV");a.className="timeline-groups-axis",a.style.position="absolute",a.style.overflow="hidden",a.style.top="0px",a.style.height="100%",t.frame.appendChild(a),t.groups.frame=a}if(a.style.left=i.groupsLeft+"px",a.style.width=void 0!==e.groupsWidth?e.groupsWidth:i.groupsWidth+"px",a.style.display=0==n.length?"none":"",i.dataChanged){for(var l=s.length,h=n.length,c=0,u=Math.min(l,h);u>c;c++){var d=n[c],p=s[c];p.innerHTML=d.content,p.style.display=""}for(var c=l;h>c;c++){var d=n[c],p=document.createElement("DIV");p.className="timeline-groups-text",p.style.position="absolute",void 0===e.groupsWidth&&(p.style.whiteSpace="nowrap"),p.innerHTML=d.content,a.appendChild(p),s[c]=p;var f=document.createElement("DIV");f.className="timeline-axis-grid timeline-axis-grid-minor",f.style.position="absolute",f.style.left="0px",f.style.width="100%",f.style.height="0px",f.style.borderTopStyle="solid",a.appendChild(f),r[c]=f;var m=document.createElement("DIV");m.className="timeline-axis-grid timeline-axis-grid-minor",m.style.position="absolute",m.style.left="0px",m.style.width="100%",m.style.height="0px",m.style.borderTopStyle="solid",t.content.insertBefore(m,t.content.firstChild),o[c]=m}for(var c=h;l>c;c++){var p=s[c],f=r[c],m=o[c];a.removeChild(p),a.removeChild(f),t.content.removeChild(m)}s.splice(h,l-h),r.splice(h,l-h),o.splice(h,l-h),a.style.borderStyle=e.groupsOnRight?"none none none solid":"none solid none none"}for(var c=0,u=n.length;u>c;c++){var d=n[c],p=s[c],f=r[c],m=o[c];p.style.top=d.labelTop+"px",f.style.top=d.lineTop+"px",m.style.top=d.lineTop+"px",m.style.width=i.contentWidth+"px"}if(!t.groups.background){var g=document.createElement("DIV");g.className="timeline-axis",g.style.position="absolute",g.style.left="0px",g.style.width="100%",g.style.border="none",a.appendChild(g),t.groups.background=g}if(t.groups.background.style.top=i.axis.top+"px",t.groups.background.style.height=i.axis.height+"px",!t.groups.line){var v=document.createElement("DIV");v.className="timeline-axis",v.style.position="absolute",v.style.left="0px",v.style.width="100%",v.style.height="0px",a.appendChild(v),t.groups.line=v}t.groups.line.style.top=i.axis.line+"px"},t.prototype.redrawCurrentTime=function(){var t=this.options,e=this.dom,i=this.size;if(!t.showCurrentTime)return e.currentTime&&(e.contentTimelines.removeChild(e.currentTime),delete e.currentTime),void 0;if(!e.currentTime){var n=document.createElement("DIV");n.className="timeline-currenttime",n.style.position="absolute",n.style.top="0px",n.style.height="100%",e.contentTimelines.appendChild(n),e.currentTime=n}var s=new Date,r=new Date(s.getTime()+this.clientTimeOffset),o=this.timeToScreen(r),a=o>-i.contentWidth&&o<2*i.contentWidth;e.currentTime.style.display=a?"":"none",e.currentTime.style.left=o+"px",e.currentTime.title="Current time: "+r,void 0!=this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer);var l=this,h=function(){l.redrawCurrentTime()},c=1/this.conversion.factor/2;30>c&&(c=30),this.currentTimeTimer=setTimeout(h,c)},t.prototype.redrawCustomTime=function(){var t=this.options,e=this.dom,i=this.size;if(!t.showCustomTime)return e.customTime&&(e.contentTimelines.removeChild(e.customTime),delete e.customTime),void 0;if(!e.customTime){var n=document.createElement("DIV");n.className="timeline-customtime",n.style.position="absolute",n.style.top="0px",n.style.height="100%";var s=document.createElement("DIV");s.style.position="relative",s.style.top="0px",s.style.left="-10px",s.style.height="100%",s.style.width="20px",n.appendChild(s),e.contentTimelines.appendChild(n),e.customTime=n,this.customTime=new Date}var r=this.timeToScreen(this.customTime),o=r>-i.contentWidth&&r<2*i.contentWidth;e.customTime.style.display=o?"":"none",e.customTime.style.left=r+"px",e.customTime.title="Time: "+this.customTime},t.prototype.redrawDeleteButton=function(){var t=this.options,e=this.dom,i=this.size,n=e.items.frame;if(t.editable){var s=e.items.deleteButton;if(s||(s=document.createElement("DIV"),s.className="timeline-navigation-delete",s.style.position="absolute",n.appendChild(s),e.items.deleteButton=s),this.selection){var r,o=this.selection.index,a=this.items[o],l=(this.selection.item,a.top);switch(a.type){case"range":r=this.timeToScreen(a.end);break;case"box":r=this.timeToScreen(a.start)+a.width/2;break;case"dot":r=this.timeToScreen(a.start)+a.width}r<-i.contentWidth&&(r=-i.contentWidth),r>2*i.contentWidth&&(r=2*i.contentWidth),s.style.left=r+"px",s.style.top=l+"px",s.style.display="",n.removeChild(s),n.appendChild(s)}else s.style.display="none"}},t.prototype.redrawDragAreas=function(){var t=this.options,e=this.dom,i=(this.size,this.dom.items.frame);if(t.editable){var n=e.items.dragLeft;n||(n=document.createElement("DIV"),n.style.width=t.dragAreaWidth+"px",n.style.position="absolute",n.style.cursor="w-resize",i.appendChild(n),e.items.dragLeft=n);var s=e.items.dragRight;if(s||(s=document.createElement("DIV"),s.style.width=t.dragAreaWidth+"px",s.style.position="absolute",s.style.cursor="e-resize",i.appendChild(s),e.items.dragRight=s),this.selection){var r=this.selection.index,o=this.items[r];if("range"==o.type){var a=(o.dom,this.timeToScreen(o.start)),l=this.timeToScreen(o.end),h=o.top,c=o.height;n.style.left=a+"px",n.style.top=h+"px",n.style.height=c+"px",n.style.display="",i.removeChild(n),i.appendChild(n),s.style.left=l-t.dragAreaWidth+"px",s.style.top=h+"px",s.style.height=c+"px",s.style.display="",i.removeChild(s),i.appendChild(s)}}else n.style.display="none",s.style.display="none"}},t.prototype.redrawNavigation=function(){var e=this,i=this.options,n=this.dom,s=n.frame,r=n.navBar;if(!r){if((i.editable||i.showNavigation)&&(r=document.createElement("DIV"),r.style.position="absolute",r.className="timeline-navigation btn-group",i.groupsOnRight?r.style.left="10px":r.style.right="10px",i.axisOnTop?r.style.bottom="10px":r.style.top="10px",n.navBar=r,s.appendChild(r)),i.editable&&i.showButtonAdd){r.addButton=document.createElement("DIV"),r.addButton.className="timeline-navigation-new",r.addButton.title="Create new event";var o=function(n){t.preventDefault(n),t.stopPropagation(n);var s=e.size.contentWidth,r=s/2,o=e.screenToTime(r-s/10),a=e.screenToTime(r+s/10);i.snapEvents&&(e.step.snap(o),e.step.snap(a));var l="New",h=e.groups.length?e.groups[0].content:void 0;e.addItem({start:o,end:a,content:l,group:h});var c=e.items.length-1;e.selectItem(c),e.applyAdd=!0,e.trigger("add"),e.applyAdd||e.deleteItem(c),e.redrawDeleteButton(),e.redrawDragAreas()};t.addEventListener(r.addButton,"mousedown",o),r.appendChild(r.addButton)}if(i.editable&&i.showButtonAdd&&i.showNavigation&&(r.addButton.style.borderRightWidth="1px",r.addButton.style.borderRightStyle="solid"),i.showNavigation){r.zoomInButton=document.createElement("BUTTON"),r.zoomInButtonIcon=document.createElement("I"),r.zoomInButton.className="timeline-navigation-zoom-in btn btn-inverse",r.zoomInButtonIcon.className="icon-zoom-in",r.zoomInButton.title="Zoom in";var a=function(i){t.preventDefault(i),t.stopPropagation(i),e.zoom(.4),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.zoomInButton,"mousedown",a),r.zoomInButton.appendChild(r.zoomInButtonIcon),r.appendChild(r.zoomInButton),r.zoomOutButton=document.createElement("BUTTON"),r.zoomOutButtonIcon=document.createElement("I"),r.zoomOutButton.className="timeline-navigation-zoom-out btn btn-inverse",r.zoomOutButtonIcon.className="icon-zoom-out",r.zoomOutButton.title="Zoom out";var l=function(i){t.preventDefault(i),t.stopPropagation(i),e.zoom(-.4),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.zoomOutButton,"mousedown",l),r.zoomOutButton.appendChild(r.zoomOutButtonIcon),r.appendChild(r.zoomOutButton),r.moveLeftButton=document.createElement("BUTTON"),r.moveLeftButtonIcon=document.createElement("I"),r.moveLeftButton.className="timeline-navigation-move-left btn btn-inverse",r.moveLeftButtonIcon.className="icon-chevron-left",r.moveLeftButton.title="Move left";var h=function(i){t.preventDefault(i),t.stopPropagation(i),e.move(-.2),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.moveLeftButton,"mousedown",h),r.moveLeftButton.appendChild(r.moveLeftButtonIcon),r.appendChild(r.moveLeftButton),r.moveRightButton=document.createElement("BUTTON"),r.moveRightButtonIcon=document.createElement("I"),r.moveRightButton.className="timeline-navigation-move-right btn btn-inverse",r.moveRightButtonIcon.className="icon-chevron-right",r.moveRightButton.title="Move right";var c=function(i){t.preventDefault(i),t.stopPropagation(i),e.move(.2),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.moveRightButton,"mousedown",c),r.moveRightButton.appendChild(r.moveRightButtonIcon),r.appendChild(r.moveRightButton)}}},t.prototype.setCurrentTime=function(t){var e=new Date;this.clientTimeOffset=t.getTime()-e.getTime(),this.redrawCurrentTime()},t.prototype.getCurrentTime=function(){var t=new Date;return new Date(t.getTime()+this.clientTimeOffset)},t.prototype.setCustomTime=function(t){this.customTime=new Date(t),this.redrawCustomTime()},t.prototype.getCustomTime=function(){return new Date(this.customTime)},t.prototype.setScale=function(t,e){this.step.setScale(t,e),this.redrawFrame()},t.prototype.setAutoScale=function(t){this.step.setAutoScale(t),this.redrawFrame()},t.prototype.redraw=function(){this.setData(this.data)},t.prototype.checkResize=function(){var t=this.recalcSize();t&&this.redrawFrame()},t.filterImageUrls=function(e,i){for(var n=e.firstChild;n;){if("IMG"==n.tagName){var s=n.src;-1==i.indexOf(s)&&i.push(s)}t.filterImageUrls(n,i),n=n.nextSibling}},t.prototype.recalcSize=function(){var e=!1,i=this;if(size=this.size,options=this.options,axisOnTop=options.axisOnTop,dom=this.dom,axis=dom.axis,groups=this.groups,labels=dom.groups.labels,items=this.items,groupsWidth=size.groupsWidth,characterMinorWidth=axis.characterMinor?axis.characterMinor.clientWidth:0,characterMinorHeight=axis.characterMinor?axis.characterMinor.clientHeight:0,characterMajorWidth=axis.characterMajor?axis.characterMajor.clientWidth:0,characterMajorHeight=axis.characterMajor?axis.characterMajor.clientHeight:0,axisHeight=characterMinorHeight+(options.showMajorLabels?characterMajorHeight:0),actualHeight=size.actualHeight||axisHeight,size.dataChanged){for(var n=[],s=0,r=items.length;r>s;s++){var o=items[s],a=o.dom;a&&t.filterImageUrls(a,n)}if(n.length)for(var s=0;s<n.length;s++){var l=n[s],h=function(){i.redraw()},c=!1;t.imageloader.load(l,h,c)}}if(size.dataChanged){groupsWidth=0;for(var s=0,r=labels.length;r>s;s++){var u=groups[s];u.width=labels[s].clientWidth,u.height=labels[s].clientHeight,u.labelHeight=u.height,groupsWidth=Math.max(groupsWidth,u.width)}for(var s=0,r=items.length;r>s;s++){var o=items[s],a=o.dom,u=o.group,d=a?a.clientWidth:0,p=a?a.clientHeight:0;switch(e=e||o.width!=d,e=e||o.height!=p,o.width=d,o.height=p,o.type){case"range":break;case"box":o.dotHeight=a.dot.offsetHeight,o.dotWidth=a.dot.offsetWidth,o.lineWidth=a.line.offsetWidth;break;case"dot":o.dotHeight=a.dot.offsetHeight,o.dotWidth=a.dot.offsetWidth,o.contentHeight=a.content.offsetHeight}u&&(u.height=u.height?Math.max(u.height,o.height):o.height)}actualHeight=axisHeight+2*options.eventMarginAxis;for(var s=0,r=groups.length;r>s;s++)actualHeight+=groups[s].height+options.eventMargin}if(0==groups.length&&options.autoHeight){var f=0,m=0;if(this.animation&&this.animation.finalItems){var g=this.animation.finalItems,v=g[0];v&&v.top&&(f=v.top,m=v.top+v.height);for(var s=1,r=g.length;r>s;s++)v=g[s],f=Math.min(f,v.top),m=Math.max(m,v.top+v.height)}else{var o=items[0];o&&o.top&&(f=o.top,m=o.top+o.height);for(var s=1,r=items.length;r>s;s++){var o=items[s];o.top&&(f=Math.min(f,o.top),m=Math.max(m,o.top+o.height))}}if(actualHeight=m-f+2*options.eventMarginAxis+axisHeight,size.actualHeight!=actualHeight&&options.autoHeight&&!options.axisOnTop){var y=actualHeight-size.actualHeight;if(this.animation&&this.animation.finalItems)for(var g=this.animation.finalItems,s=0,r=g.length;r>s;s++)g[s].top+=y,g[s].item.top+=y;else for(var s=0,r=items.length;r>s;s++)items[s].top+=y}}var b=dom.frame?dom.frame.offsetWidth:0,x=Math.max(options.autoHeight?actualHeight:dom.frame?dom.frame.clientHeight:0,options.minHeight),w=axisOnTop?0:x-axisHeight,k=axisOnTop?axisHeight:w,_=axisOnTop?axisHeight:0,C=Math.max(x-axisHeight,0);void 0!==options.groupsWidth&&(groupsWidth=dom.groups.frame?dom.groups.frame.clientWidth:0);var D=options.groupsOnRight?b-groupsWidth:0;if(size.dataChanged){for(var M=options.eventMargin,T=axisOnTop?options.eventMarginAxis+M/2:C-options.eventMarginAxis+M/2,s=0,r=groups.length;r>s;s++){var u=groups[s];axisOnTop?(u.top=T,u.labelTop=T+axisHeight+(u.height-u.labelHeight)/2,u.lineTop=T+axisHeight+u.height+M/2,T+=u.height+M):(T-=u.height+M,u.top=T,u.labelTop=T+(u.height-u.labelHeight)/2,u.lineTop=T-M/2)}for(var s=0,r=items.length;r>s;s++){var o=items[s],u=o.group;u&&(o.top=u.top)}e=!0}return e=e||size.groupsWidth!==groupsWidth,e=e||size.groupsLeft!==D,e=e||size.actualHeight!==actualHeight,size.groupsWidth=groupsWidth,size.groupsLeft=D,size.actualHeight=actualHeight,e=e||size.frameWidth!==b,e=e||size.frameHeight!==x,size.frameWidth=b,size.frameHeight=x,e=e||size.groupsWidth!==groupsWidth,size.groupsWidth=groupsWidth,size.contentLeft=options.groupsOnRight?0:groupsWidth,size.contentWidth=Math.max(b-groupsWidth,0),size.contentHeight=C,e=e||size.axis.top!==w,e=e||size.axis.line!==k,e=e||size.axis.height!==axisHeight,e=e||size.items.top!==_,size.axis.top=w,size.axis.line=k,size.axis.height=axisHeight,size.axis.labelMajorTop=options.axisOnTop?0:k+characterMinorHeight,size.axis.labelMinorTop=options.axisOnTop?options.showMajorLabels?characterMajorHeight:0:k,size.axis.lineMinorTop=options.axisOnTop?size.axis.labelMinorTop:0,size.axis.lineMinorHeight=options.showMajorLabels?x-characterMajorHeight:x,size.axis.lineMinorWidth=dom.axis.minorLines.length?dom.axis.minorLines[0].offsetWidth:1,size.axis.lineMajorWidth=dom.axis.majorLines.length?dom.axis.majorLines[0].offsetWidth:1,size.items.top=_,e=e||size.axis.characterMinorWidth!==characterMinorWidth,e=e||size.axis.characterMinorHeight!==characterMinorHeight,e=e||size.axis.characterMajorWidth!==characterMajorWidth,e=e||size.axis.characterMajorHeight!==characterMajorHeight,size.axis.characterMinorWidth=characterMinorWidth,size.axis.characterMinorHeight=characterMinorHeight,size.axis.characterMajorWidth=characterMajorWidth,size.axis.characterMajorHeight=characterMajorHeight,this.recalcConversion(),e},t.prototype.recalcConversion=function(){this.conversion.offset=parseFloat(this.start.valueOf()),this.conversion.factor=parseFloat(this.size.contentWidth)/parseFloat(this.end.valueOf()-this.start.valueOf())},t.prototype.screenToTime=function(t){var e=this.conversion,i=new Date(parseFloat(t)/e.factor+e.offset);return i},t.prototype.timeToScreen=function(t){var e=this.conversion,i=(t.valueOf()-e.offset)*e.factor;return i},t.prototype.onTouchStart=function(e){var i=this.eventParams,n=(this.dom,this);i.touchDown||(i.touchDown=!0,i.zoomed=!1,this.onMouseDown(e),i.onTouchMove||(i.onTouchMove=function(t){n.onTouchMove(t)},t.addEventListener(document,"touchmove",i.onTouchMove)),i.onTouchEnd||(i.onTouchEnd=function(t){n.onTouchEnd(t)},t.addEventListener(document,"touchend",i.onTouchEnd)))},t.prototype.onTouchMove=function(e){var i=this.eventParams;if(e.scale&&1!==e.scale&&(i.zoomed=!0),i.zoomed){if(this.options.zoomable){i.zoomed=!0;var n=e.scale,s=i.end.valueOf()-i.start.valueOf(),r=s/n,o=r-s,a=new Date(parseInt(i.start.valueOf()-o/2)),l=new Date(parseInt(i.end.valueOf()+o/2));this.setVisibleChartRange(a,l),timeline.trigger("rangechange"),t.preventDefault(e)}}else this.onMouseMove(e)},t.prototype.onTouchEnd=function(e){var i=this.eventParams;i.touchDown=!1,i.zoomed&&timeline.trigger("rangechanged"),i.onTouchMove&&(t.removeEventListener(document,"touchmove",i.onTouchMove),delete i.onTouchMove),i.onTouchEnd&&(t.removeEventListener(document,"touchend",i.onTouchEnd),delete i.onTouchEnd),this.onMouseUp(e)},t.prototype.onMouseDown=function(e){e=e||window.event;var i=this.eventParams,n=this.options,s=this.dom,r=e.which?1==e.which:1==e.button;if(r||i.touchDown){if(this.recalcSize(),i.touchDown?(i.mouseX=e.targetTouches[0].clientX,i.mouseY=e.targetTouches[0].clientY):(i.mouseX=e.clientX,i.mouseY=e.clientY),void 0===i.mouseX&&(i.mouseX=0),void 0===i.mouseY&&(i.mouseY=0),i.frameLeft=t.getAbsoluteLeft(this.dom.content),i.frameTop=t.getAbsoluteTop(this.dom.content),i.previousLeft=0,i.previousOffset=0,i.moved=!1,i.start=new Date(this.start),i.end=new Date(this.end),i.target=t.getTarget(e),i.itemDragLeft=i.target===this.dom.items.dragLeft,i.itemDragRight=i.target===this.dom.items.dragRight,i.itemIndex=i.itemDragLeft||i.itemDragRight?this.selection?this.selection.index:void 0:this.getItemIndex(i.target),i.customTime=i.target===s.customTime||i.target.parentNode===s.customTime?this.customTime:void 0,i.addItem=n.editable&&e.ctrlKey,i.addItem){var o=i.mouseX-i.frameLeft,a=i.mouseY-i.frameTop,l=this.screenToTime(o);n.snapEvents&&this.step.snap(l);var h=new Date(l),c="New",u=this.getGroupFromHeight(a);this.addItem({start:l,end:h,content:c,group:u.content}),i.itemIndex=this.items.length-1,this.selectItem(i.itemIndex),i.itemDragRight=!0}if(i.editItem=n.editable?this.isSelected(i.itemIndex):void 0,i.editItem){var d=this.items[i.itemIndex];i.itemStart=d.start,i.itemEnd=d.end,i.itemType=d.type,"range"==i.itemType?(i.itemLeft=this.timeToScreen(d.start),i.itemRight=this.timeToScreen(d.end)):i.itemLeft=this.timeToScreen(d.start)}else this.dom.frame.style.cursor="move";if(!i.touchDown){var p=this;i.onMouseMove||(i.onMouseMove=function(t){p.onMouseMove(t)},t.addEventListener(document,"mousemove",i.onMouseMove)),i.onMouseUp||(i.onMouseUp=function(t){p.onMouseUp(t)},t.addEventListener(document,"mouseup",i.onMouseUp)),t.preventDefault(e)}}},t.prototype.onMouseMove=function(e){e=e||window.event;var i=this.eventParams,n=this.size,s=this.dom,r=this.options;if(i.touchDown)var o=e.targetTouches[0].clientX,a=e.targetTouches[0].clientY;else var o=e.clientX,a=e.clientY;void 0===o&&(o=0),void 0===a&&(a=0),void 0===i.mouseX&&(i.mouseX=o),void 0===i.mouseY&&(i.mouseY=a);var l=parseFloat(o)-i.mouseX;if(parseFloat(a)-i.mouseY,i.moved=!0,i.customTime){var h=this.timeToScreen(i.customTime),c=h+l;this.customTime=this.screenToTime(c),this.redrawCustomTime(),this.trigger("timechange")}else if(i.editItem){var u,d,p=this.items[i.itemIndex];if(p.dom,i.itemDragLeft?(u=i.itemLeft+l,d=i.itemRight,p.start=this.screenToTime(u),r.snapEvents&&(this.step.snap(p.start),u=this.timeToScreen(p.start)),u>d&&(u=d,p.start=this.screenToTime(u))):i.itemDragRight?(u=i.itemLeft,d=i.itemRight+l,p.end=this.screenToTime(d),r.snapEvents&&(this.step.snap(p.end),d=this.timeToScreen(p.end)),u>d&&(d=u,p.end=this.screenToTime(d))):(u=i.itemLeft+l,p.start=this.screenToTime(u),r.snapEvents&&(this.step.snap(p.start),u=this.timeToScreen(p.start)),p.end&&(d=u+(i.itemRight-i.itemLeft),p.end=this.screenToTime(d))),this.repositionItem(p,u,d),0==this.groups.length)this.stackEvents(r.animate),r.animate||this.redrawFrame();else if(r.groupsChangeable){var f=a-i.frameTop,m=this.getGroupFromHeight(f);if(p.group!==m){var g=this.items.indexOf(p);this.changeItem(g,{group:m.content}),p.top=m.top,this.repositionItem(p)}}this.redrawDeleteButton(),this.redrawDragAreas()}else if(r.moveable){var v=i.end.valueOf()-i.start.valueOf(),y=Math.round(parseFloat(-l)/n.contentWidth*v),b=new Date(i.start.valueOf()+y),x=new Date(i.end.valueOf()+y);this.applyRange(b,x);var w=this.start.valueOf()-b.valueOf();w&&(y+=w),this.recalcConversion();var k=i.previousLeft||0,_=parseFloat(s.items.frame.style.left)||0,C=i.previousOffset||0,D=C+(_-k),M=-y/v*n.contentWidth+D;i.previousOffset=D,i.previousLeft=M,s.items.frame.style.left=M+"px",this.redrawCurrentTime(),this.redrawCustomTime(),this.redrawAxis(),this.trigger("rangechange")}t.preventDefault(e)},t.prototype.onMouseUp=function(e){var i=this.eventParams,n=this.options;if(e=e||window.event,this.dom.frame.style.cursor="auto",i.onMouseMove&&(t.removeEventListener(document,"mousemove",i.onMouseMove),delete i.onMouseMove),i.onMouseUp&&(t.removeEventListener(document,"mouseup",i.onMouseUp),delete i.onMouseUp),i.customTime)this.trigger("timechanged");else if(i.editItem){var s=this.items[i.itemIndex];if(i.moved||i.addItem){if(this.applyChange=!0,this.applyAdd=!0,this.updateData(i.itemIndex,{start:s.start,end:s.end}),this.trigger(i.addItem?"add":"change"),i.addItem)this.applyAdd?this.updateData(i.itemIndex,{start:s.start,end:s.end,content:s.content,group:s.group?s.group.content:void 0}):this.deleteItem(i.itemIndex);else if(this.applyChange)this.updateData(i.itemIndex,{start:s.start,end:s.end});else{delete this.applyChange,delete this.applyAdd;var s=this.items[i.itemIndex];s.dom,s.start=i.itemStart,s.end=i.itemEnd,this.repositionItem(s,i.itemLeft,i.itemRight)}this.recalcSize(),this.stackEvents(n.animate),n.animate||this.redrawFrame(),this.redrawDeleteButton(),this.redrawDragAreas()}}else i.moved||i.zoomed?(this.redrawFrame(),(i.moved&&n.moveable||i.zoomed&&n.zoomable)&&this.trigger("rangechanged")):n.editable&&i.target===this.dom.items.deleteButton?(this.selection&&this.confirmDeleteItem(this.selection.index),this.redrawFrame()):n.selectable&&(void 0!==i.itemIndex?this.isSelected(i.itemIndex)||(this.selectItem(i.itemIndex),this.redrawDeleteButton(),this.redrawDragAreas(),this.trigger("select")):(this.unselectItem(),this.redrawDeleteButton(),this.redrawDragAreas()))},t.prototype.onDblClick=function(e){var i=this.eventParams,n=this.options,s=this.dom,r=this.size;if(e=e||window.event,n.editable){if(void 0!==i.itemIndex)this.trigger("edit");else{var o=e.clientX-t.getAbsoluteLeft(s.content),a=e.clientY-t.getAbsoluteTop(s.content),l=this.screenToTime(o),h=this.screenToTime(o+r.frameWidth/10);n.snapEvents&&(this.step.snap(l),this.step.snap(h));var c="New",u=this.getGroupFromHeight(a);this.addItem({start:l,end:h,content:c,group:u.content}),i.itemIndex=this.items.length-1,this.selectItem(i.itemIndex),this.applyAdd=!0,this.trigger("add"),this.applyAdd||this.deleteItem(i.itemIndex),this.redrawDeleteButton(),this.redrawDragAreas()}t.preventDefault(e)}},t.prototype.onMouseWheel=function(e){if(this.options.zoomable){e||(e=window.event);var i=0;if(e.wheelDelta?i=e.wheelDelta/120:e.detail&&(i=-e.detail/3),i){var n=this,s=function(){n.recalcSize();var s=i/5,r=t.getAbsoluteLeft(n.dom.content),o=void 0!=e.clientX&&void 0!=r?n.screenToTime(e.clientX-r):void 0;n.zoom(s,o),n.trigger("rangechange"),n.trigger("rangechanged")};s()}t.preventDefault(e)}},t.prototype.zoom=function(t,e){void 0==e&&(e=new Date((this.start.valueOf()+this.end.valueOf())/2)),t>=1&&(t=.9),-1>=t&&(t=-.9),0>t&&(t/=1+t);var i=parseFloat(this.start.valueOf()-e.valueOf()),n=parseFloat(this.end.valueOf()-e.valueOf()),s=new Date(this.start.valueOf()-i*t),r=new Date(this.end.valueOf()-n*t);this.applyRange(s,r,e),this.recalcSize();var o=this.options.animate?this.options.animateZoom:!1;this.stackEvents(o),(!o||this.groups.length>0)&&this.redrawFrame()},t.prototype.move=function(t){var e=parseFloat(this.end.valueOf()-this.start.valueOf()),i=new Date(this.start.valueOf()+e*t),n=new Date(this.end.valueOf()+e*t);this.applyRange(i,n),this.recalcConversion(),this.redrawFrame()},t.prototype.repositionItem=function(t,e,i){var n=t.dom;switch(t.type){case"range":n.style.left=e+"px",n.style.width=Math.max(i-e,1)+"px";break;case"box":n.style.left=e-t.width/2+"px",n.line.style.left=e-t.lineWidth/2+"px",n.dot.style.left=e-t.dotWidth/2+"px";break;case"dot":n.style.left=e-t.dotWidth/2+"px"}this.groups.length>0&&(n.style.top=t.top+"px")},t.prototype.applyRange=function(t,e,i){var n=t.valueOf(),s=e.valueOf(),r=s-n,o=this.options,a=31536e6,l=Number(o.intervalMin)||10;10>l&&(l=10);var h=Number(o.intervalMax)||1e4*a;h>1e4*a&&(h=1e4*a),l>h&&(h=l);var c=o.min?o.min.valueOf():void 0,u=o.max?o.max.valueOf():void 0;if(c&&u){if(c>=u){var d=864e5;u=c+d}h>u-c&&(h=u-c),l>u-c&&(l=u-c)}if(n>=s&&(s+=864e5),l>r){var p=l-r,f=i?(i.valueOf()-n)/r:.5;n-=Math.round(p*f),s+=Math.round(p*(1-f))}if(r>h){var p=r-h,f=i?(i.valueOf()-n)/r:.5;n+=Math.round(p*f),s-=Math.round(p*(1-f))}if(c){var p=n-c;0>p&&(n-=p,s-=p)}if(u){var p=u-s;0>p&&(n+=p,s+=p)}this.start=new Date(n),this.end=new Date(s)},t.prototype.confirmDeleteItem=function(t){this.applyDelete=!0,this.isSelected(t)||this.selectItem(t),this.trigger("delete"),this.applyDelete&&this.deleteItem(t),delete this.applyDelete},t.prototype.deleteItem=function(e){if(e>=this.items.length)throw"Cannot delete row, index out of range";if(this.unselectItem(),this.items.splice(e,1),this.data){if(!t.isArray(this.data))throw"Cannot delete row from data, unknown data type";this.data.splice(e,1)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(this.options.animate),this.options.animate||this.redrawFrame(),this.size.dataChanged=!1},t.prototype.deleteAllItems=function(){if(this.unselectItem(),this.items=[],this.deleteGroups(),this.data){if(!t.isArray(this.data))throw"Cannot delete row from data, unknown data type";this.data.splice(0,this.data.length)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(this.options.animate),this.options.animate||this.redrawFrame(),this.size.dataChanged=!1},t.prototype.getGroupFromHeight=function(t){var e=this.groups,i=this.options,n=this.size,s=t-(i.axisOnTop?n.axis.height:0);if(e){for(var r,o=e.length-1;o>=0;o--)if(r=e[o],s>r.top)return r;return r}return void 0},t.prototype.getItem=function(t){if(t>=this.items.length)throw"Cannot get item, index out of range";var e=this.items[t],i={};return i.start=new Date(e.start),e.end&&(i.end=new Date(e.end)),i.content=e.content,e.group&&(i.group=e.group.content),i},t.prototype.addItem=function(t){var e=[t];this.addItems(e)},t.prototype.addItems=function(t){var e=t,i=this.items;this.groups,this.groupIndexes;for(var n=0,s=e.length;s>n;n++){var r=t[n];this.addGroup(r.group),i.push(this.createItem(r));var o=i.length-1;this.updateData(o,r)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(!1),this.redrawFrame(),this.size.dataChanged=!1},t.prototype.createItem=function(t){var e={id:t.id,groupId:t.jobId,status:t.status,start:t.start,end:t.end,content:t.content,type:t.end?"range":this.options.style,group:this.findGroup(t.group),top:0,left:0,width:0,height:0,lineWidth:0,dotWidth:0,dotHeight:0};return e},t.prototype.changeItem=function(t,e){if(t>=this.items.length)throw"Cannot change item, index out of range";this.options.style;var i=this.items[t];e.start&&(i.start=e.start),e.end&&(i.end=e.end),e.content&&(i.content=e.content),e.group&&(i.group=this.addGroup(e.group)),this.updateData(t,e),this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(!1),this.redrawFrame(),this.size.dataChanged=!1},t.prototype.findGroup=function(t){var e=this.groupIndexes[t];return void 0!=e?this.groups[e]:void 0},t.prototype.deleteGroups=function(){this.groups=[],this.groupIndexes={}},t.prototype.addGroup=function(t){var e=this.groups,i=this.groupIndexes,n=void 0,s=i[t];if(void 0===s&&void 0!==t){n={content:t,labelTop:0,lineTop:0},e.push(n),this.options.axisOnTop?e.sort(function(t,e){return t.content>e.content}):e.sort(function(t,e){return t.content<e.content});for(var r=0,o=e.length;o>r;r++)i[e[r].content]=r}else n=e[s];return n},t.prototype.cancelChange=function(){this.applyChange=!1},t.prototype.cancelDelete=function(){this.applyDelete=!1},t.prototype.cancelAdd=function(){this.applyAdd=!1},t.prototype.setSelection=function(t){if(void 0!=t&&t.length>0){if(void 0!=t[0].row){var e=t[0].row;if(this.items[e]){var i=this.items[e];this.selectItem(e);var n=i.start,s=i.end;if(void 0!=s)var r=new Date((s.valueOf()+n.valueOf())/2);else var r=new Date(n);var o=this.end.valueOf()-this.start.valueOf(),a=new Date(r.valueOf()-o/2),l=new Date(r.valueOf()+o/2);return this.setVisibleChartRange(a,l),!0}}}else this.unselectItem();return!1},t.prototype.getSelection=function(){var t=[];return this.selection&&t.push({row:this.selection.index}),t},t.prototype.selectItem=function(t){if(this.unselectItem(),this.selection=void 0,void 0!==this.items[t]){var e=this.items[t],i=e.dom;switch(this.selection={index:t,item:i},this.options.editable&&(i.style.cursor="move"),e.type){case"range":i.className=i.className+" timeline-event-selected";break;case"box":i.className="timeline-event timeline-event-selected timeline-event-box",i.line.className="timeline-event timeline-event-selected timeline-event-line",i.dot.className="timeline-event timeline-event-selected timeline-event-dot";
395
- break;case"dot":i.className="timeline-event timeline-event-selected",i.dot.className="timeline-event timeline-event-selected timeline-event-dot"}}},t.prototype.isSelected=function(t){return this.selection&&this.selection.index===t},t.prototype.unselectItem=function(){if(this.selection){var t=this.items[this.selection.index];if(t&&t.dom){var e=t.dom;switch(e.style.cursor="",t.type){case"range":e.className=e.className.replace(" timeline-event-selected","");break;case"box":e.className="timeline-event timeline-event-box",e.line.className="timeline-event timeline-event-line",e.dot.className="timeline-event timeline-event-dot";break;case"dot":e.className="",e.dot.className="timeline-event timeline-event-dot"}}}this.selection=void 0},t.prototype.stackEvents=function(t){if(!(0==this.options.stackEvents||this.groups.length>0)){void 0==t&&(t=!0);var e=this.stackOrder(this.items),i=this.stackCalculateFinal(e,t),n=this.groupOrder(this.items),s=this.groupStackCalculateFinal(n,t);e=n,i=s;var r=this.animation;r||(r={},this.animation=r),r.finalItems=i;var o=this,a=function(){var t=o.stackMoveOneStep(e,r.finalItems);o.recalcSize(),o.redrawFrame(),t?(delete r.finalItems,delete r.timer):r.timer=setTimeout(a,30)};r.timer||(r.timer=setTimeout(a,30))}},t.prototype.stackOrder=function(t){var e=t.concat([]),i=function(t,e){return"range"==t.type&&"range"!=e.type?-1:"range"!=t.type&&"range"==e.type?1:t.left-e.left};return e.sort(i),e},t.prototype.groupOrder=function(t){for(var e=[],i=[],n=t.concat([]),s=[],r=n.length-1;r>=0;r--)"undefined"==typeof e[n[r].groupId]&&(e[n[r].groupId]=[],i.push({groupId:n[r].groupId,content:n[r].content})),e[n[r].groupId].push(n[r]);i.sort(function(t,e){return t.content<e.content?-1:t.content>e.content?1:0});for(var r=0;r<i.length;r++)s.push(e[i[r].groupId]);return s.reverse()},t.prototype.stackCalculateFinal=function(t){for(var e=this.size,i=e.axis.top,n=this.options,s=n.axisOnTop,r=n.eventMargin,o=n.eventMarginAxis,a=[],l=0,h=t.length;h>l;l++){var c,u,d,p,f=t[l],m=f.height,g=f.width;switch(c=s?i+o+r/2:i-m-o-r/2,p=c+m,f.type){case"range":case"dot":u=this.timeToScreen(f.start),d=f.end?this.timeToScreen(f.end):u+g;break;case"box":u=this.timeToScreen(f.start)-g/2,d=u+g}a[l]={left:u,top:c,right:d,bottom:p,height:m,item:f}}for(var l=0,h=a.length;h>l;l++){var v=a[l],y=null;do y=this.stackEventsCheckOverlap(a,l,0,l-1),null!=y&&(v.top=s?y.top+y.height+r:y.top-v.height-r,v.bottom=v.top+v.height);while(y)}return a},t.prototype.groupStackCalculateFinal=function(t){for(var e=this.size,i=e.axis.top,n=this.options,s=n.axisOnTop,r=n.eventMargin,o=n.eventMarginAxis,a=[],l=0;l<t.length;l++)for(var h=t[l],c=0;c<h.length;c++){var u,d,p,f,m=h[c],g=m.height,v=m.width;switch(u=s?i+o+(g+r)*(l+1):i-o-(g+r)*(l+1),f=u+g,m.type){case"range":case"dot":d=this.timeToScreen(m.start),p=m.end?this.timeToScreen(m.end):d+v;break;case"box":d=this.timeToScreen(m.start)-v/2,p=d+v}a.push({left:d,top:u,right:p,bottom:f,height:g,item:m})}return a},t.prototype.stackMoveOneStep=function(t,e){var n=!0;for(i=0,iMax=e.length;iMax>i;i++){var s=e[i],r=s.item,o=parseInt(r.top),a=parseInt(s.top),l=a-o;if(l){var h=a==o?0:a>o?1:-1;Math.abs(l)>4&&(h=l/4);var c=parseInt(o+h);c!=a&&(n=!1),r.top=c,r.bottom=r.top+r.height}else r.top=s.top,r.bottom=s.bottom;r.left=s.left,r.right=s.right}return n},t.prototype.stackMoveToFinal=function(t,e){for(i=0,iMax=t.length;iMax>i;i++){var n=t[i],s=e[i];n.left=s.left,n.top=s.top,n.right=s.right,n.bottom=s.bottom}},t.prototype.stackEventsCheckOverlap=function(t,e,i,n){eventMargin=this.options.eventMargin,collision=this.collision;for(var s=t[e],r=n;r>=i;r--){var o=t[r];if(collision(s,o,eventMargin)&&r!=e)return o}},t.prototype.collision=function(t,e,i){return void 0==i&&(i=0),t.left-i<e.right&&t.right+i>e.left&&t.top-i<e.bottom&&t.bottom+i>e.top},t.prototype.trigger=function(e){var i=null;switch(e){case"rangechange":case"rangechanged":i={start:new Date(this.start),end:new Date(this.end)};break;case"timechange":case"timechanged":i={time:new Date(this.customTime)}}t.events.trigger(this,e,i)},t.events=t.events||{listeners:[],indexOf:function(t){for(var e=this.listeners,i=0,n=this.listeners.length;n>i;i++){var s=e[i];if(s&&s.object==t)return i}return-1},addListener:function(t,e,i){var n=this.indexOf(t),s=this.listeners[n];s||(s={object:t,events:{}},this.listeners.push(s));var r=s.events[e];r||(r=[],s.events[e]=r),-1==r.indexOf(i)&&r.push(i)},removeListener:function(t,e,i){var n=this.indexOf(t),s=this.listeners[n];if(s){var r=s.events[e];if(r){var n=r.indexOf(i);-1!=n&&r.splice(n,1),0==r.length&&delete s.events[e]}var o=0,a=s.events;for(var e in a)a.hasOwnProperty(e)&&o++;0==o&&delete this.listeners[n]}},removeAllListeners:function(){this.listeners=[]},trigger:function(t,e,i){var n=this.indexOf(t),s=this.listeners[n];if(s){var r=s.events[e];if(r)for(var o=0,a=r.length;a>o;o++)r[o](i)}}},t.StepDate=function(e){this.options=e,this.current=this.getDate(),this._start=this.getDate(),this._end=this.getDate(),this.autoScale=!0,this.scale=t.StepDate.SCALE.DAY,this.step=1,this.setRange(e.start,e.end,e.minimumStep)},t.StepDate.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,MONTH:6,YEAR:7},t.StepDate.prototype.getDate=function(t){return this.options.utc?t?new XDate(t,!0):new XDate(!0):t?new XDate(t):new XDate},t.StepDate.prototype.setRange=function(t,e,i){isNaN(t)||isNaN(e)||(this._start=void 0!=t?this.getDate(t):this.getDate(),this._end=void 0!=e?this.getDate(e):this.getDate(),this.autoScale&&this.setMinimumStep(i))},t.StepDate.prototype.start=function(){this.current=this.getDate(this._start),this.roundToMinor()},t.StepDate.prototype.roundToMinor=function(){switch(this.scale){case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step)),this.current.setMonth(0);case t.StepDate.SCALE.MONTH:this.current.setDate(1);case t.StepDate.SCALE.DAY:this.current.setHours(0);case t.StepDate.SCALE.HOUR:this.current.setMinutes(0);case t.StepDate.SCALE.MINUTE:this.current.setSeconds(0);case t.StepDate.SCALE.SECOND:this.current.setMilliseconds(0)}if(1!=this.step)switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case t.StepDate.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case t.StepDate.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case t.StepDate.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case t.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()-1-(this.current.getDate()-1)%this.step+1);break;case t.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step)}},t.StepDate.prototype.end=function(){return this.current.getTime()>this._end.getTime()},t.StepDate.prototype.next=function(){var e=this.current.getTime();if(this.current.getMonth()<6)switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current=this.getDate(this.current.getTime()+this.step,!0);break;case t.StepDate.SCALE.SECOND:this.current=this.getDate(this.current.getTime()+1e3*this.step);break;case t.StepDate.SCALE.MINUTE:this.current=this.getDate(this.current.getTime()+60*1e3*this.step);break;case t.StepDate.SCALE.HOUR:this.current=this.getDate(this.current.getTime()+60*60*1e3*this.step);var i=this.current.getHours();this.current.setHours(i-i%this.step);break;case t.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case t.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}else switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current=this.getDate(this.current.getTime()+this.step);break;case t.StepDate.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case t.StepDate.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case t.StepDate.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case t.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case t.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}if(1!=this.step)switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current.getMilliseconds()<this.step&&this.current.setMilliseconds(0);break;case t.StepDate.SCALE.SECOND:this.current.getSeconds()<this.step&&this.current.setSeconds(0);break;case t.StepDate.SCALE.MINUTE:this.current.getMinutes()<this.step&&this.current.setMinutes(0);break;case t.StepDate.SCALE.HOUR:this.current.getHours()<this.step&&this.current.setHours(0);break;case t.StepDate.SCALE.DAY:this.current.getDate()<this.step+1&&this.current.setDate(1);break;case t.StepDate.SCALE.MONTH:this.current.getMonth()<this.step&&this.current.setMonth(0);break;case t.StepDate.SCALE.YEAR:}this.current.getTime()==e&&(this.current=this.getDate(this._end))},t.StepDate.prototype.getCurrent=function(){return this.current},t.StepDate.prototype.setScale=function(t,e){this.scale=t,e>0&&(this.step=e),this.autoScale=!1},t.StepDate.prototype.setAutoScale=function(t){this.autoScale=t},t.StepDate.prototype.setMinimumStep=function(e){if(void 0!=e){var i=31104e6,n=2592e6,s=864e5,r=36e5,o=6e4,a=1e3,l=1;1e3*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=1e3),500*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=500),100*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=100),50*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=50),10*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=10),5*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=5),i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=1),3*n>e&&(this.scale=t.StepDate.SCALE.MONTH,this.step=3),n>e&&(this.scale=t.StepDate.SCALE.MONTH,this.step=1),5*s>e&&(this.scale=t.StepDate.SCALE.DAY,this.step=5),2*s>e&&(this.scale=t.StepDate.SCALE.DAY,this.step=2),s>e&&(this.scale=t.StepDate.SCALE.DAY,this.step=1),4*r>e&&(this.scale=t.StepDate.SCALE.HOUR,this.step=4),r>e&&(this.scale=t.StepDate.SCALE.HOUR,this.step=1),15*o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=15),10*o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=10),5*o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=5),o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=1),15*a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=15),10*a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=10),5*a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=5),a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=1),200*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=200),100*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=100),50*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=50),10*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=10),5*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=5),l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=1)}},t.StepDate.prototype.snap=function(e){if(this.scale==t.StepDate.SCALE.YEAR){var i=e.getFullYear()+Math.round(e.getMonth()/12);e.setFullYear(Math.round(i/this.step)*this.step),e.setMonth(0),e.setDate(0),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.MONTH)e.getDate()>15?(e.setDate(1),e.setMonth(e.getMonth()+1)):e.setDate(1),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);else if(this.scale==t.StepDate.SCALE.DAY){switch(this.step){case 5:case 2:e.setHours(24*Math.round(e.getHours()/24));break;default:e.setHours(12*Math.round(e.getHours()/12))}e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.HOUR){switch(this.step){case 4:e.setMinutes(60*Math.round(e.getMinutes()/60));break;default:e.setMinutes(30*Math.round(e.getMinutes()/30))}e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.MINUTE){switch(this.step){case 15:case 10:e.setMinutes(5*Math.round(e.getMinutes()/5)),e.setSeconds(0);break;case 5:e.setSeconds(60*Math.round(e.getSeconds()/60));break;default:e.setSeconds(30*Math.round(e.getSeconds()/30))}e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.SECOND)switch(this.step){case 15:case 10:e.setSeconds(5*Math.round(e.getSeconds()/5)),e.setMilliseconds(0);break;case 5:e.setMilliseconds(1e3*Math.round(e.getMilliseconds()/1e3));break;default:e.setMilliseconds(500*Math.round(e.getMilliseconds()/500))}else if(this.scale==t.StepDate.SCALE.MILLISECOND){var n=this.step>5?this.step/2:1;e.setMilliseconds(Math.round(e.getMilliseconds()/n)*n)}},t.StepDate.prototype.isMajor=function(){switch(this.scale){case t.StepDate.SCALE.MILLISECOND:return 0==this.current.getMilliseconds();case t.StepDate.SCALE.SECOND:return 0==this.current.getSeconds();case t.StepDate.SCALE.MINUTE:return 0==this.current.getHours()&&0==this.current.getMinutes();case t.StepDate.SCALE.HOUR:return 0==this.current.getHours();case t.StepDate.SCALE.DAY:return 1==this.current.getDate();case t.StepDate.SCALE.MONTH:return 0==this.current.getMonth();case t.StepDate.SCALE.YEAR:return!1;default:return!1}},t.StepDate.prototype.getLabelMinor=function(e){var i=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");switch(void 0==e&&(e=this.current),this.scale){case t.StepDate.SCALE.MILLISECOND:return String(e.getMilliseconds());case t.StepDate.SCALE.SECOND:return String(e.getSeconds());case t.StepDate.SCALE.MINUTE:return this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2);case t.StepDate.SCALE.HOUR:return this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2);case t.StepDate.SCALE.DAY:return String(e.getDate());case t.StepDate.SCALE.MONTH:return i[e.getMonth()];case t.StepDate.SCALE.YEAR:return String(e.getFullYear());default:return""}},t.StepDate.prototype.getLabelMajor=function(e){var i=new Array("January","February","March","April","May","June","July","August","September","October","November","December"),n=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");switch(void 0==e&&(e=this.current),this.scale){case t.StepDate.SCALE.MILLISECOND:return this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2)+":"+this.addZeros(e.getSeconds(),2);case t.StepDate.SCALE.SECOND:return e.getDate()+" "+i[e.getMonth()]+" "+this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2);case t.StepDate.SCALE.MINUTE:return n[e.getDay()]+" "+e.getDate()+" "+i[e.getMonth()]+" "+e.getFullYear();case t.StepDate.SCALE.HOUR:return n[e.getDay()]+" "+e.getDate()+" "+i[e.getMonth()]+" "+e.getFullYear();case t.StepDate.SCALE.DAY:return i[e.getMonth()]+" "+e.getFullYear();case t.StepDate.SCALE.MONTH:return String(e.getFullYear());default:return""}},t.StepDate.prototype.addZeros=function(t,e){for(var i=""+t;i.length<e;)i="0"+i;return i},t.imageloader=function(){function t(t){if(1==n[t])return!0;var e=new Image;return e.src=t,e.complete?!0:!1}function e(t){return void 0!=s[t]}function i(i,r,o){if(void 0==o&&(o=!0),t(i))return o&&r(i),void 0;if(!e(i)||o){var a=s[i];if(!a){var l=new Image;l.src=i,a=[],s[i]=a,l.onload=function(){n[i]=!0,delete s[i];for(var t=0;t<a.length;t++)a[t](i)}}-1==a.indexOf(r)&&a.push(r)}}var n={},s={};return{isLoaded:t,isLoading:e,load:i}}(),t.addEventListener=function(t,e,i,n){t.addEventListener?(void 0===n&&(n=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,n)):t.attachEvent("on"+e,i)},t.removeEventListener=function(t,e,i,n){t.removeEventListener?(void 0===n&&(n=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,n)):t.detachEvent("on"+e,i)},t.getTarget=function(t){if(!t)var t=window.event;var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!==e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},t.stopPropagation=function(t){if(!t)var t=window.event;t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},t.preventDefault=function(t){if(!t)var t=window.event;t.preventDefault?t.preventDefault():t.returnValue=!1},t.getAbsoluteLeft=function(t){for(var e=0;null!=t;)e+=t.offsetLeft,e-=t.scrollLeft,t=t.offsetParent;return!document.body.scrollLeft&&window.pageXOffset&&(e-=window.pageXOffset),e},t.getAbsoluteTop=function(t){for(var e=0;null!=t;)e+=t.offsetTop,e-=t.scrollTop,t=t.offsetParent;return!document.body.scrollTop&&window.pageYOffset&&(e-=window.pageYOffset),e},t.isArray=function(t){return t instanceof Array?!0:"[object Array]"===Object.prototype.toString.call(t)},t}),define("view/alerttimeline",["timeline","view/base"],function(t,e){var i=e.extend({events:{"shown .accordion-body":"publishTimelineHeight","hidden .accordion-body":"publishTimelineHeight"},subscriptions:{"view:dashboard:complete":"render"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.dashboardId=t.dashboardId,this.status=t.status,this.popovers=[],this.openPopovers=[],this.alertData=[]},render:function(){this.templar.render({path:"alerttimeline",el:this.$el,data:{}}),this.$timeline=this.$el.find(".alert-timeline .accordion-inner"),this.$accordion=this.$el.find(".alert-timeline .accordion-body")},addPopover:function(){var t=this;jobAlertIdList=_.uniq(t.jobAlertList);for(var e=jobAlertIdList.length-1;e>=0;e--){var i=function(e){var i=$("<div class='timeline-monitor'>"),n=$("<button/>",{text:"Troubleshoot Monitor","class":"btn"}),s=$(".timeline-group-"+e);s.popover({trigger:"manual",html:!0,placement:"bottom",delay:{show:100,hide:200},container:"body",content:i}).click(function(s){s.stopPropagation();var r=$(this);_.each(t.openPopovers,function(t){t.data("popover").tip().removeClass("active"),t.data("popover").hide()}),t.openPopovers=[],r.toggleClass("active").hasClass("active")?(n.off("click"),$("body").off("click"),r.popover("show"),t.showOverlay(i.parent(),"Loading...","alert-data-overlay"),t.loadAlertIncidentData(e,r,i,function(i){var s=t.createMetaTable(i);r.data("popover").tip().find(".alert-meta-data").length>0?r.data("popover").tip().find(".alert-meta-data").replaceWith(s):r.data("popover").tip().append(s),r.data("popover").tip().append(n),n.on("click",function(i){i.stopPropagation(),r.popover("hide"),r.toggleClass("active"),n.off("click"),t.openPopovers=[],Backbone.Mediator.pub("view:alerttimeline:troubleshoot",e)}),t.openPopovers.push(r),$("body").on("click",function(){t.openPopovers=[],r.removeClass("active"),r.popover("hide")})})):(t.openPopovers=[],r.popover("hide"))})};i(jobAlertIdList[e])}},loadAlertIncidentData:function(t,e,i,n){var s=this,r=s.collection.get(t),o=/timeline-event-(\d+)/g,a=parseInt(o.exec(e.attr("class"))[1]),l=_.findWhere(s.alertData,{id:a}),h=r.get("name"),c=new XDate(l.start),u=new XDate(l.end),d=r.toJSON(),p=c.diffMinutes(u),f=c.diffHours(u);d.toDate=u.toString("MM/dd/yyyy HH:mm"),d.minutes=500>p?p:500;var m=s.initGraph(i[0]);$.ajax({url:"/monitor.json",type:"post",data:r.toJSON(),async:!1,success:function(t){if("success"==t.status){var e=s.formatGraphData(t.graph_data);s.renderGraphData(m,e),"function"==typeof n&&n({name:h,start:c.toString("MM/dd/yyyy HH:mm"),end:u.toString("MM/dd/yyyy HH:mm"),hrs:Math.floor(f),min:Math.floor(p%60)}),s.hideOverlay(i.parent())}}})},createMetaTable:function(t){return $("<table class='alert-meta-data'><tr><th>Name</th><td>"+t.name+"</td></tr><tr><th>Start</th><td>"+t.start+"</td></tr><tr><th>End</th><td>"+t.end+"</td></tr><tr><th>Duration</th><td>"+t.hrs+" hr "+t.min+" min"+"</td></tr></table>")},publishTimelineHeight:function(){var t=this;Backbone.Mediator.pub("view:alerttimeline:toggle",t.$accordion.height()),$(document.body).css("overflow","auto")},setAlertStatus:function(){var t=this;this.status&&t.$el.find(".icon-bell-alt").addClass("alert-status")},setupAlertTimeline:function(){var e=this,i=[];$.ajax("/dashboards/"+e.dashboardId+"/errors",{success:function(n){_.each(n,function(t){var n=null;_.extend(t,{name:"undefined"!=typeof e.collection.get(t.jobId)?e.collection.get(t.jobId).get("name"):""}),n=e.formatServerDateTime(t.date,!0)<new XDate(Date.now(),!0).addWeeks(-2)?new XDate(Date.now(),!0).addWeeks(-2):e.formatServerDateTime(t.date,!0),e.alertData.push({id:t.id,jobId:t.jobId,start:n,end:t.endDate?e.formatServerDateTime(t.endDate,!0):e.formatServerDateTime(Date.now(),!0),status:t.status,content:t.name}),i.push(t.jobId)}),e.timeline=new t(e.$timeline[0]);var s=new XDate(Date.now()-864e5,!0),r=new XDate(Date.now()+432e5,!0);e.timeline.draw(e.alertData,{utc:!0,start:s,end:r,width:"100%",editable:!1,style:"box",intervalMin:6e5,intervalMax:2592e5}),e.$timeline.on("mouseenter",function(){$(window).on("scroll",e.stopBrowserScroll)}),e.$timeline.on("mouseleave",function(){$(window).off("scroll",e.stopBrowserScroll)}),e.jobAlertList=i,e.addPopover()}})},stopBrowserScroll:function(){window.scrollTo(0,0)},showOverlay:function(t,e,i){var n=this;if(t=$(t),!n.overlay){var i=i?i:"";t.data("overlay",$("<div class='overlay "+i+"'><h1></h1></div>")),t.append(t.data("overlay"))}t.data("overlay").find("h1").html(e),t.data("overlay").show()},hideOverlay:function(t){t.data("overlay").hide()},destructor:function(){var t=this,e=t.$el.prev();t.destroySubscriptions(),t.remove(),t.unbind(),t.off(),t.$el.empty(),$("<section class='timeline-wrap clearfix'></section>").insertAfter(e)}});return i}),define("view/dashboard",["view/base","model/monitor","collection/monitor","view/smallmonitor","view/expandedmonitor","view/addmonitor","view/resetmonitor","view/alerttimeline","codemirror","codemirror-ruby","jquery-validate"],function(t,e,i,n,s,r,o,a){var l=t.extend({rowMonitorLimit:3,events:{"slid .carousel":"advanceCarousel"},subscriptions:{"view:expandedmonitor:open":"hideDash","view:expandedmonitor:exit":"updateDash","view:addmonitor:close":"showDash","view:addmonitor:save":"updateDash","view:addmonitor:show":"hideDash","view:smallmonitor:edit":"editMonitor","view:alerttimeline:troubleshoot":"editMonitor"},hidePrevCaption:function(){this.$el.find(".carousel-caption").parent().children(".carousel-caption p").hide()},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.dashboardId=t.dashboardId?t.dashboardId:null,this.categoryId=t.categoryId?t.categoryId:null,this.user=t.user?t.user:null,this.router=t.router?t.router:null,this.categories=[],this.monitors=[],this.monitorCollections=[],this.currentOrder=[],this.carouselIndex=0,this.expandedMonitorView=new s({el:$(".edit-monitor-wrap"),user:this.user,templar:this.templar,router:this.router}),this.addMonitorView=new r({model:new e({dashboardId:this.dashboardId}),user:this.user,dashboardId:this.dashboardId,templar:this.templar}),this.alertTimelineView=new a({el:$(".timeline-wrap"),collection:this.collection,dashboardId:this.dashboardId,user:this.user,status:this.checkDashboardAlertState(),templar:this.templar}),this.resetMonitorView=new o({el:$(".reset-monitor-wrap"),templar:this.templar}),this.addHelpers(),Backbone.Mediator.pub("view:dashboard:init")},render:function(){return this.initMonitors(),this},initMonitors:function(){this.getCategories(),this.categories.length&&null==this.categoryId&&Backbone.Mediator.pub("view:dashboard:category",this.setCategoryId(this.categories[this.carouselIndex].id)),this.getDashboardInfo(this.dashboardId,function(t){Backbone.Mediator.pub("view:dashboard:render",{title:t,subtitle:this.getDashboardSubtitle(this.getCategoryIndex()),nav:{ecosystem:!1,dashboard:!0},dashboardId:this.dashboardId})}.bind(this)),this.updateMonitorList(),this.setupCarousel(),this.setupDrop(),this.goToCategory(),Backbone.Mediator.pub("view:dashboard:complete")},setCategories:function(t){_.each(t,function(t,e){t.children.length&&this.categories.splice(e,1)},this),this.categories=t},getCategories:function(){$.ajax({url:"/dashboards/"+this.dashboardId+"/children",async:!1,success:function(t){var e=t;this.setCategories(e)}.bind(this)})},setupDrop:function(){this.$monitorDragWraps=$(".small-monitor-drag"),this.$monitorWraps=$(".small-monitor-wrap"),this.$monitorWraps.droppable({accept:".small-monitor",over:function(t,e){$(t.target).addClass("active-drop"),e.draggable.draggable("option","revert",!1)},out:function(t,e){$(t.target).removeClass("active-drop"),e.draggable.draggable("option","revert",!0)},drop:function(t){$(t.target).removeClass("active-drop"),$(window).trigger("resize")}})},setupCarousel:function(){this.$carousel=$("#dashboardCarousel").carousel({interval:!1}),this.$el.find(".icon-chevron-sign-right").click(function(){this.$carousel.carousel("next")}.bind(this)),this.$el.find(".icon-chevron-sign-left").click(function(){this.$carousel.carousel("prev")}.bind(this))},getDashboardSubtitle:function(t){this.getCategories();var e="";return e=this.categories.length>=1&&this.parentDashboardInfo.id!==this.getCategoryId()?_.str.capitalize(this.categories[t].name)+" Dashboard":"Monitor Dashboard"},publishDashboardSubtitle:function(t){Backbone.Mediator.pub("view:dashboard:render",{subtitle:this.getDashboardSubtitle(t)})},advanceCarousel:function(t){t&&t.stopPropagation(),this.carouselIndex=this.$el.find(".item.active").index(".item"),this.setCategoryId(this.categories.length?this.categories[this.carouselIndex].id:this.getCategoryId()),this.router.navigate("dash/"+this.dashboardId+"/category/"+this.getCategoryId()),this.$el.find(".dashboard-"+this.getCategoryId()).css({"min-height":this.$el.find(".dashboard-"+this.getCategoryId()+" .monitor-grid").height()+40}),this.publishDashboardSubtitle(this.carouselIndex),Backbone.Mediator.pub("view:dashboard:category",this.getCategoryId()),$(window).trigger("resize")},getCategoryIndex:function(){var t=0;return _.each(this.categories,function(e,i){this.getCategoryId()===e.id&&(t=i)},this),t},goToCategory:function(){this.getCategoryIndex()&&(this.$carousel.toggleClass("slide"),this.$carousel.carousel(this.getCategoryIndex()),this.$carousel.toggleClass("slide")),this.categories.length<=1&&this.$el.find(".carousel-indicators, .carousel-control").hide()},getCategoryId:function(){return this.categoryId},setCategoryId:function(t){return this.categoryId=_.isNull(t)?this.categoryId:t,this.getCategoryId()},getMonitorOrder:function(){var t=this.user.get("preferences");if(this.categories.length)_.each(this.categories,function(e){var i=t.dashboards&&!_.isEmpty(t.dashboards[e.id])?t.dashboards[e.id].order:[];this.currentOrder[e.id]=i},this);else{var e=t.dashboards&&!_.isEmpty(t.dashboards[this.parentDashboardInfo.id])?t.dashboards[this.parentDashboardInfo.id].order:[];this.currentOrder[this.parentDashboardInfo.id]=e}return this.currentOrder},getDashboardInfo:function(t,e){$.ajax({url:"/dashboards/"+t,async:!1,success:function(t){this.parentDashboardInfo=t,"function"==typeof e&&e(this.parentDashboardInfo.name)}.bind(this),error:function(){}.bind(this),complete:function(){}.bind(this)})},editMonitor:function(t){this.expandedMonitorView.render(t,this.categories,this.getCategoryId(),this.dashboardId)},updateDash:function(t){t&&t.status&&"error"!=t.status&&(this.collection=new i(null,{dashboardId:this.dashboardId}),this.reinitializeDash(t)),this.showDash()},reinitializeDash:function(){this.$el.parent(),this.router.navigate(),this.getCategoryId()?this.router.navigate("dash/"+this.dashboardId+"/category/"+this.getCategoryId(),{trigger:!0}):this.router.navigate("dash/"+this.dashboardId,{trigger:!0})},hideDash:function(){this.$el.hide()},showDash:function(){this.$el.show(),$(window).trigger("resize")},updateSavedMonitorStatus:function(t){var e=t?t.model:null;e&&_.each(this.monitors,function(t){t.model.get("id")===e.get("id")&&t.nextRun()})},checkDashboardAlertState:function(){return this.collection.each(function(t){"success"!==t.get("status")&&"undefined"!=typeof t.get("status")&&t.get("active")&&(this.dashboardAlert=!0)}),this.dashboardAlert&&Backbone.Mediator.pub("view:dashboard:alert"),this.dashboardAlert},updateMonitorList:function(){var t=[],e=[];if(this.getMonitorOrder(),Handlebars.registerHelper("mod",function(t,e){return 0===parseInt(t,10)%this.rowMonitorLimit?e.fn(this):void 0}.bind(this)),this.categories.length)_.each(this.categories,function(t){var e=new i(null,{dashboardId:t.id}),n=this.currentOrder[t.id];if(0!==n.length){var s=_.difference(e.pluck("id"),n);n=_.union(n,s),e.filterById(n)}this.monitorCollections.push(e),t.monitors=e.toJSON()},this),e=this.categories;else{var t=new i(null,{dashboardId:this.parentDashboardInfo.id}),s=this.currentOrder.length?this.currentOrder[this.parentDashboardInfo.id]:[];if(0!==s.length){var r=_.difference(t.pluck("id"),s);s=_.union(s,r),t.filterById(s)}this.monitorCollections.push(t),this.parentDashboardInfo.monitors=t.toJSON(),e.push(this.parentDashboardInfo)}this.templar.render({path:"dashboard",el:this.$el,data:{categories:e}}),_.each(this.monitorCollections,function(t){t.each(function(t){this.monitors.push(new n({el:this.$el.find(".small-monitor-"+t.get("id"))[0],model:t,dashboardId:this.dashboardId,templar:this.templar,user:this.user}).render())}.bind(this))},this)},destroyMonitors:function(){for(viewName in this.monitors){var t=this.monitors[viewName];t.destructor(),delete this.monitors[viewName]}},destructor:function(){var t=this.$el.parent();this.destroyMonitors(),this.collection.off("remove",this.reinitializeDash,this),this.destroySubscriptions(),this.expandedMonitorView.destructor(),this.addMonitorView.destructor(),this.alertTimelineView.destructor(),this.resetMonitorView.destructor(),this.monitors=[],this.categories=[],this.$el.empty(),this.$el.remove(),this.off(),t.prepend("<div class='monitor-panel container clearfix'>")}});return l}),define("model/dashboard",["model/base"],function(t){var e=t.extend({initialize:function(t){this.category=t?t.category:!1,this.dashboardId=t?t.dashboardId:null},url:function(){return this.category?this.dashboardId?"/dashboards/"+this.dashboardId+"/children.json":"/dashboards.json":this.get("id")?"/dashboards/"+this.get("id"):"/dashboards.json"},parse:function(t){return t.createdAt=t.createdAt?this.formatServerDateTime(t.createdAt):t.createdAt,t.modifiedAt=t.modifiedAt?this.formatServerDateTime(t.modifiedAt):t.modifiedAt,t},defaults:{id:null,userId:null,name:"Default",createdAt:null,modifiedAt:null,description:null,children:[]}});return e}),define("view/adddashboard",["view/base","model/dashboard","jquery-validate"],function(t,e){var i=t.extend({events:{"click .saveCloseDashboard":"checkValidationClose","click .saveDashboard":"checkValidation","hidden #addDashboard":"_cleanUp","shown #addDashboard":"focusFirst"},initialize:function(t){_.bind(this,"checkValidation","_cleanUp"),this.user=t.user,this.templar=t.templar},render:function(){this.templar.render({path:"adddashboard",el:this.$el,data:{}}),this.$modal=this.$el.find(".add-dashboard"),this.resizeModal($("#addDashboard"),"small",!0),this.setAddDashboardValidation()},setAddDashboardValidation:function(){this.form=$("#addDashboardForm"),this.validator=this.form.validate({rules:{dashboardName:{required:!0}},highlight:function(t){$(t).closest(".control-group").addClass("error")},success:function(t){t.closest(".control-group").removeClass("error"),$(t).remove()},submitHandler:function(){this.close?this.saveFinish():this.save()}.bind(this)})},checkValidation:function(){this.close=!1,this.form.submit()},checkValidationClose:function(){this.close=!0,this.form.submit()},save:function(){this._saveDashboard(function(){this._cleanUp()}.bind(this))},saveFinish:function(){this._saveDashboard(function(){this._closeModal()}.bind(this))},destructor:function(){var t=this.$el.prev();this.remove(),this.off(),this.$el=$("<section class='add-dashboard-wrap'></section>").insertAfter(t)},_saveDashboard:function(t){this.model.save({userId:this.user.get("id"),name:this.$el.find("#dashboardName").val(),description:this.$el.find("#dashboardDescription").val()},{success:function(e){this.collection.add(e),Backbone.Mediator.pub("view:adddashboard:save",{model:e,message:"The dashboard '"+e.get("name")+"' was added.",attention:"Dashboard Saved!"}),"function"==typeof t&&t()
396
- }.bind(this),error:function(){this.validator.showErrors({dashboardName:"That dashboard name already exists!"})}.bind(this)})},_closeModal:function(){this._cleanUp(),this.$modal.modal("hide")},_cleanUp:function(){this.$el.find("#dashboardName").val(""),this.$el.find("#dashboardDescription").val(""),this.$el.find("#dashboardName").parent().removeClass("error"),this.validator.resetForm(),this.model=new e}});return i}),define("view/addcategory",["view/base","model/dashboard","collection/monitor","jquery-validate"],function(t,e,i){var n=t.extend({events:{"click .saveCloseCategory":"checkValidationClose","click .saveCategory":"checkValidation","hidden #addCategory":"_cleanUp","shown #addCategory":"focusFirst"},subscriptions:{"view:dashboard:add":"_openModal"},initialize:function(t){_.bindAll(this),this.user=t.user,this.templar=t.templar,Handlebars.registerHelper("toUpperCase",function(t){return"string"==typeof t?t.toUpperCase():t})},render:function(t){this.dashboard=t?t.dashboard:null,this.templar.render({path:"addcategory",el:this.$el,data:t?t:{}}),this.setElement(this.$el),this.setAddCategoryValidation(),this.$modal=this.$el.find(".add-category"),this.resizeModal($("#addCategory"),"small",!0)},setAddCategoryValidation:function(){this.form=$("#addCategoryForm"),this.validator=this.form.validate({rules:{categoryName:{required:!0}},highlight:function(t){$(t).closest(".control-group").addClass("error")},success:function(t){t.closest(".control-group").removeClass("error"),$(t).remove()},submitHandler:function(){this.close?this.saveFinish():this.save()}.bind(this)})},checkValidation:function(){this.close=!1,this.form.submit()},checkValidationClose:function(){this.close=!0,this.form.submit()},save:function(){this._saveCategory(function(){this._cleanUp()}.bind(this))},saveFinish:function(){this._saveCategory(function(){this._closeModal()}.bind(this))},updateMonitorOrder:function(t){var e=this.user.get("preferences");e.dashboards[this.dashboard.id]&&(e.dashboards[t.get("id")]=e.dashboards[this.dashboard.id],e.dashboards[this.dashboard.id]=null,this.user.save())},destructor:function(){var t=this.$el.prev();this.remove(),this.off(),this.$el=$("<section class='add-category-wrap'></section>").insertAfter(t)},_checkFirstCategoryCondition:function(t){new e({id:this.dashboard.id}).fetch({success:function(e){_.isFunction(t)&&t(e)}.bind(this)})},_moveAllCurrentMonitorsToCategory:function(){this.model.save({userId:this.user.get("id"),name:this.$el.find("#categoryName").val(),description:this.$el.find("#categoryDescription").val()},{success:function(t){Backbone.Mediator.pub("view:addcategory:save",{model:t,message:"The category '"+t.get("name")+"' was added.",attention:"Category Saved!"}),t.get("id")&&new i(null,{dashboardId:this.dashboard.id,cb:function(e){e.each(function(e){e.save({dashboardId:t.get("id")})},this),this.updateMonitorOrder(t)}.bind(this)})}.bind(this),error:function(){this.validator.showErrors({categoryName:"That category name already exists!"})}.bind(this)})},_saveCategory:function(t){this._checkFirstCategoryCondition(function(i){this.model=new e({category:!0,dashboardId:this.dashboard.id}),i.get("children").length?this.model.save({userId:this.user.get("id"),name:this.$el.find("#categoryName").val(),description:this.$el.find("#categoryDescription").val()},{success:function(e){Backbone.Mediator.pub("view:addcategory:save",{model:e,message:"The category '"+e.get("name")+"' was added.",attention:"Category Saved!"}),_.isFunction(t)&&t()}.bind(this),error:function(){this.validator.showErrors({categoryName:"That category name already exists!"})}.bind(this)}):(this._moveAllCurrentMonitorsToCategory(),_.isFunction(t)&&t())}.bind(this))},_closeModal:function(){this._cleanUp(),this.$modal.modal("hide")},_cleanUp:function(){this.$el.find("#categoryName").val(""),this.$el.find("#categoryDescription").val(""),this.$el.find("#categoryName").parent().removeClass("error"),this.validator.resetForm(),this.model=new e},_openModal:function(t){this.destructor(),this.render(t),this.$modal.modal("show")}});return n}),define("view/dashboardtile",["view/base"],function(t){var e=t.extend({events:{"click .save.btn":"save","click .settings.btn":"settings","click figure.front":"loadDashboard","click .cancel.btn":"settings","click .add.btn":"addCategory"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.intervalLength=t.intervalLength?t.intervalLength:60,this.render()},render:function(){this.templar.render({path:"dashboardtile",el:this.$el,append:!0,data:{dashboard:this.model.toJSON()}}),this.$dashboardTile=this.$el.find(".dashboard"+this.model.get("id")),this.setElement(this.$dashboardTile),this.startStatusCheck()},loadDashboard:function(){location.href="#dash/"+this.model.get("id")},addCategory:function(){Backbone.Mediator.pub("view:dashboard:add",{dashboard:{id:this.model.get("id"),name:this.model.get("name"),children:this.model.get("children")}})},startStatusCheck:function(){this.updateTile(),this.interval=setInterval(function(){this.updateTile()}.bind(this),1e3*this.intervalLength),clearInterval(this.interval)},updateTile:function(){$.ajax({url:"/dashboards/"+this.model.get("id")+"/jobs.json",success:function(t){_.map(t,function(t){t.createdAt=t.createdAt?this.formatServerDateTime(t.createdAt,!0):t.createdAt,t.modifiedAt=t.modifiedAt?this.formatServerDateTime(t.modifiedAt,!0):t.modifiedAt},this),this.checkErrorState(t)}.bind(this)})},checkErrorState:function(t){for(var e=!1,i=t.length-1;i>=0;i--)if("success"!=t[i].status&&"undefined"!=typeof t[i].status&&t[i].active){e=!0;break}e?this.$el.find(".dashboard"+this.model.get("id")).addClass("red"):this.$el.find(".dashboard"+this.model.get("id")).removeClass("red")},settings:function(t){t.stopPropagation(),this.$dashboardTile.toggleClass("flipped"),setTimeout(function(){this.$dashboardTile.find(".front .btn").toggle()}.bind(this),600)},save:function(t){t.stopPropagation(),this.model.save({name:this.$dashboardTile.find(".dashboard-name").val()},{success:function(){Backbone.Mediator.pub("view:dashboard:save",{model:this.model,message:"Your changes to '"+this.model.get("name")+"' dashboard were saved.",attention:"Dashboard Saved!"})}.bind(this),error:function(t){Backbone.Mediator.pub("view:dashboard:save",{model:this.model,message:"The dashboard '"+t.get("name")+"' produced an error during the process of saving.",attention:"Dashboard Save Error!",status:"error"})}.bind(this)})},destructor:function(){clearInterval(this.interval),this.remove(),this.$el.remove(),this.off(),this.model.off()}});return e}),define("view/ecosystem",["view/base","view/dashboardtile"],function(t,e){var i=t.extend({dashboards:[],subscriptions:{"view:addcategory:save":"update","view:adddashboard:save":"update","view:dashboard:render":"destructor","view:dashboard:save":"update"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.dashboards=[]},render:function(){this.collection.each(function(t){this.dashboards.push(new e({el:this.el,model:t,templar:this.templar}))}.bind(this)),this.paddingFix(),Backbone.Mediator.pub("view:ecosystem:render",{title:"Ecosystem",subtitle:"Rearview Dashboards",nav:{ecosystem:!0,dashboard:!1}})},paddingFix:function(){this.$el.css("padding-bottom","40px")},update:function(t){t&&t.model?t.model:null,this.$el.empty(),this.collection.fetch({success:function(){this.render()}.bind(this)})},destroyDashboards:function(){var t=this;for(viewName in t.dashboards){var e=t.dashboards[viewName];e.destructor(),delete t.dashboards[viewName]}},destructor:function(){var t=this.$el.prev();this.destroySubscriptions(),this.destroyDashboards(),this.off(),this.collection.off(),this.remove(),t.after("<section class='ecosystem-dashboard-wrap'>")}});return i}),define("view/secondarynav",["view/base"],function(t){var e=t.extend({initialize:function(t){this.templar=t.templar,_.bindAll(this),this.currentNav={secondary:{nav:{ecosystem:!0,dashboard:!1}}},Backbone.Mediator.sub("view:dashboard:render",this.render,this),Backbone.Mediator.sub("controller:dashboard:init",this.render,this),this.render()},render:function(t){this.destructor(),this.previous=self.currentNav,_.extend(this.currentNav.secondary,t),this.templar.render({path:"secondarynav",el:this.$el,data:this.currentNav})},destructor:function(){this.$el.empty()}});return e}),define("view/settings",["view/base","jquery-validate"],function(t){var e=t.extend({el:".settings",events:{"click .saveSettings":"saveSettings","click .saveCloseSettings":"saveCloseSettings"},initialize:function(t){_.bindAll(this,"saveSettings","saveCloseSettings","render"),this.user=t.user,this.templar=t.templar},render:function(){this.templar.render({path:"settings",el:this.$el,data:{user:this.user.toJSON()}}),this.$modal=this.$el.find(".settings"),this.resizeModal($("#settings"),"small",!0)},saveSettings:function(){this.user.applyPrefs({alertKeys:this.parseAlertKeys(this.$el.find(".alert-settings textarea").val())}),this.user.save({},{success:function(){Backbone.Mediator.pub("view:settings:save",{model:this.user,message:"message",attention:"attention"})}.bind(this),error:function(){}.bind(this)})},saveCloseSettings:function(){this.saveSettings(),this.$modal.modal("hide")},destructor:function(){var t=this.$el.prev();this.remove(),this.off(),this.$el=$("<section class='settings-wrap'></section>").insertAfter(t)},_closeModal:function(){this._cleanUp(),this.$modal.modal("hide")},_cleanUp:function(){}});return e}),define("model/user",["model/base","backbone-mediator"],function(t){var e=t.extend({url:"/user.json",defaults:{id:null,email:"",firstName:"",lastName:"",lastLogin:null,createdAt:null,modifiedAt:null,preferences:{}},parse:function(t){return t.createdAt&&(t.createdAt=this.formatServerDateTime(t.createdAt)),t.modifiedAt&&(t.modifiedAt=this.formatServerDateTime(t.modifiedAt)),t.preferences||(t.preferences={},t.preferences.dashboards||(t.preferences.dashboards=[])),t},convertApplicationPrefs:function(){var t=this.get("preferences");t.applications&&(t.dashboards=t.applications,this.set("preferences",t),delete t.applications,this.save())},applyPrefs:function(t){var e=this.get("preferences");this.set("preferences",_.extend(e,t))},updatePrefs:function(t){this.applyPrefs(t),this.save()},initialize:function(){_.bindAll(this),this.fetch({async:!1,success:function(){this.convertApplicationPrefs(),Backbone.Mediator.pub("model:user:init",this)}.bind(this)})}});return e}),define("collection/dashboard",["jquery","underscore","backbone","model/dashboard"],function(t,e,i,n){var s=i.Collection.extend({model:n,url:"/dashboards.json",comparator:function(t){return t.get("name").toLowerCase()},initialize:function(t,e){e&&(this.cb=e.cb),this.fetch({success:function(){this.cb&&this.cb(),i.Mediator.pub("collection:dashboard:init",this)}.bind(this),async:!1})}});return s}),function(t,e){function i(e,i){var s,r,o,a=e.nodeName.toLowerCase();return"area"===a?(s=e.parentNode,r=s.name,e.href&&r&&"map"===s.nodeName.toLowerCase()?(o=t("img[usemap=#"+r+"]")[0],!!o&&n(o)):!1):(/input|select|textarea|button|object/.test(a)?!e.disabled:"a"===a?e.href||i:i)&&n(e)}function n(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var s=0,r=/^ui-id-\d+$/;t.ui=t.ui||{},t.extend(t.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({focus:function(e){return function(i,n){return"number"==typeof i?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),n&&n.call(e)},i)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(i){if(i!==e)return this.css("zIndex",i);if(this.length)for(var n,s,r=t(this[0]);r.length&&r[0]!==document;){if(n=r.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(r.css("zIndex"),10),!isNaN(s)&&0!==s))return s;r=r.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,n){return!!t.data(e,n[3])},focusable:function(e){return i(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var n=t.attr(e,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(e,!s)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(i,n){function s(e,i,n,s){return t.each(r,function(){i-=parseFloat(t.css(e,"padding"+this))||0,n&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),s&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var r="Width"===n?["Left","Right"]:["Top","Bottom"],o=n.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+n]=function(i){return i===e?a["inner"+n].call(this):this.each(function(){t(this).css(o,s(this,i)+"px")})},t.fn["outer"+n]=function(e,i){return"number"!=typeof e?a["outer"+n].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,i)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(i){return arguments.length?e.call(this,t.camelCase(i)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,i,n){var s,r=t.ui[e].prototype;for(s in n)r.plugins[s]=r.plugins[s]||[],r.plugins[s].push([i,n[s]])},call:function(t,e,i){var n,s=t.plugins[e];if(s&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(n=0;s.length>n;n++)t.options[s[n][0]]&&s[n][1].apply(t.element,i)}},hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return e[n]>0?!0:(e[n]=1,s=e[n]>0,e[n]=0,s)}})}(jQuery),function(t,e){var i=0,n=Array.prototype.slice,s=t.cleanData;t.cleanData=function(e){for(var i,n=0;null!=(i=e[n]);n++)try{t(i).triggerHandler("remove")}catch(r){}s(e)},t.widget=function(i,n,s){var r,o,a,l,h={},c=i.split(".")[0];i=i.split(".")[1],r=c+"-"+i,s||(s=n,n=t.Widget),t.expr[":"][r.toLowerCase()]=function(e){return!!t.data(e,r)},t[c]=t[c]||{},o=t[c][i],a=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new a(t,i)},t.extend(a,o,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),l=new n,l.options=t.widget.extend({},l.options),t.each(s,function(i,s){return t.isFunction(s)?(h[i]=function(){var t=function(){return n.prototype[i].apply(this,arguments)},e=function(t){return n.prototype[i].apply(this,t)};return function(){var i,n=this._super,r=this._superApply;return this._super=t,this._superApply=e,i=s.apply(this,arguments),this._super=n,this._superApply=r,i}}(),e):(h[i]=s,e)}),a.prototype=t.widget.extend(l,{widgetEventPrefix:o?l.widgetEventPrefix:i},h,{constructor:a,namespace:c,widgetName:i,widgetFullName:r}),o?(t.each(o._childConstructors,function(e,i){var n=i.prototype;t.widget(n.namespace+"."+n.widgetName,a,i._proto)}),delete o._childConstructors):n._childConstructors.push(a),t.widget.bridge(i,a)},t.widget.extend=function(i){for(var s,r,o=n.call(arguments,1),a=0,l=o.length;l>a;a++)for(s in o[a])r=o[a][s],o[a].hasOwnProperty(s)&&r!==e&&(i[s]=t.isPlainObject(r)?t.isPlainObject(i[s])?t.widget.extend({},i[s],r):t.widget.extend({},r):r);return i},t.widget.bridge=function(i,s){var r=s.prototype.widgetFullName||i;t.fn[i]=function(o){var a="string"==typeof o,l=n.call(arguments,1),h=this;return o=!a&&l.length?t.widget.extend.apply(null,[o].concat(l)):o,a?this.each(function(){var n,s=t.data(this,r);return s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(n=s[o].apply(s,l),n!==s&&n!==e?(h=n&&n.jquery?h.pushStack(n.get()):n,!1):e):t.error("no such method '"+o+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+o+"'")}):this.each(function(){var e=t.data(this,r);e?e.option(o||{})._init():t.data(this,r,new s(o,this))}),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,n){n=t(n||this.defaultElement||this)[0],this.element=t(n),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),n!==this&&(t.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===n&&this.destroy()}}),this.document=t(n.style?n.ownerDocument:n.document||n),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(i,n){var s,r,o,a=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(a={},s=i.split("."),i=s.shift(),s.length){for(r=a[i]=t.widget.extend({},this.options[i]),o=0;s.length-1>o;o++)r[s[o]]=r[s[o]]||{},r=r[s[o]];if(i=s.pop(),n===e)return r[i]===e?null:r[i];r[i]=n}else{if(n===e)return this.options[i]===e?null:this.options[i];a[i]=n}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,n,s){var r,o=this;"boolean"!=typeof i&&(s=n,n=i,i=!1),s?(n=r=t(n),this.bindings=this.bindings.add(n)):(s=n,n=this.element,r=this.widget()),t.each(s,function(s,a){function l(){return i||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):e}"string"!=typeof a&&(l.guid=a.guid=a.guid||l.guid||t.guid++);var h=s.match(/^(\w+)\s*(.*)$/),c=h[1]+o.eventNamespace,u=h[2];u?r.delegate(u,c,l):n.bind(c,l)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?n[t]:t).apply(n,arguments)}var n=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,n){var s,r,o=this.options[e];if(n=n||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],r=i.originalEvent)for(s in r)s in i||(i[s]=r[s]);return this.element.trigger(i,n),!(t.isFunction(o)&&o.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(n,s,r){"string"==typeof s&&(s={effect:s});var o,a=s?s===!0||"number"==typeof s?i:s.effect||i:e;s=s||{},"number"==typeof s&&(s={duration:s}),o=!t.isEmptyObject(s),s.complete=r,s.delay&&n.delay(s.delay),o&&t.effects&&t.effects.effect[a]?n[e](s):a!==e&&n[a]?n[a](s.duration,s.easing,r):n.queue(function(i){t(this)[e](),r&&r.call(n[0]),i()})}})}(jQuery),function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var n=this,s=1===i.which,r="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return s&&!r&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return n._mouseMove(t)},this._mouseUpDelegate=function(t){return n._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function n(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var r,o=Math.max,a=Math.abs,l=Math.round,h=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(r!==e)return r;var i,n,s=t("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),i=o.offsetWidth,s.css("overflow","scroll"),n=o.offsetWidth,i===n&&(n=s[0].clientWidth),s.remove(),r=i-n},getScrollInfo:function(e){var i=e.isWindow?"":e.element.css("overflow-x"),n=e.isWindow?"":e.element.css("overflow-y"),s="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,r="scroll"===n||"auto"===n&&e.height<e.element[0].scrollHeight;return{width:r?t.position.scrollbarWidth():0,height:s?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),n=t.isWindow(i[0]);return{element:i,isWindow:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:n?i.width():i.outerWidth(),height:n?i.height():i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var r,p,m,g,v,y,b=t(e.of),x=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(x),k=(e.collision||"flip").split(" "),_={};return y=s(b),b[0].preventDefault&&(e.at="left top"),p=y.width,m=y.height,g=y.offset,v=t.extend({},g),t.each(["my","at"],function(){var t,i,n=(e[this]||"").split(" ");1===n.length&&(n=h.test(n[0])?n.concat(["center"]):c.test(n[0])?["center"].concat(n):["center","center"]),n[0]=h.test(n[0])?n[0]:"center",n[1]=c.test(n[1])?n[1]:"center",t=u.exec(n[0]),i=u.exec(n[1]),_[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(n[0])[0],d.exec(n[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=m:"center"===e.at[1]&&(v.top+=m/2),r=i(_.at,p,m),v.left+=r[0],v.top+=r[1],this.each(function(){var s,h,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=n(this,"marginLeft"),y=n(this,"marginTop"),C=u+f+n(this,"marginRight")+w.width,D=d+y+n(this,"marginBottom")+w.height,M=t.extend({},v),T=i(_.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?M.left-=u:"center"===e.my[0]&&(M.left-=u/2),"bottom"===e.my[1]?M.top-=d:"center"===e.my[1]&&(M.top-=d/2),M.left+=T[0],M.top+=T[1],t.support.offsetFractions||(M.left=l(M.left),M.top=l(M.top)),s={marginLeft:f,marginTop:y},t.each(["left","top"],function(i,n){t.ui.position[k[i]]&&t.ui.position[k[i]][n](M,{targetWidth:p,targetHeight:m,elemWidth:u,elemHeight:d,collisionPosition:s,collisionWidth:C,collisionHeight:D,offset:[r[0]+T[0],r[1]+T[1]],my:e.my,at:e.at,within:x,elem:c})}),e.using&&(h=function(t){var i=g.left-M.left,n=i+p-u,s=g.top-M.top,r=s+m-d,l={target:{element:b,left:g.left,top:g.top,width:p,height:m},element:{element:c,left:M.left,top:M.top,width:u,height:d},horizontal:0>n?"left":i>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};u>p&&p>a(i+n)&&(l.horizontal="center"),d>m&&m>a(s+r)&&(l.vertical="middle"),l.important=o(a(i),a(n))>o(a(s),a(r))?"horizontal":"vertical",e.using.call(this,t,l)}),c.offset(t.extend(M,{using:h}))})},t.ui.position={fit:{left:function(t,e){var i,n=e.within,s=n.isWindow?n.scrollLeft:n.offset.left,r=n.width,a=t.left-e.collisionPosition.marginLeft,l=s-a,h=a+e.collisionWidth-r-s;e.collisionWidth>r?l>0&&0>=h?(i=t.left+l+e.collisionWidth-r-s,t.left+=l-i):t.left=h>0&&0>=l?s:l>h?s+r-e.collisionWidth:s:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-a,t.left)},top:function(t,e){var i,n=e.within,s=n.isWindow?n.scrollTop:n.offset.top,r=e.within.height,a=t.top-e.collisionPosition.marginTop,l=s-a,h=a+e.collisionHeight-r-s;e.collisionHeight>r?l>0&&0>=h?(i=t.top+l+e.collisionHeight-r-s,t.top+=l-i):t.top=h>0&&0>=l?s:l>h?s+r-e.collisionHeight:s:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-a,t.top)}},flip:{left:function(t,e){var i,n,s=e.within,r=s.offset.left+s.scrollLeft,o=s.width,l=s.isWindow?s.scrollLeft:s.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-o-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-o-r,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(n=t.left-e.collisionPosition.marginLeft+d+p+f-l,(n>0||u>a(n))&&(t.left+=d+p+f))},top:function(t,e){var i,n,s=e.within,r=s.offset.top+s.scrollTop,o=s.height,l=s.isWindow?s.scrollTop:s.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-o-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(n=t.top+p+f+m+e.collisionHeight-o-r,t.top+p+f+m>c&&(0>n||a(c)>n)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-l,t.top+p+f+m>u&&(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,n,s,r,o=document.getElementsByTagName("body")[0],a=document.createElement("div");e=document.createElement(o?"div":"body"),n={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&t.extend(n,{position:"absolute",left:"-1000px",top:"-1000px"});for(r in n)e.style[r]=n[r];e.appendChild(a),i=o||document.documentElement,i.insertBefore(e,i.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",s=t(a).offset().left,t.support.offsetFractions=s>10&&11>s,e.innerHTML="",i.removeChild(e)}()}(jQuery),function(t){t.widget("ui.draggable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(t(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){t("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)
397
- },_mouseDrag:function(e,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!i){var n=this._uiHash();if(this._trigger("drag",e,n)===!1)return this._mouseUp({}),!1;this.position=n.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,n=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(n=t.ui.ddmanager.drop(this,e)),this.dropped&&(n=this.dropped,this.dropped=!1),"original"!==this.options.helper||t.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!n||"valid"===this.options.revert&&n||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1):!1},_mouseUp:function(e){return t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(e){var i=this.options,n=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,n,s=this.options;return s.containment?"window"===s.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===s.containment?(this.containment=[0,0,t(document).width()-this.helperProportions.width-this.margins.left,(t(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):s.containment.constructor===Array?(this.containment=s.containment,void 0):("parent"===s.containment&&(s.containment=this.helper[0].parentNode),i=t(s.containment),n=i[0],n&&(e="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,i){i||(i=this.position);var n="absolute"===e?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:s.scrollTop(),left:s.scrollLeft()}),{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*n}},_generatePosition:function(e){var i,n,s,r,o=this.options,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=e.pageX,h=e.pageY;return this.offset.scroll||(this.offset.scroll={top:a.scrollTop(),left:a.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(n=this.relative_container.offset(),i=[this.containment[0]+n.left,this.containment[1]+n.top,this.containment[2]+n.left,this.containment[3]+n.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(h=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),o.grid&&(s=o.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,h=i?s-this.offset.click.top>=i[1]||s-this.offset.click.top>i[3]?s:s-this.offset.click.top>=i[1]?s-o.grid[1]:s+o.grid[1]:s,r=o.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,l=i?r-this.offset.click.left>=i[0]||r-this.offset.click.left>i[2]?r:r-this.offset.click.left>=i[0]?r-o.grid[0]:r+o.grid[0]:r)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(e,i,n){return n=n||this._uiHash(),t.ui.plugin.call(this,e,[i,n]),"drag"===e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,i,n)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i){var n=t(this).data("ui-draggable"),s=n.options,r=t.extend({},i,{item:n.element});n.sortables=[],t(s.connectToSortable).each(function(){var i=t.data(this,"ui-sortable");i&&!i.options.disabled&&(n.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",e,r))})},stop:function(e,i){var n=t(this).data("ui-draggable"),s=t.extend({},i,{item:n.element});t.each(n.sortables,function(){this.instance.isOver?(this.instance.isOver=0,n.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,"original"===n.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,s))})},drag:function(e,i){var n=t(this).data("ui-draggable"),s=this;t.each(n.sortables,function(){var r=!1,o=this;this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(r=!0,t.each(n.sortables,function(){return this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&t.contains(o.instance.element[0],this.instance.element[0])&&(r=!1),r})),r?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=t(s).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=n.offset.click.top,this.instance.offset.click.left=n.offset.click.left,this.instance.offset.parent.left-=n.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=n.offset.parent.top-this.instance.offset.parent.top,n._trigger("toSortable",e),n.dropped=this.instance.element,n.currentItem=n.element,this.instance.fromOutside=n),this.instance.currentItem&&this.instance._mouseDrag(e)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),n._trigger("fromSortable",e),n.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(){var e=t("body"),i=t(this).data("ui-draggable").options;e.css("cursor")&&(i._cursor=e.css("cursor")),e.css("cursor",i.cursor)},stop:function(){var e=t(this).data("ui-draggable").options;e._cursor&&t("body").css("cursor",e._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i){var n=t(i.helper),s=t(this).data("ui-draggable").options;n.css("opacity")&&(s._opacity=n.css("opacity")),n.css("opacity",s.opacity)},stop:function(e,i){var n=t(this).data("ui-draggable").options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(){var e=t(this).data("ui-draggable");e.scrollParent[0]!==document&&"HTML"!==e.scrollParent[0].tagName&&(e.overflowOffset=e.scrollParent.offset())},drag:function(e){var i=t(this).data("ui-draggable"),n=i.options,s=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(n.axis&&"x"===n.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<n.scrollSensitivity?i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop+n.scrollSpeed:e.pageY-i.overflowOffset.top<n.scrollSensitivity&&(i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<n.scrollSensitivity?i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft+n.scrollSpeed:e.pageX-i.overflowOffset.left<n.scrollSensitivity&&(i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(document).scrollTop()<n.scrollSensitivity?s=t(document).scrollTop(t(document).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<n.scrollSensitivity&&(s=t(document).scrollTop(t(document).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(document).scrollLeft()<n.scrollSensitivity?s=t(document).scrollLeft(t(document).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<n.scrollSensitivity&&(s=t(document).scrollLeft(t(document).scrollLeft()+n.scrollSpeed)))),s!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(){var e=t(this).data("ui-draggable"),i=e.options;e.snapElements=[],t(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=t(this),n=i.offset();this!==e.element[0]&&e.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:n.top,left:n.left})})},drag:function(e,i){var n,s,r,o,a,l,h,c,u,d,p=t(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,v=g+p.helperProportions.width,y=i.offset.top,b=y+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)a=p.snapElements[u].left,l=a+p.snapElements[u].width,h=p.snapElements[u].top,c=h+p.snapElements[u].height,a-m>v||g>l+m||h-m>b||y>c+m||!t.contains(p.snapElements[u].item.ownerDocument,p.snapElements[u].item)?(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(h-b),s=m>=Math.abs(c-y),r=m>=Math.abs(a-v),o=m>=Math.abs(l-g),n&&(i.position.top=p._convertPositionTo("relative",{top:h-p.helperProportions.height,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),r&&(i.position.left=p._convertPositionTo("relative",{top:0,left:a-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),d=n||s||r||o,"outer"!==f.snapMode&&(n=m>=Math.abs(h-y),s=m>=Math.abs(c-b),r=m>=Math.abs(a-g),o=m>=Math.abs(l-v),n&&(i.position.top=p._convertPositionTo("relative",{top:h,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),r&&(i.position.left=p._convertPositionTo("relative",{top:0,left:a}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(n||s||r||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=n||s||r||o||d)}}),t.ui.plugin.add("draggable","stack",{start:function(){var e,i=this.data("ui-draggable").options,n=t.makeArray(t(i.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});n.length&&(e=parseInt(t(n[0]).css("zIndex"),10)||0,t(n).each(function(i){t(this).css("zIndex",e+i)}),this.css("zIndex",e+n.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i){var n=t(i.helper),s=t(this).data("ui-draggable").options;n.css("zIndex")&&(s._zIndex=n.css("zIndex")),n.css("zIndex",s.zIndex)},stop:function(e,i){var n=t(this).data("ui-draggable").options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}t.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(i)?i:function(t){return t.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},t.ui.ddmanager.droppables[e.scope]=t.ui.ddmanager.droppables[e.scope]||[],t.ui.ddmanager.droppables[e.scope].push(this),e.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var e=0,i=t.ui.ddmanager.droppables[this.options.scope];i.length>e;e++)i[e]===this&&i.splice(e,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(e,i){"accept"===e&&(this.accept=t.isFunction(i)?i:function(t){return t.is(i)}),t.Widget.prototype._setOption.apply(this,arguments)},_activate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var n=i||t.ui.ddmanager.current,s=!1;return n&&(n.currentItem||n.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var e=t.data(this,"ui-droppable");return e.options.greedy&&!e.options.disabled&&e.options.scope===n.options.scope&&e.accept.call(e.element[0],n.currentItem||n.element)&&t.ui.intersect(n,t.extend(e,{offset:e.element.offset()}),e.options.tolerance)?(s=!0,!1):void 0}),s?!1:this.accept.call(this.element[0],n.currentItem||n.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",e,this.ui(n)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}}}),t.ui.intersect=function(t,i,n){if(!i.offset)return!1;var s,r,o=(t.positionAbs||t.position.absolute).left,a=o+t.helperProportions.width,l=(t.positionAbs||t.position.absolute).top,h=l+t.helperProportions.height,c=i.offset.left,u=c+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(n){case"fit":return o>=c&&u>=a&&l>=d&&p>=h;case"intersect":return o+t.helperProportions.width/2>c&&u>a-t.helperProportions.width/2&&l+t.helperProportions.height/2>d&&p>h-t.helperProportions.height/2;case"pointer":return s=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,r=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,e(r,d,i.proportions.height)&&e(s,c,i.proportions.width);case"touch":return(l>=d&&p>=l||h>=d&&p>=h||d>l&&h>p)&&(o>=c&&u>=o||a>=c&&u>=a||c>o&&a>u);default:return!1}},t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var n,s,r=t.ui.ddmanager.droppables[e.options.scope]||[],o=i?i.type:null,a=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(n=0;r.length>n;n++)if(!(r[n].options.disabled||e&&!r[n].accept.call(r[n].element[0],e.currentItem||e.element))){for(s=0;a.length>s;s++)if(a[s]===r[n].element[0]){r[n].proportions.height=0;continue t}r[n].visible="none"!==r[n].element.css("display"),r[n].visible&&("mousedown"===o&&r[n]._activate.call(r[n],i),r[n].offset=r[n].element.offset(),r[n].proportions={width:r[n].element[0].offsetWidth,height:r[n].element[0].offsetHeight})}},drop:function(e,i){var n=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&t.ui.intersect(e,this,this.options.tolerance)&&(n=this._drop.call(this,i)||n),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),n},dragStart:function(e,i){e.element.parentsUntil("body").bind("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var n,s,r,o=t.ui.intersect(e,this,this.options.tolerance),a=!o&&this.isover?"isout":o&&!this.isover?"isover":null;a&&(this.options.greedy&&(s=this.options.scope,r=this.element.parents(":data(ui-droppable)").filter(function(){return t.data(this,"ui-droppable").options.scope===s}),r.length&&(n=t.data(r[0],"ui-droppable"),n.greedyChild="isover"===a)),n&&"isover"===a&&(n.isover=!1,n.isout=!0,n._out.call(n,i)),this[a]=!0,this["isout"===a?"isover":"isout"]=!1,this["isover"===a?"_over":"_out"].call(this,i),n&&"isout"===a&&(n.isout=!1,n.isover=!0,n._over.call(n,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").unbind("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}}}(jQuery),function(t){function e(t){return parseInt(t,10)||0}function i(t){return!isNaN(parseInt(t,10))}t.widget("ui.resizable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var e,i,n,s,r,o=this,a=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),e=this.handles.split(","),this.handles={},i=0;e.length>i;i++)n=t.trim(e[i]),r="ui-resizable-"+n,s=t("<div class='ui-resizable-handle "+r+"'></div>"),s.css({zIndex:a.zIndex}),"se"===n&&s.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[n]=".ui-resizable-"+n,this.element.append(s);this._renderAxis=function(e){var i,n,s,r;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=t(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(n=t(this.handles[i],this.element),r=/sw|ne|nw|se|n|s/.test(i)?n.outerHeight():n.outerWidth(),s=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(s,r),this._proportionallyResize()),t(this.handles[i]).length},this._renderAxis(this.element),this._handles=t(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(s=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=s&&s[1]?s[1]:"se")}),a.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").mouseenter(function(){a.disabled||(t(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){a.disabled||o.resizing||(t(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(e){var i,n,s=!1;for(i in this.handles)n=t(this.handles[i])[0],(n===e.target||t.contains(n,e.target))&&(s=!0);return!this.options.disabled&&s},_mouseStart:function(i){var n,s,r,o=this.options,a=this.element.position(),l=this.element;return this.resizing=!0,/absolute/.test(l.css("position"))?l.css({position:"absolute",top:l.css("top"),left:l.css("left")}):l.is(".ui-draggable")&&l.css({position:"absolute",top:a.top,left:a.left}),this._renderProxy(),n=e(this.helper.css("left")),s=e(this.helper.css("top")),o.containment&&(n+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:n,top:s},this.size=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalSize=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalPosition={left:n,top:s},this.sizeDiff={width:l.outerWidth()-l.width(),height:l.outerHeight()-l.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,r=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===r?this.axis+"-resize":r),l.addClass("ui-resizable-resizing"),this._propagate("start",i),!0},_mouseDrag:function(e){var i,n=this.helper,s={},r=this.originalMousePosition,o=this.axis,a=this.position.top,l=this.position.left,h=this.size.width,c=this.size.height,u=e.pageX-r.left||0,d=e.pageY-r.top||0,p=this._change[o];return p?(i=p.apply(this,[e,u,d]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),this.position.top!==a&&(s.top=this.position.top+"px"),this.position.left!==l&&(s.left=this.position.left+"px"),this.size.width!==h&&(s.width=this.size.width+"px"),this.size.height!==c&&(s.height=this.size.height+"px"),n.css(s),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||this._trigger("resize",e,this.ui()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,n,s,r,o,a,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,n=i.length&&/textarea/i.test(i[0].nodeName),s=n&&t.ui.hasScroll(i[0],"left")?0:c.sizeDiff.height,r=n?0:c.sizeDiff.width,o={width:c.helper.width()-r,height:c.helper.height()-s},a=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,l=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(o,{top:l,left:a})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(t){var e,n,s,r,o,a=this.options;o={minWidth:i(a.minWidth)?a.minWidth:0,maxWidth:i(a.maxWidth)?a.maxWidth:1/0,minHeight:i(a.minHeight)?a.minHeight:0,maxHeight:i(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,n=o.maxHeight*this.aspectRatio,r=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>n&&(o.maxWidth=n),o.maxHeight>r&&(o.maxHeight=r)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),i(t.left)&&(this.position.left=t.left),i(t.top)&&(this.position.top=t.top),i(t.height)&&(this.size.height=t.height),i(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,n=this.size,s=this.axis;return i(t.height)?t.width=t.height*this.aspectRatio:i(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(n.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(n.height-t.height),t.left=e.left+(n.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,n=this.axis,s=i(t.width)&&e.maxWidth&&e.maxWidth<t.width,r=i(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=i(t.width)&&e.minWidth&&e.minWidth>t.width,a=i(t.height)&&e.minHeight&&e.minHeight>t.height,l=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,c=/sw|nw|w/.test(n),u=/nw|ne|n/.test(n);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),r&&(t.height=e.maxHeight),o&&c&&(t.left=l-e.minWidth),s&&c&&(t.left=l-e.maxWidth),a&&u&&(t.top=h-e.minHeight),r&&u&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var t,e,i,n,s,r=this.helper||this.element;for(t=0;this._proportionallyResizeElements.length>t;t++){if(s=this._proportionallyResizeElements[t],!this.borderDif)for(this.borderDif=[],i=[s.css("borderTopWidth"),s.css("borderRightWidth"),s.css("borderBottomWidth"),s.css("borderLeftWidth")],n=[s.css("paddingTop"),s.css("paddingRight"),s.css("paddingBottom"),s.css("paddingLeft")],e=0;i.length>e;e++)this.borderDif[e]=(parseInt(i[e],10)||0)+(parseInt(n[e],10)||0);s.css({height:r.height()-this.borderDif[0]-this.borderDif[2]||0,width:r.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,n=this.originalPosition;return{left:n.left+e,width:i.width-e}},n:function(t,e,i){var n=this.originalSize,s=this.originalPosition;return{top:s.top+i,height:n.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,n){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,n]))
398
- },sw:function(e,i,n){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,n]))},ne:function(e,i,n){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,n]))},nw:function(e,i,n){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,n]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).data("ui-resizable"),n=i.options,s=i._proportionallyResizeElements,r=s.length&&/textarea/i.test(s[0].nodeName),o=r&&t.ui.hasScroll(s[0],"left")?0:i.sizeDiff.height,a=r?0:i.sizeDiff.width,l={width:i.size.width-a,height:i.size.height-o},h=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:n.animateDuration,easing:n.animateEasing,step:function(){var n={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};s&&s.length&&t(s[0]).css({width:n.width,height:n.height}),i._updateCache(n),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var i,n,s,r,o,a,l,h=t(this).data("ui-resizable"),c=h.options,u=h.element,d=c.containment,p=d instanceof t?d.get(0):/parent/.test(d)?u.parent().get(0):d;p&&(h.containerElement=t(p),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(i=t(p),n=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){n[t]=e(i.css("padding"+s))}),h.containerOffset=i.offset(),h.containerPosition=i.position(),h.containerSize={height:i.innerHeight()-n[3],width:i.innerWidth()-n[1]},s=h.containerOffset,r=h.containerSize.height,o=h.containerSize.width,a=t.ui.hasScroll(p,"left")?p.scrollWidth:o,l=t.ui.hasScroll(p)?p.scrollHeight:r,h.parentData={element:p,left:s.left,top:s.top,width:a,height:l}))},resize:function(e){var i,n,s,r,o=t(this).data("ui-resizable"),a=o.options,l=o.containerOffset,h=o.position,c=o._aspectRatio||e.shiftKey,u={top:0,left:0},d=o.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(o._helper?l.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-l.left:o.position.left-u.left),c&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=a.helper?l.left:0),h.top<(o._helper?l.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-l.top:o.position.top),c&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?l.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,i=Math.abs((o._helper?o.offset.left-u.left:o.offset.left-u.left)+o.sizeDiff.width),n=Math.abs((o._helper?o.offset.top-u.top:o.offset.top-l.top)+o.sizeDiff.height),s=o.containerElement.get(0)===o.element.parent().get(0),r=/relative|absolute/.test(o.containerElement.css("position")),s&&r&&(i-=o.parentData.left),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,c&&(o.size.height=o.size.width/o.aspectRatio)),n+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-n,c&&(o.size.width=o.size.height*o.aspectRatio))},stop:function(){var e=t(this).data("ui-resizable"),i=e.options,n=e.containerOffset,s=e.containerPosition,r=e.containerElement,o=t(e.helper),a=o.offset(),l=o.outerWidth()-e.sizeDiff.width,h=o.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(r.css("position"))&&t(this).css({left:a.left-s.left-n.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(r.css("position"))&&t(this).css({left:a.left-s.left-n.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,n=function(e){t(e).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?n(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],n(i.alsoResize)):t.each(i.alsoResize,function(t){n(t)})},resize:function(e,i){var n=t(this).data("ui-resizable"),s=n.options,r=n.originalSize,o=n.originalPosition,a={height:n.size.height-r.height||0,width:n.size.width-r.width||0,top:n.position.top-o.top||0,left:n.position.left-o.left||0},l=function(e,n){t(e).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),r={},o=n&&n.length?n:e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&i>=0&&(r[e]=i||null)}),e.css(r)})};"object"!=typeof s.alsoResize||s.alsoResize.nodeType?l(s.alsoResize):t.each(s.alsoResize,function(t,e){l(t,e)})},stop:function(){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,n=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:n.height,width:n.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).data("ui-resizable");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).data("ui-resizable");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e=t(this).data("ui-resizable"),i=e.options,n=e.size,s=e.originalSize,r=e.originalPosition,o=e.axis,a="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=a[0]||1,h=a[1]||1,c=Math.round((n.width-s.width)/l)*l,u=Math.round((n.height-s.height)/h)*h,d=s.width+c,p=s.height+u,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=a,g&&(d+=l),v&&(p+=h),f&&(d-=l),m&&(p-=h),/^(se|s|e)$/.test(o)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(o)?(e.size.width=d,e.size.height=p,e.position.top=r.top-u):/^(sw)$/.test(o)?(e.size.width=d,e.size.height=p,e.position.left=r.left-c):(e.size.width=d,e.size.height=p,e.position.top=r.top-u,e.position.left=r.left-c)}})}(jQuery),function(t){t.widget("ui.selectable",t.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e=t(i.options.filter,i.element[0]),e.addClass("ui-selectee"),e.each(function(){var e=t(this),i=e.offset();t.data(this,"selectable-item",{element:this,$element:e,left:i.left,top:i.top,right:i.left+e.outerWidth(),bottom:i.top+e.outerHeight(),startselected:!1,selected:e.hasClass("ui-selected"),selecting:e.hasClass("ui-selecting"),unselecting:e.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=e.addClass("ui-selectee"),this._mouseInit(),this.helper=t("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(e){var i=this,n=this.options;this.opos=[e.pageX,e.pageY],this.options.disabled||(this.selectees=t(n.filter,this.element[0]),this._trigger("start",e),t(n.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),n.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var n=t.data(this,"selectable-item");n.startselected=!0,e.metaKey||e.ctrlKey||(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,i._trigger("unselecting",e,{unselecting:n.element}))}),t(e.target).parents().addBack().each(function(){var n,s=t.data(this,"selectable-item");return s?(n=!e.metaKey&&!e.ctrlKey||!s.$element.hasClass("ui-selected"),s.$element.removeClass(n?"ui-unselecting":"ui-selected").addClass(n?"ui-selecting":"ui-unselecting"),s.unselecting=!n,s.selecting=n,s.selected=n,n?i._trigger("selecting",e,{selecting:s.element}):i._trigger("unselecting",e,{unselecting:s.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,n=this,s=this.options,r=this.opos[0],o=this.opos[1],a=e.pageX,l=e.pageY;return r>a&&(i=a,a=r,r=i),o>l&&(i=l,l=o,o=i),this.helper.css({left:r,top:o,width:a-r,height:l-o}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),h=!1;i&&i.element!==n.element[0]&&("touch"===s.tolerance?h=!(i.left>a||r>i.right||i.top>l||o>i.bottom):"fit"===s.tolerance&&(h=i.left>r&&a>i.right&&i.top>o&&l>i.bottom),h?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,n._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),n._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,n._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var n=t.data(this,"selectable-item");n.$element.removeClass("ui-unselecting"),n.unselecting=!1,n.startselected=!1,i._trigger("unselected",e,{unselected:n.element})}),t(".ui-selecting",this.element[0]).each(function(){var n=t.data(this,"selectable-item");n.$element.removeClass("ui-selecting").addClass("ui-selected"),n.selecting=!1,n.selected=!0,n.startselected=!0,i._trigger("selected",e,{selected:n.element})}),this._trigger("stop",e),this.helper.remove(),!1}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var n=null,s=!1,r=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,r.widgetName+"-item")===r?(n=t(this),!1):void 0}),t.data(e.target,r.widgetName+"-item")===r&&(n=t(e.target)),n?!this.options.handle||i||(t(this.options.handle,n).find("*").addBack().each(function(){this===e.target&&(s=!0)}),s)?(this.currentItem=n,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,n){var s,r,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(r=this.document.find("body"),this.storedCursor=r.css("cursor"),r.css("cursor",o.cursor),this.storedStylesheet=t("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(r)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!n)for(s=this.containers.length-1;s>=0;s--)this.containers[s]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,n,s,r,o=this.options,a=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop+o.scrollSpeed:e.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft+o.scrollSpeed:e.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(e.pageY-t(document).scrollTop()<o.scrollSensitivity?a=t(document).scrollTop(t(document).scrollTop()-o.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<o.scrollSensitivity&&(a=t(document).scrollTop(t(document).scrollTop()+o.scrollSpeed)),e.pageX-t(document).scrollLeft()<o.scrollSensitivity?a=t(document).scrollLeft(t(document).scrollLeft()-o.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<o.scrollSensitivity&&(a=t(document).scrollLeft(t(document).scrollLeft()+o.scrollSpeed))),a!==!1&&t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(n=this.items[i],s=n.item[0],r=this._intersectsWithPointer(n),r&&n.instance===this.currentContainer&&s!==this.currentItem[0]&&this.placeholder[1===r?"next":"prev"]()[0]!==s&&!t.contains(this.placeholder[0],s)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],s):!0)){if(this.direction=1===r?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(n))break;this._rearrange(e,n),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var n=this,s=this.placeholder.offset(),r=this.options.axis,o={};r&&"x"!==r||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),r&&"y"!==r||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){n._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),n=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&n.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!n.length&&e.key&&n.push(e.key+"="),n.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),n=[];return e=e||{},i.each(function(){n.push(t(e.item||this).attr(e.attribute||"id")||"")}),n},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,n=this.positionAbs.top,s=n+this.helperProportions.height,r=t.left,o=r+t.width,a=t.top,l=a+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||n+h>a&&l>n+h,d="y"===this.options.axis||e+c>r&&o>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>r&&o>i-this.helperProportions.width/2&&n+this.helperProportions.height/2>a&&l>s-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),s=i&&n,r=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return s?this.floating?o&&"right"===o||"down"===r?2:1:r&&("down"===r?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),n=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return this.floating&&r?"right"===r&&n||"left"===r&&!n:s&&("down"===s&&i||"up"===s&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,n,s,r,o=[],a=[],l=this._connectWith();if(l&&e)for(i=l.length-1;i>=0;i--)for(s=t(l[i]),n=s.length-1;n>=0;n--)r=t.data(s[n],this.widgetFullName),r&&r!==this&&!r.options.disabled&&a.push([t.isFunction(r.options.items)?r.options.items.call(r.element):t(r.options.items,r.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),r]);for(a.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=a.length-1;i>=0;i--)a[i][0].each(function(){o.push(this)});return t(o)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,n,s,r,o,a,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(s=t(d[i]),n=s.length-1;n>=0;n--)r=t.data(s[n],this.widgetFullName),r&&r!==this&&!r.options.disabled&&(u.push([t.isFunction(r.options.items)?r.options.items.call(r.element[0],e,{item:this.currentItem}):t(r.options.items,r.element),r]),this.containers.push(r));for(i=u.length-1;i>=0;i--)for(o=u[i][1],a=u[i][0],n=0,h=a.length;h>n;n++)l=t(a[n]),l.data(this.widgetName+"-item",o),c.push({item:l,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,n,s,r;for(i=this.items.length-1;i>=0;i--)n=this.items[i],n.instance!==this.currentContainer&&this.currentContainer&&n.item[0]!==this.currentItem[0]||(s=this.options.toleranceElement?t(this.options.toleranceElement,n.item):n.item,e||(n.width=s.outerWidth(),n.height=s.outerHeight()),r=s.offset(),n.left=r.left,n.top=r.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)r=this.containers[i].element.offset(),this.containers[i].containerCache.left=r.left,this.containers[i].containerCache.top=r.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,n=e.options;n.placeholder&&n.placeholder.constructor!==String||(i=n.placeholder,n.placeholder={element:function(){var n=e.currentItem[0].nodeName.toLowerCase(),s=t("<"+n+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===n?e.currentItem.children().each(function(){t("<td>&#160;</td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(s)}):"img"===n&&s.attr("src",e.currentItem.attr("src")),i||s.css("visibility","hidden"),s},update:function(t,s){(!i||n.forcePlaceholderSize)&&(s.height()||s.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),s.width()||s.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(n.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),n.placeholder.update(e,e.placeholder)},_contactContainers:function(n){var s,r,o,a,l,h,c,u,d,p,f=null,m=null;for(s=this.containers.length-1;s>=0;s--)if(!t.contains(this.currentItem[0],this.containers[s].element[0]))if(this._intersectsWith(this.containers[s].containerCache)){if(f&&t.contains(this.containers[s].element[0],f.element[0]))continue;f=this.containers[s],m=s}else this.containers[s].containerCache.over&&(this.containers[s]._trigger("out",n,this._uiHash(this)),this.containers[s].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",n,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(o=1e4,a=null,p=f.floating||i(this.currentItem),l=p?"left":"top",h=p?"width":"height",c=this.positionAbs[l]+this.offset.click[l],r=this.items.length-1;r>=0;r--)t.contains(this.containers[m].element[0],this.items[r].item[0])&&this.items[r].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[r].top,this.items[r].height))&&(u=this.items[r].item.offset()[l],d=!1,Math.abs(u-c)>Math.abs(u+this.items[r][h]-c)&&(d=!0,u+=this.items[r][h]),o>Math.abs(u-c)&&(o=Math.abs(u-c),a=this.items[r],this.direction=d?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;a?this._rearrange(n,a,null,!0):this._rearrange(n,null,this.containers[m].element,!0),this._trigger("change",n,this._uiHash()),this.containers[m]._trigger("change",n,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",n,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(e){var i=this.options,n=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return n.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(n[0]),n[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!n[0].style.width||i.forceHelperSize)&&n.width(this.currentItem.width()),(!n[0].style.height||i.forceHelperSize)&&n.height(this.currentItem.height()),n},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,n,s=this.options;"parent"===s.containment&&(s.containment=this.helper[0].parentNode),("document"===s.containment||"window"===s.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===s.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===s.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(s.containment)||(e=t(s.containment)[0],i=t(s.containment).offset(),n="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(n?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(n?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var n="absolute"===e?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,r=/(html|body)/i.test(s[0].tagName);return{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():r?0:s.scrollTop())*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():r?0:s.scrollLeft())*n}},_generatePosition:function(e){var i,n,s=this.options,r=e.pageX,o=e.pageY,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(a[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(r=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(r=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),s.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/s.grid[1])*s.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-s.grid[1]:i+s.grid[1]:i,n=this.originalPageX+Math.round((r-this.originalPageX)/s.grid[0])*s.grid[0],r=this.containment?n-this.offset.click.left>=this.containment[0]&&n-this.offset.click.left<=this.containment[2]?n:n-this.offset.click.left>=this.containment[0]?n-s.grid[0]:n+s.grid[0]:n)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:a.scrollTop()),left:r-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:a.scrollLeft())}},_rearrange:function(t,e,i,n){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;
399
- var s=this.counter;this._delay(function(){s===this.counter&&this.refreshPositions(!n)})},_clear:function(t,e){this.reverting=!1;var i,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||n.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(n.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;n.length>i;i++)n[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;n.length>i;i++)n[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}(jQuery),function(t,e){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){t.datepicker._isDisabledDatepicker(r.inline?e.parent()[0]:r.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))})}function s(e,i){t.extend(e,i);for(var n in i)null==i[n]&&(e[n]=i[n]);return e}t.extend(t.ui,{datepicker:{version:"1.10.3"}});var r,o="datepicker";t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return s(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var n,s,r;n=e.nodeName.toLowerCase(),s="div"===n||"span"===n,e.id||(this.uuid+=1,e.id="dp"+this.uuid),r=this._newInst(t(e),s),r.settings=t.extend({},i||{}),"input"===n?this._connectDatepicker(e,r):s&&this._inlineDatepicker(e,r)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var n=t(e);i.append=t([]),i.trigger=t([]),n.hasClass(this.markerClassName)||(this._attachments(n,i),n.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,o,i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var n,s,r,o=this._get(i,"appendText"),a=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=t("<span class='"+this._appendClass+"'>"+o+"</span>"),e[a?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),n=this._get(i,"showOn"),("focus"===n||"both"===n)&&e.focus(this._showDatepicker),("button"===n||"both"===n)&&(s=this._get(i,"buttonText"),r=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:r,alt:s,title:s}):t("<button type='button'></button>").addClass(this._triggerClass).html(r?t("<img/>").attr({src:r,alt:s,title:s}):s)),e[a?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,n,s,r=new Date(2009,11,20),o=this._get(t,"dateFormat");o.match(/[DM]/)&&(e=function(t){for(i=0,n=0,s=0;t.length>s;s++)t[s].length>i&&(i=t[s].length,n=s);return n},r.setMonth(e(this._get(t,o.match(/MM/)?"monthNames":"monthNamesShort"))),r.setDate(e(this._get(t,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-r.getDay())),t.input.attr("size",this._formatDate(t,r).length)}},_inlineDatepicker:function(e,i){var n=t(e);n.hasClass(this.markerClassName)||(n.addClass(this.markerClassName).append(i.dpDiv),t.data(e,o,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,n,r,a){var l,h,c,u,d,p=this._dialogInst;return p||(this.uuid+=1,l="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+l+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},t.data(this._dialogInput[0],o,p)),s(p.settings,r||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=n,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],o,p),this},_destroyDatepicker:function(e){var i,n=t(e),s=t.data(e,o);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,o),"input"===i?(s.append.remove(),s.trigger.remove(),n.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&n.removeClass(this.markerClassName).empty())},_enableDatepicker:function(e){var i,n,s=t(e),r=t.data(e,o);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,r.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(n=s.children("."+this._inlineClass),n.children().removeClass("ui-state-disabled"),n.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,n,s=t(e),r=t.data(e,o);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,r.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(n=s.children("."+this._inlineClass),n.children().addClass("ui-state-disabled"),n.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,o)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,n,r){var o,a,l,h,c=this._getInst(i);return 2===arguments.length&&"string"==typeof n?"defaults"===n?t.extend({},t.datepicker._defaults):c?"all"===n?t.extend({},c.settings):this._get(c,n):null:(o=n||{},"string"==typeof n&&(o={},o[n]=r),c&&(this._curInst===c&&this._hideDatepicker(),a=this._getDateDatepicker(i,!0),l=this._getMinMaxDate(c,"min"),h=this._getMinMaxDate(c,"max"),s(c.settings,o),null!==l&&o.dateFormat!==e&&o.minDate===e&&(c.settings.minDate=this._formatDate(c,l)),null!==h&&o.dateFormat!==e&&o.maxDate===e&&(c.settings.maxDate=this._formatDate(c,h)),"disabled"in o&&(o.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(t(i),c),this._autoSize(c),this._setDate(c,a),this._updateAlternate(c),this._updateDatepicker(c)),e)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,n,s,r=t.datepicker._getInst(e.target),o=!0,a=r.dpDiv.is(".ui-datepicker-rtl");if(r._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),o=!1;break;case 13:return s=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",r.dpDiv),s[0]&&t.datepicker._selectDay(e.target,r.selectedMonth,r.selectedYear,s[0]),i=t.datepicker._get(r,"onSelect"),i?(n=t.datepicker._formatDate(r),i.apply(r.input?r.input[0]:null,[n,r])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(r,"stepBigMonths"):-t.datepicker._get(r,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(r,"stepBigMonths"):+t.datepicker._get(r,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),o=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),o=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,a?1:-1,"D"),o=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(r,"stepBigMonths"):-t.datepicker._get(r,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),o=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,a?-1:1,"D"),o=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(r,"stepBigMonths"):+t.datepicker._get(r,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),o=e.ctrlKey||e.metaKey;break;default:o=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):o=!1;o&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(i){var n,s,r=t.datepicker._getInst(i.target);return t.datepicker._get(r,"constrainInput")?(n=t.datepicker._possibleChars(t.datepicker._get(r,"dateFormat")),s=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">s||!n||n.indexOf(s)>-1):e},_doKeyUp:function(e){var i,n=t.datepicker._getInst(e.target);if(n.input.val()!==n.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(n,"dateFormat"),n.input?n.input.val():null,t.datepicker._getFormatConfig(n)),i&&(t.datepicker._setDateFromField(n),t.datepicker._updateAlternate(n),t.datepicker._updateDatepicker(n))}catch(s){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,n,r,o,a,l,h;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(i,"beforeShow"),r=n?n.apply(e,[e,i]):{},r!==!1&&(s(i.settings,r),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),o=!1,t(e).parents().each(function(){return o|="fixed"===t(this).css("position"),!o}),a={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),a=t.datepicker._checkOffset(i,a,o),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":o?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),i.inline||(l=t.datepicker._get(i,"showAnim"),h=t.datepicker._get(i,"duration"),i.dpDiv.zIndex(t(e).zIndex()+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?i.dpDiv.show(l,t.datepicker._get(i,"showOptions"),h):i.dpDiv[l||"show"](l?h:null),t.datepicker._shouldFocusInput(i)&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,r=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,n=this._getNumberOfMonths(e),s=n[1],o=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),s>1&&e.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",o*s+"em"),e.dpDiv[(1!==n[0]||1!==n[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,n){var s=e.dpDiv.outerWidth(),r=e.dpDiv.outerHeight(),o=e.input?e.input.outerWidth():0,a=e.input?e.input.outerHeight():0,l=document.documentElement.clientWidth+(n?0:t(document).scrollLeft()),h=document.documentElement.clientHeight+(n?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?s-o:0,i.left-=n&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=n&&i.top===e.input.offset().top+a?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+s>l&&l>s?Math.abs(i.left+s-l):0),i.top-=Math.min(i.top,i.top+r>h&&h>r?Math.abs(r+a):0),i},_findPos:function(e){for(var i,n=this._getInst(e),s=this._get(n,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[s?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,n,s,r,a=this._curInst;!a||e&&a!==t.data(e,o)||this._datepickerShowing&&(i=this._get(a,"showAnim"),n=this._get(a,"duration"),s=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),n,s):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?n:null,s),i||s(),this._datepickerShowing=!1,r=this._get(a,"onClose"),r&&r.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),n=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==n)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,n){var s=t(e),r=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(r,i+("M"===n?this._get(r,"showCurrentAtPos"):0),n),this._updateDatepicker(r))},_gotoToday:function(e){var i,n=t(e),s=this._getInst(n[0]);this._get(s,"gotoCurrent")&&s.currentDay?(s.selectedDay=s.currentDay,s.drawMonth=s.selectedMonth=s.currentMonth,s.drawYear=s.selectedYear=s.currentYear):(i=new Date,s.selectedDay=i.getDate(),s.drawMonth=s.selectedMonth=i.getMonth(),s.drawYear=s.selectedYear=i.getFullYear()),this._notifyChange(s),this._adjustDate(n)},_selectMonthYear:function(e,i,n){var s=t(e),r=this._getInst(s[0]);r["selected"+("M"===n?"Month":"Year")]=r["draw"+("M"===n?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(r),this._adjustDate(s)},_selectDay:function(e,i,n,s){var r,o=t(e);t(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(r=this._getInst(o[0]),r.selectedDay=r.currentDay=t("a",s).html(),r.selectedMonth=r.currentMonth=i,r.selectedYear=r.currentYear=n,this._selectDate(e,this._formatDate(r,r.currentDay,r.currentMonth,r.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var n,s=t(e),r=this._getInst(s[0]);i=null!=i?i:this._formatDate(r),r.input&&r.input.val(i),this._updateAlternate(r),n=this._get(r,"onSelect"),n?n.apply(r.input?r.input[0]:null,[i,r]):r.input&&r.input.trigger("change"),r.inline?this._updateDatepicker(r):(this._hideDatepicker(),this._lastInput=r.input[0],"object"!=typeof r.input[0]&&r.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,n,s,r=this._get(e,"altField");r&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),n=this._getDate(e),s=this.formatDate(i,n,this._getFormatConfig(e)),t(r).each(function(){t(this).val(s)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(i,n,s){if(null==i||null==n)throw"Invalid arguments";if(n="object"==typeof n?""+n:n+"",""===n)return null;var r,o,a,l,h=0,c=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,p=(s?s.dayNames:null)||this._defaults.dayNames,f=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,m=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,v=-1,y=-1,b=-1,x=!1,w=function(t){var e=i.length>r+1&&i.charAt(r+1)===t;return e&&r++,e},k=function(t){var e=w(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,s=RegExp("^\\d{1,"+i+"}"),r=n.substring(h).match(s);if(!r)throw"Missing number at position "+h;return h+=r[0].length,parseInt(r[0],10)},_=function(i,s,r){var o=-1,a=t.map(w(i)?r:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,i){var s=i[1];return n.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=i[0],h+=s.length,!1):e}),-1!==o)return o+1;throw"Unknown name at position "+h},C=function(){if(n.charAt(h)!==i.charAt(r))throw"Unexpected literal at position "+h;h++};for(r=0;i.length>r;r++)if(x)"'"!==i.charAt(r)||w("'")?C():x=!1;else switch(i.charAt(r)){case"d":y=k("d");break;case"D":_("D",d,p);break;case"o":b=k("o");break;case"m":v=k("m");break;case"M":v=_("M",f,m);break;case"y":g=k("y");break;case"@":l=new Date(k("@")),g=l.getFullYear(),v=l.getMonth()+1,y=l.getDate();break;case"!":l=new Date((k("!")-this._ticksTo1970)/1e4),g=l.getFullYear(),v=l.getMonth()+1,y=l.getDate();break;case"'":w("'")?C():x=!0;break;default:C()}if(n.length>h&&(a=n.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=g?0:-100)),b>-1)for(v=1,y=b;o=this._getDaysInMonth(g,v-1),!(o>=y);)v++,y-=o;if(l=this._daylightSavingAdjust(new Date(g,v-1,y)),l.getFullYear()!==g||l.getMonth()+1!==v||l.getDate()!==y)throw"Invalid date";return l},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864e9*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var n,s=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,r=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,a=(i?i.monthNames:null)||this._defaults.monthNames,l=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},h=function(t,e,i){var n=""+e;if(l(t))for(;i>n.length;)n="0"+n;return n},c=function(t,e,i,n){return l(t)?n[e]:i[e]},u="",d=!1;if(e)for(n=0;t.length>n;n++)if(d)"'"!==t.charAt(n)||l("'")?u+=t.charAt(n):d=!1;else switch(t.charAt(n)){case"d":u+=h("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),s,r);break;case"o":u+=h("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=h("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),o,a);break;case"y":u+=l("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":d=!0;break;default:u+=t.charAt(n)}return u},_possibleChars:function(t){var e,i="",n=!1,s=function(i){var n=t.length>e+1&&t.charAt(e+1)===i;return n&&e++,n};for(e=0;t.length>e;e++)if(n)"'"!==t.charAt(e)||s("'")?i+=t.charAt(e):n=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":s("'")?i+="'":n=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,i){return t.settings[i]!==e?t.settings[i]:this._defaults[i]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),n=t.lastVal=t.input?t.input.val():null,s=this._getDefaultDate(t),r=s,o=this._getFormatConfig(t);try{r=this.parseDate(i,n,o)||s}catch(a){n=e?"":n}t.selectedDay=r.getDate(),t.drawMonth=t.selectedMonth=r.getMonth(),t.drawYear=t.selectedYear=r.getFullYear(),t.currentDay=n?r.getDate():0,t.currentMonth=n?r.getMonth():0,t.currentYear=n?r.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,n){var s=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},r=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(n){}for(var s=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,r=s.getFullYear(),o=s.getMonth(),a=s.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,h=l.exec(i);h;){switch(h[2]||"d"){case"d":case"D":a+=parseInt(h[1],10);break;case"w":case"W":a+=7*parseInt(h[1],10);break;case"m":case"M":o+=parseInt(h[1],10),a=Math.min(a,t.datepicker._getDaysInMonth(r,o));break;case"y":case"Y":r+=parseInt(h[1],10),a=Math.min(a,t.datepicker._getDaysInMonth(r,o))}h=l.exec(i)}return new Date(r,o,a)},o=null==i||""===i?n:"string"==typeof i?r(i):"number"==typeof i?isNaN(i)?n:s(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?n:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var n=!e,s=t.selectedMonth,r=t.selectedYear,o=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=o.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=o.getMonth(),t.drawYear=t.selectedYear=t.currentYear=o.getFullYear(),s===t.selectedMonth&&r===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(n?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),n="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(n,-i,"M")},next:function(){t.datepicker._adjustDate(n,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(n)},selectDay:function(){return t.datepicker._selectDay(n,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(n,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(n,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,n,s,r,o,a,l,h,c,u,d,p,f,m,g,v,y,b,x,w,k,_,C,D,M,T,S,A,E,F,I,L,N,$,z,P,O,H,W=new Date,j=this._daylightSavingAdjust(new Date(W.getFullYear(),W.getMonth(),W.getDate())),R=this._get(t,"isRTL"),B=this._get(t,"showButtonPanel"),Y=this._get(t,"hideIfNoPrevNext"),V=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),G=this._get(t,"showCurrentAtPos"),q=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],K=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(t,"min"),Z=this._getMinMaxDate(t,"max"),Q=t.drawMonth-G,te=t.drawYear;if(0>Q&&(Q+=12,te--),Z)for(e=this._daylightSavingAdjust(new Date(Z.getFullYear(),Z.getMonth()-U[0]*U[1]+1,Z.getDate())),e=J&&J>e?J:e;this._daylightSavingAdjust(new Date(te,Q,1))>e;)Q--,0>Q&&(Q=11,te--);for(t.drawMonth=Q,t.drawYear=te,i=this._get(t,"prevText"),i=V?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Q-q,1)),this._getFormatConfig(t)):i,n=this._canAdjustMonth(t,-1,te,Q)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(R?"e":"w")+"'>"+i+"</span></a>":Y?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(R?"e":"w")+"'>"+i+"</span></a>",s=this._get(t,"nextText"),s=V?this.formatDate(s,this._daylightSavingAdjust(new Date(te,Q+q,1)),this._getFormatConfig(t)):s,r=this._canAdjustMonth(t,1,te,Q)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(R?"w":"e")+"'>"+s+"</span></a>":Y?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(R?"w":"e")+"'>"+s+"</span></a>",o=this._get(t,"currentText"),a=this._get(t,"gotoCurrent")&&t.currentDay?K:j,o=V?this.formatDate(o,a,this._getFormatConfig(t)):o,l=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",h=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(R?l:"")+(this._isInRange(t,a)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(R?"":l)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),m=this._get(t,"monthNamesShort"),g=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),y=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),x="",k=0;U[0]>k;k++){for(_="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Q,t.selectedDay)),M=" ui-corner-all",T="",X){if(T+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:T+=" ui-datepicker-group-first",M=" ui-corner-"+(R?"right":"left");break;case U[1]-1:T+=" ui-datepicker-group-last",M=" ui-corner-"+(R?"left":"right");break;default:T+=" ui-datepicker-group-middle",M=""}T+="'>"}for(T+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+M+"'>"+(/all|left/.test(M)&&0===k?R?r:n:"")+(/all|right/.test(M)&&0===k?R?n:r:"")+this._generateMonthYearHeader(t,Q,te,J,Z,k>0||C>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",S=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)A=(w+c)%7,S+="<th"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[A]+"'>"+p[A]+"</span></th>";
400
- for(T+=S+"</tr></thead><tbody>",E=this._getDaysInMonth(te,Q),te===t.selectedYear&&Q===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,E)),F=(this._getFirstDayOfMonth(te,Q)-c+7)%7,I=Math.ceil((F+E)/7),L=X?this.maxRows>I?this.maxRows:I:I,this.maxRows=L,N=this._daylightSavingAdjust(new Date(te,Q,1-F)),$=0;L>$;$++){for(T+="<tr>",z=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(N)+"</td>":"",w=0;7>w;w++)P=g?g.apply(t.input?t.input[0]:null,[N]):[!0,""],O=N.getMonth()!==Q,H=O&&!y||!P[0]||J&&J>N||Z&&N>Z,z+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(O?" ui-datepicker-other-month":"")+(N.getTime()===D.getTime()&&Q===t.selectedMonth&&t._keyEvent||b.getTime()===N.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(H?" "+this._unselectableClass+" ui-state-disabled":"")+(O&&!v?"":" "+P[1]+(N.getTime()===K.getTime()?" "+this._currentClass:"")+(N.getTime()===j.getTime()?" ui-datepicker-today":""))+"'"+(O&&!v||!P[2]?"":" title='"+P[2].replace(/'/g,"&#39;")+"'")+(H?"":" data-handler='selectDay' data-event='click' data-month='"+N.getMonth()+"' data-year='"+N.getFullYear()+"'")+">"+(O&&!v?"&#xa0;":H?"<span class='ui-state-default'>"+N.getDate()+"</span>":"<a class='ui-state-default"+(N.getTime()===j.getTime()?" ui-state-highlight":"")+(N.getTime()===K.getTime()?" ui-state-active":"")+(O?" ui-priority-secondary":"")+"' href='#'>"+N.getDate()+"</a>")+"</td>",N.setDate(N.getDate()+1),N=this._daylightSavingAdjust(N);T+=z+"</tr>"}Q++,Q>11&&(Q=0,te++),T+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),_+=T}x+=_}return x+=h,t._keyEvent=!1,x},_generateMonthYearHeader:function(t,e,i,n,s,r,o,a){var l,h,c,u,d,p,f,m,g=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),y=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",x="";if(r||!g)x+="<span class='ui-datepicker-month'>"+o[e]+"</span>";else{for(l=n&&n.getFullYear()===i,h=s&&s.getFullYear()===i,x+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!l||c>=n.getMonth())&&(!h||s.getMonth()>=c)&&(x+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+a[c]+"</option>");x+="</select>"}if(y||(b+=x+(!r&&g&&v?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",r||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),m=Math.max(f,p(u[1]||"")),f=n?Math.max(f,n.getFullYear()):f,m=s?Math.min(m,s.getFullYear()):m,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),y&&(b+=(!r&&g&&v?"":"&#xa0;")+x),b+="</div>"},_adjustInstDate:function(t,e,i){var n=t.drawYear+("Y"===i?e:0),s=t.drawMonth+("M"===i?e:0),r=Math.min(t.selectedDay,this._getDaysInMonth(n,s))+("D"===i?e:0),o=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(n,s,r)));t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),n=this._getMinMaxDate(t,"max"),s=i&&i>e?i:e;return n&&s>n?n:s},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,n){var s=this._getNumberOfMonths(t),r=this._daylightSavingAdjust(new Date(i,n+(0>e?e:s[0]*s[1]),1));return 0>e&&r.setDate(this._getDaysInMonth(r.getFullYear(),r.getMonth())),this._isInRange(t,r)},_isInRange:function(t,e){var i,n,s=this._getMinMaxDate(t,"min"),r=this._getMinMaxDate(t,"max"),o=null,a=null,l=this._get(t,"yearRange");return l&&(i=l.split(":"),n=(new Date).getFullYear(),o=parseInt(i[0],10),a=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=n),i[1].match(/[+\-].*/)&&(a+=n)),(!s||e.getTime()>=s.getTime())&&(!r||e.getTime()<=r.getTime())&&(!o||e.getFullYear()>=o)&&(!a||a>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,n){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var s=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(n,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),s,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.10.3"}(jQuery),function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,n=this.options,s=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),r="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",o=[];for(i=n.values&&n.values.length||1,s.length>i&&(s.slice(i).remove(),s=s.slice(0,i)),e=s.length;i>e;e++)o.push(r);this.handles=s.add(t(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):this.range=t([])},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,n,s,r,o,a,l,h,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(i),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(n-c.values(e));(s>i||s===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(s=i,r=t(this),o=e)}),a=this._start(e,o),a===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,r.addClass("ui-state-active").focus(),l=r.offset(),h=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-l.left-r.width()/2,top:e.pageY-l.top-r.height()/2-(parseInt(r.css("borderTopWidth"),10)||0)-(parseInt(r.css("borderBottomWidth"),10)||0)+(parseInt(r.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,o,n),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,n,s,r;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),n=i/e,n>1&&(n=1),0>n&&(n=0),"vertical"===this.orientation&&(n=1-n),s=this._valueMax()-this._valueMin(),r=this._valueMin()+n*s,this._trimAlignValue(r)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var n,s,r;this.options.values&&this.options.values.length?(n=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>n||1===e&&n>i)&&(i=n),i!==this.values(e)&&(s=this.values(),s[e]=i,r=this._trigger("slide",t,{handle:this.handles[e],value:i,values:s}),n=this.values(e?0:1),r!==!1&&this.values(e,i,!0))):i!==this.value()&&(r=this._trigger("slide",t,{handle:this.handles[e],value:i}),r!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var n,s,r;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(n=this.options.values,s=arguments[0],r=0;n.length>r;r+=1)n[r]=this._trimAlignValue(s[r]),this._change(null,r);this._refreshValue()},_setOption:function(e,i){var n,s=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(s=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),n=0;s>n;n+=1)this._change(null,n);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,n;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),n=0;i.length>n;n+=1)i[n]=this._trimAlignValue(i[n]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,n=t-i;return 2*Math.abs(i)>=e&&(n+=i>0?e:-e),parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,n,s,r,o=this.options.range,a=this.options,l=this,h=this._animateOff?!1:a.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(n){i=100*((l.values(n)-l._valueMin())/(l._valueMax()-l._valueMin())),c["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](c,a.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===n&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},a.animate),1===n&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:a.animate})):(0===n&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},a.animate),1===n&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:a.animate}))),e=i}):(n=this.value(),s=this._valueMin(),r=this._valueMax(),i=r!==s?100*((n-s)/(r-s)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](c,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range[h?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:a.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range[h?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:a.animate}))},_handleEvents:{keydown:function(i){var n,s,r,o,a=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),n=this._start(i,a),n===!1))return}switch(o=this.options.step,s=r=this.options.values&&this.options.values.length?this.values(a):this.value(),i.keyCode){case t.ui.keyCode.HOME:r=this._valueMin();break;case t.ui.keyCode.END:r=this._valueMax();break;case t.ui.keyCode.PAGE_UP:r=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:r=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;r=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;r=this._trimAlignValue(s-o)}this._slide(i,a,r)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})}(jQuery),define("jquery-ui",["jquery"],function(){}),function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"@@version"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",defaultValue:null,parse:"strict",ls_now:!1},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,ls_now:!1,setDefaults:function(t){return extendRemove(this._defaults,t||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}overrides={beforeShow:function(t,e){return tp_inst.ls_now="now"===tp_inst.$input.val()?!0:!1,$.isFunction(tp_inst._defaults.evnts.beforeShow)?tp_inst._defaults.evnts.beforeShow.call($input[0],t,e,tp_inst):void 0},onChangeMonthYear:function(t,e,i){tp_inst.ls_now=!1,tp_inst._updateDateTime(i),$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],t,e,i,tp_inst)},onClose:function(t,e){tp_inst.timeDefined===!0&&""!==$input.val()&&tp_inst._updateDateTime(e),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],t,e,tp_inst)}};for(i in overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(t){return t.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(t){return t.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&"undefined"==typeof $.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(tzl>0&&"object"!=typeof timezoneList[0])for(;tzl>tzi;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):-1*(new Date).getTimezoneOffset(),tp_inst.hour=tp_inst._defaults.hour<tp_inst._defaults.hourMin?tp_inst._defaults.hourMin:tp_inst._defaults.hour>tp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minute<tp_inst._defaults.minuteMin?tp_inst._defaults.minuteMin:tp_inst._defaults.minute>tp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.second<tp_inst._defaults.secondMin?tp_inst._defaults.secondMin:tp_inst._defaults.second>tp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisec<tp_inst._defaults.millisecMin?tp_inst._defaults.millisecMin:tp_inst._defaults.millisec>tp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsec<tp_inst._defaults.microsecMin?tp_inst._defaults.microsecMin:tp_inst._defaults.microsec>tp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField).css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),(0===tp_inst._defaults.minDate||0===tp_inst._defaults.minDateTime)&&(tp_inst._defaults.minDate=new Date),(0===tp_inst._defaults.maxDate||0===tp_inst._defaults.maxDateTime)&&(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){}),tp_inst},_addTimePicker:function(t){var e=this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val();this.timeDefined=this._parseTime(e),this._limitMinMaxDateTime(t,!1),this._injectTimePicker()},_parseTime:function(t,e){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),e||!this._defaults.timeOnly){var i=$.datepicker._get(this.inst,"dateFormat");try{}catch(n){return $.timepicker.log("Error parsing the date/time string: "+n+"\ndate/time string = "+t+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+i),!1}return!0}var s=$.datepicker.parseTime(this._defaults.timeFormat,t,this._defaults);return s?($.extend(this,s),!0):!1},_injectTimePicker:function(){var t=this.inst.dpDiv,e=this.inst.settings,i=this,n="",s="",r=null,o={},a={},l=null,h=0,c=0;if(0===t.find("div.ui-timepicker-div").length&&e.showTimepicker){var u=' style="display:none;"',d='<div class="ui-timepicker-div'+(e.isRTL?" ui-timepicker-rtl":"")+'"><dl>'+'<dt class="ui_tpicker_time_label"'+(e.showTime?"":u)+">"+e.timeText+"</dt>"+'<dd class="ui_tpicker_time"'+(e.showTime?"":u)+"></dd>";for(h=0,c=this.units.length;c>h;h++){if(n=this.units[h],s=n.substr(0,1).toUpperCase()+n.substr(1),r=null!==e["show"+s]?e["show"+s]:this.support[n],o[n]=parseInt(e[n+"Max"]-(e[n+"Max"]-e[n+"Min"])%e["step"+s],10),a[n]=0,d+='<dt class="ui_tpicker_'+n+'_label"'+(r?"":u)+">"+e[n+"Text"]+"</dt>"+'<dd class="ui_tpicker_'+n+'"><div class="ui_tpicker_'+n+'_slider"'+(r?"":u)+"></div>",r&&e[n+"Grid"]>0){if(d+='<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>',"hour"===n)for(var p=e[n+"Min"];p<=o[n];p+=parseInt(e[n+"Grid"],10)){a[n]++;var f=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:p},e);d+='<td data-for="'+n+'">'+f+"</td>"}else for(var m=e[n+"Min"];m<=o[n];m+=parseInt(e[n+"Grid"],10))a[n]++,d+='<td data-for="'+n+'">'+(10>m?"0":"")+m+"</td>";d+="</tr></table></div>"}d+="</dd>"}var g=null!==e.showTimezone?e.showTimezone:this.support.timezone;d+='<dt class="ui_tpicker_timezone_label"'+(g?"":u)+">"+e.timezoneText+"</dt>",d+='<dd class="ui_tpicker_timezone" '+(g?"":u)+"></dd>",d+="</dl></div>";var v=$(d);for(e.timeOnly===!0&&(v.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+e.timeOnlyTitle+"</div>"+"</div>"),t.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),h=0,c=i.units.length;c>h;h++)n=i.units[h],s=n.substr(0,1).toUpperCase()+n.substr(1),r=null!==e["show"+s]?e["show"+s]:this.support[n],i[n+"_slider"]=i.control.create(i,v.find(".ui_tpicker_"+n+"_slider"),n,i[n],e[n+"Min"],o[n],e["step"+s]),r&&e[n+"Grid"]>0&&(l=100*a[n]*e[n+"Grid"]/(o[n]-e[n+"Min"]),v.find(".ui_tpicker_"+n+" table").css({width:l+"%",marginLeft:e.isRTL?"0":l/(-2*a[n])+"%",marginRight:e.isRTL?l/(-2*a[n])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(){var t=$(this),e=t.html(),s=parseInt(e.replace(/[^0-9]/g),10),r=e.replace(/[^apm]/gi),o=t.data("for");"hour"===o&&(-1!==r.indexOf("p")&&12>s?s+=12:-1!==r.indexOf("a")&&12===s&&(s=0)),i.control.value(i,i[o+"_slider"],n,s),i._onTimeChange(),i._onSelectHandler()}).css({cursor:"pointer",width:100/a[n]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=v.find(".ui_tpicker_timezone").append("<select></select>").find("select"),$.fn.append.apply(this.timezone_select,$.map(e.timezoneList,function(t){return $("<option />").val("object"==typeof t?t.value:t).text("object"==typeof t?t.label:t)})),"undefined"!=typeof this.timezone&&null!==this.timezone&&""!==this.timezone){var y=-1*new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset();y===this.timezone?selectLocalTimezone(i):this.timezone_select.val(this.timezone)}else"undefined"!=typeof this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(e.timezone):selectLocalTimezone(i);this.timezone_select.change(function(){i._onTimeChange(),i._onSelectHandler()});var b=t.find(".ui-datepicker-buttonpane");if(b.length?b.before(v):t.append(v),this.$timeObj=v.find(".ui_tpicker_time"),null!==this.inst){var x=this.timeDefined;this._onTimeChange(),this.timeDefined=x}if(this._defaults.addSliderAccess){var w=this._defaults.sliderAccessArgs,k=this._defaults.isRTL;w.isRTL=k,setTimeout(function(){if(0===v.find(".ui-slider-access").length){v.find(".ui-slider:visible").sliderAccess(w);var t=v.find(".ui-slider-access:eq(0)").outerWidth(!0);t&&v.find("table:visible").each(function(){var e=$(this),i=e.outerWidth(),n=e.css(k?"marginRight":"marginLeft").toString().replace("%",""),s=i-t,r=n*s/i+"%",o={width:s,marginRight:0,marginLeft:0};o[k?"marginRight":"marginLeft"]=r,e.css(o)})}},10)}i._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(t,e){var i=this._defaults,n=new Date(t.selectedYear,t.selectedMonth,t.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(t,"minDateTime")&&void 0!==$.datepicker._get(t,"minDateTime")&&n){var s=$.datepicker._get(t,"minDateTime"),r=new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0);(null===this.hourMinOriginal||null===this.minuteMinOriginal||null===this.secondMinOriginal||null===this.millisecMinOriginal||null===this.microsecMinOriginal)&&(this.hourMinOriginal=i.hourMin,this.minuteMinOriginal=i.minuteMin,this.secondMinOriginal=i.secondMin,this.millisecMinOriginal=i.millisecMin,this.microsecMinOriginal=i.microsecMin),t.settings.timeOnly||r.getTime()===n.getTime()?(this._defaults.hourMin=s.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=s.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=s.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=s.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=s.getMicroseconds()):(this.microsec<this._defaults.microsecMin&&(this.microsec=this._defaults.microsecMin),this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)}if(null!==$.datepicker._get(t,"maxDateTime")&&void 0!==$.datepicker._get(t,"maxDateTime")&&n){var o=$.datepicker._get(t,"maxDateTime"),a=new Date(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0,0);(null===this.hourMaxOriginal||null===this.minuteMaxOriginal||null===this.secondMaxOriginal||null===this.millisecMaxOriginal)&&(this.hourMaxOriginal=i.hourMax,this.minuteMaxOriginal=i.minuteMax,this.secondMaxOriginal=i.secondMax,this.millisecMaxOriginal=i.millisecMax,this.microsecMaxOriginal=i.microsecMax),t.settings.timeOnly||a.getTime()===n.getTime()?(this._defaults.hourMax=o.getHours(),this.hour>=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=o.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=o.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=o.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=o.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(void 0!==e&&e===!0){var l=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),h=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),c=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),u=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),d=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);
401
- this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:l}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:h}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:c}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:u}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:d}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var t=this.hour_slider?this.control.value(this,this.hour_slider,"hour"):!1,e=this.minute_slider?this.control.value(this,this.minute_slider,"minute"):!1,i=this.second_slider?this.control.value(this,this.second_slider,"second"):!1,n=this.millisec_slider?this.control.value(this,this.millisec_slider,"millisec"):!1,s=this.microsec_slider?this.control.value(this,this.microsec_slider,"microsec"):!1,r=this.timezone_select?this.timezone_select.val():!1,o=this._defaults,a=o.pickerTimeFormat||o.timeFormat,l=o.pickerTimeSuffix||o.timeSuffix;"object"==typeof t&&(t=!1),"object"==typeof e&&(e=!1),"object"==typeof i&&(i=!1),"object"==typeof n&&(n=!1),"object"==typeof s&&(s=!1),"object"==typeof r&&(r=!1),t!==!1&&(t=parseInt(t,10)),e!==!1&&(e=parseInt(e,10)),i!==!1&&(i=parseInt(i,10)),n!==!1&&(n=parseInt(n,10)),s!==!1&&(s=parseInt(s,10));var h=o[12>t?"amNames":"pmNames"][0],c=t!==this.hour||e!==this.minute||i!==this.second||n!==this.millisec||s!==this.microsec||this.ampm.length>0&&12>t!=(-1!==$.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&r!==this.timezone;c&&(t!==!1&&(this.hour=t),e!==!1&&(this.minute=e),i!==!1&&(this.second=i),n!==!1&&(this.millisec=n),s!==!1&&(this.microsec=s),r!==!1&&(this.timezone=r),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=h),this.formattedTime=$.datepicker.formatTime(o.timeFormat,this,o),this.$timeObj&&(a===o.timeFormat?this.$timeObj.text(this.formattedTime+l):this.$timeObj.text($.datepicker.formatTime(a,this,o)+l)),this.timeDefined=!0,c&&this._updateDateTime()}},_onSelectHandler:function(){var t=this._defaults.onSelect||this.inst.settings.onSelect,e=this.$input?this.$input[0]:null;t&&e&&t.apply(e,[this.formattedDateTime,this])},_updateDateTime:function(t){if(t=this.inst||t,this.ls_now)this.$input.val("now");else{var e=t.currentYear>0?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(t.selectedYear,t.selectedMonth,t.selectedDay),i=$.datepicker._daylightSavingAdjust(e),n=$.datepicker._get(t,"dateFormat"),s=$.datepicker._getFormatConfig(t),r=null!==i&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(n,null===i?new Date:i,s);var o=this.formattedDate;if(""===t.lastVa&&(t.currentYear=t.selectedYear,t.currentMonth=t.selectedMonth,t.currentDay=t.selectedDay),this._defaults.timeOnly===!0?o=this.formattedTime:this._defaults.timeOnly!==!0&&(this._defaults.alwaysSetTime||r)&&(o+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=o,this._defaults.showTimepicker)if(this.$altInput&&this._defaults.timeOnly===!1&&this._defaults.altFieldTimeOnly===!0)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(o);var a="",l=this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,h=this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(a=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===i?new Date:i,s):this.formattedDate,a&&(a+=l)),a+=this._defaults.altTimeFormat?$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+h:this.formattedTime+h,this.$altInput.val(a)}else this.$input.val(o);else this.$input.val(this.formattedDate)}this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var t=$.datepicker._getInst(this.$input.get(0)),e=$.datepicker._get(t,"timepicker");if(e&&e._defaults.timeOnly&&t.input.val()!==t.lastVal)try{$.datepicker._updateDatepicker(t)}catch(i){$.timepicker.log(i)}}},_controls:{slider:{create:function(t,e,i,n,s,r,o){var a=t._defaults.isRTL;return e.prop("slide",null).slider({orientation:"horizontal",value:a?-1*n:n,min:a?-1*r:s,max:a?-1*s:r,step:o,slide:function(e,n){t.ls_now=!1,t.control.value(t,$(this),i,a?-1*n.value:n.value),t._onTimeChange()},stop:function(){t._onSelectHandler()}})},options:function(t,e,i,n,s){if(t._defaults.isRTL){if("string"==typeof n)return"min"===n||"max"===n?void 0!==s?e.slider(n,-1*s):Math.abs(e.slider(n)):e.slider(n);var r=n.min,o=n.max;return n.min=n.max=null,void 0!==r&&(n.max=-1*r),void 0!==o&&(n.min=-1*o),e.slider(n)}return"string"==typeof n&&void 0!==s?e.slider(n,s):e.slider(n)},value:function(t,e,i,n){return t._defaults.isRTL?void 0!==n?e.slider("value",-1*n):Math.abs(e.slider("value")):void 0!==n?e.slider("value",n):e.slider("value")}},select:{create:function(t,e,i,n,s,r,o){for(var a='<select class="ui-timepicker-select" data-unit="'+i+'" data-min="'+s+'" data-max="'+r+'" data-step="'+o+'">',l=t._defaults.pickerTimeFormat||t._defaults.timeFormat,h=s;r>=h;h+=o)a+='<option value="'+h+'"'+(h===n?" selected":"")+">",a+="hour"===i?$.datepicker.formatTime($.trim(l.replace(/[^ht ]/gi,"")),{hour:h},t._defaults):"millisec"===i||"microsec"===i||h>=10?h:"0"+h.toString(),a+="</option>";return a+="</select>",e.children("select").remove(),$(a).appendTo(e).change(function(){t._onTimeChange(),t._onSelectHandler()}),e},options:function(t,e,i,n,s){var r={},o=e.children("select");if("string"==typeof n){if(void 0===s)return o.data(n);r[n]=s}else r=n;return t.control.create(t,e,o.data("unit"),o.val(),r.min||o.data("min"),r.max||o.data("max"),r.step||o.data("step"))},value:function(t,e,i,n){var s=e.children("select");return void 0!==n?s.val(n):s.val()}}}}),$.fn.extend({timepicker:function(t){t=t||{};var e=Array.prototype.slice.call(arguments);return"object"==typeof t&&(e[0]=$.extend(t,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),e)})},datetimepicker:function(t){t=t||{};var e=arguments;return"string"==typeof t?"getDate"===t?$.fn.datepicker.apply($(this[0]),e):this.each(function(){var t=$(this);t.datepicker.apply(t,e)}):this.each(function(){var e=$(this);e.datepicker($.timepicker._newInst(e,t)._defaults)})}}),$.datepicker.parseDateTime=function(t,e,i,n,s){var r=parseDateTimeInternal(t,e,i,n,s);if(r.timeObj){var o=r.timeObj;r.date.setHours(o.hour,o.minute,o.second,o.millisec),r.date.setMicroseconds(o.microsec)}return r.date},$.datepicker.parseTime=function(t,e,i){var n=extendRemove(extendRemove({},$.timepicker._defaults),i||{});-1!==t.replace(/\'.*?\'/g,"").indexOf("Z");var s=function(t,e,i){var n,s=function(t,e){var i=[];return t&&$.merge(i,t),e&&$.merge(i,e),i=$.map(i,function(t){return t.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")}),"("+i.join("|")+")?"},r=function(t){var e=t.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),i={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(e)for(var n=0;n<e.length;n++)-1===i[e[n].toString().charAt(0)]&&(i[e[n].toString().charAt(0)]=n+1);return i},o="^"+t.toString().replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){var e=t.length;switch(t.charAt(0).toLowerCase()){case"h":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"m":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"s":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"l":return"(\\d?\\d?\\d)";case"c":return"(\\d?\\d?\\d)";case"z":return"(z|[-+]\\d\\d:?\\d\\d|\\S+)?";case"t":return s(i.amNames,i.pmNames);default:return"("+t.replace(/\'/g,"").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g,function(t){return"\\"+t})+")?"}}).replace(/\s/g,"\\s?")+i.timeSuffix+"$",a=r(t),l="";n=e.match(new RegExp(o,"i"));var h={hour:0,minute:0,second:0,millisec:0,microsec:0};return n?(-1!==a.t&&(void 0===n[a.t]||0===n[a.t].length?(l="",h.ampm=""):(l=-1!==$.inArray(n[a.t].toUpperCase(),i.amNames)?"AM":"PM",h.ampm=i["AM"===l?"amNames":"pmNames"][0])),-1!==a.h&&(h.hour="AM"===l&&"12"===n[a.h]?0:"PM"===l&&"12"!==n[a.h]?parseInt(n[a.h],10)+12:Number(n[a.h])),-1!==a.m&&(h.minute=Number(n[a.m])),-1!==a.s&&(h.second=Number(n[a.s])),-1!==a.l&&(h.millisec=Number(n[a.l])),-1!==a.c&&(h.microsec=Number(n[a.c])),-1!==a.z&&void 0!==n[a.z]&&(h.timezone=$.timepicker.timezoneOffsetNumber(n[a.z])),h):!1},r=function(t,e,i){try{var n=new Date("2012-01-01 "+e);if(isNaN(n.getTime())&&(n=new Date("2012-01-01T"+e),isNaN(n.getTime())&&(n=new Date("01/01/2012 "+e),isNaN(n.getTime()))))throw"Unable to parse time with native Date: "+e;return{hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds(),millisec:n.getMilliseconds(),microsec:n.getMicroseconds(),timezone:-1*n.getTimezoneOffset()}}catch(r){try{return s(t,e,i)}catch(o){$.timepicker.log("Unable to parse \ntimeString: "+e+"\ntimeFormat: "+t)}}return!1};return"function"==typeof n.parse?n.parse(t,e,n):"loose"===n.parse?r(t,e,n):s(t,e,n)},$.datepicker.formatTime=function(t,e,i){i=i||{},i=$.extend({},$.timepicker._defaults,i),e=$.extend({hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null},e);var n=t,s=i.amNames[0],r=parseInt(e.hour,10);return r>11&&(s=i.pmNames[0]),n=n.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){switch(t){case"HH":return("0"+r).slice(-2);case"H":return r;case"hh":return("0"+convert24to12(r)).slice(-2);case"h":return convert24to12(r);case"mm":return("0"+e.minute).slice(-2);case"m":return e.minute;case"ss":return("0"+e.second).slice(-2);case"s":return e.second;case"l":return("00"+e.millisec).slice(-3);case"c":return("00"+e.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===e.timezone?i.timezone:e.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===e.timezone?i.timezone:e.timezone,!0);case"T":return s.charAt(0).toUpperCase();case"TT":return s.toUpperCase();case"t":return s.charAt(0).toLowerCase();case"tt":return s.toLowerCase();default:return t.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(t,e){var i=this._getInst($(t)[0]),n=this._get(i,"timepicker");n?(n._limitMinMaxDateTime(i,!0),i.inline=i.stay_open=!0,this._base_selectDate(t,e),i.inline=i.stay_open=!1,this._notifyChange(i),this._updateDatepicker(i)):this._base_selectDate(t,e)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(t){var e=t.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==t&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==e||"boolean"==typeof t.stay_open&&t.stay_open!==!1)){this._base_updateDatepicker(t);var i=this._get(t,"timepicker");i&&i._addTimePicker(t)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(t){var e=$.datepicker._getInst(t.target),i=$.datepicker._get(e,"timepicker");if(i&&$.datepicker._get(e,"constrainInput")){var n=i.support.ampm,s=null!==i._defaults.showTimezone?i._defaults.showTimezone:i.support.timezone,r=$.datepicker._possibleChars($.datepicker._get(e,"dateFormat")),o=i._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,n?"APM":"").replace(/Tt/g,n?"AaPpMm":"").replace(/tT/g,n?"AaPpMm":"").replace(/T/g,n?"AP":"").replace(/tt/g,n?"apm":"").replace(/t/g,n?"ap":"")+" "+i._defaults.separator+i._defaults.timeSuffix+(s?i._defaults.timezoneList.join(""):"")+i._defaults.amNames.join("")+i._defaults.pmNames.join("")+r,a=String.fromCharCode(void 0===t.charCode?t.keyCode:t.charCode);return t.ctrlKey||" ">a||!r||o.indexOf(a)>-1}return $.datepicker._base_doKeyPress(t)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(t){var e=this._get(t,"timepicker");if(e){var i=e._defaults.altField;if(i){var n=(e._defaults.altFormat||e._defaults.dateFormat,this._getDate(t)),s=$.datepicker._getFormatConfig(t),r="",o=e._defaults.altSeparator?e._defaults.altSeparator:e._defaults.separator,a=e._defaults.altTimeSuffix?e._defaults.altTimeSuffix:e._defaults.timeSuffix,l=null!==e._defaults.altTimeFormat?e._defaults.altTimeFormat:e._defaults.timeFormat;r+=$.datepicker.formatTime(l,e,e._defaults)+a,e._defaults.timeOnly||e._defaults.altFieldTimeOnly||null===n||(r=e._defaults.altFormat?$.datepicker.formatDate(e._defaults.altFormat,n,s)+o+r:e.formattedDate+o+r),$(i).val(r)}}else $.datepicker._base_updateAlternate(t)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(t){var e=$.datepicker._getInst(t.target),i=$.datepicker._get(e,"timepicker");if(i&&i._defaults.timeOnly&&e.input.val()!==e.lastVal)try{$.datepicker._updateDatepicker(e)}catch(n){$.timepicker.log(n)}return $.datepicker._base_doKeyUp(t)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(t){var e=this._getInst($(t)[0]);e.dpDiv,this._base_gotoToday(t);var i=this._get(e,"timepicker");selectLocalTimezone(i);var n=new Date,s=new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCHours());i.ls_now=!0,this._setTime(e,s)},$.datepicker._disableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var i=this._get(e,"timepicker");$(t).datepicker("getDate"),i&&(e.settings.showTimepicker=!1,i._defaults.showTimepicker=!1,i._updateDateTime(e))}},$.datepicker._enableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var i=this._get(e,"timepicker");$(t).datepicker("getDate"),i&&(e.settings.showTimepicker=!0,i._defaults.showTimepicker=!0,i._addTimePicker(e),i._updateDateTime(e))}},$.datepicker._setTime=function(t,e){var i=this._get(t,"timepicker");if(i){var n=i._defaults;i.hour=e?e.getHours():n.hour,i.minute=e?e.getMinutes():n.minute,i.second=e?e.getSeconds():n.second,i.millisec=e?e.getMilliseconds():n.millisec,i.microsec=e?e.getMicroseconds():n.microsec,i._limitMinMaxDateTime(t,!0),i._onTimeChange(),i._updateDateTime(t)}},$.datepicker._setTimeDatepicker=function(t,e,i){var n=this._getInst(t);if(n){var s=this._get(n,"timepicker");if(s){this._setDateFromField(n);var r;e&&("string"==typeof e?(s._parseTime(e,i),r=new Date,r.setHours(s.hour,s.minute,s.second,s.millisec),r.setMicroseconds(s.microsec)):(r=new Date(e.getTime()),r.setMicroseconds(e.getMicroseconds())),"Invalid Date"===r.toString()&&(r=void 0),this._setTime(n,r))}}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(t,e){var i=this._getInst(t);if(i){"string"==typeof e&&(e=new Date(e),e.getTime()||$.timepicker.log("Error creating Date object from string."));var n,s=this._get(i,"timepicker");e instanceof Date?(n=new Date(e.getTime()),n.setMicroseconds(e.getMicroseconds())):n=e,s&&(s.support.timezone||null!==s._defaults.timezone||(s.timezone=-1*n.getTimezoneOffset()),e=$.timepicker.timezoneAdjust(e,s.timezone),n=$.timepicker.timezoneAdjust(n,s.timezone)),this._updateDatepicker(i),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(t,n,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(t,e){var i=this._getInst(t);if(i){var n=this._get(i,"timepicker");if(n){void 0===i.lastVal&&this._setDateFromField(i,e);var s=this._getDate(i);return s&&n._parseTime($(t).val(),n.timeOnly)&&(s.setHours(n.hour,n.minute,n.second,n.millisec),s.setMicroseconds(n.microsec),null!=n.timezone&&(n.support.timezone||null!==n._defaults.timezone||(n.timezone=-1*s.getTimezoneOffset()),s=$.timepicker.timezoneAdjust(s,n.timezone))),s}return this._base_getDateDatepicker(t,e)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(t,e,i){var n;try{n=this._base_parseDate(t,e,i)}catch(s){if(!(s.indexOf(":")>=0))throw s;n=this._base_parseDate(t,e.substring(0,e.length-(s.length-s.indexOf(":")-2)),i),$.timepicker.log("Error parsing the date string: "+s+"\ndate string = "+e+"\ndate format = "+t)}return n},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(t){var e=this._get(t,"timepicker");return e?(e._updateDateTime(t),e.$input.val()):this._base_formatDate(t)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(t,e,i){var n,s=this._getInst(t);if(!s)return null;var r=this._get(s,"timepicker");if(r){var o,a=null,l=null,h=null,c=r._defaults.evnts,u={};if("string"==typeof e){if("minDate"===e||"minDateTime"===e)a=i;else if("maxDate"===e||"maxDateTime"===e)l=i;else if("onSelect"===e)h=i;else if(c.hasOwnProperty(e)){if("undefined"==typeof i)return c[e];u[e]=i,n={}}}else if("object"==typeof e){e.minDate?a=e.minDate:e.minDateTime?a=e.minDateTime:e.maxDate?l=e.maxDate:e.maxDateTime&&(l=e.maxDateTime);for(o in c)c.hasOwnProperty(o)&&e[o]&&(u[o]=e[o])}for(o in u)u.hasOwnProperty(o)&&(c[o]=u[o],n||(n=$.extend({},e)),delete n[o]);if(n&&isEmptyObject(n))return;a?(a=0===a?new Date:new Date(a),r._defaults.minDate=a,r._defaults.minDateTime=a):l?(l=0===l?new Date:new Date(l),r._defaults.maxDate=l,r._defaults.maxDateTime=l):h&&(r._defaults.onSelect=h)}return void 0===i?this._base_optionDatepicker.call($.datepicker,t,e):this._base_optionDatepicker.call($.datepicker,t,n||e,i)};var isEmptyObject=function(t){var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0},extendRemove=function(t,e){$.extend(t,e);for(var i in e)(null===e[i]||void 0===e[i])&&(t[i]=e[i]);return t},detectSupport=function(t){var e=t.replace(/'.*?'/g,"").toLowerCase(),i=function(t,e){return-1!==t.indexOf(e)?!0:!1};return{hour:i(e,"h"),minute:i(e,"m"),second:i(e,"s"),millisec:i(e,"l"),microsec:i(e,"c"),timezone:i(e,"z"),ampm:i(e,"t")&&i(t,"h"),iso8601:i(t,"Z")}},convert24to12=function(t){return t%=12,0===t&&(t=12),String(t)},computeEffectiveSetting=function(t,e){return t&&t[e]?t[e]:$.timepicker._defaults[e]},splitDateTime=function(t,e){var i=computeEffectiveSetting(e,"separator"),n=computeEffectiveSetting(e,"timeFormat"),s=n.split(i),r=s.length,o=t.split(i),a=o.length;return a>1?{dateString:o.splice(0,a-r).join(i),timeString:o.splice(0,r).join(i)}:{dateString:t,timeString:""}},parseDateTimeInternal=function(t,e,i,n,s){var r,o,a;if(o=splitDateTime(i,s),r=$.datepicker._base_parseDate(t,o.dateString,n),""===o.timeString)return{date:r};if(a=$.datepicker.parseTime(e,o.timeString,s),!a)throw"Wrong time format";return{date:r,timeObj:a}},selectLocalTimezone=function(t,e){if(t&&t.timezone_select){var i=e||new Date;t.timezone_select.val(-i.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(t,e){if(isNaN(t)||t>840||-720>t)return t;var i=t,n=i%60,s=(i-n)/60,r=e?":":"",o=(i>=0?"+":"-")+("0"+Math.abs(s)).slice(-2)+r+("0"+Math.abs(n)).slice(-2);return"+00:00"===o?"Z":o},$.timepicker.timezoneOffsetNumber=function(t){var e=t.toString().replace(":","");return"Z"===e.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(e)?("-"===e.substr(0,1)?-1:1)*(60*parseInt(e.substr(1,2),10)+parseInt(e.substr(3,2),10)):t},$.timepicker.timezoneAdjust=function(t,e){var i=$.timepicker.timezoneOffsetNumber(e);return isNaN(i)||t.setMinutes(t.getMinutes()+-t.getTimezoneOffset()-i),t},$.timepicker.timeRange=function(t,e,i){return $.timepicker.handleRange("timepicker",t,e,i)},$.timepicker.datetimeRange=function(t,e,i){$.timepicker.handleRange("datetimepicker",t,e,i)},$.timepicker.dateRange=function(t,e,i){$.timepicker.handleRange("datepicker",t,e,i)},$.timepicker.handleRange=function(t,e,i,n){function s(s,r){var o=e[t]("getDate"),a=i[t]("getDate"),l=s[t]("getDate");if(null!==o){var h=new Date(o.getTime()),c=new Date(o.getTime());h.setMilliseconds(h.getMilliseconds()+n.minInterval),c.setMilliseconds(c.getMilliseconds()+n.maxInterval),n.minInterval>0&&h>a?i[t]("setDate",h):n.maxInterval>0&&a>c?i[t]("setDate",c):o>a&&r[t]("setDate",l)}}function r(e,i,s){if(e.val()){var r=e[t].call(e,"getDate");null!==r&&n.minInterval>0&&("minDate"===s&&r.setMilliseconds(r.getMilliseconds()+n.minInterval),"maxDate"===s&&r.setMilliseconds(r.getMilliseconds()-n.minInterval)),r.getTime&&i[t].call(i,"option",s,r)}}return n=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},n),$.fn[t].call(e,$.extend({onClose:function(){s($(this),i)},onSelect:function(){r($(this),i,"minDate")}},n,n.start)),$.fn[t].call(i,$.extend({onClose:function(){s($(this),e)},onSelect:function(){r($(this),e,"maxDate")}},n,n.end)),s(e,i),r(e,i,"minDate"),r(i,e,"maxDate"),$([e.get(0),i.get(0)])},$.timepicker.log=function(t){window.console&&window.console.log(t)},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(t){return this.setMilliseconds(this.getMilliseconds()+Math.floor(t/1e3)),this.microseconds=t%1e3,this}),$.timepicker.version="@@version"}}(jQuery),define("jquery-timepicker",["jquery-ui","jquery"],function(){}),!function(t){t(function(){t.support.transition=function(){var t=function(){var t,e=document.createElement("bootstrap"),i={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(t in i)if(void 0!==e.style[t])return i[t]}();return t&&{end:t}}()})}(window.jQuery),!function(t){var e='[data-dismiss="alert"]',i=function(i){t(i).on("click",e,this.close)};i.prototype.close=function(e){function i(){n.trigger("closed").remove()}var n,s=t(this),r=s.attr("data-target");r||(r=s.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),n=t(r),e&&e.preventDefault(),n.length||(n=s.hasClass("alert")?s:s.parent()),n.trigger(e=t.Event("close")),e.isDefaultPrevented()||(n.removeClass("in"),t.support.transition&&n.hasClass("fade")?n.on(t.support.transition.end,i):i())};var n=t.fn.alert;t.fn.alert=function(e){return this.each(function(){var n=t(this),s=n.data("alert");s||n.data("alert",s=new i(this)),"string"==typeof e&&s[e].call(n)})},t.fn.alert.Constructor=i,t.fn.alert.noConflict=function(){return t.fn.alert=n,this},t(document).on("click.alert.data-api",e,i.prototype.close)}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.button.defaults,i)};e.prototype.setState=function(t){var e="disabled",i=this.$element,n=i.data(),s=i.is("input")?"val":"html";t+="Text",n.resetText||i.data("resetText",i[s]()),i[s](n[t]||this.options[t]),setTimeout(function(){"loadingText"==t?i.addClass(e).attr(e,e):i.removeClass(e).removeAttr(e)},0)},e.prototype.toggle=function(){var t=this.$element.closest('[data-toggle="buttons-radio"]');t&&t.find(".active").removeClass("active"),this.$element.toggleClass("active")};var i=t.fn.button;t.fn.button=function(i){return this.each(function(){var n=t(this),s=n.data("button"),r="object"==typeof i&&i;s||n.data("button",s=new e(this,r)),"toggle"==i?s.toggle():i&&s.setState(i)})},t.fn.button.defaults={loadingText:"loading..."},t.fn.button.Constructor=e,t.fn.button.noConflict=function(){return t.fn.button=i,this},t(document).on("click.button.data-api","[data-toggle^=button]",function(e){var i=t(e.target);i.hasClass("btn")||(i=i.closest(".btn")),i.button("toggle")})}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,"hover"==this.options.pause&&this.$element.on("mouseenter",t.proxy(this.pause,this)).on("mouseleave",t.proxy(this.cycle,this))};e.prototype={cycle:function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(e){var i=this.getActiveIndex(),n=this;if(!(e>this.$items.length-1||0>e))return this.sliding?this.$element.one("slid",function(){n.to(e)}):i==e?this.pause().cycle():this.slide(e>i?"next":"prev",t(this.$items[e]))},pause:function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition.end&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(e,i){var n,s=this.$element.find(".item.active"),r=i||s[e](),o=this.interval,a="next"==e?"left":"right",l="next"==e?"first":"last",h=this;if(this.sliding=!0,o&&this.pause(),r=r.length?r:this.$element.find(".item")[l](),n=t.Event("slide",{relatedTarget:r[0],direction:a}),!r.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var e=t(h.$indicators.children()[h.getActiveIndex()]);e&&e.addClass("active")})),t.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(n),n.isDefaultPrevented())return;r.addClass(e),r[0].offsetWidth,s.addClass(a),r.addClass(a),this.$element.one(t.support.transition.end,function(){r.removeClass([e,a].join(" ")).addClass("active"),s.removeClass(["active",a].join(" ")),h.sliding=!1,setTimeout(function(){h.$element.trigger("slid")},0)})}else{if(this.$element.trigger(n),n.isDefaultPrevented())return;s.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return o&&this.cycle(),this}}};var i=t.fn.carousel;t.fn.carousel=function(i){return this.each(function(){var n=t(this),s=n.data("carousel"),r=t.extend({},t.fn.carousel.defaults,"object"==typeof i&&i),o="string"==typeof i?i:r.slide;s||n.data("carousel",s=new e(this,r)),"number"==typeof i?s.to(i):o?s[o]():r.interval&&s.pause().cycle()})},t.fn.carousel.defaults={interval:5e3,pause:"hover"},t.fn.carousel.Constructor=e,t.fn.carousel.noConflict=function(){return t.fn.carousel=i,this},t(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(e){var i,n,s=t(this),r=t(s.attr("data-target")||(i=s.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"")),o=t.extend({},r.data(),s.data());r.carousel(o),(n=s.attr("data-slide-to"))&&r.data("carousel").pause().to(n).cycle(),e.preventDefault()})}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.collapse.defaults,i),this.options.parent&&(this.$parent=t(this.options.parent)),this.options.toggle&&this.toggle()};e.prototype={constructor:e,dimension:function(){var t=this.$element.hasClass("width");return t?"width":"height"},show:function(){var e,i,n,s;if(!this.transitioning&&!this.$element.hasClass("in")){if(e=this.dimension(),i=t.camelCase(["scroll",e].join("-")),n=this.$parent&&this.$parent.find("> .accordion-group > .in"),n&&n.length){if(s=n.data("collapse"),s&&s.transitioning)return;n.collapse("hide"),s||n.data("collapse",null)}this.$element[e](0),this.transition("addClass",t.Event("show"),"shown"),t.support.transition&&this.$element[e](this.$element[0][i])}},hide:function(){var e;!this.transitioning&&this.$element.hasClass("in")&&(e=this.dimension(),this.reset(this.$element[e]()),this.transition("removeClass",t.Event("hide"),"hidden"),this.$element[e](0))},reset:function(t){var e=this.dimension();return this.$element.removeClass("collapse")[e](t||"auto")[0].offsetWidth,this.$element[null!==t?"addClass":"removeClass"]("collapse"),this},transition:function(e,i,n){var s=this,r=function(){"show"==i.type&&s.reset(),s.transitioning=0,s.$element.trigger(n)};this.$element.trigger(i),i.isDefaultPrevented()||(this.transitioning=1,this.$element[e]("in"),t.support.transition&&this.$element.hasClass("collapse")?this.$element.one(t.support.transition.end,r):r())},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var i=t.fn.collapse;t.fn.collapse=function(i){return this.each(function(){var n=t(this),s=n.data("collapse"),r=t.extend({},t.fn.collapse.defaults,n.data(),"object"==typeof i&&i);s||n.data("collapse",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.collapse.defaults={toggle:!0},t.fn.collapse.Constructor=e,t.fn.collapse.noConflict=function(){return t.fn.collapse=i,this},t(document).on("click.collapse.data-api","[data-toggle=collapse]",function(e){var i,n=t(this),s=n.attr("data-target")||e.preventDefault()||(i=n.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,""),r=t(s).data("collapse")?"toggle":n.data();n[t(s).hasClass("in")?"addClass":"removeClass"]("collapsed"),t(s).collapse(r)})}(window.jQuery),!function(t){function e(){t(".dropdown-backdrop").remove(),t(n).each(function(){i(t(this)).removeClass("open")})}function i(e){var i,n=e.attr("data-target");return n||(n=e.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),i=n&&t(n),i&&i.length||(i=e.parent()),i}var n="[data-toggle=dropdown]",s=function(e){var i=t(e).on("click.dropdown.data-api",this.toggle);t("html").on("click.dropdown.data-api",function(){i.parent().removeClass("open")})};s.prototype={constructor:s,toggle:function(){var n,s,r=t(this);if(!r.is(".disabled, :disabled"))return n=i(r),s=n.hasClass("open"),e(),s||("ontouchstart"in document.documentElement&&t('<div class="dropdown-backdrop"/>').insertBefore(t(this)).on("click",e),n.toggleClass("open")),r.focus(),!1},keydown:function(e){var s,r,o,a,l;if(/(38|40|27)/.test(e.keyCode)&&(s=t(this),e.preventDefault(),e.stopPropagation(),!s.is(".disabled, :disabled"))){if(o=i(s),a=o.hasClass("open"),!a||a&&27==e.keyCode)return 27==e.which&&o.find(n).focus(),s.click();r=t("[role=menu] li:not(.divider):visible a",o),r.length&&(l=r.index(r.filter(":focus")),38==e.keyCode&&l>0&&l--,40==e.keyCode&&l<r.length-1&&l++,~l||(l=0),r.eq(l).focus())}}};var r=t.fn.dropdown;t.fn.dropdown=function(e){return this.each(function(){var i=t(this),n=i.data("dropdown");n||i.data("dropdown",n=new s(this)),"string"==typeof e&&n[e].call(i)})},t.fn.dropdown.Constructor=s,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=r,this},t(document).on("click.dropdown.data-api",e).on("click.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.dropdown.data-api",n,s.prototype.toggle).on("keydown.dropdown.data-api",n+", [role=menu]",s.prototype.keydown)}(window.jQuery),!function(t){var e=function(e,i){this.options=i,this.$element=t(e).delegate('[data-dismiss="modal"]',"click.dismiss.modal",t.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};e.prototype={constructor:e,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var e=this,i=t.Event("show");this.$element.trigger(i),this.isShown||i.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var i=t.support.transition&&e.$element.hasClass("fade");e.$element.parent().length||e.$element.appendTo(document.body),e.$element.show(),i&&e.$element[0].offsetWidth,e.$element.addClass("in").attr("aria-hidden",!1),e.enforceFocus(),i?e.$element.one(t.support.transition.end,function(){e.$element.focus().trigger("shown")}):e.$element.focus().trigger("shown")}))},hide:function(e){e&&e.preventDefault(),e=t.Event("hide"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),t(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),t.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())
402
- },enforceFocus:function(){var e=this;t(document).on("focusin.modal",function(t){e.$element[0]===t.target||e.$element.has(t.target).length||e.$element.focus()})},escape:function(){var t=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(e){27==e.which&&t.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var e=this,i=setTimeout(function(){e.$element.off(t.support.transition.end),e.hideModal()},500);this.$element.one(t.support.transition.end,function(){clearTimeout(i),e.hideModal()})},hideModal:function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(e){var i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var n=t.support.transition&&i;if(this.$backdrop=t('<div class="modal-backdrop '+i+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?t.proxy(this.$element[0].focus,this.$element[0]):t.proxy(this.hide,this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;n?this.$backdrop.one(t.support.transition.end,e):e()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(t.support.transition.end,e):e()):e&&e()}};var i=t.fn.modal;t.fn.modal=function(i){return this.each(function(){var n=t(this),s=n.data("modal"),r=t.extend({},t.fn.modal.defaults,n.data(),"object"==typeof i&&i);s||n.data("modal",s=new e(this,r)),"string"==typeof i?s[i]():r.show&&s.show()})},t.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},t.fn.modal.Constructor=e,t.fn.modal.noConflict=function(){return t.fn.modal=i,this},t(document).on("click.modal.data-api",'[data-toggle="modal"]',function(e){var i=t(this),n=i.attr("href"),s=t(i.attr("data-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),r=s.data("modal")?"toggle":t.extend({remote:!/#/.test(n)&&n},s.data(),i.data());e.preventDefault(),s.modal(r).one("hide",function(){i.focus()})})}(window.jQuery),!function(t){var e=function(t,e){this.init("tooltip",t,e)};e.prototype={constructor:e,init:function(e,i,n){var s,r,o,a,l;for(this.type=e,this.$element=t(i),this.options=this.getOptions(n),this.enabled=!0,o=this.options.trigger.split(" "),l=o.length;l--;)a=o[l],"click"==a?this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this)):"manual"!=a&&(s="hover"==a?"mouseenter":"focus",r="hover"==a?"mouseleave":"blur",this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,t.proxy(this.leave,this)));this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(e){return e=t.extend({},t.fn[this.type].defaults,this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},enter:function(e){var i,n=t.fn[this.type].defaults,s={};return this._options&&t.each(this._options,function(t,e){n[t]!=e&&(s[t]=e)},this),i=t(e.currentTarget)[this.type](s).data(this.type),i.options.delay&&i.options.delay.show?(clearTimeout(this.timeout),i.hoverState="in",this.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show),void 0):i.show()},leave:function(e){var i=t(e.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),i.options.delay&&i.options.delay.hide?(i.hoverState="out",this.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide),void 0):i.hide()},show:function(){var e,i,n,s,r,o,a=t.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(a),a.isDefaultPrevented())return;switch(e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),r="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,e.detach().css({top:0,left:0,display:"block"}),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element),i=this.getPosition(),n=e[0].offsetWidth,s=e[0].offsetHeight,r){case"bottom":o={top:i.top+i.height,left:i.left+i.width/2-n/2};break;case"top":o={top:i.top-s,left:i.left+i.width/2-n/2};break;case"left":o={top:i.top+i.height/2-s/2,left:i.left-n};break;case"right":o={top:i.top+i.height/2-s/2,left:i.left+i.width}}this.applyPlacement(o,r),this.$element.trigger("shown")}},applyPlacement:function(t,e){var i,n,s,r,o=this.tip(),a=o[0].offsetWidth,l=o[0].offsetHeight;o.offset(t).addClass(e).addClass("in"),i=o[0].offsetWidth,n=o[0].offsetHeight,"top"==e&&n!=l&&(t.top=t.top+l-n,r=!0),"bottom"==e||"top"==e?(s=0,t.left<0&&(s=-2*t.left,t.left=0,o.offset(t),i=o[0].offsetWidth,n=o[0].offsetHeight),this.replaceArrow(s-a+i,i,"left")):this.replaceArrow(n-l,n,"top"),r&&o.offset(t)},replaceArrow:function(t,e,i){this.arrow().css(i,t?50*(1-t/e)+"%":"")},setContent:function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},hide:function(){function e(){var e=setTimeout(function(){i.off(t.support.transition.end).detach()},500);i.one(t.support.transition.end,function(){clearTimeout(e),i.detach()})}var i=this.tip(),n=t.Event("hide");return this.$element.trigger(n),n.isDefaultPrevented()?void 0:(i.removeClass("in"),t.support.transition&&this.$tip.hasClass("fade")?e():i.detach(),this.$element.trigger("hidden"),this)},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var e=this.$element[0];return t.extend({},"function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight},this.$element.offset())},getTitle:function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},tip:function(){return this.$tip=this.$tip||t(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(e){var i=e?t(e.currentTarget)[this.type](this._options).data(this.type):this;i.tip().hasClass("in")?i.hide():i.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var i=t.fn.tooltip;t.fn.tooltip=function(i){return this.each(function(){var n=t(this),s=n.data("tooltip"),r="object"==typeof i&&i;s||n.data("tooltip",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.tooltip.Constructor=e,t.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},t.fn.tooltip.noConflict=function(){return t.fn.tooltip=i,this}}(window.jQuery),!function(t){var e=function(t,e){this.init("popover",t,e)};e.prototype=t.extend({},t.fn.tooltip.Constructor.prototype,{constructor:e,setContent:function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content")[this.options.html?"html":"text"](i),t.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var t,e=this.$element,i=this.options;return t=("function"==typeof i.content?i.content.call(e[0]):i.content)||e.attr("data-content")},tip:function(){return this.$tip||(this.$tip=t(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var i=t.fn.popover;t.fn.popover=function(i){return this.each(function(){var n=t(this),s=n.data("popover"),r="object"==typeof i&&i;s||n.data("popover",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.popover.Constructor=e,t.fn.popover.defaults=t.extend({},t.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),t.fn.popover.noConflict=function(){return t.fn.popover=i,this}}(window.jQuery),!function(t){function e(e,i){var n,s=t.proxy(this.process,this),r=t(e).is("body")?t(window):t(e);this.options=t.extend({},t.fn.scrollspy.defaults,i),this.$scrollElement=r.on("scroll.scroll-spy.data-api",s),this.selector=(this.options.target||(n=t(e).attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=t("body"),this.refresh(),this.process()}e.prototype={constructor:e,refresh:function(){var e,i=this;this.offsets=t([]),this.targets=t([]),e=this.$body.find(this.selector).map(function(){var e=t(this),n=e.data("target")||e.attr("href"),s=/^#\w/.test(n)&&t(n);return s&&s.length&&[[s.position().top+(!t.isWindow(i.$scrollElement.get(0))&&i.$scrollElement.scrollTop()),n]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){i.offsets.push(this[0]),i.targets.push(this[1])})},process:function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=i-this.$scrollElement.height(),s=this.offsets,r=this.targets,o=this.activeTarget;if(e>=n)return o!=(t=r.last()[0])&&this.activate(t);for(t=s.length;t--;)o!=r[t]&&e>=s[t]&&(!s[t+1]||e<=s[t+1])&&this.activate(r[t])},activate:function(e){var i,n;this.activeTarget=e,t(this.selector).parent(".active").removeClass("active"),n=this.selector+'[data-target="'+e+'"],'+this.selector+'[href="'+e+'"]',i=t(n).parent("li").addClass("active"),i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate")}};var i=t.fn.scrollspy;t.fn.scrollspy=function(i){return this.each(function(){var n=t(this),s=n.data("scrollspy"),r="object"==typeof i&&i;s||n.data("scrollspy",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.scrollspy.Constructor=e,t.fn.scrollspy.defaults={offset:10},t.fn.scrollspy.noConflict=function(){return t.fn.scrollspy=i,this},t(window).on("load",function(){t('[data-spy="scroll"]').each(function(){var e=t(this);e.scrollspy(e.data())})})}(window.jQuery),!function(t){var e=function(e){this.element=t(e)};e.prototype={constructor:e,show:function(){var e,i,n,s=this.element,r=s.closest("ul:not(.dropdown-menu)"),o=s.attr("data-target");o||(o=s.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,"")),s.parent("li").hasClass("active")||(e=r.find(".active:last a")[0],n=t.Event("show",{relatedTarget:e}),s.trigger(n),n.isDefaultPrevented()||(i=t(o),this.activate(s.parent("li"),r),this.activate(i,i.parent(),function(){s.trigger({type:"shown",relatedTarget:e})})))},activate:function(e,i,n){function s(){r.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),e.addClass("active"),o?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu")&&e.closest("li.dropdown").addClass("active"),n&&n()}var r=i.find("> .active"),o=n&&t.support.transition&&r.hasClass("fade");o?r.one(t.support.transition.end,s):s(),r.removeClass("in")}};var i=t.fn.tab;t.fn.tab=function(i){return this.each(function(){var n=t(this),s=n.data("tab");s||n.data("tab",s=new e(this)),"string"==typeof i&&s[i]()})},t.fn.tab.Constructor=e,t.fn.tab.noConflict=function(){return t.fn.tab=i,this},t(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault(),t(this).tab("show")})}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.typeahead.defaults,i),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=t(this.options.menu),this.shown=!1,this.listen()};e.prototype={constructor:e,select:function(){var t=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(t)).change(),this.hide()},updater:function(t){return t},show:function(){var e=t.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:e.top+e.height,left:e.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var e;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(e=t.isFunction(this.source)?this.source(this.query,t.proxy(this.process,this)):this.source,e?this.process(e):this)},process:function(e){var i=this;return e=t.grep(e,function(t){return i.matcher(t)}),e=this.sorter(e),e.length?this.render(e.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(t){return~t.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(t){for(var e,i=[],n=[],s=[];e=t.shift();)e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?n.push(e):s.push(e):i.push(e);return i.concat(n,s)},highlighter:function(t){var e=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return t.replace(new RegExp("("+e+")","ig"),function(t,e){return"<strong>"+e+"</strong>"})},render:function(e){var i=this;return e=t(e).map(function(e,n){return e=t(i.options.item).attr("data-value",n),e.find("a").html(i.highlighter(n)),e[0]}),e.first().addClass("active"),this.$menu.html(e),this},next:function(){var e=this.$menu.find(".active").removeClass("active"),i=e.next();i.length||(i=t(this.$menu.find("li")[0])),i.addClass("active")},prev:function(){var t=this.$menu.find(".active").removeClass("active"),e=t.prev();e.length||(e=this.$menu.find("li").last()),e.addClass("active")},listen:function(){this.$element.on("focus",t.proxy(this.focus,this)).on("blur",t.proxy(this.blur,this)).on("keypress",t.proxy(this.keypress,this)).on("keyup",t.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",t.proxy(this.keydown,this)),this.$menu.on("click",t.proxy(this.click,this)).on("mouseenter","li",t.proxy(this.mouseenter,this)).on("mouseleave","li",t.proxy(this.mouseleave,this))},eventSupported:function(t){var e=t in this.$element;return e||(this.$element.setAttribute(t,"return;"),e="function"==typeof this.$element[t]),e},move:function(t){if(this.shown){switch(t.keyCode){case 9:case 13:case 27:t.preventDefault();break;case 38:t.preventDefault(),this.prev();break;case 40:t.preventDefault(),this.next()}t.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~t.inArray(e.keyCode,[40,38,9,13,27]),this.move(e)},keypress:function(t){this.suppressKeyPressRepeat||this.move(t)},keyup:function(t){switch(t.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}t.stopPropagation(),t.preventDefault()},focus:function(){this.focused=!0},blur:function(){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(t){t.stopPropagation(),t.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(e){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),t(e.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var i=t.fn.typeahead;t.fn.typeahead=function(i){return this.each(function(){var n=t(this),s=n.data("typeahead"),r="object"==typeof i&&i;s||n.data("typeahead",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},t.fn.typeahead.Constructor=e,t.fn.typeahead.noConflict=function(){return t.fn.typeahead=i,this},t(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(){var e=t(this);e.data("typeahead")||e.typeahead(e.data())})}(window.jQuery),!function(t){var e=function(e,i){this.options=t.extend({},t.fn.affix.defaults,i),this.$window=t(window).on("scroll.affix.data-api",t.proxy(this.checkPosition,this)).on("click.affix.data-api",t.proxy(function(){setTimeout(t.proxy(this.checkPosition,this),1)},this)),this.$element=t(e),this.checkPosition()};e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e,i=t(document).height(),n=this.$window.scrollTop(),s=this.$element.offset(),r=this.options.offset,o=r.bottom,a=r.top,l="affix affix-top affix-bottom";"object"!=typeof r&&(o=a=r),"function"==typeof a&&(a=r.top()),"function"==typeof o&&(o=r.bottom()),e=null!=this.unpin&&n+this.unpin<=s.top?!1:null!=o&&s.top+this.$element.height()>=i-o?"bottom":null!=a&&a>=n?"top":!1,this.affixed!==e&&(this.affixed=e,this.unpin="bottom"==e?s.top-n:null,this.$element.removeClass(l).addClass("affix"+(e?"-"+e:"")))}};var i=t.fn.affix;t.fn.affix=function(i){return this.each(function(){var n=t(this),s=n.data("affix"),r="object"==typeof i&&i;s||n.data("affix",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.affix.Constructor=e,t.fn.affix.defaults={offset:0},t.fn.affix.noConflict=function(){return t.fn.affix=i,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var e=t(this),i=e.data();i.offset=i.offset||{},i.offsetBottom&&(i.offset.bottom=i.offsetBottom),i.offsetTop&&(i.offset.top=i.offsetTop),e.affix(i)})})}(window.jQuery),define("bootstrap",function(){}),define("app",["jquery","underscore","backbone","util/templar","route/index","view/alert","view/primarynav","view/header","view/addmonitor","view/dashboard","view/adddashboard","view/addcategory","view/ecosystem","view/secondarynav","view/settings","model/user","model/dashboard","collection/monitor","collection/dashboard","backbone-mediator","jquery-timepicker","bootstrap"],function(t,e,i,n,s,r,o,a,l,h,c,u,d,p,f,m,g,v,y){var b=function(){};return e.extend(b,{initialize:function(){e.bindAll(this),this.auth(),this.alert(),this.primaryNav(),this.header(),this.secondaryNav(),this.addCategory(),i.Mediator.pub("controller:app:init"),this.controllerInit=!0,i.history.start()},addCategory:function(){new u({el:t(".add-category-wrap"),templar:this.templar,user:this.user})},alert:function(){this.auth(),this.alertView=new r({el:t(".alert-wrap"),templar:this.templar})},header:function(){this.auth(),new a({el:t(".header-wrap"),templar:this.templar}).render()},primaryNav:function(){this.auth(),new o({el:t(".primary-nav-wrap"),collection:this.dashboardCollection,user:this.user,templar:this.templar}).render(),new f({el:t(".settings-wrap"),user:this.user,templar:this.templar}).render()},secondaryNav:function(){this.auth(),new p({el:t(".secondary-nav-wrap"),templar:this.templar}).render()},category:function(e,n,s){var r=[];this.auth(),this.destroyViews();var o=new v(null,{dashboardId:e});r.push(new h({el:t(".monitor-panel"),collection:o,dashboardId:e,user:this.user,templar:this.templar,router:this.indexRouter,categoryId:n})),this.renderViews(r),i.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:s,dashboardId:e})},dashboard:function(e,n){var s=[];this.auth(),this.destroyViews();var r=new v(null,{dashboardId:e});s.push(new h({el:t(".monitor-panel"),collection:r,dashboardId:e,user:this.user,templar:this.templar,router:this.indexRouter})),this.renderViews(s),i.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:n,dashboardId:e})},ecosystem:function(){var e=[];this.auth(),this.destroyViews(),e.push(new d({el:t(".ecosystem-dashboard-wrap"),collection:this.dashboardCollection,templar:this.templar}));var n=new g;e.push(new c({el:t(".add-dashboard-wrap"),templar:this.templar,model:n,collection:this.dashboardCollection,user:this.user})),this.renderViews(e),i.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!1}})},destroyViews:function(){if(this.currentView)for(;this.currentView.length>0;)this.currentView.pop().destructor()},renderViews:function(t){this.currentView=t;for(var e=this.currentView.length-1;e>=0;e--)this.currentView[e].render()},auth:function(){this.indexRouter=this.indexRouter?this.indexRouter:new s({app:this}),this.user=this.user?this.user:new m,this.dashboardCollection=this.dashboardCollection?this.dashboardCollection:new y,this.templar=this.templar?this.templar:new n(["addcategory","adddashboard","addmonitor","alert","dashboard","dashboardtile","deletemonitor","expandedmonitor","header","primarynav","schedulemonitor","secondarynav","setmetrics","settings","smallmonitor"],{url:rearview.path+"/templates/",version:e.isUndefined(rearview.version)?"0.0.1":rearview.version,cache:e.isUndefined(rearview.cache)?!0:!1})}}),b}),require.config({paths:{backbone:"../vendor/backbone/js/backbone","backbone-mediator":"../vendor/backbone/plugins/backbone-mediator/js/backbone-mediator","backbone-localStorage":"../vendor/backbone/plugins/backbone-localStorage/js/backbone-localStorage",bootstrap:"../vendor/bootstrap/js/bootstrap","bootstrap-datepicker":"../vendor/bootstrap/plugins/bootstrap-datepicker/js/bootstrap-datepicker",codemirror:"../vendor/codemirror/lib/codemirror","codemirror-ruby":"../vendor/codemirror/mode/ruby/ruby",handlebars:"../vendor/handlebars/js/handlebars",highcharts:"../vendor/highcharts/js/highcharts","highcharts-theme":"../js/util/highcharts-gray-theme",jquery:"../vendor/jquery/js/jquery","jquery-validate":"../vendor/jquery/plugins/jquery.validate","jquery-ui":"../vendor/jquery/plugins/jquery-ui/js/jquery-ui-1.10.3.custom.min","jquery-timepicker":"../vendor/jquery/plugins/timepicker-ui/js/jquery.timepicker",parsley:"../vendor/parsley/js/parsley.min",underscore:"../vendor/underscore/js/underscore","underscore-string":"../vendor/underscore/plugins/underscore-string/js/underscore.string",xdate:"../vendor/xdate/js/xdate",timeline:"../vendor/timeline/timeline"},shim:{backbone:{deps:["underscore","jquery"],exports:"Backbone"},"backbone-mediator":{deps:["underscore","backbone"]},"backbone-localStorage":{deps:["backbone"],exports:"Backbone.LocalStorage"},"bootstrap-datepicker":{deps:["bootstrap","jquery"]},codemirror:{exports:"CodeMirror"},"codemirror-ruby":{deps:["codemirror"]},handlebars:{exports:"Handlebars"},"highcharts-theme":{deps:["jquery","highcharts"]},highcharts:{deps:["jquery"],exports:"Highcharts"},jquery:{exports:"$"},"jquery-validate":{deps:["jquery"]},"jquery-ui":{deps:["jquery"]},"jquery-timepicker":{deps:["jquery-ui","jquery"]},parsley:{deps:["jquery"]},timeline:{deps:["xdate"],exports:"timeline"},underscore:{exports:"_"},"underscore-string":{exports:"_.str"}}}),define("main",["app"],function(t){t.initialize()});
380
+ !function(t,e){function i(t){var e=fe[t]={};return Z.each(t.split(ee),function(t,i){e[i]=!0}),e}function n(t,i,n){if(n===e&&1===t.nodeType){var s="data-"+i.replace(ge,"-$1").toLowerCase();if(n=t.getAttribute(s),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:me.test(n)?Z.parseJSON(n):n}catch(r){}Z.data(t,i,n)}else n=e}return n}function s(t){var e;for(e in t)if(("data"!==e||!Z.isEmptyObject(t[e]))&&"toJSON"!==e)return!1;return!0}function r(){return!1}function o(){return!0}function a(t){return!t||!t.parentNode||11===t.parentNode.nodeType}function l(t,e){do t=t[e];while(t&&1!==t.nodeType);return t}function h(t,e,i){if(e=e||0,Z.isFunction(e))return Z.grep(t,function(t,n){var s=!!e.call(t,n,t);return s===i});if(e.nodeType)return Z.grep(t,function(t){return t===e===i});if("string"==typeof e){var n=Z.grep(t,function(t){return 1===t.nodeType});if(ze.test(e))return Z.filter(e,n,!i);e=Z.filter(e,n)}return Z.grep(t,function(t){return Z.inArray(t,e)>=0===i})}function c(t){var e=He.split("|"),i=t.createDocumentFragment();if(i.createElement)for(;e.length;)i.createElement(e.pop());return i}function u(t,e){return t.getElementsByTagName(e)[0]||t.appendChild(t.ownerDocument.createElement(e))}function d(t,e){if(1===e.nodeType&&Z.hasData(t)){var i,n,s,r=Z._data(t),o=Z._data(e,r),a=r.events;if(a){delete o.handle,o.events={};for(i in a)for(n=0,s=a[i].length;s>n;n++)Z.event.add(e,i,a[i][n])}o.data&&(o.data=Z.extend({},o.data))}}function p(t,e){var i;1===e.nodeType&&(e.clearAttributes&&e.clearAttributes(),e.mergeAttributes&&e.mergeAttributes(t),i=e.nodeName.toLowerCase(),"object"===i?(e.parentNode&&(e.outerHTML=t.outerHTML),Z.support.html5Clone&&t.innerHTML&&!Z.trim(e.innerHTML)&&(e.innerHTML=t.innerHTML)):"input"===i&&Xe.test(t.type)?(e.defaultChecked=e.checked=t.checked,e.value!==t.value&&(e.value=t.value)):"option"===i?e.selected=t.defaultSelected:"input"===i||"textarea"===i?e.defaultValue=t.defaultValue:"script"===i&&e.text!==t.text&&(e.text=t.text),e.removeAttribute(Z.expando))}function f(t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName("*"):"undefined"!=typeof t.querySelectorAll?t.querySelectorAll("*"):[]}function m(t){Xe.test(t.type)&&(t.defaultChecked=t.checked)}function g(t,e){if(e in t)return e;for(var i=e.charAt(0).toUpperCase()+e.slice(1),n=e,s=vi.length;s--;)if(e=vi[s]+i,e in t)return e;return n}function v(t,e){return t=e||t,"none"===Z.css(t,"display")||!Z.contains(t.ownerDocument,t)}function y(t,e){for(var i,n,s=[],r=0,o=t.length;o>r;r++)i=t[r],i.style&&(s[r]=Z._data(i,"olddisplay"),e?(s[r]||"none"!==i.style.display||(i.style.display=""),""===i.style.display&&v(i)&&(s[r]=Z._data(i,"olddisplay",k(i.nodeName)))):(n=ii(i,"display"),s[r]||"none"===n||Z._data(i,"olddisplay",n)));for(r=0;o>r;r++)i=t[r],i.style&&(e&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=e?s[r]||"":"none"));return t}function b(t,e,i){var n=ci.exec(e);return n?Math.max(0,n[1]-(i||0))+(n[2]||"px"):e}function x(t,e,i,n){for(var s=i===(n?"border":"content")?4:"width"===e?1:0,r=0;4>s;s+=2)"margin"===i&&(r+=Z.css(t,i+gi[s],!0)),n?("content"===i&&(r-=parseFloat(ii(t,"padding"+gi[s]))||0),"margin"!==i&&(r-=parseFloat(ii(t,"border"+gi[s]+"Width"))||0)):(r+=parseFloat(ii(t,"padding"+gi[s]))||0,"padding"!==i&&(r+=parseFloat(ii(t,"border"+gi[s]+"Width"))||0));return r}function w(t,e,i){var n="width"===e?t.offsetWidth:t.offsetHeight,s=!0,r=Z.support.boxSizing&&"border-box"===Z.css(t,"boxSizing");if(0>=n||null==n){if(n=ii(t,e),(0>n||null==n)&&(n=t.style[e]),ui.test(n))return n;s=r&&(Z.support.boxSizingReliable||n===t.style[e]),n=parseFloat(n)||0}return n+x(t,e,i||(r?"border":"content"),s)+"px"}function k(t){if(pi[t])return pi[t];var e=Z("<"+t+">").appendTo(R.body),i=e.css("display");return e.remove(),("none"===i||""===i)&&(ni=R.body.appendChild(ni||Z.extend(R.createElement("iframe"),{frameBorder:0,width:0,height:0})),si&&ni.createElement||(si=(ni.contentWindow||ni.contentDocument).document,si.write("<!doctype html><html><body>"),si.close()),e=si.body.appendChild(si.createElement(t)),i=ii(e,"display"),R.body.removeChild(ni)),pi[t]=i,i}function _(t,e,i,n){var s;if(Z.isArray(e))Z.each(e,function(e,s){i||xi.test(t)?n(t,s):_(t+"["+("object"==typeof s?e:"")+"]",s,i,n)});else if(i||"object"!==Z.type(e))n(t,e);else for(s in e)_(t+"["+s+"]",e[s],i,n)}function C(t){return function(e,i){"string"!=typeof e&&(i=e,e="*");var n,s,r,o=e.toLowerCase().split(ee),a=0,l=o.length;if(Z.isFunction(i))for(;l>a;a++)n=o[a],r=/^\+/.test(n),r&&(n=n.substr(1)||"*"),s=t[n]=t[n]||[],s[r?"unshift":"push"](i)}}function D(t,i,n,s,r,o){r=r||i.dataTypes[0],o=o||{},o[r]=!0;for(var a,l=t[r],h=0,c=l?l.length:0,u=t===zi;c>h&&(u||!a);h++)a=l[h](i,n,s),"string"==typeof a&&(!u||o[a]?a=e:(i.dataTypes.unshift(a),a=D(t,i,n,s,a,o)));return!u&&a||o["*"]||(a=D(t,i,n,s,"*",o)),a}function M(t,i){var n,s,r=Z.ajaxSettings.flatOptions||{};for(n in i)i[n]!==e&&((r[n]?t:s||(s={}))[n]=i[n]);s&&Z.extend(!0,t,s)}function S(t,i,n){var s,r,o,a,l=t.contents,h=t.dataTypes,c=t.responseFields;for(r in c)r in n&&(i[c[r]]=n[r]);for(;"*"===h[0];)h.shift(),s===e&&(s=t.mimeType||i.getResponseHeader("content-type"));if(s)for(r in l)if(l[r]&&l[r].test(s)){h.unshift(r);break}if(h[0]in n)o=h[0];else{for(r in n){if(!h[0]||t.converters[r+" "+h[0]]){o=r;break}a||(a=r)}o=o||a}return o?(o!==h[0]&&h.unshift(o),n[o]):void 0}function T(t,e){var i,n,s,r,o=t.dataTypes.slice(),a=o[0],l={},h=0;if(t.dataFilter&&(e=t.dataFilter(e,t.dataType)),o[1])for(i in t.converters)l[i.toLowerCase()]=t.converters[i];for(;s=o[++h];)if("*"!==s){if("*"!==a&&a!==s){if(i=l[a+" "+s]||l["* "+s],!i)for(n in l)if(r=n.split(" "),r[1]===s&&(i=l[a+" "+r[0]]||l["* "+r[0]])){i===!0?i=l[n]:l[n]!==!0&&(s=r[0],o.splice(h--,0,s));break}if(i!==!0)if(i&&t["throws"])e=i(e);else try{e=i(e)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+a+" to "+s}}}a=s}return{state:"success",data:e}}function A(){try{return new t.XMLHttpRequest}catch(e){}}function E(){try{return new t.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function F(){return setTimeout(function(){Gi=e},0),Gi=Z.now()}function I(t,e){Z.each(e,function(e,i){for(var n=(Qi[e]||[]).concat(Qi["*"]),s=0,r=n.length;r>s;s++)if(n[s].call(t,e,i))return})}function L(t,e,i){var n,s=0,r=Zi.length,o=Z.Deferred().always(function(){delete a.elem}),a=function(){for(var e=Gi||F(),i=Math.max(0,l.startTime+l.duration-e),n=1-(i/l.duration||0),s=0,r=l.tweens.length;r>s;s++)l.tweens[s].run(n);return o.notifyWith(t,[l,n,i]),1>n&&r?i:(o.resolveWith(t,[l]),!1)},l=o.promise({elem:t,props:Z.extend({},e),opts:Z.extend(!0,{specialEasing:{}},i),originalProperties:e,originalOptions:i,startTime:Gi||F(),duration:i.duration,tweens:[],createTween:function(e,i){var n=Z.Tween(t,l.opts,e,i,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){for(var i=0,n=e?l.tweens.length:0;n>i;i++)l.tweens[i].run(1);return e?o.resolveWith(t,[l,e]):o.rejectWith(t,[l,e]),this}}),h=l.props;for(N(h,l.opts.specialEasing);r>s;s++)if(n=Zi[s].call(l,t,h,l.opts))return n;return I(l,h),Z.isFunction(l.opts.start)&&l.opts.start.call(t,l),Z.fx.timer(Z.extend(a,{anim:l,queue:l.opts.queue,elem:t})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function N(t,e){var i,n,s,r,o;for(i in t)if(n=Z.camelCase(i),s=e[n],r=t[i],Z.isArray(r)&&(s=r[1],r=t[i]=r[0]),i!==n&&(t[n]=r,delete t[i]),o=Z.cssHooks[n],o&&"expand"in o){r=o.expand(r),delete t[n];for(i in r)i in t||(t[i]=r[i],e[i]=s)}else e[n]=s}function $(t,e,i){var n,s,r,o,a,l,h,c,u=this,d=t.style,p={},f=[],m=t.nodeType&&v(t);i.queue||(h=Z._queueHooks(t,"fx"),null==h.unqueued&&(h.unqueued=0,c=h.empty.fire,h.empty.fire=function(){h.unqueued||c()}),h.unqueued++,u.always(function(){u.always(function(){h.unqueued--,Z.queue(t,"fx").length||h.empty.fire()})})),1===t.nodeType&&("height"in e||"width"in e)&&(i.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===Z.css(t,"display")&&"none"===Z.css(t,"float")&&(Z.support.inlineBlockNeedsLayout&&"inline"!==k(t.nodeName)?d.zoom=1:d.display="inline-block")),i.overflow&&(d.overflow="hidden",Z.support.shrinkWrapBlocks||u.done(function(){d.overflow=i.overflow[0],d.overflowX=i.overflow[1],d.overflowY=i.overflow[2]}));for(n in e)if(r=e[n],Xi.exec(r)){if(delete e[n],r===(m?"hide":"show"))continue;f.push(n)}if(o=f.length)for(a=Z._data(t,"fxshow")||Z._data(t,"fxshow",{}),m?Z(t).show():u.done(function(){Z(t).hide()}),u.done(function(){var e;Z.removeData(t,"fxshow",!0);for(e in p)Z.style(t,e,p[e])}),n=0;o>n;n++)s=f[n],l=u.createTween(s,m?a[s]:0),p[s]=a[s]||Z.style(t,s),s in a||(a[s]=l.start,m&&(l.end=l.start,l.start="width"===s||"height"===s?1:0))}function z(t,e,i,n,s){return new z.prototype.init(t,e,i,n,s)}function P(t,e){var i,n={height:t},s=0;for(e=e?1:0;4>s;s+=2-e)i=gi[s],n["margin"+i]=n["padding"+i]=t;return e&&(n.opacity=n.width=t),n}function O(t){return Z.isWindow(t)?t:9===t.nodeType?t.defaultView||t.parentWindow:!1}var H,W,R=t.document,j=t.location,B=t.navigator,Y=t.jQuery,V=t.$,U=Array.prototype.push,G=Array.prototype.slice,q=Array.prototype.indexOf,X=Object.prototype.toString,K=Object.prototype.hasOwnProperty,J=String.prototype.trim,Z=function(t,e){return new Z.fn.init(t,e,H)},Q=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,te=/\S/,ee=/\s+/,ie=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ne=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,se=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,re=/^[\],:{}\s]*$/,oe=/(?:^|:|,)(?:\s*\[)+/g,ae=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,le=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,he=/^-ms-/,ce=/-([\da-z])/gi,ue=function(t,e){return(e+"").toUpperCase()},de=function(){R.addEventListener?(R.removeEventListener("DOMContentLoaded",de,!1),Z.ready()):"complete"===R.readyState&&(R.detachEvent("onreadystatechange",de),Z.ready())},pe={};Z.fn=Z.prototype={constructor:Z,init:function(t,i,n){var s,r,o;if(!t)return this;if(t.nodeType)return this.context=this[0]=t,this.length=1,this;if("string"==typeof t){if(s="<"===t.charAt(0)&&">"===t.charAt(t.length-1)&&t.length>=3?[null,t,null]:ne.exec(t),!s||!s[1]&&i)return!i||i.jquery?(i||n).find(t):this.constructor(i).find(t);if(s[1])return i=i instanceof Z?i[0]:i,o=i&&i.nodeType?i.ownerDocument||i:R,t=Z.parseHTML(s[1],o,!0),se.test(s[1])&&Z.isPlainObject(i)&&this.attr.call(t,i,!0),Z.merge(this,t);if(r=R.getElementById(s[2]),r&&r.parentNode){if(r.id!==s[2])return n.find(t);this.length=1,this[0]=r}return this.context=R,this.selector=t,this}return Z.isFunction(t)?n.ready(t):(t.selector!==e&&(this.selector=t.selector,this.context=t.context),Z.makeArray(t,this))},selector:"",jquery:"1.8.2",length:0,size:function(){return this.length},toArray:function(){return G.call(this)},get:function(t){return null==t?this.toArray():0>t?this[this.length+t]:this[t]},pushStack:function(t,e,i){var n=Z.merge(this.constructor(),t);return n.prevObject=this,n.context=this.context,"find"===e?n.selector=this.selector+(this.selector?" ":"")+i:e&&(n.selector=this.selector+"."+e+"("+i+")"),n},each:function(t,e){return Z.each(this,t,e)},ready:function(t){return Z.ready.promise().done(t),this},eq:function(t){return t=+t,-1===t?this.slice(t):this.slice(t,t+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(t){return this.pushStack(Z.map(this,function(e,i){return t.call(e,i,e)}))},end:function(){return this.prevObject||this.constructor(null)},push:U,sort:[].sort,splice:[].splice},Z.fn.init.prototype=Z.fn,Z.extend=Z.fn.extend=function(){var t,i,n,s,r,o,a=arguments[0]||{},l=1,h=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[1]||{},l=2),"object"==typeof a||Z.isFunction(a)||(a={}),h===l&&(a=this,--l);h>l;l++)if(null!=(t=arguments[l]))for(i in t)n=a[i],s=t[i],a!==s&&(c&&s&&(Z.isPlainObject(s)||(r=Z.isArray(s)))?(r?(r=!1,o=n&&Z.isArray(n)?n:[]):o=n&&Z.isPlainObject(n)?n:{},a[i]=Z.extend(c,o,s)):s!==e&&(a[i]=s));return a},Z.extend({noConflict:function(e){return t.$===Z&&(t.$=V),e&&t.jQuery===Z&&(t.jQuery=Y),Z},isReady:!1,readyWait:1,holdReady:function(t){t?Z.readyWait++:Z.ready(!0)},ready:function(t){if(t===!0?!--Z.readyWait:!Z.isReady){if(!R.body)return setTimeout(Z.ready,1);Z.isReady=!0,t!==!0&&--Z.readyWait>0||(W.resolveWith(R,[Z]),Z.fn.trigger&&Z(R).trigger("ready").off("ready"))}},isFunction:function(t){return"function"===Z.type(t)},isArray:Array.isArray||function(t){return"array"===Z.type(t)},isWindow:function(t){return null!=t&&t==t.window},isNumeric:function(t){return!isNaN(parseFloat(t))&&isFinite(t)},type:function(t){return null==t?String(t):pe[X.call(t)]||"object"},isPlainObject:function(t){if(!t||"object"!==Z.type(t)||t.nodeType||Z.isWindow(t))return!1;try{if(t.constructor&&!K.call(t,"constructor")&&!K.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(i){return!1}var n;for(n in t);return n===e||K.call(t,n)},isEmptyObject:function(t){var e;for(e in t)return!1;return!0},error:function(t){throw new Error(t)},parseHTML:function(t,e,i){var n;return t&&"string"==typeof t?("boolean"==typeof e&&(i=e,e=0),e=e||R,(n=se.exec(t))?[e.createElement(n[1])]:(n=Z.buildFragment([t],e,i?null:[]),Z.merge([],(n.cacheable?Z.clone(n.fragment):n.fragment).childNodes))):null},parseJSON:function(e){return e&&"string"==typeof e?(e=Z.trim(e),t.JSON&&t.JSON.parse?t.JSON.parse(e):re.test(e.replace(ae,"@").replace(le,"]").replace(oe,""))?new Function("return "+e)():(Z.error("Invalid JSON: "+e),void 0)):null},parseXML:function(i){var n,s;if(!i||"string"!=typeof i)return null;try{t.DOMParser?(s=new DOMParser,n=s.parseFromString(i,"text/xml")):(n=new ActiveXObject("Microsoft.XMLDOM"),n.async="false",n.loadXML(i))}catch(r){n=e}return n&&n.documentElement&&!n.getElementsByTagName("parsererror").length||Z.error("Invalid XML: "+i),n},noop:function(){},globalEval:function(e){e&&te.test(e)&&(t.execScript||function(e){t.eval.call(t,e)})(e)},camelCase:function(t){return t.replace(he,"ms-").replace(ce,ue)},nodeName:function(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()},each:function(t,i,n){var s,r=0,o=t.length,a=o===e||Z.isFunction(t);if(n)if(a){for(s in t)if(i.apply(t[s],n)===!1)break}else for(;o>r&&i.apply(t[r++],n)!==!1;);else if(a){for(s in t)if(i.call(t[s],s,t[s])===!1)break}else for(;o>r&&i.call(t[r],r,t[r++])!==!1;);return t},trim:J&&!J.call(" ")?function(t){return null==t?"":J.call(t)}:function(t){return null==t?"":(t+"").replace(ie,"")},makeArray:function(t,e){var i,n=e||[];return null!=t&&(i=Z.type(t),null==t.length||"string"===i||"function"===i||"regexp"===i||Z.isWindow(t)?U.call(n,t):Z.merge(n,t)),n},inArray:function(t,e,i){var n;if(e){if(q)return q.call(e,t,i);for(n=e.length,i=i?0>i?Math.max(0,n+i):i:0;n>i;i++)if(i in e&&e[i]===t)return i}return-1},merge:function(t,i){var n=i.length,s=t.length,r=0;if("number"==typeof n)for(;n>r;r++)t[s++]=i[r];else for(;i[r]!==e;)t[s++]=i[r++];return t.length=s,t},grep:function(t,e,i){var n,s=[],r=0,o=t.length;for(i=!!i;o>r;r++)n=!!e(t[r],r),i!==n&&s.push(t[r]);return s},map:function(t,i,n){var s,r,o=[],a=0,l=t.length,h=t instanceof Z||l!==e&&"number"==typeof l&&(l>0&&t[0]&&t[l-1]||0===l||Z.isArray(t));if(h)for(;l>a;a++)s=i(t[a],a,n),null!=s&&(o[o.length]=s);else for(r in t)s=i(t[r],r,n),null!=s&&(o[o.length]=s);return o.concat.apply([],o)},guid:1,proxy:function(t,i){var n,s,r;return"string"==typeof i&&(n=t[i],i=t,t=n),Z.isFunction(t)?(s=G.call(arguments,2),r=function(){return t.apply(i,s.concat(G.call(arguments)))},r.guid=t.guid=t.guid||Z.guid++,r):e},access:function(t,i,n,s,r,o,a){var l,h=null==n,c=0,u=t.length;if(n&&"object"==typeof n){for(c in n)Z.access(t,i,c,n[c],1,o,s);r=1}else if(s!==e){if(l=a===e&&Z.isFunction(s),h&&(l?(l=i,i=function(t,e,i){return l.call(Z(t),i)}):(i.call(t,s),i=null)),i)for(;u>c;c++)i(t[c],n,l?s.call(t[c],c,i(t[c],n)):s,a);r=1}return r?t:h?i.call(t):u?i(t[0],n):o},now:function(){return(new Date).getTime()}}),Z.ready.promise=function(e){if(!W)if(W=Z.Deferred(),"complete"===R.readyState)setTimeout(Z.ready,1);else if(R.addEventListener)R.addEventListener("DOMContentLoaded",de,!1),t.addEventListener("load",Z.ready,!1);else{R.attachEvent("onreadystatechange",de),t.attachEvent("onload",Z.ready);var i=!1;try{i=null==t.frameElement&&R.documentElement}catch(n){}i&&i.doScroll&&!function s(){if(!Z.isReady){try{i.doScroll("left")}catch(t){return setTimeout(s,50)}Z.ready()}}()}return W.promise(e)},Z.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(t,e){pe["[object "+e+"]"]=e.toLowerCase()}),H=Z(R);var fe={};Z.Callbacks=function(t){t="string"==typeof t?fe[t]||i(t):Z.extend({},t);var n,s,r,o,a,l,h=[],c=!t.once&&[],u=function(e){for(n=t.memory&&e,s=!0,l=o||0,o=0,a=h.length,r=!0;h&&a>l;l++)if(h[l].apply(e[0],e[1])===!1&&t.stopOnFalse){n=!1;break}r=!1,h&&(c?c.length&&u(c.shift()):n?h=[]:d.disable())},d={add:function(){if(h){var e=h.length;!function i(e){Z.each(e,function(e,n){var s=Z.type(n);"function"!==s||t.unique&&d.has(n)?n&&n.length&&"string"!==s&&i(n):h.push(n)})}(arguments),r?a=h.length:n&&(o=e,u(n))}return this},remove:function(){return h&&Z.each(arguments,function(t,e){for(var i;(i=Z.inArray(e,h,i))>-1;)h.splice(i,1),r&&(a>=i&&a--,l>=i&&l--)}),this},has:function(t){return Z.inArray(t,h)>-1},empty:function(){return h=[],this},disable:function(){return h=c=n=e,this},disabled:function(){return!h},lock:function(){return c=e,n||d.disable(),this},locked:function(){return!c},fireWith:function(t,e){return e=e||[],e=[t,e.slice?e.slice():e],!h||s&&!c||(r?c.push(e):u(e)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!s}};return d},Z.extend({Deferred:function(t){var e=[["resolve","done",Z.Callbacks("once memory"),"resolved"],["reject","fail",Z.Callbacks("once memory"),"rejected"],["notify","progress",Z.Callbacks("memory")]],i="pending",n={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var t=arguments;return Z.Deferred(function(i){Z.each(e,function(e,n){var r=n[0],o=t[e];s[n[1]](Z.isFunction(o)?function(){var t=o.apply(this,arguments);t&&Z.isFunction(t.promise)?t.promise().done(i.resolve).fail(i.reject).progress(i.notify):i[r+"With"](this===s?i:this,[t])}:i[r])}),t=null}).promise()},promise:function(t){return null!=t?Z.extend(t,n):n}},s={};return n.pipe=n.then,Z.each(e,function(t,r){var o=r[2],a=r[3];n[r[1]]=o.add,a&&o.add(function(){i=a},e[1^t][2].disable,e[2][2].lock),s[r[0]]=o.fire,s[r[0]+"With"]=o.fireWith}),n.promise(s),t&&t.call(s,s),s},when:function(t){var e,i,n,s=0,r=G.call(arguments),o=r.length,a=1!==o||t&&Z.isFunction(t.promise)?o:0,l=1===a?t:Z.Deferred(),h=function(t,i,n){return function(s){i[t]=this,n[t]=arguments.length>1?G.call(arguments):s,n===e?l.notifyWith(i,n):--a||l.resolveWith(i,n)}};if(o>1)for(e=new Array(o),i=new Array(o),n=new Array(o);o>s;s++)r[s]&&Z.isFunction(r[s].promise)?r[s].promise().done(h(s,n,r)).fail(l.reject).progress(h(s,i,e)):--a;return a||l.resolveWith(n,r),l.promise()}}),Z.support=function(){var e,i,n,s,r,o,a,l,h,c,u,d=R.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",i=d.getElementsByTagName("*"),n=d.getElementsByTagName("a")[0],n.style.cssText="top:1px;float:left;opacity:.5",!i||!i.length)return{};s=R.createElement("select"),r=s.appendChild(R.createElement("option")),o=d.getElementsByTagName("input")[0],e={leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(n.getAttribute("style")),hrefNormalized:"/a"===n.getAttribute("href"),opacity:/^0.5/.test(n.style.opacity),cssFloat:!!n.style.cssFloat,checkOn:"on"===o.value,optSelected:r.selected,getSetAttribute:"t"!==d.className,enctype:!!R.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==R.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===R.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},o.checked=!0,e.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,e.optDisabled=!r.disabled;try{delete d.test}catch(p){e.deleteExpando=!1}if(!d.addEventListener&&d.attachEvent&&d.fireEvent&&(d.attachEvent("onclick",u=function(){e.noCloneEvent=!1}),d.cloneNode(!0).fireEvent("onclick"),d.detachEvent("onclick",u)),o=R.createElement("input"),o.value="t",o.setAttribute("type","radio"),e.radioValue="t"===o.value,o.setAttribute("checked","checked"),o.setAttribute("name","t"),d.appendChild(o),a=R.createDocumentFragment(),a.appendChild(d.lastChild),e.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,e.appendChecked=o.checked,a.removeChild(o),a.appendChild(d),d.attachEvent)for(h in{submit:!0,change:!0,focusin:!0})l="on"+h,c=l in d,c||(d.setAttribute(l,"return;"),c="function"==typeof d[l]),e[h+"Bubbles"]=c;return Z(function(){var i,n,s,r,o="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=R.getElementsByTagName("body")[0];a&&(i=R.createElement("div"),i.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(i,a.firstChild),n=R.createElement("div"),i.appendChild(n),n.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=n.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=0===s[0].offsetHeight,s[0].style.display="",s[1].style.display="none",e.reliableHiddenOffsets=c&&0===s[0].offsetHeight,n.innerHTML="",n.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",e.boxSizing=4===n.offsetWidth,e.doesNotIncludeMarginInBodyOffset=1!==a.offsetTop,t.getComputedStyle&&(e.pixelPosition="1%"!==(t.getComputedStyle(n,null)||{}).top,e.boxSizingReliable="4px"===(t.getComputedStyle(n,null)||{width:"4px"}).width,r=R.createElement("div"),r.style.cssText=n.style.cssText=o,r.style.marginRight=r.style.width="0",n.style.width="1px",n.appendChild(r),e.reliableMarginRight=!parseFloat((t.getComputedStyle(r,null)||{}).marginRight)),"undefined"!=typeof n.style.zoom&&(n.innerHTML="",n.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",e.inlineBlockNeedsLayout=3===n.offsetWidth,n.style.display="block",n.style.overflow="visible",n.innerHTML="<div></div>",n.firstChild.style.width="5px",e.shrinkWrapBlocks=3!==n.offsetWidth,i.style.zoom=1),a.removeChild(i),i=n=s=r=null)}),a.removeChild(d),i=n=s=r=o=a=d=null,e}();var me=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,ge=/([A-Z])/g;Z.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(Z.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(t){return t=t.nodeType?Z.cache[t[Z.expando]]:t[Z.expando],!!t&&!s(t)},data:function(t,i,n,s){if(Z.acceptData(t)){var r,o,a=Z.expando,l="string"==typeof i,h=t.nodeType,c=h?Z.cache:t,u=h?t[a]:t[a]&&a;if(u&&c[u]&&(s||c[u].data)||!l||n!==e)return u||(h?t[a]=u=Z.deletedIds.pop()||Z.guid++:u=a),c[u]||(c[u]={},h||(c[u].toJSON=Z.noop)),("object"==typeof i||"function"==typeof i)&&(s?c[u]=Z.extend(c[u],i):c[u].data=Z.extend(c[u].data,i)),r=c[u],s||(r.data||(r.data={}),r=r.data),n!==e&&(r[Z.camelCase(i)]=n),l?(o=r[i],null==o&&(o=r[Z.camelCase(i)])):o=r,o}},removeData:function(t,e,i){if(Z.acceptData(t)){var n,r,o,a=t.nodeType,l=a?Z.cache:t,h=a?t[Z.expando]:Z.expando;if(l[h]){if(e&&(n=i?l[h]:l[h].data)){Z.isArray(e)||(e in n?e=[e]:(e=Z.camelCase(e),e=e in n?[e]:e.split(" ")));for(r=0,o=e.length;o>r;r++)delete n[e[r]];if(!(i?s:Z.isEmptyObject)(n))return}(i||(delete l[h].data,s(l[h])))&&(a?Z.cleanData([t],!0):Z.support.deleteExpando||l!=l.window?delete l[h]:l[h]=null)}}},_data:function(t,e,i){return Z.data(t,e,i,!0)},acceptData:function(t){var e=t.nodeName&&Z.noData[t.nodeName.toLowerCase()];return!e||e!==!0&&t.getAttribute("classid")===e}}),Z.fn.extend({data:function(t,i){var s,r,o,a,l,h=this[0],c=0,u=null;if(t===e){if(this.length&&(u=Z.data(h),1===h.nodeType&&!Z._data(h,"parsedAttrs"))){for(o=h.attributes,l=o.length;l>c;c++)a=o[c].name,a.indexOf("data-")||(a=Z.camelCase(a.substring(5)),n(h,a,u[a]));Z._data(h,"parsedAttrs",!0)}return u}return"object"==typeof t?this.each(function(){Z.data(this,t)}):(s=t.split(".",2),s[1]=s[1]?"."+s[1]:"",r=s[1]+"!",Z.access(this,function(i){return i===e?(u=this.triggerHandler("getData"+r,[s[0]]),u===e&&h&&(u=Z.data(h,t),u=n(h,t,u)),u===e&&s[1]?this.data(s[0]):u):(s[1]=i,this.each(function(){var e=Z(this);e.triggerHandler("setData"+r,s),Z.data(this,t,i),e.triggerHandler("changeData"+r,s)}),void 0)},null,i,arguments.length>1,null,!1))},removeData:function(t){return this.each(function(){Z.removeData(this,t)})}}),Z.extend({queue:function(t,e,i){var n;return t?(e=(e||"fx")+"queue",n=Z._data(t,e),i&&(!n||Z.isArray(i)?n=Z._data(t,e,Z.makeArray(i)):n.push(i)),n||[]):void 0},dequeue:function(t,e){e=e||"fx";var i=Z.queue(t,e),n=i.length,s=i.shift(),r=Z._queueHooks(t,e),o=function(){Z.dequeue(t,e)};"inprogress"===s&&(s=i.shift(),n--),s&&("fx"===e&&i.unshift("inprogress"),delete r.stop,s.call(t,o,r)),!n&&r&&r.empty.fire()},_queueHooks:function(t,e){var i=e+"queueHooks";return Z._data(t,i)||Z._data(t,i,{empty:Z.Callbacks("once memory").add(function(){Z.removeData(t,e+"queue",!0),Z.removeData(t,i,!0)})})}}),Z.fn.extend({queue:function(t,i){var n=2;return"string"!=typeof t&&(i=t,t="fx",n--),arguments.length<n?Z.queue(this[0],t):i===e?this:this.each(function(){var e=Z.queue(this,t,i);Z._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&Z.dequeue(this,t)})},dequeue:function(t){return this.each(function(){Z.dequeue(this,t)})},delay:function(t,e){return t=Z.fx?Z.fx.speeds[t]||t:t,e=e||"fx",this.queue(e,function(e,i){var n=setTimeout(e,t);i.stop=function(){clearTimeout(n)}})},clearQueue:function(t){return this.queue(t||"fx",[])},promise:function(t,i){var n,s=1,r=Z.Deferred(),o=this,a=this.length,l=function(){--s||r.resolveWith(o,[o])};for("string"!=typeof t&&(i=t,t=e),t=t||"fx";a--;)n=Z._data(o[a],t+"queueHooks"),n&&n.empty&&(s++,n.empty.add(l));return l(),r.promise(i)}});var ve,ye,be,xe=/[\t\r\n]/g,we=/\r/g,ke=/^(?:button|input)$/i,_e=/^(?:button|input|object|select|textarea)$/i,Ce=/^a(?:rea|)$/i,De=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,Me=Z.support.getSetAttribute;Z.fn.extend({attr:function(t,e){return Z.access(this,Z.attr,t,e,arguments.length>1)},removeAttr:function(t){return this.each(function(){Z.removeAttr(this,t)})},prop:function(t,e){return Z.access(this,Z.prop,t,e,arguments.length>1)},removeProp:function(t){return t=Z.propFix[t]||t,this.each(function(){try{this[t]=e,delete this[t]}catch(i){}})},addClass:function(t){var e,i,n,s,r,o,a;if(Z.isFunction(t))return this.each(function(e){Z(this).addClass(t.call(this,e,this.className))});if(t&&"string"==typeof t)for(e=t.split(ee),i=0,n=this.length;n>i;i++)if(s=this[i],1===s.nodeType)if(s.className||1!==e.length){for(r=" "+s.className+" ",o=0,a=e.length;a>o;o++)r.indexOf(" "+e[o]+" ")<0&&(r+=e[o]+" ");s.className=Z.trim(r)}else s.className=t;return this},removeClass:function(t){var i,n,s,r,o,a,l;if(Z.isFunction(t))return this.each(function(e){Z(this).removeClass(t.call(this,e,this.className))});if(t&&"string"==typeof t||t===e)for(i=(t||"").split(ee),a=0,l=this.length;l>a;a++)if(s=this[a],1===s.nodeType&&s.className){for(n=(" "+s.className+" ").replace(xe," "),r=0,o=i.length;o>r;r++)for(;n.indexOf(" "+i[r]+" ")>=0;)n=n.replace(" "+i[r]+" "," ");s.className=t?Z.trim(n):""}return this},toggleClass:function(t,e){var i=typeof t,n="boolean"==typeof e;return Z.isFunction(t)?this.each(function(i){Z(this).toggleClass(t.call(this,i,this.className,e),e)}):this.each(function(){if("string"===i)for(var s,r=0,o=Z(this),a=e,l=t.split(ee);s=l[r++];)a=n?a:!o.hasClass(s),o[a?"addClass":"removeClass"](s);else("undefined"===i||"boolean"===i)&&(this.className&&Z._data(this,"__className__",this.className),this.className=this.className||t===!1?"":Z._data(this,"__className__")||"")})},hasClass:function(t){for(var e=" "+t+" ",i=0,n=this.length;n>i;i++)if(1===this[i].nodeType&&(" "+this[i].className+" ").replace(xe," ").indexOf(e)>=0)return!0;return!1},val:function(t){var i,n,s,r=this[0];{if(arguments.length)return s=Z.isFunction(t),this.each(function(n){var r,o=Z(this);1===this.nodeType&&(r=s?t.call(this,n,o.val()):t,null==r?r="":"number"==typeof r?r+="":Z.isArray(r)&&(r=Z.map(r,function(t){return null==t?"":t+""})),i=Z.valHooks[this.type]||Z.valHooks[this.nodeName.toLowerCase()],i&&"set"in i&&i.set(this,r,"value")!==e||(this.value=r))});if(r)return i=Z.valHooks[r.type]||Z.valHooks[r.nodeName.toLowerCase()],i&&"get"in i&&(n=i.get(r,"value"))!==e?n:(n=r.value,"string"==typeof n?n.replace(we,""):null==n?"":n)}}}),Z.extend({valHooks:{option:{get:function(t){var e=t.attributes.value;return!e||e.specified?t.value:t.text}},select:{get:function(t){var e,i,n,s,r=t.selectedIndex,o=[],a=t.options,l="select-one"===t.type;if(0>r)return null;for(i=l?r:0,n=l?r+1:a.length;n>i;i++)if(s=a[i],!(!s.selected||(Z.support.optDisabled?s.disabled:null!==s.getAttribute("disabled"))||s.parentNode.disabled&&Z.nodeName(s.parentNode,"optgroup"))){if(e=Z(s).val(),l)return e;o.push(e)}return l&&!o.length&&a.length?Z(a[r]).val():o},set:function(t,e){var i=Z.makeArray(e);return Z(t).find("option").each(function(){this.selected=Z.inArray(Z(this).val(),i)>=0}),i.length||(t.selectedIndex=-1),i}}},attrFn:{},attr:function(t,i,n,s){var r,o,a,l=t.nodeType;if(t&&3!==l&&8!==l&&2!==l)return s&&Z.isFunction(Z.fn[i])?Z(t)[i](n):"undefined"==typeof t.getAttribute?Z.prop(t,i,n):(a=1!==l||!Z.isXMLDoc(t),a&&(i=i.toLowerCase(),o=Z.attrHooks[i]||(De.test(i)?ye:ve)),n!==e?null===n?(Z.removeAttr(t,i),void 0):o&&"set"in o&&a&&(r=o.set(t,n,i))!==e?r:(t.setAttribute(i,n+""),n):o&&"get"in o&&a&&null!==(r=o.get(t,i))?r:(r=t.getAttribute(i),null===r?e:r))},removeAttr:function(t,e){var i,n,s,r,o=0;if(e&&1===t.nodeType)for(n=e.split(ee);o<n.length;o++)s=n[o],s&&(i=Z.propFix[s]||s,r=De.test(s),r||Z.attr(t,s,""),t.removeAttribute(Me?s:i),r&&i in t&&(t[i]=!1))},attrHooks:{type:{set:function(t,e){if(ke.test(t.nodeName)&&t.parentNode)Z.error("type property can't be changed");else if(!Z.support.radioValue&&"radio"===e&&Z.nodeName(t,"input")){var i=t.value;return t.setAttribute("type",e),i&&(t.value=i),e}}},value:{get:function(t,e){return ve&&Z.nodeName(t,"button")?ve.get(t,e):e in t?t.value:null},set:function(t,e,i){return ve&&Z.nodeName(t,"button")?ve.set(t,e,i):(t.value=e,void 0)}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(t,i,n){var s,r,o,a=t.nodeType;if(t&&3!==a&&8!==a&&2!==a)return o=1!==a||!Z.isXMLDoc(t),o&&(i=Z.propFix[i]||i,r=Z.propHooks[i]),n!==e?r&&"set"in r&&(s=r.set(t,n,i))!==e?s:t[i]=n:r&&"get"in r&&null!==(s=r.get(t,i))?s:t[i]},propHooks:{tabIndex:{get:function(t){var i=t.getAttributeNode("tabindex");return i&&i.specified?parseInt(i.value,10):_e.test(t.nodeName)||Ce.test(t.nodeName)&&t.href?0:e}}}}),ye={get:function(t,i){var n,s=Z.prop(t,i);return s===!0||"boolean"!=typeof s&&(n=t.getAttributeNode(i))&&n.nodeValue!==!1?i.toLowerCase():e},set:function(t,e,i){var n;return e===!1?Z.removeAttr(t,i):(n=Z.propFix[i]||i,n in t&&(t[n]=!0),t.setAttribute(i,i.toLowerCase())),i}},Me||(be={name:!0,id:!0,coords:!0},ve=Z.valHooks.button={get:function(t,i){var n;return n=t.getAttributeNode(i),n&&(be[i]?""!==n.value:n.specified)?n.value:e},set:function(t,e,i){var n=t.getAttributeNode(i);return n||(n=R.createAttribute(i),t.setAttributeNode(n)),n.value=e+""}},Z.each(["width","height"],function(t,e){Z.attrHooks[e]=Z.extend(Z.attrHooks[e],{set:function(t,i){return""===i?(t.setAttribute(e,"auto"),i):void 0
381
+ }})}),Z.attrHooks.contenteditable={get:ve.get,set:function(t,e,i){""===e&&(e="false"),ve.set(t,e,i)}}),Z.support.hrefNormalized||Z.each(["href","src","width","height"],function(t,i){Z.attrHooks[i]=Z.extend(Z.attrHooks[i],{get:function(t){var n=t.getAttribute(i,2);return null===n?e:n}})}),Z.support.style||(Z.attrHooks.style={get:function(t){return t.style.cssText.toLowerCase()||e},set:function(t,e){return t.style.cssText=e+""}}),Z.support.optSelected||(Z.propHooks.selected=Z.extend(Z.propHooks.selected,{get:function(t){var e=t.parentNode;return e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex),null}})),Z.support.enctype||(Z.propFix.enctype="encoding"),Z.support.checkOn||Z.each(["radio","checkbox"],function(){Z.valHooks[this]={get:function(t){return null===t.getAttribute("value")?"on":t.value}}}),Z.each(["radio","checkbox"],function(){Z.valHooks[this]=Z.extend(Z.valHooks[this],{set:function(t,e){return Z.isArray(e)?t.checked=Z.inArray(Z(t).val(),e)>=0:void 0}})});var Se=/^(?:textarea|input|select)$/i,Te=/^([^\.]*|)(?:\.(.+)|)$/,Ae=/(?:^|\s)hover(\.\S+|)\b/,Ee=/^key/,Fe=/^(?:mouse|contextmenu)|click/,Ie=/^(?:focusinfocus|focusoutblur)$/,Le=function(t){return Z.event.special.hover?t:t.replace(Ae,"mouseenter$1 mouseleave$1")};Z.event={add:function(t,i,n,s,r){var o,a,l,h,c,u,d,p,f,m,g;if(3!==t.nodeType&&8!==t.nodeType&&i&&n&&(o=Z._data(t))){for(n.handler&&(f=n,n=f.handler,r=f.selector),n.guid||(n.guid=Z.guid++),l=o.events,l||(o.events=l={}),a=o.handle,a||(o.handle=a=function(t){return"undefined"==typeof Z||t&&Z.event.triggered===t.type?e:Z.event.dispatch.apply(a.elem,arguments)},a.elem=t),i=Z.trim(Le(i)).split(" "),h=0;h<i.length;h++)c=Te.exec(i[h])||[],u=c[1],d=(c[2]||"").split(".").sort(),g=Z.event.special[u]||{},u=(r?g.delegateType:g.bindType)||u,g=Z.event.special[u]||{},p=Z.extend({type:u,origType:c[1],data:s,handler:n,guid:n.guid,selector:r,needsContext:r&&Z.expr.match.needsContext.test(r),namespace:d.join(".")},f),m=l[u],m||(m=l[u]=[],m.delegateCount=0,g.setup&&g.setup.call(t,s,d,a)!==!1||(t.addEventListener?t.addEventListener(u,a,!1):t.attachEvent&&t.attachEvent("on"+u,a))),g.add&&(g.add.call(t,p),p.handler.guid||(p.handler.guid=n.guid)),r?m.splice(m.delegateCount++,0,p):m.push(p),Z.event.global[u]=!0;t=null}},global:{},remove:function(t,e,i,n,s){var r,o,a,l,h,c,u,d,p,f,m,g=Z.hasData(t)&&Z._data(t);if(g&&(d=g.events)){for(e=Z.trim(Le(e||"")).split(" "),r=0;r<e.length;r++)if(o=Te.exec(e[r])||[],a=l=o[1],h=o[2],a){for(p=Z.event.special[a]||{},a=(n?p.delegateType:p.bindType)||a,f=d[a]||[],c=f.length,h=h?new RegExp("(^|\\.)"+h.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null,u=0;u<f.length;u++)m=f[u],!s&&l!==m.origType||i&&i.guid!==m.guid||h&&!h.test(m.namespace)||n&&n!==m.selector&&("**"!==n||!m.selector)||(f.splice(u--,1),m.selector&&f.delegateCount--,p.remove&&p.remove.call(t,m));0===f.length&&c!==f.length&&(p.teardown&&p.teardown.call(t,h,g.handle)!==!1||Z.removeEvent(t,a,g.handle),delete d[a])}else for(a in d)Z.event.remove(t,a+e[r],i,n,!0);Z.isEmptyObject(d)&&(delete g.handle,Z.removeData(t,"events",!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(i,n,s,r){if(!s||3!==s.nodeType&&8!==s.nodeType){var o,a,l,h,c,u,d,p,f,m,g=i.type||i,v=[];if(!Ie.test(g+Z.event.triggered)&&(g.indexOf("!")>=0&&(g=g.slice(0,-1),a=!0),g.indexOf(".")>=0&&(v=g.split("."),g=v.shift(),v.sort()),s&&!Z.event.customEvent[g]||Z.event.global[g]))if(i="object"==typeof i?i[Z.expando]?i:new Z.Event(g,i):new Z.Event(g),i.type=g,i.isTrigger=!0,i.exclusive=a,i.namespace=v.join("."),i.namespace_re=i.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,u=g.indexOf(":")<0?"on"+g:"",s){if(i.result=e,i.target||(i.target=s),n=null!=n?Z.makeArray(n):[],n.unshift(i),d=Z.event.special[g]||{},!d.trigger||d.trigger.apply(s,n)!==!1){if(f=[[s,d.bindType||g]],!r&&!d.noBubble&&!Z.isWindow(s)){for(m=d.delegateType||g,h=Ie.test(m+g)?s:s.parentNode,c=s;h;h=h.parentNode)f.push([h,m]),c=h;c===(s.ownerDocument||R)&&f.push([c.defaultView||c.parentWindow||t,m])}for(l=0;l<f.length&&!i.isPropagationStopped();l++)h=f[l][0],i.type=f[l][1],p=(Z._data(h,"events")||{})[i.type]&&Z._data(h,"handle"),p&&p.apply(h,n),p=u&&h[u],p&&Z.acceptData(h)&&p.apply&&p.apply(h,n)===!1&&i.preventDefault();return i.type=g,r||i.isDefaultPrevented()||d._default&&d._default.apply(s.ownerDocument,n)!==!1||"click"===g&&Z.nodeName(s,"a")||!Z.acceptData(s)||u&&s[g]&&("focus"!==g&&"blur"!==g||0!==i.target.offsetWidth)&&!Z.isWindow(s)&&(c=s[u],c&&(s[u]=null),Z.event.triggered=g,s[g](),Z.event.triggered=e,c&&(s[u]=c)),i.result}}else{o=Z.cache;for(l in o)o[l].events&&o[l].events[g]&&Z.event.trigger(i,n,o[l].handle.elem,!0)}}},dispatch:function(i){i=Z.event.fix(i||t.event);var n,s,r,o,a,l,h,c,u,d=(Z._data(this,"events")||{})[i.type]||[],p=d.delegateCount,f=G.call(arguments),m=!i.exclusive&&!i.namespace,g=Z.event.special[i.type]||{},v=[];if(f[0]=i,i.delegateTarget=this,!g.preDispatch||g.preDispatch.call(this,i)!==!1){if(p&&(!i.button||"click"!==i.type))for(r=i.target;r!=this;r=r.parentNode||this)if(r.disabled!==!0||"click"!==i.type){for(a={},h=[],n=0;p>n;n++)c=d[n],u=c.selector,a[u]===e&&(a[u]=c.needsContext?Z(u,this).index(r)>=0:Z.find(u,this,null,[r]).length),a[u]&&h.push(c);h.length&&v.push({elem:r,matches:h})}for(d.length>p&&v.push({elem:this,matches:d.slice(p)}),n=0;n<v.length&&!i.isPropagationStopped();n++)for(l=v[n],i.currentTarget=l.elem,s=0;s<l.matches.length&&!i.isImmediatePropagationStopped();s++)c=l.matches[s],(m||!i.namespace&&!c.namespace||i.namespace_re&&i.namespace_re.test(c.namespace))&&(i.data=c.data,i.handleObj=c,o=((Z.event.special[c.origType]||{}).handle||c.handler).apply(l.elem,f),o!==e&&(i.result=o,o===!1&&(i.preventDefault(),i.stopPropagation())));return g.postDispatch&&g.postDispatch.call(this,i),i.result}},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(t,e){return null==t.which&&(t.which=null!=e.charCode?e.charCode:e.keyCode),t}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(t,i){var n,s,r,o=i.button,a=i.fromElement;return null==t.pageX&&null!=i.clientX&&(n=t.target.ownerDocument||R,s=n.documentElement,r=n.body,t.pageX=i.clientX+(s&&s.scrollLeft||r&&r.scrollLeft||0)-(s&&s.clientLeft||r&&r.clientLeft||0),t.pageY=i.clientY+(s&&s.scrollTop||r&&r.scrollTop||0)-(s&&s.clientTop||r&&r.clientTop||0)),!t.relatedTarget&&a&&(t.relatedTarget=a===t.target?i.toElement:a),t.which||o===e||(t.which=1&o?1:2&o?3:4&o?2:0),t}},fix:function(t){if(t[Z.expando])return t;var e,i,n=t,s=Z.event.fixHooks[t.type]||{},r=s.props?this.props.concat(s.props):this.props;for(t=Z.Event(n),e=r.length;e;)i=r[--e],t[i]=n[i];return t.target||(t.target=n.srcElement||R),3===t.target.nodeType&&(t.target=t.target.parentNode),t.metaKey=!!t.metaKey,s.filter?s.filter(t,n):t},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(t,e,i){Z.isWindow(this)&&(this.onbeforeunload=i)},teardown:function(t,e){this.onbeforeunload===e&&(this.onbeforeunload=null)}}},simulate:function(t,e,i,n){var s=Z.extend(new Z.Event,i,{type:t,isSimulated:!0,originalEvent:{}});n?Z.event.trigger(s,null,e):Z.event.dispatch.call(e,s),s.isDefaultPrevented()&&i.preventDefault()}},Z.event.handle=Z.event.dispatch,Z.removeEvent=R.removeEventListener?function(t,e,i){t.removeEventListener&&t.removeEventListener(e,i,!1)}:function(t,e,i){var n="on"+e;t.detachEvent&&("undefined"==typeof t[n]&&(t[n]=null),t.detachEvent(n,i))},Z.Event=function(t,e){return this instanceof Z.Event?(t&&t.type?(this.originalEvent=t,this.type=t.type,this.isDefaultPrevented=t.defaultPrevented||t.returnValue===!1||t.getPreventDefault&&t.getPreventDefault()?o:r):this.type=t,e&&Z.extend(this,e),this.timeStamp=t&&t.timeStamp||Z.now(),this[Z.expando]=!0,void 0):new Z.Event(t,e)},Z.Event.prototype={preventDefault:function(){this.isDefaultPrevented=o;var t=this.originalEvent;t&&(t.preventDefault?t.preventDefault():t.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=o;var t=this.originalEvent;t&&(t.stopPropagation&&t.stopPropagation(),t.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=o,this.stopPropagation()},isDefaultPrevented:r,isPropagationStopped:r,isImmediatePropagationStopped:r},Z.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(t,e){Z.event.special[t]={delegateType:e,bindType:e,handle:function(t){var i,n=this,s=t.relatedTarget,r=t.handleObj;return r.selector,(!s||s!==n&&!Z.contains(n,s))&&(t.type=r.origType,i=r.handler.apply(this,arguments),t.type=e),i}}}),Z.support.submitBubbles||(Z.event.special.submit={setup:function(){return Z.nodeName(this,"form")?!1:(Z.event.add(this,"click._submit keypress._submit",function(t){var i=t.target,n=Z.nodeName(i,"input")||Z.nodeName(i,"button")?i.form:e;n&&!Z._data(n,"_submit_attached")&&(Z.event.add(n,"submit._submit",function(t){t._submit_bubble=!0}),Z._data(n,"_submit_attached",!0))}),void 0)},postDispatch:function(t){t._submit_bubble&&(delete t._submit_bubble,this.parentNode&&!t.isTrigger&&Z.event.simulate("submit",this.parentNode,t,!0))},teardown:function(){return Z.nodeName(this,"form")?!1:(Z.event.remove(this,"._submit"),void 0)}}),Z.support.changeBubbles||(Z.event.special.change={setup:function(){return Se.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(Z.event.add(this,"propertychange._change",function(t){"checked"===t.originalEvent.propertyName&&(this._just_changed=!0)}),Z.event.add(this,"click._change",function(t){this._just_changed&&!t.isTrigger&&(this._just_changed=!1),Z.event.simulate("change",this,t,!0)})),!1):(Z.event.add(this,"beforeactivate._change",function(t){var e=t.target;Se.test(e.nodeName)&&!Z._data(e,"_change_attached")&&(Z.event.add(e,"change._change",function(t){!this.parentNode||t.isSimulated||t.isTrigger||Z.event.simulate("change",this.parentNode,t,!0)}),Z._data(e,"_change_attached",!0))}),void 0)},handle:function(t){var e=t.target;return this!==e||t.isSimulated||t.isTrigger||"radio"!==e.type&&"checkbox"!==e.type?t.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return Z.event.remove(this,"._change"),!Se.test(this.nodeName)}}),Z.support.focusinBubbles||Z.each({focus:"focusin",blur:"focusout"},function(t,e){var i=0,n=function(t){Z.event.simulate(e,t.target,Z.event.fix(t),!0)};Z.event.special[e]={setup:function(){0===i++&&R.addEventListener(t,n,!0)},teardown:function(){0===--i&&R.removeEventListener(t,n,!0)}}}),Z.fn.extend({on:function(t,i,n,s,o){var a,l;if("object"==typeof t){"string"!=typeof i&&(n=n||i,i=e);for(l in t)this.on(l,i,n,t[l],o);return this}if(null==n&&null==s?(s=i,n=i=e):null==s&&("string"==typeof i?(s=n,n=e):(s=n,n=i,i=e)),s===!1)s=r;else if(!s)return this;return 1===o&&(a=s,s=function(t){return Z().off(t),a.apply(this,arguments)},s.guid=a.guid||(a.guid=Z.guid++)),this.each(function(){Z.event.add(this,t,s,n,i)})},one:function(t,e,i,n){return this.on(t,e,i,n,1)},off:function(t,i,n){var s,o;if(t&&t.preventDefault&&t.handleObj)return s=t.handleObj,Z(t.delegateTarget).off(s.namespace?s.origType+"."+s.namespace:s.origType,s.selector,s.handler),this;if("object"==typeof t){for(o in t)this.off(o,i,t[o]);return this}return(i===!1||"function"==typeof i)&&(n=i,i=e),n===!1&&(n=r),this.each(function(){Z.event.remove(this,t,n,i)})},bind:function(t,e,i){return this.on(t,null,e,i)},unbind:function(t,e){return this.off(t,null,e)},live:function(t,e,i){return Z(this.context).on(t,this.selector,e,i),this},die:function(t,e){return Z(this.context).off(t,this.selector||"**",e),this},delegate:function(t,e,i,n){return this.on(e,t,i,n)},undelegate:function(t,e,i){return 1===arguments.length?this.off(t,"**"):this.off(e,t||"**",i)},trigger:function(t,e){return this.each(function(){Z.event.trigger(t,e,this)})},triggerHandler:function(t,e){return this[0]?Z.event.trigger(t,e,this[0],!0):void 0},toggle:function(t){var e=arguments,i=t.guid||Z.guid++,n=0,s=function(i){var s=(Z._data(this,"lastToggle"+t.guid)||0)%n;return Z._data(this,"lastToggle"+t.guid,s+1),i.preventDefault(),e[s].apply(this,arguments)||!1};for(s.guid=i;n<e.length;)e[n++].guid=i;return this.click(s)},hover:function(t,e){return this.mouseenter(t).mouseleave(e||t)}}),Z.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(t,e){Z.fn[e]=function(t,i){return null==i&&(i=t,t=null),arguments.length>0?this.on(e,null,t,i):this.trigger(e)},Ee.test(e)&&(Z.event.fixHooks[e]=Z.event.keyHooks),Fe.test(e)&&(Z.event.fixHooks[e]=Z.event.mouseHooks)}),function(t,e){function i(t,e,i,n){i=i||[],e=e||F;var s,r,o,a,l=e.nodeType;if(!t||"string"!=typeof t)return i;if(1!==l&&9!==l)return[];if(o=w(e),!o&&!n&&(s=ie.exec(t)))if(a=s[1]){if(9===l){if(r=e.getElementById(a),!r||!r.parentNode)return i;if(r.id===a)return i.push(r),i}else if(e.ownerDocument&&(r=e.ownerDocument.getElementById(a))&&k(e,r)&&r.id===a)return i.push(r),i}else{if(s[2])return z.apply(i,P.call(e.getElementsByTagName(t),0)),i;if((a=s[3])&&de&&e.getElementsByClassName)return z.apply(i,P.call(e.getElementsByClassName(a),0)),i}return m(t.replace(J,"$1"),e,i,n,o)}function n(t){return function(e){var i=e.nodeName.toLowerCase();return"input"===i&&e.type===t}}function s(t){return function(e){var i=e.nodeName.toLowerCase();return("input"===i||"button"===i)&&e.type===t}}function r(t){return H(function(e){return e=+e,H(function(i,n){for(var s,r=t([],i.length,e),o=r.length;o--;)i[s=r[o]]&&(i[s]=!(n[s]=i[s]))})})}function o(t,e,i){if(t===e)return i;for(var n=t.nextSibling;n;){if(n===e)return-1;n=n.nextSibling}return 1}function a(t,e){var n,s,r,o,a,l,h,c=j[A][t];if(c)return e?0:c.slice(0);for(a=t,l=[],h=b.preFilter;a;){(!n||(s=Q.exec(a)))&&(s&&(a=a.slice(s[0].length)),l.push(r=[])),n=!1,(s=te.exec(a))&&(r.push(n=new E(s.shift())),a=a.slice(n.length),n.type=s[0].replace(J," "));for(o in b.filter)!(s=ae[o].exec(a))||h[o]&&!(s=h[o](s,F,!0))||(r.push(n=new E(s.shift())),a=a.slice(n.length),n.type=o,n.matches=s);if(!n)break}return e?a.length:a?i.error(t):j(t,l).slice(0)}function l(t,e,i){var n=e.dir,s=i&&"parentNode"===e.dir,r=N++;return e.first?function(e,i,r){for(;e=e[n];)if(s||1===e.nodeType)return t(e,i,r)}:function(e,i,o){if(o){for(;e=e[n];)if((s||1===e.nodeType)&&t(e,i,o))return e}else for(var a,l=L+" "+r+" ",h=l+v;e=e[n];)if(s||1===e.nodeType){if((a=e[A])===h)return e.sizset;if("string"==typeof a&&0===a.indexOf(l)){if(e.sizset)return e}else{if(e[A]=h,t(e,i,o))return e.sizset=!0,e;e.sizset=!1}}}}function h(t){return t.length>1?function(e,i,n){for(var s=t.length;s--;)if(!t[s](e,i,n))return!1;return!0}:t[0]}function c(t,e,i,n,s){for(var r,o=[],a=0,l=t.length,h=null!=e;l>a;a++)(r=t[a])&&(!i||i(r,n,s))&&(o.push(r),h&&e.push(a));return o}function u(t,e,i,n,s,r){return n&&!n[A]&&(n=u(n)),s&&!s[A]&&(s=u(s,r)),H(function(r,o,a,l){if(!r||!s){var h,u,d,p=[],m=[],g=o.length,v=r||f(e||"*",a.nodeType?[a]:a,[],r),y=!t||!r&&e?v:c(v,p,t,a,l),b=i?s||(r?t:g||n)?[]:o:y;if(i&&i(y,b,a,l),n)for(d=c(b,m),n(d,[],a,l),h=d.length;h--;)(u=d[h])&&(b[m[h]]=!(y[m[h]]=u));if(r)for(h=t&&b.length;h--;)(u=b[h])&&(r[p[h]]=!(o[p[h]]=u));else b=c(b===o?b.splice(g,b.length):b),s?s(null,o,b,l):z.apply(o,b)}})}function d(t){for(var e,i,n,s=t.length,r=b.relative[t[0].type],o=r||b.relative[" "],a=r?1:0,c=l(function(t){return t===e},o,!0),p=l(function(t){return O.call(e,t)>-1},o,!0),f=[function(t,i,n){return!r&&(n||i!==M)||((e=i).nodeType?c(t,i,n):p(t,i,n))}];s>a;a++)if(i=b.relative[t[a].type])f=[l(h(f),i)];else{if(i=b.filter[t[a].type].apply(null,t[a].matches),i[A]){for(n=++a;s>n&&!b.relative[t[n].type];n++);return u(a>1&&h(f),a>1&&t.slice(0,a-1).join("").replace(J,"$1"),i,n>a&&d(t.slice(a,n)),s>n&&d(t=t.slice(n)),s>n&&t.join(""))}f.push(i)}return h(f)}function p(t,e){var n=e.length>0,s=t.length>0,r=function(o,a,l,h,u){var d,p,f,m=[],g=0,y="0",x=o&&[],w=null!=u,k=M,_=o||s&&b.find.TAG("*",u&&a.parentNode||a),C=L+=null==k?1:Math.E;for(w&&(M=a!==F&&a,v=r.el);null!=(d=_[y]);y++){if(s&&d){for(p=0;f=t[p];p++)if(f(d,a,l)){h.push(d);break}w&&(L=C,v=++r.el)}n&&((d=!f&&d)&&g--,o&&x.push(d))}if(g+=y,n&&y!==g){for(p=0;f=e[p];p++)f(x,m,a,l);if(o){if(g>0)for(;y--;)x[y]||m[y]||(m[y]=$.call(h));m=c(m)}z.apply(h,m),w&&!o&&m.length>0&&g+e.length>1&&i.uniqueSort(h)}return w&&(L=C,M=k),x};return r.el=0,n?H(r):r}function f(t,e,n,s){for(var r=0,o=e.length;o>r;r++)i(t,e[r],n,s);return n}function m(t,e,i,n,s){var r,o,l,h,c,u=a(t);if(u.length,!n&&1===u.length){if(o=u[0]=u[0].slice(0),o.length>2&&"ID"===(l=o[0]).type&&9===e.nodeType&&!s&&b.relative[o[1].type]){if(e=b.find.ID(l.matches[0].replace(oe,""),e,s)[0],!e)return i;t=t.slice(o.shift().length)}for(r=ae.POS.test(t)?-1:o.length-1;r>=0&&(l=o[r],!b.relative[h=l.type]);r--)if((c=b.find[h])&&(n=c(l.matches[0].replace(oe,""),ne.test(o[0].type)&&e.parentNode||e,s))){if(o.splice(r,1),t=n.length&&o.join(""),!t)return z.apply(i,P.call(n,0)),i;break}}return _(t,u)(n,e,s,i,ne.test(t)),i}function g(){}var v,y,b,x,w,k,_,C,D,M,S=!0,T="undefined",A=("sizcache"+Math.random()).replace(".",""),E=String,F=t.document,I=F.documentElement,L=0,N=0,$=[].pop,z=[].push,P=[].slice,O=[].indexOf||function(t){for(var e=0,i=this.length;i>e;e++)if(this[e]===t)return e;return-1},H=function(t,e){return t[A]=null==e||e,t},W=function(){var t={},e=[];return H(function(i,n){return e.push(i)>b.cacheLength&&delete t[e.shift()],t[i]=n},t)},R=W(),j=W(),B=W(),Y="[\\x20\\t\\r\\n\\f]",V="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",U=V.replace("w","w#"),G="([*^$|!~]?=)",q="\\["+Y+"*("+V+")"+Y+"*(?:"+G+Y+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+U+")|)|)"+Y+"*\\]",X=":("+V+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+q+")|[^:]|\\\\.)*|.*))\\)|)",K=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+Y+"*((?:-\\d)?\\d*)"+Y+"*\\)|)(?=[^-]|$)",J=new RegExp("^"+Y+"+|((?:^|[^\\\\])(?:\\\\.)*)"+Y+"+$","g"),Q=new RegExp("^"+Y+"*,"+Y+"*"),te=new RegExp("^"+Y+"*([\\x20\\t\\r\\n\\f>+~])"+Y+"*"),ee=new RegExp(X),ie=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,ne=/[\x20\t\r\n\f]*[+~]/,se=/h\d/i,re=/input|select|textarea|button/i,oe=/\\(?!\\)/g,ae={ID:new RegExp("^#("+V+")"),CLASS:new RegExp("^\\.("+V+")"),NAME:new RegExp("^\\[name=['\"]?("+V+")['\"]?\\]"),TAG:new RegExp("^("+V.replace("w","w*")+")"),ATTR:new RegExp("^"+q),PSEUDO:new RegExp("^"+X),POS:new RegExp(K,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+Y+"*(even|odd|(([+-]|)(\\d*)n|)"+Y+"*(?:([+-]|)"+Y+"*(\\d+)|))"+Y+"*\\)|)","i"),needsContext:new RegExp("^"+Y+"*[>+~]|"+K,"i")},le=function(t){var e=F.createElement("div");try{return t(e)}catch(i){return!1}finally{e=null}},he=le(function(t){return t.appendChild(F.createComment("")),!t.getElementsByTagName("*").length}),ce=le(function(t){return t.innerHTML="<a href='#'></a>",t.firstChild&&typeof t.firstChild.getAttribute!==T&&"#"===t.firstChild.getAttribute("href")}),ue=le(function(t){t.innerHTML="<select></select>";var e=typeof t.lastChild.getAttribute("multiple");return"boolean"!==e&&"string"!==e}),de=le(function(t){return t.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",t.getElementsByClassName&&t.getElementsByClassName("e").length?(t.lastChild.className="e",2===t.getElementsByClassName("e").length):!1}),pe=le(function(t){t.id=A+0,t.innerHTML="<a name='"+A+"'></a><div name='"+A+"'></div>",I.insertBefore(t,I.firstChild);var e=F.getElementsByName&&F.getElementsByName(A).length===2+F.getElementsByName(A+0).length;return y=!F.getElementById(A),I.removeChild(t),e});try{P.call(I.childNodes,0)[0].nodeType}catch(fe){P=function(t){for(var e,i=[];e=this[t];t++)i.push(e);return i}}i.matches=function(t,e){return i(t,null,null,e)},i.matchesSelector=function(t,e){return i(e,null,null,[t]).length>0},x=i.getText=function(t){var e,i="",n=0,s=t.nodeType;if(s){if(1===s||9===s||11===s){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)i+=x(t)}else if(3===s||4===s)return t.nodeValue}else for(;e=t[n];n++)i+=x(e);return i},w=i.isXML=function(t){var e=t&&(t.ownerDocument||t).documentElement;return e?"HTML"!==e.nodeName:!1},k=i.contains=I.contains?function(t,e){var i=9===t.nodeType?t.documentElement:t,n=e&&e.parentNode;return t===n||!!(n&&1===n.nodeType&&i.contains&&i.contains(n))}:I.compareDocumentPosition?function(t,e){return e&&!!(16&t.compareDocumentPosition(e))}:function(t,e){for(;e=e.parentNode;)if(e===t)return!0;return!1},i.attr=function(t,e){var i,n=w(t);return n||(e=e.toLowerCase()),(i=b.attrHandle[e])?i(t):n||ue?t.getAttribute(e):(i=t.getAttributeNode(e),i?"boolean"==typeof t[e]?t[e]?e:null:i.specified?i.value:null:null)},b=i.selectors={cacheLength:50,createPseudo:H,match:ae,attrHandle:ce?{}:{href:function(t){return t.getAttribute("href",2)},type:function(t){return t.getAttribute("type")}},find:{ID:y?function(t,e,i){if(typeof e.getElementById!==T&&!i){var n=e.getElementById(t);return n&&n.parentNode?[n]:[]}}:function(t,i,n){if(typeof i.getElementById!==T&&!n){var s=i.getElementById(t);return s?s.id===t||typeof s.getAttributeNode!==T&&s.getAttributeNode("id").value===t?[s]:e:[]}},TAG:he?function(t,e){return typeof e.getElementsByTagName!==T?e.getElementsByTagName(t):void 0}:function(t,e){var i=e.getElementsByTagName(t);if("*"===t){for(var n,s=[],r=0;n=i[r];r++)1===n.nodeType&&s.push(n);return s}return i},NAME:pe&&function(t,e){return typeof e.getElementsByName!==T?e.getElementsByName(name):void 0},CLASS:de&&function(t,e,i){return typeof e.getElementsByClassName===T||i?void 0:e.getElementsByClassName(t)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(oe,""),t[3]=(t[4]||t[5]||"").replace(oe,""),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1]?(t[2]||i.error(t[0]),t[3]=+(t[3]?t[4]+(t[5]||1):2*("even"===t[2]||"odd"===t[2])),t[4]=+(t[6]+t[7]||"odd"===t[2])):t[2]&&i.error(t[0]),t},PSEUDO:function(t){var e,i;return ae.CHILD.test(t[0])?null:(t[3]?t[2]=t[3]:(e=t[4])&&(ee.test(e)&&(i=a(e,!0))&&(i=e.indexOf(")",e.length-i)-e.length)&&(e=e.slice(0,i),t[0]=t[0].slice(0,i)),t[2]=e),t.slice(0,3))}},filter:{ID:y?function(t){return t=t.replace(oe,""),function(e){return e.getAttribute("id")===t}}:function(t){return t=t.replace(oe,""),function(e){var i=typeof e.getAttributeNode!==T&&e.getAttributeNode("id");return i&&i.value===t}},TAG:function(t){return"*"===t?function(){return!0}:(t=t.replace(oe,"").toLowerCase(),function(e){return e.nodeName&&e.nodeName.toLowerCase()===t})},CLASS:function(t){var e=R[A][t];return e||(e=R(t,new RegExp("(^|"+Y+")"+t+"("+Y+"|$)"))),function(t){return e.test(t.className||typeof t.getAttribute!==T&&t.getAttribute("class")||"")}},ATTR:function(t,e,n){return function(s){var r=i.attr(s,t);return null==r?"!="===e:e?(r+="","="===e?r===n:"!="===e?r!==n:"^="===e?n&&0===r.indexOf(n):"*="===e?n&&r.indexOf(n)>-1:"$="===e?n&&r.substr(r.length-n.length)===n:"~="===e?(" "+r+" ").indexOf(n)>-1:"|="===e?r===n||r.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(t,e,i,n){return"nth"===t?function(t){var e,s,r=t.parentNode;if(1===i&&0===n)return!0;if(r)for(s=0,e=r.firstChild;e&&(1!==e.nodeType||(s++,t!==e));e=e.nextSibling);return s-=n,s===i||0===s%i&&s/i>=0}:function(e){var i=e;switch(t){case"only":case"first":for(;i=i.previousSibling;)if(1===i.nodeType)return!1;if("first"===t)return!0;i=e;case"last":for(;i=i.nextSibling;)if(1===i.nodeType)return!1;return!0}}},PSEUDO:function(t,e){var n,s=b.pseudos[t]||b.setFilters[t.toLowerCase()]||i.error("unsupported pseudo: "+t);return s[A]?s(e):s.length>1?(n=[t,t,"",e],b.setFilters.hasOwnProperty(t.toLowerCase())?H(function(t,i){for(var n,r=s(t,e),o=r.length;o--;)n=O.call(t,r[o]),t[n]=!(i[n]=r[o])}):function(t){return s(t,0,n)}):s}},pseudos:{not:H(function(t){var e=[],i=[],n=_(t.replace(J,"$1"));return n[A]?H(function(t,e,i,s){for(var r,o=n(t,null,s,[]),a=t.length;a--;)(r=o[a])&&(t[a]=!(e[a]=r))}):function(t,s,r){return e[0]=t,n(e,null,r,i),!i.pop()}}),has:H(function(t){return function(e){return i(t,e).length>0}}),contains:H(function(t){return function(e){return(e.textContent||e.innerText||x(e)).indexOf(t)>-1}}),enabled:function(t){return t.disabled===!1},disabled:function(t){return t.disabled===!0},checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,t.selected===!0},parent:function(t){return!b.pseudos.empty(t)},empty:function(t){var e;for(t=t.firstChild;t;){if(t.nodeName>"@"||3===(e=t.nodeType)||4===e)return!1;t=t.nextSibling}return!0},header:function(t){return se.test(t.nodeName)},text:function(t){var e,i;return"input"===t.nodeName.toLowerCase()&&"text"===(e=t.type)&&(null==(i=t.getAttribute("type"))||i.toLowerCase()===e)},radio:n("radio"),checkbox:n("checkbox"),file:n("file"),password:n("password"),image:n("image"),submit:s("submit"),reset:s("reset"),button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},input:function(t){return re.test(t.nodeName)},focus:function(t){var e=t.ownerDocument;return!(t!==e.activeElement||e.hasFocus&&!e.hasFocus()||!t.type&&!t.href)},active:function(t){return t===t.ownerDocument.activeElement},first:r(function(){return[0]}),last:r(function(t,e){return[e-1]}),eq:r(function(t,e,i){return[0>i?i+e:i]}),even:r(function(t,e){for(var i=0;e>i;i+=2)t.push(i);return t}),odd:r(function(t,e){for(var i=1;e>i;i+=2)t.push(i);return t}),lt:r(function(t,e,i){for(var n=0>i?i+e:i;--n>=0;)t.push(n);return t}),gt:r(function(t,e,i){for(var n=0>i?i+e:i;++n<e;)t.push(n);return t})}},C=I.compareDocumentPosition?function(t,e){return t===e?(D=!0,0):(t.compareDocumentPosition&&e.compareDocumentPosition?4&t.compareDocumentPosition(e):t.compareDocumentPosition)?-1:1}:function(t,e){if(t===e)return D=!0,0;if(t.sourceIndex&&e.sourceIndex)return t.sourceIndex-e.sourceIndex;var i,n,s=[],r=[],a=t.parentNode,l=e.parentNode,h=a;if(a===l)return o(t,e);if(!a)return-1;if(!l)return 1;for(;h;)s.unshift(h),h=h.parentNode;for(h=l;h;)r.unshift(h),h=h.parentNode;i=s.length,n=r.length;for(var c=0;i>c&&n>c;c++)if(s[c]!==r[c])return o(s[c],r[c]);return c===i?o(t,r[c],-1):o(s[c],e,1)},[0,0].sort(C),S=!D,i.uniqueSort=function(t){var e,i=1;if(D=S,t.sort(C),D)for(;e=t[i];i++)e===t[i-1]&&t.splice(i--,1);return t},i.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},_=i.compile=function(t,e){var i,n=[],s=[],r=B[A][t];if(!r){for(e||(e=a(t)),i=e.length;i--;)r=d(e[i]),r[A]?n.push(r):s.push(r);r=B(t,p(s,n))}return r},F.querySelectorAll&&!function(){var t,e=m,n=/'|\\/g,s=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,r=[":focus"],o=[":active",":focus"],l=I.matchesSelector||I.mozMatchesSelector||I.webkitMatchesSelector||I.oMatchesSelector||I.msMatchesSelector;le(function(t){t.innerHTML="<select><option selected=''></option></select>",t.querySelectorAll("[selected]").length||r.push("\\["+Y+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),t.querySelectorAll(":checked").length||r.push(":checked")}),le(function(t){t.innerHTML="<p test=''></p>",t.querySelectorAll("[test^='']").length&&r.push("[*^$]="+Y+"*(?:\"\"|'')"),t.innerHTML="<input type='hidden'/>",t.querySelectorAll(":enabled").length||r.push(":enabled",":disabled")}),r=new RegExp(r.join("|")),m=function(t,i,s,o,l){if(!(o||l||r&&r.test(t))){var h,c,u=!0,d=A,p=i,f=9===i.nodeType&&t;if(1===i.nodeType&&"object"!==i.nodeName.toLowerCase()){for(h=a(t),(u=i.getAttribute("id"))?d=u.replace(n,"\\$&"):i.setAttribute("id",d),d="[id='"+d+"'] ",c=h.length;c--;)h[c]=d+h[c].join("");p=ne.test(t)&&i.parentNode||i,f=h.join(",")}if(f)try{return z.apply(s,P.call(p.querySelectorAll(f),0)),s}catch(m){}finally{u||i.removeAttribute("id")}}return e(t,i,s,o,l)},l&&(le(function(e){t=l.call(e,"div");try{l.call(e,"[test!='']:sizzle"),o.push("!=",X)}catch(i){}}),o=new RegExp(o.join("|")),i.matchesSelector=function(e,n){if(n=n.replace(s,"='$1']"),!(w(e)||o.test(n)||r&&r.test(n)))try{var a=l.call(e,n);if(a||t||e.document&&11!==e.document.nodeType)return a}catch(h){}return i(n,null,null,[e]).length>0})}(),b.pseudos.nth=b.pseudos.eq,b.filters=g.prototype=b.pseudos,b.setFilters=new g,i.attr=Z.attr,Z.find=i,Z.expr=i.selectors,Z.expr[":"]=Z.expr.pseudos,Z.unique=i.uniqueSort,Z.text=i.getText,Z.isXMLDoc=i.isXML,Z.contains=i.contains}(t);var Ne=/Until$/,$e=/^(?:parents|prev(?:Until|All))/,ze=/^.[^:#\[\.,]*$/,Pe=Z.expr.match.needsContext,Oe={children:!0,contents:!0,next:!0,prev:!0};Z.fn.extend({find:function(t){var e,i,n,s,r,o,a=this;if("string"!=typeof t)return Z(t).filter(function(){for(e=0,i=a.length;i>e;e++)if(Z.contains(a[e],this))return!0});for(o=this.pushStack("","find",t),e=0,i=this.length;i>e;e++)if(n=o.length,Z.find(t,this[e],o),e>0)for(s=n;s<o.length;s++)for(r=0;n>r;r++)if(o[r]===o[s]){o.splice(s--,1);break}return o},has:function(t){var e,i=Z(t,this),n=i.length;return this.filter(function(){for(e=0;n>e;e++)if(Z.contains(this,i[e]))return!0})},not:function(t){return this.pushStack(h(this,t,!1),"not",t)},filter:function(t){return this.pushStack(h(this,t,!0),"filter",t)},is:function(t){return!!t&&("string"==typeof t?Pe.test(t)?Z(t,this.context).index(this[0])>=0:Z.filter(t,this).length>0:this.filter(t).length>0)},closest:function(t,e){for(var i,n=0,s=this.length,r=[],o=Pe.test(t)||"string"!=typeof t?Z(t,e||this.context):0;s>n;n++)for(i=this[n];i&&i.ownerDocument&&i!==e&&11!==i.nodeType;){if(o?o.index(i)>-1:Z.find.matchesSelector(i,t)){r.push(i);break}i=i.parentNode}return r=r.length>1?Z.unique(r):r,this.pushStack(r,"closest",t)},index:function(t){return t?"string"==typeof t?Z.inArray(this[0],Z(t)):Z.inArray(t.jquery?t[0]:t,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(t,e){var i="string"==typeof t?Z(t,e):Z.makeArray(t&&t.nodeType?[t]:t),n=Z.merge(this.get(),i);return this.pushStack(a(i[0])||a(n[0])?n:Z.unique(n))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),Z.fn.andSelf=Z.fn.addBack,Z.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return Z.dir(t,"parentNode")},parentsUntil:function(t,e,i){return Z.dir(t,"parentNode",i)},next:function(t){return l(t,"nextSibling")},prev:function(t){return l(t,"previousSibling")},nextAll:function(t){return Z.dir(t,"nextSibling")},prevAll:function(t){return Z.dir(t,"previousSibling")},nextUntil:function(t,e,i){return Z.dir(t,"nextSibling",i)},prevUntil:function(t,e,i){return Z.dir(t,"previousSibling",i)},siblings:function(t){return Z.sibling((t.parentNode||{}).firstChild,t)},children:function(t){return Z.sibling(t.firstChild)},contents:function(t){return Z.nodeName(t,"iframe")?t.contentDocument||t.contentWindow.document:Z.merge([],t.childNodes)}},function(t,e){Z.fn[t]=function(i,n){var s=Z.map(this,e,i);return Ne.test(t)||(n=i),n&&"string"==typeof n&&(s=Z.filter(n,s)),s=this.length>1&&!Oe[t]?Z.unique(s):s,this.length>1&&$e.test(t)&&(s=s.reverse()),this.pushStack(s,t,G.call(arguments).join(","))}}),Z.extend({filter:function(t,e,i){return i&&(t=":not("+t+")"),1===e.length?Z.find.matchesSelector(e[0],t)?[e[0]]:[]:Z.find.matches(t,e)},dir:function(t,i,n){for(var s=[],r=t[i];r&&9!==r.nodeType&&(n===e||1!==r.nodeType||!Z(r).is(n));)1===r.nodeType&&s.push(r),r=r[i];return s},sibling:function(t,e){for(var i=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&i.push(t);return i}});var He="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",We=/ jQuery\d+="(?:null|\d+)"/g,Re=/^\s+/,je=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Be=/<([\w:]+)/,Ye=/<tbody/i,Ve=/<|&#?\w+;/,Ue=/<(?:script|style|link)/i,Ge=/<(?:script|object|embed|option|style)/i,qe=new RegExp("<(?:"+He+")[\\s/>]","i"),Xe=/^(?:checkbox|radio)$/,Ke=/checked\s*(?:[^=]|=\s*.checked.)/i,Je=/\/(java|ecma)script/i,Ze=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Qe={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},ti=c(R),ei=ti.appendChild(R.createElement("div"));
382
+ Qe.optgroup=Qe.option,Qe.tbody=Qe.tfoot=Qe.colgroup=Qe.caption=Qe.thead,Qe.th=Qe.td,Z.support.htmlSerialize||(Qe._default=[1,"X<div>","</div>"]),Z.fn.extend({text:function(t){return Z.access(this,function(t){return t===e?Z.text(this):this.empty().append((this[0]&&this[0].ownerDocument||R).createTextNode(t))},null,t,arguments.length)},wrapAll:function(t){if(Z.isFunction(t))return this.each(function(e){Z(this).wrapAll(t.call(this,e))});if(this[0]){var e=Z(t,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&e.insertBefore(this[0]),e.map(function(){for(var t=this;t.firstChild&&1===t.firstChild.nodeType;)t=t.firstChild;return t}).append(this)}return this},wrapInner:function(t){return Z.isFunction(t)?this.each(function(e){Z(this).wrapInner(t.call(this,e))}):this.each(function(){var e=Z(this),i=e.contents();i.length?i.wrapAll(t):e.append(t)})},wrap:function(t){var e=Z.isFunction(t);return this.each(function(i){Z(this).wrapAll(e?t.call(this,i):t)})},unwrap:function(){return this.parent().each(function(){Z.nodeName(this,"body")||Z(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(t){(1===this.nodeType||11===this.nodeType)&&this.appendChild(t)})},prepend:function(){return this.domManip(arguments,!0,function(t){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(t,this.firstChild)})},before:function(){if(!a(this[0]))return this.domManip(arguments,!1,function(t){this.parentNode.insertBefore(t,this)});if(arguments.length){var t=Z.clean(arguments);return this.pushStack(Z.merge(t,this),"before",this.selector)}},after:function(){if(!a(this[0]))return this.domManip(arguments,!1,function(t){this.parentNode.insertBefore(t,this.nextSibling)});if(arguments.length){var t=Z.clean(arguments);return this.pushStack(Z.merge(this,t),"after",this.selector)}},remove:function(t,e){for(var i,n=0;null!=(i=this[n]);n++)(!t||Z.filter(t,[i]).length)&&(e||1!==i.nodeType||(Z.cleanData(i.getElementsByTagName("*")),Z.cleanData([i])),i.parentNode&&i.parentNode.removeChild(i));return this},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)for(1===t.nodeType&&Z.cleanData(t.getElementsByTagName("*"));t.firstChild;)t.removeChild(t.firstChild);return this},clone:function(t,e){return t=null==t?!1:t,e=null==e?t:e,this.map(function(){return Z.clone(this,t,e)})},html:function(t){return Z.access(this,function(t){var i=this[0]||{},n=0,s=this.length;if(t===e)return 1===i.nodeType?i.innerHTML.replace(We,""):e;if(!("string"!=typeof t||Ue.test(t)||!Z.support.htmlSerialize&&qe.test(t)||!Z.support.leadingWhitespace&&Re.test(t)||Qe[(Be.exec(t)||["",""])[1].toLowerCase()])){t=t.replace(je,"<$1></$2>");try{for(;s>n;n++)i=this[n]||{},1===i.nodeType&&(Z.cleanData(i.getElementsByTagName("*")),i.innerHTML=t);i=0}catch(r){}}i&&this.empty().append(t)},null,t,arguments.length)},replaceWith:function(t){return a(this[0])?this.length?this.pushStack(Z(Z.isFunction(t)?t():t),"replaceWith",t):this:Z.isFunction(t)?this.each(function(e){var i=Z(this),n=i.html();i.replaceWith(t.call(this,e,n))}):("string"!=typeof t&&(t=Z(t).detach()),this.each(function(){var e=this.nextSibling,i=this.parentNode;Z(this).remove(),e?Z(e).before(t):Z(i).append(t)}))},detach:function(t){return this.remove(t,!0)},domManip:function(t,i,n){t=[].concat.apply([],t);var s,r,o,a,l=0,h=t[0],c=[],d=this.length;if(!Z.support.checkClone&&d>1&&"string"==typeof h&&Ke.test(h))return this.each(function(){Z(this).domManip(t,i,n)});if(Z.isFunction(h))return this.each(function(s){var r=Z(this);t[0]=h.call(this,s,i?r.html():e),r.domManip(t,i,n)});if(this[0]){if(s=Z.buildFragment(t,this,c),o=s.fragment,r=o.firstChild,1===o.childNodes.length&&(o=r),r)for(i=i&&Z.nodeName(r,"tr"),a=s.cacheable||d-1;d>l;l++)n.call(i&&Z.nodeName(this[l],"table")?u(this[l],"tbody"):this[l],l===a?o:Z.clone(o,!0,!0));o=r=null,c.length&&Z.each(c,function(t,e){e.src?Z.ajax?Z.ajax({url:e.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):Z.error("no ajax"):Z.globalEval((e.text||e.textContent||e.innerHTML||"").replace(Ze,"")),e.parentNode&&e.parentNode.removeChild(e)})}return this}}),Z.buildFragment=function(t,i,n){var s,r,o,a=t[0];return i=i||R,i=!i.nodeType&&i[0]||i,i=i.ownerDocument||i,!(1===t.length&&"string"==typeof a&&a.length<512&&i===R&&"<"===a.charAt(0))||Ge.test(a)||!Z.support.checkClone&&Ke.test(a)||!Z.support.html5Clone&&qe.test(a)||(r=!0,s=Z.fragments[a],o=s!==e),s||(s=i.createDocumentFragment(),Z.clean(t,i,s,n),r&&(Z.fragments[a]=o&&s)),{fragment:s,cacheable:r}},Z.fragments={},Z.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(t,e){Z.fn[t]=function(i){var n,s=0,r=[],o=Z(i),a=o.length,l=1===this.length&&this[0].parentNode;if((null==l||l&&11===l.nodeType&&1===l.childNodes.length)&&1===a)return o[e](this[0]),this;for(;a>s;s++)n=(s>0?this.clone(!0):this).get(),Z(o[s])[e](n),r=r.concat(n);return this.pushStack(r,t,o.selector)}}),Z.extend({clone:function(t,e,i){var n,s,r,o;if(Z.support.html5Clone||Z.isXMLDoc(t)||!qe.test("<"+t.nodeName+">")?o=t.cloneNode(!0):(ei.innerHTML=t.outerHTML,ei.removeChild(o=ei.firstChild)),!(Z.support.noCloneEvent&&Z.support.noCloneChecked||1!==t.nodeType&&11!==t.nodeType||Z.isXMLDoc(t)))for(p(t,o),n=f(t),s=f(o),r=0;n[r];++r)s[r]&&p(n[r],s[r]);if(e&&(d(t,o),i))for(n=f(t),s=f(o),r=0;n[r];++r)d(n[r],s[r]);return n=s=null,o},clean:function(t,e,i,n){var s,r,o,a,l,h,u,d,p,f,g,v=e===R&&ti,y=[];for(e&&"undefined"!=typeof e.createDocumentFragment||(e=R),s=0;null!=(o=t[s]);s++)if("number"==typeof o&&(o+=""),o){if("string"==typeof o)if(Ve.test(o)){for(v=v||c(e),u=e.createElement("div"),v.appendChild(u),o=o.replace(je,"<$1></$2>"),a=(Be.exec(o)||["",""])[1].toLowerCase(),l=Qe[a]||Qe._default,h=l[0],u.innerHTML=l[1]+o+l[2];h--;)u=u.lastChild;if(!Z.support.tbody)for(d=Ye.test(o),p="table"!==a||d?"<table>"!==l[1]||d?[]:u.childNodes:u.firstChild&&u.firstChild.childNodes,r=p.length-1;r>=0;--r)Z.nodeName(p[r],"tbody")&&!p[r].childNodes.length&&p[r].parentNode.removeChild(p[r]);!Z.support.leadingWhitespace&&Re.test(o)&&u.insertBefore(e.createTextNode(Re.exec(o)[0]),u.firstChild),o=u.childNodes,u.parentNode.removeChild(u)}else o=e.createTextNode(o);o.nodeType?y.push(o):Z.merge(y,o)}if(u&&(o=u=v=null),!Z.support.appendChecked)for(s=0;null!=(o=y[s]);s++)Z.nodeName(o,"input")?m(o):"undefined"!=typeof o.getElementsByTagName&&Z.grep(o.getElementsByTagName("input"),m);if(i)for(f=function(t){return!t.type||Je.test(t.type)?n?n.push(t.parentNode?t.parentNode.removeChild(t):t):i.appendChild(t):void 0},s=0;null!=(o=y[s]);s++)Z.nodeName(o,"script")&&f(o)||(i.appendChild(o),"undefined"!=typeof o.getElementsByTagName&&(g=Z.grep(Z.merge([],o.getElementsByTagName("script")),f),y.splice.apply(y,[s+1,0].concat(g)),s+=g.length));return y},cleanData:function(t,e){for(var i,n,s,r,o=0,a=Z.expando,l=Z.cache,h=Z.support.deleteExpando,c=Z.event.special;null!=(s=t[o]);o++)if((e||Z.acceptData(s))&&(n=s[a],i=n&&l[n])){if(i.events)for(r in i.events)c[r]?Z.event.remove(s,r):Z.removeEvent(s,r,i.handle);l[n]&&(delete l[n],h?delete s[a]:s.removeAttribute?s.removeAttribute(a):s[a]=null,Z.deletedIds.push(n))}}}),function(){var t,e;Z.uaMatch=function(t){t=t.toLowerCase();var e=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:e[1]||"",version:e[2]||"0"}},t=Z.uaMatch(B.userAgent),e={},t.browser&&(e[t.browser]=!0,e.version=t.version),e.chrome?e.webkit=!0:e.webkit&&(e.safari=!0),Z.browser=e,Z.sub=function(){function t(e,i){return new t.fn.init(e,i)}Z.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(i,n){return n&&n instanceof Z&&!(n instanceof t)&&(n=t(n)),Z.fn.init.call(this,i,n,e)},t.fn.init.prototype=t.fn;var e=t(R);return t}}();var ii,ni,si,ri=/alpha\([^)]*\)/i,oi=/opacity=([^)]*)/,ai=/^(top|right|bottom|left)$/,li=/^(none|table(?!-c[ea]).+)/,hi=/^margin/,ci=new RegExp("^("+Q+")(.*)$","i"),ui=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),di=new RegExp("^([-+])=("+Q+")","i"),pi={},fi={position:"absolute",visibility:"hidden",display:"block"},mi={letterSpacing:0,fontWeight:400},gi=["Top","Right","Bottom","Left"],vi=["Webkit","O","Moz","ms"],yi=Z.fn.toggle;Z.fn.extend({css:function(t,i){return Z.access(this,function(t,i,n){return n!==e?Z.style(t,i,n):Z.css(t,i)},t,i,arguments.length>1)},show:function(){return y(this,!0)},hide:function(){return y(this)},toggle:function(t,e){var i="boolean"==typeof t;return Z.isFunction(t)&&Z.isFunction(e)?yi.apply(this,arguments):this.each(function(){(i?t:v(this))?Z(this).show():Z(this).hide()})}}),Z.extend({cssHooks:{opacity:{get:function(t,e){if(e){var i=ii(t,"opacity");return""===i?"1":i}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":Z.support.cssFloat?"cssFloat":"styleFloat"},style:function(t,i,n,s){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var r,o,a,l=Z.camelCase(i),h=t.style;if(i=Z.cssProps[l]||(Z.cssProps[l]=g(h,l)),a=Z.cssHooks[i]||Z.cssHooks[l],n===e)return a&&"get"in a&&(r=a.get(t,!1,s))!==e?r:h[i];if(o=typeof n,"string"===o&&(r=di.exec(n))&&(n=(r[1]+1)*r[2]+parseFloat(Z.css(t,i)),o="number"),!(null==n||"number"===o&&isNaN(n)||("number"!==o||Z.cssNumber[l]||(n+="px"),a&&"set"in a&&(n=a.set(t,n,s))===e)))try{h[i]=n}catch(c){}}},css:function(t,i,n,s){var r,o,a,l=Z.camelCase(i);return i=Z.cssProps[l]||(Z.cssProps[l]=g(t.style,l)),a=Z.cssHooks[i]||Z.cssHooks[l],a&&"get"in a&&(r=a.get(t,!0,s)),r===e&&(r=ii(t,i)),"normal"===r&&i in mi&&(r=mi[i]),n||s!==e?(o=parseFloat(r),n||Z.isNumeric(o)?o||0:r):r},swap:function(t,e,i){var n,s,r={};for(s in e)r[s]=t.style[s],t.style[s]=e[s];n=i.call(t);for(s in e)t.style[s]=r[s];return n}}),t.getComputedStyle?ii=function(e,i){var n,s,r,o,a=t.getComputedStyle(e,null),l=e.style;return a&&(n=a[i],""!==n||Z.contains(e.ownerDocument,e)||(n=Z.style(e,i)),ui.test(n)&&hi.test(i)&&(s=l.width,r=l.minWidth,o=l.maxWidth,l.minWidth=l.maxWidth=l.width=n,n=a.width,l.width=s,l.minWidth=r,l.maxWidth=o)),n}:R.documentElement.currentStyle&&(ii=function(t,e){var i,n,s=t.currentStyle&&t.currentStyle[e],r=t.style;return null==s&&r&&r[e]&&(s=r[e]),ui.test(s)&&!ai.test(e)&&(i=r.left,n=t.runtimeStyle&&t.runtimeStyle.left,n&&(t.runtimeStyle.left=t.currentStyle.left),r.left="fontSize"===e?"1em":s,s=r.pixelLeft+"px",r.left=i,n&&(t.runtimeStyle.left=n)),""===s?"auto":s}),Z.each(["height","width"],function(t,e){Z.cssHooks[e]={get:function(t,i,n){return i?0===t.offsetWidth&&li.test(ii(t,"display"))?Z.swap(t,fi,function(){return w(t,e,n)}):w(t,e,n):void 0},set:function(t,i,n){return b(t,i,n?x(t,e,n,Z.support.boxSizing&&"border-box"===Z.css(t,"boxSizing")):0)}}}),Z.support.opacity||(Z.cssHooks.opacity={get:function(t,e){return oi.test((e&&t.currentStyle?t.currentStyle.filter:t.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":e?"1":""},set:function(t,e){var i=t.style,n=t.currentStyle,s=Z.isNumeric(e)?"alpha(opacity="+100*e+")":"",r=n&&n.filter||i.filter||"";i.zoom=1,e>=1&&""===Z.trim(r.replace(ri,""))&&i.removeAttribute&&(i.removeAttribute("filter"),n&&!n.filter)||(i.filter=ri.test(r)?r.replace(ri,s):r+" "+s)}}),Z(function(){Z.support.reliableMarginRight||(Z.cssHooks.marginRight={get:function(t,e){return Z.swap(t,{display:"inline-block"},function(){return e?ii(t,"marginRight"):void 0})}}),!Z.support.pixelPosition&&Z.fn.position&&Z.each(["top","left"],function(t,e){Z.cssHooks[e]={get:function(t,i){if(i){var n=ii(t,e);return ui.test(n)?Z(t).position()[e]+"px":n}}}})}),Z.expr&&Z.expr.filters&&(Z.expr.filters.hidden=function(t){return 0===t.offsetWidth&&0===t.offsetHeight||!Z.support.reliableHiddenOffsets&&"none"===(t.style&&t.style.display||ii(t,"display"))},Z.expr.filters.visible=function(t){return!Z.expr.filters.hidden(t)}),Z.each({margin:"",padding:"",border:"Width"},function(t,e){Z.cssHooks[t+e]={expand:function(i){var n,s="string"==typeof i?i.split(" "):[i],r={};for(n=0;4>n;n++)r[t+gi[n]+e]=s[n]||s[n-2]||s[0];return r}},hi.test(t)||(Z.cssHooks[t+e].set=b)});var bi=/%20/g,xi=/\[\]$/,wi=/\r?\n/g,ki=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,_i=/^(?:select|textarea)/i;Z.fn.extend({serialize:function(){return Z.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?Z.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||_i.test(this.nodeName)||ki.test(this.type))}).map(function(t,e){var i=Z(this).val();return null==i?null:Z.isArray(i)?Z.map(i,function(t){return{name:e.name,value:t.replace(wi,"\r\n")}}):{name:e.name,value:i.replace(wi,"\r\n")}}).get()}}),Z.param=function(t,i){var n,s=[],r=function(t,e){e=Z.isFunction(e)?e():null==e?"":e,s[s.length]=encodeURIComponent(t)+"="+encodeURIComponent(e)};if(i===e&&(i=Z.ajaxSettings&&Z.ajaxSettings.traditional),Z.isArray(t)||t.jquery&&!Z.isPlainObject(t))Z.each(t,function(){r(this.name,this.value)});else for(n in t)_(n,t[n],i,r);return s.join("&").replace(bi,"+")};var Ci,Di,Mi=/#.*$/,Si=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Ti=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Ai=/^(?:GET|HEAD)$/,Ei=/^\/\//,Fi=/\?/,Ii=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,Li=/([?&])_=[^&]*/,Ni=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,$i=Z.fn.load,zi={},Pi={},Oi=["*/"]+["*"];try{Di=j.href}catch(Hi){Di=R.createElement("a"),Di.href="",Di=Di.href}Ci=Ni.exec(Di.toLowerCase())||[],Z.fn.load=function(t,i,n){if("string"!=typeof t&&$i)return $i.apply(this,arguments);if(!this.length)return this;var s,r,o,a=this,l=t.indexOf(" ");return l>=0&&(s=t.slice(l,t.length),t=t.slice(0,l)),Z.isFunction(i)?(n=i,i=e):i&&"object"==typeof i&&(r="POST"),Z.ajax({url:t,type:r,dataType:"html",data:i,complete:function(t,e){n&&a.each(n,o||[t.responseText,e,t])}}).done(function(t){o=arguments,a.html(s?Z("<div>").append(t.replace(Ii,"")).find(s):t)}),this},Z.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(t,e){Z.fn[e]=function(t){return this.on(e,t)}}),Z.each(["get","post"],function(t,i){Z[i]=function(t,n,s,r){return Z.isFunction(n)&&(r=r||s,s=n,n=e),Z.ajax({type:i,url:t,data:n,success:s,dataType:r})}}),Z.extend({getScript:function(t,i){return Z.get(t,e,i,"script")},getJSON:function(t,e,i){return Z.get(t,e,i,"json")},ajaxSetup:function(t,e){return e?M(t,Z.ajaxSettings):(e=t,t=Z.ajaxSettings),M(t,e),t},ajaxSettings:{url:Di,isLocal:Ti.test(Ci[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Oi},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":t.String,"text html":!0,"text json":Z.parseJSON,"text xml":Z.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:C(zi),ajaxTransport:C(Pi),ajax:function(t,i){function n(t,i,n,o){var h,u,y,b,w,_=i;2!==x&&(x=2,l&&clearTimeout(l),a=e,r=o||"",k.readyState=t>0?4:0,n&&(b=S(d,k,n)),t>=200&&300>t||304===t?(d.ifModified&&(w=k.getResponseHeader("Last-Modified"),w&&(Z.lastModified[s]=w),w=k.getResponseHeader("Etag"),w&&(Z.etag[s]=w)),304===t?(_="notmodified",h=!0):(h=T(d,b),_=h.state,u=h.data,y=h.error,h=!y)):(y=_,(!_||t)&&(_="error",0>t&&(t=0))),k.status=t,k.statusText=(i||_)+"",h?m.resolveWith(p,[u,_,k]):m.rejectWith(p,[k,_,y]),k.statusCode(v),v=e,c&&f.trigger("ajax"+(h?"Success":"Error"),[k,d,h?u:y]),g.fireWith(p,[k,_]),c&&(f.trigger("ajaxComplete",[k,d]),--Z.active||Z.event.trigger("ajaxStop")))}"object"==typeof t&&(i=t,t=e),i=i||{};var s,r,o,a,l,h,c,u,d=Z.ajaxSetup({},i),p=d.context||d,f=p!==d&&(p.nodeType||p instanceof Z)?Z(p):Z.event,m=Z.Deferred(),g=Z.Callbacks("once memory"),v=d.statusCode||{},y={},b={},x=0,w="canceled",k={readyState:0,setRequestHeader:function(t,e){if(!x){var i=t.toLowerCase();t=b[i]=b[i]||t,y[t]=e}return this},getAllResponseHeaders:function(){return 2===x?r:null},getResponseHeader:function(t){var i;if(2===x){if(!o)for(o={};i=Si.exec(r);)o[i[1].toLowerCase()]=i[2];i=o[t.toLowerCase()]}return i===e?null:i},overrideMimeType:function(t){return x||(d.mimeType=t),this},abort:function(t){return t=t||w,a&&a.abort(t),n(0,t),this}};if(m.promise(k),k.success=k.done,k.error=k.fail,k.complete=g.add,k.statusCode=function(t){if(t){var e;if(2>x)for(e in t)v[e]=[v[e],t[e]];else e=t[k.status],k.always(e)}return this},d.url=((t||d.url)+"").replace(Mi,"").replace(Ei,Ci[1]+"//"),d.dataTypes=Z.trim(d.dataType||"*").toLowerCase().split(ee),null==d.crossDomain&&(h=Ni.exec(d.url.toLowerCase())||!1,d.crossDomain=h&&h.join(":")+(h[3]?"":"http:"===h[1]?80:443)!==Ci.join(":")+(Ci[3]?"":"http:"===Ci[1]?80:443)),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=Z.param(d.data,d.traditional)),D(zi,d,i,k),2===x)return k;if(c=d.global,d.type=d.type.toUpperCase(),d.hasContent=!Ai.test(d.type),c&&0===Z.active++&&Z.event.trigger("ajaxStart"),!d.hasContent&&(d.data&&(d.url+=(Fi.test(d.url)?"&":"?")+d.data,delete d.data),s=d.url,d.cache===!1)){var _=Z.now(),C=d.url.replace(Li,"$1_="+_);d.url=C+(C===d.url?(Fi.test(d.url)?"&":"?")+"_="+_:"")}(d.data&&d.hasContent&&d.contentType!==!1||i.contentType)&&k.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(s=s||d.url,Z.lastModified[s]&&k.setRequestHeader("If-Modified-Since",Z.lastModified[s]),Z.etag[s]&&k.setRequestHeader("If-None-Match",Z.etag[s])),k.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Oi+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)k.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(p,k,d)===!1||2===x))return k.abort();w="abort";for(u in{success:1,error:1,complete:1})k[u](d[u]);if(a=D(Pi,d,i,k)){k.readyState=1,c&&f.trigger("ajaxSend",[k,d]),d.async&&d.timeout>0&&(l=setTimeout(function(){k.abort("timeout")},d.timeout));try{x=1,a.send(y,n)}catch(M){if(!(2>x))throw M;n(-1,M)}}else n(-1,"No Transport");return k},active:0,lastModified:{},etag:{}});var Wi=[],Ri=/\?/,ji=/(=)\?(?=&|$)|\?\?/,Bi=Z.now();Z.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var t=Wi.pop()||Z.expando+"_"+Bi++;return this[t]=!0,t}}),Z.ajaxPrefilter("json jsonp",function(i,n,s){var r,o,a,l=i.data,h=i.url,c=i.jsonp!==!1,u=c&&ji.test(h),d=c&&!u&&"string"==typeof l&&!(i.contentType||"").indexOf("application/x-www-form-urlencoded")&&ji.test(l);return"jsonp"===i.dataTypes[0]||u||d?(r=i.jsonpCallback=Z.isFunction(i.jsonpCallback)?i.jsonpCallback():i.jsonpCallback,o=t[r],u?i.url=h.replace(ji,"$1"+r):d?i.data=l.replace(ji,"$1"+r):c&&(i.url+=(Ri.test(h)?"&":"?")+i.jsonp+"="+r),i.converters["script json"]=function(){return a||Z.error(r+" was not called"),a[0]},i.dataTypes[0]="json",t[r]=function(){a=arguments},s.always(function(){t[r]=o,i[r]&&(i.jsonpCallback=n.jsonpCallback,Wi.push(r)),a&&Z.isFunction(o)&&o(a[0]),a=o=e}),"script"):void 0}),Z.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(t){return Z.globalEval(t),t}}}),Z.ajaxPrefilter("script",function(t){t.cache===e&&(t.cache=!1),t.crossDomain&&(t.type="GET",t.global=!1)}),Z.ajaxTransport("script",function(t){if(t.crossDomain){var i,n=R.head||R.getElementsByTagName("head")[0]||R.documentElement;return{send:function(s,r){i=R.createElement("script"),i.async="async",t.scriptCharset&&(i.charset=t.scriptCharset),i.src=t.url,i.onload=i.onreadystatechange=function(t,s){(s||!i.readyState||/loaded|complete/.test(i.readyState))&&(i.onload=i.onreadystatechange=null,n&&i.parentNode&&n.removeChild(i),i=e,s||r(200,"success"))},n.insertBefore(i,n.firstChild)},abort:function(){i&&i.onload(0,1)}}}});var Yi,Vi=t.ActiveXObject?function(){for(var t in Yi)Yi[t](0,1)}:!1,Ui=0;Z.ajaxSettings.xhr=t.ActiveXObject?function(){return!this.isLocal&&A()||E()}:A,function(t){Z.extend(Z.support,{ajax:!!t,cors:!!t&&"withCredentials"in t})}(Z.ajaxSettings.xhr()),Z.support.ajax&&Z.ajaxTransport(function(i){if(!i.crossDomain||Z.support.cors){var n;return{send:function(s,r){var o,a,l=i.xhr();if(i.username?l.open(i.type,i.url,i.async,i.username,i.password):l.open(i.type,i.url,i.async),i.xhrFields)for(a in i.xhrFields)l[a]=i.xhrFields[a];i.mimeType&&l.overrideMimeType&&l.overrideMimeType(i.mimeType),i.crossDomain||s["X-Requested-With"]||(s["X-Requested-With"]="XMLHttpRequest");try{for(a in s)l.setRequestHeader(a,s[a])}catch(h){}l.send(i.hasContent&&i.data||null),n=function(t,s){var a,h,c,u,d;try{if(n&&(s||4===l.readyState))if(n=e,o&&(l.onreadystatechange=Z.noop,Vi&&delete Yi[o]),s)4!==l.readyState&&l.abort();else{a=l.status,c=l.getAllResponseHeaders(),u={},d=l.responseXML,d&&d.documentElement&&(u.xml=d);try{u.text=l.responseText}catch(t){}try{h=l.statusText}catch(p){h=""}a||!i.isLocal||i.crossDomain?1223===a&&(a=204):a=u.text?200:404}}catch(f){s||r(-1,f)}u&&r(a,h,u,c)},i.async?4===l.readyState?setTimeout(n,0):(o=++Ui,Vi&&(Yi||(Yi={},Z(t).unload(Vi)),Yi[o]=n),l.onreadystatechange=n):n()},abort:function(){n&&n(0,1)}}}});var Gi,qi,Xi=/^(?:toggle|show|hide)$/,Ki=new RegExp("^(?:([-+])=|)("+Q+")([a-z%]*)$","i"),Ji=/queueHooks$/,Zi=[$],Qi={"*":[function(t,e){var i,n,s=this.createTween(t,e),r=Ki.exec(e),o=s.cur(),a=+o||0,l=1,h=20;if(r){if(i=+r[2],n=r[3]||(Z.cssNumber[t]?"":"px"),"px"!==n&&a){a=Z.css(s.elem,t,!0)||i||1;do l=l||".5",a/=l,Z.style(s.elem,t,a+n);while(l!==(l=s.cur()/o)&&1!==l&&--h)}s.unit=n,s.start=a,s.end=r[1]?a+(r[1]+1)*i:i}return s}]};Z.Animation=Z.extend(L,{tweener:function(t,e){Z.isFunction(t)?(e=t,t=["*"]):t=t.split(" ");for(var i,n=0,s=t.length;s>n;n++)i=t[n],Qi[i]=Qi[i]||[],Qi[i].unshift(e)},prefilter:function(t,e){e?Zi.unshift(t):Zi.push(t)}}),Z.Tween=z,z.prototype={constructor:z,init:function(t,e,i,n,s,r){this.elem=t,this.prop=i,this.easing=s||"swing",this.options=e,this.start=this.now=this.cur(),this.end=n,this.unit=r||(Z.cssNumber[i]?"":"px")},cur:function(){var t=z.propHooks[this.prop];return t&&t.get?t.get(this):z.propHooks._default.get(this)},run:function(t){var e,i=z.propHooks[this.prop];return this.pos=e=this.options.duration?Z.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),i&&i.set?i.set(this):z.propHooks._default.set(this),this}},z.prototype.init.prototype=z.prototype,z.propHooks={_default:{get:function(t){var e;return null==t.elem[t.prop]||t.elem.style&&null!=t.elem.style[t.prop]?(e=Z.css(t.elem,t.prop,!1,""),e&&"auto"!==e?e:0):t.elem[t.prop]},set:function(t){Z.fx.step[t.prop]?Z.fx.step[t.prop](t):t.elem.style&&(null!=t.elem.style[Z.cssProps[t.prop]]||Z.cssHooks[t.prop])?Z.style(t.elem,t.prop,t.now+t.unit):t.elem[t.prop]=t.now}}},z.propHooks.scrollTop=z.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},Z.each(["toggle","show","hide"],function(t,e){var i=Z.fn[e];Z.fn[e]=function(n,s,r){return null==n||"boolean"==typeof n||!t&&Z.isFunction(n)&&Z.isFunction(s)?i.apply(this,arguments):this.animate(P(e,!0),n,s,r)}}),Z.fn.extend({fadeTo:function(t,e,i,n){return this.filter(v).css("opacity",0).show().end().animate({opacity:e},t,i,n)},animate:function(t,e,i,n){var s=Z.isEmptyObject(t),r=Z.speed(e,i,n),o=function(){var e=L(this,Z.extend({},t),r);s&&e.stop(!0)};return s||r.queue===!1?this.each(o):this.queue(r.queue,o)},stop:function(t,i,n){var s=function(t){var e=t.stop;delete t.stop,e(n)};return"string"!=typeof t&&(n=i,i=t,t=e),i&&t!==!1&&this.queue(t||"fx",[]),this.each(function(){var e=!0,i=null!=t&&t+"queueHooks",r=Z.timers,o=Z._data(this);if(i)o[i]&&o[i].stop&&s(o[i]);else for(i in o)o[i]&&o[i].stop&&Ji.test(i)&&s(o[i]);for(i=r.length;i--;)r[i].elem!==this||null!=t&&r[i].queue!==t||(r[i].anim.stop(n),e=!1,r.splice(i,1));(e||!n)&&Z.dequeue(this,t)})}}),Z.each({slideDown:P("show"),slideUp:P("hide"),slideToggle:P("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(t,e){Z.fn[t]=function(t,i,n){return this.animate(e,t,i,n)}}),Z.speed=function(t,e,i){var n=t&&"object"==typeof t?Z.extend({},t):{complete:i||!i&&e||Z.isFunction(t)&&t,duration:t,easing:i&&e||e&&!Z.isFunction(e)&&e};return n.duration=Z.fx.off?0:"number"==typeof n.duration?n.duration:n.duration in Z.fx.speeds?Z.fx.speeds[n.duration]:Z.fx.speeds._default,(null==n.queue||n.queue===!0)&&(n.queue="fx"),n.old=n.complete,n.complete=function(){Z.isFunction(n.old)&&n.old.call(this),n.queue&&Z.dequeue(this,n.queue)},n},Z.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2}},Z.timers=[],Z.fx=z.prototype.init,Z.fx.tick=function(){for(var t,e=Z.timers,i=0;i<e.length;i++)t=e[i],t()||e[i]!==t||e.splice(i--,1);e.length||Z.fx.stop()},Z.fx.timer=function(t){t()&&Z.timers.push(t)&&!qi&&(qi=setInterval(Z.fx.tick,Z.fx.interval))},Z.fx.interval=13,Z.fx.stop=function(){clearInterval(qi),qi=null},Z.fx.speeds={slow:600,fast:200,_default:400},Z.fx.step={},Z.expr&&Z.expr.filters&&(Z.expr.filters.animated=function(t){return Z.grep(Z.timers,function(e){return t===e.elem}).length});var tn=/^(?:body|html)$/i;Z.fn.offset=function(t){if(arguments.length)return t===e?this:this.each(function(e){Z.offset.setOffset(this,t,e)});var i,n,s,r,o,a,l,h={top:0,left:0},c=this[0],u=c&&c.ownerDocument;if(u)return(n=u.body)===c?Z.offset.bodyOffset(c):(i=u.documentElement,Z.contains(i,c)?("undefined"!=typeof c.getBoundingClientRect&&(h=c.getBoundingClientRect()),s=O(u),r=i.clientTop||n.clientTop||0,o=i.clientLeft||n.clientLeft||0,a=s.pageYOffset||i.scrollTop,l=s.pageXOffset||i.scrollLeft,{top:h.top+a-r,left:h.left+l-o}):h)},Z.offset={bodyOffset:function(t){var e=t.offsetTop,i=t.offsetLeft;return Z.support.doesNotIncludeMarginInBodyOffset&&(e+=parseFloat(Z.css(t,"marginTop"))||0,i+=parseFloat(Z.css(t,"marginLeft"))||0),{top:e,left:i}},setOffset:function(t,e,i){var n=Z.css(t,"position");"static"===n&&(t.style.position="relative");var s,r,o=Z(t),a=o.offset(),l=Z.css(t,"top"),h=Z.css(t,"left"),c=("absolute"===n||"fixed"===n)&&Z.inArray("auto",[l,h])>-1,u={},d={};c?(d=o.position(),s=d.top,r=d.left):(s=parseFloat(l)||0,r=parseFloat(h)||0),Z.isFunction(e)&&(e=e.call(t,i,a)),null!=e.top&&(u.top=e.top-a.top+s),null!=e.left&&(u.left=e.left-a.left+r),"using"in e?e.using.call(t,u):o.css(u)}},Z.fn.extend({position:function(){if(this[0]){var t=this[0],e=this.offsetParent(),i=this.offset(),n=tn.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(Z.css(t,"marginTop"))||0,i.left-=parseFloat(Z.css(t,"marginLeft"))||0,n.top+=parseFloat(Z.css(e[0],"borderTopWidth"))||0,n.left+=parseFloat(Z.css(e[0],"borderLeftWidth"))||0,{top:i.top-n.top,left:i.left-n.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||R.body;t&&!tn.test(t.nodeName)&&"static"===Z.css(t,"position");)t=t.offsetParent;return t||R.body})}}),Z.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var n=/Y/.test(i);Z.fn[t]=function(s){return Z.access(this,function(t,s,r){var o=O(t);return r===e?o?i in o?o[i]:o.document.documentElement[s]:t[s]:(o?o.scrollTo(n?Z(o).scrollLeft():r,n?r:Z(o).scrollTop()):t[s]=r,void 0)},t,s,arguments.length,null)}}),Z.each({Height:"height",Width:"width"},function(t,i){Z.each({padding:"inner"+t,content:i,"":"outer"+t},function(n,s){Z.fn[s]=function(s,r){var o=arguments.length&&(n||"boolean"!=typeof s),a=n||(s===!0||r===!0?"margin":"border");return Z.access(this,function(i,n,s){var r;return Z.isWindow(i)?i.document.documentElement["client"+t]:9===i.nodeType?(r=i.documentElement,Math.max(i.body["scroll"+t],r["scroll"+t],i.body["offset"+t],r["offset"+t],r["client"+t])):s===e?Z.css(i,n,s,a):Z.style(i,n,s,a)},i,o?s:e,o,null)}})}),t.jQuery=t.$=Z,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return Z})}(window),function(){var t=this,e=t._,i={},n=Array.prototype,s=Object.prototype,r=Function.prototype,o=n.push,a=n.slice,l=n.concat,h=s.toString,c=s.hasOwnProperty,u=n.forEach,d=n.map,p=n.reduce,f=n.reduceRight,m=n.filter,g=n.every,v=n.some,y=n.indexOf,b=n.lastIndexOf,x=Array.isArray,w=Object.keys,k=r.bind,_=function(t){return t instanceof _?t:this instanceof _?(this._wrapped=t,void 0):new _(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=_),exports._=_):t._=_,_.VERSION="1.4.4";var C=_.each=_.forEach=function(t,e,n){if(null!=t)if(u&&t.forEach===u)t.forEach(e,n);else if(t.length===+t.length){for(var s=0,r=t.length;r>s;s++)if(e.call(n,t[s],s,t)===i)return}else for(var o in t)if(_.has(t,o)&&e.call(n,t[o],o,t)===i)return};_.map=_.collect=function(t,e,i){var n=[];return null==t?n:d&&t.map===d?t.map(e,i):(C(t,function(t,s,r){n[n.length]=e.call(i,t,s,r)}),n)};var D="Reduce of empty array with no initial value";_.reduce=_.foldl=_.inject=function(t,e,i,n){var s=arguments.length>2;if(null==t&&(t=[]),p&&t.reduce===p)return n&&(e=_.bind(e,n)),s?t.reduce(e,i):t.reduce(e);if(C(t,function(t,r,o){s?i=e.call(n,i,t,r,o):(i=t,s=!0)}),!s)throw new TypeError(D);return i},_.reduceRight=_.foldr=function(t,e,i,n){var s=arguments.length>2;if(null==t&&(t=[]),f&&t.reduceRight===f)return n&&(e=_.bind(e,n)),s?t.reduceRight(e,i):t.reduceRight(e);var r=t.length;if(r!==+r){var o=_.keys(t);r=o.length}if(C(t,function(a,l,h){l=o?o[--r]:--r,s?i=e.call(n,i,t[l],l,h):(i=t[l],s=!0)}),!s)throw new TypeError(D);return i},_.find=_.detect=function(t,e,i){var n;return M(t,function(t,s,r){return e.call(i,t,s,r)?(n=t,!0):void 0}),n},_.filter=_.select=function(t,e,i){var n=[];return null==t?n:m&&t.filter===m?t.filter(e,i):(C(t,function(t,s,r){e.call(i,t,s,r)&&(n[n.length]=t)}),n)},_.reject=function(t,e,i){return _.filter(t,function(t,n,s){return!e.call(i,t,n,s)},i)},_.every=_.all=function(t,e,n){e||(e=_.identity);var s=!0;return null==t?s:g&&t.every===g?t.every(e,n):(C(t,function(t,r,o){return(s=s&&e.call(n,t,r,o))?void 0:i}),!!s)};var M=_.some=_.any=function(t,e,n){e||(e=_.identity);var s=!1;return null==t?s:v&&t.some===v?t.some(e,n):(C(t,function(t,r,o){return s||(s=e.call(n,t,r,o))?i:void 0}),!!s)};_.contains=_.include=function(t,e){return null==t?!1:y&&t.indexOf===y?-1!=t.indexOf(e):M(t,function(t){return t===e})},_.invoke=function(t,e){var i=a.call(arguments,2),n=_.isFunction(e);return _.map(t,function(t){return(n?e:t[e]).apply(t,i)})},_.pluck=function(t,e){return _.map(t,function(t){return t[e]})},_.where=function(t,e,i){return _.isEmpty(e)?i?null:[]:_[i?"find":"filter"](t,function(t){for(var i in e)if(e[i]!==t[i])return!1;return!0})},_.findWhere=function(t,e){return _.where(t,e,!0)},_.max=function(t,e,i){if(!e&&_.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.max.apply(Math,t);if(!e&&_.isEmpty(t))return-1/0;var n={computed:-1/0,value:-1/0};return C(t,function(t,s,r){var o=e?e.call(i,t,s,r):t;o>=n.computed&&(n={value:t,computed:o})}),n.value},_.min=function(t,e,i){if(!e&&_.isArray(t)&&t[0]===+t[0]&&t.length<65535)return Math.min.apply(Math,t);if(!e&&_.isEmpty(t))return 1/0;var n={computed:1/0,value:1/0};return C(t,function(t,s,r){var o=e?e.call(i,t,s,r):t;o<n.computed&&(n={value:t,computed:o})}),n.value},_.shuffle=function(t){var e,i=0,n=[];return C(t,function(t){e=_.random(i++),n[i-1]=n[e],n[e]=t}),n};var S=function(t){return _.isFunction(t)?t:function(e){return e[t]}};_.sortBy=function(t,e,i){var n=S(e);return _.pluck(_.map(t,function(t,e,s){return{value:t,index:e,criteria:n.call(i,t,e,s)}}).sort(function(t,e){var i=t.criteria,n=e.criteria;if(i!==n){if(i>n||void 0===i)return 1;if(n>i||void 0===n)return-1}return t.index<e.index?-1:1}),"value")};var T=function(t,e,i,n){var s={},r=S(e||_.identity);return C(t,function(e,o){var a=r.call(i,e,o,t);n(s,a,e)}),s};_.groupBy=function(t,e,i){return T(t,e,i,function(t,e,i){(_.has(t,e)?t[e]:t[e]=[]).push(i)})},_.countBy=function(t,e,i){return T(t,e,i,function(t,e){_.has(t,e)||(t[e]=0),t[e]++
383
+ })},_.sortedIndex=function(t,e,i,n){i=null==i?_.identity:S(i);for(var s=i.call(n,e),r=0,o=t.length;o>r;){var a=r+o>>>1;i.call(n,t[a])<s?r=a+1:o=a}return r},_.toArray=function(t){return t?_.isArray(t)?a.call(t):t.length===+t.length?_.map(t,_.identity):_.values(t):[]},_.size=function(t){return null==t?0:t.length===+t.length?t.length:_.keys(t).length},_.first=_.head=_.take=function(t,e,i){return null==t?void 0:null==e||i?t[0]:a.call(t,0,e)},_.initial=function(t,e,i){return a.call(t,0,t.length-(null==e||i?1:e))},_.last=function(t,e,i){return null==t?void 0:null==e||i?t[t.length-1]:a.call(t,Math.max(t.length-e,0))},_.rest=_.tail=_.drop=function(t,e,i){return a.call(t,null==e||i?1:e)},_.compact=function(t){return _.filter(t,_.identity)};var A=function(t,e,i){return C(t,function(t){_.isArray(t)?e?o.apply(i,t):A(t,e,i):i.push(t)}),i};_.flatten=function(t,e){return A(t,e,[])},_.without=function(t){return _.difference(t,a.call(arguments,1))},_.uniq=_.unique=function(t,e,i,n){_.isFunction(e)&&(n=i,i=e,e=!1);var s=i?_.map(t,i,n):t,r=[],o=[];return C(s,function(i,n){(e?n&&o[o.length-1]===i:_.contains(o,i))||(o.push(i),r.push(t[n]))}),r},_.union=function(){return _.uniq(l.apply(n,arguments))},_.intersection=function(t){var e=a.call(arguments,1);return _.filter(_.uniq(t),function(t){return _.every(e,function(e){return _.indexOf(e,t)>=0})})},_.difference=function(t){var e=l.apply(n,a.call(arguments,1));return _.filter(t,function(t){return!_.contains(e,t)})},_.zip=function(){for(var t=a.call(arguments),e=_.max(_.pluck(t,"length")),i=new Array(e),n=0;e>n;n++)i[n]=_.pluck(t,""+n);return i},_.object=function(t,e){if(null==t)return{};for(var i={},n=0,s=t.length;s>n;n++)e?i[t[n]]=e[n]:i[t[n][0]]=t[n][1];return i},_.indexOf=function(t,e,i){if(null==t)return-1;var n=0,s=t.length;if(i){if("number"!=typeof i)return n=_.sortedIndex(t,e),t[n]===e?n:-1;n=0>i?Math.max(0,s+i):i}if(y&&t.indexOf===y)return t.indexOf(e,i);for(;s>n;n++)if(t[n]===e)return n;return-1},_.lastIndexOf=function(t,e,i){if(null==t)return-1;var n=null!=i;if(b&&t.lastIndexOf===b)return n?t.lastIndexOf(e,i):t.lastIndexOf(e);for(var s=n?i:t.length;s--;)if(t[s]===e)return s;return-1},_.range=function(t,e,i){arguments.length<=1&&(e=t||0,t=0),i=arguments[2]||1;for(var n=Math.max(Math.ceil((e-t)/i),0),s=0,r=new Array(n);n>s;)r[s++]=t,t+=i;return r},_.bind=function(t,e){if(t.bind===k&&k)return k.apply(t,a.call(arguments,1));var i=a.call(arguments,2);return function(){return t.apply(e,i.concat(a.call(arguments)))}},_.partial=function(t){var e=a.call(arguments,1);return function(){return t.apply(this,e.concat(a.call(arguments)))}},_.bindAll=function(t){var e=a.call(arguments,1);return 0===e.length&&(e=_.functions(t)),C(e,function(e){t[e]=_.bind(t[e],t)}),t},_.memoize=function(t,e){var i={};return e||(e=_.identity),function(){var n=e.apply(this,arguments);return _.has(i,n)?i[n]:i[n]=t.apply(this,arguments)}},_.delay=function(t,e){var i=a.call(arguments,2);return setTimeout(function(){return t.apply(null,i)},e)},_.defer=function(t){return _.delay.apply(_,[t,1].concat(a.call(arguments,1)))},_.throttle=function(t,e){var i,n,s,r,o=0,a=function(){o=new Date,s=null,r=t.apply(i,n)};return function(){var l=new Date,h=e-(l-o);return i=this,n=arguments,0>=h?(clearTimeout(s),s=null,o=l,r=t.apply(i,n)):s||(s=setTimeout(a,h)),r}},_.debounce=function(t,e,i){var n,s;return function(){var r=this,o=arguments,a=function(){n=null,i||(s=t.apply(r,o))},l=i&&!n;return clearTimeout(n),n=setTimeout(a,e),l&&(s=t.apply(r,o)),s}},_.once=function(t){var e,i=!1;return function(){return i?e:(i=!0,e=t.apply(this,arguments),t=null,e)}},_.wrap=function(t,e){return function(){var i=[t];return o.apply(i,arguments),e.apply(this,i)}},_.compose=function(){var t=arguments;return function(){for(var e=arguments,i=t.length-1;i>=0;i--)e=[t[i].apply(this,e)];return e[0]}},_.after=function(t,e){return 0>=t?e():function(){return--t<1?e.apply(this,arguments):void 0}},_.keys=w||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var i in t)_.has(t,i)&&(e[e.length]=i);return e},_.values=function(t){var e=[];for(var i in t)_.has(t,i)&&e.push(t[i]);return e},_.pairs=function(t){var e=[];for(var i in t)_.has(t,i)&&e.push([i,t[i]]);return e},_.invert=function(t){var e={};for(var i in t)_.has(t,i)&&(e[t[i]]=i);return e},_.functions=_.methods=function(t){var e=[];for(var i in t)_.isFunction(t[i])&&e.push(i);return e.sort()},_.extend=function(t){return C(a.call(arguments,1),function(e){if(e)for(var i in e)t[i]=e[i]}),t},_.pick=function(t){var e={},i=l.apply(n,a.call(arguments,1));return C(i,function(i){i in t&&(e[i]=t[i])}),e},_.omit=function(t){var e={},i=l.apply(n,a.call(arguments,1));for(var s in t)_.contains(i,s)||(e[s]=t[s]);return e},_.defaults=function(t){return C(a.call(arguments,1),function(e){if(e)for(var i in e)null==t[i]&&(t[i]=e[i])}),t},_.clone=function(t){return _.isObject(t)?_.isArray(t)?t.slice():_.extend({},t):t},_.tap=function(t,e){return e(t),t};var E=function(t,e,i,n){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof _&&(t=t._wrapped),e instanceof _&&(e=e._wrapped);var s=h.call(t);if(s!=h.call(e))return!1;switch(s){case"[object String]":return t==String(e);case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var r=i.length;r--;)if(i[r]==t)return n[r]==e;i.push(t),n.push(e);var o=0,a=!0;if("[object Array]"==s){if(o=t.length,a=o==e.length)for(;o--&&(a=E(t[o],e[o],i,n)););}else{var l=t.constructor,c=e.constructor;if(l!==c&&!(_.isFunction(l)&&l instanceof l&&_.isFunction(c)&&c instanceof c))return!1;for(var u in t)if(_.has(t,u)&&(o++,!(a=_.has(e,u)&&E(t[u],e[u],i,n))))break;if(a){for(u in e)if(_.has(e,u)&&!o--)break;a=!o}}return i.pop(),n.pop(),a};_.isEqual=function(t,e){return E(t,e,[],[])},_.isEmpty=function(t){if(null==t)return!0;if(_.isArray(t)||_.isString(t))return 0===t.length;for(var e in t)if(_.has(t,e))return!1;return!0},_.isElement=function(t){return!(!t||1!==t.nodeType)},_.isArray=x||function(t){return"[object Array]"==h.call(t)},_.isObject=function(t){return t===Object(t)},C(["Arguments","Function","String","Number","Date","RegExp"],function(t){_["is"+t]=function(e){return h.call(e)=="[object "+t+"]"}}),_.isArguments(arguments)||(_.isArguments=function(t){return!(!t||!_.has(t,"callee"))}),"function"!=typeof/./&&(_.isFunction=function(t){return"function"==typeof t}),_.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},_.isNaN=function(t){return _.isNumber(t)&&t!=+t},_.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==h.call(t)},_.isNull=function(t){return null===t},_.isUndefined=function(t){return void 0===t},_.has=function(t,e){return c.call(t,e)},_.noConflict=function(){return t._=e,this},_.identity=function(t){return t},_.times=function(t,e,i){for(var n=Array(t),s=0;t>s;s++)n[s]=e.call(i,s);return n},_.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var F={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};F.unescape=_.invert(F.escape);var I={escape:new RegExp("["+_.keys(F.escape).join("")+"]","g"),unescape:new RegExp("("+_.keys(F.unescape).join("|")+")","g")};_.each(["escape","unescape"],function(t){_[t]=function(e){return null==e?"":(""+e).replace(I[t],function(e){return F[t][e]})}}),_.result=function(t,e){if(null==t)return null;var i=t[e];return _.isFunction(i)?i.call(t):i},_.mixin=function(t){C(_.functions(t),function(e){var i=_[e]=t[e];_.prototype[e]=function(){var t=[this._wrapped];return o.apply(t,arguments),P.call(this,i.apply(_,t))}})};var L=0;_.uniqueId=function(t){var e=++L+"";return t?t+e:e},_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var N=/(.)^/,$={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;_.template=function(t,e,i){var n;i=_.defaults({},i,_.templateSettings);var s=new RegExp([(i.escape||N).source,(i.interpolate||N).source,(i.evaluate||N).source].join("|")+"|$","g"),r=0,o="__p+='";t.replace(s,function(e,i,n,s,a){return o+=t.slice(r,a).replace(z,function(t){return"\\"+$[t]}),i&&(o+="'+\n((__t=("+i+"))==null?'':_.escape(__t))+\n'"),n&&(o+="'+\n((__t=("+n+"))==null?'':__t)+\n'"),s&&(o+="';\n"+s+"\n__p+='"),r=a+e.length,e}),o+="';\n",i.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{n=new Function(i.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(e)return n(e,_);var l=function(t){return n.call(this,t,_)};return l.source="function("+(i.variable||"obj")+"){\n"+o+"}",l},_.chain=function(t){return _(t).chain()};var P=function(t){return this._chain?_(t).chain():t};_.mixin(_),C(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=n[t];_.prototype[t]=function(){var i=this._wrapped;return e.apply(i,arguments),"shift"!=t&&"splice"!=t||0!==i.length||delete i[0],P.call(this,i)}}),C(["concat","join","slice"],function(t){var e=n[t];_.prototype[t]=function(){return P.call(this,e.apply(this._wrapped,arguments))}}),_.extend(_.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(t){return function(){var e;return e||t._}}(this)),function(){var t,e=this,i=e.Backbone,n=Array.prototype.slice,s=Array.prototype.splice;t="undefined"!=typeof exports?exports:e.Backbone={},t.VERSION="0.9.2";var r=e._;r||"undefined"==typeof require||(r=require("underscore"));var o=e.jQuery||e.Zepto||e.ender;t.setDomLibrary=function(t){o=t},t.noConflict=function(){return e.Backbone=i,this},t.emulateHTTP=!1,t.emulateJSON=!1;var a=/\s+/,l=t.Events={on:function(t,e,i){var n,s,r,o,l;if(!e)return this;for(t=t.split(a),n=this._callbacks||(this._callbacks={});s=t.shift();)l=n[s],r=l?l.tail:{},r.next=o={},r.context=i,r.callback=e,n[s]={tail:o,next:l?l.next:r};return this},off:function(t,e,i){var n,s,o,l,h,c;if(s=this._callbacks){if(!(t||e||i))return delete this._callbacks,this;for(t=t?t.split(a):r.keys(s);n=t.shift();)if(o=s[n],delete s[n],o&&(e||i))for(l=o.tail;(o=o.next)!==l;)h=o.callback,c=o.context,(e&&h!==e||i&&c!==i)&&this.on(n,h,c);return this}},trigger:function(t){var e,i,s,r,o,l,h;if(!(s=this._callbacks))return this;for(l=s.all,t=t.split(a),h=n.call(arguments,1);e=t.shift();){if(i=s[e])for(r=i.tail;(i=i.next)!==r;)i.callback.apply(i.context||this,h);if(i=l)for(r=i.tail,o=[e].concat(h);(i=i.next)!==r;)i.callback.apply(i.context||this,o)}return this}};l.bind=l.on,l.unbind=l.off;var h=t.Model=function(t,e){var i;t||(t={}),e&&e.parse&&(t=this.parse(t)),(i=M(this,"defaults"))&&(t=r.extend({},i,t)),e&&e.collection&&(this.collection=e.collection),this.attributes={},this._escapedAttributes={},this.cid=r.uniqueId("c"),this.changed={},this._silent={},this._pending={},this.set(t,{silent:!0}),this.changed={},this._silent={},this._pending={},this._previousAttributes=r.clone(this.attributes),this.initialize.apply(this,arguments)};r.extend(h.prototype,l,{changed:null,_silent:null,_pending:null,idAttribute:"id",initialize:function(){},toJSON:function(){return r.clone(this.attributes)},get:function(t){return this.attributes[t]},escape:function(t){var e;if(e=this._escapedAttributes[t])return e;var i=this.get(t);return this._escapedAttributes[t]=r.escape(null==i?"":""+i)},has:function(t){return null!=this.get(t)},set:function(t,e,i){var n,s,o;if(r.isObject(t)||null==t?(n=t,i=e):(n={},n[t]=e),i||(i={}),!n)return this;if(n instanceof h&&(n=n.attributes),i.unset)for(s in n)n[s]=void 0;if(!this._validate(n,i))return!1;this.idAttribute in n&&(this.id=n[this.idAttribute]);var a=i.changes={},l=this.attributes,c=this._escapedAttributes,u=this._previousAttributes||{};for(s in n)o=n[s],(!r.isEqual(l[s],o)||i.unset&&r.has(l,s))&&(delete c[s],(i.silent?this._silent:a)[s]=!0),i.unset?delete l[s]:l[s]=o,r.isEqual(u[s],o)&&r.has(l,s)==r.has(u,s)?(delete this.changed[s],delete this._pending[s]):(this.changed[s]=o,i.silent||(this._pending[s]=!0));return i.silent||this.change(i),this},unset:function(t,e){return(e||(e={})).unset=!0,this.set(t,null,e)},clear:function(t){return(t||(t={})).unset=!0,this.set(r.clone(this.attributes),t)},fetch:function(e){e=e?r.clone(e):{};var i=this,n=e.success;return e.success=function(t,s,r){return i.set(i.parse(t,r),e)?(n&&n(i,t),void 0):!1},e.error=t.wrapError(e.error,i,e),(this.sync||t.sync).call(this,"read",this,e)},save:function(e,i,n){var s,o;if(r.isObject(e)||null==e?(s=e,n=i):(s={},s[e]=i),n=n?r.clone(n):{},n.wait){if(!this._validate(s,n))return!1;o=r.clone(this.attributes)}var a=r.extend({},n,{silent:!0});if(s&&!this.set(s,n.wait?a:n))return!1;var l=this,h=n.success;n.success=function(t,e,i){var o=l.parse(t,i);return n.wait&&(delete n.wait,o=r.extend(s||{},o)),l.set(o,n)?(h?h(l,t):l.trigger("sync",l,t,n),void 0):!1},n.error=t.wrapError(n.error,l,n);var c=this.isNew()?"create":"update",u=(this.sync||t.sync).call(this,c,this,n);return n.wait&&this.set(o,a),u},destroy:function(e){e=e?r.clone(e):{};var i=this,n=e.success,s=function(){i.trigger("destroy",i,i.collection,e)};if(this.isNew())return s(),!1;e.success=function(t){e.wait&&s(),n?n(i,t):i.trigger("sync",i,t,e)},e.error=t.wrapError(e.error,i,e);var o=(this.sync||t.sync).call(this,"delete",this,e);return e.wait||s(),o},url:function(){var t=M(this,"urlRoot")||M(this.collection,"url")||S();return this.isNew()?t:t+("/"==t.charAt(t.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(t){return t},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},change:function(t){t||(t={});var e=this._changing;this._changing=!0;for(var i in this._silent)this._pending[i]=!0;var n=r.extend({},t.changes,this._silent);this._silent={};for(var i in n)this.trigger("change:"+i,this,this.get(i),t);if(e)return this;for(;!r.isEmpty(this._pending);){this._pending={},this.trigger("change",this,t);for(var i in this.changed)this._pending[i]||this._silent[i]||delete this.changed[i];this._previousAttributes=r.clone(this.attributes)}return this._changing=!1,this},hasChanged:function(t){return arguments.length?r.has(this.changed,t):!r.isEmpty(this.changed)},changedAttributes:function(t){if(!t)return this.hasChanged()?r.clone(this.changed):!1;var e,i=!1,n=this._previousAttributes;for(var s in t)r.isEqual(n[s],e=t[s])||((i||(i={}))[s]=e);return i},previous:function(t){return arguments.length&&this._previousAttributes?this._previousAttributes[t]:null},previousAttributes:function(){return r.clone(this._previousAttributes)},isValid:function(){return!this.validate(this.attributes)},_validate:function(t,e){if(e.silent||!this.validate)return!0;t=r.extend({},this.attributes,t);var i=this.validate(t,e);return i?(e&&e.error?e.error(this,i,e):this.trigger("error",this,i,e),!1):!0}});var c=t.Collection=function(t,e){e||(e={}),e.model&&(this.model=e.model),e.comparator&&(this.comparator=e.comparator),this._reset(),this.initialize.apply(this,arguments),t&&this.reset(t,{silent:!0,parse:e.parse})};r.extend(c.prototype,l,{model:h,initialize:function(){},toJSON:function(t){return this.map(function(e){return e.toJSON(t)})},add:function(t,e){var i,n,o,a,l,h,c={},u={},d=[];for(e||(e={}),t=r.isArray(t)?t.slice():[t],i=0,o=t.length;o>i;i++){if(!(a=t[i]=this._prepareModel(t[i],e)))throw new Error("Can't add an invalid model to a collection");l=a.cid,h=a.id,c[l]||this._byCid[l]||null!=h&&(u[h]||this._byId[h])?d.push(i):c[l]=u[h]=a}for(i=d.length;i--;)t.splice(d[i],1);for(i=0,o=t.length;o>i;i++)(a=t[i]).on("all",this._onModelEvent,this),this._byCid[a.cid]=a,null!=a.id&&(this._byId[a.id]=a);if(this.length+=o,n=null!=e.at?e.at:this.models.length,s.apply(this.models,[n,0].concat(t)),this.comparator&&this.sort({silent:!0}),e.silent)return this;for(i=0,o=this.models.length;o>i;i++)c[(a=this.models[i]).cid]&&(e.index=i,a.trigger("add",a,this,e));return this},remove:function(t,e){var i,n,s,o;for(e||(e={}),t=r.isArray(t)?t.slice():[t],i=0,n=t.length;n>i;i++)o=this.getByCid(t[i])||this.get(t[i]),o&&(delete this._byId[o.id],delete this._byCid[o.cid],s=this.indexOf(o),this.models.splice(s,1),this.length--,e.silent||(e.index=s,o.trigger("remove",o,this,e)),this._removeReference(o));return this},push:function(t,e){return t=this._prepareModel(t,e),this.add(t,e),t},pop:function(t){var e=this.at(this.length-1);return this.remove(e,t),e},unshift:function(t,e){return t=this._prepareModel(t,e),this.add(t,r.extend({at:0},e)),t},shift:function(t){var e=this.at(0);return this.remove(e,t),e},get:function(t){return null==t?void 0:this._byId[null!=t.id?t.id:t]},getByCid:function(t){return t&&this._byCid[t.cid||t]},at:function(t){return this.models[t]},where:function(t){return r.isEmpty(t)?[]:this.filter(function(e){for(var i in t)if(t[i]!==e.get(i))return!1;return!0})},sort:function(t){if(t||(t={}),!this.comparator)throw new Error("Cannot sort a set without a comparator");var e=r.bind(this.comparator,this);return 1==this.comparator.length?this.models=this.sortBy(e):this.models.sort(e),t.silent||this.trigger("reset",this,t),this},pluck:function(t){return r.map(this.models,function(e){return e.get(t)})},reset:function(t,e){t||(t=[]),e||(e={});for(var i=0,n=this.models.length;n>i;i++)this._removeReference(this.models[i]);return this._reset(),this.add(t,r.extend({silent:!0},e)),e.silent||this.trigger("reset",this,e),this},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var i=this,n=e.success;return e.success=function(t,s,r){i[e.add?"add":"reset"](i.parse(t,r),e),n&&n(i,t)},e.error=t.wrapError(e.error,i,e),(this.sync||t.sync).call(this,"read",this,e)},create:function(t,e){var i=this;if(e=e?r.clone(e):{},t=this._prepareModel(t,e),!t)return!1;e.wait||i.add(t,e);var n=e.success;return e.success=function(s,r){e.wait&&i.add(s,e),n?n(s,r):s.trigger("sync",t,r,e)},t.save(null,e),t},parse:function(t){return t},chain:function(){return r(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(t,e){if(e||(e={}),t instanceof h)t.collection||(t.collection=this);else{var i=t;e.collection=this,t=new this.model(i,e),t._validate(t.attributes,e)||(t=!1)}return t},_removeReference:function(t){this==t.collection&&delete t.collection,t.off("all",this._onModelEvent,this)},_onModelEvent:function(t,e,i,n){("add"!=t&&"remove"!=t||i==this)&&("destroy"==t&&this.remove(e,n),e&&t==="change:"+e.idAttribute&&(delete this._byId[e.previous(e.idAttribute)],this._byId[e.id]=e),this.trigger.apply(this,arguments))}});var u=["forEach","each","map","reduce","reduceRight","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortBy","sortedIndex","toArray","size","first","initial","rest","last","without","indexOf","shuffle","lastIndexOf","isEmpty","groupBy"];r.each(u,function(t){c.prototype[t]=function(){return r[t].apply(r,[this.models].concat(r.toArray(arguments)))}});var d=t.Router=function(t){t||(t={}),t.routes&&(this.routes=t.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},p=/:\w+/g,f=/\*\w+/g,m=/[-[\]{}()+?.,\\^$|#\s]/g;r.extend(d.prototype,l,{initialize:function(){},route:function(e,i,n){return t.history||(t.history=new g),r.isRegExp(e)||(e=this._routeToRegExp(e)),n||(n=this[i]),t.history.route(e,r.bind(function(s){var r=this._extractParameters(e,s);n&&n.apply(this,r),this.trigger.apply(this,["route:"+i].concat(r)),t.history.trigger("route",this,i,r)},this)),this},navigate:function(e,i){t.history.navigate(e,i)},_bindRoutes:function(){if(this.routes){var t=[];for(var e in this.routes)t.unshift([e,this.routes[e]]);for(var i=0,n=t.length;n>i;i++)this.route(t[i][0],t[i][1],this[t[i][1]])}},_routeToRegExp:function(t){return t=t.replace(m,"\\$&").replace(p,"([^/]+)").replace(f,"(.*?)"),new RegExp("^"+t+"$")},_extractParameters:function(t,e){return t.exec(e).slice(1)}});var g=t.History=function(){this.handlers=[],r.bindAll(this,"checkUrl")},v=/^[#\/]/,y=/msie [\w.]+/;g.started=!1,r.extend(g.prototype,l,{interval:50,getHash:function(t){var e=t?t.location:window.location,i=e.href.match(/#(.*)$/);return i?i[1]:""},getFragment:function(t,e){if(null==t)if(this._hasPushState||e){t=window.location.pathname;var i=window.location.search;i&&(t+=i)}else t=this.getHash();return t.indexOf(this.options.root)||(t=t.substr(this.options.root.length)),t.replace(v,"")},start:function(t){if(g.started)throw new Error("Backbone.history has already been started");g.started=!0,this.options=r.extend({},{root:"/"},this.options,t),this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&window.history&&window.history.pushState);var e=this.getFragment(),i=document.documentMode,n=y.exec(navigator.userAgent.toLowerCase())&&(!i||7>=i);n&&(this.iframe=o('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(e)),this._hasPushState?o(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!n?o(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=e;var s=window.location,a=s.pathname==this.options.root;return this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!a?(this.fragment=this.getFragment(null,!0),window.location.replace(this.options.root+"#"+this.fragment),!0):(this._wantsPushState&&this._hasPushState&&a&&s.hash&&(this.fragment=this.getHash().replace(v,""),window.history.replaceState({},document.title,s.protocol+"//"+s.host+this.options.root+this.fragment)),this.options.silent?void 0:this.loadUrl())},stop:function(){o(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),g.started=!1},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(){var t=this.getFragment();return t==this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe))),t==this.fragment?!1:(this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash()),void 0)},loadUrl:function(t){var e=this.fragment=this.getFragment(t),i=r.any(this.handlers,function(t){return t.route.test(e)?(t.callback(e),!0):void 0});return i},navigate:function(t,e){if(!g.started)return!1;e&&e!==!0||(e={trigger:e});var i=(t||"").replace(v,"");this.fragment!=i&&(this._hasPushState?(0!=i.indexOf(this.options.root)&&(i=this.options.root+i),this.fragment=i,window.history[e.replace?"replaceState":"pushState"]({},document.title,i)):this._wantsHashChange?(this.fragment=i,this._updateHash(window.location,i,e.replace),this.iframe&&i!=this.getFragment(this.getHash(this.iframe))&&(e.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,i,e.replace))):window.location.assign(this.options.root+t),e.trigger&&this.loadUrl(t))},_updateHash:function(t,e,i){i?t.replace(t.toString().replace(/(javascript:|#).*$/,"")+"#"+e):t.hash=e}});var b=t.View=function(t){this.cid=r.uniqueId("view"),this._configure(t||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},x=/^(\S+)\s*(.*)$/,w=["model","collection","el","id","attributes","className","tagName"];r.extend(b.prototype,l,{tagName:"div",$:function(t){return this.$el.find(t)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this},make:function(t,e,i){var n=document.createElement(t);return e&&o(n).attr(e),i&&o(n).html(i),n},setElement:function(t,e){return this.$el&&this.undelegateEvents(),this.$el=t instanceof o?t:o(t),this.el=this.$el[0],e!==!1&&this.delegateEvents(),this},delegateEvents:function(t){if(t||(t=M(this,"events"))){this.undelegateEvents();for(var e in t){var i=t[e];if(r.isFunction(i)||(i=this[t[e]]),!i)throw new Error('Method "'+t[e]+'" does not exist');var n=e.match(x),s=n[1],o=n[2];i=r.bind(i,this),s+=".delegateEvents"+this.cid,""===o?this.$el.bind(s,i):this.$el.delegate(o,s,i)}}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(t){this.options&&(t=r.extend({},this.options,t));for(var e=0,i=w.length;i>e;e++){var n=w[e];t[n]&&(this[n]=t[n])}this.options=t},_ensureElement:function(){if(this.el)this.setElement(this.el,!1);else{var t=M(this,"attributes")||{};this.id&&(t.id=this.id),this.className&&(t["class"]=this.className),this.setElement(this.make(this.tagName,t),!1)}}});var k=function(t,e){var i=D(this,t,e);return i.extend=this.extend,i};h.extend=c.extend=d.extend=b.extend=k;var _={create:"POST",update:"PUT","delete":"DELETE",read:"GET"};t.sync=function(e,i,n){var s=_[e];n||(n={});var a={type:s,dataType:"json"};return n.url||(a.url=M(i,"url")||S()),n.data||!i||"create"!=e&&"update"!=e||(a.contentType="application/json",a.data=JSON.stringify(i.toJSON())),t.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),t.emulateHTTP&&("PUT"===s||"DELETE"===s)&&(t.emulateJSON&&(a.data._method=s),a.type="POST",a.beforeSend=function(t){t.setRequestHeader("X-HTTP-Method-Override",s)}),"GET"===a.type||t.emulateJSON||(a.processData=!1),o.ajax(r.extend(a,n))},t.wrapError=function(t,e,i){return function(n,s){s=n===e?s:n,t?t(e,s,i):e.trigger("error",e,s,i)}};var C=function(){},D=function(t,e,i){var n;return n=e&&e.hasOwnProperty("constructor")?e.constructor:function(){t.apply(this,arguments)},r.extend(n,t),C.prototype=t.prototype,n.prototype=new C,e&&r.extend(n.prototype,e),i&&r.extend(n,i),n.prototype.constructor=n,n.__super__=t.prototype,n},M=function(t,e){return t&&t[e]?r.isFunction(t[e])?t[e]():t[e]:null},S=function(){throw new Error('A "url" property or function must be specified')}}.call(this),define("backbone",["underscore","jquery"],function(t){return function(){var e;return e||t.Backbone}}(this)),function(t,e){function i(){return(0|65536*(1+Math.random())).toString(16).substring(1)}function n(){return i()+i()+"-"+i()+"-"+i()+"-"+i()+"-"+i()+i()+i()}e.LocalStorage=window.Store=function(t){this.name=t;var e=this.localStorage().getItem(this.name);this.records=e&&e.split(",")||[]},t.extend(e.LocalStorage.prototype,{save:function(){this.localStorage().setItem(this.name,this.records.join(","))},create:function(t){return t.id||(t.id=n(),t.set(t.idAttribute,t.id)),this.localStorage().setItem(this.name+"-"+t.id,JSON.stringify(t)),this.records.push(t.id.toString()),this.save(),t.toJSON()},update:function(e){return this.localStorage().setItem(this.name+"-"+e.id,JSON.stringify(e)),t.include(this.records,e.id.toString())||this.records.push(e.id.toString()),this.save(),e.toJSON()},find:function(t){return JSON.parse(this.localStorage().getItem(this.name+"-"+t.id))},findAll:function(){return t(this.records).chain().map(function(t){return JSON.parse(this.localStorage().getItem(this.name+"-"+t))},this).compact().value()},destroy:function(e){return this.localStorage().removeItem(this.name+"-"+e.id),this.records=t.reject(this.records,function(t){return t==e.id.toString()}),this.save(),e},localStorage:function(){return localStorage}}),e.LocalStorage.sync=window.Store.sync=e.localSync=function(t,e,i){var n,s=e.localStorage||e.collection.localStorage,r=$.Deferred&&$.Deferred();switch(t){case"read":n=void 0!=e.id?s.find(e):s.findAll();break;case"create":n=s.create(e);break;case"update":n=s.update(e);break;case"delete":n=s.destroy(e)}return n?(i&&i.success&&i.success(n),r&&r.resolve()):(i&&i.error&&i.error("Record not found"),r&&r.reject()),r&&r.promise()},e.ajaxSync=e.sync,e.getSyncMethod=function(t){return t.localStorage||t.collection&&t.collection.localStorage?e.localSync:e.ajaxSync},e.sync=function(t,i,n){return e.getSyncMethod(i).apply(this,[t,i,n])}}(_,Backbone),define("backbone-localStorage",["backbone"],function(t){return function(){var e;return e||t.Backbone.LocalStorage}}(this)),function(t){"function"==typeof define&&define.amd?define("util/templar",["underscore","backbone","backbone-localStorage"],t):t(_,Backbone)}(function(t,e){var i={url:"public/templates/",ext:".hbs",version:"0.0.1",cache:!0,storage:new e.LocalStorage("Templar")};return e.Templar=function(n,s){var s="undefined"==typeof s?{}:s,r=s.ext?s.ext:i.ext,o=s.url?s.url:i.url,a=s.version?s.version:i.version,l="undefined"!=typeof s.cache?s.cache:i.cache,h=s.storage?s.storage:i.storage;this.render=function(t){if(!t.path)throw new Error("A template path is required.");t.el=t.el?t.el:document.body,c._render(t)},this.add=function(){if(!s.path)throw new Error("A template path is required.");c._add(s)};var c=new(e.Collection.extend({initialize:function(){this._loadTemplates()},templates:n,model:e.Model.extend({defaults:function(){return{path:null,content:null,version:a}},url:function(){var t=this.get("path")&&"undefined"!==this.get("path")?this.get("path"):"";return o+t+r},parse:function(t){return{content:t}}}),localStorage:h,_loadTemplates:function(){var e=this,i=this.localStorage.findAll();if(i.length>0&&i[0].version!==a&&(l=!1),l)for(var n=0;n<i.length;n++)this.add(i[n]);else t.each(i,function(t){e.localStorage.destroy(t)});if(this.templates)for(var n=0;n<this.templates.length;n++)this._add({path:this.templates[n]})},_createModel:function(t){var e=new this.model({path:t});return e},_add:function(t,e){var i=this.where({path:t.path});0==i.length&&(templateModel=this._createModel(t.path),$.ajax({url:o+t.path+r,async:!1,success:function(e){templateModel.set({content:e,path:t.path})}}),this.add(templateModel),this.create(templateModel.toJSON()),"function"==typeof e&&e())},_compile:function(t,e,i,n,s){var i=i?i:!1,r=Handlebars.compile(t);i?e.append(r(n)):e.html(r(n)),"function"==typeof s&&s()},_render:function(e){var i=this,n=this.where({path:e.path,version:a});n.length>0?this._compile(n[0].get("content"),e.el,e.append,e.data,e.cb):this._add(e,t.bind(function(){i._compile(templateModel.get("content"),e.el,e.append,e.data,e.cb)},this))}}))},e.Templar}),define("util/cron",["underscore"],function(t){var e=function(){};return t.extend(e,{minuteRegex:RegExp(/^[0-9\*\-,\/]+$/),hourRegex:RegExp(/^[0-9\*\-,\/]+$/),dayRegex:RegExp(/^[\?0-9\*\-,\/,LW]+$/i),parsleyValidator:function(e){var i=function(){};return t.extend(i,{validationMinlength:1,validators:{cronfield:function(i,n){var s=null;switch(n){case"day":s=i.match(this.dayRegex);break;case"hour":s=i.match(this.hourRegex);break;case"minute":s=i.match(this.minuteRegex)}return t.isFunction(e)&&(s=e(i,n,s)),null!=s}.bind(this)},messages:{cronfield:"Not a valid value for cron field '%s'"}}),i}}),e}),function(t){"function"==typeof define&&define.amd?define("backbone-mediator",["underscore","backbone"],t):t(_,Backbone)}(function(t,e){var i,n={},s=e.View.prototype.delegateEvents,r=e.View.prototype.undelegateEvents;return e.Mediator={subscribe:function(t,e,i,s){n[t]||(n[t]=[]),n[t].push({fn:e,context:i||this,once:s})},publish:function(t){if(n[t])for(var i,s=[].slice.call(arguments,1),r=0,o=n[t].length;o>r;r++)i=n[t][r],i.fn.apply(i.context,s),i.once&&(e.Mediator.unsubscribe(t,i.fn,i.context),r--)},unsubscribe:function(t,e,i){if(n[t])for(var s,r=0;r<n[t].length;r++)s=n[t][r],s.fn===e&&s.context===i&&(n[t].splice(r,1),r--)},unsubscribeChannel:function(t){if(n[t])for(var e,i=0;i<n[t].length;i++)e=n[t][i],n[t].splice(i,1),i--},subscribeOnce:function(t,i,n){e.Mediator.subscribe(t,i,n,!0)}},i={delegateEvents:function(){s.apply(this,arguments),this.setSubscriptions()},undelegateEvents:function(){r.apply(this,arguments),this.unsetSubscriptions()},subscriptions:{},setSubscriptions:function(i){i&&t.extend(this.subscriptions||{},i),i=i||this.subscriptions,i&&!t.isEmpty(i)&&(this.unsetSubscriptions(i),t.each(i,function(i,n){var s;i.$once&&(i=i.$once,s=!0),t.isString(i)&&(i=this[i]),e.Mediator.subscribe(n,i,this,s)},this))},unsetSubscriptions:function(i){i=i||this.subscriptions,i&&!t.isEmpty(i)&&t.each(i,function(i,n){t.isString(i)&&(i=this[i]),e.Mediator.unsubscribe(n,i.$once||i,this)
384
+ },this)}},t.extend(e.View.prototype,i),t.extend(e.Mediator,{pub:e.Mediator.publish,sub:e.Mediator.subscribe}),e}),define("route/index",["backbone","backbone-mediator"],function(t){var e=t.Router.extend({initialize:function(t){this.app=t.app},routes:{"":"ecosystem",ecosystem:"ecosystem","dash/:id":"dashboard","dash/:id/expand/:mid":"dashboard","dash/:id/category/:cid":"category"},category:function(t,e){t=t?parseInt(t):t,e=e?parseInt(e):e,t&&this.app.category(t,e)},dashboard:function(t,e){t=t?parseInt(t):t,e=e?parseInt(e):e,t&&this.app.dashboard(t,e)},ecosystem:function(){this.navigate("ecosystem",{replace:!0}),this.app.ecosystem()}});return e}),this.Handlebars={},function(t){t.VERSION="1.0.rc.1",t.helpers={},t.partials={},t.registerHelper=function(t,e,i){i&&(e.not=i),this.helpers[t]=e},t.registerPartial=function(t,e){this.partials[t]=e},t.registerHelper("helperMissing",function(t){if(2===arguments.length)return void 0;throw new Error("Could not find property '"+t+"'")});var e=Object.prototype.toString,i="[object Function]";t.registerHelper("blockHelperMissing",function(n,s){var r=s.inverse||function(){},o=s.fn,a=e.call(n);return a===i&&(n=n.call(this)),n===!0?o(this):n===!1||null==n?r(this):"[object Array]"===a?n.length>0?t.helpers.each(n,s):r(this):o(n)}),t.K=function(){},t.createFrame=Object.create||function(e){t.K.prototype=e;var i=new t.K;return t.K.prototype=null,i},t.registerHelper("each",function(e,i){var n,s=i.fn,r=i.inverse,o="";if(i.data&&(n=t.createFrame(i.data)),e&&e.length>0)for(var a=0,l=e.length;l>a;a++)n&&(n.index=a),o+=s(e[a],{data:n});else o=r(this);return o}),t.registerHelper("if",function(n,s){var r=e.call(n);return r===i&&(n=n.call(this)),!n||t.Utils.isEmpty(n)?s.inverse(this):s.fn(this)}),t.registerHelper("unless",function(e,i){var n=i.fn,s=i.inverse;return i.fn=s,i.inverse=n,t.helpers["if"].call(this,e,i)}),t.registerHelper("with",function(t,e){return e.fn(t)}),t.registerHelper("log",function(e){t.log(e)})}(this.Handlebars);var handlebars=function(){function t(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,DATA:27,param:28,STRING:29,INTEGER:30,BOOLEAN:31,hashSegments:32,hashSegment:33,ID:34,EQUALS:35,pathSegments:36,SEP:37,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",27:"DATA",29:"STRING",30:"INTEGER",31:"BOOLEAN",34:"ID",35:"EQUALS",37:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[17,1],[25,2],[25,1],[28,1],[28,1],[28,1],[28,1],[28,1],[26,1],[32,2],[32,1],[33,3],[33,3],[33,3],[33,3],[33,3],[21,1],[36,3],[36,1]],performAction:function(t,e,i,n,s,r){var o=r.length-1;switch(s){case 1:return r[o-1];case 2:this.$=new n.ProgramNode(r[o-2],r[o]);break;case 3:this.$=new n.ProgramNode(r[o]);break;case 4:this.$=new n.ProgramNode([]);break;case 5:this.$=[r[o]];break;case 6:r[o-1].push(r[o]),this.$=r[o-1];break;case 7:this.$=new n.BlockNode(r[o-2],r[o-1].inverse,r[o-1],r[o]);break;case 8:this.$=new n.BlockNode(r[o-2],r[o-1],r[o-1].inverse,r[o]);break;case 9:this.$=r[o];break;case 10:this.$=r[o];break;case 11:this.$=new n.ContentNode(r[o]);break;case 12:this.$=new n.CommentNode(r[o]);break;case 13:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1]);break;case 14:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1]);break;case 15:this.$=r[o-1];break;case 16:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1]);break;case 17:this.$=new n.MustacheNode(r[o-1][0],r[o-1][1],!0);break;case 18:this.$=new n.PartialNode(r[o-1]);break;case 19:this.$=new n.PartialNode(r[o-2],r[o-1]);break;case 20:break;case 21:this.$=[[r[o-2]].concat(r[o-1]),r[o]];break;case 22:this.$=[[r[o-1]].concat(r[o]),null];break;case 23:this.$=[[r[o-1]],r[o]];break;case 24:this.$=[[r[o]],null];break;case 25:this.$=[[new n.DataNode(r[o])],null];break;case 26:r[o-1].push(r[o]),this.$=r[o-1];break;case 27:this.$=[r[o]];break;case 28:this.$=r[o];break;case 29:this.$=new n.StringNode(r[o]);break;case 30:this.$=new n.IntegerNode(r[o]);break;case 31:this.$=new n.BooleanNode(r[o]);break;case 32:this.$=new n.DataNode(r[o]);break;case 33:this.$=new n.HashNode(r[o]);break;case 34:r[o-1].push(r[o]),this.$=r[o-1];break;case 35:this.$=[r[o]];break;case 36:this.$=[r[o-2],r[o]];break;case 37:this.$=[r[o-2],new n.StringNode(r[o])];break;case 38:this.$=[r[o-2],new n.IntegerNode(r[o])];break;case 39:this.$=[r[o-2],new n.BooleanNode(r[o])];break;case 40:this.$=[r[o-2],new n.DataNode(r[o])];break;case 41:this.$=new n.IdNode(r[o]);break;case 42:r[o-2].push(r[o]),this.$=r[o-2];break;case 43:this.$=[r[o]]}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,27:[1,24],34:[1,26],36:25},{17:27,21:23,27:[1,24],34:[1,26],36:25},{17:28,21:23,27:[1,24],34:[1,26],36:25},{17:29,21:23,27:[1,24],34:[1,26],36:25},{21:30,34:[1,26],36:25},{1:[2,1]},{6:31,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,32],21:23,27:[1,24],34:[1,26],36:25},{10:33,20:[1,34]},{10:35,20:[1,34]},{18:[1,36]},{18:[2,24],21:41,25:37,26:38,27:[1,45],28:39,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,25]},{18:[2,41],27:[2,41],29:[2,41],30:[2,41],31:[2,41],34:[2,41],37:[1,48]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],37:[2,43]},{18:[1,49]},{18:[1,50]},{18:[1,51]},{18:[1,52],21:53,34:[1,26],36:25},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:54,34:[1,26],36:25},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:41,26:55,27:[1,45],28:56,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,23]},{18:[2,27],27:[2,27],29:[2,27],30:[2,27],31:[2,27],34:[2,27]},{18:[2,33],33:57,34:[1,58]},{18:[2,28],27:[2,28],29:[2,28],30:[2,28],31:[2,28],34:[2,28]},{18:[2,29],27:[2,29],29:[2,29],30:[2,29],31:[2,29],34:[2,29]},{18:[2,30],27:[2,30],29:[2,30],30:[2,30],31:[2,30],34:[2,30]},{18:[2,31],27:[2,31],29:[2,31],30:[2,31],31:[2,31],34:[2,31]},{18:[2,32],27:[2,32],29:[2,32],30:[2,32],31:[2,32],34:[2,32]},{18:[2,35],34:[2,35]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],35:[1,59],37:[2,43]},{34:[1,60]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,61]},{18:[1,62]},{18:[2,21]},{18:[2,26],27:[2,26],29:[2,26],30:[2,26],31:[2,26],34:[2,26]},{18:[2,34],34:[2,34]},{35:[1,59]},{21:63,27:[1,67],29:[1,64],30:[1,65],31:[1,66],34:[1,26],36:25},{18:[2,42],27:[2,42],29:[2,42],30:[2,42],31:[2,42],34:[2,42],37:[2,42]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,36],34:[2,36]},{18:[2,37],34:[2,37]},{18:[2,38],34:[2,38]},{18:[2,39],34:[2,39]},{18:[2,40],34:[2,40]}],defaultActions:{16:[2,1],24:[2,25],38:[2,23],55:[2,21]},parseError:function(t){throw new Error(t)},parse:function(t){function e(){var t;return t=i.lexer.lex()||1,"number"!=typeof t&&(t=i.symbols_[t]||t),t}var i=this,n=[0],s=[null],r=[],o=this.table,a="",l=0,h=0,c=0;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var u=this.lexer.yylloc;r.push(u);var d=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var p,f,m,g,v,y,b,x,w,k={};;){if(m=n[n.length-1],this.defaultActions[m]?g=this.defaultActions[m]:((null===p||"undefined"==typeof p)&&(p=e()),g=o[m]&&o[m][p]),"undefined"==typeof g||!g.length||!g[0]){var _="";if(!c){w=[];for(y in o[m])this.terminals_[y]&&y>2&&w.push("'"+this.terminals_[y]+"'");_=this.lexer.showPosition?"Parse error on line "+(l+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+w.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(_,{text:this.lexer.match,token:this.terminals_[p]||p,line:this.lexer.yylineno,loc:u,expected:w})}}if(g[0]instanceof Array&&g.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(g[0]){case 1:n.push(p),s.push(this.lexer.yytext),r.push(this.lexer.yylloc),n.push(g[1]),p=null,f?(p=f,f=null):(h=this.lexer.yyleng,a=this.lexer.yytext,l=this.lexer.yylineno,u=this.lexer.yylloc,c>0&&c--);break;case 2:if(b=this.productions_[g[1]][1],k.$=s[s.length-b],k._$={first_line:r[r.length-(b||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(b||1)].first_column,last_column:r[r.length-1].last_column},d&&(k._$.range=[r[r.length-(b||1)].range[0],r[r.length-1].range[1]]),v=this.performAction.call(k,a,h,l,this.yy,g[1],s,r),"undefined"!=typeof v)return v;b&&(n=n.slice(0,2*-1*b),s=s.slice(0,-1*b),r=r.slice(0,-1*b)),n.push(this.productions_[g[1]][0]),s.push(k.$),r.push(k._$),x=o[n[n.length-2]][n[n.length-1]],n.push(x);break;case 3:return!0}}return!0}},i=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t){return this._input=t,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e-1),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var s=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===n.length?this.yylloc.first_column:0)+n[n.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this},more:function(){return this._more=!0,this},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,i,n,s;this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),o=0;o<r.length&&(i=this._input.match(this.rules[r[o]]),!i||e&&!(i[0].length>e[0].length)||(e=i,n=o,this.options.flex));o++);return e?(s=e[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],t=this.performAction.call(this,this.yy,this,r[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),t?t:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return"undefined"!=typeof t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return t.options={},t.performAction=function(t,e,i,n){switch(i){case 0:if("\\"!==e.yytext.slice(-1)&&this.begin("mu"),"\\"===e.yytext.slice(-1)&&(e.yytext=e.yytext.substr(0,e.yyleng-1),this.begin("emu")),e.yytext)return 14;break;case 1:return 14;case 2:return"\\"!==e.yytext.slice(-1)&&this.popState(),"\\"===e.yytext.slice(-1)&&(e.yytext=e.yytext.substr(0,e.yyleng-1)),14;case 3:return 24;case 4:return 16;case 5:return 20;case 6:return 19;case 7:return 19;case 8:return 23;case 9:return 23;case 10:return e.yytext=e.yytext.substr(3,e.yyleng-5),this.popState(),15;case 11:return 22;case 12:return 35;case 13:return 34;case 14:return 34;case 15:return 37;case 16:break;case 17:return this.popState(),18;case 18:return this.popState(),18;case 19:return e.yytext=e.yytext.substr(1,e.yyleng-2).replace(/\\"/g,'"'),29;case 20:return e.yytext=e.yytext.substr(1,e.yyleng-2).replace(/\\"/g,'"'),29;case 21:return e.yytext=e.yytext.substr(1),27;case 22:return 31;case 23:return 31;case 24:return 30;case 25:return 34;case 26:return e.yytext=e.yytext.substr(1,e.yyleng-2),34;case 27:return"INVALID";case 28:return 5}},t.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],t.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],inclusive:!1},emu:{rules:[2],inclusive:!1},INITIAL:{rules:[0,1,28],inclusive:!0}},t}();return e.lexer=i,t.prototype=e,e.Parser=t,new t}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=handlebars,exports.Parser=handlebars.Parser,exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");var e;return e="undefined"!=typeof process?require("fs").readFileSync(require("path").resolve(t[1]),"utf8"):require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"}),exports.parser.parse(e)},"undefined"!=typeof module&&require.main===module&&exports.main("undefined"!=typeof process?process.argv.slice(1):require("system").args)),Handlebars.Parser=handlebars,Handlebars.parse=function(t){return Handlebars.Parser.yy=Handlebars.AST,Handlebars.Parser.parse(t)},Handlebars.print=function(t){return(new Handlebars.PrintVisitor).accept(t)},Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(){}},Handlebars.log=function(t,e){Handlebars.logger.log(t,e)},function(){Handlebars.AST={},Handlebars.AST.ProgramNode=function(t,e){this.type="program",this.statements=t,e&&(this.inverse=new Handlebars.AST.ProgramNode(e))},Handlebars.AST.MustacheNode=function(t,e,i){this.type="mustache",this.escaped=!i,this.hash=e;var n=this.id=t[0],s=this.params=t.slice(1),r=this.eligibleHelper=n.isSimple;this.isHelper=r&&(s.length||e)},Handlebars.AST.PartialNode=function(t,e){this.type="partial",this.id=t,this.context=e};var t=function(t,e){if(t.original!==e.original)throw new Handlebars.Exception(t.original+" doesn't match "+e.original)};Handlebars.AST.BlockNode=function(e,i,n,s){t(e.id,s),this.type="block",this.mustache=e,this.program=i,this.inverse=n,this.inverse&&!this.program&&(this.isInverse=!0)},Handlebars.AST.ContentNode=function(t){this.type="content",this.string=t},Handlebars.AST.HashNode=function(t){this.type="hash",this.pairs=t},Handlebars.AST.IdNode=function(t){this.type="ID",this.original=t.join(".");for(var e=[],i=0,n=0,s=t.length;s>n;n++){var r=t[n];".."===r?i++:"."===r||"this"===r?this.isScoped=!0:e.push(r)}this.parts=e,this.string=e.join("."),this.depth=i,this.isSimple=1===t.length&&!this.isScoped&&0===i},Handlebars.AST.DataNode=function(t){this.type="DATA",this.id=t},Handlebars.AST.StringNode=function(t){this.type="STRING",this.string=t},Handlebars.AST.IntegerNode=function(t){this.type="INTEGER",this.integer=t},Handlebars.AST.BooleanNode=function(t){this.type="BOOLEAN",this.bool=t},Handlebars.AST.CommentNode=function(t){this.type="comment",this.comment=t}}(),Handlebars.Exception=function(){var t=Error.prototype.constructor.apply(this,arguments);for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);this.message=t.message},Handlebars.Exception.prototype=new Error,Handlebars.SafeString=function(t){this.string=t},Handlebars.SafeString.prototype.toString=function(){return this.string.toString()},function(){var t={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},e=/[&<>"'`]/g,i=/[&<>"'`]/,n=function(e){return t[e]||"&amp;"};Handlebars.Utils={escapeExpression:function(t){return t instanceof Handlebars.SafeString?t.toString():null==t||t===!1?"":i.test(t)?t.replace(e,n):t},isEmpty:function(t){return"undefined"==typeof t?!0:null===t?!0:t===!1?!0:"[object Array]"===Object.prototype.toString.call(t)&&0===t.length?!0:!1}}}(),Handlebars.Compiler=function(){},Handlebars.JavaScriptCompiler=function(){},function(t,e){t.prototype={compiler:t,disassemble:function(){for(var t,e,i,n=this.opcodes,s=[],r=0,o=n.length;o>r;r++)if(t=n[r],"DECLARE"===t.opcode)s.push("DECLARE "+t.name+"="+t.value);else{e=[];for(var a=0;a<t.args.length;a++)i=t.args[a],"string"==typeof i&&(i='"'+i.replace("\n","\\n")+'"'),e.push(i);s.push(t.opcode+" "+e.join(" "))}return s.join("\n")},guid:0,compile:function(t,e){this.children=[],this.depths={list:[]},this.options=e;var i=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},i)for(var n in i)this.options.knownHelpers[n]=i[n];return this.program(t)},accept:function(t){return this[t.type](t)},program:function(t){var e,i=t.statements;this.opcodes=[];for(var n=0,s=i.length;s>n;n++)e=i[n],this[e.type](e);return this.isSimple=1===s,this.depths.list=this.depths.list.sort(function(t,e){return t-e}),this},compileProgram:function(t){var e,i=(new this.compiler).compile(t,this.options),n=this.guid++;this.usePartial=this.usePartial||i.usePartial,this.children[n]=i;for(var s=0,r=i.depths.list.length;r>s;s++)e=i.depths.list[s],2>e||this.addDepth(e-1);return n},block:function(t){var e=t.mustache,i=t.program,n=t.inverse;i&&(i=this.compileProgram(i)),n&&(n=this.compileProgram(n));var s=this.classifyMustache(e);"helper"===s?this.helperMustache(e,i,n):"simple"===s?(this.simpleMustache(e),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("pushLiteral","{}"),this.opcode("blockValue")):(this.ambiguousMustache(e,i,n),this.opcode("pushProgram",i),this.opcode("pushProgram",n),this.opcode("pushLiteral","{}"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(t){var e,i,n=t.pairs;this.opcode("push","{}");for(var s=0,r=n.length;r>s;s++)e=n[s],i=e[1],this.accept(i),this.opcode("assignToHash",e[0])},partial:function(t){var e=t.id;this.usePartial=!0,t.context?this.ID(t.context):this.opcode("push","depth0"),this.opcode("invokePartial",e.original),this.opcode("append")},content:function(t){this.opcode("appendContent",t.string)},mustache:function(t){var e=this.options,i=this.classifyMustache(t);"simple"===i?this.simpleMustache(t):"helper"===i?this.helperMustache(t):this.ambiguousMustache(t),t.escaped&&!e.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(t,e,i){var n=t.id,s=n.parts[0];this.opcode("getContext",n.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),this.opcode("invokeAmbiguous",s)},simpleMustache:function(t){var e=t.id;"DATA"===e.type?this.DATA(e):e.parts.length?this.ID(e):(this.addDepth(e.depth),this.opcode("getContext",e.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperMustache:function(t,e,i){var n=this.setupFullMustacheParams(t,e,i),s=t.id.parts[0];if(this.options.knownHelpers[s])this.opcode("invokeKnownHelper",n.length,s);else{if(this.knownHelpersOnly)throw new Error("You specified knownHelpersOnly, but used the unknown helper "+s);this.opcode("invokeHelper",n.length,s)}},ID:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0];e?this.opcode("lookupOnContext",t.parts[0]):this.opcode("pushContext");for(var i=1,n=t.parts.length;n>i;i++)this.opcode("lookup",t.parts[i])},DATA:function(t){this.options.data=!0,this.opcode("lookupData",t.id)},STRING:function(t){this.opcode("pushString",t.string)},INTEGER:function(t){this.opcode("pushLiteral",t.integer)},BOOLEAN:function(t){this.opcode("pushLiteral",t.bool)},comment:function(){},opcode:function(t){this.opcodes.push({opcode:t,args:[].slice.call(arguments,1)})},declare:function(t,e){this.opcodes.push({opcode:"DECLARE",name:t,value:e})},addDepth:function(t){if(isNaN(t))throw new Error("EWOT");0!==t&&(this.depths[t]||(this.depths[t]=!0,this.depths.list.push(t)))},classifyMustache:function(t){var e=t.isHelper,i=t.eligibleHelper,n=this.options;if(i&&!e){var s=t.id.parts[0];n.knownHelpers[s]?e=!0:n.knownHelpersOnly&&(i=!1)}return e?"helper":i?"ambiguous":"simple"},pushParams:function(t){for(var e,i=t.length;i--;)e=t[i],this.options.stringParams?(e.depth&&this.addDepth(e.depth),this.opcode("getContext",e.depth||0),this.opcode("pushStringParam",e.string)):this[e.type](e)},setupMustacheParams:function(t){var e=t.params;return this.pushParams(e),t.hash?this.hash(t.hash):this.opcode("pushLiteral","{}"),e},setupFullMustacheParams:function(t,e,i){var n=t.params;return this.pushParams(n),this.opcode("pushProgram",e),this.opcode("pushProgram",i),t.hash?this.hash(t.hash):this.opcode("pushLiteral","{}"),n}};var i=function(t){this.value=t};e.prototype={nameLookup:function(t,i){return/^[0-9]+$/.test(i)?t+"["+i+"]":e.isValidJavaScriptVariableName(i)?t+"."+i:t+"['"+i+"']"},appendToBuffer:function(t){return this.environment.isSimple?"return "+t+";":"buffer += "+t+";"},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(t,e,i,n){this.environment=t,this.options=e||{},Handlebars.log(Handlebars.logger.DEBUG,this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!i,this.context=i||{programs:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.compileStack=[],this.compileChildren(t,e);var s,r=t.opcodes;for(this.i=0,o=r.length;this.i<o;this.i++)s=r[this.i],"DECLARE"===s.opcode?this[s.name]=s.value:this[s.opcode].apply(this,s.args);return this.createFunctionContext(n)},nextOpcode:function(){var t=this.environment.opcodes;return t[this.i+1],t[this.i+1]},eat:function(){this.i=this.i+1},preamble:function(){var t=[];if(this.isChild)t.push("");else{var e=this.namespace,i="helpers = helpers || "+e+".helpers;";this.environment.usePartial&&(i=i+" partials = partials || "+e+".partials;"),this.options.data&&(i+=" data = data || {};"),t.push(i)}this.environment.isSimple?t.push(""):t.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=t},createFunctionContext:function(t){var e=this.stackVars.concat(this.registers.list);if(e.length>0&&(this.source[1]=this.source[1]+", "+e.join(", ")),!this.isChild)for(var i in this.context.aliases)this.source[1]=this.source[1]+", "+i+"="+this.context.aliases[i];this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");for(var n=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"],s=0,r=this.environment.depths.list.length;r>s;s++)n.push("depth"+this.environment.depths.list[s]);if(t)return n.push(this.source.join("\n ")),Function.apply(this,n);var o="function "+(this.name||"")+"("+n.join(",")+") {\n "+this.source.join("\n ")+"}";return Handlebars.log(Handlebars.logger.DEBUG,o+"\n\n"),o},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var t=["depth0"];this.setupParams(0,t),this.replaceStack(function(e){return t.splice(1,0,e),e+" = blockHelperMissing.call("+t.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var t=["depth0"];this.setupParams(0,t);var e=this.topStack();t.splice(1,0,e),this.source.push("if (!"+this.lastHelper+") { "+e+" = blockHelperMissing.call("+t.join(", ")+"); }")},appendContent:function(t){this.source.push(this.appendToBuffer(this.quotedString(t)))},append:function(){var t=this.popStack();this.source.push("if("+t+" || "+t+" === 0) { "+this.appendToBuffer(t)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){var t=this.nextOpcode(),e="";this.context.aliases.escapeExpression="this.escapeExpression",t&&"appendContent"===t.opcode&&(e=" + "+this.quotedString(t.args[0]),this.eat(t)),this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+e))},getContext:function(t){this.lastContext!==t&&(this.lastContext=t)},lookupOnContext:function(t){this.pushStack(this.nameLookup("depth"+this.lastContext,t,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(t){return"typeof "+t+" === functionType ? "+t+"() : "+t})},lookup:function(t){this.replaceStack(function(e){return e+" == null || "+e+" === false ? "+e+" : "+this.nameLookup(e,t,"context")})},lookupData:function(t){this.pushStack(this.nameLookup("data",t,"data"))},pushStringParam:function(t){this.pushStackLiteral("depth"+this.lastContext),this.pushString(t)},pushString:function(t){this.pushStackLiteral(this.quotedString(t))},push:function(t){this.pushStack(t)},pushLiteral:function(t){this.pushStackLiteral(t)},pushProgram:function(t){null!=t?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},invokeHelper:function(t,e){this.context.aliases.helperMissing="helpers.helperMissing";var i=this.lastHelper=this.setupHelper(t,e);this.register("foundHelper",i.name),this.pushStack("foundHelper ? foundHelper.call("+i.callParams+") "+": helperMissing.call("+i.helperMissingParams+")")},invokeKnownHelper:function(t,e){var i=this.setupHelper(t,e);this.pushStack(i.name+".call("+i.callParams+")")},invokeAmbiguous:function(t){this.context.aliases.functionType='"function"',this.pushStackLiteral("{}");var e=this.setupHelper(0,t),i=this.lastHelper=this.nameLookup("helpers",t,"helper");this.register("foundHelper",i);var n=this.nameLookup("depth"+this.lastContext,t,"context"),s=this.nextStack();this.source.push("if (foundHelper) { "+s+" = foundHelper.call("+e.callParams+"); }"),this.source.push("else { "+s+" = "+n+"; "+s+" = typeof "+s+" === functionType ? "+s+"() : "+s+"; }")},invokePartial:function(t){var e=[this.nameLookup("partials",t,"partial"),"'"+t+"'",this.popStack(),"helpers","partials"];this.options.data&&e.push("data"),this.context.aliases.self="this",this.pushStack("self.invokePartial("+e.join(", ")+");")},assignToHash:function(t){var e=this.popStack(),i=this.topStack();this.source.push(i+"['"+t+"'] = "+e+";")},compiler:e,compileChildren:function(t,e){for(var i,n,s=t.children,r=0,o=s.length;o>r;r++){i=s[r],n=new this.compiler,this.context.programs.push("");var a=this.context.programs.length;i.index=a,i.name="program"+a,this.context.programs[a]=n.compile(i,e,this.context)}},programExpression:function(t){if(this.context.aliases.self="this",null==t)return"self.noop";for(var e,i=this.environment.children[t],n=i.depths.list,s=[i.index,i.name,"data"],r=0,o=n.length;o>r;r++)e=n[r],1===e?s.push("depth0"):s.push("depth"+(e-1));return 0===n.length?"self.program("+s.join(", ")+")":(s.shift(),"self.programWithDepth("+s.join(", ")+")")},register:function(t,e){this.useRegister(t),this.source.push(t+" = "+e+";")},useRegister:function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},pushStackLiteral:function(t){return this.compileStack.push(new i(t)),t},pushStack:function(t){return this.source.push(this.incrStack()+" = "+t+";"),this.compileStack.push("stack"+this.stackSlot),"stack"+this.stackSlot},replaceStack:function(t){var e=t.call(this,this.topStack());return this.source.push(this.topStack()+" = "+e+";"),"stack"+this.stackSlot},nextStack:function(){var t=this.incrStack();return this.compileStack.push("stack"+this.stackSlot),t},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),"stack"+this.stackSlot},popStack:function(){var t=this.compileStack.pop();return t instanceof i?t.value:(this.stackSlot--,t)},topStack:function(){var t=this.compileStack[this.compileStack.length-1];return t instanceof i?t.value:t},quotedString:function(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'},setupHelper:function(t,e){var i=[];this.setupParams(t,i);var n=this.nameLookup("helpers",e,"helper");return{params:i,name:n,callParams:["depth0"].concat(i).join(", "),helperMissingParams:["depth0",this.quotedString(e)].concat(i).join(", ")}},setupParams:function(t,e){var i,n,s,r=[],o=[];r.push("hash:"+this.popStack()),n=this.popStack(),s=this.popStack(),(s||n)&&(s||(this.context.aliases.self="this",s="self.noop"),n||(this.context.aliases.self="this",n="self.noop"),r.push("inverse:"+n),r.push("fn:"+s));for(var a=0;t>a;a++)i=this.popStack(),e.push(i),this.options.stringParams&&o.push(this.popStack());return this.options.stringParams&&r.push("contexts:["+o.join(",")+"]"),this.options.data&&r.push("data:data"),e.push("{"+r.join(",")+"}"),e.join(", ")
385
+ }};for(var n="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),s=e.RESERVED_WORDS={},r=0,o=n.length;o>r;r++)s[n[r]]=!0;e.isValidJavaScriptVariableName=function(t){return!e.RESERVED_WORDS[t]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(t)?!0:!1}}(Handlebars.Compiler,Handlebars.JavaScriptCompiler),Handlebars.precompile=function(t,e){e=e||{};var i=Handlebars.parse(t),n=(new Handlebars.Compiler).compile(i,e);return(new Handlebars.JavaScriptCompiler).compile(n,e)},Handlebars.compile=function(t,e){function i(){var i=Handlebars.parse(t),n=(new Handlebars.Compiler).compile(i,e),s=(new Handlebars.JavaScriptCompiler).compile(n,e,void 0,!0);return Handlebars.template(s)}e=e||{};var n;return function(t,e){return n||(n=i()),n.call(this,t,e)}},Handlebars.VM={template:function(t){var e={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(t,e,i){var n=this.programs[t];return i?Handlebars.VM.program(e,i):n?n:n=this.programs[t]=Handlebars.VM.program(e)},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(i,n){return n=n||{},t.call(e,Handlebars,i,n.helpers,n.partials,n.data)}},programWithDepth:function(t,e){var i=Array.prototype.slice.call(arguments,2);return function(n,s){return s=s||{},t.apply(this,[n,s.data||e].concat(i))}},program:function(t,e){return function(i,n){return n=n||{},t(i,n.data||e)}},noop:function(){return""},invokePartial:function(t,e,i,n,s,r){var o={helpers:n,partials:s,data:r};if(void 0===t)throw new Handlebars.Exception("The partial "+e+" could not be found");if(t instanceof Function)return t(i,o);if(Handlebars.compile)return s[e]=Handlebars.compile(t,{data:void 0!==r}),s[e](i,o);throw new Handlebars.Exception("The partial "+e+" could not be compiled when running in runtime-only mode")}},Handlebars.template=Handlebars.VM.template,define("handlebars",function(t){return function(){var e;return e||t.Handlebars}}(this)),define("highcharts",["jquery"],function(){return function(){function t(t,e){var i;t||(t={});for(i in e)t[i]=e[i];return t}function e(){for(var t=0,e=arguments,i=e.length,n={};i>t;t++)n[e[t++]]=e[t];return n}function i(t,e){return parseInt(t,e||10)}function n(t){return"string"==typeof t}function s(t){return"object"==typeof t}function r(t){return"[object Array]"===Object.prototype.toString.call(t)}function o(t){return"number"==typeof t}function a(t){return he.log(t)/he.LN10}function l(t){return he.pow(10,t)}function h(t,e){for(var i=t.length;i--;)if(t[i]===e){t.splice(i,1);break}}function c(t){return t!==R&&null!==t}function u(t,e,i){var r,o;if(n(e))c(i)?t.setAttribute(e,i):t&&t.getAttribute&&(o=t.getAttribute(e));else if(c(e)&&s(e))for(r in e)t.setAttribute(r,e[r]);return o}function d(t){return r(t)?t:[t]}function p(){var t,e,i=arguments,n=i.length;for(t=0;n>t;t++)if(e=i[t],"undefined"!=typeof e&&null!==e)return e}function f(e,i){ke&&i&&i.opacity!==R&&(i.filter="alpha(opacity="+100*i.opacity+")"),t(e.style,i)}function m(e,i,n,s,r){return e=ae.createElement(e),i&&t(e,i),r&&f(e,{padding:0,border:$e,margin:0}),n&&f(e,n),s&&s.appendChild(e),e}function g(e,i){var n=function(){};return n.prototype=new e,t(n.prototype,i),n}function v(t,e,n,s){var r=Y.lang,o=t;-1===e?(e=(t||0).toString(),t=e.indexOf(".")>-1?e.split(".")[1].length:0):t=isNaN(e=me(e))?2:e;var e=t,n=void 0===n?r.decimalPoint:n,s=void 0===s?r.thousandsSep:s,r=0>o?"-":"",t=String(i(o=me(+o||0).toFixed(e))),a=t.length>3?t.length%3:0;return r+(a?t.substr(0,a)+s:"")+t.substr(a).replace(/(\d{3})(?=\d)/g,"$1"+s)+(e?n+me(o-t).toFixed(e).slice(2):"")}function y(t,e){return Array((e||2)+1-String(t).length).join(0)+t}function b(t,e,i,n){var s,i=p(i,1);for(s=t/i,e||(e=[1,2,2.5,5,10],n&&n.allowDecimals===!1&&(1===i?e=[1,2,5,10]:.1>=i&&(e=[1/i]))),n=0;n<e.length&&(t=e[n],!(s<=(e[n]+(e[n+1]||e[n]))/2));n++);return t*=i}function x(t,e){var i,n=e||[[Pe,[1,2,5,10,20,25,50,100,200,500]],[Oe,[1,2,5,10,15,30]],[He,[1,2,5,10,15,30]],[We,[1,2,3,4,6,8,12]],[Re,[1,2]],[je,[1,2]],[Be,[1,2,3,4,6]],[Ye,null]],s=n[n.length-1],r=q[s[0]],o=s[1];for(i=0;i<n.length&&(s=n[i],r=q[s[0]],o=s[1],!(n[i+1]&&t<=(r*o[o.length-1]+q[n[i+1][0]])/2));i++);return r===q[Ye]&&5*r>t&&(o=[1,2,5]),r===q[Ye]&&5*r>t&&(o=[1,2,5]),n=b(t/r,o),{unitRange:r,count:n,unitName:s[0]}}function w(e,i,n,s){var r,o=[],a={},l=Y.global.useUTC,h=new Date(i),i=e.unitRange,c=e.count;i>=q[Oe]&&(h.setMilliseconds(0),h.setSeconds(i>=q[He]?0:c*ue(h.getSeconds()/c))),i>=q[He]&&h[ie](i>=q[We]?0:c*ue(h[K]()/c)),i>=q[We]&&h[ne](i>=q[Re]?0:c*ue(h[J]()/c)),i>=q[Re]&&h[se](i>=q[Be]?1:c*ue(h[Q]()/c)),i>=q[Be]&&(h[re](i>=q[Ye]?0:c*ue(h[te]()/c)),r=h[ee]()),i>=q[Ye]&&(r-=r%c,h[oe](r)),i===q[je]&&h[se](h[Q]()-h[Z]()+p(s,1)),s=1,r=h[ee]();for(var u=h.getTime(),d=h[te](),f=h[Q](),h=l?0:(864e5+6e4*h.getTimezoneOffset())%864e5;n>u;)o.push(u),i===q[Ye]?u=X(r+s*c,0):i===q[Be]?u=X(r,d+s*c):l||i!==q[Re]&&i!==q[je]?(u+=i*c,i<=q[We]&&u%q[Re]===h&&(a[u]=Re)):u=X(r,d,f+s*c*(i===q[Re]?1:7)),s++;return o.push(u),o.info=t(e,{higherRanks:a,totalRange:i*c}),o}function k(){this.symbol=this.color=0}function _(t,e){var i,n,s=t.length;for(n=0;s>n;n++)t[n].ss_i=n;for(t.sort(function(t,n){return i=e(t,n),0===i?t.ss_i-n.ss_i:i}),n=0;s>n;n++)delete t[n].ss_i}function C(t){for(var e=t.length,i=t[0];e--;)t[e]<i&&(i=t[e]);return i}function D(t){for(var e=t.length,i=t[0];e--;)t[e]>i&&(i=t[e]);return i}function M(t,e){for(var i in t)t[i]&&t[i]!==e&&t[i].destroy&&t[i].destroy(),delete t[i]}function S(t){B||(B=m(Ne)),t&&B.appendChild(t),B.innerHTML=""}function T(t,e){var i="Highcharts error #"+t+": www.highcharts.com/errors/"+t;if(e)throw i;le.console&&console.log(i)}function A(t){return parseFloat(t.toPrecision(14))}function E(t,e){U=p(t,e.animation)}function F(){var t=Y.global.useUTC,e=t?"getUTC":"get",i=t?"setUTC":"set";X=t?Date.UTC:function(t,e,i,n,s,r){return new Date(t,e,p(i,1),p(n,0),p(s,0),p(r,0)).getTime()},K=e+"Minutes",J=e+"Hours",Z=e+"Day",Q=e+"Date",te=e+"Month",ee=e+"FullYear",ie=i+"Minutes",ne=i+"Hours",se=i+"Date",re=i+"Month",oe=i+"FullYear"}function I(){}function L(t,e,i){this.axis=t,this.pos=e,this.type=i||"",this.isNew=!0,i||this.addLabel()}function N(t,e){return this.axis=t,e&&(this.options=e,this.id=e.id),this}function $(t,e,i,n,s,r){var o=t.chart.inverted;this.axis=t,this.isNegative=i,this.options=e,this.x=n,this.stack=s,this.percent="percent"===r,this.alignOptions={align:e.align||(o?i?"left":"right":"center"),verticalAlign:e.verticalAlign||(o?"middle":i?"bottom":"top"),y:p(e.y,o?4:i?14:-6),x:p(e.x,o?i?-6:6:0)},this.textAlign=e.textAlign||(o?i?"right":"left":"center")}function z(){this.init.apply(this,arguments)}function P(t,e){var n=e.borderWidth,s=e.style,r=i(s.padding);this.chart=t,this.options=e,this.crosshairs=[],this.now={x:0,y:0},this.isHidden=!0,this.label=t.renderer.label("",0,0,e.shape,null,null,e.useHTML,null,"tooltip").attr({padding:r,fill:e.backgroundColor,"stroke-width":n,r:e.borderRadius,zIndex:8}).css(s).css({padding:0}).hide().add(),Ae||this.label.shadow(e.shadow),this.shared=e.shared}function O(t,e){var i=Ae?"":e.chart.zoomType;this.zoomX=/x/.test(i),this.zoomY=/y/.test(i),this.options=e,this.chart=t,this.init(t,e.tooltip)}function H(t){this.init(t)}function W(t,e){var i,n=t.series;t.series=null,i=ei(Y,t),i.series=t.series=n;var n=i.chart,r=n.margin,r=s(r)?r:[r,r,r,r];this.optionsMarginTop=p(n.marginTop,r[0]),this.optionsMarginRight=p(n.marginRight,r[1]),this.optionsMarginBottom=p(n.marginBottom,r[2]),this.optionsMarginLeft=p(n.marginLeft,r[3]),this.runChartClick=(r=n.events)&&!!r.click,this.callback=e,this.isResizing=0,this.options=i,this.axes=[],this.series=[],this.hasCartesianSeries=n.showAxes,this.init(r)}var R,j,B,Y,V,U,G,q,X,K,J,Z,Q,te,ee,ie,ne,se,re,oe,ae=document,le=window,he=Math,ce=he.round,ue=he.floor,de=he.ceil,pe=he.max,fe=he.min,me=he.abs,ge=he.cos,ve=he.sin,ye=he.PI,be=2*ye/360,xe=navigator.userAgent,we=le.opera,ke=/msie/i.test(xe)&&!we,_e=8===ae.documentMode,Ce=/AppleWebKit/.test(xe),De=/Firefox/.test(xe),Me="http://www.w3.org/2000/svg",Se=!!ae.createElementNS&&!!ae.createElementNS(Me,"svg").createSVGRect,Te=De&&parseInt(xe.split("Firefox/")[1],10)<4,Ae=!Se&&!ke&&!!ae.createElement("canvas").getContext,Ee=ae.documentElement.ontouchstart!==R,Fe={},Ie=0,Le=function(){},Ne="div",$e="none",ze="rgba(192,192,192,"+(Se?1e-6:.002)+")",Pe="millisecond",Oe="second",He="minute",We="hour",Re="day",je="week",Be="month",Ye="year",Ve={};le.Highcharts={},V=function(t,e,i){if(!c(e)||isNaN(e))return"Invalid date";var n,t=p(t,"%Y-%m-%d %H:%M:%S"),s=new Date(e),r=s[J](),o=s[Z](),a=s[Q](),l=s[te](),h=s[ee](),u=Y.lang,d=u.weekdays,e={a:d[o].substr(0,3),A:d[o],d:y(a),e:a,b:u.shortMonths[l],B:u.months[l],m:y(l+1),y:h.toString().substr(2,2),Y:h,H:y(r),I:y(r%12||12),l:r%12||12,M:y(s[K]()),p:12>r?"AM":"PM",P:12>r?"am":"pm",S:y(s.getSeconds()),L:y(ce(e%1e3),3)};for(n in e)t=t.replace("%"+n,e[n]);return i?t.substr(0,1).toUpperCase()+t.substr(1):t},k.prototype={wrapColor:function(t){this.color>=t&&(this.color=0)},wrapSymbol:function(t){this.symbol>=t&&(this.symbol=0)}},q=e(Pe,1,Oe,1e3,He,6e4,We,36e5,Re,864e5,je,6048e5,Be,2592e6,Ye,31556952e3),G={init:function(t,e,i){var n,s,r,e=e||"",o=t.shift,a=e.indexOf("C")>-1,l=a?7:3,e=e.split(" "),i=[].concat(i),h=function(t){for(n=t.length;n--;)"M"===t[n]&&t.splice(n+1,0,t[n+1],t[n+2],t[n+1],t[n+2])};if(a&&(h(e),h(i)),t.isArea&&(s=e.splice(e.length-6,6),r=i.splice(i.length-6,6)),o<=i.length/l)for(;o--;)i=[].concat(i).splice(0,l).concat(i);if(t.shift=0,e.length)for(t=i.length;e.length<t;)o=[].concat(e).splice(e.length-l,l),a&&(o[l-6]=o[l-2],o[l-5]=o[l-1]),e=e.concat(o);return s&&(e=e.concat(s),i=i.concat(r)),[e,i]},step:function(t,e,i,n){var s=[],r=t.length;if(1===i)s=n;else if(r===e.length&&1>i)for(;r--;)n=parseFloat(t[r]),s[r]=isNaN(n)?t[r]:i*parseFloat(e[r]-n)+n;else s=e;return s}},function(e){le.HighchartsAdapter=le.HighchartsAdapter||e&&{init:function(t){var i,n=e.fx,s=n.step,r=e.Tween,o=r&&r.propHooks;e.extend(e.easing,{easeOutQuad:function(t,e,i,n,s){return-n*(e/=s)*(e-2)+i}}),e.each(["cur","_default","width","height"],function(t,e){var i,a,l=s;"cur"===e?l=n.prototype:"_default"===e&&r&&(l=o[e],e="set"),(i=l[e])&&(l[e]=function(n){return n=t?n:this,a=n.elem,a.attr?a.attr(n.prop,"cur"===e?R:n.now):i.apply(this,arguments)})}),i=function(e){var i,n=e.elem;e.started||(i=t.init(n,n.d,n.toD),e.start=i[0],e.end=i[1],e.started=!0),n.attr("d",t.step(e.start,e.end,e.pos,n.toD))},r?o.d={set:i}:s.d=i,this.each=Array.prototype.forEach?function(t,e){return Array.prototype.forEach.call(t,e)}:function(t,e){for(var i=0,n=t.length;n>i;i++)if(e.call(t[i],t[i],i,t)===!1)return i}},getScript:e.getScript,inArray:e.inArray,adapterRun:function(t,i){return e(t)[i]()},grep:e.grep,map:function(t,e){for(var i=[],n=0,s=t.length;s>n;n++)i[n]=e.call(t[n],t[n],n,t);return i},merge:function(){var t=arguments;return e.extend(!0,null,t[0],t[1],t[2],t[3])},offset:function(t){return e(t).offset()},addEvent:function(t,i,n){e(t).bind(i,n)},removeEvent:function(t,i,n){var s=ae.removeEventListener?"removeEventListener":"detachEvent";ae[s]&&!t[s]&&(t[s]=function(){}),e(t).unbind(i,n)},fireEvent:function(i,n,s,r){var o,a=e.Event(n),l="detached"+n;!ke&&s&&(delete s.layerX,delete s.layerY),t(a,s),i[n]&&(i[l]=i[n],i[n]=null),e.each(["preventDefault","stopPropagation"],function(t,e){var i=a[e];a[e]=function(){try{i.call(a)}catch(t){"preventDefault"===e&&(o=!0)}}}),e(i).trigger(a),i[l]&&(i[n]=i[l],i[l]=null),r&&!a.isDefaultPrevented()&&!o&&r(a)},washMouseEvent:function(t){var e=t.originalEvent||t;return e.pageX===R&&(e.pageX=t.pageX,e.pageY=t.pageY),e},animate:function(t,i,n){var s=e(t);i.d&&(t.toD=i.d,i.d=1),s.stop(),s.animate(i,n)},stop:function(t){e(t).stop()}}}(le.jQuery);var Ue=le.HighchartsAdapter,Ge=Ue||{};Ue&&Ue.init.call(Ue,G);var qe=Ge.adapterRun,Xe=Ge.getScript,Ke=Ge.inArray,Je=Ge.each,Ze=Ge.grep,Qe=Ge.offset,ti=Ge.map,ei=Ge.merge,ii=Ge.addEvent,ni=Ge.removeEvent,si=Ge.fireEvent,ri=Ge.washMouseEvent,oi=Ge.animate,ai=Ge.stop,Ge={enabled:!0,align:"center",x:0,y:15,style:{color:"#666",fontSize:"11px",lineHeight:"14px"}};Y={colors:"#4572A7,#AA4643,#89A54E,#80699B,#3D96AE,#DB843D,#92A8CD,#A47D7C,#B5CA92".split(","),symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),decimalPoint:".",numericSymbols:"k,M,G,T,P,E".split(","),resetZoom:"Reset zoom",resetZoomTitle:"Reset zoom level 1:1",thousandsSep:","},global:{useUTC:!0,canvasToolsURL:"http://code.highcharts.com/2.3.3/modules/canvas-tools.js",VMLRadialGradientURL:"http://code.highcharts.com/2.3.3/gfx/vml-radial-gradient.png"},chart:{borderColor:"#4572A7",borderRadius:5,defaultSeriesType:"line",ignoreHiddenSeries:!0,spacingTop:10,spacingRight:10,spacingBottom:15,spacingLeft:10,style:{fontFamily:'"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif',fontSize:"12px"},backgroundColor:"#FFFFFF",plotBorderColor:"#C0C0C0",resetZoomButton:{theme:{zIndex:20},position:{align:"right",x:-10,y:10}}},title:{text:"Chart title",align:"center",y:15,style:{color:"#3E576F",fontSize:"16px"}},subtitle:{text:"",align:"center",y:30,style:{color:"#6D869F"}},plotOptions:{line:{allowPointSelect:!1,showCheckbox:!1,animation:{duration:1e3},events:{},lineWidth:2,shadow:!0,marker:{enabled:!0,lineWidth:0,radius:4,lineColor:"#FFFFFF",states:{hover:{enabled:!0},select:{fillColor:"#FFFFFF",lineColor:"#000000",lineWidth:2}}},point:{events:{}},dataLabels:ei(Ge,{enabled:!1,formatter:function(){return this.y},verticalAlign:"bottom",y:0}),cropThreshold:300,pointRange:0,showInLegend:!0,states:{hover:{marker:{}},select:{marker:{}}},stickyTracking:!0}},labels:{style:{position:"absolute",color:"#3E576F"}},legend:{enabled:!0,align:"center",layout:"horizontal",labelFormatter:function(){return this.name},borderWidth:1,borderColor:"#909090",borderRadius:5,navigation:{activeColor:"#3E576F",inactiveColor:"#CCC"},shadow:!1,itemStyle:{cursor:"pointer",color:"#3E576F",fontSize:"12px"},itemHoverStyle:{color:"#000"},itemHiddenStyle:{color:"#CCC"},itemCheckboxStyle:{position:"absolute",width:"13px",height:"13px"},symbolWidth:16,symbolPadding:5,verticalAlign:"bottom",x:0,y:0},loading:{labelStyle:{fontWeight:"bold",position:"relative",top:"1em"},style:{position:"absolute",backgroundColor:"white",opacity:.5,textAlign:"center"}},tooltip:{enabled:!0,backgroundColor:"rgba(255, 255, 255, .85)",borderWidth:2,borderRadius:5,dateTimeLabelFormats:{millisecond:"%A, %b %e, %H:%M:%S.%L",second:"%A, %b %e, %H:%M:%S",minute:"%A, %b %e, %H:%M",hour:"%A, %b %e, %H:%M",day:"%A, %b %e, %Y",week:"Week from %A, %b %e, %Y",month:"%B %Y",year:"%Y"},headerFormat:'<span style="font-size: 10px">{point.key}</span><br/>',pointFormat:'<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b><br/>',shadow:!0,shared:Ae,snap:Ee?25:10,style:{color:"#333333",fontSize:"12px",padding:"5px",whiteSpace:"nowrap"}},credits:{enabled:!0,text:"Highcharts.com",href:"http://www.highcharts.com",position:{align:"right",x:-10,verticalAlign:"bottom",y:-5},style:{cursor:"pointer",color:"#909090",fontSize:"10px"}}};var li=Y.plotOptions,Ue=li.line;F();var hi=function(t){var e,n=[];return function(t){(e=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/.exec(t))?n=[i(e[1]),i(e[2]),i(e[3]),parseFloat(e[4],10)]:(e=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(t))&&(n=[i(e[1],16),i(e[2],16),i(e[3],16),1])}(t),{get:function(e){return n&&!isNaN(n[0])?"rgb"===e?"rgb("+n[0]+","+n[1]+","+n[2]+")":"a"===e?n[3]:"rgba("+n.join(",")+")":t},brighten:function(t){if(o(t)&&0!==t){var e;for(e=0;3>e;e++)n[e]+=i(255*t),n[e]<0&&(n[e]=0),n[e]>255&&(n[e]=255)}return this},setOpacity:function(t){return n[3]=t,this}}};I.prototype={init:function(t,e){this.element="span"===e?m(e):ae.createElementNS(Me,e),this.renderer=t,this.attrSetters={}},animate:function(t,e,i){e=p(e,U,!0),ai(this),e?(e=ei(e),i&&(e.complete=i),oi(this,t,e)):(this.attr(t),i&&i())},attr:function(t,e){var s,r,o,a,l,h,d,p=this.element,f=p.nodeName.toLowerCase(),m=this.renderer,g=this.attrSetters,v=this.shadows,y=this;if(n(t)&&c(e)&&(s=t,t={},t[s]=e),n(t))s=t,"circle"===f?s={x:"cx",y:"cy"}[s]||s:"strokeWidth"===s&&(s="stroke-width"),y=u(p,s)||this[s]||0,"d"!==s&&"visibility"!==s&&(y=parseFloat(y));else for(s in t)if(l=!1,r=t[s],o=g[s]&&g[s].call(this,r,s),o!==!1){if(o!==R&&(r=o),"d"===s)r&&r.join&&(r=r.join(" ")),/(NaN| {2}|^$)/.test(r)&&(r="M 0 0");else if("x"===s&&"text"===f){for(o=0;o<p.childNodes.length;o++)a=p.childNodes[o],u(a,"x")===u(p,"x")&&u(a,"x",r);this.rotation&&u(p,"transform","rotate("+this.rotation+" "+r+" "+i(t.y||u(p,"y"))+")")}else if("fill"===s)r=m.color(r,p,s);else if("circle"!==f||"x"!==s&&"y"!==s)if("rect"===f&&"r"===s)u(p,{rx:r,ry:r}),l=!0;else if("translateX"===s||"translateY"===s||"rotation"===s||"verticalAlign"===s)l=d=!0;else if("stroke"===s)r=m.color(r,p,s);else if("dashstyle"===s){if(s="stroke-dasharray",r=r&&r.toLowerCase(),"solid"===r)r=$e;else if(r){for(r=r.replace("shortdashdotdot","3,1,1,1,1,1,").replace("shortdashdot","3,1,1,1").replace("shortdot","1,1,").replace("shortdash","3,1,").replace("longdash","8,3,").replace(/dot/g,"1,3,").replace("dash","4,3,").replace(/,$/,"").split(","),o=r.length;o--;)r[o]=i(r[o])*t["stroke-width"];r=r.join(",")}}else"isTracker"===s?this[s]=r:"width"===s?r=i(r):"align"===s?(s="text-anchor",r={left:"start",center:"middle",right:"end"}[r]):"title"===s&&(o=p.getElementsByTagName("title")[0],o||(o=ae.createElementNS(Me,"title"),p.appendChild(o)),o.textContent=r);else s={x:"cx",y:"cy"}[s]||s;if("strokeWidth"===s&&(s="stroke-width"),Ce&&"stroke-width"===s&&0===r&&(r=1e-6),this.symbolName&&/^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(s)&&(h||(this.symbolAttr(t),h=!0),l=!0),v&&/^(width|height|visibility|x|y|d|transform)$/.test(s))for(o=v.length;o--;)u(v[o],s,"height"===s?pe(r-(v[o].cutHeight||0),0):r);("width"===s||"height"===s)&&"rect"===f&&0>r&&(r=0),this[s]=r,d&&this.updateTransform(),"text"===s?(r!==this.textStr&&delete this.bBox,this.textStr=r,this.added&&m.buildText(this)):l||u(p,s,r)}return y},symbolAttr:function(t){var e=this;Je("x,y,r,start,end,width,height,innerR,anchorX,anchorY".split(","),function(i){e[i]=p(t[i],e[i])}),e.attr({d:e.renderer.symbols[e.symbolName](e.x,e.y,e.width,e.height,e)})},clip:function(t){return this.attr("clip-path",t?"url("+this.renderer.url+"#"+t.id+")":$e)},crisp:function(t,e,i,n,s){var r,o,a={},l={},t=t||this.strokeWidth||this.attr&&this.attr("stroke-width")||0;o=ce(t)%2/2,l.x=ue(e||this.x||0)+o,l.y=ue(i||this.y||0)+o,l.width=ue((n||this.width||0)-2*o),l.height=ue((s||this.height||0)-2*o),l.strokeWidth=t;for(r in l)this[r]!==l[r]&&(this[r]=a[r]=l[r]);return a},css:function(e){var i,n=this.element,n=e&&e.width&&"text"===n.nodeName.toLowerCase(),s="",r=function(t,e){return"-"+e.toLowerCase()};if(e&&e.color&&(e.fill=e.color),this.styles=e=t(this.styles,e),Ae&&n&&delete e.width,ke&&!Se)n&&delete e.width,f(this.element,e);else{for(i in e)s+=i.replace(/([A-Z])/g,r)+":"+e[i]+";";this.attr({style:s})}return n&&this.added&&this.renderer.buildText(this),this},on:function(t,e){var i=e;return Ee&&"click"===t&&(t="touchstart",i=function(t){t.preventDefault(),e()}),this.element["on"+t]=i,this},setRadialReference:function(t){return this.element.radialReference=t,this},translate:function(t,e){return this.attr({translateX:t,translateY:e})},invert:function(){return this.inverted=!0,this.updateTransform(),this},htmlCss:function(e){var i=this.element;return(i=e&&"SPAN"===i.tagName&&e.width)&&(delete e.width,this.textWidth=i,this.updateTransform()),this.styles=t(this.styles,e),f(this.element,e),this},htmlGetBBox:function(){var t=this.element,e=this.bBox;return e||("text"===t.nodeName&&(t.style.position="absolute"),e=this.bBox={x:t.offsetLeft,y:t.offsetTop,width:t.offsetWidth,height:t.offsetHeight}),e},htmlUpdateTransform:function(){if(this.added){var t=this.renderer,e=this.element,n=this.translateX||0,s=this.translateY||0,r=this.x||0,o=this.y||0,a=this.textAlign||"left",l={left:0,center:.5,right:1}[a],h=a&&"left"!==a,u=this.shadows;if((n||s)&&(f(e,{marginLeft:n,marginTop:s}),u&&Je(u,function(t){f(t,{marginLeft:n+1,marginTop:s+1})})),this.inverted&&Je(e.childNodes,function(i){t.invertChild(i,e)}),"SPAN"===e.tagName){var d,m,g,v,u=this.rotation,y=0,b=1,y=0;g=i(this.textWidth);var x=this.xCorr||0,w=this.yCorr||0,k=[u,a,e.innerHTML,this.textWidth].join(",");d={},k!==this.cTT&&(c(u)&&(t.isSVG?(x=ke?"-ms-transform":Ce?"-webkit-transform":De?"MozTransform":we?"-o-transform":"",d[x]=d.transform="rotate("+u+"deg)"):(y=u*be,b=ge(y),y=ve(y),d.filter=u?["progid:DXImageTransform.Microsoft.Matrix(M11=",b,", M12=",-y,", M21=",y,", M22=",b,", sizingMethod='auto expand')"].join(""):$e),f(e,d)),d=p(this.elemWidth,e.offsetWidth),m=p(this.elemHeight,e.offsetHeight),d>g&&/[ \-]/.test(e.innerText)&&(f(e,{width:g+"px",display:"block",whiteSpace:"normal"}),d=g),g=t.fontMetrics(e.style.fontSize).b,x=0>b&&-d,w=0>y&&-m,v=0>b*y,x+=y*g*(v?1-l:l),w-=b*g*(u?v?l:1-l:1),h&&(x-=d*l*(0>b?-1:1),u&&(w-=m*l*(0>y?-1:1)),f(e,{textAlign:a})),this.xCorr=x,this.yCorr=w),f(e,{left:r+x+"px",top:o+w+"px"}),this.cTT=k}}else this.alignOnAdd=!0},updateTransform:function(){var t=this.translateX||0,e=this.translateY||0,i=this.inverted,n=this.rotation,s=[];i&&(t+=this.attr("width"),e+=this.attr("height")),(t||e)&&s.push("translate("+t+","+e+")"),i?s.push("rotate(90) scale(-1,1)"):n&&s.push("rotate("+n+" "+(this.x||0)+" "+(this.y||0)+")"),s.length&&u(this.element,"transform",s.join(" "))},toFront:function(){var t=this.element;return t.parentNode.appendChild(t),this},align:function(t,e,i){t?(this.alignOptions=t,this.alignByTranslate=e,i||this.renderer.alignedObjects.push(this)):(t=this.alignOptions,e=this.alignByTranslate);var i=p(i,this.renderer),n=t.align,s=t.verticalAlign,r=(i.x||0)+(t.x||0),o=(i.y||0)+(t.y||0),a={};return("right"===n||"center"===n)&&(r+=(i.width-(t.width||0))/{right:1,center:2}[n]),a[e?"translateX":"x"]=ce(r),("bottom"===s||"middle"===s)&&(o+=(i.height-(t.height||0))/({bottom:1,middle:2}[s]||1)),a[e?"translateY":"y"]=ce(o),this[this.placed?"animate":"attr"](a),this.placed=!0,this.alignAttr=a,this},getBBox:function(){var e,i=this.bBox,n=this.renderer,s=this.rotation,r=this.element,o=this.styles,a=s*be;if(!i){if(r.namespaceURI===Me||n.forExport){try{i=r.getBBox?t({},r.getBBox()):{width:r.offsetWidth,height:r.offsetHeight}}catch(l){}(!i||i.width<0)&&(i={width:0,height:0})}else i=this.htmlGetBBox();n.isSVG&&(n=i.width,e=i.height,s)&&(i.width=me(e*ve(a))+me(n*ge(a)),i.height=me(e*ge(a))+me(n*ve(a))),ke&&o&&"11px"===o.fontSize&&22.700000762939453===e&&(i.height=14),this.bBox=i}return i},show:function(){return this.attr({visibility:"visible"})},hide:function(){return this.attr({visibility:"hidden"})},add:function(t){var e,n=this.renderer,s=t||n,r=s.element||n.box,o=r.childNodes,a=this.element,l=u(a,"zIndex");if(t&&(this.parentGroup=t),this.parentInverted=t&&t.inverted,void 0!==this.textStr&&n.buildText(this),l&&(s.handleZ=!0,l=i(l)),s.handleZ)for(s=0;s<o.length;s++)if(t=o[s],n=u(t,"zIndex"),t!==a&&(i(n)>l||!c(l)&&c(n))){r.insertBefore(a,t),e=!0;break}return e||r.appendChild(a),this.added=!0,si(this,"add"),this},safeRemoveChild:function(t){var e=t.parentNode;e&&e.removeChild(t)},destroy:function(){var t,e,i=this,n=i.element||{},s=i.shadows;if(n.onclick=n.onmouseout=n.onmouseover=n.onmousemove=null,ai(i),i.clipPath&&(i.clipPath=i.clipPath.destroy()),i.stops){for(e=0;e<i.stops.length;e++)i.stops[e]=i.stops[e].destroy();i.stops=null}i.safeRemoveChild(n),s&&Je(s,function(t){i.safeRemoveChild(t)}),h(i.renderer.alignedObjects,i);for(t in i)delete i[t];return null},empty:function(){for(var t=this.element,e=t.childNodes,i=e.length;i--;)t.removeChild(e[i])},shadow:function(t,e,i){var n,s,r,o,a,l,h=[],c=this.element;if(t){for(o=p(t.width,3),a=(t.opacity||.15)/o,l=this.parentInverted?"(-1,-1)":"("+p(t.offsetX,1)+", "+p(t.offsetY,1)+")",n=1;o>=n;n++)s=c.cloneNode(0),r=2*o+1-2*n,u(s,{isShadow:"true",stroke:t.color||"black","stroke-opacity":a*n,"stroke-width":r,transform:"translate"+l,fill:$e}),i&&(u(s,"height",pe(u(s,"height")-r,0)),s.cutHeight=r),e?e.element.appendChild(s):c.parentNode.insertBefore(s,c),h.push(s);this.shadows=h}return this}};var ci=function(){this.init.apply(this,arguments)};ci.prototype={Element:I,init:function(t,e,i,n){var s,r=location;s=this.createElement("svg").attr({xmlns:Me,version:"1.1"}),t.appendChild(s.element),this.isSVG=!0,this.box=s.element,this.boxWrapper=s,this.alignedObjects=[],this.url=(De||Ce)&&ae.getElementsByTagName("base").length?r.href.replace(/#.*?$/,"").replace(/([\('\)])/g,"\\$1").replace(/ /g,"%20"):"",this.defs=this.createElement("defs").add(),this.forExport=n,this.gradients={},this.setSize(e,i,!1);var o;De&&t.getBoundingClientRect&&(this.subPixelFix=e=function(){f(t,{left:0,top:0}),o=t.getBoundingClientRect(),f(t,{left:de(o.left)-o.left+"px",top:de(o.top)-o.top+"px"})},e(),ii(le,"resize",e))},isHidden:function(){return!this.boxWrapper.getBBox().width},destroy:function(){var t=this.defs;return this.box=null,this.boxWrapper=this.boxWrapper.destroy(),M(this.gradients||{}),this.gradients=null,t&&(this.defs=t.destroy()),this.subPixelFix&&ni(le,"resize",this.subPixelFix),this.alignedObjects=null},createElement:function(t){var e=new this.Element;return e.init(this,t),e},draw:function(){},buildText:function(t){for(var e,n=t.element,s=p(t.textStr,"").toString().replace(/<(b|strong)>/g,'<span style="font-weight:bold">').replace(/<(i|em)>/g,'<span style="font-style:italic">').replace(/<a/g,"<span").replace(/<\/(b|strong|i|em|a)>/g,"</span>").split(/<br.*?>/g),r=n.childNodes,o=/style="([^"]+)"/,a=/href="([^"]+)"/,l=u(n,"x"),h=t.styles,c=h&&h.width&&i(h.width),d=h&&h.lineHeight,h=r.length,m=[];h--;)n.removeChild(r[h]);c&&!t.added&&this.box.appendChild(n),""===s[s.length-1]&&s.pop(),Je(s,function(s,r){var h,p,g=0,s=s.replace(/<span/g,"|||<span").replace(/<\/span>/g,"</span>|||");h=s.split("|||"),Je(h,function(s){if(""!==s||1===h.length){var v,y={},b=ae.createElementNS(Me,"tspan");if(o.test(s)&&(v=s.match(o)[1].replace(/(;| |^)color([ :])/,"$1fill$2"),u(b,"style",v)),a.test(s)&&(u(b,"onclick",'location.href="'+s.match(a)[1]+'"'),f(b,{cursor:"pointer"})),s=(s.replace(/<(.|\n)*?>/g,"")||" ").replace(/&lt;/g,"<").replace(/&gt;/g,">"),b.appendChild(ae.createTextNode(s)),g?y.dx=3:y.x=l,!g){if(r){if(!Se&&t.renderer.forExport&&f(b,{display:"block"}),p=le.getComputedStyle&&i(le.getComputedStyle(e,null).getPropertyValue("line-height")),!p||isNaN(p)){var x;(x=d)||(x=e.offsetHeight)||(m[r]=n.getBBox?n.getBBox().height:t.renderer.fontMetrics(n.style.fontSize).h,x=ce(m[r]-(m[r-1]||0))||18),p=x}u(b,"dy",p)}e=b}if(u(b,y),n.appendChild(b),g++,c)for(var s=s.replace(/([^\^])-/g,"$1- ").split(" "),w=[];s.length||w.length;)delete t.bBox,x=t.getBBox().width,y=x>c,y&&1!==s.length?(b.removeChild(b.firstChild),w.unshift(s.pop())):(s=w,w=[],s.length&&(b=ae.createElementNS(Me,"tspan"),u(b,{dy:d||16,x:l}),v&&u(b,"style",v),n.appendChild(b),x>c&&(c=x))),s.length&&b.appendChild(ae.createTextNode(s.join(" ").replace(/- /g,"-")))}})})},button:function(i,n,s,r,o,a,l){var h,c,u,d,p,f=this.label(i,n,s),m=0,i={x1:0,y1:0,x2:0,y2:1},o=ei(e("stroke-width",1,"stroke","#999","fill",e("linearGradient",i,"stops",[[0,"#FFF"],[1,"#DDD"]]),"r",3,"padding",3,"style",e("color","black")),o);return u=o.style,delete o.style,a=ei(o,e("stroke","#68A","fill",e("linearGradient",i,"stops",[[0,"#FFF"],[1,"#ACF"]])),a),d=a.style,delete a.style,l=ei(o,e("stroke","#68A","fill",e("linearGradient",i,"stops",[[0,"#9BD"],[1,"#CDF"]])),l),p=l.style,delete l.style,ii(f.element,"mouseenter",function(){f.attr(a).css(d)}),ii(f.element,"mouseleave",function(){h=[o,a,l][m],c=[u,d,p][m],f.attr(h).css(c)}),f.setState=function(t){(m=t)?2===t&&f.attr(l).css(p):f.attr(o).css(u)},f.on("click",function(){r.call(f)}).attr(o).css(t({cursor:"default"},u))},crispLine:function(t,e){return t[1]===t[4]&&(t[1]=t[4]=ce(t[1])-e%2/2),t[2]===t[5]&&(t[2]=t[5]=ce(t[2])+e%2/2),t},path:function(e){var i={fill:$e};return r(e)?i.d=e:s(e)&&t(i,e),this.createElement("path").attr(i)},circle:function(t,e,i){return t=s(t)?t:{x:t,y:e,r:i},this.createElement("circle").attr(t)},arc:function(t,e,i,n,r,o){return s(t)&&(e=t.y,i=t.r,n=t.innerR,r=t.start,o=t.end,t=t.x),this.symbol("arc",t||0,e||0,i||0,i||0,{innerR:n||0,start:r||0,end:o||0})},rect:function(t,e,i,n,r,o){return r=s(t)?t.r:r,r=this.createElement("rect").attr({rx:r,ry:r,fill:$e}),r.attr(s(t)?t:r.crisp(o,t,e,pe(i,0),pe(n,0)))},setSize:function(t,e,i){var n=this.alignedObjects,s=n.length;for(this.width=t,this.height=e,this.boxWrapper[p(i,!0)?"animate":"attr"]({width:t,height:e});s--;)n[s].align()},g:function(t){var e=this.createElement("g");return c(t)?e.attr({"class":"highcharts-"+t}):e},image:function(e,i,n,s,r){var o={preserveAspectRatio:$e};return arguments.length>1&&t(o,{x:i,y:n,width:s,height:r}),o=this.createElement("image").attr(o),o.element.setAttributeNS?o.element.setAttributeNS("http://www.w3.org/1999/xlink","href",e):o.element.setAttribute("hc-svg-href",e),o},symbol:function(e,i,n,s,r,o){var a,l,h,c=this.symbols[e],c=c&&c(ce(i),ce(n),s,r,o),u=/^url\((.*?)\)$/;return c?(a=this.path(c),t(a,{symbolName:e,x:i,y:n,width:s,height:r}),o&&t(a,o)):u.test(e)&&(h=function(t,e){t.attr({width:e[0],height:e[1]}),t.alignByTranslate||t.translate(-ce(e[0]/2),-ce(e[1]/2))},l=e.match(u)[1],e=Fe[l],a=this.image(l).attr({x:i,y:n}),e?h(a,e):(a.attr({width:0,height:0}),m("img",{onload:function(){h(a,Fe[l]=[this.width,this.height])},src:l}))),a},symbols:{circle:function(t,e,i,n){var s=.166*i;return["M",t+i/2,e,"C",t+i+s,e,t+i+s,e+n,t+i/2,e+n,"C",t-s,e+n,t-s,e,t+i/2,e,"Z"]},square:function(t,e,i,n){return["M",t,e,"L",t+i,e,t+i,e+n,t,e+n,"Z"]},triangle:function(t,e,i,n){return["M",t+i/2,e,"L",t+i,e+n,t,e+n,"Z"]},"triangle-down":function(t,e,i,n){return["M",t,e,"L",t+i,e,t+i/2,e+n,"Z"]},diamond:function(t,e,i,n){return["M",t+i/2,e,"L",t+i,e+n/2,t+i/2,e+n,t,e+n/2,"Z"]},arc:function(t,e,i,n,s){var r=s.start,i=s.r||i||n,o=s.end-1e-6,n=s.innerR,a=s.open,l=ge(r),h=ve(r),c=ge(o),o=ve(o),s=s.end-r<ye?0:1;return["M",t+i*l,e+i*h,"A",i,i,0,s,1,t+i*c,e+i*o,a?"M":"L",t+n*c,e+n*o,"A",n,n,0,s,0,t+n*l,e+n*h,a?"":"Z"]}},clipRect:function(t,e,i,n){var s="highcharts-"+Ie++,r=this.createElement("clipPath").attr({id:s}).add(this.defs),t=this.rect(t,e,i,n,0).add(r);return t.id=s,t.clipPath=r,t},color:function(e,i,n){var s,o,a=this,l=/^rgba/;if(e&&e.linearGradient?o="linearGradient":e&&e.radialGradient&&(o="radialGradient"),o){var h,d,p,n=e[o],f=a.gradients,i=i.radialReference;return n.id&&f[n.id]||(r(n)&&(e[o]=n={x1:n[0],y1:n[1],x2:n[2],y2:n[3],gradientUnits:"userSpaceOnUse"}),"radialGradient"===o&&i&&!c(n.gradientUnits)&&t(n,{cx:i[0]-i[2]/2+n.cx*i[2],cy:i[1]-i[2]/2+n.cy*i[2],r:n.r*i[2],gradientUnits:"userSpaceOnUse"}),n.id="highcharts-"+Ie++,f[n.id]=h=a.createElement(o).attr(n).add(a.defs),h.stops=[],Je(e.stops,function(t){l.test(t[1])?(s=hi(t[1]),d=s.get("rgb"),p=s.get("a")):(d=t[1],p=1),t=a.createElement("stop").attr({offset:t[0],"stop-color":d,"stop-opacity":p}).add(h),h.stops.push(t)})),"url("+a.url+"#"+n.id+")"}return l.test(e)?(s=hi(e),u(i,n+"-opacity",s.get("a")),s.get("rgb")):(i.removeAttribute(n+"-opacity"),e)},text:function(t,e,i,n){var s=Y.chart.style,r=Ae||!Se&&this.forExport;return n&&!this.forExport?this.html(t,e,i):(e=ce(p(e,0)),i=ce(p(i,0)),t=this.createElement("text").attr({x:e,y:i,text:t}).css({fontFamily:s.fontFamily,fontSize:s.fontSize}),r&&t.css({position:"absolute"}),t.x=e,t.y=i,t)},html:function(e,i,n){var s=Y.chart.style,r=this.createElement("span"),o=r.attrSetters,a=r.element,l=r.renderer;
386
+ return o.text=function(t){return t!==a.innerHTML&&delete this.bBox,a.innerHTML=t,!1},o.x=o.y=o.align=function(t,e){return"align"===e&&(e="textAlign"),r[e]=t,r.htmlUpdateTransform(),!1},r.attr({text:e,x:ce(i),y:ce(n)}).css({position:"absolute",whiteSpace:"nowrap",fontFamily:s.fontFamily,fontSize:s.fontSize}),r.css=r.htmlCss,l.isSVG&&(r.add=function(e){var i,n=l.box.parentNode,s=[];if(e){if(i=e.div,!i){for(;e;)s.push(e),e=e.parentGroup;Je(s.reverse(),function(e){var s;i=e.div=e.div||m(Ne,{className:u(e.element,"class")},{position:"absolute",left:(e.translateX||0)+"px",top:(e.translateY||0)+"px"},i||n),s=i.style,t(e.attrSetters,{translateX:function(t){s.left=t+"px"},translateY:function(t){s.top=t+"px"},visibility:function(t,e){s[e]=t}})})}}else i=n;return i.appendChild(a),r.added=!0,r.alignOnAdd&&r.htmlUpdateTransform(),r}),r},fontMetrics:function(t){var t=i(t||11),t=24>t?t+4:ce(1.2*t),e=ce(.8*t);return{h:t,b:e}},label:function(e,i,n,s,r,o,a,l,h){function u(){var t,e=k.styles,e=e&&e.textAlign,i=D*(1-C);t=l?0:x,!c(g)||"center"!==e&&"right"!==e||(i+={center:.5,right:1}[e]*(g-m.width)),(i!==_.x||t!==_.y)&&_.attr({x:i,y:t}),_.x=i,_.y=t}function d(t,e){f?f.attr(t,e):S[t]=e}function p(){_.add(k),k.attr({text:e,x:i,y:n}),c(r)&&k.attr({anchorX:r,anchorY:o})}var f,m,g,v,y,b,x,w=this,k=w.g(h),_=w.text("",0,0,a).attr({zIndex:1}),C=0,D=3,M=0,S={},a=k.attrSetters;ii(k,"add",p),a.width=function(t){return g=t,!1},a.height=function(t){return v=t,!1},a.padding=function(t){return c(t)&&t!==D&&(D=t,u()),!1},a.align=function(t){return C={left:0,center:.5,right:1}[t],!1},a.text=function(t,e){_.attr(e,t);var i;return i=_.element.style,m=(void 0===g||void 0===v||k.styles.textAlign)&&_.getBBox(),k.width=(g||m.width||0)+2*D,k.height=(v||m.height||0)+2*D,x=D+w.fontMetrics(i&&i.fontSize).b,f||(i=l?-x:0,k.box=f=s?w.symbol(s,-C*D,i,k.width,k.height):w.rect(-C*D,i,k.width,k.height,0,S["stroke-width"]),f.add(k)),f.attr(ei({width:k.width,height:k.height},S)),S=null,u(),!1},a["stroke-width"]=function(t,e){return M=t%2/2,d(e,t),!1},a.stroke=a.fill=a.r=function(t,e){return d(e,t),!1},a.anchorX=function(t,e){return r=t,d(e,t+M-y),!1},a.anchorY=function(t,e){return o=t,d(e,t-b),!1},a.x=function(t){return k.x=t,t-=C*((g||m.width)+D),y=ce(t),k.attr("translateX",y),!1},a.y=function(t){return b=k.y=ce(t),k.attr("translateY",t),!1};var T=k.css;return t(k,{css:function(t){if(t){var e={},t=ei({},t);Je("fontSize,fontWeight,fontFamily,color,lineHeight,width".split(","),function(i){t[i]!==R&&(e[i]=t[i],delete t[i])}),_.css(e)}return T.call(k,t)},getBBox:function(){return f.getBBox()},shadow:function(t){return f.shadow(t),k},destroy:function(){ni(k,"add",p),ni(k.element,"mouseenter"),ni(k.element,"mouseleave"),_&&(_=_.destroy()),f&&(f=f.destroy()),I.prototype.destroy.call(k)}})}},j=ci;var ui;if(!Se&&!Ae){ui={init:function(t,e){var i=["<",e,' filled="f" stroked="f"'],n=["position: ","absolute",";"];("shape"===e||e===Ne)&&n.push("left:0;top:0;width:1px;height:1px;"),_e&&n.push("visibility: ",e===Ne?"hidden":"visible"),i.push(' style="',n.join(""),'"/>'),e&&(i=e===Ne||"span"===e||"img"===e?i.join(""):t.prepVML(i),this.element=m(i)),this.renderer=t,this.attrSetters={}},add:function(t){var e=this.renderer,i=this.element,n=e.box,n=t?t.element||t:n;return t&&t.inverted&&e.invertChild(i,n),n.appendChild(i),this.added=!0,this.alignOnAdd&&!this.deferUpdateTransform&&this.updateTransform(),si(this,"add"),this},updateTransform:I.prototype.htmlUpdateTransform,attr:function(t,e){var i,s,r,a,l,h=this.element||{},d=h.style,p=h.nodeName,f=this.renderer,g=this.symbolName,v=this.shadows,y=this.attrSetters,b=this;if(n(t)&&c(e)&&(i=t,t={},t[i]=e),n(t))i=t,b="strokeWidth"===i||"stroke-width"===i?this.strokeweight:this[i];else for(i in t)if(s=t[i],l=!1,r=y[i]&&y[i].call(this,s,i),r!==!1&&null!==s){if(r!==R&&(s=r),g&&/^(x|y|r|start|end|width|height|innerR|anchorX|anchorY)/.test(i))a||(this.symbolAttr(t),a=!0),l=!0;else if("d"===i){for(s=s||[],this.d=s.join(" "),r=s.length,l=[];r--;)l[r]=o(s[r])?ce(10*s[r])-5:"Z"===s[r]?"x":s[r];if(s=l.join(" ")||"x",h.path=s,v)for(r=v.length;r--;)v[r].path=v[r].cutOff?this.cutOffPath(s,v[r].cutOff):s;l=!0}else if("visibility"===i){if(v)for(r=v.length;r--;)v[r].style[i]=s;"DIV"===p&&(s="hidden"===s?"-999em":0,i="top"),d[i]=s,l=!0}else"zIndex"===i?(s&&(d[i]=s),l=!0):"width"===i||"height"===i?(s=pe(0,s),this[i]=s,this.updateClipping?(this[i]=s,this.updateClipping()):d[i]=s,l=!0):"x"===i||"y"===i?(this[i]=s,d[{x:"left",y:"top"}[i]]=s):"class"===i?h.className=s:"stroke"===i?(s=f.color(s,h,i),i="strokecolor"):"stroke-width"===i||"strokeWidth"===i?(h.stroked=s?!0:!1,i="strokeweight",this[i]=s,o(s)&&(s+="px")):"dashstyle"===i?((h.getElementsByTagName("stroke")[0]||m(f.prepVML(["<stroke/>"]),null,null,h))[i]=s||"solid",this.dashstyle=s,l=!0):"fill"===i?"SPAN"===p?d.color=s:(h.filled=s!==$e?!0:!1,s=f.color(s,h,i,this),i="fillcolor"):"shape"===p&&"rotation"===i?(this[i]=s,h.style.left=-ce(ve(s*be)+1)+"px",h.style.top=ce(ge(s*be))+"px"):"translateX"===i||"translateY"===i||"rotation"===i?(this[i]=s,this.updateTransform(),l=!0):"text"===i&&(this.bBox=null,h.innerHTML=s,l=!0);l||(_e?h[i]=s:u(h,i,s))}return b},clip:function(t){var e,i=this,n=i.element,s=n.parentNode;return t?(e=t.members,e.push(i),i.destroyClip=function(){h(e,i)},s&&"highcharts-tracker"===s.className&&!_e&&f(n,{visibility:"hidden"}),t=t.getCSS(i)):(i.destroyClip&&i.destroyClip(),t={clip:_e?"inherit":"rect(auto)"}),i.css(t)},css:I.prototype.htmlCss,safeRemoveChild:function(t){t.parentNode&&S(t)},destroy:function(){return this.destroyClip&&this.destroyClip(),I.prototype.destroy.apply(this)},empty:function(){for(var t,e=this.element.childNodes,i=e.length;i--;)t=e[i],t.parentNode.removeChild(t)},on:function(t,e){return this.element["on"+t]=function(){var t=le.event;t.target=t.srcElement,e(t)},this},cutOffPath:function(t,e){var n,t=t.split(/[ ,]/);return n=t.length,(9===n||11===n)&&(t[n-4]=t[n-2]=i(t[n-2])-10*e),t.join(" ")},shadow:function(t,e,n){var s,r,o,a,l,h,c,u=[],d=this.element,f=this.renderer,g=d.style,v=d.path;if(v&&"string"!=typeof v.value&&(v="x"),l=v,t){for(h=p(t.width,3),c=(t.opacity||.15)/h,s=1;3>=s;s++)a=2*h+1-2*s,n&&(l=this.cutOffPath(v.value,a+.5)),o=['<shape isShadow="true" strokeweight="',a,'" filled="false" path="',l,'" coordsize="10 10" style="',d.style.cssText,'" />'],r=m(f.prepVML(o),null,{left:i(g.left)+p(t.offsetX,1),top:i(g.top)+p(t.offsetY,1)}),n&&(r.cutOff=a+1),o=['<stroke color="',t.color||"black",'" opacity="',c*s,'"/>'],m(f.prepVML(o),null,null,r),e?e.element.appendChild(r):d.parentNode.insertBefore(r,d),u.push(r);this.shadows=u}return this}},ui=g(I,ui);var di={Element:ui,isIE8:xe.indexOf("MSIE 8.0")>-1,init:function(t,e,i){var n,s;this.alignedObjects=[],n=this.createElement(Ne),s=n.element,s.style.position="relative",t.appendChild(n.element),this.box=s,this.boxWrapper=n,this.setSize(e,i,!1),ae.namespaces.hcv||(ae.namespaces.add("hcv","urn:schemas-microsoft-com:vml"),ae.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; } ")},isHidden:function(){return!this.box.offsetWidth},clipRect:function(e,i,n,r){var o=this.createElement(),a=s(e);return t(o,{members:[],left:a?e.x:e,top:a?e.y:i,width:a?e.width:n,height:a?e.height:r,getCSS:function(e){var i=e.inverted,n=this.top,s=this.left,r=s+this.width,o=n+this.height,n={clip:"rect("+ce(i?s:n)+"px,"+ce(i?o:r)+"px,"+ce(i?r:o)+"px,"+ce(i?n:s)+"px)"};return!i&&_e&&"IMG"!==e.element.nodeName&&t(n,{width:r+"px",height:o+"px"}),n},updateClipping:function(){Je(o.members,function(t){t.css(o.getCSS(t))})}})},color:function(t,e,i,n){var s,r,o,a=this,l=/^rgba/,h=$e;if(t&&t.linearGradient?o="gradient":t&&t.radialGradient&&(o="pattern"),o){var c,u,d,p,f,g,v,y,b=t.linearGradient||t.radialGradient,x="",t=t.stops,w=[],k=function(){r=['<fill colors="'+w.join(",")+'" opacity="',f,'" o:opacity2="',p,'" type="',o,'" ',x,'focus="100%" method="any" />'],m(a.prepVML(r),null,null,e)};if(d=t[0],y=t[t.length-1],d[0]>0&&t.unshift([0,d[1]]),y[0]<1&&t.push([1,y[1]]),Je(t,function(t,e){l.test(t[1])?(s=hi(t[1]),c=s.get("rgb"),u=s.get("a")):(c=t[1],u=1),w.push(100*t[0]+"% "+c),e?(f=u,g=c):(p=u,v=c)}),"fill"===i)if("gradient"===o)i=b.x1||b[0]||0,t=b.y1||b[1]||0,d=b.x2||b[2]||0,b=b.y2||b[3]||0,x='angle="'+(90-180*he.atan((b-t)/(d-i))/ye)+'"',k();else{var _,h=b.r,C=2*h,D=2*h,M=b.cx,S=b.cy,T=e.radialReference,h=function(){T&&(_=n.getBBox(),M+=(T[0]-_.x)/_.width-.5,S+=(T[1]-_.y)/_.height-.5,C*=T[2]/_.width,D*=T[2]/_.height),x='src="'+Y.global.VMLRadialGradientURL+'" size="'+C+","+D+'" origin="0.5,0.5" position="'+M+","+S+'" color2="'+v+'" ',k()};n.added?h():ii(n,"add",h),h=g}else h=c}else l.test(t)&&"IMG"!==e.tagName?(s=hi(t),r=["<",i,' opacity="',s.get("a"),'"/>'],m(this.prepVML(r),null,null,e),h=s.get("rgb")):(h=e.getElementsByTagName(i),h.length&&(h[0].opacity=1),h=t);return h},prepVML:function(t){var e=this.isIE8,t=t.join("");return e?(t=t.replace("/>",' xmlns="urn:schemas-microsoft-com:vml" />'),t=-1===t.indexOf('style="')?t.replace("/>",' style="display:inline-block;behavior:url(#default#VML);" />'):t.replace('style="','style="display:inline-block;behavior:url(#default#VML);')):t=t.replace("<","<hcv:"),t},text:ci.prototype.html,path:function(e){var i={coordsize:"10 10"};return r(e)?i.d=e:s(e)&&t(i,e),this.createElement("shape").attr(i)},circle:function(t,e,i){return this.symbol("circle").attr({x:t-i,y:e-i,width:2*i,height:2*i})},g:function(t){var e;return t&&(e={className:"highcharts-"+t,"class":"highcharts-"+t}),this.createElement(Ne).attr(e)},image:function(t,e,i,n,s){var r=this.createElement("img").attr({src:t});return arguments.length>1&&r.attr({x:e,y:i,width:n,height:s}),r},rect:function(t,e,i,n,r,o){s(t)&&(e=t.y,i=t.width,n=t.height,o=t.strokeWidth,t=t.x);var a=this.symbol("rect");return a.r=r,a.attr(a.crisp(o,t,e,pe(i,0),pe(n,0)))},invertChild:function(t,e){var n=e.style;f(t,{flip:"x",left:i(n.width)-1,top:i(n.height)-1,rotation:-90})},symbols:{arc:function(t,e,i,n,s){var r=s.start,o=s.end,a=s.r||i||n,i=ge(r),n=ve(r),l=ge(o),h=ve(o),c=s.innerR,u=.08/a,d=c&&.1/c||0;return 0===o-r?["x"]:(u>2*ye-o+r?l=-u:d>o-r&&(l=ge(r+d)),r=["wa",t-a,e-a,t+a,e+a,t+a*i,e+a*n,t+a*l,e+a*h],s.open&&!c&&r.push("e","M",t,e),r.push("at",t-c,e-c,t+c,e+c,t+c*l,e+c*h,t+c*i,e+c*n,"x","e"),r)},circle:function(t,e,i,n){return["wa",t,e,t+i,e+n,t+i,e+n/2,t+i,e+n/2,"e"]},rect:function(t,e,i,n,s){var r,o=t+i,a=e+n;return c(s)&&s.r?(r=fe(s.r,i,n),o=["M",t+r,e,"L",o-r,e,"wa",o-2*r,e,o,e+2*r,o-r,e,o,e+r,"L",o,a-r,"wa",o-2*r,a-2*r,o,a,o,a-r,o-r,a,"L",t+r,a,"wa",t,a-2*r,t+2*r,a,t+r,a,t,a-r,"L",t,e+r,"wa",t,e,t+2*r,e+2*r,t,e+r,t+r,e,"x","e"]):o=ci.prototype.symbols.square.apply(0,arguments),o}}};ui=function(){this.init.apply(this,arguments)},ui.prototype=ei(ci.prototype,di),j=ui}var pi,fi;Ae&&(pi=function(){Me="http://www.w3.org/1999/xhtml"},pi.prototype.symbols={},fi=function(){function t(){var t,i=e.length;for(t=0;i>t;t++)e[t]();e=[]}var e=[];return{push:function(i,n){0===e.length&&Xe(n,t),e.push(i)}}}()),j=ui||pi||ci,L.prototype={addLabel:function(){var e,i=this.axis,n=i.options,s=i.chart,r=i.horiz,a=i.categories,h=this.pos,u=n.labels,d=i.tickPositions,r=a&&r&&a.length&&!u.step&&!u.staggerLines&&!u.rotation&&s.plotWidth/d.length||!r&&s.plotWidth/2,p=h===d[0],f=h===d[d.length-1],m=a&&c(a[h])?a[h]:h,a=this.label,d=d.info;i.isDatetimeAxis&&d&&(e=n.dateTimeLabelFormats[d.higherRanks[h]||d.unitName]),this.isFirst=p,this.isLast=f,n=i.labelFormatter.call({axis:i,chart:s,isFirst:p,isLast:f,dateTimeLabelFormat:e,value:i.isLog?A(l(m)):m}),h=r&&{width:pe(1,ce(r-2*(u.padding||10)))+"px"},h=t(h,u.style),c(a)?a&&a.attr({text:n}).css(h):(r={align:u.align},o(u.rotation)&&(r.rotation=u.rotation),this.label=c(n)&&u.enabled?s.renderer.text(n,0,0,u.useHTML).attr(r).css(h).add(i.labelGroup):null)},getLabelSize:function(){var t=this.label,e=this.axis;return t?(this.labelBBox=t.getBBox())[e.horiz?"height":"width"]:0},getLabelSides:function(){var t=this.axis.options.labels,e=this.labelBBox.width,t=e*{left:0,center:.5,right:1}[t.align]-t.x;return[-t,e-t]},handleOverflow:function(t,e){var i=!0,n=this.axis,s=n.chart,r=this.isFirst,o=this.isLast,a=e.x,l=n.reversed,h=n.tickPositions;if(r||o){var c=this.getLabelSides(),u=c[0],c=c[1],s=s.plotLeft,d=s+n.len,h=(n=n.ticks[h[t+(r?1:-1)]])&&n.label.xy&&n.label.xy.x+n.getLabelSides()[r?0:1];r&&!l||o&&l?s>a+u&&(a=s-u,n&&a+c>h&&(i=!1)):a+c>d&&(a=d-c,n&&h>a+u&&(i=!1)),e.x=a}return i},getPosition:function(t,e,i,n){var s=this.axis,r=s.chart,o=n&&r.oldChartHeight||r.chartHeight;return{x:t?s.translate(e+i,null,null,n)+s.transB:s.left+s.offset+(s.opposite?(n&&r.oldChartWidth||r.chartWidth)-s.right-s.left:0),y:t?o-s.bottom+s.offset-(s.opposite?s.height:0):o-s.translate(e+i,null,null,n)-s.transB}},getLabelPosition:function(t,e,n,s,r,o,a,l){var h=this.axis,u=h.transA,d=h.reversed,h=h.staggerLines,t=t+r.x-(o&&s?o*u*(d?-1:1):0),e=e+r.y-(o&&!s?o*u*(d?1:-1):0);return c(r.y)||(e+=.9*i(n.styles.lineHeight)-n.getBBox().height/2),h&&(e+=16*(a/(l||1)%h)),{x:t,y:e}},getMarkPath:function(t,e,i,n,s,r){return r.crispLine(["M",t,e,"L",t+(s?0:-i),e+(s?i:0)],n)},render:function(t,e){var i=this.axis,n=i.options,s=i.chart.renderer,r=i.horiz,o=this.type,a=this.label,l=this.pos,h=n.labels,c=this.gridLine,u=o?o+"Grid":"grid",d=o?o+"Tick":"tick",f=n[u+"LineWidth"],m=n[u+"LineColor"],g=n[u+"LineDashStyle"],v=n[d+"Length"],u=n[d+"Width"]||0,y=n[d+"Color"],b=n[d+"Position"],d=this.mark,x=h.step,w=!0,k=i.tickmarkOffset,_=this.getPosition(r,l,k,e),C=_.x,_=_.y,D=i.staggerLines;f&&(l=i.getPlotLinePath(l+k,f,e),c===R&&(c={stroke:m,"stroke-width":f},g&&(c.dashstyle=g),o||(c.zIndex=1),this.gridLine=c=f?s.path(l).attr(c).add(i.gridGroup):null),!e&&c&&l&&c[this.isNew?"attr":"animate"]({d:l})),u&&v&&("inside"===b&&(v=-v),i.opposite&&(v=-v),o=this.getMarkPath(C,_,v,u,r,s),d?d.animate({d:o}):this.mark=s.path(o).attr({stroke:y,"stroke-width":u}).add(i.axisGroup)),a&&!isNaN(C)&&(a.xy=_=this.getLabelPosition(C,_,a,r,h,k,t,x),this.isFirst&&!p(n.showFirstLabel,1)||this.isLast&&!p(n.showLastLabel,1)?w=!1:!D&&r&&"justify"===h.overflow&&!this.handleOverflow(t,_)&&(w=!1),x&&t%x&&(w=!1),w?(a[this.isNew?"attr":"animate"](_),a.show(),this.isNew=!1):a.hide())},destroy:function(){M(this,this.axis)}},N.prototype={render:function(){var t,e=this,i=e.axis,n=i.horiz,s=(i.pointRange||0)/2,r=e.options,o=r.label,l=e.label,h=r.width,u=r.to,d=r.from,f=c(d)&&c(u),m=r.value,g=r.dashStyle,v=e.svgElem,y=[],b=r.color,x=r.zIndex,w=r.events,k=i.chart.renderer;if(i.isLog&&(d=a(d),u=a(u),m=a(m)),h)y=i.getPlotLinePath(m,h),s={stroke:b,"stroke-width":h},g&&(s.dashstyle=g);else{if(!f)return;d=pe(d,i.min-s),u=fe(u,i.max+s),y=i.getPlotBandPath(d,u,r),s={fill:b},r.borderWidth&&(s.stroke=r.borderColor,s["stroke-width"]=r.borderWidth)}if(c(x)&&(s.zIndex=x),v)y?v.animate({d:y},null,v.onGetPath):(v.hide(),v.onGetPath=function(){v.show()});else if(y&&y.length&&(e.svgElem=v=k.path(y).attr(s).add(),w))for(t in r=function(t){v.on(t,function(i){w[t].apply(e,[i])})},w)r(t);return o&&c(o.text)&&y&&y.length&&i.width>0&&i.height>0?(o=ei({align:n&&f&&"center",x:n?!f&&4:10,verticalAlign:!n&&f&&"middle",y:n?f?16:10:f?6:-4,rotation:n&&!f&&90},o),l||(e.label=l=k.text(o.text,0,0).attr({align:o.textAlign||o.align,rotation:o.rotation,zIndex:x}).css(o.style).add()),i=[y[1],y[4],p(y[6],y[1])],y=[y[2],y[5],p(y[7],y[2])],n=C(i),f=C(y),l.align(o,!1,{x:n,y:f,width:D(i)-n,height:D(y)-f}),l.show()):l&&l.hide(),e},destroy:function(){h(this.axis.plotLinesAndBands,this),M(this,this.axis)}},$.prototype={destroy:function(){M(this,this.axis)},setTotal:function(t){this.cum=this.total=t},render:function(t){var e=this.options.formatter.call(this);this.label?this.label.attr({text:e,visibility:"hidden"}):this.label=this.axis.chart.renderer.text(e,0,0).css(this.options.style).attr({align:this.textAlign,rotation:this.options.rotation,visibility:"hidden"}).add(t)},setOffset:function(t,e){var i=this.axis,n=i.chart,s=n.inverted,r=this.isNegative,o=i.translate(this.percent?100:this.total,0,0,0,1),i=i.translate(0),i=me(o-i),a=n.xAxis[0].translate(this.x)+t,l=n.plotHeight,r={x:s?r?o:o-i:a,y:s?l-a-e:r?l-o-i:l-o,width:s?i:e,height:s?e:i};(s=this.label)&&(s.align(this.alignOptions,null,r),r=s.alignAttr,s.attr({visibility:this.options.crop===!1||n.isInsidePlot(r.x,r.y)?Se?"inherit":"visible":"hidden"}))}},z.prototype={defaultOptions:{dateTimeLabelFormats:{millisecond:"%H:%M:%S.%L",second:"%H:%M:%S",minute:"%H:%M",hour:"%H:%M",day:"%e. %b",week:"%e. %b",month:"%b '%y",year:"%Y"},endOnTick:!1,gridLineColor:"#C0C0C0",labels:Ge,lineColor:"#C0D0E0",lineWidth:1,minPadding:.01,maxPadding:.01,minorGridLineColor:"#E0E0E0",minorGridLineWidth:1,minorTickColor:"#A0A0A0",minorTickLength:2,minorTickPosition:"outside",startOfWeek:1,startOnTick:!1,tickColor:"#C0D0E0",tickLength:5,tickmarkPlacement:"between",tickPixelInterval:100,tickPosition:"outside",tickWidth:1,title:{align:"middle",style:{color:"#6D869F",fontWeight:"bold"}},type:"linear"},defaultYAxisOptions:{endOnTick:!0,gridLineWidth:1,tickPixelInterval:72,showLastLabel:!0,labels:{align:"right",x:-8,y:3},lineWidth:0,maxPadding:.05,minPadding:.05,startOnTick:!0,tickWidth:0,title:{rotation:270,text:"Y-values"},stackLabels:{enabled:!1,formatter:function(){return this.total},style:Ge.style}},defaultLeftAxisOptions:{labels:{align:"right",x:-8,y:null},title:{rotation:270}},defaultRightAxisOptions:{labels:{align:"left",x:8,y:null},title:{rotation:90}},defaultBottomAxisOptions:{labels:{align:"center",x:0,y:14},title:{rotation:0}},defaultTopAxisOptions:{labels:{align:"center",x:0,y:-5},title:{rotation:0}},init:function(t,e){var i=e.isX;this.horiz=t.inverted?!i:i,this.xOrY=(this.isXAxis=i)?"x":"y",this.opposite=e.opposite,this.side=this.horiz?this.opposite?0:2:this.opposite?1:3,this.setOptions(e);var n=this.options,s=n.type,r="datetime"===s;this.labelFormatter=n.labels.formatter||this.defaultLabelFormatter,this.staggerLines=this.horiz&&n.labels.staggerLines,this.userOptions=e,this.minPixelPadding=0,this.chart=t,this.reversed=n.reversed,this.categories=n.categories,this.isLog="logarithmic"===s,this.isLinked=c(n.linkedTo),this.isDatetimeAxis=r,this.tickmarkOffset=n.categories&&"between"===n.tickmarkPlacement?.5:0,this.ticks={},this.minorTicks={},this.plotLinesAndBands=[],this.alternateBands={},this.len=0,this.minRange=this.userMinRange=n.minRange||n.maxZoom,this.range=n.range,this.offset=n.offset||0,this.stacks={},this.min=this.max=null;var o,n=this.options.events;t.axes.push(this),t[i?"xAxis":"yAxis"].push(this),this.series=[],t.inverted&&i&&this.reversed===R&&(this.reversed=!0),this.removePlotLine=this.removePlotBand=this.removePlotBandOrLine,this.addPlotLine=this.addPlotBand=this.addPlotBandOrLine;for(o in n)ii(this,o,n[o]);this.isLog&&(this.val2lin=a,this.lin2val=l)},setOptions:function(t){this.options=ei(this.defaultOptions,this.isXAxis?{}:this.defaultYAxisOptions,[this.defaultTopAxisOptions,this.defaultRightAxisOptions,this.defaultBottomAxisOptions,this.defaultLeftAxisOptions][this.side],ei(Y[this.isXAxis?"xAxis":"yAxis"],t))},defaultLabelFormatter:function(){var t,e=this.axis,i=this.value,n=this.dateTimeLabelFormat,s=Y.lang.numericSymbols,r=s&&s.length,o=e.isLog?i:e.tickInterval;if(e.categories)t=i;else if(n)t=V(n,i);else if(r&&o>=1e3)for(;r--&&t===R;)e=Math.pow(1e3,r+1),o>=e&&null!==s[r]&&(t=v(i/e,-1)+s[r]);return t===R&&(t=i>=1e3?v(i,0):v(i,-1)),t},getSeriesExtremes:function(){var t,e=this,i=e.chart,n=e.stacks,s=[],r=[];e.hasVisibleSeries=!1,e.dataMin=e.dataMax=null,Je(e.series,function(o){if(o.visible||!i.options.chart.ignoreHiddenSeries){var a,l,h,u,d,f,m,g,v,y,b=o.options,x=b.threshold,w=[],k=0;if(e.hasVisibleSeries=!0,e.isLog&&0>=x&&(x=b.threshold=null),e.isXAxis)b=o.xData,b.length&&(e.dataMin=fe(p(e.dataMin,b[0]),C(b)),e.dataMax=pe(p(e.dataMax,b[0]),D(b)));else{var _,M,S,T=o.cropped,E=o.xAxis.getExtremes(),F=!!o.modifyValue;for(a=b.stacking,e.usePercentage="percent"===a,a&&(d=b.stack,u=o.type+p(d,""),f="-"+u,o.stackKey=u,l=s[u]||[],s[u]=l,h=r[f]||[],r[f]=h),e.usePercentage&&(e.dataMin=0,e.dataMax=99),b=o.processedXData,m=o.processedYData,y=m.length,t=0;y>t;t++)if(g=b[t],v=m[t],a&&(M=(_=x>v)?h:l,S=_?f:u,v=M[g]=c(M[g])?A(M[g]+v):v,n[S]||(n[S]={}),n[S][g]||(n[S][g]=new $(e,e.options.stackLabels,_,g,d,a)),n[S][g].setTotal(v)),null!==v&&v!==R&&(F&&(v=o.modifyValue(v)),T||(b[t+1]||g)>=E.min&&(b[t-1]||g)<=E.max))if(g=v.length)for(;g--;)null!==v[g]&&(w[k++]=v[g]);else w[k++]=v;!e.usePercentage&&w.length&&(e.dataMin=fe(p(e.dataMin,w[0]),C(w)),e.dataMax=pe(p(e.dataMax,w[0]),D(w))),c(x)&&(e.dataMin>=x?(e.dataMin=x,e.ignoreMinPadding=!0):e.dataMax<x&&(e.dataMax=x,e.ignoreMaxPadding=!0))}}})},translate:function(t,e,i,n,s,r){var o=this.len,a=1,l=0,h=n?this.oldTransA:this.transA,n=n?this.oldMin:this.min,s=this.options.ordinal||this.isLog&&s;return h||(h=this.transA),i&&(a*=-1,l=o),this.reversed&&(a*=-1,l-=a*o),e?(this.reversed&&(t=o-t),t=t/h+n,s&&(t=this.lin2val(t))):(s&&(t=this.val2lin(t)),t=a*(t-n)*h+l+a*this.minPixelPadding+(r?h*this.pointRange/2:0)),t},getPlotLinePath:function(t,e,i){var n,s,r,o,a=this.chart,l=this.left,h=this.top,t=this.translate(t,null,null,i),c=i&&a.oldChartHeight||a.chartHeight,u=i&&a.oldChartWidth||a.chartWidth;return n=this.transB,i=s=ce(t+n),n=r=ce(c-t-n),isNaN(t)?o=!0:this.horiz?(n=h,r=c-this.bottom,(l>i||i>l+this.width)&&(o=!0)):(i=l,s=u-this.right,(h>n||n>h+this.height)&&(o=!0)),o?null:a.renderer.crispLine(["M",i,n,"L",s,r],e||0)},getPlotBandPath:function(t,e){var i=this.getPlotLinePath(e),n=this.getPlotLinePath(t);return n&&i?n.push(i[4],i[5],i[1],i[2]):n=null,n},getLinearTickPositions:function(t,e,i){for(var n,e=A(ue(e/t)*t),i=A(de(i/t)*t),s=[];i>=e&&(s.push(e),e=A(e+t),e!==n);)n=e;return s},getLogTickPositions:function(t,e,i,n){var s=this.options,r=this.len,o=[];if(n||(this._minorAutoInterval=null),t>=.5)t=ce(t),o=this.getLinearTickPositions(t,e,i);else if(t>=.08)for(var h,c,u,d,f,r=ue(e),s=t>.3?[1,2,4]:t>.15?[1,2,4,6,8]:[1,2,3,4,5,6,7,8,9];i+1>r&&!f;r++)for(c=s.length,h=0;c>h&&!f;h++)u=a(l(r)*s[h]),u>e&&o.push(d),d>i&&(f=!0),d=u;else e=l(e),i=l(i),t=s[n?"minorTickInterval":"tickInterval"],t=p("auto"===t?null:t,this._minorAutoInterval,(i-e)*(s.tickPixelInterval/(n?5:1))/((n?r/this.tickPositions.length:r)||1)),t=b(t,null,he.pow(10,ue(he.log(t)/he.LN10))),o=ti(this.getLinearTickPositions(t,e,i),a),n||(this._minorAutoInterval=t/5);return n||(this.tickInterval=t),o},getMinorTickPositions:function(){var t,e,i=this.tickPositions,n=this.minorTickInterval,s=[];if(this.isLog)for(e=i.length,t=1;e>t;t++)s=s.concat(this.getLogTickPositions(n,i[t-1],i[t],!0));else for(i=this.min+(i[0]-this.min)%n;i<=this.max;i+=n)s.push(i);return s},adjustForMinRange:function(){var t,e,i,n,s,r,o=this.options,a=this.min,l=this.max,h=this.dataMax-this.dataMin>=this.minRange;if(this.isXAxis&&this.minRange===R&&!this.isLog&&(c(o.min)||c(o.max)?this.minRange=null:(Je(this.series,function(t){for(s=t.xData,i=r=t.xIncrement?1:s.length-1;i>0;i--)n=s[i]-s[i-1],(e===R||e>n)&&(e=n)}),this.minRange=fe(5*e,this.dataMax-this.dataMin))),l-a<this.minRange){var u=this.minRange;t=(u-l+a)/2,t=[a-t,p(o.min,a-t)],h&&(t[2]=this.dataMin),a=D(t),l=[a+u,p(o.max,a+u)],h&&(l[2]=this.dataMax),l=C(l),u>l-a&&(t[0]=l-u,t[1]=p(o.min,l-u),a=D(t))}this.min=a,this.max=l},setAxisTranslation:function(){var t,e=this.max-this.min,i=0,n=0,s=0,r=this.linkedParent,o=this.transA;this.isXAxis&&(r?(n=r.minPointOffset,s=r.pointRangePadding):Je(this.series,function(e){var r=e.pointRange,o=e.options.pointPlacement,a=e.closestPointRange;i=pe(i,r),n=pe(n,o?0:r/2),s=pe(s,"on"===o?0:r),!e.noSharedTooltip&&c(a)&&(t=c(t)?fe(t,a):a)}),this.minPointOffset=n,this.pointRangePadding=s,this.pointRange=i,this.closestPointRange=t),this.oldTransA=o,this.translationSlope=this.transA=o=this.len/(e+s||1),this.transB=this.horiz?this.left:this.bottom,this.minPixelPadding=o*n},setTickPositions:function(t){var e=this,i=e.chart,n=e.options,s=e.isLog,r=e.isDatetimeAxis,o=e.isXAxis,l=e.isLinked,h=e.options.tickPositioner,u=n.maxPadding,d=n.minPadding,f=n.tickInterval,m=n.minTickInterval,g=n.tickPixelInterval,v=e.categories;l?(e.linkedParent=i[o?"xAxis":"yAxis"][n.linkedTo],i=e.linkedParent.getExtremes(),e.min=p(i.min,i.dataMin),e.max=p(i.max,i.dataMax),n.type!==e.linkedParent.options.type&&T(11,1)):(e.min=p(e.userMin,n.min,e.dataMin),e.max=p(e.userMax,n.max,e.dataMax)),s&&(!t&&fe(e.min,p(e.dataMin,e.min))<=0&&T(10,1),e.min=A(a(e.min)),e.max=A(a(e.max))),e.range&&(e.userMin=e.min=pe(e.min,e.max-e.range),e.userMax=e.max,t)&&(e.range=null),e.adjustForMinRange(),v||e.usePercentage||l||!c(e.min)||!c(e.max)||(i=e.max-e.min||1,c(n.min)||c(e.userMin)||!d||!(e.dataMin<0)&&e.ignoreMinPadding||(e.min-=i*d),c(n.max)||c(e.userMax)||!u||!(e.dataMax>0)&&e.ignoreMaxPadding||(e.max+=i*u)),e.tickInterval=e.min===e.max||void 0===e.min||void 0===e.max?1:l&&!f&&g===e.linkedParent.options.tickPixelInterval?e.linkedParent.tickInterval:p(f,v?1:(e.max-e.min)*g/(e.len||1)),o&&!t&&Je(e.series,function(t){t.processData(e.min!==e.oldMin||e.max!==e.oldMax)}),e.setAxisTranslation(t),e.beforeSetTickPositions&&e.beforeSetTickPositions(),e.postProcessTickInterval&&(e.tickInterval=e.postProcessTickInterval(e.tickInterval)),!f&&e.tickInterval<m&&(e.tickInterval=m),r||s||(t=he.pow(10,ue(he.log(e.tickInterval)/he.LN10)),f)||(e.tickInterval=b(e.tickInterval,null,t,n)),e.minorTickInterval="auto"===n.minorTickInterval&&e.tickInterval?e.tickInterval/5:n.minorTickInterval,e.tickPositions=h=n.tickPositions||h&&h.apply(e,[e.min,e.max]),h||(h=r?(e.getNonLinearTimeTicks||w)(x(e.tickInterval,n.units),e.min,e.max,n.startOfWeek,e.ordinalPositions,e.closestPointRange,!0):s?e.getLogTickPositions(e.tickInterval,e.min,e.max):e.getLinearTickPositions(e.tickInterval,e.min,e.max),e.tickPositions=h),l||(s=h[0],r=h[h.length-1],l=e.minPointOffset||0,n.startOnTick?e.min=s:e.min-l>s&&h.shift(),n.endOnTick?e.max=r:e.max+l<r&&h.pop())},setMaxTicks:function(){var t=this.chart,e=t.maxTicks,i=this.tickPositions,n=this.xOrY;e||(e={x:0,y:0}),!this.isLinked&&!this.isDatetimeAxis&&i.length>e[n]&&this.options.alignTicks!==!1&&(e[n]=i.length),t.maxTicks=e},adjustTickAmount:function(){var t=this.xOrY,e=this.tickPositions,i=this.chart.maxTicks;if(i&&i[t]&&!this.isDatetimeAxis&&!this.categories&&!this.isLinked&&this.options.alignTicks!==!1){var n=this.tickAmount,s=e.length;if(this.tickAmount=t=i[t],t>s){for(;e.length<t;)e.push(A(e[e.length-1]+this.tickInterval));this.transA*=(s-1)/(t-1),this.max=e[e.length-1]}c(n)&&t!==n&&(this.isDirty=!0)}},setScale:function(){var t,e,i,n,s=this.stacks;if(this.oldMin=this.min,this.oldMax=this.max,this.oldAxisLength=this.len,this.setAxisSize(),n=this.len!==this.oldAxisLength,Je(this.series,function(t){(t.isDirtyData||t.isDirty||t.xAxis.isDirty)&&(i=!0)}),(n||i||this.isLinked||this.userMin!==this.oldUserMin||this.userMax!==this.oldUserMax)&&(this.getSeriesExtremes(),this.setTickPositions(),this.oldUserMin=this.userMin,this.oldUserMax=this.userMax,this.isDirty||(this.isDirty=n||this.min!==this.oldMin||this.max!==this.oldMax)),!this.isXAxis)for(t in s)for(e in s[t])s[t][e].cum=s[t][e].total;this.setMaxTicks()},setExtremes:function(e,i,n,s,r){var o=this,a=o.chart,n=p(n,!0),r=t(r,{min:e,max:i});si(o,"setExtremes",r,function(){o.userMin=e,o.userMax=i,o.isDirtyExtremes=!0,n&&a.redraw(s)})},zoom:function(t,e){return this.setExtremes(t,e,!1,R,{trigger:"zoom"}),!0},setAxisSize:function(){var t=this.chart,e=this.options,i=e.offsetLeft||0,n=e.offsetRight||0;this.left=p(e.left,t.plotLeft+i),this.top=p(e.top,t.plotTop),this.width=p(e.width,t.plotWidth-i+n),this.height=p(e.height,t.plotHeight),this.bottom=t.chartHeight-this.height-this.top,this.right=t.chartWidth-this.width-this.left,this.len=pe(this.horiz?this.width:this.height,0)},getExtremes:function(){var t=this.isLog;return{min:t?A(l(this.min)):this.min,max:t?A(l(this.max)):this.max,dataMin:this.dataMin,dataMax:this.dataMax,userMin:this.userMin,userMax:this.userMax}},getThreshold:function(t){var e=this.isLog,i=e?l(this.min):this.min,e=e?l(this.max):this.max;return i>t||null===t?t=i:t>e&&(t=e),this.translate(t,0,1,0,1)},addPlotBandOrLine:function(t){return t=new N(this,t).render(),this.plotLinesAndBands.push(t),t},getOffset:function(){var t,e,i,n=this,s=n.chart,r=s.renderer,o=n.options,a=n.tickPositions,l=n.ticks,h=n.horiz,u=n.side,d=0,f=0,m=o.title,g=o.labels,v=0,y=s.axisOffset,b=[-1,1,1,-1][u];if(n.hasData=s=n.hasVisibleSeries||c(n.min)&&c(n.max)&&!!a,n.showAxis=t=s||p(o.showEmpty,!0),n.axisGroup||(n.gridGroup=r.g("grid").attr({zIndex:o.gridZIndex||1}).add(),n.axisGroup=r.g("axis").attr({zIndex:o.zIndex||2}).add(),n.labelGroup=r.g("axis-labels").attr({zIndex:g.zIndex||7}).add()),s||n.isLinked)Je(a,function(t){l[t]?l[t].addLabel():l[t]=new L(n,t)}),Je(a,function(t){(0===u||2===u||{1:"left",3:"right"}[u]===g.align)&&(v=pe(l[t].getLabelSize(),v))}),n.staggerLines&&(v+=16*(n.staggerLines-1));else for(i in l)l[i].destroy(),delete l[i];m&&m.text&&(n.axisTitle||(n.axisTitle=r.text(m.text,0,0,m.useHTML).attr({zIndex:7,rotation:m.rotation||0,align:m.textAlign||{low:"left",middle:"center",high:"right"}[m.align]}).css(m.style).add(n.axisGroup),n.axisTitle.isNew=!0),t&&(d=n.axisTitle.getBBox()[h?"height":"width"],f=p(m.margin,h?5:10),e=m.offset),n.axisTitle[t?"show":"hide"]()),n.offset=b*p(o.offset,y[u]),n.axisTitleMargin=p(e,v+f+(2!==u&&v&&b*o.labels[h?"y":"x"])),y[u]=pe(y[u],n.axisTitleMargin+d+b*n.offset)},getLinePath:function(t){var e=this.chart,i=this.opposite,n=this.offset,s=this.horiz,r=this.left+(i?this.width:0)+n;return this.lineTop=i=e.chartHeight-this.bottom-(i?this.height:0)+n,e.renderer.crispLine(["M",s?this.left:r,s?i:this.top,"L",s?e.chartWidth-this.right:r,s?i:e.chartHeight-this.bottom],t)},getTitlePosition:function(){var t=this.horiz,e=this.left,n=this.top,s=this.len,r=this.options.title,o=t?e:n,a=this.opposite,l=this.offset,h=i(r.style.fontSize||12),s={low:o+(t?0:s),middle:o+s/2,high:o+(t?s:0)}[r.align],e=(t?n+this.height:e)+(t?1:-1)*(a?-1:1)*this.axisTitleMargin+(2===this.side?h:0);return{x:t?s:e+(a?this.width:0)+l+(r.x||0),y:t?e-(a?this.height:0)+l:s+(r.y||0)}},render:function(){var t,e,i,n=this,s=n.chart,r=s.renderer,o=n.options,a=n.isLog,h=n.isLinked,u=n.tickPositions,d=n.axisTitle,p=n.stacks,f=n.ticks,m=n.minorTicks,g=n.alternateBands,v=o.stackLabels,y=o.alternateGridColor,b=n.tickmarkOffset,x=o.lineWidth,w=s.hasRendered&&c(n.oldMin)&&!isNaN(n.oldMin),k=n.showAxis;if((n.hasData||h)&&(n.minorTickInterval&&!n.categories&&Je(n.getMinorTickPositions(),function(t){m[t]||(m[t]=new L(n,t,"minor")),w&&m[t].isNew&&m[t].render(null,!0),m[t].isActive=!0,m[t].render()}),Je(u.slice(1).concat([u[0]]),function(t,e){e=e===u.length-1?0:e+1,(!h||t>=n.min&&t<=n.max)&&(f[t]||(f[t]=new L(n,t)),w&&f[t].isNew&&f[t].render(e,!0),f[t].isActive=!0,f[t].render(e))}),y&&Je(u,function(t,s){0===s%2&&t<n.max&&(g[t]||(g[t]=new N(n)),e=t+b,i=u[s+1]!==R?u[s+1]+b:n.max,g[t].options={from:a?l(e):e,to:a?l(i):i,color:y},g[t].render(),g[t].isActive=!0)}),n._addedPlotLB||(Je((o.plotLines||[]).concat(o.plotBands||[]),function(t){n.addPlotBandOrLine(t)}),n._addedPlotLB=!0)),Je([f,m,g],function(t){for(var e in t)t[e].isActive?t[e].isActive=!1:(t[e].destroy(),delete t[e])}),x&&(t=n.getLinePath(x),n.axisLine?n.axisLine.animate({d:t}):n.axisLine=r.path(t).attr({stroke:o.lineColor,"stroke-width":x,zIndex:7}).add(n.axisGroup),n.axisLine[k?"show":"hide"]()),d&&k&&(d[d.isNew?"attr":"animate"](n.getTitlePosition()),d.isNew=!1),v&&v.enabled){var _,C,o=n.stackTotalGroup;o||(n.stackTotalGroup=o=r.g("stack-labels").attr({visibility:"visible",zIndex:6}).add()),o.translate(s.plotLeft,s.plotTop);for(_ in p)for(C in s=p[_])s[C].render(o)}n.isDirty=!1},removePlotBandOrLine:function(t){for(var e=this.plotLinesAndBands,i=e.length;i--;)e[i].id===t&&e[i].destroy()},setTitle:function(t,e){var i=this.chart,n=this.options,s=this.axisTitle;n.title=ei(n.title,t),this.axisTitle=s&&s.destroy(),this.isDirty=!0,p(e,!0)&&i.redraw()},redraw:function(){var t=this.chart;t.tracker.resetTracker&&t.tracker.resetTracker(!0),this.render(),Je(this.plotLinesAndBands,function(t){t.render()}),Je(this.series,function(t){t.isDirty=!0
387
+ })},setCategories:function(t,e){var i=this.chart;this.categories=this.userOptions.categories=t,Je(this.series,function(t){t.translate(),t.setTooltipPoints(!0)}),this.isDirty=!0,p(e,!0)&&i.redraw()},destroy:function(){var t,e=this,i=e.stacks;ni(e);for(t in i)M(i[t]),i[t]=null;Je([e.ticks,e.minorTicks,e.alternateBands,e.plotLinesAndBands],function(t){M(t)}),Je("stackTotalGroup,axisLine,axisGroup,gridGroup,labelGroup,axisTitle".split(","),function(t){e[t]&&(e[t]=e[t].destroy())})}},P.prototype={destroy:function(){Je(this.crosshairs,function(t){t&&t.destroy()}),this.label&&(this.label=this.label.destroy())},move:function(e,i,n,s){var r=this,o=r.now,a=r.options.animation!==!1&&!r.isHidden;t(o,{x:a?(2*o.x+e)/3:e,y:a?(o.y+i)/2:i,anchorX:a?(2*o.anchorX+n)/3:n,anchorY:a?(o.anchorY+s)/2:s}),r.label.attr(o),a&&(me(e-o.x)>1||me(i-o.y)>1)&&(clearTimeout(this.tooltipTimeout),this.tooltipTimeout=setTimeout(function(){r&&r.move(e,i,n,s)},32))},hide:function(){if(!this.isHidden){var t=this.chart.hoverPoints;this.label.hide(),t&&Je(t,function(t){t.setState()}),this.chart.hoverPoints=null,this.isHidden=!0}},hideCrosshairs:function(){Je(this.crosshairs,function(t){t&&t.hide()})},getAnchor:function(t,e){var i,n,s=this.chart,r=s.inverted,o=0,a=0,t=d(t);return i=t[0].tooltipPos,i||(Je(t,function(t){n=t.series.yAxis,o+=t.plotX,a+=(t.plotLow?(t.plotLow+t.plotHigh)/2:t.plotY)+(!r&&n?n.top-s.plotTop:0)}),o/=t.length,a/=t.length,i=[r?s.plotWidth-a:o,this.shared&&!r&&t.length>1&&e?e.chartY-s.plotTop:r?s.plotHeight-o:a]),ti(i,ce)},getPosition:function(t,e,i){var n,s=this.chart,r=s.plotLeft,o=s.plotTop,a=s.plotWidth,l=s.plotHeight,h=p(this.options.distance,12),c=i.plotX,i=i.plotY,s=c+r+(s.inverted?h:-t-h),u=i-e+o+15;return 7>s&&(s=r+pe(c,0)+h),s+t>r+a&&(s-=s+t-(r+a),u=i-e+o-h,n=!0),o+5>u&&(u=o+5,n&&i>=u&&u+e>=i&&(u=i+o+h)),u+e>o+l&&(u=pe(o,o+l-e-h)),{x:s,y:u}},refresh:function(t,e){function i(){var t,e=this.points||d(this),i=e[0].series;return t=[i.tooltipHeaderFormatter(e[0].key)],Je(e,function(e){i=e.series,t.push(i.tooltipFormatter&&i.tooltipFormatter(e)||e.point.tooltipFormatter(i.tooltipOptions.pointFormat))}),t.push(h.footerFormat||""),t.join("")}var n,s,r,o,a=this.chart,l=this.label,h=this.options,c={},u=[];o=h.formatter||i;var f,c=a.hoverPoints,m=h.crosshairs;if(r=this.shared,s=this.getAnchor(t,e),n=s[0],s=s[1],!r||t.series&&t.series.noSharedTooltip?c=t.getLabelConfig():(a.hoverPoints=t,c&&Je(c,function(t){t.setState()}),Je(t,function(t){t.setState("hover"),u.push(t.getLabelConfig())}),c={x:t[0].category,y:t[0].y},c.points=u,t=t[0]),o=o.call(c),c=t.series,r=r||!c.isCartesian||c.tooltipOutsidePlot||a.isInsidePlot(n,s),o!==!1&&r?(this.isHidden&&l.show(),l.attr({text:o}),f=h.borderColor||t.color||c.color||"#606060",l.attr({stroke:f}),l=(h.positioner||this.getPosition).call(this,l.width,l.height,{plotX:n,plotY:s}),this.move(ce(l.x),ce(l.y),n+a.plotLeft,s+a.plotTop),this.isHidden=!1):this.hide(),m)for(m=d(m),l=m.length;l--;)r=t.series[l?"yAxis":"xAxis"],m[l]&&r&&(r=r.getPlotLinePath(l?p(t.stackY,t.y):t.x,1),this.crosshairs[l]?this.crosshairs[l].attr({d:r,visibility:"visible"}):(c={"stroke-width":m[l].width||1,stroke:m[l].color||"#C0C0C0",zIndex:m[l].zIndex||2},m[l].dashStyle&&(c.dashstyle=m[l].dashStyle),this.crosshairs[l]=a.renderer.path(r).attr(c).add()));si(a,"tooltipRefresh",{text:o,x:n+a.plotLeft,y:s+a.plotTop,borderColor:f})}},O.prototype={normalizeMouseEvent:function(e){var i,n,s,e=e||le.event;return e.target||(e.target=e.srcElement),e=ri(e),s=e.touches?e.touches.item(0):e,this.chartPosition=i=Qe(this.chart.container),s.pageX===R?(n=e.x,i=e.y):(n=s.pageX-i.left,i=s.pageY-i.top),t(e,{chartX:ce(n),chartY:ce(i)})},getMouseCoordinates:function(t){var e={xAxis:[],yAxis:[]},i=this.chart;return Je(i.axes,function(n){var s=n.isXAxis;e[s?"xAxis":"yAxis"].push({axis:n,value:n.translate(((i.inverted?!s:s)?t.chartX-i.plotLeft:n.top+n.len-t.chartY)-n.minPixelPadding,!0)})}),e},getIndex:function(t){var e=this.chart;return e.inverted?e.plotHeight+e.plotTop-t.chartY:t.chartX-e.plotLeft},onmousemove:function(t){var e,i,n,s=this.chart,r=s.series,o=s.tooltip,a=s.hoverPoint,l=s.hoverSeries,h=s.chartWidth,c=this.getIndex(t);if(o&&this.options.tooltip.shared&&(!l||!l.noSharedTooltip)){for(e=[],i=r.length,n=0;i>n;n++)r[n].visible&&r[n].options.enableMouseTracking!==!1&&!r[n].noSharedTooltip&&r[n].tooltipPoints.length&&(s=r[n].tooltipPoints[c],s._dist=me(c-s[r[n].xAxis.tooltipPosName||"plotX"]),h=fe(h,s._dist),e.push(s));for(i=e.length;i--;)e[i]._dist>h&&e.splice(i,1);e.length&&e[0].plotX!==this.hoverX&&(o.refresh(e,t),this.hoverX=e[0].plotX)}l&&l.tracker&&(s=l.tooltipPoints[c])&&s!==a&&s.onMouseOver()},resetTracker:function(t){var e=this.chart,i=e.hoverSeries,n=e.hoverPoint,s=e.tooltip,e=s&&s.shared?e.hoverPoints:n;(t=t&&s&&e)&&d(e)[0].plotX===R&&(t=!1),t?s.refresh(e):(n&&n.onMouseOut(),i&&i.onMouseOut(),s&&(s.hide(),s.hideCrosshairs()),this.hoverX=null)},setDOMEvents:function(){function e(){if(n.selectionMarker){var t,o={xAxis:[],yAxis:[]},a=n.selectionMarker.getBBox(),l=a.x-s.plotLeft,h=a.y-s.plotTop;i&&(Je(s.axes,function(e){if(e.options.zoomEnabled!==!1){var i=e.isXAxis,n=s.inverted?!i:i,r=e.translate(n?l:s.plotHeight-h-a.height,!0,0,0,1),n=e.translate((n?l+a.width:s.plotHeight-h)-2*e.minPixelPadding,!0,0,0,1);!isNaN(r)&&!isNaN(n)&&(o[i?"xAxis":"yAxis"].push({axis:e,min:fe(r,n),max:pe(r,n)}),t=!0)}}),t&&si(s,"selection",o,function(t){s.zoom(t)})),n.selectionMarker=n.selectionMarker.destroy()}s&&(f(r,{cursor:"auto"}),s.cancelClick=i,s.mouseIsDown=i=!1),ni(ae,Ee?"touchend":"mouseup",e)}var i,n=this,s=n.chart,r=s.container,o=n.zoomX&&!s.inverted||n.zoomY&&s.inverted,a=n.zoomY&&!s.inverted||n.zoomX&&s.inverted;n.hideTooltipOnMouseMove=function(t){t=ri(t),n.chartPosition&&s.hoverSeries&&s.hoverSeries.isCartesian&&!s.isInsidePlot(t.pageX-n.chartPosition.left-s.plotLeft,t.pageY-n.chartPosition.top-s.plotTop)&&n.resetTracker()},n.hideTooltipOnMouseLeave=function(){n.resetTracker(),n.chartPosition=null},r.onmousedown=function(t){t=n.normalizeMouseEvent(t),!Ee&&t.preventDefault&&t.preventDefault(),s.mouseIsDown=!0,s.cancelClick=!1,s.mouseDownX=n.mouseDownX=t.chartX,n.mouseDownY=t.chartY,ii(ae,Ee?"touchend":"mouseup",e)};var l=function(t){if(!(t&&t.touches&&t.touches.length>1)){t=n.normalizeMouseEvent(t),Ee||(t.returnValue=!1);var e=t.chartX,r=t.chartY,l=!s.isInsidePlot(e-s.plotLeft,r-s.plotTop);if(Ee&&"touchstart"===t.type&&(u(t.target,"isTracker")?s.runTrackerClick||t.preventDefault():!s.runChartClick&&!l&&t.preventDefault()),l&&(e<s.plotLeft?e=s.plotLeft:e>s.plotLeft+s.plotWidth&&(e=s.plotLeft+s.plotWidth),r<s.plotTop?r=s.plotTop:r>s.plotTop+s.plotHeight&&(r=s.plotTop+s.plotHeight)),s.mouseIsDown&&"touchstart"!==t.type&&(i=Math.sqrt(Math.pow(n.mouseDownX-e,2)+Math.pow(n.mouseDownY-r,2)),i>10)){var h=s.isInsidePlot(n.mouseDownX-s.plotLeft,n.mouseDownY-s.plotTop);if(s.hasCartesianSeries&&(n.zoomX||n.zoomY)&&h&&!n.selectionMarker&&(n.selectionMarker=s.renderer.rect(s.plotLeft,s.plotTop,o?1:s.plotWidth,a?1:s.plotHeight,0).attr({fill:n.options.chart.selectionMarkerFill||"rgba(69,114,167,0.25)",zIndex:7}).add()),n.selectionMarker&&o){var c=e-n.mouseDownX;n.selectionMarker.attr({width:me(c),x:(c>0?0:c)+n.mouseDownX})}n.selectionMarker&&a&&(r-=n.mouseDownY,n.selectionMarker.attr({height:me(r),y:(r>0?0:r)+n.mouseDownY})),h&&!n.selectionMarker&&n.options.chart.panning&&s.pan(e)}return l||n.onmousemove(t),l||!s.hasCartesianSeries}};r.onmousemove=l,ii(r,"mouseleave",n.hideTooltipOnMouseLeave),ii(ae,"mousemove",n.hideTooltipOnMouseMove),r.ontouchstart=function(t){(n.zoomX||n.zoomY)&&r.onmousedown(t),l(t)},r.ontouchmove=l,r.ontouchend=function(){i&&n.resetTracker()},r.onclick=function(e){var i,r,o=s.hoverPoint,e=n.normalizeMouseEvent(e);e.cancelBubble=!0,s.cancelClick||(o&&(u(e.target,"isTracker")||u(e.target.parentNode,"isTracker"))?(i=o.plotX,r=o.plotY,t(o,{pageX:n.chartPosition.left+s.plotLeft+(s.inverted?s.plotWidth-r:i),pageY:n.chartPosition.top+s.plotTop+(s.inverted?s.plotHeight-i:r)}),si(o.series,"click",t(e,{point:o})),o.firePointEvent("click",e)):(t(e,n.getMouseCoordinates(e)),s.isInsidePlot(e.chartX-s.plotLeft,e.chartY-s.plotTop)&&si(s,"click",e)))}},destroy:function(){var t=this.chart,e=t.container;t.trackerGroup&&(t.trackerGroup=t.trackerGroup.destroy()),ni(e,"mouseleave",this.hideTooltipOnMouseLeave),ni(ae,"mousemove",this.hideTooltipOnMouseMove),e.onclick=e.onmousedown=e.onmousemove=e.ontouchstart=e.ontouchend=e.ontouchmove=null,clearInterval(this.tooltipTimeout)},init:function(t,e){t.trackerGroup||(t.trackerGroup=t.renderer.g("tracker").attr({zIndex:9}).add()),e.enabled&&(t.tooltip=new P(t,e)),this.setDOMEvents()}},H.prototype={init:function(t){var e=this,n=e.options=t.options.legend;if(n.enabled){var s=n.itemStyle,r=p(n.padding,8),o=n.itemMarginTop||0;e.baseline=i(s.fontSize)+3+o,e.itemStyle=s,e.itemHiddenStyle=ei(s,n.itemHiddenStyle),e.itemMarginTop=o,e.padding=r,e.initialItemX=r,e.initialItemY=r-5,e.maxItemWidth=0,e.chart=t,e.itemHeight=0,e.lastLineHeight=0,e.render(),ii(e.chart,"endResize",function(){e.positionCheckboxes()})}},colorizeItem:function(t,e){var i,n=this.options,s=t.legendItem,r=t.legendLine,o=t.legendSymbol,a=this.itemHiddenStyle.color,n=e?n.itemStyle.color:a,l=e?t.color:a,a=t.options&&t.options.marker,h={stroke:l,fill:l};if(s&&s.css({fill:n}),r&&r.attr({stroke:l}),o){if(a)for(i in a=t.convertAttribs(a))s=a[i],s!==R&&(h[i]=s);o.attr(h)}},positionItem:function(t){var e=this.options,i=e.symbolPadding,e=!e.rtl,n=t._legendItemPos,s=n[0],n=n[1],r=t.checkbox;t.legendGroup&&t.legendGroup.translate(e?s:this.legendWidth-s-2*i-4,n),r&&(r.x=s,r.y=n)},destroyItem:function(t){var e=t.checkbox;Je(["legendItem","legendLine","legendSymbol","legendGroup"],function(e){t[e]&&t[e].destroy()}),e&&S(t.checkbox)},destroy:function(){var t=this.group,e=this.box;e&&(this.box=e.destroy()),t&&(this.group=t.destroy())},positionCheckboxes:function(){var t=this;Je(t.allItems,function(e){var i=e.checkbox,n=t.group.alignAttr;i&&f(i,{left:n.translateX+e.legendItemWidth+i.x-20+"px",top:n.translateY+i.y+3+"px"})})},renderItem:function(t){var e,i=this,n=i.chart,s=n.renderer,r=i.options,o="horizontal"===r.layout,a=r.symbolWidth,l=r.symbolPadding,h=i.itemStyle,c=i.itemHiddenStyle,u=i.padding,d=!r.rtl,p=r.width,f=r.itemMarginBottom||0,g=i.itemMarginTop,v=i.initialItemX,y=t.legendItem,b=t.series||t,x=b.options,w=x.showCheckbox;!y&&(t.legendGroup=s.g("legend-item").attr({zIndex:1}).add(i.scrollGroup),b.drawLegendSymbol(i,t),t.legendItem=y=s.text(r.labelFormatter.call(t),d?a+l:-l,i.baseline,r.useHTML).css(ei(t.visible?h:c)).attr({align:d?"left":"right",zIndex:2}).add(t.legendGroup),t.legendGroup.on("mouseover",function(){t.setState("hover"),y.css(i.options.itemHoverStyle)}).on("mouseout",function(){y.css(t.visible?h:c),t.setState()}).on("click",function(e){var i=function(){t.setVisible()},e={browserEvent:e};t.firePointEvent?t.firePointEvent("legendItemClick",e,i):si(t,"legendItemClick",e,i)}),i.colorizeItem(t,t.visible),x&&w)&&(t.checkbox=m("input",{type:"checkbox",checked:t.selected,defaultChecked:t.selected},r.itemCheckboxStyle,n.container),ii(t.checkbox,"click",function(e){si(t,"checkboxClick",{checked:e.target.checked},function(){t.select()})})),s=y.getBBox(),e=t.legendItemWidth=r.itemWidth||a+l+s.width+u+(w?20:0),r=e,i.itemHeight=a=s.height,o&&i.itemX-v+r>(p||n.chartWidth-2*u-v)&&(i.itemX=v,i.itemY+=g+i.lastLineHeight+f,i.lastLineHeight=0),i.maxItemWidth=pe(i.maxItemWidth,r),i.lastItemY=g+i.itemY+f,i.lastLineHeight=pe(a,i.lastLineHeight),t._legendItemPos=[i.itemX,i.itemY],o?i.itemX+=r:(i.itemY+=g+a+f,i.lastLineHeight=a),i.offsetWidth=p||pe(o?i.itemX-v:r,i.offsetWidth)},render:function(){var e,i,n,s,r=this,o=r.chart,a=o.renderer,l=r.group,h=r.box,c=r.options,u=r.padding,d=c.borderWidth,p=c.backgroundColor;r.itemX=r.initialItemX,r.itemY=r.initialItemY,r.offsetWidth=0,r.lastItemY=0,l||(r.group=l=a.g("legend").attr({zIndex:7}).add(),r.contentGroup=a.g().attr({zIndex:1}).add(l),r.scrollGroup=a.g().add(r.contentGroup),r.clipRect=a.clipRect(0,0,9999,o.chartHeight),r.contentGroup.clip(r.clipRect)),e=[],Je(o.series,function(t){var i=t.options;i.showInLegend&&(e=e.concat(t.legendItems||("point"===i.legendType?t.data:t)))}),_(e,function(t,e){return(t.options&&t.options.legendIndex||0)-(e.options&&e.options.legendIndex||0)}),c.reversed&&e.reverse(),r.allItems=e,r.display=i=!!e.length,Je(e,function(t){r.renderItem(t)}),n=c.width||r.offsetWidth,s=r.lastItemY+r.lastLineHeight,s=r.handleOverflow(s),(d||p)&&(n+=u,s+=u,h?n>0&&s>0&&(h[h.isNew?"attr":"animate"](h.crisp(null,null,null,n,s)),h.isNew=!1):(r.box=h=a.rect(0,0,n,s,c.borderRadius,d||0).attr({stroke:c.borderColor,"stroke-width":d||0,fill:p||$e}).add(l).shadow(c.shadow),h.isNew=!0),h[i?"show":"hide"]()),r.legendWidth=n,r.legendHeight=s,Je(e,function(t){r.positionItem(t)}),i&&l.align(t({width:n,height:s},c),!0,o.spacingBox),o.isResizing||this.positionCheckboxes()},handleOverflow:function(t){var e=this,i=this.chart,n=i.renderer,s=this.options,r=s.y,r=i.spacingBox.height+("top"===s.verticalAlign?-r:r)-this.padding,o=s.maxHeight,a=this.clipRect,l=s.navigation,h=p(l.animation,!0),c=l.arrowSize||12,u=this.nav;return"horizontal"===s.layout&&(r/=2),o&&(r=fe(r,o)),t>r?(this.clipHeight=i=r-20,this.pageCount=de(t/i),this.currentPage=p(this.currentPage,1),this.fullHeight=t,a.attr({height:i}),u||(this.nav=u=n.g().attr({zIndex:1}).add(this.group),this.up=n.symbol("triangle",0,0,c,c).on("click",function(){e.scroll(-1,h)}).add(u),this.pager=n.text("",15,10).css(l.style).add(u),this.down=n.symbol("triangle-down",0,0,c,c).on("click",function(){e.scroll(1,h)}).add(u)),e.scroll(0),t=r):u&&(a.attr({height:i.chartHeight}),u.hide(),this.scrollGroup.attr({translateY:1})),t},scroll:function(t,e){var i=this.pageCount,n=this.currentPage+t,s=this.clipHeight,r=this.options.navigation,o=r.activeColor,r=r.inactiveColor,a=this.pager,l=this.padding;n>i&&(n=i),n>0&&(e!==R&&E(e,this.chart),this.nav.attr({translateX:l,translateY:s+7,visibility:"visible"}),this.up.attr({fill:1===n?r:o}).css({cursor:1===n?"default":"pointer"}),a.attr({text:n+"/"+this.pageCount}),this.down.attr({x:18+this.pager.getBBox().width,fill:n===i?r:o}).css({cursor:n===i?"default":"pointer"}),this.scrollGroup.animate({translateY:-fe(s*(n-1),this.fullHeight-s+l)+1}),a.attr({text:n+"/"+i}),this.currentPage=n)}},W.prototype={initSeries:function(t){var e=this.options.chart,e=new Ve[t.type||e.type||e.defaultSeriesType];return e.init(this,t),e},addSeries:function(t,e,i){var n,s=this;return t&&(E(i,s),e=p(e,!0),si(s,"addSeries",{options:t},function(){n=s.initSeries(t),s.isDirtyLegend=!0,e&&s.redraw()})),n},isInsidePlot:function(t,e,i){var n=i?e:t,t=i?t:e;return n>=0&&n<=this.plotWidth&&t>=0&&t<=this.plotHeight},adjustTickAmounts:function(){this.options.chart.alignTicks!==!1&&Je(this.axes,function(t){t.adjustTickAmount()}),this.maxTicks=null},redraw:function(t){var e,i=this.axes,n=this.series,s=this.tracker,r=this.legend,o=this.isDirtyLegend,a=this.isDirtyBox,l=n.length,h=l,c=this.renderer,u=c.isHidden(),d=[];for(E(t,this),u&&this.cloneRenderTo();h--;)if(t=n[h],t.isDirty&&t.options.stacking){e=!0;break}if(e)for(h=l;h--;)t=n[h],t.options.stacking&&(t.isDirty=!0);Je(n,function(t){t.isDirty&&"point"===t.options.legendType&&(o=!0)}),o&&r.options.enabled&&(r.render(),this.isDirtyLegend=!1),this.hasCartesianSeries&&(this.isResizing||(this.maxTicks=null,Je(i,function(t){t.setScale()})),this.adjustTickAmounts(),this.getMargins(),Je(i,function(t){t.isDirtyExtremes&&(t.isDirtyExtremes=!1,d.push(function(){si(t,"afterSetExtremes",t.getExtremes())})),(t.isDirty||a||e)&&(t.redraw(),a=!0)})),a&&this.drawChartBox(),Je(n,function(t){t.isDirty&&t.visible&&(!t.isCartesian||t.xAxis)&&t.redraw()}),s&&s.resetTracker&&s.resetTracker(!0),c.draw(),si(this,"redraw"),u&&this.cloneRenderTo(!0),Je(d,function(t){t.call()})},showLoading:function(e){var i=this.options,n=this.loadingDiv,s=i.loading;n||(this.loadingDiv=n=m(Ne,{className:"highcharts-loading"},t(s.style,{left:this.plotLeft+"px",top:this.plotTop+"px",width:this.plotWidth+"px",height:this.plotHeight+"px",zIndex:10,display:$e}),this.container),this.loadingSpan=m("span",null,s.labelStyle,n)),this.loadingSpan.innerHTML=e||i.lang.loading,this.loadingShown||(f(n,{opacity:0,display:""}),oi(n,{opacity:s.style.opacity},{duration:s.showDuration||0}),this.loadingShown=!0)},hideLoading:function(){var t=this.options,e=this.loadingDiv;e&&oi(e,{opacity:0},{duration:t.loading.hideDuration||100,complete:function(){f(e,{display:$e})}}),this.loadingShown=!1},get:function(t){var e,i,n=this.axes,s=this.series;for(e=0;e<n.length;e++)if(n[e].options.id===t)return n[e];for(e=0;e<s.length;e++)if(s[e].options.id===t)return s[e];for(e=0;e<s.length;e++)for(i=s[e].points||[],n=0;n<i.length;n++)if(i[n].id===t)return i[n];return null},getAxes:function(){var t=this,e=this.options,i=e.xAxis||{},e=e.yAxis||{},i=d(i);Je(i,function(t,e){t.index=e,t.isX=!0}),e=d(e),Je(e,function(t,e){t.index=e}),i=i.concat(e),Je(i,function(e){new z(t,e)}),t.adjustTickAmounts()},getSelectedPoints:function(){var t=[];return Je(this.series,function(e){t=t.concat(Ze(e.points,function(t){return t.selected}))}),t},getSelectedSeries:function(){return Ze(this.series,function(t){return t.selected})},showResetZoom:function(){var t=this,e=Y.lang,i=t.options.chart.resetZoomButton,n=i.theme,s=n.states,r="chart"===i.relativeTo?null:"plotBox";this.resetZoomButton=t.renderer.button(e.resetZoom,null,null,function(){t.zoomOut()},n,s&&s.hover).attr({align:i.position.align,title:e.resetZoomTitle}).add().align(i.position,!1,t[r]),this.resetZoomButton.alignTo=r},zoomOut:function(){var t=this,e=t.resetZoomButton;si(t,"selection",{resetSelection:!0},function(){t.zoom()}),e&&(t.resetZoomButton=e.destroy())},zoom:function(t){var e,i=this;!t||t.resetSelection?Je(i.axes,function(t){e=t.zoom()}):Je(t.xAxis.concat(t.yAxis),function(t){var n=t.axis;i.tracker[n.isXAxis?"zoomX":"zoomY"]&&(e=n.zoom(t.min,t.max))}),i.resetZoomButton||i.showResetZoom(),e&&i.redraw(p(i.options.chart.animation,i.pointCount<100))},pan:function(t){var e=this.xAxis[0],i=this.mouseDownX,n=e.pointRange/2,s=e.getExtremes(),r=e.translate(i-t,!0)+n,i=e.translate(i+this.plotWidth-t,!0)-n;(n=this.hoverPoints)&&Je(n,function(t){t.setState()}),e.series.length&&r>fe(s.dataMin,s.min)&&i<pe(s.dataMax,s.max)&&e.setExtremes(r,i,!0,!1,{trigger:"pan"}),this.mouseDownX=t,f(this.container,{cursor:"move"})},setTitle:function(t,e){var i,n=this,s=n.options;n.chartTitleOptions=i=ei(s.title,t),n.chartSubtitleOptions=s=ei(s.subtitle,e),Je([["title",t,i],["subtitle",e,s]],function(t){var e=t[0],i=n[e],s=t[1],t=t[2];i&&s&&(n[e]=i=i.destroy()),t&&t.text&&!i&&(n[e]=n.renderer.text(t.text,0,0,t.useHTML).attr({align:t.align,"class":"highcharts-"+e,zIndex:t.zIndex||4}).css(t.style).add().align(t,!1,n.spacingBox))})},getChartSize:function(){var t=this.options.chart,e=this.renderToClone||this.renderTo;this.containerWidth=qe(e,"width"),this.containerHeight=qe(e,"height"),this.chartWidth=t.width||this.containerWidth||600,this.chartHeight=t.height||(this.containerHeight>19?this.containerHeight:400)},cloneRenderTo:function(t){var e=this.renderToClone,i=this.container;t?e&&(this.renderTo.appendChild(i),S(e),delete this.renderToClone):(i&&this.renderTo.removeChild(i),this.renderToClone=e=this.renderTo.cloneNode(0),f(e,{position:"absolute",top:"-9999px",display:"block"}),ae.body.appendChild(e),i&&e.appendChild(i))},getContainer:function(){var e,i,s,r,o=this.options.chart;this.renderTo=e=o.renderTo,r="highcharts-"+Ie++,n(e)&&(this.renderTo=e=ae.getElementById(e)),e||T(13,!0),e.innerHTML="",e.offsetWidth||this.cloneRenderTo(),this.getChartSize(),i=this.chartWidth,s=this.chartHeight,this.container=e=m(Ne,{className:"highcharts-container"+(o.className?" "+o.className:""),id:r},t({position:"relative",overflow:"hidden",width:i+"px",height:s+"px",textAlign:"left",lineHeight:"normal",zIndex:0},o.style),this.renderToClone||e),this.renderer=o.forExport?new ci(e,i,s,!0):new j(e,i,s),Ae&&this.renderer.create(this,e,i,s)},getMargins:function(){var t,e=this.options.chart,i=e.spacingTop,n=e.spacingRight,s=e.spacingBottom,e=e.spacingLeft,r=this.legend,o=this.optionsMarginTop,a=this.optionsMarginLeft,l=this.optionsMarginRight,h=this.optionsMarginBottom,u=this.chartTitleOptions,d=this.chartSubtitleOptions,f=this.options.legend,m=p(f.margin,10),g=f.x,v=f.y,y=f.align,b=f.verticalAlign;this.resetMargins(),t=this.axisOffset,!this.title&&!this.subtitle||c(this.optionsMarginTop)||(d=pe(this.title&&!u.floating&&!u.verticalAlign&&u.y||0,this.subtitle&&!d.floating&&!d.verticalAlign&&d.y||0))&&(this.plotTop=pe(this.plotTop,d+p(u.margin,15)+i)),r.display&&!f.floating&&("right"===y?c(l)||(this.marginRight=pe(this.marginRight,r.legendWidth-g+m+n)):"left"===y?c(a)||(this.plotLeft=pe(this.plotLeft,r.legendWidth+g+m+e)):"top"===b?c(o)||(this.plotTop=pe(this.plotTop,r.legendHeight+v+m+i)):"bottom"!==b||c(h)||(this.marginBottom=pe(this.marginBottom,r.legendHeight-v+m+s))),this.extraBottomMargin&&(this.marginBottom+=this.extraBottomMargin),this.extraTopMargin&&(this.plotTop+=this.extraTopMargin),this.hasCartesianSeries&&Je(this.axes,function(t){t.getOffset()}),c(a)||(this.plotLeft+=t[3]),c(o)||(this.plotTop+=t[0]),c(h)||(this.marginBottom+=t[2]),c(l)||(this.marginRight+=t[1]),this.setChartSize()},initReflow:function(){function t(t){var r=n.width||qe(s,"width"),o=n.height||qe(s,"height"),t=t?t.target:le;r&&o&&(t===le||t===ae)&&((r!==i.containerWidth||o!==i.containerHeight)&&(clearTimeout(e),i.reflowTimeout=e=setTimeout(function(){i.container&&i.resize(r,o,!1)},100)),i.containerWidth=r,i.containerHeight=o)}var e,i=this,n=i.options.chart,s=i.renderTo;ii(le,"resize",t),ii(i,"destroy",function(){ni(le,"resize",t)})},resize:function(t,e,i){var n,s,r,o=this,a=o.resetZoomButton,l=o.title,h=o.subtitle;o.isResizing+=1,r=function(){o&&si(o,"endResize",null,function(){o.isResizing-=1})},E(i,o),o.oldChartHeight=o.chartHeight,o.oldChartWidth=o.chartWidth,c(t)&&(o.chartWidth=n=ce(t)),c(e)&&(o.chartHeight=s=ce(e)),f(o.container,{width:n+"px",height:s+"px"}),o.renderer.setSize(n,s,i),o.plotWidth=n-o.plotLeft-o.marginRight,o.plotHeight=s-o.plotTop-o.marginBottom,o.maxTicks=null,Je(o.axes,function(t){t.isDirty=!0,t.setScale()}),Je(o.series,function(t){t.isDirty=!0}),o.isDirtyLegend=!0,o.isDirtyBox=!0,o.getMargins(),t=o.spacingBox,l&&l.align(null,null,t),h&&h.align(null,null,t),a&&a.align&&a.align(null,null,o[a.alignTo]),o.redraw(i),o.oldChartHeight=null,si(o,"resize"),U===!1?r():setTimeout(r,U&&U.duration||500)},setChartSize:function(){var t,e,i,n,s=this.inverted,r=this.chartWidth,o=this.chartHeight,a=this.options.chart,l=a.spacingTop,h=a.spacingRight,c=a.spacingBottom,u=a.spacingLeft;this.plotLeft=t=ce(this.plotLeft),this.plotTop=e=ce(this.plotTop),this.plotWidth=i=ce(r-t-this.marginRight),this.plotHeight=n=ce(o-e-this.marginBottom),this.plotSizeX=s?n:i,this.plotSizeY=s?i:n,this.plotBorderWidth=s=a.plotBorderWidth||0,this.spacingBox={x:u,y:l,width:r-u-h,height:o-l-c},this.plotBox={x:t,y:e,width:i,height:n},this.clipBox={x:s/2,y:s/2,width:this.plotSizeX-s,height:this.plotSizeY-s},Je(this.axes,function(t){t.setAxisSize(),t.setAxisTranslation()})},resetMargins:function(){var t=this.options.chart,e=t.spacingRight,i=t.spacingBottom,n=t.spacingLeft;this.plotTop=p(this.optionsMarginTop,t.spacingTop),this.marginRight=p(this.optionsMarginRight,e),this.marginBottom=p(this.optionsMarginBottom,i),this.plotLeft=p(this.optionsMarginLeft,n),this.axisOffset=[0,0,0,0]},drawChartBox:function(){var t,e=this.options.chart,i=this.renderer,n=this.chartWidth,s=this.chartHeight,r=this.chartBackground,o=this.plotBackground,a=this.plotBorder,l=this.plotBGImage,h=e.borderWidth||0,c=e.backgroundColor,u=e.plotBackgroundColor,d=e.plotBackgroundImage,p=e.plotBorderWidth||0,f=this.plotLeft,m=this.plotTop,g=this.plotWidth,v=this.plotHeight,y=this.plotBox,b=this.clipRect,x=this.clipBox;t=h+(e.shadow?8:0),(h||c)&&(r?r.animate(r.crisp(null,null,null,n-t,s-t)):(r={fill:c||$e},h&&(r.stroke=e.borderColor,r["stroke-width"]=h),this.chartBackground=i.rect(t/2,t/2,n-t,s-t,e.borderRadius,h).attr(r).add().shadow(e.shadow))),u&&(o?o.animate(y):this.plotBackground=i.rect(f,m,g,v,0).attr({fill:u}).add().shadow(e.plotShadow)),d&&(l?l.animate(y):this.plotBGImage=i.image(d,f,m,g,v).add()),b?b.animate({width:x.width,height:x.height}):this.clipRect=i.clipRect(x),p&&(a?a.animate(a.crisp(null,f,m,g,v)):this.plotBorder=i.rect(f,m,g,v,0,p).attr({stroke:e.plotBorderColor,"stroke-width":p,zIndex:1}).add()),this.isDirtyBox=!1},propFromSeries:function(){var t,e,i,n=this,s=n.options.chart,r=n.options.series;Je(["inverted","angular","polar"],function(o){for(t=Ve[s.type||s.defaultSeriesType],i=n[o]||s[o]||t&&t.prototype[o],e=r&&r.length;!i&&e--;)(t=Ve[r[e].type])&&t.prototype[o]&&(i=!0);n[o]=i})},render:function(){var e,n=this,s=n.axes,r=n.renderer,o=n.options,a=o.labels,o=o.credits;n.setTitle(),n.legend=new H(n),Je(s,function(t){t.setScale()}),n.getMargins(),n.maxTicks=null,Je(s,function(t){t.setTickPositions(!0),t.setMaxTicks()}),n.adjustTickAmounts(),n.getMargins(),n.drawChartBox(),n.hasCartesianSeries&&Je(s,function(t){t.render()}),n.seriesGroup||(n.seriesGroup=r.g("series-group").attr({zIndex:3}).add()),Je(n.series,function(t){t.translate(),t.setTooltipPoints(),t.render()}),a.items&&Je(a.items,function(e){var s=t(a.style,e.style),o=i(s.left)+n.plotLeft,l=i(s.top)+n.plotTop+12;delete s.left,delete s.top,r.text(e.html,o,l).attr({zIndex:2}).css(s).add()}),o.enabled&&!n.credits&&(e=o.href,n.credits=r.text(o.text,0,0).on("click",function(){e&&(location.href=e)}).attr({align:o.position.align,zIndex:8}).css(o.style).add().align(o.position)),n.hasRendered=!0},destroy:function(){var t,e=this,i=e.axes,n=e.series,s=e.container,r=s&&s.parentNode;for(si(e,"destroy"),ni(e),t=i.length;t--;)i[t]=i[t].destroy();for(t=n.length;t--;)n[t]=n[t].destroy();Je("title,subtitle,chartBackground,plotBackground,plotBGImage,plotBorder,seriesGroup,clipRect,credits,tracker,scroller,rangeSelector,legend,resetZoomButton,tooltip,renderer".split(","),function(t){var i=e[t];i&&i.destroy&&(e[t]=i.destroy())}),s&&(s.innerHTML="",ni(s),r&&S(s));for(t in e)delete e[t]},firstRender:function(){var t=this,e=t.options,i=t.callback;!Se&&le==le.top&&"complete"!==ae.readyState||Ae&&!le.canvg?Ae?fi.push(function(){t.firstRender()},e.global.canvasToolsURL):ae.attachEvent("onreadystatechange",function(){ae.detachEvent("onreadystatechange",t.firstRender),"complete"===ae.readyState&&t.firstRender()}):(t.getContainer(),si(t,"init"),Highcharts.RangeSelector&&e.rangeSelector.enabled&&(t.rangeSelector=new Highcharts.RangeSelector(t)),t.resetMargins(),t.setChartSize(),t.propFromSeries(),t.getAxes(),Je(e.series||[],function(e){t.initSeries(e)}),Highcharts.Scroller&&(e.navigator.enabled||e.scrollbar.enabled)&&(t.scroller=new Highcharts.Scroller(t)),t.tracker=new O(t,e),t.render(),t.renderer.draw(),i&&i.apply(t,[t]),Je(t.callbacks,function(e){e.apply(t,[t])}),t.cloneRenderTo(!0),si(t,"load"))},init:function(t){var e,i=this.options.chart;if(i.reflow!==!1&&ii(this,"load",this.initReflow),t)for(e in t)ii(this,e,t[e]);this.xAxis=[],this.yAxis=[],this.animation=Ae?!1:p(i.animation,!0),this.setSize=this.resize,this.pointCount=0,this.counters=new k,this.firstRender()}},W.prototype.callbacks=[];var mi=function(){};mi.prototype={init:function(t,e,i){var n=t.chart.counters;return this.series=t,this.applyOptions(e,i),this.pointAttr={},t.options.colorByPoint&&(e=t.chart.options.colors,this.color=this.color||e[n.color++],n.wrapColor(e.length)),t.chart.pointCount++,this},applyOptions:function(e,i){var n=this.series,s=typeof e;this.config=e,"number"===s||null===e?this.y=e:"number"==typeof e[0]?(this.x=e[0],this.y=e[1]):"object"===s&&"number"!=typeof e.length?(t(this,e),this.options=e,e.dataLabels&&(n._hasPointLabels=!0),e.marker&&(n._hasPointMarkers=!0)):"string"==typeof e[0]&&(this.name=e[0],this.y=e[1]),this.x===R&&(this.x=i===R?n.autoIncrement():i)},destroy:function(){var t,e=this.series.chart,i=e.hoverPoints;e.pointCount--,i&&(this.setState(),h(i,this),!i.length)&&(e.hoverPoints=null),this===e.hoverPoint&&this.onMouseOut(),(this.graphic||this.dataLabel)&&(ni(this),this.destroyElements()),this.legendItem&&e.legend.destroyItem(this);for(t in this)this[t]=null},destroyElements:function(){for(var t,e="graphic,tracker,dataLabel,group,connector,shadowGroup".split(","),i=6;i--;)t=e[i],this[t]&&(this[t]=this[t].destroy())},getLabelConfig:function(){return{x:this.category,y:this.y,key:this.name||this.category,series:this.series,point:this,percentage:this.percentage,total:this.total||this.stackTotal}},select:function(t,e){var i=this,n=i.series.chart,t=p(t,!i.selected);i.firePointEvent(t?"select":"unselect",{accumulate:e},function(){i.selected=t,i.setState(t&&"select"),e||Je(n.getSelectedPoints(),function(t){t.selected&&t!==i&&(t.selected=!1,t.setState(""),t.firePointEvent("unselect"))})})},onMouseOver:function(){var t=this.series,e=t.chart,i=e.tooltip,n=e.hoverPoint;n&&n!==this&&n.onMouseOut(),this.firePointEvent("mouseOver"),i&&(!i.shared||t.noSharedTooltip)&&i.refresh(this),this.setState("hover"),e.hoverPoint=this},onMouseOut:function(){var t=this.series.chart,e=t.hoverPoints;e&&-1!==Ke(this,e)||(this.firePointEvent("mouseOut"),this.setState(),t.hoverPoint=null)},tooltipFormatter:function(t){var e,i,s,r,o=this.series,a=o.tooltipOptions,l=t.match(/\{(series|point)\.[a-zA-Z]+\}/g),h=/[{\.}]/,c={y:0,open:0,high:0,low:0,close:0,percentage:1,total:1};a.valuePrefix=a.valuePrefix||a.yPrefix,a.valueDecimals=a.valueDecimals||a.yDecimals,a.valueSuffix=a.valueSuffix||a.ySuffix;for(r in l)i=l[r],n(i)&&i!==t&&(s=(" "+i).split(h),e={point:this,series:o}[s[1]],s=s[2],e===this&&c.hasOwnProperty(s)?(e=c[s]?s:"value",e=(a[e+"Prefix"]||"")+v(this[s],p(a[e+"Decimals"],-1))+(a[e+"Suffix"]||"")):e=e[s],t=t.replace(i,e));return t},update:function(t,e,i){var n,r=this,o=r.series,a=r.graphic,l=o.data,h=l.length,c=o.chart,e=p(e,!0);r.firePointEvent("update",{options:t},function(){for(r.applyOptions(t),s(t)&&(o.getAttribs(),a&&a.attr(r.pointAttr[o.state])),n=0;h>n;n++)if(l[n]===r){o.xData[n]=r.x,o.yData[n]=r.y,o.options.data[n]=t;break}o.isDirty=!0,o.isDirtyData=!0,e&&c.redraw(i)})},remove:function(t,e){var i,n=this,s=n.series,r=s.chart,o=s.data,a=o.length;E(e,r),t=p(t,!0),n.firePointEvent("remove",null,function(){for(i=0;a>i;i++)if(o[i]===n){o.splice(i,1),s.options.data.splice(i,1),s.xData.splice(i,1),s.yData.splice(i,1);break}n.destroy(),s.isDirty=!0,s.isDirtyData=!0,t&&r.redraw()})},firePointEvent:function(t,e,i){var n=this,s=this.series.options;(s.point.events[t]||n.options&&n.options.events&&n.options.events[t])&&this.importEvents(),"click"===t&&s.allowPointSelect&&(i=function(t){n.select(null,t.ctrlKey||t.metaKey||t.shiftKey)}),si(this,t,e,i)},importEvents:function(){if(!this.hasImportedEvents){var t,e=ei(this.series.options.point,this.options).events;this.events=e;for(t in e)ii(this,t,e[t]);this.hasImportedEvents=!0}},setState:function(t){var e=this.plotX,i=this.plotY,n=this.series,s=n.options.states,r=li[n.type].marker&&n.options.marker,o=r&&!r.enabled,a=r&&r.states[t],l=a&&a.enabled===!1,h=n.stateMarkerGraphic,c=n.chart,u=this.pointAttr,t=t||"";t===this.state||this.selected&&"select"!==t||s[t]&&s[t].enabled===!1||t&&(l||o&&!a.enabled)||(this.graphic?(s=r&&this.graphic.symbolName&&u[t].r,this.graphic.attr(ei(u[t],s?{x:e-s,y:i-s,width:2*s,height:2*s}:{}))):(t&&a&&(s=a.radius,h?h.attr({x:e-s,y:i-s}):n.stateMarkerGraphic=h=c.renderer.symbol(n.symbol,e-s,i-s,2*s,2*s).attr(u[t]).add(n.markerGroup)),h&&h[t&&c.isInsidePlot(e,i)?"show":"hide"]()),this.state=t)}};var gi=function(){};gi.prototype={isCartesian:!0,type:"line",pointClass:mi,sorted:!0,pointAttrToOptions:{stroke:"lineColor","stroke-width":"lineWidth",fill:"fillColor",r:"radius"},init:function(e,i){var n,s;this.chart=e,this.options=i=this.setOptions(i),this.bindAxes(),t(this,{name:i.name,state:"",pointAttr:{},visible:i.visible!==!1,selected:i.selected===!0}),Ae&&(i.animation=!1),s=i.events;for(n in s)ii(this,n,s[n]);(s&&s.click||i.point&&i.point.events&&i.point.events.click||i.allowPointSelect)&&(e.runTrackerClick=!0),this.getColor(),this.getSymbol(),this.setData(i.data,!1),this.isCartesian&&(e.hasCartesianSeries=!0),e.series.push(this),_(e.series,function(t,e){return(t.options.index||0)-(e.options.index||0)
388
+ }),Je(e.series,function(t,e){t.index=e,t.name=t.name||"Series "+(e+1)})},bindAxes:function(){var t,e=this,i=e.options,n=e.chart;e.isCartesian&&Je(["xAxis","yAxis"],function(s){Je(n[s],function(n){t=n.options,(i[s]===t.index||i[s]===R&&0===t.index)&&(n.series.push(e),e[s]=n,n.isDirty=!0)})})},autoIncrement:function(){var t=this.options,e=this.xIncrement,e=p(e,t.pointStart,0);return this.pointInterval=p(this.pointInterval,t.pointInterval,1),this.xIncrement=e+this.pointInterval,e},getSegments:function(){var t,e=-1,i=[],n=this.points,s=n.length;if(s)if(this.options.connectNulls){for(t=s;t--;)null===n[t].y&&n.splice(t,1);n.length&&(i=[n])}else Je(n,function(t,r){null===t.y?(r>e+1&&i.push(n.slice(e+1,r)),e=r):r===s-1&&i.push(n.slice(e+1,r+1))});this.segments=i},setOptions:function(t){var e=this.chart.options,i=e.plotOptions,n=i[this.type],s=t.data;return t.data=null,i=ei(n,i.series,t),i.data=t.data=s,this.tooltipOptions=ei(e.tooltip,i.tooltip),null===n.marker&&delete i.marker,i},getColor:function(){var t=this.options,e=this.chart.options.colors,i=this.chart.counters;this.color=t.color||!t.colorByPoint&&e[i.color++]||"gray",i.wrapColor(e.length)},getSymbol:function(){var t=this.options.marker,e=this.chart,i=e.options.symbols,e=e.counters;this.symbol=t.symbol||i[e.symbol++],/^url/.test(this.symbol)&&(t.radius=0),e.wrapSymbol(i.length)},drawLegendSymbol:function(t){var e,i=this.options,n=i.marker,s=t.options.symbolWidth,r=this.chart.renderer,o=this.legendGroup,t=t.baseline;i.lineWidth&&(e={"stroke-width":i.lineWidth},i.dashStyle&&(e.dashstyle=i.dashStyle),this.legendLine=r.path(["M",0,t-4,"L",s,t-4]).attr(e).add(o)),n&&n.enabled&&(i=n.radius,this.legendSymbol=r.symbol(this.symbol,s/2-i,t-4-i,2*i,2*i).add(o))},addPoint:function(t,e,i,n){var s=this.data,r=this.graph,o=this.area,a=this.chart,l=this.xData,h=this.yData,c=r&&r.shift||0,u=this.options.data,d=this.pointClass.prototype;E(n,a),r&&i&&(r.shift=c+1),o&&(i&&(o.shift=c+1),o.isArea=!0),e=p(e,!0),n={series:this},d.applyOptions.apply(n,[t]),l.push(n.x),h.push(d.toYData?d.toYData.call(n):n.y),u.push(t),i&&(s[0]&&s[0].remove?s[0].remove(!1):(s.shift(),l.shift(),h.shift(),u.shift())),this.getAttribs(),this.isDirtyData=this.isDirty=!0,e&&a.redraw()},setData:function(t,e){var i,s=this.points,a=this.options,l=this.initialColor,h=this.chart,u=null,d=this.xAxis,f=this.pointClass.prototype;this.xIncrement=null,this.pointRange=d&&d.categories?1:a.pointRange,c(l)&&(h.counters.color=l);var l=[],m=[],g=t?t.length:[],v=(i=this.pointArrayMap)&&i.length;if(g>(a.turboThreshold||1e3)){for(i=0;null===u&&g>i;)u=t[i],i++;if(o(u)){for(f=p(a.pointStart,0),a=p(a.pointInterval,1),i=0;g>i;i++)l[i]=f,m[i]=t[i],f+=a;this.xIncrement=f}else if(r(u))if(v)for(i=0;g>i;i++)a=t[i],l[i]=a[0],m[i]=a.slice(1,v+1);else for(i=0;g>i;i++)a=t[i],l[i]=a[0],m[i]=a[1]}else for(i=0;g>i;i++)a={series:this},f.applyOptions.apply(a,[t[i]]),l[i]=a.x,m[i]=f.toYData?f.toYData.call(a):a.y;for(n(m[0])&&T(14,!0),this.data=[],this.options.data=t,this.xData=l,this.yData=m,i=s&&s.length||0;i--;)s[i]&&s[i].destroy&&s[i].destroy();d&&(d.minRange=d.userMinRange),this.isDirty=this.isDirtyData=h.isDirtyBox=!0,p(e,!0)&&h.redraw(!1)},remove:function(t,e){var i=this,n=i.chart,t=p(t,!0);i.isRemoving||(i.isRemoving=!0,si(i,"remove",null,function(){i.destroy(),n.isDirtyLegend=n.isDirtyBox=!0,t&&n.redraw(e)})),i.isRemoving=!1},processData:function(t){var e,i,n=this.xData,s=this.yData,r=n.length,o=0,a=r,l=this.xAxis,h=this.options,c=h.cropThreshold,u=this.isCartesian;if(u&&!this.isDirty&&!l.isDirty&&!this.yAxis.isDirty&&!t)return!1;if(u&&this.sorted&&(!c||r>c||this.forceCrop))if(t=l.getExtremes(),l=t.min,c=t.max,n[r-1]<l||n[0]>c)n=[],s=[];else if(n[0]<l||n[r-1]>c){for(t=0;r>t;t++)if(n[t]>=l){o=pe(0,t-1);break}for(;r>t;t++)if(n[t]>c){a=t+1;break}n=n.slice(o,a),s=s.slice(o,a),e=!0}for(t=n.length-1;t>0;t--)r=n[t]-n[t-1],r>0&&(i===R||i>r)&&(i=r);this.cropped=e,this.cropStart=o,this.processedXData=n,this.processedYData=s,null===h.pointRange&&(this.pointRange=i||1),this.closestPointRange=i},generatePoints:function(){var t,e,i,n,s=this.options.data,r=this.data,o=this.processedXData,a=this.processedYData,l=this.pointClass,h=o.length,c=this.cropStart||0,u=this.hasGroupedData,p=[];for(r||u||(r=[],r.length=s.length,r=this.data=r),n=0;h>n;n++)e=c+n,u?p[n]=(new l).init(this,[o[n]].concat(d(a[n]))):(r[e]?i=r[e]:s[e]!==R&&(r[e]=i=(new l).init(this,s[e],o[n])),p[n]=i);if(r&&(h!==(t=r.length)||u))for(n=0;t>n;n++)n===c&&!u&&(n+=h),r[n]&&(r[n].destroyElements(),r[n].plotX=R);this.data=r,this.points=p},translate:function(){this.processedXData||this.processData(),this.generatePoints();for(var t,e=this.chart,i=this.options,n=i.stacking,s=this.xAxis,r=s.categories,o=this.yAxis,a=this.points,l=a.length,h=!!this.modifyValue,u=o.series,d=u.length,f="between"===i.pointPlacement;d--;)if(u[d].visible){u[d]===this&&(t=!0);break}for(d=0;l>d;d++){var u=a[d],m=u.x,g=u.y,v=u.low,y=o.stacks[(g<i.threshold?"-":"")+this.stackKey];u.plotX=s.translate(m,0,0,0,1,f),n&&this.visible&&y&&y[m]&&(v=y[m],m=v.total,v.cum=v=v.cum-g,g=v+g,t&&(v=p(i.threshold,o.min)),o.isLog&&0>=v&&(v=null),"percent"===n&&(v=m?100*v/m:0,g=m?100*g/m:0),u.percentage=m?100*u.y/m:0,u.total=u.stackTotal=m,u.stackY=g),u.yBottom=c(v)?o.translate(v,0,1,0,1):null,h&&(g=this.modifyValue(g,u)),u.plotY="number"==typeof g?ce(10*o.translate(g,0,1,0,1))/10:R,u.clientX=e.inverted?e.plotHeight-u.plotX:u.plotX,u.category=r&&r[u.x]!==R?r[u.x]:u.x}this.getSegments()},setTooltipPoints:function(t){var e,i,n,s,r=[],o=(e=this.xAxis)?e.tooltipLen||e.len:this.chart.plotSizeX,a=e&&e.tooltipPosName||"plotX",l=[];if(this.options.enableMouseTracking!==!1){for(t&&(this.tooltipPoints=null),Je(this.segments||this.points,function(t){r=r.concat(t)}),e&&e.reversed&&(r=r.reverse()),t=r.length,s=0;t>s;s++)for(n=r[s],e=r[s-1]?i+1:0,i=r[s+1]?pe(0,ue((n[a]+(r[s+1]?r[s+1][a]:o))/2)):o;e>=0&&i>=e;)l[e++]=n;this.tooltipPoints=l}},tooltipHeaderFormatter:function(t){var e,i=this.tooltipOptions,n=i.xDateFormat,s=this.xAxis,r=s&&"datetime"===s.options.type;if(r&&!n)for(e in q)if(q[e]>=s.closestPointRange){n=i.dateTimeLabelFormats[e];break}return i.headerFormat.replace("{point.key}",r&&o(t)?V(n,t):t).replace("{series.name}",this.name).replace("{series.color}",this.color)},onMouseOver:function(){var t=this.chart,e=t.hoverSeries;e&&e!==this&&e.onMouseOut(),this.options.events.mouseOver&&si(this,"mouseOver"),this.setState("hover"),t.hoverSeries=this},onMouseOut:function(){var t=this.options,e=this.chart,i=e.tooltip,n=e.hoverPoint;n&&n.onMouseOut(),this&&t.events.mouseOut&&si(this,"mouseOut"),i&&!t.stickyTracking&&!i.shared&&i.hide(),this.setState(),e.hoverSeries=null},animate:function(e){var i,n=this,r=n.chart,o=r.renderer;i=n.options.animation;var a,l=r.clipBox,h=r.inverted;i&&!s(i)&&(i=li[n.type].animation),a="_sharedClip"+i.duration+i.easing,e?(e=r[a],i=r[a+"m"],e||(r[a]=e=o.clipRect(t(l,{width:0})),r[a+"m"]=i=o.clipRect(-99,h?-r.plotLeft:-r.plotTop,99,h?r.chartWidth:r.chartHeight)),n.group.clip(e),n.markerGroup.clip(i),n.sharedClipKey=a):((e=r[a])&&(e.animate({width:r.plotSizeX},i),r[a+"m"].animate({width:r.plotSizeX+99},i)),n.animate=null,n.animationTimeout=setTimeout(function(){n.afterAnimate()},i.duration))},afterAnimate:function(){var t=this.chart,e=this.sharedClipKey,i=this.group;i&&this.options.clip!==!1&&(i.clip(t.clipRect),this.markerGroup.clip()),setTimeout(function(){e&&t[e]&&(t[e]=t[e].destroy(),t[e+"m"]=t[e+"m"].destroy())},100)},drawPoints:function(){var e,i,n,s,r,o,a,l,h,c,u=this.points,d=this.chart,f=this.options.marker,m=this.markerGroup;if(f.enabled||this._hasPointMarkers)for(s=u.length;s--;)r=u[s],i=r.plotX,n=r.plotY,h=r.graphic,a=r.marker||{},e=f.enabled&&a.enabled===R||a.enabled,c=d.isInsidePlot(i,n,d.inverted),e&&n!==R&&!isNaN(n)?(e=r.pointAttr[r.selected?"select":""],o=e.r,a=p(a.symbol,this.symbol),l=0===a.indexOf("url"),h?h.attr({visibility:c?Se?"inherit":"visible":"hidden"}).animate(t({x:i-o,y:n-o},h.symbolName?{width:2*o,height:2*o}:{})):c&&(o>0||l)&&(r.graphic=d.renderer.symbol(a,i-o,n-o,2*o,2*o).attr(e).add(m))):h&&(r.graphic=h.destroy())},convertAttribs:function(t,e,i,n){var s,r,o=this.pointAttrToOptions,a={},t=t||{},e=e||{},i=i||{},n=n||{};for(s in o)r=o[s],a[s]=p(t[r],e[s],i[s],n[s]);return a},getAttribs:function(){var e,i,n,s=this,r=li[s.type].marker?s.options.marker:s.options,o=r.states,a=o.hover,l=s.color,h={stroke:l,fill:l},u=s.points||[],d=[],p=s.pointAttrToOptions;for(s.options.marker?(a.radius=a.radius||r.radius+2,a.lineWidth=a.lineWidth||r.lineWidth+1):a.color=a.color||hi(a.color||l).brighten(a.brightness).get(),d[""]=s.convertAttribs(r,h),Je(["hover","select"],function(t){d[t]=s.convertAttribs(o[t],d[""])}),s.pointAttr=d,l=u.length;l--;){if(h=u[l],(r=h.options&&h.options.marker||h.options)&&r.enabled===!1&&(r.radius=0),e=s.options.colorByPoint,h.options)for(n in p)c(r[p[n]])&&(e=!0);e?(r=r||{},i=[],o=r.states||{},e=o.hover=o.hover||{},s.options.marker||(e.color=hi(e.color||h.color).brighten(e.brightness||a.brightness).get()),i[""]=s.convertAttribs(t({color:h.color},r),d[""]),i.hover=s.convertAttribs(o.hover,d.hover,i[""]),i.select=s.convertAttribs(o.select,d.select,i[""])):i=d,h.pointAttr=i}},destroy:function(){var t,e,i,n,s,r=this,o=r.chart,a=/AppleWebKit\/533/.test(xe),l=r.data||[];for(si(r,"destroy"),ni(r),Je(["xAxis","yAxis"],function(t){(s=r[t])&&(h(s.series,r),s.isDirty=!0)}),r.legendItem&&r.chart.legend.destroyItem(r),e=l.length;e--;)(i=l[e])&&i.destroy&&i.destroy();r.points=null,clearTimeout(r.animationTimeout),Je("area,graph,dataLabelsGroup,group,markerGroup,tracker,trackerGroup".split(","),function(e){r[e]&&(t=a&&"group"===e?"hide":"destroy",r[e][t]())}),o.hoverSeries===r&&(o.hoverSeries=null),h(o.series,r);for(n in r)delete r[n]},drawDataLabels:function(){var t,e,i,n,s=this,r=s.options.dataLabels,o=s.points;(r.enabled||s._hasPointLabels)&&(s.dlProcessOptions&&s.dlProcessOptions(r),n=s.plotGroup("dataLabelsGroup","data-labels",s.visible?"visible":"hidden",6),e=r,Je(o,function(o){var a,l,h=o.dataLabel,u=!0;if(t=o.options&&o.options.dataLabels,a=e.enabled||t&&t.enabled,h&&!a)o.dataLabel=h.destroy();else if(a){if(a=r.rotation,r=ei(e,t),i=r.formatter.call(o.getLabelConfig(),r),r.style.color=p(r.color,r.style.color,s.color,"black"),h)h.attr({text:i}),u=!1;else if(c(i)){h={fill:r.backgroundColor,stroke:r.borderColor,"stroke-width":r.borderWidth,r:r.borderRadius||0,rotation:a,padding:r.padding,zIndex:1};for(l in h)h[l]===R&&delete h[l];h=o.dataLabel=s.chart.renderer[a?"text":"label"](i,0,-999,null,null,null,r.useHTML).attr(h).css(r.style).add(n).shadow(r.shadow)}h&&s.alignDataLabel(o,h,r,null,u)}}))},alignDataLabel:function(e,i,n,s,r){var o=this.chart,a=o.inverted,l=p(e.plotX,-999),e=p(e.plotY,-999),h=i.getBBox(),s=t({x:a?o.plotWidth-e:l,y:ce(a?o.plotHeight-l:e),width:0,height:0},s);t(n,{width:h.width,height:h.height}),n.rotation?(s={align:n.align,x:s.x+n.x+s.width/2,y:s.y+n.y+s.height/2},i[r?"attr":"animate"](s)):(i.align(n,null,s),s=i.alignAttr),i.attr({visibility:n.crop===!1||o.isInsidePlot(s.x,s.y)||o.isInsidePlot(l,e,a)?Se?"inherit":"visible":"hidden"})},getSegmentPath:function(t){var e=this,i=[];return Je(t,function(n,s){e.getPointSpline?i.push.apply(i,e.getPointSpline(t,n,s)):(i.push(s?"L":"M"),s&&e.options.step&&i.push(n.plotX,t[s-1].plotY),i.push(n.plotX,n.plotY))}),i},getGraphPath:function(){var t,e=this,i=[],n=[];return Je(e.segments,function(s){t=e.getSegmentPath(s),s.length>1?i=i.concat(t):n.push(s[0])}),e.singlePoints=n,e.graphPath=i},drawGraph:function(){var t=this.options,e=this.graph,i=this.group,n=t.lineColor||this.color,s=t.lineWidth,r=t.dashStyle,o=this.getGraphPath();e?(ai(e),e.animate({d:o})):s&&(e={stroke:n,"stroke-width":s,zIndex:1},r&&(e.dashstyle=r),this.graph=this.chart.renderer.path(o).attr(e).add(i).shadow(t.shadow))},invertGroups:function(){function t(){var t={width:e.yAxis.len,height:e.xAxis.len};Je(["group","trackerGroup","markerGroup"],function(i){e[i]&&e[i].attr(t).invert()})}var e=this,i=e.chart;ii(i,"resize",t),ii(e,"destroy",function(){ni(i,"resize",t)}),t(),e.invertGroups=t},plotGroup:function(t,e,i,n,s){var r=this[t],o=this.chart,a=this.xAxis,l=this.yAxis;return r||(this[t]=r=o.renderer.g(e).attr({visibility:i,zIndex:n||.1}).add(s)),r.translate(a?a.left:o.plotLeft,l?l.top:o.plotTop),r},render:function(){var t,e=this.chart,i=this.options,n=i.animation&&!!this.animate,s=this.visible?"visible":"hidden",r=i.zIndex,o=this.hasRendered,a=e.seriesGroup;t=this.plotGroup("group","series",s,r,a),this.markerGroup=this.plotGroup("markerGroup","markers",s,r,a),n&&this.animate(!0),this.getAttribs(),t.inverted=e.inverted,this.drawGraph&&this.drawGraph(),this.drawPoints(),this.drawDataLabels(),this.options.enableMouseTracking!==!1&&this.drawTracker(),e.inverted&&this.invertGroups(),i.clip!==!1&&!this.sharedClipKey&&!o&&(t.clip(e.clipRect),this.trackerGroup&&this.trackerGroup.clip(e.clipRect)),n?this.animate():o||this.afterAnimate(),this.isDirty=this.isDirtyData=!1,this.hasRendered=!0},redraw:function(){var t=this.chart,e=this.isDirtyData,i=this.group;i&&(t.inverted&&i.attr({width:t.plotWidth,height:t.plotHeight}),i.animate({translateX:this.xAxis.left,translateY:this.yAxis.top})),this.translate(),this.setTooltipPoints(!0),this.render(),e&&si(this,"updatedData")},setState:function(t){var e=this.options,i=this.graph,n=e.states,e=e.lineWidth,t=t||"";this.state!==t&&(this.state=t,n[t]&&n[t].enabled===!1||(t&&(e=n[t].lineWidth||e+1),i&&!i.dashstyle&&i.attr({"stroke-width":e},t?0:500)))},setVisible:function(t,e){var i,n=this.chart,s=this.legendItem,r=this.group,o=this.tracker,a=this.dataLabelsGroup,l=this.markerGroup,h=this.points,c=n.options.chart.ignoreHiddenSeries;if(i=this.visible,i=(this.visible=t=t===R?!i:t)?"show":"hide",r&&r[i](),l&&l[i](),o)o[i]();else if(h)for(r=h.length;r--;)o=h[r],o.tracker&&o.tracker[i]();a&&a[i](),s&&n.legend.colorizeItem(this,t),this.isDirty=!0,this.options.stacking&&Je(n.series,function(t){t.options.stacking&&t.visible&&(t.isDirty=!0)}),c&&(n.isDirtyBox=!0),e!==!1&&n.redraw(),si(this,i)},show:function(){this.setVisible(!0)},hide:function(){this.setVisible(!1)},select:function(t){this.selected=t=t===R?!this.selected:t,this.checkbox&&(this.checkbox.checked=t),si(this,t?"select":"unselect")},drawTracker:function(){var t,e=this,i=e.options,n=i.trackByArea,s=[].concat(n?e.areaPath:e.graphPath),r=s.length,o=e.chart,a=o.renderer,l=o.options.tooltip.snap,h=e.tracker,c=i.cursor,c=c&&{cursor:c},u=e.singlePoints,d=this.isCartesian&&this.plotGroup("trackerGroup",null,"visible",i.zIndex||1,o.trackerGroup);if(r&&!n)for(t=r+1;t--;)"M"===s[t]&&s.splice(t+1,0,s[t+1]-l,s[t+2],"L"),(t&&"M"===s[t]||t===r)&&s.splice(t,0,"L",s[t-2]+l,s[t-1]);for(t=0;t<u.length;t++)r=u[t],s.push("M",r.plotX-l,r.plotY,"L",r.plotX+l,r.plotY);h?h.attr({d:s}):e.tracker=a.path(s).attr({isTracker:!0,"stroke-linejoin":"bevel",visibility:e.visible?"visible":"hidden",stroke:ze,fill:n?ze:$e,"stroke-width":i.lineWidth+(n?0:2*l)}).on(Ee?"touchstart":"mouseover",function(){o.hoverSeries!==e&&e.onMouseOver()}).on("mouseout",function(){i.stickyTracking||e.onMouseOut()}).css(c).add(d)}},Ge=g(gi),Ve.line=Ge,li.area=ei(Ue,{threshold:0}),Ge=g(gi,{type:"area",getSegmentPath:function(t){var e,i=gi.prototype.getSegmentPath.call(this,t),n=[].concat(i),s=this.options;if(3===i.length&&n.push("L",i[1],i[2]),s.stacking&&!this.closedStacks)for(e=t.length-1;e>=0;e--)e<t.length-1&&s.step&&n.push(t[e+1].plotX,t[e].yBottom),n.push(t[e].plotX,t[e].yBottom);else this.closeSegment(n,t);return this.areaPath=this.areaPath.concat(n),i},closeSegment:function(t,e){var i=this.yAxis.getThreshold(this.options.threshold);t.push("L",e[e.length-1].plotX,i,"L",e[0].plotX,i)},drawGraph:function(){this.areaPath=[],gi.prototype.drawGraph.apply(this);var t=this.areaPath,e=this.options,i=this.area;i?i.animate({d:t}):this.area=this.chart.renderer.path(t).attr({fill:p(e.fillColor,hi(this.color).setOpacity(e.fillOpacity||.75).get()),zIndex:0}).add(this.group)},drawLegendSymbol:function(t,e){e.legendSymbol=this.chart.renderer.rect(0,t.baseline-11,t.options.symbolWidth,12,2).attr({zIndex:3}).add(e.legendGroup)}}),Ve.area=Ge,li.spline=ei(Ue),di=g(gi,{type:"spline",getPointSpline:function(t,e,i){var n,s,r,o,a=e.plotX,l=e.plotY,h=t[i-1],c=t[i+1];if(h&&c){t=h.plotY,r=c.plotX;var u,c=c.plotY;n=(1.5*a+h.plotX)/2.5,s=(1.5*l+t)/2.5,r=(1.5*a+r)/2.5,o=(1.5*l+c)/2.5,u=(o-s)*(r-a)/(r-n)+l-o,s+=u,o+=u,s>t&&s>l?(s=pe(t,l),o=2*l-s):t>s&&l>s&&(s=fe(t,l),o=2*l-s),o>c&&o>l?(o=pe(c,l),s=2*l-o):c>o&&l>o&&(o=fe(c,l),s=2*l-o),e.rightContX=r,e.rightContY=o}return i?(e=["C",h.rightContX||h.plotX,h.rightContY||h.plotY,n||a,s||l,a,l],h.rightContX=h.rightContY=null):e=["M",a,l],e}}),Ve.spline=di,li.areaspline=ei(li.area);var vi=Ge.prototype,di=g(di,{type:"areaspline",closedStacks:!0,getSegmentPath:vi.getSegmentPath,closeSegment:vi.closeSegment,drawGraph:vi.drawGraph});Ve.areaspline=di,li.column=ei(Ue,{borderColor:"#FFFFFF",borderWidth:1,borderRadius:0,groupPadding:.2,marker:null,pointPadding:.1,minPointLength:0,cropThreshold:50,pointRange:null,states:{hover:{brightness:.1,shadow:!1},select:{color:"#C0C0C0",borderColor:"#000000",shadow:!1}},dataLabels:{align:null,verticalAlign:null,y:null},threshold:0}),di=g(gi,{type:"column",tooltipOutsidePlot:!0,pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color",r:"borderRadius"},init:function(){gi.prototype.init.apply(this,arguments);var t=this,e=t.chart;e.hasRendered&&Je(e.series,function(e){e.type===t.type&&(e.isDirty=!0)})},translate:function(){var t,e,i=this,n=i.chart,s=i.options,r=s.stacking,o=s.borderWidth,a=0,l=i.xAxis,h=l.reversed,u={};gi.prototype.translate.apply(i),s.grouping===!1?a=1:Je(n.series,function(n){var s=n.options;n.type===i.type&&n.visible&&i.options.group===s.group&&(s.stacking?(t=n.stackKey,u[t]===R&&(u[t]=a++),e=u[t]):s.grouping!==!1&&(e=a++),n.columnIndex=e)});var d=i.points,l=me(l.transA)*(l.ordinalSlope||s.pointRange||l.closestPointRange||1),f=l*s.groupPadding,m=(l-2*f)/a,g=s.pointWidth,v=c(g)?(m-g)/2:m*s.pointPadding,y=p(g,m-2*v),b=de(pe(y,1+2*o)),x=v+(f+((h?a-i.columnIndex:i.columnIndex)||0)*m-l/2)*(h?-1:1),w=i.translatedThreshold=i.yAxis.getThreshold(s.threshold),k=p(s.minPointLength,5);Je(d,function(t){var e=t.plotY,s=p(t.yBottom,w),a=t.plotX+x,l=de(fe(e,s)),h=de(pe(e,s)-l),c=i.yAxis.stacks[(t.y<0?"-":"")+i.stackKey];r&&i.visible&&c&&c[t.x]&&c[t.x].setOffset(x,b),me(h)<k&&k&&(h=k,l=me(l-w)>k?s-k:w-(w>=e?k:0)),t.barX=a,t.pointWidth=y,t.shapeType="rect",t.shapeArgs=e=n.renderer.Element.prototype.crisp.call(0,o,a,l,b,h),o%2&&(e.y-=1,e.height+=1),t.trackerArgs=me(h)<3&&ei(t.shapeArgs,{height:6,y:l-3})})},getSymbol:Le,drawLegendSymbol:Ge.prototype.drawLegendSymbol,drawGraph:Le,drawPoints:function(){var t,e=this,i=e.options,n=e.chart.renderer;Je(e.points,function(s){var r=s.plotY,o=s.graphic;r===R||isNaN(r)||null===s.y?o&&(s.graphic=o.destroy()):(t=s.shapeArgs,o?(ai(o),o.animate(ei(t))):s.graphic=n[s.shapeType](t).attr(s.pointAttr[s.selected?"select":""]).add(e.group).shadow(i.shadow,null,i.stacking&&!i.borderRadius))})},drawTracker:function(){var t,e,i,n,s,r=this,o=r.chart,a=o.renderer,l=+new Date,h=r.options,c=h.cursor,d=c&&{cursor:c},p=r.isCartesian&&r.plotGroup("trackerGroup",null,"visible",h.zIndex||1,o.trackerGroup);Je(r.points,function(c){e=c.tracker,t=c.trackerArgs||c.shapeArgs,n=c.plotY,s=!r.isCartesian||n!==R&&!isNaN(n),delete t.strokeWidth,null!==c.y&&s&&(e?e.attr(t):c.tracker=a[c.shapeType](t).attr({isTracker:l,fill:ze,visibility:r.visible?"visible":"hidden"}).on(Ee?"touchstart":"mouseover",function(t){i=t.relatedTarget||t.fromElement,o.hoverSeries!==r&&u(i,"isTracker")!==l&&r.onMouseOver(),c.onMouseOver()}).on("mouseout",function(t){h.stickyTracking||(i=t.relatedTarget||t.toElement,u(i,"isTracker")===l)||r.onMouseOut()}).css(d).add(c.group||p))})},alignDataLabel:function(t,e,i,n,s){var r=this.chart,o=r.inverted,a=t.below||t.plotY>(this.translatedThreshold||r.plotSizeY),l=this.options.stacking||i.inside;t.shapeArgs&&(n=ei(t.shapeArgs),o&&(n={x:r.plotWidth-n.y-n.height,y:r.plotHeight-n.x-n.width,width:n.height,height:n.width}),!l)&&(o?(n.x+=a?0:n.width,n.width=0):(n.y+=a?n.height:0,n.height=0)),i.align=p(i.align,!o||l?"center":a?"right":"left"),i.verticalAlign=p(i.verticalAlign,o||l?"middle":a?"top":"bottom"),gi.prototype.alignDataLabel.call(this,t,e,i,n,s)},animate:function(t){var e=this,i=e.points,n=e.options;t||(Je(i,function(t){var i=t.graphic,t=t.shapeArgs,s=e.yAxis,r=n.threshold;i&&(i.attr({height:0,y:c(r)?s.getThreshold(r):s.translate(s.getExtremes().min,0,1,0,1)}),i.animate({height:t.height,y:t.y},n.animation))}),e.animate=null)},remove:function(){var t=this,e=t.chart;e.hasRendered&&Je(e.series,function(e){e.type===t.type&&(e.isDirty=!0)}),gi.prototype.remove.apply(t,arguments)}}),Ve.column=di,li.bar=ei(li.column),vi=g(di,{type:"bar",inverted:!0}),Ve.bar=vi,li.scatter=ei(Ue,{lineWidth:0,states:{hover:{lineWidth:0}},tooltip:{headerFormat:'<span style="font-size: 10px; color:{series.color}">{series.name}</span><br/>',pointFormat:"x: <b>{point.x}</b><br/>y: <b>{point.y}</b><br/>"}}),vi=g(gi,{type:"scatter",sorted:!1,translate:function(){var t=this;gi.prototype.translate.apply(t),Je(t.points,function(e){e.shapeType="circle",e.shapeArgs={x:e.plotX,y:e.plotY,r:t.chart.options.tooltip.snap}})},drawTracker:function(){for(var t,e=this,i=e.options.cursor,i=i&&{cursor:i},n=e.points,s=n.length;s--;)(t=n[s].graphic)&&(t.element._i=s);e._hasTracking?e._hasTracking=!0:e.markerGroup.attr({isTracker:!0}).on(Ee?"touchstart":"mouseover",function(t){e.onMouseOver(),t.target._i!==R&&n[t.target._i].onMouseOver()}).on("mouseout",function(){e.options.stickyTracking||e.onMouseOut()}).css(i)}}),Ve.scatter=vi,li.pie=ei(Ue,{borderColor:"#FFFFFF",borderWidth:1,center:["50%","50%"],colorByPoint:!0,dataLabels:{distance:30,enabled:!0,formatter:function(){return this.point.name}},legendType:"point",marker:null,size:"75%",showInLegend:!1,slicedOffset:10,states:{hover:{brightness:.1,shadow:!1}}}),Le={type:"pie",isCartesian:!1,pointClass:g(mi,{init:function(){mi.prototype.init.apply(this,arguments);var e,i=this;return t(i,{visible:i.visible!==!1,name:p(i.name,"Slice")}),e=function(){i.slice()},ii(i,"select",e),ii(i,"unselect",e),i},setVisible:function(t){var e,i=this.series,n=i.chart,s=this.tracker,r=this.dataLabel,o=this.connector,a=this.shadowGroup;e=(this.visible=t=t===R?!this.visible:t)?"show":"hide",this.group[e](),s&&s[e](),r&&r[e](),o&&o[e](),a&&a[e](),this.legendItem&&n.legend.colorizeItem(this,t),!i.isDirty&&i.options.ignoreHiddenPoint&&(i.isDirty=!0,n.redraw())},slice:function(t,e,i){var n=this.series.chart,s=this.slicedTranslation;E(i,n),p(e,!0),t=this.sliced=c(t)?t:!this.sliced,t={translateX:t?s[0]:n.plotLeft,translateY:t?s[1]:n.plotTop},this.group.animate(t),this.shadowGroup&&this.shadowGroup.animate(t)}}),pointAttrToOptions:{stroke:"borderColor","stroke-width":"borderWidth",fill:"color"},getColor:function(){this.initialColor=this.chart.counters.color},animate:function(){var t=this;Je(t.points,function(e){var i=e.graphic,e=e.shapeArgs,n=-ye/2;i&&(i.attr({r:0,start:n,end:n}),i.animate({r:e.r,start:e.start,end:e.end},t.options.animation))}),t.animate=null},setData:function(t,e){gi.prototype.setData.call(this,t,!1),this.processData(),this.generatePoints(),p(e,!0)&&this.chart.redraw()},getCenter:function(){var t,e=this.options,n=this.chart,s=n.plotWidth,r=n.plotHeight,e=e.center.concat([e.size,e.innerSize||0]),o=fe(s,r);return ti(e,function(e,n){return(t=/%$/.test(e))?[s,r,o,o][n]*i(e)/100:e})},translate:function(){this.generatePoints();var t,e,i,n,s,r,o=0,a=-.25,l=this.options,h=l.slicedOffset,c=h+l.borderWidth,u=this.chart,d=this.points,p=2*ye,f=l.dataLabels.distance,m=l.ignoreHiddenPoint,g=d.length;for(this.center=t=this.getCenter(),this.getX=function(e,i){return n=he.asin((e-t[1])/(t[2]/2+f)),t[0]+(i?-1:1)*ge(n)*(t[2]/2+f)},s=0;g>s;s++)r=d[s],o+=m&&!r.visible?0:r.y;for(s=0;g>s;s++)r=d[s],l=o?r.y/o:0,e=ce(1e3*a*p)/1e3,(!m||r.visible)&&(a+=l),i=ce(1e3*a*p)/1e3,r.shapeType="arc",r.shapeArgs={x:t[0],y:t[1],r:t[2]/2,innerR:t[3]/2,start:e,end:i},n=(i+e)/2,r.slicedTranslation=ti([ge(n)*h+u.plotLeft,ve(n)*h+u.plotTop],ce),e=ge(n)*t[2]/2,i=ve(n)*t[2]/2,r.tooltipPos=[t[0]+.7*e,t[1]+.7*i],r.labelPos=[t[0]+e+ge(n)*f,t[1]+i+ve(n)*f,t[0]+e+ge(n)*c,t[1]+i+ve(n)*c,t[0]+e,t[1]+i,0>f?"center":p/4>n?"left":"right",n],r.percentage=100*l,r.total=o;this.setTooltipPoints()},render:function(){this.getAttribs(),this.drawPoints(),this.options.enableMouseTracking!==!1&&this.drawTracker(),this.drawDataLabels(),this.options.animation&&this.animate&&this.animate(),this.isDirty=!1},drawPoints:function(){var e,i,n,s,r,o=this,a=o.chart,l=a.renderer,h=o.options.shadow;Je(o.points,function(c){i=c.graphic,r=c.shapeArgs,n=c.group,s=c.shadowGroup,h&&!s&&(s=c.shadowGroup=l.g("shadow").attr({zIndex:4}).add()),n||(n=c.group=l.g("point").attr({zIndex:5}).add()),e=c.sliced?c.slicedTranslation:[a.plotLeft,a.plotTop],n.translate(e[0],e[1]),s&&s.translate(e[0],e[1]),i?i.animate(r):c.graphic=i=l.arc(r).setRadialReference(o.center).attr(t(c.pointAttr[""],{"stroke-linejoin":"round"})).add(c.group).shadow(h,s),c.visible===!1&&c.setVisible(!1)})},drawDataLabels:function(){var t,e,i,n,s,r,o,a,l=this.data,h=this.chart,c=this.options.dataLabels,u=p(c.connectorPadding,10),d=p(c.connectorWidth,1),f=p(c.softConnector,!0),m=c.distance,g=this.center,v=g[2]/2,y=g[1],b=m>0,x=[[],[]],w=2;if(c.enabled||this._hasPointLabels)for(gi.prototype.drawDataLabels.apply(this),Je(l,function(t){t.dataLabel&&x[t.labelPos[7]<ye/2?0:1].push(t)}),x[1].reverse(),o=function(t,e){return e.y-t.y},l=x[0][0]&&x[0][0].dataLabel&&(x[0][0].dataLabel.getBBox().height||21);w--;){var k,_=[],C=[],D=x[w],M=D.length;if(m>0){for(a=y-v-m;y+v+m>=a;a+=l)_.push(a);if(r=_.length,M>r){for(i=[].concat(D),i.sort(o),a=M;a--;)i[a].rank=a;for(a=M;a--;)D[a].rank>=r&&D.splice(a,1);M=D.length}for(a=0;M>a;a++){for(t=D[a],i=t.labelPos,t=9999,s=0;r>s;s++)e=me(_[s]-i[1]),t>e&&(t=e,k=s);if(a>k&&null!==_[a])k=a;else for(M-a+k>r&&null!==_[a]&&(k=r-M+a);null===_[k];)k++;C.push({i:k,y:_[k]}),_[k]=null}C.sort(o)}for(a=0;M>a;a++)t=D[a],i=t.labelPos,e=t.dataLabel,r=t.visible===!1?"hidden":"visible",n=i[1],m>0?(s=C.pop(),k=s.i,s=s.y,(n>s&&null!==_[k+1]||s>n&&null!==_[k-1])&&(s=n)):s=n,n=c.justify?g[0]+(w?-1:1)*(v+m):this.getX(0===k||k===_.length-1?n:s,w),e.attr({visibility:r,align:i[6]})[e.moved?"animate":"attr"]({x:n+c.x+({left:u,right:-u}[i[6]]||0),y:s+c.y-10}),e.moved=!0,b&&d&&(e=t.connector,i=f?["M",n+("left"===i[6]?5:-5),s,"C",n,s,2*i[2]-i[4],2*i[3]-i[5],i[2],i[3],"L",i[4],i[5]]:["M",n+("left"===i[6]?5:-5),s,"L",i[2],i[3],"L",i[4],i[5]],e?(e.animate({d:i}),e.attr("visibility",r)):t.connector=e=this.chart.renderer.path(i).attr({"stroke-width":d,stroke:c.connectorColor||t.color||"#606060",visibility:r,zIndex:3}).translate(h.plotLeft,h.plotTop).add())}},alignDataLabel:Le,drawTracker:di.prototype.drawTracker,drawLegendSymbol:Ge.prototype.drawLegendSymbol,getSymbol:function(){}},Le=g(gi,Le),Ve.pie=Le,t(Highcharts,{Axis:z,CanVGRenderer:pi,Chart:W,Color:hi,Legend:H,MouseTracker:O,Point:mi,Tick:L,Tooltip:P,Renderer:j,Series:gi,SVGRenderer:ci,VMLRenderer:ui,dateFormat:V,pathAnim:G,getOptions:function(){return Y},hasBidiBug:Te,numberFormat:v,seriesTypes:Ve,setOptions:function(t){return Y=ei(Y,t),F(),Y},addEvent:ii,removeEvent:ni,createElement:m,discardElement:S,css:f,each:Je,extend:t,map:ti,merge:ei,pick:p,splat:d,extendClass:g,pInt:i,wrap:function(t,e,i){var n=t[e];t[e]=function(){var t=Array.prototype.slice.call(arguments);return t.unshift(n),i.apply(this,t)}},svg:Se,canvas:Ae,vml:!Se&&!Ae,product:"Highcharts",version:"2.3.3"})}(),window.Highcharts}),!function(t,e){var i=e.prototype.trim,n=e.prototype.trimRight,s=e.prototype.trimLeft,r=function(t){return 1*t||0},o=function(t,e){if(1>e)return"";for(var i="";e>0;)1&e&&(i+=t),e>>=1,t+=t;return i},a=[].slice,l=function(t){return null==t?"\\s":t.source?t.source:"["+p.escapeRegExp(t)+"]"},h={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},c={};for(var u in h)c[h[u]]=u;c["'"]="#39";var d=function(){function t(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}var i=o,n=function(){return n.cache.hasOwnProperty(arguments[0])||(n.cache[arguments[0]]=n.parse(arguments[0])),n.format.call(null,n.cache[arguments[0]],arguments)};return n.format=function(n,s){var r,o,a,l,h,c,u,p=1,f=n.length,m="",g=[];for(o=0;f>o;o++)if(m=t(n[o]),"string"===m)g.push(n[o]);else if("array"===m){if(l=n[o],l[2])for(r=s[p],a=0;a<l[2].length;a++){if(!r.hasOwnProperty(l[2][a]))throw new Error(d('[_.sprintf] property "%s" does not exist',l[2][a]));r=r[l[2][a]]}else r=l[1]?s[l[1]]:s[p++];if(/[^s]/.test(l[8])&&"number"!=t(r))throw new Error(d("[_.sprintf] expecting number but found %s",t(r)));switch(l[8]){case"b":r=r.toString(2);break;case"c":r=e.fromCharCode(r);break;case"d":r=parseInt(r,10);break;case"e":r=l[7]?r.toExponential(l[7]):r.toExponential();break;case"f":r=l[7]?parseFloat(r).toFixed(l[7]):parseFloat(r);break;case"o":r=r.toString(8);break;case"s":r=(r=e(r))&&l[7]?r.substring(0,l[7]):r;break;case"u":r=Math.abs(r);break;case"x":r=r.toString(16);break;case"X":r=r.toString(16).toUpperCase()}r=/[def]/.test(l[8])&&l[3]&&r>=0?"+"+r:r,c=l[4]?"0"==l[4]?"0":l[4].charAt(1):" ",u=l[6]-e(r).length,h=l[6]?i(c,u):"",g.push(l[5]?r+h:h+r)}return g.join("")},n.cache={},n.parse=function(t){for(var e=t,i=[],n=[],s=0;e;){if(null!==(i=/^[^\x25]+/.exec(e)))n.push(i[0]);else if(null!==(i=/^\x25{2}/.exec(e)))n.push("%");else{if(null===(i=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(e)))throw new Error("[_.sprintf] huh?");if(i[2]){s|=1;var r=[],o=i[2],a=[];if(null===(a=/^([a-z_][a-z_\d]*)/i.exec(o)))throw new Error("[_.sprintf] huh?");for(r.push(a[1]);""!==(o=o.substring(a[0].length));)if(null!==(a=/^\.([a-z_][a-z_\d]*)/i.exec(o)))r.push(a[1]);else{if(null===(a=/^\[(\d+)\]/.exec(o)))throw new Error("[_.sprintf] huh?");r.push(a[1])}i[2]=r}else s|=2;if(3===s)throw new Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");n.push(i)}e=e.substring(i[0].length)}return n},n}(),p={VERSION:"2.3.0",isBlank:function(t){return null==t&&(t=""),/^\s*$/.test(t)},stripTags:function(t){return null==t?"":e(t).replace(/<\/?[^>]+>/g,"")},capitalize:function(t){return t=null==t?"":e(t),t.charAt(0).toUpperCase()+t.slice(1)},chop:function(t,i){return null==t?[]:(t=e(t),i=~~i,i>0?t.match(new RegExp(".{1,"+i+"}","g")):[t])},clean:function(t){return p.strip(t).replace(/\s+/g," ")},count:function(t,i){if(null==t||null==i)return 0;t=e(t),i=e(i);for(var n=0,s=0,r=i.length;;){if(s=t.indexOf(i,s),-1===s)break;n++,s+=r}return n},chars:function(t){return null==t?[]:e(t).split("")},swapCase:function(t){return null==t?"":e(t).replace(/\S/g,function(t){return t===t.toUpperCase()?t.toLowerCase():t.toUpperCase()})},escapeHTML:function(t){return null==t?"":e(t).replace(/[&<>"']/g,function(t){return"&"+c[t]+";"})},unescapeHTML:function(t){return null==t?"":e(t).replace(/\&([^;]+);/g,function(t,i){var n;return i in h?h[i]:(n=i.match(/^#x([\da-fA-F]+)$/))?e.fromCharCode(parseInt(n[1],16)):(n=i.match(/^#(\d+)$/))?e.fromCharCode(~~n[1]):t})},escapeRegExp:function(t){return null==t?"":e(t).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(t,e,i,n){var s=p.chars(t);return s.splice(~~e,~~i,n),s.join("")},insert:function(t,e,i){return p.splice(t,e,0,i)},include:function(t,i){return""===i?!0:null==t?!1:-1!==e(t).indexOf(i)},join:function(){var t=a.call(arguments),e=t.shift();return null==e&&(e=""),t.join(e)},lines:function(t){return null==t?[]:e(t).split("\n")},reverse:function(t){return p.chars(t).reverse().join("")},startsWith:function(t,i){return""===i?!0:null==t||null==i?!1:(t=e(t),i=e(i),t.length>=i.length&&t.slice(0,i.length)===i)},endsWith:function(t,i){return""===i?!0:null==t||null==i?!1:(t=e(t),i=e(i),t.length>=i.length&&t.slice(t.length-i.length)===i)},succ:function(t){return null==t?"":(t=e(t),t.slice(0,-1)+e.fromCharCode(t.charCodeAt(t.length-1)+1))},titleize:function(t){return null==t?"":e(t).replace(/(?:^|\s)\S/g,function(t){return t.toUpperCase()
389
+ })},camelize:function(t){return p.trim(t).replace(/[-_\s]+(.)?/g,function(t,e){return e.toUpperCase()})},underscored:function(t){return p.trim(t).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(t){return p.trim(t).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(t){return p.titleize(e(t).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(t){return p.capitalize(p.underscored(t).replace(/_id$/,"").replace(/_/g," "))},trim:function(t,n){return null==t?"":!n&&i?i.call(t):(n=l(n),e(t).replace(new RegExp("^"+n+"+|"+n+"+$","g"),""))},ltrim:function(t,i){return null==t?"":!i&&s?s.call(t):(i=l(i),e(t).replace(new RegExp("^"+i+"+"),""))},rtrim:function(t,i){return null==t?"":!i&&n?n.call(t):(i=l(i),e(t).replace(new RegExp(i+"+$"),""))},truncate:function(t,i,n){return null==t?"":(t=e(t),n=n||"...",i=~~i,t.length>i?t.slice(0,i)+n:t)},prune:function(t,i,n){if(null==t)return"";if(t=e(t),i=~~i,n=null!=n?e(n):"...",t.length<=i)return t;var s=function(t){return t.toUpperCase()!==t.toLowerCase()?"A":" "},r=t.slice(0,i+1).replace(/.(?=\W*\w*$)/g,s);return r=r.slice(r.length-2).match(/\w\w/)?r.replace(/\s*\S+$/,""):p.rtrim(r.slice(0,r.length-1)),(r+n).length>t.length?t:t.slice(0,r.length)+n},words:function(t,e){return p.isBlank(t)?[]:p.trim(t,e).split(e||/\s+/)},pad:function(t,i,n,s){t=null==t?"":e(t),i=~~i;var r=0;switch(n?n.length>1&&(n=n.charAt(0)):n=" ",s){case"right":return r=i-t.length,t+o(n,r);case"both":return r=i-t.length,o(n,Math.ceil(r/2))+t+o(n,Math.floor(r/2));default:return r=i-t.length,o(n,r)+t}},lpad:function(t,e,i){return p.pad(t,e,i)},rpad:function(t,e,i){return p.pad(t,e,i,"right")},lrpad:function(t,e,i){return p.pad(t,e,i,"both")},sprintf:d,vsprintf:function(t,e){return e.unshift(t),d.apply(null,e)},toNumber:function(t,e){return t?(t=p.trim(t),t.match(/^-?\d+(?:\.\d+)?$/)?r(r(t).toFixed(~~e)):0/0):0},numberFormat:function(t,e,i,n){if(isNaN(t)||null==t)return"";t=t.toFixed(~~e),n="string"==typeof n?n:",";var s=t.split("."),r=s[0],o=s[1]?(i||".")+s[1]:"";return r.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+n)+o},strRight:function(t,i){if(null==t)return"";t=e(t),i=null!=i?e(i):i;var n=i?t.indexOf(i):-1;return~n?t.slice(n+i.length,t.length):t},strRightBack:function(t,i){if(null==t)return"";t=e(t),i=null!=i?e(i):i;var n=i?t.lastIndexOf(i):-1;return~n?t.slice(n+i.length,t.length):t},strLeft:function(t,i){if(null==t)return"";t=e(t),i=null!=i?e(i):i;var n=i?t.indexOf(i):-1;return~n?t.slice(0,n):t},strLeftBack:function(t,e){if(null==t)return"";t+="",e=null!=e?""+e:e;var i=t.lastIndexOf(e);return~i?t.slice(0,i):t},toSentence:function(t,e,i,n){e=e||", ",i=i||" and ";var s=t.slice(),r=s.pop();return t.length>2&&n&&(i=p.rtrim(e)+i),s.length?s.join(e)+i+r:r},toSentenceSerial:function(){var t=a.call(arguments);return t[3]=!0,p.toSentence.apply(p,t)},slugify:function(t){if(null==t)return"";var i="ąàáäâãåæćęèéëêìíïîłńòóöôõøśùúüûñçżź",n="aaaaaaaaceeeeeiiiilnoooooosuuuunczz",s=new RegExp(l(i),"g");return t=e(t).toLowerCase().replace(s,function(t){var e=i.indexOf(t);return n.charAt(e)||"-"}),p.dasherize(t.replace(/[^\w\s-]/g,""))},surround:function(t,e){return[e,t,e].join("")},quote:function(t){return p.surround(t,'"')},exports:function(){var t={};for(var e in this)this.hasOwnProperty(e)&&!e.match(/^(?:include|contains|reverse)$/)&&(t[e]=this[e]);return t},repeat:function(t,i,n){if(null==t)return"";if(i=~~i,null==n)return o(e(t),i);for(var s=[];i>0;s[--i]=t);return s.join(n)},naturalCmp:function(t,i){if(t==i)return 0;if(!t)return-1;if(!i)return 1;for(var n=/(\.\d+)|(\d+)|(\D+)/g,s=e(t).toLowerCase().match(n),r=e(i).toLowerCase().match(n),o=Math.min(s.length,r.length),a=0;o>a;a++){var l=s[a],h=r[a];if(l!==h){var c=parseInt(l,10);if(!isNaN(c)){var u=parseInt(h,10);if(!isNaN(u)&&c-u)return c-u}return h>l?-1:1}}return s.length===r.length?s.length-r.length:i>t?-1:1},levenshtein:function(t,i){if(null==t&&null==i)return 0;if(null==t)return e(i).length;if(null==i)return e(t).length;t=e(t),i=e(i);for(var n,s,r=[],o=0;o<=i.length;o++)for(var a=0;a<=t.length;a++)s=o&&a?t.charAt(a-1)===i.charAt(o-1)?n:Math.min(r[a],r[a-1],n)+1:o+a,n=r[a],r[a]=s;return r.pop()}};p.strip=p.trim,p.lstrip=p.ltrim,p.rstrip=p.rtrim,p.center=p.lrpad,p.rjust=p.lpad,p.ljust=p.rpad,p.contains=p.include,p.q=p.quote,"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(module.exports=p),exports._s=p),"function"==typeof define&&define.amd&&define("underscore.string",[],function(){return p}),t._=t._||{},t._.string=t._.str=p}(this,String),define("underscore-string",function(t){return function(){var e;return e||t._.str}}(this)),define("highcharts-theme",["jquery","highcharts"],function(t,e){return e.theme={colors:["#DDDF0D","#7798BF","#55BF3B","#DF5353","#aaeeee","#ff0066","#eeaaee","#55BF3B","#DF5353","#7798BF","#aaeeee"],chart:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"rgb(96, 96, 96)"],[1,"rgb(16, 16, 16)"]]},borderWidth:0,borderRadius:15,plotBackgroundColor:null,plotShadow:!1,plotBorderWidth:0},title:{style:{color:"#FFF",font:"16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}},subtitle:{style:{color:"#DDD",font:"12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}},xAxis:{gridLineWidth:0,lineColor:"#999",tickColor:"#999",labels:{style:{color:"#999",fontWeight:"bold"}},title:{style:{color:"#AAA",font:"bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}}},yAxis:{alternateGridColor:null,minorTickInterval:null,gridLineColor:"rgba(255, 255, 255, .1)",lineWidth:0,tickWidth:0,labels:{style:{color:"#999",fontWeight:"bold"}},title:{style:{color:"#AAA",font:"bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif"}}},legend:{itemStyle:{color:"#CCC"},itemHoverStyle:{color:"#FFF"},itemHiddenStyle:{color:"#333"}},labels:{style:{color:"#CCC"}},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"rgba(96, 96, 96, .8)"],[1,"rgba(16, 16, 16, .8)"]]},borderWidth:0,style:{color:"#FFF"}},plotOptions:{line:{dataLabels:{color:"#CCC"},marker:{lineColor:"#333"}},spline:{marker:{lineColor:"#333"}},scatter:{marker:{lineColor:"#333"}},candlestick:{lineColor:"white"}},toolbar:{itemStyle:{color:"#CCC"}},navigation:{buttonOptions:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#606060"],[.6,"#333333"]]},borderColor:"#000000",symbolStroke:"#C0C0C0",hoverSymbolStroke:"#FFFFFF"}},exporting:{buttons:{exportButton:{symbolFill:"#55BE3B"},printButton:{symbolFill:"#7797BE"}}},rangeSelector:{buttonTheme:{fill:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#888"],[.6,"#555"]]},stroke:"#000000",style:{color:"#CCC",fontWeight:"bold"},states:{hover:{fill:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#BBB"],[.6,"#888"]]},stroke:"#000000",style:{color:"white"}},select:{fill:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.1,"#000"],[.3,"#333"]]},stroke:"#000000",style:{color:"yellow"}}}},inputStyle:{backgroundColor:"#333",color:"silver"},labelStyle:{color:"silver"}},navigator:{handles:{backgroundColor:"#666",borderColor:"#AAA"},outlineColor:"#CCC",maskFill:"rgba(16, 16, 16, 0.5)",series:{color:"#7798BF",lineColor:"#A6C7ED"}},scrollbar:{barBackgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#888"],[.6,"#555"]]},barBorderColor:"#CCC",buttonArrowColor:"#CCC",buttonBackgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[.4,"#888"],[.6,"#555"]]},buttonBorderColor:"#CCC",rifleColor:"#FFF",trackBackgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,"#000"],[1,"#333"]]},trackBorderColor:"#666"},legendBackgroundColor:"rgba(48, 48, 48, 0.8)",legendBackgroundColorSolid:"rgb(70, 70, 70)",dataLabelsColor:"#444",textColor:"#E0E0E0",maskColor:"rgba(255,255,255,0.3)"},e.setOptions(e.theme),e.theme});var XDate=function(t,e,i,n){function s(){return r(this instanceof s?this:new s,arguments)}function r(e,i){var n,r=i.length;if(z(i[r-1])&&(n=i[--r],i=I(i,0,r)),r)if(1==r){var o=i[0];o instanceof t||$(o)?e[0]=new t(+o):o instanceof s?e[0]=C(o):N(o)&&(e[0]=new t(0),e=m(o,n||!1,e))}else e[0]=new t(ee.apply(t,i)),n||(e[0]=T(e[0]));else e[0]=new t;return z(n)&&a(e,n),e}function o(t){return t[0].toString===ie}function a(e,i,n){return i?o(e)||(n&&(e[0]=S(e[0])),e[0].toString=ie):o(e)&&(e[0]=n?T(e[0]):new t(+e[0])),e}function l(t,e,i,n,s){var r=F(D,t[0],s),o=F(M,t[0],s),a=e==W?i%12:r(W),l=!1;2==n.length&&z(n[1])&&(l=n[1],n=[i]),o(e,n),l&&r(W)!=a&&(o(W,[r(W)-1]),o(R,[A(r(H),r(W))]))}function h(t,i,n,s){n=Number(n);var r=e.floor(n);t["set"+J[i]](t["get"+J[i]]()+r,s||!1),r!=n&&V>i&&h(t,i+1,(n-r)*Q[i],s)}function c(t,i,n){t=t.clone().setUTCMode(!0,!0),i=s(i).setUTCMode(!0,!0);var r=0;if(n==H||n==W){for(var o=V;o>=n;o--)r/=Q[o],r+=D(i,!1,o)-D(t,!1,o);n==W&&(r+=12*(i.getFullYear()-t.getFullYear()))}else if(n==R){var a=t.toDate().setUTCHours(0,0,0,0),l=i.toDate().setUTCHours(0,0,0,0);r=e.round((l-a)/q)+(i-l-(t-a))/q}else r=(i-t)/[36e5,6e4,1e3,1][n-3];return r}function u(t){return d(t(H),t(W),t(R))}function d(i,n,s){var r=new t(ee(i,n,s)),o=p(i),a=o;if(o>r)a=p(i-1);else{var l=p(i+1);r>=l&&(a=l)}return e.floor(e.round((r-a)/q)/7)+1}function p(e){var i=new t(ee(e,0,4));return i.setUTCDate(i.getUTCDate()-(i.getUTCDay()+6)%7),i}function f(t,e,i,s){var r=F(D,t,s),o=F(M,t,s),a=p(i===n?r(H):i);s||(a=T(a)),t.setTime(+a),o(R,[r(R)+7*(e-1)])}function m(e,i,n){for(var r,o=s.parsers,a=0;a<o.length;a++)if(r=o[a](e,i,n))return r;return n[0]=new t(e),n}function g(e,i,n){var s=e.match(/^(\d{4})(-(\d{2})(-(\d{2})([T ](\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/);if(s){var r=new t(ee(s[1],s[3]?s[3]-1:0,s[5]||1,s[7]||0,s[8]||0,s[10]||0,s[12]?1e3*Number("0."+s[12]):0));return s[13]?s[14]&&r.setUTCMinutes(r.getUTCMinutes()+("-"==s[15]?1:-1)*(60*Number(s[16])+(s[18]?Number(s[18]):0))):i||(r=T(r)),n.setTime(+r)}}function v(t,e,i,n,r){function o(t){return i[t]||h[t]}function a(t){if(n)for(var e=(t==U?R:t)-1;e>=0;e--)n.push(c(e));return c(t)}var l=s.locales,h=l[s.defaultLocale]||{},c=F(D,t,r);return i=(N(i)?l[i]:i)||{},y(t,e,a,o,r)}function y(t,e,i,n,s){for(var r,o,a="";r=e.match(te);)a+=e.substr(0,r.index),r[1]?a+=b(t,r[1],i,n,s):r[3]?(o=y(t,r[4],i,n,s),parseInt(o.replace(/\D/g,""),10)&&(a+=o)):a+=r[7]||"'",e=e.substr(r.index+r[0].length);return a+e}function b(t,e,i,s,r){for(var o,a=e.length,l="";a>0;)o=x(t,e.substr(0,a),i,s,r),o!==n?(l+=o,e=e.substr(a),a=e.length):a--;return l+e}function x(t,e,i,n,r){var o=s.formatters[e];if(N(o))return y(t,o,i,n,r);if(P(o))return o(t,r||!1,n);switch(e){case"fff":return O(i(V),3);case"s":return i(Y);case"ss":return O(i(Y));case"m":return i(B);case"mm":return O(i(B));case"h":return i(j)%12||12;case"hh":return O(i(j)%12||12);case"H":return i(j);case"HH":return O(i(j));case"d":return i(R);case"dd":return O(i(R));case"ddd":return n("dayNamesShort")[i(U)]||"";case"dddd":return n("dayNames")[i(U)]||"";case"M":return i(W)+1;case"MM":return O(i(W)+1);case"MMM":return n("monthNamesShort")[i(W)]||"";case"MMMM":return n("monthNames")[i(W)]||"";case"yy":return(i(H)+"").substring(2);case"yyyy":return i(H);case"t":return k(i,n).substr(0,1).toLowerCase();case"tt":return k(i,n).toLowerCase();case"T":return k(i,n).substr(0,1);case"TT":return k(i,n);case"z":case"zz":case"zzz":return r?"Z":w(t,e);case"w":return u(i);case"ww":return O(u(i));case"S":var a=i(R);return a>10&&20>a?"th":["st","nd","rd"][a%10-1]||"th"}}function w(t,i){var n=t.getTimezoneOffset(),s=0>n?"+":"-",r=e.floor(e.abs(n)/60),o=e.abs(n)%60,a=r;return"zz"==i?a=O(r):"zzz"==i&&(a=O(r)+":"+O(o)),s+a}function k(t,e){return t(j)<12?e("amDesignator"):e("pmDesignator")}function _(t){return!isNaN(+t[0])}function C(e){var i=new t(+e[0]);return o(e)&&(i.toString=ie),i}function D(t,e,i){return t["get"+(e?"UTC":"")+J[i]]()}function M(t,e,i,n){t["set"+(e?"UTC":"")+J[i]].apply(t,n)}function S(e){return new t(ee(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()))}function T(e){return new t(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds())}function A(e,i){return 32-new t(ee(e,i,32)).getUTCDate()}function E(t){return function(){return t.apply(n,[this].concat(I(arguments)))}}function F(t){var e=I(arguments,1);return function(){return t.apply(n,e.concat(I(arguments)))}}function I(t,e,s){return i.prototype.slice.call(t,e||0,s===n?t.length:s)}function L(t,e){for(var i=0;i<t.length;i++)e(t[i],i)}function N(t){return"string"==typeof t}function $(t){return"number"==typeof t}function z(t){return"boolean"==typeof t}function P(t){return"function"==typeof t}function O(t,e){for(e=e||2,t+="";t.length<e;)t="0"+t;return t}var H=0,W=1,R=2,j=3,B=4,Y=5,V=6,U=7,G=8,q=864e5,X="yyyy-MM-dd'T'HH:mm:ss(.fff)",K=X+"zzz",J=["FullYear","Month","Date","Hours","Minutes","Seconds","Milliseconds","Day","Year"],Z=["Years","Months","Days"],Q=[12,31,24,60,60,1e3,1],te=new RegExp("(([a-zA-Z])\\2*)|(\\((('.*?'|\\(.*?\\)|.)*?)\\))|('(.*?)')"),ee=t.UTC,ie=t.prototype.toUTCString,ne=s.prototype;return ne.length=1,ne.splice=i.prototype.splice,ne.getUTCMode=E(o),ne.setUTCMode=E(a),ne.getTimezoneOffset=function(){return o(this)?0:this[0].getTimezoneOffset()},L(J,function(t,e){ne["get"+t]=function(){return D(this[0],o(this),e)},e!=G&&(ne["getUTC"+t]=function(){return D(this[0],!0,e)}),e!=U&&(ne["set"+t]=function(t){return l(this,e,t,arguments,o(this)),this},e!=G&&(ne["setUTC"+t]=function(t){return l(this,e,t,arguments,!0),this},ne["add"+(Z[e]||t)]=function(t,i){return h(this,e,t,i),this},ne["diff"+(Z[e]||t)]=function(t){return c(this,t,e)}))}),ne.getWeek=function(){return u(F(D,this,!1))},ne.getUTCWeek=function(){return u(F(D,this,!0))},ne.setWeek=function(t,e){return f(this,t,e,!1),this},ne.setUTCWeek=function(t,e){return f(this,t,e,!0),this},ne.addWeeks=function(t){return this.addDays(7*Number(t))},ne.diffWeeks=function(t){return c(this,t,R)/7},s.parsers=[g],s.parse=function(t){return+s(""+t)},ne.toString=function(t,e,i){return t!==n&&_(this)?v(this,t,e,i,o(this)):this[0].toString()},ne.toUTCString=ne.toGMTString=function(t,e,i){return t!==n&&_(this)?v(this,t,e,i,!0):this[0].toUTCString()},ne.toISOString=function(){return this.toUTCString(K)},s.defaultLocale="",s.locales={"":{monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],amDesignator:"AM",pmDesignator:"PM"}},s.formatters={i:X,u:K},L(["getTime","valueOf","toDateString","toTimeString","toLocaleString","toLocaleDateString","toLocaleTimeString","toJSON"],function(t){ne[t]=function(){return this[0][t]()}}),ne.setTime=function(t){return this[0].setTime(t),this},ne.valid=E(_),ne.clone=function(){return new s(this)},ne.clearTime=function(){return this.setHours(0,0,0,0)},ne.toDate=function(){return new t(+this[0])},s.now=function(){return+new t},s.today=function(){return(new s).clearTime()},s.UTC=ee,s.getDaysInMonth=A,"undefined"!=typeof module&&module.exports&&(module.exports=s),s}(Date,Math,Array);define("xdate",function(){}),define("view/base",["jquery","underscore","backbone","handlebars","highcharts","underscore-string","highcharts-theme","xdate","backbone-mediator"],function(t,e,i,n){var s=i.View.extend({assetRoot:"public/",intervalDiviser:4,infiniteTimes:[],infiniteLabels:[],infiniteTimesInt:[],addHelpers:function(){n.registerHelper("nl2br",function(t){var e=(t+"").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,"$1<br>$2");return new n.SafeString(e)})},destroySubscriptions:function(){for(sub in this.subscriptions)i.Mediator.unsubscribe(sub,this[this.subscriptions[sub]],this)},drawAsInfinite:function(t){var i=t.match(/^drawAsInfinite\((.*)\)$/);return i?e.last(i):null},formatGraphData:function(t){var i=e.reduce(e.keys(t),function(i,n){var s=t[n];return t[n]={},t[n].graphite=s,t[n].xInt=[],t[n].x=[],t[n].y=[],e.each(t[n].graphite,function(e){t[n].x.push(new XDate(1e3*e[0]).toUTCString("HH:mm")),t[n].y.push(e[1]),t[n].xInt.push(e[0])}),t},[]);return i},focusFirst:function(){this.$el.find("input[type=text]:first").focus()},initGraph:function(t){var e=this;return e.chart=new Highcharts.Chart({exporting:{buttons:{exportButton:{enabled:!1},printButton:{enabled:!1}}},credits:{enabled:!1},chart:{zoomType:"x",spacingRight:24,animation:!0,renderTo:t,type:"line",borderRadius:3,backgroundColor:{stops:[[0,"rgb(16, 16, 16)"],[1,"rgb(16, 16, 16)"]]}},title:{text:null},xAxis:{minTickInterval:this,title:{text:null}},yAxis:{title:{text:null}},plotOptions:{column:{animation:!0},series:{animation:!1,marker:{enabled:!1}}},tooltip:{animation:!0}}),e.chart},keyOrder:function(t){var i=[];return i=e.keys(t),i=e.sortBy(i,function(t){return t.toLowerCase()})},renderGraphData:function(t,i){for(var n=this,s=[],r=["#4572A7","#AA4643","#89A54E","#80699B","#3D96AE","#DB843D","#92A8CD","#A47D7C","#B5CA92"];t.series.length>0;)t.series[0].remove(!0);t.xAxis[0].removePlotLine("plotLine"),n.infiniteTimes=[],n.infiniteTimesInt=[],n.infiniteLabels=[],e.each(i,function(t,e){if(n.drawAsInfinite(e)){for(var s=[],r=[],o=0;o<t.xInt.length;o++)t.y[o]&&(s.push(t.x[o]),r.push(t.xInt[o]));n.infiniteTimes.push(s),n.infiniteTimesInt.push(r),n.infiniteLabels.push(n.drawAsInfinite(e)),delete i[e]}});for(var o=n.keyOrder(i),a=0;a<o.length;a++){var l=i[o[a]];t.xAxis[0].setCategories(l.x),t.xAxis[0].options.tickInterval=parseInt(l.x.length/n.intervalDiviser,10),t.xAxis[0].setExtremes(null,null),t.addSeries({name:o[a],data:l.y,animation:!1,color:r[a]}),s=e.union(s,l.xInt)}if(n.infiniteTimes.length)for(var h=n.infiniteTimes.length-1,a=h;a>=0;a--){var c=n.infiniteTimesInt[a];if(c.length)for(var u=0;u<c.length;u++){var d=e.sortedIndex(s,c[u]);e.isNull(d)||t.xAxis[0].addPlotLine({id:"plotLine",value:d,color:"green",dashStyle:"shortdash",width:2,label:{text:n.infiniteLabels[a],style:{color:"#ccc"}}})}}},formatServerDateTime:function(t,e){var i=t.toString().length;return 10==i?new XDate(1e3*parseInt(t,10),e):new XDate(parseInt(t,10),e)},parseAlertKeys:function(t){var i=[],n=t.split("\n");return e.each(n,function(t){i.push(e.str.words(t,/([ \,])/))}),i=e.flatten(i),i=e.filter(i,function(t){return!e.str.isBlank(t)&&","!==t})},resizeModal:function(e,i,n){var s=t(window).width(),r=t(window).height(),o=.8;switch(i){case"small":widthMultipler=.3;break;case"medium":widthMultipler=.6;break;case"large":widthMultipler=.9;break;default:widthMultipler=.6}return e.css({width:s*widthMultipler,marginLeft:-(s*(widthMultipler/2))}),n||(e.css({height:r*o}),e.find(".modal-body").css({maxHeight:r*o-140,height:r*o-149})),e.each(function(){t(this).css({marginTop:-(t(this).height()/2)})}),e.addClass("modal-"+i),{height:e.height(),width:e.width(),body:{height:e.find(".modal-body").height(),width:e.find(".modal-body").width()}}},_processRadioControl:function(i,n){var s=e.map(i,function(e){return t(e).attr("data-value")});return s.length>0?s.join(","):n?n:""},_createCronExpr:function(){var t=this;return[0,t.$el.find("#inputMinutes").val(),t.$el.find("#inputHours").val(),t.$el.find("#inputDays").val(),t._processRadioControl(t.$el.find(".month-picker button.active"),"*"),t._processRadioControl(t.$el.find(".day-picker button.active"),"?")].join(" ")},showOverlay:function(e,i,n){var s=this;if(e=t(e),!s.overlay){var n=n?n:"";s.overlay=t("<div class='overlay "+n+"'><h1></h1></div>"),e.append(s.overlay)}s.overlay.find("h1").html(i),s.overlay.show()},hideOverlay:function(){var t=this;t.overlay.hide()},_toggleFullscreen:function(e,i,n,s){var r=t(e);r.hasClass("fullscreen")?(n&&s&&(n.show(),s.hide()),r.removeClass("fullscreen"),r.height(r.data("beforeFullscreen").height),r.width(r.data("beforeFullscreen").width),i.refresh()):(n&&s&&(n.hide(),s.show()),r.data("beforeFullscreen",{height:r.height(),width:r.width()}),r.addClass("fullscreen"),r.width("100%"),r.height("100%"),i.setSize("100%","100%"),i.refresh())},_validateMirror:function(e){var i=this,n=t(e.getWrapperElement());return i._isNonblank(e.getValue())?(n.removeClass("error"),!0):(n.addClass("error"),!1)},_isNonblank:function(t){var e=/\S/;return-1!=String(t).search(e)},getPositions:function(e){var i=t(e).offset(),n=t(e).width(),s=t(e).height();return[[i.left,i.left+n],[i.top,i.top+s]]},comparePositions:function(t,e){var i=t[0]<e[0]?t:e,n=t[0]<e[0]?e:t;return i[1]>n[0]||i[0]===n[0]},overlaps:function(t,e){var i=this,n=i.getPositions(t),s=i.getPositions(e);return i.comparePositions(n[0],s[0])&&i.comparePositions(n[1],s[1])}});return s.prototype.destructor=function(){this.destroySubscriptions(),this.onDestruct&&this.onDestruct(),this.off(),this.remove(),this.$el.empty()},s}),define("view/alert",["view/base"],function(t){var e=t.extend({subscriptions:{"view:adddashboard:save":"render","view:addcategory:save":"render","view:addmonitor:save":"render","view:addmonitor:test":"render","view:expandedmonitor:delete":"render","view:expandedmonitor:save":"render","view:expandedmonitor:test":"render","view:smallmonitor:save":"render","view:dashboard:save":"render","view:resetmonitor:reset":"render"},initialize:function(t){_.bindAll(this,"render","activate","deactivate"),this.templar=t.templar},render:function(t){if(t.tryJSON)try{t.errors=JSON.parse(t.tryJSON).errors}catch(e){t.raw=t.tryJSON}this.templar.render({path:"alert",el:this.$el,data:t}),this.activate()},activate:function(){this.$el.addClass("active"),_.delay(this.deactivate,2e4)},deactivate:function(){this.$el.removeClass("active")}});return e}),define("view/primarynav",["view/base"],function(t){var e=t.extend({subscriptions:{"view:dashboard:save":"render","view:adddashboard:save":"render","view:addcategory:save":"render"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.user=t.user,Backbone.history.bind("all",function(){this.setNav()}.bind(this))},render:function(){this.$el.empty(),this.collection.fetch({success:function(){this.collection.sort(),this.templar.render({path:"primarynav",el:this.$el,data:{nav:this.collection.toJSON(),user:this.user.toJSON()}})}.bind(this)}),this.$el.find(".user").tooltip({placement:"bottom"})},setNav:function(){var t=Backbone.history.fragment;switch(this.$el.find("li").removeClass("active"),t){case"ecosystem":this.$el.find(".nav > li:first-child").addClass("active")}}});return e}),define("view/header",["view/base"],function(t){var e=t.extend({initialize:function(t){_.bindAll(this,"render"),this.templar=t.templar,this.currentNav={header:{title:"Ecosystem",subtitle:"",date:new XDate(Date.now()).toUTCString("MMM dd, yyyy"),nav:{back:!1}}},Backbone.Mediator.sub("view:ecosystem:render",this.render,this),Backbone.Mediator.sub("view:dashboard:render",this.render,this),this.render()},render:function(t){this.previous=this.currentNav,_.extend(this.currentNav.header,t),this.templar.render({path:"header",el:this.$el,data:this.currentNav})}});return e}),define("model/base",["underscore","backbone"],function(t,e){var i=e.Model.extend({url:"",formatServerDateTime:function(t){var e=t.toString().length;return 10==e?1e3*parseInt(t,10):parseInt(t,10)}});return i}),define("model/monitor",["model/base"],function(t){var e=t.extend({url:function(){return this.get("id")?"/jobs/"+this.get("id"):"/jobs.json"},parse:function(t){return t.createdAt=t.createdAt?this.formatServerDateTime(t.createdAt):t.createdAt,t.modifiedAt=t.modifiedAt?this.formatServerDateTime(t.modifiedAt):t.modifiedAt,t},defaults:{id:null,dashboardId:1,userId:null,name:"",active:!0,jobType:"monitor",version:2,alertKeys:[],cronExpr:"",errorTimeout:60,minutes:1,metrics:[],monitorExpr:"",toDate:null,createdAt:null,modifiedAt:null}});return e}),window.CodeMirror=function(){function t(o,l){function h(t){tn.onDragEvent&&tn.onDragEvent(ns,D(t))||T(t)}function f(t){return t>=0&&t<Dn.size}function m(t){return b(Dn,t)}function C(t,e){zn=!0;for(var i=e-t.height,n=t;n;n=n.parent)n.height+=i}function S(t,e){return t.styles||t.highlight(wn,t.stateAfter=Gi(x(t)),tn.tabSize),t.getContent(tn.tabSize,e,tn.lineWrapping)}function N(t){var e={line:0,ch:0};Ee(e,{line:Dn.size-1,ch:m(Dn.size-1).text.length},xe(t),e,e),Fn=!0}function U(t){var e=[];return Dn.iter(0,Dn.size,function(t){e.push(t.text)}),e.join(t||"\n")}function Z(){an.scrollTop!=Wn&&(Wn=yn.scrollTop=an.scrollTop,Qe([]))}function Q(){tn.fixedGutter&&mn.style.left!=yn.scrollLeft+"px"&&(mn.style.left=yn.scrollLeft+"px"),yn.scrollTop!=Wn&&(Wn=yn.scrollTop,an.scrollTop!=Wn&&(an.scrollTop=Wn),Qe([])),tn.onScroll&&tn.onScroll(ns)}function ee(t){function e(e){he&&(yn.draggable=!1),En=!1,d(),p(),Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)<10&&(M(e),li(o.line,o.ch,!0),Ge())}function i(t){if("single"==l)ri(o,t);else if("double"==l){var e=mi(t);R(t,f)?ri(e.from,m):ri(f,e.to)}else"triple"==l&&(R(t,f)?ri(m,ci({line:t.line,ch:0})):ri(f,ci({line:t.line+1,ch:0})))}function n(t){var e=ji(t,!0);if(e&&!W(e,u)){kn||Te(),u=e,i(e),Fn=!1;var s=Ze();(e.line>=s.to||e.line<s.from)&&(c=setTimeout(Zi(function(){n(t)}),150))}}function s(t){clearTimeout(c);var e=ji(t);e&&i(e),M(t),Ge(),Fn=!0,g(),d()}si(F(t,"shiftKey"));for(var r=A(t);r!=bn;r=r.parentNode)if(r.parentNode==vn&&r!=gn)return;for(var r=A(t);r!=bn;r=r.parentNode)if(r.parentNode==fn)return tn.onGutterClick&&tn.onGutterClick(ns,q(fn.childNodes,r)+Yn,t),M(t);var o=ji(t);switch(E(t)){case 3:return se&&Bi(t),void 0;case 2:return o&&li(o.line,o.ch,!0),setTimeout(Ge,20),M(t),void 0}if(!o)return A(t)==yn&&M(t),void 0;kn||Te();var a=+new Date,l="single";if(An&&An.time>a-400&&W(An.pos,o))l="triple",M(t),setTimeout(Ge,20),gi(o.line);else if(Tn&&Tn.time>a-400&&W(Tn.pos,o)){l="double",An={time:a,pos:o},M(t);var h=mi(o);ri(h.from,h.to)}else Tn={time:a,pos:o};var c,u=o;if(tn.dragDrop&&ve&&!tn.readOnly&&!W(Hn.from,Hn.to)&&!R(o,Hn.from)&&!R(Hn.to,o)&&"single"==l){he&&(yn.draggable=!0);var d=I(document,"mouseup",Zi(e),!0),p=I(yn,"drop",Zi(e),!0);return En=!0,yn.dragDrop&&yn.dragDrop(),void 0}M(t),"single"==l&&li(o.line,o.ch,!0);var f=Hn.from,m=Hn.to,g=I(document,"mousemove",Zi(function(t){clearTimeout(c),M(t),re||E(t)?n(t):s(t)}),!0),d=I(document,"mouseup",Zi(s),!0)}function ce(t){for(var e=A(t);e!=bn;e=e.parentNode)if(e.parentNode==fn)return M(t);M(t)}function de(t){if(!tn.onDragEvent||!tn.onDragEvent(ns,D(t))){M(t);var e=ji(t,!0),i=t.dataTransfer.files;if(e&&!tn.readOnly)if(i&&i.length&&window.FileReader&&window.File)for(var n=i.length,s=Array(n),r=0,o=function(t,i){var o=new FileReader;o.onload=function(){s[i]=o.result,++r==n&&(e=ci(e),Zi(function(){var t=Oe(s.join(""),e,e);ri(e,t)})())},o.readAsText(t)},a=0;n>a;++a)o(i[a],a);else{if(En&&!R(e,Hn.from)&&!R(Hn.to,e))return;try{var s=t.dataTransfer.getData("Text");s&&Qi(function(){var t=Hn.from,i=Hn.to;ri(e,e),En&&Oe("",t,i),He(s),Ge()})}catch(t){}}}}function me(t){var e=je();t.dataTransfer.setData("Text",e),t.dataTransfer.setDragImage&&t.dataTransfer.setDragImage(B("img"),0,0)}function be(t,e){if("string"==typeof t&&(t=ie[t],!t))return!1;var i=Sn;try{tn.readOnly&&(jn=!0),e&&(Sn=null),t(ns)}catch(n){if(n!=ge)throw n;return!1}finally{Sn=i,jn=!1}return!0}function _e(t){function s(){c=!0}var r=e(tn.keyMap),o=r.auto;clearTimeout(is),o&&!n(t)&&(is=setTimeout(function(){e(tn.keyMap)==r&&(tn.keyMap=o.call?o.call(null,ns):o)},50));var a=ke[F(t,"keyCode")],l=!1,h=ue&&J;if(null==a||t.altGraphKey)return!1;F(t,"altKey")&&(a="Alt-"+a),F(t,h?"metaKey":"ctrlKey")&&(a="Ctrl-"+a),F(t,h?"ctrlKey":"metaKey")&&(a="Cmd-"+a);var c=!1;return l=F(t,"shiftKey")?i("Shift-"+a,tn.extraKeys,tn.keyMap,function(t){return be(t,!0)},s)||i(a,tn.extraKeys,tn.keyMap,function(t){return"string"==typeof t&&/^go[A-Z]/.test(t)?be(t):void 0},s):i(a,tn.extraKeys,tn.keyMap,be,s),c&&(l=!1),l&&(M(t),Yi(),re&&(t.oldKeyCode=t.keyCode,t.keyCode=0)),l}function Ce(t,e){var n=i("'"+e+"'",tn.extraKeys,tn.keyMap,function(t){return be(t,!0)});return n&&(M(t),Yi()),n}function De(t){if(kn||Te(),re&&27==t.keyCode&&(t.returnValue=!1),Kn&&Ve()&&(Kn=!1),!tn.onKeyEvent||!tn.onKeyEvent(ns,D(t))){var e=F(t,"keyCode");si(16==e||F(t,"shiftKey"));var i=_e(t);ue&&(ss=i?e:null,!i&&88==e&&F(t,J?"metaKey":"ctrlKey")&&He(""))}}function Me(t){if(Kn&&Ve(),!tn.onKeyEvent||!tn.onKeyEvent(ns,D(t))){var e=F(t,"keyCode"),i=F(t,"charCode");if(ue&&e==ss)return ss=null,M(t),void 0;if(!(ue&&(!t.which||t.which<10)||pe)||!_e(t)){var n=String.fromCharCode(null==i?e:i);tn.electricChars&&wn.electricChars&&tn.smartIndent&&!tn.readOnly&&wn.electricChars.indexOf(n)>-1&&setTimeout(Zi(function(){yi(Hn.to.line,"smart")}),75),Ce(t,n)||Ye()}}}function Se(t){tn.onKeyEvent&&tn.onKeyEvent(ns,D(t))||16==F(t,"keyCode")&&(Sn=null)}function Te(){"nocursor"!=tn.readOnly&&(kn||(tn.onFocus&&tn.onFocus(ns),kn=!0,-1==yn.className.search(/\bCodeMirror-focused\b/)&&(yn.className+=" CodeMirror-focused")),Be(),Yi())}function Ae(){kn&&(tn.onBlur&&tn.onBlur(ns),kn=!1,On&&Zi(function(){On&&(On(),On=null)})(),yn.className=yn.className.replace(" CodeMirror-focused","")),clearInterval(xn),setTimeout(function(){kn||(Sn=null)},150)}function Ee(t,e,i,n,s){if(!jn){var r=[];if(Dn.iter(t.line,e.line+1,function(t){r.push(p(t.text,t.markedSpans))}),Zn)for(Zn.addChange(t.line,i.length,r);Zn.done.length>tn.undoDepth;)Zn.done.shift();var o=c(d(r[0]),d(O(r)),t.ch,e.ch,i);Ne(t,e,o,n,s)}}function Fe(t,e){if(t.length){for(var i=t.pop(),n=[],s=i.length-1;s>=0;s-=1){var r=i[s],o=[],a=r.start+r.added;Dn.iter(r.start,a,function(t){o.push(p(t.text,t.markedSpans))}),n.push({start:r.start,added:r.old.length,old:o});var l={line:r.start+r.old.length-1,ch:G(u(O(o)),u(O(r.old)))};Ne({line:r.start,ch:0},{line:a-1,ch:m(a-1).text.length},r.old,l,l)}Fn=!0,e.push(n)}}function Ie(){Fe(Zn.done,Zn.undone)}function Le(){Fe(Zn.undone,Zn.done)}function Ne(t,e,i,n,s){function r(t){return t<=Math.min(e.line,e.line+x)?t:t+x}if(!jn){var o=!1,a=Gn.text.length;tn.lineWrapping||Dn.iter(t.line,e.line+1,function(t){return t.hidden||t.text.length!=a?void 0:(o=!0,!0)}),(t.line!=e.line||i.length>1)&&(zn=!0);var l=e.line-t.line,h=m(t.line),c=m(e.line),p=O(i);if(0==t.ch&&0==e.ch&&""==u(p)){for(var f=[],v=0,y=i.length-1;y>v;++v)f.push(new g(u(i[v]),d(i[v])));c.update(c.text,d(p)),l&&Dn.remove(t.line,l,Pn),f.length&&Dn.insert(t.line,f)}else if(h==c)if(1==i.length)h.update(h.text.slice(0,t.ch)+u(i[0])+h.text.slice(e.ch),d(i[0]));else{for(var f=[],v=1,y=i.length-1;y>v;++v)f.push(new g(u(i[v]),d(i[v])));f.push(new g(u(p)+h.text.slice(e.ch),d(p))),h.update(h.text.slice(0,t.ch)+u(i[0]),d(i[0])),Dn.insert(t.line+1,f)}else if(1==i.length)h.update(h.text.slice(0,t.ch)+u(i[0])+c.text.slice(e.ch),d(i[0])),Dn.remove(t.line+1,l,Pn);else{var f=[];h.update(h.text.slice(0,t.ch)+u(i[0]),d(i[0])),c.update(u(p)+c.text.slice(e.ch),d(p));for(var v=1,y=i.length-1;y>v;++v)f.push(new g(u(i[v]),d(i[v])));l>1&&Dn.remove(t.line+1,l-1,Pn),Dn.insert(t.line+1,f)}if(tn.lineWrapping){var b=Math.max(5,yn.clientWidth/Hi()-3);Dn.iter(t.line,t.line+i.length,function(t){if(!t.hidden){var e=Math.ceil(t.text.length/b)||1;e!=t.height&&C(t,e)}})}else Dn.iter(t.line,t.line+i.length,function(t){var e=t.text;!t.hidden&&e.length>a&&(Gn=t,a=e.length,Xn=!0,o=!1)}),o&&(qn=!0);Mn=Math.min(Mn,t.line),Xi(400);var x=i.length-l-1;if(Ln.push({from:t.line,to:e.line+1,diff:x}),tn.onChange){for(var v=0;v<i.length;++v)"string"!=typeof i[v]&&(i[v]=i[v].text);var w={from:t,to:e,text:i};if(Nn){for(var k=Nn;k.next;k=k.next);k.next=w}else Nn=w}oi(ci(n),ci(s),r(Hn.from.line),r(Hn.to.line))}}function $e(){var t=Dn.height*Oi()+2*Wi();return.99*t>yn.offsetHeight?t:!1}function ze(t){var e=$e();an.style.display=e?"block":"none",e?(on.style.height=vn.style.minHeight=e+"px",an.style.height=yn.clientHeight+"px",null!=t&&(an.scrollTop=yn.scrollTop=t,he&&setTimeout(function(){an.scrollTop==t&&(an.scrollTop=t+(t?-1:1),an.scrollTop=t)},0))):vn.style.minHeight="",gn.style.top=Bn*Oi()+"px"}function Pe(){Gn=m(0),Xn=!0;var t=Gn.text.length;Dn.iter(1,Dn.size,function(e){var i=e.text;!e.hidden&&i.length>t&&(t=i.length,Gn=e)}),qn=!1}function Oe(t,e,i){function n(n){if(R(n,e))return n;
390
+ if(!R(i,n))return s;var r=n.line+t.length-(i.line-e.line)-1,o=n.ch;return n.line==i.line&&(o+=O(t).length-(i.ch-(i.line==e.line?e.ch:0))),{line:r,ch:o}}e=ci(e),i=i?ci(i):e,t=xe(t);var s;return We(t,e,i,function(t){return s=t,{from:n(Hn.from),to:n(Hn.to)}}),s}function He(t,e){We(xe(t),Hn.from,Hn.to,function(t){return"end"==e?{from:t,to:t}:"start"==e?{from:Hn.from,to:Hn.from}:{from:Hn.from,to:t}})}function We(t,e,i,n){var s=1==t.length?t[0].length+e.ch:O(t).length,r=n({line:e.line+t.length-1,ch:s});Ee(e,i,t,r.from,r.to)}function Re(t,e,i){var n=t.line,s=e.line;if(n==s)return m(n).text.slice(t.ch,e.ch);var r=[m(n).text.slice(t.ch)];return Dn.iter(n+1,s,function(t){r.push(t.text)}),r.push(m(s).text.slice(0,e.ch)),r.join(i||"\n")}function je(t){return Re(Hn.from,Hn.to,t)}function Be(){Kn||_n.set(tn.pollInterval,function(){Ve(),kn&&Be()})}function Ye(){function t(){var i=Ve();i||e?(Kn=!1,Be()):(e=!0,_n.set(60,t))}var e=!1;Kn=!0,_n.set(20,t)}function Ve(){if(!kn||we(sn)||tn.readOnly)return!1;var t=sn.value;if(t==rs)return!1;ps||Ki(),Sn=null;for(var e=0,i=Math.min(rs.length,t.length);i>e&&rs[e]==t[e];)++e;return e<rs.length?Hn.from={line:Hn.from.line,ch:Hn.from.ch-(rs.length-e)}:Rn&&W(Hn.from,Hn.to)&&(Hn.to={line:Hn.to.line,ch:Math.min(m(Hn.to.line).text.length,Hn.to.ch+(t.length-e))}),He(t.slice(e),"end"),t.length>1e3?sn.value=rs="":rs=t,ps||Ji(),!0}function Ue(t){W(Hn.from,Hn.to)?t&&(rs=sn.value=""):(rs="",sn.value=je(),kn&&H(sn))}function Ge(){"nocursor"!=tn.readOnly&&sn.focus()}function qe(){var t=Xe();if(Ke(t.x,t.y,t.x,t.yBot),kn){var e=vn.getBoundingClientRect(),i=null;if(t.y+e.top<0?i=!0:t.y+e.top+Oi()>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i){var n="none"==cn.style.display;n&&(cn.style.display="",cn.style.left=t.x+"px",cn.style.top=t.y-Bn+"px"),cn.scrollIntoView(i),n&&(cn.style.display="none")}}}function Xe(){var t=$i(Hn.inverted?Hn.from:Hn.to),e=tn.lineWrapping?Math.min(t.x,pn.offsetWidth):t.x;return{x:e,y:t.y,yBot:t.yBot}}function Ke(t,e,i,n){var s=Je(t,e,i,n);null!=s.scrollLeft&&(yn.scrollLeft=s.scrollLeft),null!=s.scrollTop&&(an.scrollTop=yn.scrollTop=s.scrollTop)}function Je(t,e,i,n){var s=Ri(),r=Wi();e+=r,n+=r,t+=s,i+=s;var o=yn.clientHeight,a=an.scrollTop,l={},h=$e()||1/0,c=r+10>e,u=n+r>h-10;a>e?l.scrollTop=c?0:Math.max(0,e):n>a+o&&(l.scrollTop=(u?h:n)-o);var d=yn.clientWidth,p=yn.scrollLeft,f=tn.fixedGutter?mn.clientWidth:0,m=f+s+10>t;return p+f>t||m?(m&&(t=0),l.scrollLeft=Math.max(0,t-10-f)):i>d+p-3&&(l.scrollLeft=i+10-d),l}function Ze(t){var e=Oi(),i=(null!=t?t:an.scrollTop)-Wi(),n=Math.max(0,Math.floor(i/e)),s=Math.ceil((i+yn.clientHeight)/e);return{from:w(Dn,n),to:w(Dn,s)}}function Qe(t,e,i){function n(){var t=ln.firstChild,e=!1;return Dn.iter(Yn,Vn,function(i){if(t){if(!i.hidden){var n=Math.round(t.offsetHeight/u)||1;i.height!=n&&(C(i,n),zn=e=!0)}t=t.nextSibling}}),e}if(!yn.clientWidth)return Yn=Vn=Bn=0,void 0;var s=Ze(i);if(t!==!0&&0==t.length&&s.from>Yn&&s.to<Vn)return ze(i),void 0;var r=Math.max(s.from-100,0),o=Math.min(Dn.size,s.to+100);r>Yn&&20>r-Yn&&(r=Yn),Vn>o&&20>Vn-o&&(o=Math.min(Dn.size,Vn));for(var a=t===!0?[]:ti([{from:Yn,to:Vn,domStart:0}],t),l=0,h=0;h<a.length;++h){var c=a[h];c.from<r&&(c.domStart+=r-c.from,c.from=r),c.to>o&&(c.to=o),c.from>=c.to?a.splice(h--,1):l+=c.to-c.from}if(l==o-r&&r==Yn&&o==Vn)return ze(i),void 0;a.sort(function(t,e){return t.domStart-e.domStart});var u=Oi(),d=mn.style.display;ln.style.display="none",ei(r,o,a),ln.style.display=mn.style.display="";var p=r!=Yn||o!=Vn||Un!=yn.clientHeight+u;if(p&&(Un=yn.clientHeight+u),(r!=Yn||o!=Vn&&tn.onViewportChange)&&setTimeout(function(){tn.onViewportChange&&tn.onViewportChange(ns,r,o)}),Yn=r,Vn=o,Bn=k(Dn,r),Xi(100),ln.childNodes.length!=Vn-Yn)throw new Error("BAD PATCH! "+JSON.stringify(a)+" size="+(Vn-Yn)+" nodes="+ln.childNodes.length);return tn.lineWrapping&&n(),mn.style.display=d,(p||zn)&&ii()&&tn.lineWrapping&&n()&&ii(),ze(i),ni(),!e&&tn.onUpdate&&tn.onUpdate(ns),!0}function ti(t,e){for(var i=0,n=e.length||0;n>i;++i){for(var s=e[i],r=[],o=s.diff||0,a=0,l=t.length;l>a;++a){var h=t[a];s.to<=h.from&&s.diff?r.push({from:h.from+o,to:h.to+o,domStart:h.domStart}):s.to<=h.from||s.from>=h.to?r.push(h):(s.from>h.from&&r.push({from:h.from,to:s.from,domStart:h.domStart}),s.to<h.to&&r.push({from:s.to+o,to:h.to+o,domStart:h.domStart+(s.to-h.from)}))}t=r}return t}function ei(t,e,i){function n(t){var e=t.nextSibling;return t.parentNode.removeChild(t),e}if(i.length){for(var s=0,r=ln.firstChild,o=0;o<i.length;++o){for(var a=i[o];a.domStart>s;)r=n(r),s++;for(var l=0,h=a.to-a.from;h>l;++l)r=r.nextSibling,s++}for(;r;)r=n(r)}else Y(ln);var c=i.shift(),r=ln.firstChild,l=t;Dn.iter(t,e,function(t){if(c&&c.to==l&&(c=i.shift()),!c||c.from>l){if(t.hidden)var e=B("pre");else{var e=S(t);if(t.className&&(e.className=t.className),t.bgClassName){var n=B("pre"," ",t.bgClassName,"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2");e=B("div",[n,e],null,"position: relative")}}ln.insertBefore(e,r)}else r=r.nextSibling;++l})}function ii(){if(tn.gutter||tn.lineNumbers){var t=gn.offsetHeight,e=yn.clientHeight;mn.style.height=(2>t-e?e:t)+"px";var i,n=document.createDocumentFragment(),s=Yn;if(Dn.iter(Yn,Math.max(Vn,Yn+1),function(t){if(t.hidden)n.appendChild(B("pre"));else{var e=t.gutterMarker,r=tn.lineNumbers?tn.lineNumberFormatter(s+tn.firstLineNumber):null;e&&e.text?r=e.text.replace("%N%",null!=r?r:""):null==r&&(r=" ");var o=n.appendChild(B("pre",null,e&&e.style));o.innerHTML=r;for(var a=1;a<t.height;++a)o.appendChild(B("br")),o.appendChild(document.createTextNode(" "));e||(i=s)}++s}),mn.style.display="none",V(fn,n),null!=i&&tn.lineNumbers){for(var r=fn.childNodes[i-Yn],o=String(Dn.size).length,a=z(r.firstChild),l="";a.length+l.length<o;)l+=" ";l&&r.insertBefore(document.createTextNode(l),r.firstChild)}mn.style.display="";var h=Math.abs((parseInt(pn.style.marginLeft)||0)-mn.offsetWidth)>2;return pn.style.marginLeft=mn.offsetWidth+"px",zn=!1,h}}function ni(){var t=W(Hn.from,Hn.to),e=$i(Hn.from,!0),i=t?e:$i(Hn.to,!0),n=Hn.inverted?e:i,s=Oi(),r=$(bn),o=$(ln);if(rn.style.top=Math.max(0,Math.min(yn.offsetHeight,n.y+o.top-r.top))+"px",rn.style.left=Math.max(0,Math.min(yn.offsetWidth,n.x+o.left-r.left))+"px",t)cn.style.top=n.y+"px",cn.style.left=(tn.lineWrapping?Math.min(n.x,pn.offsetWidth):n.x)+"px",cn.style.display="",hn.style.display="none";else{var a=e.y==i.y,l=document.createDocumentFragment(),h=pn.clientWidth||pn.offsetWidth,c=pn.clientHeight||pn.offsetHeight,u=function(t,e,i,n){var s=le?"width: "+(i?h-i-t:h)+"px":"right: "+i+"px";l.appendChild(B("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px; top: "+e+"px; "+s+"; height: "+n+"px"))};if(Hn.from.ch&&e.y>=0){var d=a?h-i.x:0;u(e.x,e.y,d,s)}var p=Math.max(0,e.y+(Hn.from.ch?s:0)),f=Math.min(i.y,c)-p;f>.2*s&&u(0,p,0,f),a&&Hn.from.ch||!(i.y<c-.5*s)||u(0,i.y,h-i.x,s),V(hn,l),cn.style.display="none",hn.style.display=""}}function si(t){Sn=t?Sn||(Hn.inverted?Hn.to:Hn.from):null}function ri(t,e){var i=Sn&&ci(Sn);i&&(R(i,t)?t=i:R(e,i)&&(e=i)),oi(t,e),In=!0}function oi(t,e,i,n){if(Jn=null,null==i&&(i=Hn.from.line,n=Hn.to.line),!W(Hn.from,t)||!W(Hn.to,e)){if(R(e,t)){var s=e;e=t,t=s}if(t.line!=i){var r=ai(t,i,Hn.from.ch);r?t=r:Ii(t.line,!1)}if(e.line!=n&&(e=ai(e,n,Hn.to.ch)),W(t,e)?Hn.inverted=!1:W(t,Hn.to)?Hn.inverted=!1:W(e,Hn.from)&&(Hn.inverted=!0),tn.autoClearEmptyLines&&W(Hn.from,Hn.to)){var o=Hn.inverted?t:e;if(o.line!=Hn.from.line&&Hn.from.line<Dn.size){var a=m(Hn.from.line);/^\s+$/.test(a.text)&&setTimeout(Zi(function(){if(a.parent&&/^\s+$/.test(a.text)){var t=x(a);Oe("",{line:t,ch:0},{line:t,ch:a.text.length})}},10))}}Hn.from=t,Hn.to=e,$n=!0}}function ai(t,e,i){function n(e){for(var n=t.line+e,s=1==e?Dn.size:-1;n!=s;){var o=m(n);if(!o.hidden){var a=t.ch;return(r||a>i||a>o.text.length)&&(a=o.text.length),{line:n,ch:a}}n+=e}}var s=m(t.line),r=t.ch==s.text.length&&t.ch!=i;return s.hidden?t.line>=e?n(1)||n(-1):n(-1)||n(1):t}function li(t,e,i){var n=ci({line:t,ch:e||0});(i?ri:oi)(n,n)}function hi(t){return Math.max(0,Math.min(t,Dn.size-1))}function ci(t){if(t.line<0)return{line:0,ch:0};if(t.line>=Dn.size)return{line:Dn.size-1,ch:m(Dn.size-1).text.length};var e=t.ch,i=m(t.line).text.length;return null==e||e>i?{line:t.line,ch:i}:0>e?{line:t.line,ch:0}:t}function ui(t,e){function i(){for(var e=r+t,i=0>t?-1:Dn.size;e!=i;e+=t){var n=m(e);if(!n.hidden)return r=e,a=n,!0}}function n(e){if(o==(0>t?0:a.text.length)){if(e||!i())return!1;o=0>t?a.text.length:0}else o+=t;return!0}var s=Hn.inverted?Hn.from:Hn.to,r=s.line,o=s.ch,a=m(r);if("char"==e)n();else if("column"==e)n(!0);else if("word"==e)for(var l=!1;!(0>t)||n();){if(X(a.text.charAt(o)))l=!0;else if(l){0>t&&(t=1,n());break}if(t>0&&!n())break}return{line:r,ch:o}}function di(t,e){var i=0>t?Hn.from:Hn.to;(Sn||W(Hn.from,Hn.to))&&(i=ui(t,e)),li(i.line,i.ch,!0)}function pi(t,e){W(Hn.from,Hn.to)?0>t?Oe("",ui(t,e),Hn.to):Oe("",Hn.from,ui(t,e)):Oe("",Hn.from,Hn.to),In=!0}function fi(t,e){var i=$i(Hn.inverted?Hn.from:Hn.to,!0);if(null!=Jn&&(i.x=Jn),"page"==e)var n=Math.min(yn.clientHeight,window.innerHeight||document.documentElement.clientHeight),s=zi(i.x,i.y+n*t);else if("line"==e)var r=Oi(),s=zi(i.x,i.y+.5*r+t*r);"page"==e&&(an.scrollTop+=$i(s,!0).y-i.y),li(s.line,s.ch,!0),Jn=i.x}function mi(t){var e=m(t.line).text,i=t.ch,n=t.ch;if(e){t.after===!1||n==e.length?--i:++n;for(var s=e.charAt(i),r=X(s)?X:/\s/.test(s)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!X(t)};i>0&&r(e.charAt(i-1));)--i;for(;n<e.length&&r(e.charAt(n));)++n}return{from:{line:t.line,ch:i},to:{line:t.line,ch:n}}}function gi(t){ri({line:t,ch:0},ci({line:t+1,ch:0}))}function vi(t){if(W(Hn.from,Hn.to))return yi(Hn.from.line,t);for(var e=Hn.to.line-(Hn.to.ch?0:1),i=Hn.from.line;e>=i;++i)yi(i,t)}function yi(t,e){if(e||(e="add"),"smart"==e)if(wn.indent)var i=Gi(t);else e="prev";var n,s=m(t),r=s.indentation(tn.tabSize),o=s.text.match(/^\s*/)[0];"smart"==e&&(n=wn.indent(i,s.text.slice(o.length),s.text),n==ge&&(e="prev")),"prev"==e?n=t?m(t-1).indentation(tn.tabSize):0:"add"==e?n=r+tn.indentUnit:"subtract"==e&&(n=r-tn.indentUnit),n=Math.max(0,n);var a="",l=0;if(tn.indentWithTabs)for(var h=Math.floor(n/tn.tabSize);h;--h)l+=tn.tabSize,a+=" ";n>l&&(a+=P(n-l)),a!=o&&Oe(a,{line:t,ch:0},{line:t,ch:o.length})}function bi(){wn=t.getMode(tn,tn.mode),Dn.iter(0,Dn.size,function(t){t.stateAfter=null}),Mn=0,Xi(100)}function xi(){var t=tn.gutter||tn.lineNumbers;mn.style.display=t?"":"none",t?zn=!0:ln.parentNode.style.marginLeft=0}function wi(){if(tn.lineWrapping){bn.className+=" CodeMirror-wrap";var t=yn.clientWidth/Hi()-3;Dn.iter(0,Dn.size,function(e){if(!e.hidden){var i=Math.ceil(e.text.length/t)||1;1!=i&&C(e,i)}}),pn.style.minWidth=un.style.left=""}else bn.className=bn.className.replace(" CodeMirror-wrap",""),Pe(),Dn.iter(0,Dn.size,function(t){1==t.height||t.hidden||C(t,1)});Ln.push({from:0,to:Dn.size})}function ki(){yn.className=yn.className.replace(/\s*cm-s-\S+/g,"")+tn.theme.replace(/(^|\s)\s*/g," cm-s-")}function _i(){var t=ne[tn.keyMap].style;bn.className=bn.className.replace(/\s*cm-keymap-\S+/g,"")+(t?" cm-keymap-"+t:"")}function Ci(t,e){this.lines=[],this.type=t,e&&(this.style=e)}function Di(t,e,i,n){t=ci(t),e=ci(e);var s=new Ci("range",i);if(n)for(var r in n)n.hasOwnProperty(r)&&(s[r]=n[r]);var o=t.line;return Dn.iter(o,e.line+1,function(i){var n={from:o==t.line?t.ch:null,to:o==e.line?e.ch:null,marker:s};(i.markedSpans||(i.markedSpans=[])).push(n),s.lines.push(i),++o}),Ln.push({from:t.line,to:e.line+1}),s}function Mi(t){t=ci(t);var e=new Ci("bookmark"),i=m(t.line),n={from:t.ch,to:t.ch,marker:e};return(i.markedSpans||(i.markedSpans=[])).push(n),e.lines.push(i),e}function Si(t){t=ci(t);var e=[],i=m(t.line).markedSpans;if(i)for(var n=0;n<i.length;++n){var s=i[n];(null==s.from||s.from<=t.ch)&&(null==s.to||s.to>=t.ch)&&e.push(s.marker)}return e}function Ti(t,e,i){return"number"==typeof t&&(t=m(hi(t))),t.gutterMarker={text:e,style:i},zn=!0,t}function Ai(t){"number"==typeof t&&(t=m(hi(t))),t.gutterMarker=null,zn=!0}function Ei(t,e){var i=t,n=t;return"number"==typeof t?n=m(hi(t)):i=x(t),null==i?null:e(n,i)?(Ln.push({from:i,to:i+1}),n):null}function Fi(t,e,i){return Ei(t,function(t){return t.className!=e||t.bgClassName!=i?(t.className=e,t.bgClassName=i,!0):void 0})}function Ii(t,e){return Ei(t,function(t,i){if(t.hidden!=e){t.hidden=e,tn.lineWrapping||(e&&t.text.length==Gn.text.length?qn=!0:!e&&t.text.length>Gn.text.length&&(Gn=t,qn=!1)),C(t,e?0:1);var n=Hn.from.line,s=Hn.to.line;if(e&&(n==i||s==i)){var r=n==i?ai({line:n,ch:0},n,0):Hn.from,o=s==i?ai({line:s,ch:0},s,0):Hn.to;if(!o)return;oi(r,o)}return zn=!0}})}function Li(t){if("number"==typeof t){if(!f(t))return null;var e=t;if(t=m(t),!t)return null}else{var e=x(t);if(null==e)return null}var i=t.gutterMarker;return{line:e,handle:t,text:t.text,markerText:i&&i.text,markerClass:i&&i.style,lineClass:t.className,bgClass:t.bgClassName}}function Ni(t,e){if(0==e)return{top:0,left:0};tn.lineWrapping&&e<t.text.length&&ye.test(t.text.slice(e-1,e+1));var i=S(t,e);V(dn,i);var n=i.anchor,s=n.offsetTop,r=n.offsetLeft;if(re&&0==s&&0==r){var o=B("span","x");n.parentNode.insertBefore(o,n.nextSibling),s=o.offsetTop}return{top:s,left:r}}function $i(t,e){var i,n=Oi(),s=n*(k(Dn,t.line)-(e?Bn:0));if(0==t.ch)i=0;else{var r=Ni(m(t.line),t.ch);i=r.left,tn.lineWrapping&&(s+=Math.max(0,r.top))}return{x:i,y:s,yBot:s+n}}function zi(t,e){function i(t){var e=Ni(a,t);if(h){var i=Math.round(e.top/n);return d=i!=c,Math.max(0,e.left+(i-c)*yn.clientWidth)}return e.left}var n=Oi(),s=Hi(),r=Bn+Math.floor(e/n);if(0>r)return{line:0,ch:0};var o=w(Dn,r);if(o>=Dn.size)return{line:Dn.size-1,ch:m(Dn.size-1).text.length};var a=m(o),l=a.text,h=tn.lineWrapping,c=h?r-k(Dn,o):0;if(0>=t&&0==c)return{line:o,ch:0};for(var u,d=!1,p=0,f=0,g=l.length,v=Math.min(g,Math.ceil((t+.9*c*yn.clientWidth)/s));;){var y=i(v);if(!(t>=y&&g>v)){u=y,g=v;break}v=Math.min(g,Math.ceil(1.2*v))}if(t>u)return{line:o,ch:g};for(v=Math.floor(.8*g),y=i(v),t>y&&(p=v,f=y);;){if(1>=g-p){var b=u-t>t-f;return{line:o,ch:b?p:g,after:b}}var x=Math.ceil((p+g)/2),_=i(x);_>t?(g=x,u=_,d&&(u+=1e3)):(p=x,f=_)}}function Pi(t){var e=$i(t,!0),i=$(pn);return{x:i.left+e.x,y:i.top+e.y,yBot:i.top+e.yBot}}function Oi(){if(null==ls){ls=B("pre");for(var t=0;49>t;++t)ls.appendChild(document.createTextNode("x")),ls.appendChild(B("br"));ls.appendChild(document.createTextNode("x"))}var e=ln.clientHeight;return e==as?os:(as=e,V(dn,ls.cloneNode(!0)),os=dn.firstChild.offsetHeight/50||1,Y(dn),os)}function Hi(){if(yn.clientWidth==us)return hs;us=yn.clientWidth;var t=B("span","x"),e=B("pre",[t]);return V(dn,e),hs=t.offsetWidth||10}function Wi(){return pn.offsetTop}function Ri(){return pn.offsetLeft}function ji(t,e){var i,n,s=$(yn,!0);try{i=t.clientX,n=t.clientY}catch(t){return null}if(!e&&(i-s.left>yn.clientWidth||n-s.top>yn.clientHeight))return null;var r=$(pn,!0);return zi(i-r.left,n-r.top)}function Bi(t){function e(){if(rn.style.position="relative",sn.style.cssText=s,ae&&(an.scrollTop=n),Be(),null!=sn.selectionStart){clearTimeout(cs);var t=sn.value=" "+(W(Hn.from,Hn.to)?"":sn.value),e=0;rs=" ",sn.selectionStart=1,sn.selectionEnd=t.length,cs=setTimeout(function i(){" "==rs&&0==sn.selectionStart?Zi(ie.selectAll)(ns):e++<10?cs=setTimeout(i,500):Ue()},200)}}var i=ji(t),n=an.scrollTop;if(i&&!ue){(W(Hn.from,Hn.to)||R(i,Hn.from)||!R(i,Hn.to))&&Zi(li)(i.line,i.ch);var s=sn.style.cssText;if(rn.style.position="absolute",sn.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(t.clientY-5)+"px; left: "+(t.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Ge(),Ue(!0),W(Hn.from,Hn.to)&&(sn.value=rs=" "),se){T(t);var r=I(window,"mouseup",function(){r(),setTimeout(e,20)},!0)}else setTimeout(e,50)}}function Yi(){clearInterval(xn);var t=!0;cn.style.visibility="",xn=setInterval(function(){cn.style.visibility=(t=!t)?"":"hidden"},tn.cursorBlinkRate)}function Vi(t){function e(t,e,i){if(t.text)for(var n,s=t.styles,r=o?0:t.text.length-1,l=o?0:s.length-2,h=o?s.length:-2;l!=h;l+=2*a){var c=s[l];if(s[l+1]==d){for(var u=o?0:c.length-1,m=o?c.length:-1;u!=m;u+=a,r+=a)if(r>=e&&i>r&&f.test(n=c.charAt(u))){var g=ds[n];if(">"==g.charAt(1)==o)p.push(n);else{if(p.pop()!=g.charAt(0))return{pos:r,match:!1};if(!p.length)return{pos:r,match:!0}}}}else r+=a*c.length}}var i=Hn.inverted?Hn.from:Hn.to,n=m(i.line),s=i.ch-1,r=s>=0&&ds[n.text.charAt(s)]||ds[n.text.charAt(++s)];if(r){for(var o=(r.charAt(0),">"==r.charAt(1)),a=o?1:-1,l=n.styles,h=s+1,c=0,u=l.length;u>c;c+=2)if((h-=l[c].length)<=0){var d=l[c+1];break}for(var p=[n.text.charAt(s)],f=/[(){}[\]]/,c=i.line,u=o?Math.min(c+100,Dn.size):Math.max(-1,c-100);c!=u;c+=a){var n=m(c),g=c==i.line,v=e(n,g&&o?s+1:0,g&&!o?s:n.text.length);if(v)break}v||(v={pos:null,match:!1});var d=v.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",y=Di({line:i.line,ch:s},{line:i.line,ch:s+1},d),b=null!=v.pos&&Di({line:c,ch:v.pos},{line:c,ch:v.pos+1},d),x=Zi(function(){y.clear(),b&&b.clear()});t?setTimeout(x,800):On=x}}function Ui(t){for(var e,i,n=t,s=t-40;n>s;--n){if(0==n)return 0;var r=m(n-1);if(r.stateAfter)return n;var o=r.indentation(tn.tabSize);(null==i||e>o)&&(i=n-1,e=o)}return i}function Gi(t){var e=Ui(t),i=e&&m(e-1).stateAfter;return i=i?s(wn,i):r(wn),Dn.iter(e,t,function(n){n.process(wn,i,tn.tabSize),n.stateAfter=e==t-1||0==e%5?s(wn,i):null}),i}function qi(){if(!(Mn>=Vn)){var t=+new Date+tn.workTime,e=s(wn,Gi(Mn)),i=Mn;Dn.iter(Mn,Vn,function(i){return Mn>=Yn?(i.highlight(wn,e,tn.tabSize),i.stateAfter=s(wn,e)):(i.process(wn,e,tn.tabSize),i.stateAfter=0==Mn%5?s(wn,e):null),++Mn,+new Date>t?(Xi(tn.workDelay),!0):void 0}),Vn>i&&Mn>=Yn&&Zi(function(){Ln.push({from:i,to:Mn})})()}}function Xi(t){Vn>Mn&&Cn.set(t,qi)}function Ki(){Fn=In=Nn=null,Ln=[],$n=!1,Pn=[]}function Ji(){if(qn&&Pe(),Xn&&!tn.lineWrapping){var t=un.offsetWidth,e=Ni(Gn,Gn.text.length).left;oe||(un.style.left=e+"px",pn.style.minWidth=e+t+"px"),Xn=!1}var i,n;if($n){var s=Xe();i=Je(s.x,s.y,s.x,s.yBot)}(Ln.length||i&&null!=i.scrollTop)&&(n=Qe(Ln,!0,i&&i.scrollTop)),n||($n&&ni(),zn&&ii()),i&&qe(),$n&&Yi(),kn&&(Fn===!0||Fn!==!1&&$n)&&Ue(In),$n&&tn.matchBrackets&&setTimeout(Zi(function(){On&&(On(),On=null),W(Hn.from,Hn.to)&&Vi(!1)}),20);var r=$n,o=Pn;Nn&&tn.onChange&&ns&&tn.onChange(ns,Nn),r&&tn.onCursorActivity&&tn.onCursorActivity(ns);for(var a=0;a<o.length;++a)o[a](ns);n&&tn.onUpdate&&tn.onUpdate(ns)}function Zi(t){return function(){ps++||Ki();try{var e=t.apply(this,arguments)}finally{--ps||Ji()}return e}}function Qi(t){Zn.startCompound();try{return t()}finally{Zn.endCompound()}}var tn={},en=t.defaults;for(var nn in en)en.hasOwnProperty(nn)&&(tn[nn]=(l&&l.hasOwnProperty(nn)?l:en)[nn]);var sn=B("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em");sn.setAttribute("wrap","off"),sn.setAttribute("autocorrect","off"),sn.setAttribute("autocapitalize","off");var rn=B("div",[sn],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),on=B("div",null,"CodeMirror-scrollbar-inner"),an=B("div",[on],"CodeMirror-scrollbar"),ln=B("div"),hn=B("div",null,null,"position: relative; z-index: -1"),cn=B("pre"," ","CodeMirror-cursor"),un=B("pre"," ","CodeMirror-cursor","visibility: hidden"),dn=B("div",null,null,"position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"),pn=B("div",[dn,cn,un,hn,ln],null,"position: relative; z-index: 0"),fn=B("div",null,"CodeMirror-gutter-text"),mn=B("div",[fn],"CodeMirror-gutter"),gn=B("div",[mn,B("div",[pn],"CodeMirror-lines")],null,"position: relative"),vn=B("div",[gn],null,"position: relative"),yn=B("div",[vn],"CodeMirror-scroll");yn.setAttribute("tabIndex","-1");var bn=B("div",[rn,an,yn],"CodeMirror"+(tn.lineWrapping?" CodeMirror-wrap":""));o.appendChild?o.appendChild(bn):o(bn),ki(),_i(),K&&(sn.style.width="0px"),he||(yn.draggable=!0),pn.style.outline="none",null!=tn.tabindex&&(sn.tabIndex=tn.tabindex),tn.autofocus&&Ge(),tn.gutter||tn.lineNumbers||(mn.style.display="none"),pe&&(rn.style.height="1px",rn.style.position="absolute"),fe?(an.style.zIndex=-2,an.style.visibility="hidden"):oe&&(an.style.minWidth="18px");var xn,wn,kn,_n=new L,Cn=new L,Dn=new y([new v([new g("")])]),Mn=0;bi();var Sn,Tn,An,En,Fn,In,Ln,Nn,$n,zn,Pn,On,Hn={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},Wn=0,Rn=!1,jn=!1,Bn=0,Yn=0,Vn=0,Un=0,Gn=m(0),qn=!1,Xn=!0,Kn=!1,Jn=null;Zi(function(){N(tn.value||""),Fn=!1})();var Zn=new _;I(yn,"mousedown",Zi(ee)),I(yn,"dblclick",Zi(ce)),I(pn,"selectstart",M),se||I(yn,"contextmenu",Bi),I(yn,"scroll",Q),I(an,"scroll",Z),I(an,"mousedown",function(){kn&&setTimeout(Ge,0)});var Qn=I(window,"resize",function(){bn.parentNode?Qe(!0):Qn()},!0);I(sn,"keyup",Zi(Se)),I(sn,"input",Ye),I(sn,"keydown",Zi(De)),I(sn,"keypress",Zi(Me)),I(sn,"focus",Te),I(sn,"blur",Ae),tn.dragDrop&&(I(yn,"dragstart",me),I(yn,"dragenter",h),I(yn,"dragover",h),I(yn,"drop",Zi(de))),I(yn,"paste",function(){Ge(),Ye()}),I(sn,"paste",Ye),I(sn,"cut",Zi(function(){tn.readOnly||He("")})),pe&&I(vn,"mouseup",function(){document.activeElement==sn&&sn.blur(),Ge()});var ts;try{ts=document.activeElement==sn}catch(es){}ts||tn.autofocus?setTimeout(Te,20):Ae();var is,ns=bn.CodeMirror={getValue:U,setValue:Zi(N),getSelection:je,replaceSelection:Zi(He),focus:function(){window.focus(),Ge(),Te(),Ye()},setOption:function(t,e){var i=tn[t];tn[t]=e,"mode"==t||"indentUnit"==t?bi():"readOnly"==t&&"nocursor"==e?(Ae(),sn.blur()):"readOnly"!=t||e?"theme"==t?ki():"lineWrapping"==t&&i!=e?Zi(wi)():"tabSize"==t?Qe(!0):"keyMap"==t&&_i():Ue(!0),("lineNumbers"==t||"gutter"==t||"firstLineNumber"==t||"theme"==t||"lineNumberFormatter"==t)&&(xi(),Qe(!0))},getOption:function(t){return tn[t]},getMode:function(){return wn},undo:Zi(Ie),redo:Zi(Le),indentLine:Zi(function(t,e){"string"!=typeof e&&(e=null==e?tn.smartIndent?"smart":"prev":e?"add":"subtract"),f(t)&&yi(t,e)}),indentSelection:Zi(vi),historySize:function(){return{undo:Zn.done.length,redo:Zn.undone.length}},clearHistory:function(){Zn=new _},setHistory:function(t){Zn=new _,Zn.done=t.done,Zn.undone=t.undone},getHistory:function(){function t(t){for(var e,i=0,n=[];i<t.length;++i){n.push(e=[]);for(var s=0,r=t[i];s<r.length;++s){var o=[],a=r[s];e.push({start:a.start,added:a.added,old:o});for(var l=0;l<a.old.length;++l)o.push(u(a.old[l]))}}return n}return{done:t(Zn.done),undone:t(Zn.undone)}},matchBrackets:Zi(function(){Vi(!0)}),getTokenAt:Zi(function(t){return t=ci(t),m(t.line).getTokenAt(wn,Gi(t.line),tn.tabSize,t.ch)}),getStateAfter:function(t){return t=hi(null==t?Dn.size-1:t),Gi(t+1)},cursorCoords:function(t,e){return null==t&&(t=Hn.inverted),this.charCoords(t?Hn.from:Hn.to,e)},charCoords:function(t,e){return t=ci(t),"local"==e?$i(t,!1):"div"==e?$i(t,!0):Pi(t)},coordsChar:function(t){var e=$(pn);return zi(t.x-e.left,t.y-e.top)},markText:Zi(Di),setBookmark:Mi,findMarksAt:Si,setMarker:Zi(Ti),clearMarker:Zi(Ai),setLineClass:Zi(Fi),hideLine:Zi(function(t){return Ii(t,!0)}),showLine:Zi(function(t){return Ii(t,!1)}),onDeleteLine:function(t,e){if("number"==typeof t){if(!f(t))return null;t=m(t)}return(t.handlers||(t.handlers=[])).push(e),t},lineInfo:Li,getViewport:function(){return{from:Yn,to:Vn}},addWidget:function(t,e,i,n,s){t=$i(ci(t));var r=t.yBot,o=t.x;if(e.style.position="absolute",vn.appendChild(e),"over"==n)r=t.y;else if("near"==n){var a=Math.max(yn.offsetHeight,Dn.height*Oi()),l=Math.max(vn.clientWidth,pn.clientWidth)-Ri();t.yBot+e.offsetHeight>a&&t.y>e.offsetHeight&&(r=t.y-e.offsetHeight),o+e.offsetWidth>l&&(o=l-e.offsetWidth)}e.style.top=r+Wi()+"px",e.style.left=e.style.right="","right"==s?(o=vn.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==s?o=0:"middle"==s&&(o=(vn.clientWidth-e.offsetWidth)/2),e.style.left=o+Ri()+"px"),i&&Ke(o,r,o+e.offsetWidth,r+e.offsetHeight)},lineCount:function(){return Dn.size},clipPos:ci,getCursor:function(t){return null==t&&(t=Hn.inverted),j(t?Hn.from:Hn.to)},somethingSelected:function(){return!W(Hn.from,Hn.to)},setCursor:Zi(function(t,e,i){null==e&&"number"==typeof t.line?li(t.line,t.ch,i):li(t,e,i)}),setSelection:Zi(function(t,e,i){(i?ri:oi)(ci(t),ci(e||t))}),getLine:function(t){return f(t)?m(t).text:void 0},getLineHandle:function(t){return f(t)?m(t):void 0},setLine:Zi(function(t,e){f(t)&&Oe(e,{line:t,ch:0},{line:t,ch:m(t).text.length})}),removeLine:Zi(function(t){f(t)&&Oe("",{line:t,ch:0},ci({line:t+1,ch:0}))}),replaceRange:Zi(Oe),getRange:function(t,e,i){return Re(ci(t),ci(e),i)},triggerOnKeyDown:Zi(De),execCommand:function(t){return ie[t](ns)},moveH:Zi(di),deleteH:Zi(pi),moveV:Zi(fi),toggleOverwrite:function(){Rn?(Rn=!1,cn.className=cn.className.replace(" CodeMirror-overwrite","")):(Rn=!0,cn.className+=" CodeMirror-overwrite")},posFromIndex:function(t){var e,i=0;return Dn.iter(0,Dn.size,function(n){var s=n.text.length+1;return s>t?(e=t,!0):(t-=s,++i,void 0)}),ci({line:i,ch:e})},indexFromPos:function(t){if(t.line<0||t.ch<0)return 0;var e=t.ch;return Dn.iter(0,t.line,function(t){e+=t.text.length+1}),e},scrollTo:function(t,e){null!=t&&(yn.scrollLeft=t),null!=e&&(an.scrollTop=yn.scrollTop=e),Qe([])},getScrollInfo:function(){return{x:yn.scrollLeft,y:an.scrollTop,height:an.scrollHeight,width:yn.scrollWidth}},setSize:function(t,e){function i(t){return t=String(t),/^\d+$/.test(t)?t+"px":t}null!=t&&(bn.style.width=i(t)),null!=e&&(yn.style.height=i(e)),ns.refresh()},operation:function(t){return Zi(t)()},compoundChange:function(t){return Qi(t)},refresh:function(){Qe(!0,null,Wn),an.scrollHeight>Wn&&(an.scrollTop=Wn)},getInputField:function(){return sn},getWrapperElement:function(){return bn},getScrollerElement:function(){return yn},getGutterElement:function(){return mn}},ss=null,rs="";Ci.prototype.clear=Zi(function(){for(var t=1/0,e=-1/0,i=0;i<this.lines.length;++i){var n=this.lines[i],s=a(n.markedSpans,this,!0);if(null!=s.from||null!=s.to){var r=x(n);t=Math.min(t,r),e=Math.max(e,r)}}1/0!=t&&Ln.push({from:t,to:e+1}),this.lines.length=0}),Ci.prototype.find=function(){for(var t,e,i=0;i<this.lines.length;++i){var n=this.lines[i],s=a(n.markedSpans,this);if(null!=s.from||null!=s.to){var r=x(n);null!=s.from&&(t={line:r,ch:s.from}),null!=s.to&&(e={line:r,ch:s.to})}}return"bookmark"==this.type?t:t&&{from:t,to:e}};var os,as,ls,hs,cs,us=0,ds={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},ps=0;for(var fs in te)te.propertyIsEnumerable(fs)&&!ns.propertyIsEnumerable(fs)&&(ns[fs]=te[fs]);return ns}function e(t){return"string"==typeof t?ne[t]:t}function i(t,i,n,s,r){function o(i){i=e(i);var n=i[t];if(n===!1)return r&&r(),!0;if(null!=n&&s(n))return!0;if(i.nofallthrough)return r&&r(),!0;var a=i.fallthrough;if(null==a)return!1;if("[object Array]"!=Object.prototype.toString.call(a))return o(a);for(var l=0,h=a.length;h>l;++l)if(o(a[l]))return!0;return!1}return i&&o(i)?!0:o(n)}function n(t){var e=ke[F(t,"keyCode")];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function s(t,e){if(e===!0)return e;if(t.copyState)return t.copyState(e);var i={};for(var n in e){var s=e[n];s instanceof Array&&(s=s.concat([])),i[n]=s}return i}function r(t,e,i){return t.startState?t.startState(e,i):!0}function o(t,e){this.pos=this.start=0,this.string=t,this.tabSize=e||8}function a(t,e,i){if(t)for(var n=0;n<t.length;++n){var s=t[n];if(s.marker==e)return i&&t.splice(n,1),s}}function l(t,e,i){if(t)for(var n,s=0;s<t.length;++s){var r=t[s],o=r.marker,a=null==r.from||(o.inclusiveLeft?r.from<=e:r.from<e);if(a||"bookmark"==o.type&&r.from==e&&r.from!=i){var l=null==r.to||(o.inclusiveRight?r.to>=e:r.to>e);(n||(n=[])).push({from:r.from,to:l?null:r.to,marker:o})}}return n}function h(t,e){if(t)for(var i,n=0;n<t.length;++n){var s=t[n],r=s.marker,o=null==s.to||(r.inclusiveRight?s.to>=e:s.to>e);if(o||"bookmark"==r.type&&s.from==e){var a=null==s.from||(r.inclusiveLeft?s.from<=e:s.from<e);(i||(i=[])).push({from:a?null:s.from-e,to:null==s.to?null:s.to-e,marker:r})}}return i}function c(t,e,i,n,s){if(!t&&!e)return s;var r=l(t,i),o=h(e,n),c=1==s.length,u=O(s).length+(c?i:0);if(r)for(var d=0;d<r.length;++d){var f=r[d];if(null==f.to){var m=a(o,f.marker);m?c&&(f.to=null==m.to?null:m.to+u):f.to=i}}if(o)for(var d=0;d<o.length;++d){var f=o[d];if(null!=f.to&&(f.to+=u),null==f.from){var m=a(r,f.marker);m||(f.from=u,c&&(r||(r=[])).push(f))}else f.from+=u,c&&(r||(r=[])).push(f)}var g=[p(s[0],r)];if(!c){var v,y=s.length-2;if(y>0&&r)for(var d=0;d<r.length;++d)null==r[d].to&&(v||(v=[])).push({from:null,to:null,marker:r[d].marker});for(var d=0;y>d;++d)g.push(p(s[d+1],v));g.push(p(O(s),o))}return g}function u(t){return"string"==typeof t?t:t.text}function d(t){return"string"==typeof t?null:t.markedSpans}function p(t,e){return e?{text:t,markedSpans:e}:t}function f(t){var e=t.markedSpans;if(e){for(var i=0;i<e.length;++i){var n=e[i].marker.lines,s=q(n,t);n.splice(s,1)}t.markedSpans=null}}function m(t,e){if(e){for(var i=0;i<e.length;++i)e[i].marker.lines.push(t);t.markedSpans=e}}function g(t,e){this.text=t,this.height=1,m(this,e)}function v(t){this.lines=t,this.parent=null;for(var e=0,i=t.length,n=0;i>e;++e)t[e].parent=this,n+=t[e].height;this.height=n}function y(t){this.children=t;for(var e=0,i=0,n=0,s=t.length;s>n;++n){var r=t[n];e+=r.chunkSize(),i+=r.height,r.parent=this}this.size=e,this.height=i,this.parent=null}function b(t,e){for(;!t.lines;)for(var i=0;;++i){var n=t.children[i],s=n.chunkSize();if(s>e){t=n;break}e-=s}return t.lines[e]}function x(t){if(null==t.parent)return null;for(var e=t.parent,i=q(e.lines,t),n=e.parent;n;e=n,n=n.parent){var s=0;for(n.children.length;n.children[s]!=e;++s)i+=n.children[s].chunkSize()}return i}function w(t,e){var i=0;t:do{for(var n=0,s=t.children.length;s>n;++n){var r=t.children[n],o=r.height;if(o>e){t=r;continue t}e-=o,i+=r.chunkSize()}return i}while(!t.lines);for(var n=0,s=t.lines.length;s>n;++n){var a=t.lines[n],l=a.height;if(l>e)break;e-=l}return i+n}function k(t,e){var i=0;t:do{for(var n=0,s=t.children.length;s>n;++n){var r=t.children[n],o=r.chunkSize();if(o>e){t=r;continue t}e-=o,i+=r.height}return i}while(!t.lines);for(var n=0;e>n;++n)i+=t.lines[n].height;return i}function _(){this.time=0,this.done=[],this.undone=[],this.compound=0,this.closed=!1}function C(){T(this)}function D(t){return t.stop||(t.stop=C),t}function M(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function S(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function T(t){M(t),S(t)}function A(t){return t.target||t.srcElement}function E(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),J&&t.ctrlKey&&1==e&&(e=3),e}function F(t,e){var i=t.override&&t.override.hasOwnProperty(e);return i?t.override[e]:t[e]}function I(t,e,i,n){if("function"==typeof t.addEventListener){if(t.addEventListener(e,i,!1),n)return function(){t.removeEventListener(e,i,!1)}}else{var s=function(t){i(t||window.event)};if(t.attachEvent("on"+e,s),n)return function(){t.detachEvent("on"+e,s)}}}function L(){this.id=null}function N(t,e,i){null==e&&(e=t.search(/[^\s\u00a0]/),-1==e&&(e=t.length));for(var n=0,s=0;e>n;++n)" "==t.charAt(n)?s+=i-s%i:++s;return s}function $(t,e){try{var i=t.getBoundingClientRect();i={top:i.top,left:i.left}}catch(n){i={top:0,left:0}}if(!e)if(null==window.pageYOffset){var s=document.documentElement||document.body.parentNode;null==s.scrollTop&&(s=document.body),i.top+=s.scrollTop,i.left+=s.scrollLeft}else i.top+=window.pageYOffset,i.left+=window.pageXOffset;return i}function z(t){return t.textContent||t.innerText||t.nodeValue||""}function P(t){for(;be.length<=t;)be.push(O(be)+" ");return be[t]}function O(t){return t[t.length-1]}function H(t){K?(t.selectionStart=0,t.selectionEnd=t.value.length):t.select()}function W(t,e){return t.line==e.line&&t.ch==e.ch}function R(t,e){return t.line<e.line||t.line==e.line&&t.ch<e.ch}function j(t){return{line:t.line,ch:t.ch}}function B(t,e,i,n){var s=document.createElement(t);if(i&&(s.className=i),n&&(s.style.cssText=n),"string"==typeof e)U(s,e);else if(e)for(var r=0;r<e.length;++r)s.appendChild(e[r]);return s}function Y(t){return t.innerHTML="",t}function V(t,e){Y(t).appendChild(e)}function U(t,e){ae?(t.innerHTML="",t.appendChild(document.createTextNode(e))):t.textContent=e
391
+ }function G(t,e){if(!e)return 0;if(!t)return e.length;for(var i=t.length,n=e.length;i>=0&&n>=0&&t.charAt(i)==e.charAt(n);--i,--n);return n+1}function q(t,e){if(t.indexOf)return t.indexOf(e);for(var i=0,n=t.length;n>i;++i)if(t[i]==e)return i;return-1}function X(t){return/\w/.test(t)||t.toUpperCase()!=t.toLowerCase()}t.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onViewportChange:null,onGutterClick:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,cursorBlinkRate:530,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null,lineNumberFormatter:function(t){return t}};var K=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),J=K||/Mac/.test(navigator.platform);/Win/.test(navigator.platform);var Z=t.modes={},Q=t.mimeModes={};t.defineMode=function(e,i){if(t.defaults.mode||"null"==e||(t.defaults.mode=e),arguments.length>2){i.dependencies=[];for(var n=2;n<arguments.length;++n)i.dependencies.push(arguments[n])}Z[e]=i},t.defineMIME=function(t,e){Q[t]=e},t.resolveMode=function(e){if("string"==typeof e&&Q.hasOwnProperty(e))e=Q[e];else if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return t.resolveMode("application/xml");return"string"==typeof e?{name:e}:e||{name:"null"}},t.getMode=function(e,i){var i=t.resolveMode(i),n=Z[i.name];if(!n)return t.getMode(e,"text/plain");var s=n(e,i);if(ee.hasOwnProperty(i.name)){var r=ee[i.name];for(var o in r)r.hasOwnProperty(o)&&(s[o]=r[o])}return s.name=i.name,s},t.listModes=function(){var t=[];for(var e in Z)Z.propertyIsEnumerable(e)&&t.push(e);return t},t.listMIMEs=function(){var t=[];for(var e in Q)Q.propertyIsEnumerable(e)&&t.push({mime:e,mode:Q[e]});return t};var te=t.extensions={};t.defineExtension=function(t,e){te[t]=e};var ee=t.modeExtensions={};t.extendMode=function(t,e){var i=ee.hasOwnProperty(t)?ee[t]:ee[t]={};for(var n in e)e.hasOwnProperty(n)&&(i[n]=e[n])};var ie=t.commands={selectAll:function(t){t.setSelection({line:0,ch:0},{line:t.lineCount()-1})},killLine:function(t){var e=t.getCursor(!0),i=t.getCursor(!1),n=!W(e,i);n||t.getLine(e.line).length!=e.ch?t.replaceRange("",e,n?i:{line:e.line}):t.replaceRange("",e,{line:e.line+1,ch:0})},deleteLine:function(t){var e=t.getCursor().line;t.replaceRange("",{line:e,ch:0},{line:e})},undo:function(t){t.undo()},redo:function(t){t.redo()},goDocStart:function(t){t.setCursor(0,0,!0)},goDocEnd:function(t){t.setSelection({line:t.lineCount()-1},null,!0)},goLineStart:function(t){t.setCursor(t.getCursor().line,0,!0)},goLineStartSmart:function(t){var e=t.getCursor(),i=t.getLine(e.line),n=Math.max(0,i.search(/\S/));t.setCursor(e.line,e.ch<=n&&e.ch?0:n,!0)},goLineEnd:function(t){t.setSelection({line:t.getCursor().line},null,!0)},goLineUp:function(t){t.moveV(-1,"line")},goLineDown:function(t){t.moveV(1,"line")},goPageUp:function(t){t.moveV(-1,"page")},goPageDown:function(t){t.moveV(1,"page")},goCharLeft:function(t){t.moveH(-1,"char")},goCharRight:function(t){t.moveH(1,"char")},goColumnLeft:function(t){t.moveH(-1,"column")},goColumnRight:function(t){t.moveH(1,"column")},goWordLeft:function(t){t.moveH(-1,"word")},goWordRight:function(t){t.moveH(1,"word")},delCharLeft:function(t){t.deleteH(-1,"char")},delCharRight:function(t){t.deleteH(1,"char")},delWordLeft:function(t){t.deleteH(-1,"word")},delWordRight:function(t){t.deleteH(1,"word")},indentAuto:function(t){t.indentSelection("smart")},indentMore:function(t){t.indentSelection("add")},indentLess:function(t){t.indentSelection("subtract")},insertTab:function(t){t.replaceSelection(" ","end")},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.replaceSelection(" ","end")},transposeChars:function(t){var e=t.getCursor(),i=t.getLine(e.line);e.ch>0&&e.ch<i.length-1&&t.replaceRange(i.charAt(e.ch)+i.charAt(e.ch-1),{line:e.line,ch:e.ch-1},{line:e.line,ch:e.ch+1})},newlineAndIndent:function(t){t.replaceSelection("\n","end"),t.indentLine(t.getCursor().line)},toggleOverwrite:function(t){t.toggleOverwrite()}},ne=t.keyMap={};ne.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},ne.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"},ne.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]},ne["default"]=J?ne.macDefault:ne.pcDefault,ne.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},t.fromTextArea=function(e,i){function n(){e.value=l.getValue()}if(i||(i={}),i.value=e.value,!i.tabindex&&e.tabindex&&(i.tabindex=e.tabindex),null==i.autofocus){var s=document.body;try{s=document.activeElement}catch(r){}i.autofocus=s==e||null!=e.getAttribute("autofocus")&&s==document.body}if(e.form){var o=I(e.form,"submit",n,!0);if("function"==typeof e.form.submit){var a=e.form.submit;e.form.submit=function h(){n(),e.form.submit=a,e.form.submit(),e.form.submit=h}}}e.style.display="none";var l=t(function(t){e.parentNode.insertBefore(t,e.nextSibling)},i);return l.save=n,l.getTextArea=function(){return e},l.toTextArea=function(){n(),e.parentNode.removeChild(l.getWrapperElement()),e.style.display="",e.form&&(o(),"function"==typeof e.form.submit&&(e.form.submit=a))},l};var se=/gecko\/\d{7}/i.test(navigator.userAgent),re=/MSIE \d/.test(navigator.userAgent),oe=/MSIE [1-7]\b/.test(navigator.userAgent),ae=/MSIE [1-8]\b/.test(navigator.userAgent),le=re&&5==document.documentMode,he=/WebKit\//.test(navigator.userAgent),ce=/Chrome\//.test(navigator.userAgent),ue=/Opera\//.test(navigator.userAgent),de=/Apple Computer/.test(navigator.vendor),pe=/KHTML\//.test(navigator.userAgent),fe=/Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);t.copyState=s,t.startState=r,t.innerMode=function(t,e){for(;t.innerMode;){var i=t.innerMode(e);e=i.state,t=i.mode}return i||{mode:t,state:e}},o.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.pos<this.string.length?this.string.charAt(this.pos++):void 0},eat:function(t){var e=this.string.charAt(this.pos);if("string"==typeof t)var i=e==t;else var i=e&&(t.test?t.test(e):t(e));return i?(++this.pos,e):void 0},eatWhile:function(t){for(var e=this.pos;this.eat(t););return this.pos>e},eatSpace:function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},skipToEnd:function(){this.pos=this.string.length},skipTo:function(t){var e=this.string.indexOf(t,this.pos);return e>-1?(this.pos=e,!0):void 0},backUp:function(t){this.pos-=t},column:function(){return N(this.string,this.start,this.tabSize)},indentation:function(){return N(this.string,null,this.tabSize)},match:function(t,e,i){if("string"!=typeof t){var n=this.string.slice(this.pos).match(t);return n&&n.index>0?null:(n&&e!==!1&&(this.pos+=n[0].length),n)}var s=function(t){return i?t.toLowerCase():t};return s(this.string).indexOf(s(t),this.pos)==this.pos?(e!==!1&&(this.pos+=t.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)}},t.StringStream=o;var me=" ";se||re&&!oe?me="​":ue&&(me=""),g.prototype={update:function(t,e){this.text=t,this.stateAfter=this.styles=null,f(this),m(this,e)},highlight:function(t,e,i){var n=new o(this.text,i),s=this.styles||(this.styles=[]),r=s.length=0;for(""==this.text&&t.blankLine&&t.blankLine(e);!n.eol();){var a=t.token(n,e),l=n.current();if(n.start=n.pos,r&&s[r-1]==a?s[r-2]+=l:l&&(s[r++]=l,s[r++]=a),n.pos>5e3){s[r++]=this.text.slice(n.pos),s[r++]=null;break}}},process:function(t,e,i){var n=new o(this.text,i);for(""==this.text&&t.blankLine&&t.blankLine(e);!n.eol()&&n.pos<=5e3;)t.token(n,e),n.start=n.pos},getTokenAt:function(t,e,i,n){for(var s=this.text,r=new o(s,i);r.pos<n&&!r.eol();){r.start=r.pos;var a=t.token(r,e)}return{start:r.start,end:r.pos,string:r.current(),className:a||null,state:e}},indentation:function(t){return N(this.text,null,t)},getContent:function(t,e,i){function n(e,i,n){if(i){if(r&&re&&" "==i.charAt(0)&&(i=" "+i.slice(1)),r=!1,a.test(i))for(var s=document.createDocumentFragment(),l=0;;){a.lastIndex=l;var h=a.exec(i),c=h?h.index-l:i.length-l;if(c&&(s.appendChild(document.createTextNode(i.slice(l,l+c))),o+=c),!h)break;if(l+=c+1," "==h[0]){var u=t-o%t;s.appendChild(B("span",P(u),"cm-tab")),o+=u}else{var d=B("span","•","cm-invalidchar");d.title="\\u"+h[0].charCodeAt(0).toString(16),s.appendChild(d),o+=1}}else{o+=i.length;var s=document.createTextNode(i)}n?e.appendChild(B("span",[s],n)):e.appendChild(s)}}function s(t){return t?"cm-"+t.replace(/ +/g," cm-"):null}var r=!0,o=0,a=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g,l=B("pre"),h=n;if(null!=e){var c=0,u=l.anchor=B("span");h=function(t,s,r){var o=s.length;if(e>=c&&c+o>e){e>c&&(n(t,s.slice(0,e-c),r),i&&t.appendChild(B("wbr"))),t.appendChild(u);var a=e-c;n(u,ue?s.slice(a,a+1):s.slice(a),r),ue&&n(t,s.slice(a+1),r),e--,c+=o}else c+=o,n(t,s,r),c==e&&c==m?(U(u,me),t.appendChild(u)):c>e+10&&/\s/.test(s)&&(h=function(){})}}var d=this.styles,p=this.text,f=this.markedSpans,m=p.length;if(p||null!=e)if(f&&f.length){f.sort(function(t,e){return t.from-e.from});for(var g,v=0,y=0,b="",x=f[0].from||0,w=[],k=0,_=function(){for(var t;k<f.length&&((t=f[k]).from==v||null==t.from);)"range"==t.marker.type&&w.push(t),++k;x=k<f.length?f[k].from:1/0;for(var e=0;e<w.length;++e){var i=w[e].to;null==i&&(i=1/0),i==v?w.splice(e--,1):x=Math.min(i,x)}};m>v;){x==v&&_();for(var C=Math.min(m,x);;){if(b){for(var D=v+b.length,M=g,S=0;S<w.length;++S){var T=w[S];M=(M?M+" ":"")+T.marker.style,T.marker.endStyle&&T.to===Math.min(D,C)&&(M+=" "+T.marker.endStyle),T.marker.startStyle&&T.from===v&&(M+=" "+T.marker.startStyle)}if(h(l,D>C?b.slice(0,C-v):b,M),D>=C){b=b.slice(C-v),v=C;break}v=D}b=d[y++],g=s(d[y++])}}}else for(var y=0,A=0;m>A;y+=2){var E=d[y],g=d[y+1],F=E.length;A+F>m&&(E=E.slice(0,m-A)),A+=F,h(l,E,s(g))}else h(l," ");return l},cleanUp:function(){this.parent=null,f(this)}},v.prototype={chunkSize:function(){return this.lines.length},remove:function(t,e,i){for(var n=t,s=t+e;s>n;++n){var r=this.lines[n];if(this.height-=r.height,r.cleanUp(),r.handlers)for(var o=0;o<r.handlers.length;++o)i.push(r.handlers[o])}this.lines.splice(t,e)},collapse:function(t){t.splice.apply(t,[t.length,0].concat(this.lines))},insertHeight:function(t,e,i){this.height+=i,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var n=0,s=e.length;s>n;++n)e[n].parent=this},iterN:function(t,e,i){for(var n=t+e;n>t;++t)if(i(this.lines[t]))return!0}},y.prototype={chunkSize:function(){return this.size},remove:function(t,e,i){this.size-=e;for(var n=0;n<this.children.length;++n){var s=this.children[n],r=s.chunkSize();if(r>t){var o=Math.min(e,r-t),a=s.height;if(s.remove(t,o,i),this.height-=a-s.height,r==o&&(this.children.splice(n--,1),s.parent=null),0==(e-=o))break;t=0}else t-=r}if(this.size-e<25){var l=[];this.collapse(l),this.children=[new v(l)],this.children[0].parent=this}},collapse:function(t){for(var e=0,i=this.children.length;i>e;++e)this.children[e].collapse(t)},insert:function(t,e){for(var i=0,n=0,s=e.length;s>n;++n)i+=e[n].height;this.insertHeight(t,e,i)},insertHeight:function(t,e,i){this.size+=e.length,this.height+=i;for(var n=0,s=this.children.length;s>n;++n){var r=this.children[n],o=r.chunkSize();if(o>=t){if(r.insertHeight(t,e,i),r.lines&&r.lines.length>50){for(;r.lines.length>50;){var a=r.lines.splice(r.lines.length-25,25),l=new v(a);r.height-=l.height,this.children.splice(n+1,0,l),l.parent=this}this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=t.children.splice(t.children.length-5,5),i=new y(e);if(t.parent){t.size-=i.size,t.height-=i.height;var n=q(t.parent.children,t);t.parent.children.splice(n+1,0,i)}else{var s=new y(t.children);s.parent=t,t.children=[s,i],t=s}i.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iter:function(t,e,i){this.iterN(t,e-t,i)},iterN:function(t,e,i){for(var n=0,s=this.children.length;s>n;++n){var r=this.children[n],o=r.chunkSize();if(o>t){var a=Math.min(e,o-t);if(r.iterN(t,a,i))return!0;if(0==(e-=a))break;t=0}else t-=o}}},_.prototype={addChange:function(t,e,i){this.undone.length=0;var n=+new Date,s=O(this.done),r=s&&O(s),o=n-this.time;if(this.compound&&s&&!this.closed)s.push({start:t,added:e,old:i});else if(o>400||!r||this.closed||r.start>t+i.length||r.start+r.added<t)this.done.push([{start:t,added:e,old:i}]),this.closed=!1;else{for(var a=Math.max(0,r.start-t),l=Math.max(0,t+i.length-(r.start+r.added)),h=a;h>0;--h)r.old.unshift(i[h-1]);for(var h=l;h>0;--h)r.old.push(i[i.length-h]);a&&(r.start=t),r.added+=e-(i.length-a-l)}this.time=n},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}},t.e_stop=T,t.e_preventDefault=M,t.e_stopPropagation=S,t.connect=I,L.prototype={set:function(t,e){clearTimeout(this.id),this.id=setTimeout(e,t)}};var ge=t.Pass={toString:function(){return"CodeMirror.Pass"}},ve=function(){if(ae)return!1;var t=B("div");return"draggable"in t||"dragDrop"in t}();!function(){var t=B("textarea");return t.value="foo\nbar",t.value.indexOf("\r")>-1?"\r\n":"\n"}();var ye=/^$/;se?ye=/$'/:de?ye=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:ce&&(ye=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var be=[""],xe=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,i=[],n=t.length;n>=e;){var s=t.indexOf("\n",e);-1==s&&(s=t.length);var r=t.slice(e,"\r"==t.charAt(s-1)?s-1:s),o=r.indexOf("\r");-1!=o?(i.push(r.slice(0,o)),e+=o+1):(i.push(r),e=s+1)}return i}:function(t){return t.split(/\r\n?|\n/)};t.splitLines=xe;var we=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(e){return!1}}:function(t){try{var e=t.ownerDocument.selection.createRange()}catch(i){}return e&&e.parentElement()==t?0!=e.compareEndPoints("StartToEnd",e):!1};t.defineMode("null",function(){return{token:function(t){t.skipToEnd()}}}),t.defineMIME("text/plain","null");var ke={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return t.keyNames=ke,function(){for(var t=0;10>t;t++)ke[t+48]=String(t);for(var t=65;90>=t;t++)ke[t]=String.fromCharCode(t);for(var t=1;12>=t;t++)ke[t+111]=ke[t+63235]="F"+t}(),t.version="2.34",t}(),define("codemirror",function(t){return function(){var e;return e||t.CodeMirror}}(this)),CodeMirror.defineMode("ruby",function(t){function e(t){for(var e={},i=0,n=t.length;n>i;++i)e[t[i]]=!0;return e}function i(t,e,i){return i.tokenize.push(t),t(e,i)}function n(t,e){if(l=null,t.sol()&&t.match("=begin")&&t.eol())return e.tokenize.push(a),"comment";if(t.eatSpace())return null;var n,s=t.next();if("`"==s||"'"==s||'"'==s||"/"==s&&!t.eol()&&" "!=t.peek())return i(r(s,"string",'"'==s||"`"==s),t,e);if("%"==s){var h,c=!1;t.eat("s")?h="atom":t.eat(/[WQ]/)?(h="string",c=!0):t.eat(/[wxqr]/)&&(h="string");var u=t.eat(/[^\w\s]/);return u?(d.propertyIsEnumerable(u)&&(u=d[u]),i(r(u,h,c,!0),t,e)):"operator"}if("#"==s)return t.skipToEnd(),"comment";if("<"==s&&(n=t.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return i(o(n[1]),t,e);if("0"==s)return t.eat("x")?t.eatWhile(/[\da-fA-F]/):t.eat("b")?t.eatWhile(/[01]/):t.eatWhile(/[0-7]/),"number";if(/\d/.test(s))return t.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==s){for(;t.match(/^\\[CM]-/););return t.eat("\\")?t.eatWhile(/\w/):t.next(),"string"}return":"==s?t.eat("'")?i(r("'","atom",!1),t,e):t.eat('"')?i(r('"',"atom",!0),t,e):(t.eatWhile(/[\w\?]/),"atom"):"@"==s?(t.eat("@"),t.eatWhile(/[\w\?]/),"variable-2"):"$"==s?(t.next(),t.eatWhile(/[\w\?]/),"variable-3"):/\w/.test(s)?(t.eatWhile(/[\w\?]/),t.eat(":")?"atom":"ident"):"|"!=s||!e.varList&&"{"!=e.lastTok&&"do"!=e.lastTok?/[\(\)\[\]{}\\;]/.test(s)?(l=s,null):"-"==s&&t.eat(">")?"arrow":/[=+\-\/*:\.^%<>~|]/.test(s)?(t.eatWhile(/[=+\-\/*:\.^%<>~|]/),"operator"):null:(l="|",null)}function s(){var t=1;return function(e,i){if("}"==e.peek()){if(t--,0==t)return i.tokenize.pop(),i.tokenize[i.tokenize.length-1](e,i)}else"{"==e.peek()&&t++;return n(e,i)}}function r(t,e,i,n){return function(r,o){for(var a,l=!1;null!=(a=r.next());){if(a==t&&(n||!l)){o.tokenize.pop();break}if(i&&"#"==a&&!l&&r.eat("{")){o.tokenize.push(s(arguments.callee));break}l=!l&&"\\"==a}return e}}function o(t){return function(e,i){return e.match(t)?i.tokenize.pop():e.skipToEnd(),"string"}}function a(t,e){return t.sol()&&t.match("=end")&&t.eol()&&e.tokenize.pop(),t.skipToEnd(),"comment"}var l,h=e(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload"]),c=e(["def","class","case","for","while","do","module","then","catch","loop","proc","begin"]),u=e(["end","until"]),d={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-t.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(t,e){t.sol()&&(e.indented=t.indentation());var i,n=e.tokenize[e.tokenize.length-1](t,e);if("ident"==n){var s=t.current();n=h.propertyIsEnumerable(t.current())?"keyword":/^[A-Z]/.test(s)?"tag":"def"==e.lastTok||"class"==e.lastTok||e.varList?"def":"variable",c.propertyIsEnumerable(s)?i="indent":u.propertyIsEnumerable(s)?i="dedent":"if"!=s&&"unless"!=s||t.column()!=t.indentation()||(i="indent")}return(l||n&&"comment"!=n)&&(e.lastTok=s||l||n),"|"==l&&(e.varList=!e.varList),"indent"==i||/[\(\[\{]/.test(l)?e.context={prev:e.context,type:l||n,indented:e.indented}:("dedent"==i||/[\)\]\}]/.test(l))&&e.context.prev&&(e.context=e.context.prev),t.eol()&&(e.continuedLine="\\"==l||"operator"==n),n},indent:function(e,i){if(e.tokenize[e.tokenize.length-1]!=n)return 0;var s=i&&i.charAt(0),r=e.context,o=r.type==d[s]||"keyword"==r.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(i);return r.indented+(o?0:t.indentUnit)+(e.continuedLine?t.indentUnit:0)},electricChars:"}de"}}),CodeMirror.defineMIME("text/x-ruby","ruby"),define("codemirror-ruby",["codemirror"],function(){}),function(t){t.extend(t.fn,{validate:function(e){if(this.length){var i=t.data(this[0],"validator");return i?i:(this.attr("novalidate","novalidate"),i=new t.validator(e,this[0]),t.data(this[0],"validator",i),i.settings.onsubmit&&(e=this.find("input, button"),e.filter(".cancel").click(function(){i.cancelSubmit=!0}),i.settings.submitHandler&&e.filter(":submit").click(function(){i.submitButton=this}),this.submit(function(e){function n(){if(i.settings.submitHandler){if(i.submitButton)var e=t("<input type='hidden'/>").attr("name",i.submitButton.name).val(i.submitButton.value).appendTo(i.currentForm);return i.settings.submitHandler.call(i,i.currentForm),i.submitButton&&e.remove(),!1}return!0}return i.settings.debug&&e.preventDefault(),i.cancelSubmit?(i.cancelSubmit=!1,n()):i.form()?i.pendingRequest?(i.formSubmitted=!0,!1):n():(i.focusInvalid(),!1)})),i)}e&&e.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(t(this[0]).is("form"))return this.validate().form();var e=!0,i=t(this[0].form).validate();return this.each(function(){e&=i.element(this)}),e},removeAttrs:function(e){var i={},n=this;return t.each(e.split(/\s/),function(t,e){i[e]=n.attr(e),n.removeAttr(e)}),i},rules:function(e,i){var n=this[0];if(e){var s=t.data(n.form,"validator").settings,r=s.rules,o=t.validator.staticRules(n);switch(e){case"add":t.extend(o,t.validator.normalizeRule(i)),r[n.name]=o,i.messages&&(s.messages[n.name]=t.extend(s.messages[n.name],i.messages));break;case"remove":if(!i)return delete r[n.name],o;var a={};return t.each(i.split(/\s/),function(t,e){a[e]=o[e],delete o[e]}),a}}return n=t.validator.normalizeRules(t.extend({},t.validator.metadataRules(n),t.validator.classRules(n),t.validator.attributeRules(n),t.validator.staticRules(n)),n),n.required&&(s=n.required,delete n.required,n=t.extend({required:s},n)),n}}),t.extend(t.expr[":"],{blank:function(e){return!t.trim(""+e.value)},filled:function(e){return!!t.trim(""+e.value)},unchecked:function(t){return!t.checked}}),t.validator=function(e,i){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=i,this.init()},t.validator.format=function(e,i){return 1==arguments.length?function(){var i=t.makeArray(arguments);return i.unshift(e),t.validator.format.apply(this,i)}:(arguments.length>2&&i.constructor!=Array&&(i=t.makeArray(arguments).slice(1)),i.constructor!=Array&&(i=[i]),t.each(i,function(t,i){e=e.replace(RegExp("\\{"+t+"\\}","g"),i)}),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(t)).hide())},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(t){(t.name in this.submitted||t==this.lastElement)&&this.element(t)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,i,n){"radio"===e.type?this.findByName(e.name).addClass(i).removeClass(n):t(e).addClass(i).removeClass(n)},unhighlight:function(e,i,n){"radio"===e.type?this.findByName(e.name).removeClass(i).addClass(n):t(e).removeClass(i).addClass(n)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function e(e){var i=t.data(this[0].form,"validator"),n="on"+e.type.replace(/^validate/,"");i.settings[n]&&i.settings[n].call(i,this[0],e)}this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var i=this.groups={};t.each(this.settings.groups,function(e,n){t.each(n.split(/\s/),function(t,n){i[n]=e})});var n=this.settings.rules;t.each(n,function(e,i){n[e]=t.validator.normalizeRule(i)}),t(this.currentForm).validateDelegate("[type='text'], [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'] ","focusin focusout keyup",e).validateDelegate("[type='radio'], [type='checkbox'], select, option","click",e),this.settings.invalidHandler&&t(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){this.lastElement=e=this.validationTargetFor(this.clean(e)),this.prepareElement(e),this.currentElements=t(e);var i=this.check(e);return i?delete this.invalid[e.name]:this.invalid[e.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),i},showErrors:function(e){if(e){t.extend(this.errorMap,e),this.errorList=[];for(var i in e)this.errorList.push({message:e[i],element:this.findByName(i)[0]});this.successList=t.grep(this.successList,function(t){return!(t.name in e)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e,i=0;for(e in t)i++;return i},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0==this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(e){}},findLastActive:function(){var e=this.lastActive;return e&&1==t.grep(this.errorList,function(t){return t.element.name==e.name}).length&&e},elements:function(){var e=this,i={};return t(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in i||!e.objectLength(t(this).rules())?!1:i[this.name]=!0})},clean:function(e){return t(e)[0]},errors:function(){return t(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([]),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},check:function(e){e=this.validationTargetFor(this.clean(e));var i,n=t(e).rules(),s=!1;for(i in n){var r={method:i,parameters:n[i]};try{var o=t.validator.methods[i].call(this,e.value.replace(/\r/g,""),e,r.parameters);if("dependency-mismatch"==o)s=!0;else{if(s=!1,"pending"==o)return this.toHide=this.toHide.not(this.errorsFor(e)),void 0;if(!o)return this.formatAndAdd(e,r),!1}}catch(a){throw this.settings.debug&&window.console&&console.log("exception occured when checking element "+e.id+", check the '"+r.method+"' method",a),a}}return s?void 0:(this.objectLength(n)&&this.successList.push(e),!0)},customMetaMessage:function(e,i){if(t.metadata){var n=this.settings.meta?t(e).metadata()[this.settings.meta]:t(e).metadata();return n&&n.messages&&n.messages[i]}},customMessage:function(t,e){var i=this.settings.messages[t];return i&&(i.constructor==String?i:i[e])},findDefined:function(){for(var t=0;t<arguments.length;t++)if(void 0!==arguments[t])return arguments[t]},defaultMessage:function(e,i){return this.findDefined(this.customMessage(e.name,i),this.customMetaMessage(e,i),!this.settings.ignoreTitle&&e.title||void 0,t.validator.messages[i],"<strong>Warning: No message defined for "+e.name+"</strong>")},formatAndAdd:function(t,e){var i=this.defaultMessage(t,e.method),n=/\$?\{(\d+)\}/g;"function"==typeof i?i=i.call(this,e.parameters,t):n.test(i)&&(i=jQuery.format(i.replace(n,"{$1}"),e.parameters)),this.errorList.push({message:i,element:t}),this.errorMap[t.name]=i,this.submitted[t.name]=i},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){for(var t=0;this.errorList[t];t++){var e=this.errorList[t];this.settings.highlight&&this.settings.highlight.call(this,e.element,this.settings.errorClass,this.settings.validClass),this.showLabel(e.element,e.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map(function(){return this.element})},showLabel:function(e,i){var n=this.errorsFor(e);n.length?(n.removeClass(this.settings.validClass).addClass(this.settings.errorClass),n.attr("generated")&&n.html(i)):(n=t("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(e),generated:!0}).addClass(this.settings.errorClass).html(i||""),this.settings.wrapper&&(n=n.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(n).length||(this.settings.errorPlacement?this.settings.errorPlacement(n,t(e)):n.insertAfter(e))),!i&&this.settings.success&&(n.text(""),"string"==typeof this.settings.success?n.addClass(this.settings.success):this.settings.success(n)),this.toShow=this.toShow.add(n)},errorsFor:function(e){var i=this.idOrName(e);return this.errors().filter(function(){return t(this).attr("for")==i
392
+ })},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(t){return this.checkable(t)&&(t=this.findByName(t.name).not(this.settings.ignore)[0]),t},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){var i=this.currentForm;return t(document.getElementsByName(e)).map(function(t,n){return n.form==i&&n.name==e&&n||null})},getLength:function(e,i){switch(i.nodeName.toLowerCase()){case"select":return t("option:selected",i).length;case"input":if(this.checkable(i))return this.findByName(i.name).filter(":checked").length}return e.length},depend:function(t,e){return this.dependTypes[typeof t]?this.dependTypes[typeof t](t,e):!0},dependTypes:{"boolean":function(t){return t},string:function(e,i){return!!t(e,i.form).length},"function":function(t,e){return t(e)}},optional:function(e){return!t.validator.methods.required.call(this,t.trim(e.value),e)&&"dependency-mismatch"},startRequest:function(t){this.pending[t.name]||(this.pendingRequest++,this.pending[t.name]=!0)},stopRequest:function(e,i){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[e.name],i&&0==this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.formSubmitted=!1):!i&&0==this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e){return t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},dateDE:{dateDE:!0},number:{number:!0},numberDE:{numberDE:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,i){e.constructor==String?this.classRuleSettings[e]=i:t.extend(this.classRuleSettings,e)},classRules:function(e){var i={};return(e=t(e).attr("class"))&&t.each(e.split(" "),function(){this in t.validator.classRuleSettings&&t.extend(i,t.validator.classRuleSettings[this])}),i},attributeRules:function(e){var i={};e=t(e);for(var n in t.validator.methods){var s;(s="required"===n&&"function"==typeof t.fn.prop?e.prop(n):e.attr(n))?i[n]=s:e[0].getAttribute("type")===n&&(i[n]=!0)}return i.maxlength&&/-1|2147483647|524288/.test(i.maxlength)&&delete i.maxlength,i},metadataRules:function(e){if(!t.metadata)return{};var i=t.data(e.form,"validator").settings.meta;return i?t(e).metadata()[i]:t(e).metadata()},staticRules:function(e){var i={},n=t.data(e.form,"validator");return n.settings.rules&&(i=t.validator.normalizeRule(n.settings.rules[e.name])||{}),i},normalizeRules:function(e,i){return t.each(e,function(n,s){if(s===!1)delete e[n];else if(s.param||s.depends){var r=!0;switch(typeof s.depends){case"string":r=!!t(s.depends,i.form).length;break;case"function":r=s.depends.call(i,i)}r?e[n]=void 0!==s.param?s.param:!0:delete e[n]}}),t.each(e,function(n,s){e[n]=t.isFunction(s)?s(i):s}),t.each(["minlength","maxlength","min","max"],function(){e[this]&&(e[this]=Number(e[this]))}),t.each(["rangelength","range"],function(){e[this]&&(e[this]=[Number(e[this][0]),Number(e[this][1])])}),t.validator.autoCreateRanges&&(e.min&&e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),e.minlength&&e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e.messages&&delete e.messages,e},normalizeRule:function(e){if("string"==typeof e){var i={};t.each(e.split(/\s/),function(){i[this]=!0}),e=i}return e},addMethod:function(e,i,n){t.validator.methods[e]=i,t.validator.messages[e]=void 0!=n?n:t.validator.messages[e],i.length<3&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,i,n){if(!this.depend(n,i))return"dependency-mismatch";switch(i.nodeName.toLowerCase()){case"select":return(e=t(i).val())&&e.length>0;case"input":if(this.checkable(i))return this.getLength(e,i)>0;default:return t.trim(e).length>0}},remote:function(e,i,n){if(this.optional(i))return"dependency-mismatch";var s=this.previousValue(i);if(this.settings.messages[i.name]||(this.settings.messages[i.name]={}),s.originalMessage=this.settings.messages[i.name].remote,this.settings.messages[i.name].remote=s.message,n="string"==typeof n&&{url:n}||n,this.pending[i.name])return"pending";if(s.old===e)return s.valid;s.old=e;var r=this;this.startRequest(i);var o={};return o[i.name]=e,t.ajax(t.extend(!0,{url:n,mode:"abort",port:"validate"+i.name,dataType:"json",data:o,success:function(n){r.settings.messages[i.name].remote=s.originalMessage;var o=n===!0;if(o){var a=r.formSubmitted;r.prepareElement(i),r.formSubmitted=a,r.successList.push(i),r.showErrors()}else a={},n=n||r.defaultMessage(i,"remote"),a[i.name]=s.message=t.isFunction(n)?n(e):n,r.showErrors(a);s.valid=o,r.stopRequest(i,o)}},n)),"pending"},minlength:function(e,i,n){return this.optional(i)||this.getLength(t.trim(e),i)>=n},maxlength:function(e,i,n){return this.optional(i)||this.getLength(t.trim(e),i)<=n},rangelength:function(e,i,n){return e=this.getLength(t.trim(e),i),this.optional(i)||e>=n[0]&&e<=n[1]},min:function(t,e,i){return this.optional(e)||t>=i},max:function(t,e,i){return this.optional(e)||i>=t},range:function(t,e,i){return this.optional(e)||t>=i[0]&&t<=i[1]},email:function(t,e){return this.optional(e)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(t)},url:function(t,e){return this.optional(e)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(t)},date:function(t,e){return this.optional(e)||!/Invalid|NaN/.test(new Date(t))},dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(t)},number:function(t,e){return this.optional(e)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},creditcard:function(t,e){if(this.optional(e))return"dependency-mismatch";if(/[^0-9 -]+/.test(t))return!1;var i=0,n=0,s=!1;t=t.replace(/\D/g,"");for(var r=t.length-1;r>=0;r--)n=t.charAt(r),n=parseInt(n,10),s&&(n*=2)>9&&(n-=9),i+=n,s=!s;return 0==i%10},accept:function(t,e,i){return i="string"==typeof i?i.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(e)||t.match(RegExp(".("+i+")$","i"))},equalTo:function(e,i,n){return n=t(n).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){t(i).valid()}),e==n.val()}}}),t.format=t.validator.format}(jQuery),function(t){var e={};if(t.ajaxPrefilter)t.ajaxPrefilter(function(t,i,n){i=t.port,"abort"==t.mode&&(e[i]&&e[i].abort(),e[i]=n)});else{var i=t.ajax;t.ajax=function(n){var s=("port"in n?n:t.ajaxSettings).port;return"abort"==("mode"in n?n:t.ajaxSettings).mode?(e[s]&&e[s].abort(),e[s]=i.apply(this,arguments)):i.apply(this,arguments)}}}(jQuery),function(t){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&t.each({focus:"focusin",blur:"focusout"},function(e,i){function n(e){return e=t.event.fix(e),e.type=i,t.event.handle.call(this,e)}t.event.special[i]={setup:function(){this.addEventListener(e,n,!0)},teardown:function(){this.removeEventListener(e,n,!0)},handler:function(e){return arguments[0]=t.event.fix(e),arguments[0].type=i,t.event.handle.apply(this,arguments)}}}),t.extend(t.fn,{validateDelegate:function(e,i,n){return this.bind(i,function(i){var s=t(i.target);return s.is(e)?n.apply(s,arguments):void 0})}})}(jQuery),define("jquery-validate",["jquery"],function(){}),!function(t){var e=function(t){this.messages={defaultMessage:"This value seems to be invalid.",type:{email:"This value should be a valid email.",url:"This value should be a valid url.",urlstrict:"This value should be a valid url.",number:"This value should be a valid number.",digits:"This value should be digits.",dateIso:"This value should be a valid date (YYYY-MM-DD).",alphanum:"This value should be alphanumeric."},notnull:"This value should not be null.",notblank:"This value should not be blank.",required:"This value is required.",regexp:"This value seems to be invalid.",min:"This value should be greater than %s.",max:"This value should be lower than %s.",range:"This value should be between %s and %s.",minlength:"This value is too short. It should have %s characters or more.",maxlength:"This value is too long. It should have %s characters or less.",rangelength:"This value length is invalid. It should be between %s and %s characters long.",mincheck:"You must select at least %s choices.",maxcheck:"You must select %s choices or less.",rangecheck:"You must select between %s and %s choices.",equalto:"This value should be the same."},this.init(t)};e.prototype={constructor:e,validators:{notnull:function(t){return 0<t.length},notblank:function(t){return null!==t&&""!==t.replace(/^\s+/g,"").replace(/\s+$/g,"")},required:function(t){if("object"==typeof t){for(var e in t)if(this.required(t[e]))return!0;return!1}return this.notnull(t)&&this.notblank(t)},type:function(t,e){var i;switch(e){case"number":i=/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/;break;case"digits":i=/^\d+$/;break;case"alphanum":i=/^\w+$/;break;case"email":i=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;break;case"url":t=/(https?|s?ftp|git)/i.test(t)?t:"http://"+t;case"urlstrict":i=/^(https?|s?ftp|git):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;break;case"dateIso":i=/^(\d{4})\D?(0[1-9]|1[0-2])\D?([12]\d|0[1-9]|3[01])$/;break;default:return!1}return""!==t?i.test(t):!1},regexp:function(t,e){return RegExp(e,"i").test(t)},minlength:function(t,e){return t.length>=e},maxlength:function(t,e){return t.length<=e},rangelength:function(t,e){return this.minlength(t,e[0])&&this.maxlength(t,e[1])},min:function(t,e){return Number(t)>=e},max:function(t,e){return Number(t)<=e},range:function(t,e){return t>=e[0]&&t<=e[1]},equalto:function(e,i){return e===t(i).val()},remote:function(e,i,n){var s={},r={};s[n.$element.attr("name")]=e,"undefined"!=typeof n.options.remoteDatatype&&(r={dataType:n.options.remoteDatatype});var o=function(t){n.updateConstraint("remote","isValid",t),n.manageValidationResult()};return t.ajax(t.extend({},{url:i,data:s,async:n.async,method:n.options.remoteMethod||"GET",success:function(t){o("1"===t||"true"==t||"object"==typeof t&&"undefined"!=typeof t.success||/success/i.test(t))},error:function(){o(!1)}},r)),n.async&&o(null),null},mincheck:function(t,e){return this.minlength(t,e)},maxcheck:function(t,e){return this.maxlength(t,e)},rangecheck:function(t,e){return this.rangelength(t,e)}},init:function(t){var e=t.validators;t=t.messages;for(var i in e)this.addValidator(i,e[i]);for(i in t)this.addMessage(i,t[i])},formatMesssage:function(t,e){if("object"==typeof e){for(var i in e)t=this.formatMesssage(t,e[i]);return t}return t.replace(/%s/i,e)},addValidator:function(t,e){this.validators[t]=e},addMessage:function(t,e,i){if("undefined"!=typeof i&&!0===i)this.messages.type[t]=e;else if("type"===t)for(var n in e)this.messages.type[n]=e[n];else this.messages[t]=e}};var i=function(t,i,n){this.options=i,this.Validator=new e(i),this.init(t,n||"ParsleyField")};i.prototype={constructor:i,init:function(e,i){this.type=i,this.isValid=!0,this.element=e,this.validatedOnce=!1,this.$element=t(e),this.val=this.$element.val(),this.isRequired=!1,this.constraints=[],"undefined"==typeof this.isRadioOrCheckbox&&(this.isRadioOrCheckbox=!1,this.hash=this.generateHash(),this.errorClassHandler=this.options.errors.classHandler(e)||this.$element),this.ulErrorManagement(),this.bindHtml5Constraints(),this.addConstraints(),this.constraints.length&&this.bindValidationEvents()},bindHtml5Constraints:function(){(this.$element.hasClass("required")||this.$element.attr("required"))&&(this.options.required=!0),"undefined"!=typeof this.$element.attr("type")&&RegExp(this.$element.attr("type"),"i").test("email url number range")&&(this.options.type=this.$element.attr("type"),RegExp(this.options.type,"i").test("number range")&&(this.options.type="number","undefined"!=typeof this.$element.attr("min")&&this.$element.attr("min").length&&(this.options.min=this.$element.attr("min")),"undefined"!=typeof this.$element.attr("max")&&this.$element.attr("max").length&&(this.options.max=this.$element.attr("max"))))},addConstraints:function(){for(var t in this.options)t=t.toLowerCase(),"function"==typeof this.Validator.validators[t]&&(this.constraints.push({name:t,requirements:this.options[t],isValid:null}),"required"===t&&(this.isRequired=!0),this.addCustomConstraintMessage(t))},addCustomConstraintMessage:function(t){var e=t+("type"===t?this.options[t].charAt(0).toUpperCase()+this.options[t].substr(1):"")+"Message";"undefined"!=typeof this.options[e]&&this.Validator.addMessage("type"===t?this.options[t]:t,this.options[e],"type"===t)},bindValidationEvents:function(){this.$element.addClass("parsley-validated");var e=this.options.trigger+(/key/i.test(this.options.trigger)?"":" keyup");this.options.remote&&(e+=/change/i.test(e)?"":" change"),e&&this.$element.on((e+" ").split(" ").join("."+this.type+" "),!1,t.proxy(this.eventValidation,this))},generateHash:function(){return"parsley-"+(Math.random()+"").substring(2)},getHash:function(){return this.hash},getVal:function(){return this.$element.val()},eventValidation:function(t){var e=this.getVal();return"keyup"===t.type&&!/keyup/i.test(this.options.trigger)&&!this.validatedOnce||e.length<this.options.validationMinlength&&!this.validatedOnce?!0:(this.validate(!0,!1),void 0)},isFieldValid:function(){return this.validate(!1,!1)},validate:function(t,e){var i=this.getVal(),n=null;return this.options.listeners.onFieldValidate(this.element,this)||""===i&&!this.isRequired?(this.reset(),null):this.needsValidation(i)?(this.errorBubbling="undefined"!=typeof t?t:!0,this.async="undefined"!=typeof e?e:!0,n=this.applyValidators(),this.errorBubbling&&this.manageValidationResult(),n):this.isValid},needsValidation:function(t){return null!==this.isValid&&this.val===t&&this.validatedOnce?!1:(this.val=t,this.validatedOnce=!0)},applyValidators:function(){for(var t=null,e=0;e<this.constraints.length;e++){var i=this.Validator.validators[this.constraints[e].name](this.val,this.constraints[e].requirements,this);!1===i?(t=!1,this.constraints[e].isValid=t):!0===i&&(this.constraints[e].isValid=!0,t=!1!==t)}return t},updateConstraint:function(t,e,i){for(var n=0;n<this.constraints.length;n++)if(this.constraints[n].name===t){this.constraints[n][e]=i;break}},manageValidationResult:function(){for(var t=null,e=0;e<this.constraints.length;e++)!1===this.constraints[e].isValid?(this.addError(this.constraints[e]),t=!1):!0===this.constraints[e].isValid&&(this.removeError(this.constraints[e].name),t=!1!==t);return this.isValid=t,!0===this.isValid?(this.removeErrors(),this.errorClassHandler.removeClass(this.options.errorClass).addClass(this.options.successClass),this.options.listeners.onFieldSuccess(this.element,this.constraints,this),!0):!1===this.isValid?(this.errorClassHandler.removeClass(this.options.successClass).addClass(this.options.errorClass),this.options.listeners.onFieldError(this.element,this.constraints,this),!1):t},ulErrorManagement:function(){this.ulError="#"+this.hash,this.ulTemplate=t(this.options.errors.errorsWrapper).attr("id",this.hash).addClass("parsley-error-list")},removeError:function(e){e=this.ulError+" ."+e,this.ulError&&t(e).remove()&&0===t(this.ulError).children().length&&t(this.ulError).remove()},removeErrors:function(){t(this.ulError).remove()},reset:function(){return this.isValid=null,this.removeErrors(),this.errorClassHandler.removeClass(this.options.successClass).removeClass(this.options.errorClass),this},addError:function(e){t(this.ulError).length||this.options.errors.container(this.element,this.ulTemplate,this.isRadioOrCheckbox)||(this.isRadioOrCheckbox?this.$element.parent().after(this.ulTemplate):this.$element.after(this.ulTemplate));var i=e.name,n=!1!==this.options.errorMessage?"custom-error-message":i,s=this.ulError+" ."+n,n=t(this.options.errors.errorElem).addClass(n);e=!1!==this.options.errorMessage?this.options.errorMessage:"type"===e.name?this.Validator.messages[i][e.requirements]:"undefined"==typeof this.Validator.messages[i]?this.Validator.messages.defaultMessage:this.Validator.formatMesssage(this.Validator.messages[i],e.requirements),t(s).length||t(this.ulError).append(t(n).text(e))},addListener:function(t){for(var e in t)this.options.listeners[e]=t[e]},destroy:function(){this.$element.removeClass("parsley-validated"),this.reset().$element.off("."+this.type).removeData(this.type)}};var n=function(t,e){this.initMultiple(t,e),this.inherit(t,e),this.init(t,e)};n.prototype={constructor:n,initMultiple:function(e,i){this.element=e,this.$element=t(e),this.hash=this.getName(),this.isRadioOrCheckbox=!0,this.isRadio=this.$element.is("input[type=radio]"),this.isCheckbox=this.$element.is("input[type=checkbox]"),this.siblings='input[name="'+this.$element.attr("name")+'"]',this.$siblings=t(this.siblings),this.errorClassHandler=i.errors.classHandler(e)||this.$element.parent()},inherit:function(t,e){var n,s=new i(t,e);for(n in s)"undefined"==typeof this[n]&&(this[n]=s[n])},getName:function(){return"parsley-"+this.$element.attr("name").replace(/(:|\.|\[|\])/g,"")},getVal:function(){if(this.isRadio)return t(this.siblings+":checked").val()||"";if(this.isCheckbox){var e=[];return t(this.siblings+":checked").each(function(){e.push(t(this).val())}),e}}};var s=function(t,e){this.init("parsleyForm",t,e)};s.prototype={constructor:s,init:function(e,i,n){this.type=e,this.items=[],this.$element=t(i),this.options=n;var s,r=this;this.$element.find(n.inputs).each(function(){s=t(this).parsley(n),null!==s&&r.items.push(s)}),this.$element.on("submit."+this.type,!1,t.proxy(this.validate,this))},addListener:function(t){for(var e in t)if(/Field/.test(e))for(var i=0;i<this.items.length;i++)this.items[i].addListener(t);else this.options.listeners[e]=t[e]},validate:function(t){var e=!0;this.focusedField=!1;for(var i=0;i<this.items.length;i++)!1===this.items[i].validate()&&(e=!1,!this.focusedField&&"first"===this.options.focus||"last"===this.options.focus)&&(this.focusedField=this.items[i].$element);return this.focusedField&&!e&&this.focusedField.focus(),this.options.listeners.onFormSubmit(e,t,this),e},removeErrors:function(){for(var t=0;t<this.items.length;t++)this.items[t].parsley("reset")},destroy:function(){for(var t=0;t<this.items.length;t++)this.items[t].destroy();this.$element.off("."+this.type).removeData(this.type)}},t.fn.parsley=function(e,r){function o(o,l){var h=t(o).data(l);if(!h){switch(l){case"parsleyForm":h=new s(o,a);break;case"parsleyField":h=new i(o,a);break;case"parsleyFieldMultiple":h=new n(o,a);break;default:return}t(o).data(l,h)}return"string"==typeof e&&"function"==typeof h[e]?h[e](r):h}var a=t.extend(!0,{},t.fn.parsley.defaults,"undefined"!=typeof window.ParsleyConfig?window.ParsleyConfig:{},e,this.data()),l=null;return t(this).is("form")?l=o(t(this),"parsleyForm"):t(this).is(a.inputs)&&!t(this).is(a.excluded)&&(l=o(t(this),t(this).is("input[type=radio], input[type=checkbox]")?"parsleyFieldMultiple":"parsleyField")),"function"==typeof r?r():l},t.fn.parsley.Constructor=s,t.fn.parsley.defaults={inputs:"input, textarea, select",excluded:"input[type=hidden], :disabled",trigger:!1,focus:"first",validationMinlength:3,successClass:"parsley-success",errorClass:"parsley-error",errorMessage:!1,validators:{},messages:{},errors:{classHandler:function(){},container:function(){},errorsWrapper:"<ul></ul>",errorElem:"<li></li>"},listeners:{onFieldValidate:function(){return!1},onFormSubmit:function(){},onFieldError:function(){},onFieldSuccess:function(){}}},t(window).on("load",function(){t('[data-validate="parsley"]').each(function(){t(this).parsley()})})}(window.jQuery||window.Zepto),define("parsley",["jquery"],function(){}),define("view/addmonitor",["view/base","model/monitor","codemirror","util/cron","codemirror-ruby","jquery-validate","parsley"],function(t,e,i,n){var s=t.extend({scheduleViewInitialized:!1,metricsViewInitialized:!1,scheduleView:!0,cronScheduleFormValid:!1,cronScheduleWeekdaysSelected:!1,cronScheduleDaysDisabled:!1,namePagerFormValid:!1,el:".add-monitor-wrap",subscriptions:{"view:dashboard:category":"updateDashboardId","view:settings:save":"render"},events:{"click .setMetrics":"advanceToMetrics","click .testGraph":"testMetrics","click .nameSchedule":"backToSchedule","click .saveFinish":"saveFinish","click .back":"exitFullScreen","click #cronScheduleForm .day-month-picker .day-picker button":"cronWeekdayButtonClicked","hide #addMonitor":"modalClose","show #addMonitor":"modalShow","shown #addMonitor":"focusFirst"},initialize:function(t){_.bindAll(this),this.user=t.user,this.dashboardId=t.dashboardId,this.templar=t.templar;var e=_.debounce(this.adjustModalLayout,500);$(window).resize(e),this.render()},render:function(){this.setElement($(".add-monitor-wrap")),this.templar.render({path:"addmonitor",el:this.$el,data:{}}),this.templar.render({path:"schedulemonitor",el:this.$el.find(".content-wrap"),data:{user:this.user.toJSON()}}),this.scheduleViewInitialized=!0,this.setNamePagerValidation(),this.setCronScheduleValidation(),this.setNameScheduleHelp(),this.$modal=this.$el.find(".add-monitor"),this.resizeModal($("#addMonitor"),"large")},updateDashboardId:function(t){this.dashboardId=t,this.model.set({dashboardId:this.dashboardId})},adjustModalLayout:function(){var t=$("#addMonitor"),e=this.resizeModal(t,"large"),i=325,n=80,s=150,r=80;if(!this.scheduleView){var o=e.body.height-n>i?e.body.height-n:i;t.find(".hero-unit").css({height:o});var a=Math.floor((o-s)/2);this.expressionsMirror.setSize(null,a),this.metricsMirror.setSize(null,a);var l=Math.floor((o-r)/2);t.find(".graph").css({height:l}),this.chart.setSize(null,l),t.find("#outputView").css({height:l})}},advanceToMetrics:function(){this.namePagerForm.parsley("validate"),this.cronScheduleForm.parsley("validate"),this.namePagerFormValid&&this.cronScheduleFormValid&&(this._setSchedule(),this._setupMetricsView())},backToSchedule:function(){this._setupScheduleView()},exitFullScreen:function(){var t=this.$el.find("button.close"),e=this.$el.find("button.back"),i=$(".add-monitor .metrics .CodeMirror"),n=$(".add-monitor .expressions .CodeMirror");t.show(),e.hide(),i.removeClass("fullscreen"),i.data("beforeFullscreen")&&(i.height(i.data("beforeFullscreen").height),i.width(i.data("beforeFullscreen").width)),this.metricsMirror.refresh(),n.removeClass("fullscreen"),n.data("beforeFullscreen")&&(n.height(n.data("beforeFullscreen").height),n.width(n.data("beforeFullscreen").width)),this.expressionsMirror.refresh()},setCronScheduleWeekdaysSelected:function(){this.cronScheduleWeekdaysSelected=$("#cronScheduleForm .day-month-picker .day-picker button.active").size()>0},setCronScheduleDaysDisabled:function(t){t?this.cronScheduleDaysDisabled||($("#inputDays").parsley("ParsleyField").reset(),$("#inputDays").val("?"),$("#inputDays").attr("disabled",""),this.cronScheduleDaysDisabled=!0):this.cronScheduleDaysDisabled&&($("#inputDays").val("*"),$("#inputDays").removeAttr("disabled"),this.cronScheduleDaysDisabled=!1)},cronWeekdayButtonClicked:function(t){$(t.target).button("toggle"),this.setCronScheduleWeekdaysSelected(),this.setCronScheduleDaysDisabled(this.cronScheduleWeekdaysSelected)},setNameScheduleHelp:function(){$cronHelpContent="",$alertHelpContent="",$.ajax({url:rearview.path+"/help/cron.html",async:!1,success:function(t){$cronHelpContent=t}}),$.ajax({url:rearview.path+"/help/alert.html",async:!1,success:function(t){$alertHelpContent=t}}),this.$el.find("#cronScheduleForm .set-schedule .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$cronHelpContent}),this.$el.find("#namePagerForm .pager-duty .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$alertHelpContent})},setNamePagerValidation:function(){this.namePagerForm=$("#namePagerForm"),this.namePagerForm.parsley({listeners:{onFormSubmit:function(t){this.namePagerFormValid=t}.bind(this)}})},setCronScheduleValidation:function(){this.cronScheduleForm=$("#cronScheduleForm");var t=n.parsleyValidator();_.extend(t,{errors:{container:function(t,e){var i=$("#cronScheduleFormErrors");return i.append(e),i}},listeners:{onFormSubmit:function(t){this.cronScheduleFormValid=t}.bind(this)}}),this.cronScheduleForm.parsley(t)},setMetricsValidation:function(){$.validator.addMethod("code",function(t,e){var i=$(e).data("CodeMirror");return $(i.getWrapperElement()),this._validateMirror(i)}.bind(this),"This field is required."),$.validator.addMethod("metric-ruby",function(){var t=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(e){"success"==e.status&&(t=!0)}}),t},"Your metrics code does not validate."),$.validator.addMethod("expression-ruby",function(t){var e=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(i){("success"==i.status||""==t)&&(e=!0)}}),e}.bind(this),"Your expression code does not validate."),this.metricsForm=$("#metricsExpressionsForm"),this.metricsForm.validate({rules:{inputMetrics:{code:!0,"expression-ruby":!0},inputExpressions:{"expression-ruby":!0}},errorPlacement:function(t,e){var i=$(e).data("CodeMirror");if(i){var n=$(i.getWrapperElement());this._validateMirror(i),t.insertAfter(n)}else t.insertAfter(e)}.bind(this),highlight:function(t){$(t).closest(".control-group").addClass("error"),$(t).closest("fieldset").addClass("error")},success:function(t){$(t).closest(".control-group").removeClass("error"),$(t).closest("fieldset").removeClass("error"),$(t).remove()},submitHandler:function(){this._saveMonitor(function(){this._closeModal()}.bind(this))}.bind(this)})},testMetrics:function(){this._setMetrics(),$.post("/monitor.json",this.model.toJSON(),function(t){if(t.graph_data){var e=this.formatGraphData(t.graph_data);this.renderGraphData(this.chart,e),$("#outputView").val(t.output)}"error"===t.status&&Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:t.errors,raw:t.output,attention:"Monitor Test Error!",status:"error"})}.bind(this)).error(function(t){Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:t.errors,raw:t.output,attention:"Monitor Test Error!",status:"error"})}.bind(this))},modalClose:function(t){$(t.target).hasClass("add-monitor")&&(t.stopPropagation(),this.metricsViewInitialized&&(this.backToSchedule(),this.metricsViewInitialized=!1),Backbone.Mediator.pub("view:addmonitor:close"))},modalShow:function(){Backbone.Mediator.pub("view:addmonitor:show")},resize:function(){return _.debounce(this.adjustModalLayout,500)},saveFinish:function(){this._setMetrics(),$("#inputMetrics").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),$("#inputExpressions").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),this.metricsForm.submit()},setMetricsHelp:function(){var t="";$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(e){t=e}});var e=this.$el.find(".help");e.tooltip({container:".expressions-metrics",trigger:"manual",html:!0,placement:"right",delay:{show:100,hide:200},title:t}).click(function(t){t.stopPropagation(),$(this).tooltip("toggle")})},destructor:function(){this.metricsViewInitialized=!1,this.scheduleViewInitialized=!1,this.metricsMonitorFooter=null,this.scheduleMonitorBody=null,this.scheduleMonitorFooter=null;var t=this.$el.prev();this.$template&&this.$template.off(),this.remove(),this.off(),$("<section class='add-monitor-wrap'></section>").insertAfter(t)},_closeModal:function(){this.$modal.modal("hide")},_getTemplateMetaData:function(t){$.ajax({url:rearview.path+"/monitors/index.json",success:function(e){"function"==typeof t&&t(e)}})},_initCodeMirror:function(){var t=this.$el.find("#inputExpressions")[0],e=".add-monitor .expressions .CodeMirror",n=this.$el.find("#inputMetrics")[0],s=".add-monitor .metrics .CodeMirror",r=this.$el.find("button.close"),o=this.$el.find("button.back");this.expressionsMirror=i.fromTextArea(t,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(t,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),this._toggleFullscreen(e,this.expressionsMirror,r,o)):void 0
393
+ }.bind(this)}),$(t).data("CodeMirror",this.expressionsMirror),this.metricsMirror=i.fromTextArea(n,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(t,e){return 70==e.keyCode&&e.ctrlKey&&"keydown"==e.type?(e.stop(),this._toggleFullscreen(s,this.metricsMirror,r,o)):void 0}.bind(this)}),$(n).data("CodeMirror",this.metricsMirror)},_initDatePicker:function(){this.fromDatePicker=$("#fromDatePicker").datetimepicker()},_setTemplateSelect:function(t){this.$template=this.$el.find("#selectTemplate"),this.$template.data("template",t),this.$template.on("change",function(){var t=this.$template.data("template");if(this.selectedIndex>0){var e=this.selectedIndex-1,i=t[e];i.path&&$.ajax({url:i.path,success:function(t){i.metrics&&i.metrics.length>0&&this.metricsMirror.setValue(i.metrics.join("\n")),this.expressionsMirror.setValue(t)}.bind(this)})}}.bind(this))},_setSchedule:function(){this.model.set({userId:this.user.get("id"),name:this.$el.find("#monitorName").val(),description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find("#pagerDuty").val()),cronExpr:this._createCronExpr()})},_setMetrics:function(){this.model.set({userId:this.user.get("id"),monitorExpr:this.expressionsMirror.getValue(),metrics:this.metricsMirror.getValue().split("\n"),minutes:parseInt(this.$el.find("#minutesBack").val()),toDate:this.$el.find("#fromDatePicker").val()})},_setupScheduleView:function(){this.metricsMonitorBody=$(".add-monitor .modal-body").detach(),this.metricsMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.scheduleMonitorBody),$(".add-monitor").append(this.scheduleMonitorFooter),this.scheduleView=!0,this.adjustModalLayout()},_setupMetricsView:function(){var t=$(".add-monitor");this.metricsViewInitialized?(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.metricsMonitorBody),$(".add-monitor").append(this.metricsMonitorFooter)):(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),this._getTemplateMetaData(function(e){this.templar.render({path:"setmetrics",el:t,append:!0,data:{monitor:{templates:e}}}),this._setTemplateSelect(e),this._initCodeMirror(),this._initDatePicker(),this.initGraph(t.find(".graph")[0]),this.setMetricsHelp(),this.setMetricsValidation(),this.metricsViewInitialized=!0,this.scheduleView=!1,this.adjustModalLayout()}.bind(this)))},_saveMonitor:function(t){this._setMetrics(),this.model.save({id:null,userId:this.user.get("id")},{success:function(i){"function"==typeof t&&t(),Backbone.Mediator.pub("view:addmonitor:save",{model:i,message:"The monitor '"+i.get("name")+"' was added.",attention:"Monitor Saved!",status:"success"}),this.model=new e}.bind(this),error:function(t,e){Backbone.Mediator.pub("view:addmonitor:save",{model:t,tryJSON:e.responseText,attention:"Monitor Save Error!",status:"error"})}})}});return s}),define("collection/monitor",["jquery","underscore","backbone","model/monitor"],function(t,e,i,n){var s=i.Collection.extend({model:n,url:function(){return this.dashboardId?"/dashboards/"+this.dashboardId+"/jobs.json":"/jobs.json"},initialize:function(t,i){e.bindAll(this,"url"),this.dashboardId=i.dashboardId,this.cb=i.cb,this.fetch({success:function(t){this.cb&&this.cb(t)}.bind(this),async:!1})},filterById:function(t){var i=[];return e.each(t,function(t){e.isUndefined(this.get(t))||i.push(t)},this),this.reset(e.map(i,function(t){return this.get(t)},this))}});return s}),define("view/smallmonitor",["view/base"],function(t){var e=t.extend({el:".small-monitor",events:{"click .header-name":"editMonitor","click .settings .btn":"monitorSettings","click .save":"monitorSettings","click .monitor-inactive":"deactivateMonitor","click .monitor-active":"activateMonitor","click button.reset":"resetMonitor"},initialize:function(t){_.bindAll(this,"editMonitor","expandMonitor","monitorTitle","monitorSettings","deactivateMonitor","activateMonitor","resetMonitor","setupDrag"),this.templar=t.templar,this.user=t.user?t.user:null,this.dashboardId=t.dashboardId?t.dashboardId:null,this.addHelpers(),this.intervalLength=t.intervalLength?t.intervalLength:60,Backbone.Mediator.sub("controller:dashboard:init",this.expandMonitor,this);var e=_.debounce(this.monitorTitle,500);$(window).resize(e)},render:function(){return this.templar.render({path:"smallmonitor",el:this.$el,append:!0,data:{monitor:this.model.toJSON()}}),this.initMonitor(),this},initMonitor:function(){this.$el.data("view",this),this.$monitor=this.$el.find("#smallMonitor"+this.model.get("id")),this.$wrap=this.$monitor.parent(),this.$graph=this.$monitor.find(".graph")[0],this.$monitor.find("h1").tooltip(),this.chart=this.initGraph(this.$graph),this.updateGraph(),this.interval=setInterval(function(){this.updateGraph(!0)}.bind(this),1e3*this.intervalLength),this.setupDrag()},setupDrag:function(){this.$monitor.draggable({handle:this.$el.find(".drag-handle"),containment:"body",snap:".small-monitor-drag",snapMode:"inner",snapTolerance:30,appendTo:".monitor-wrap",scroll:!0,revert:"invalid",start:function(t,e){var i=e.helper;e.offset,i.draggable("option","revert",!0),$("body").removeAttr("style"),i.parent().css({"z-index":"9999"}),this.currentOrder=this.getMonitorOrder()}.bind(this),stop:function(t,e){var i=e.helper,n=(e.offset,i.attr("id")),s=!0;i.parent().css({"z-index":"1"}),$(".small-monitor").each(function(t,e){var r=$(e).attr("id");n!==r&&this.overlaps(i,e)&&(this.setorder(i.parent(),$(e).parent(),!0),i.css({left:0,top:0}),s=!1)}.bind(this)),s&&i.css({left:0,top:0})}.bind(this),drag:function(t,e){e.helper,e.offset}.bind(this)})},setorder:function(t,e,i){t=$(t),e=$(e),i=!!i;var n=(t.parent(),e.parent()),s=n.attr("data-order"),r=this.currentOrder?this.currentOrder:this.getMonitorOrder(),o=t.data("view"),a=o.model.get("id"),l=_.indexOf(r,a);r.splice(l,1),r.splice(s,0,a),this.currentOrder=r,this.reorder(),i&&this.setDashboardPreferences()},updateGraph:function(t){var e=!1;t?t&&this.model.get("active")&&(e=!0):e=!0,e&&(this.errorState=!0,this.showOverlay(this.$graph,"Loading...","small-monitor-overlay"),$.ajax({url:"/jobs/"+this.model.get("id")+"/data",success:function(t){"error"===t.status?(this.hideOverlay(),_.isEmpty(t.graph_data)?this.showOverlay(this.$graph,"Monitor Error - No Data","small-monitor-error-overlay"):this.showOverlay(this.$graph,"Monitor Error","small-monitor-error-overlay"),this._setErrorState()):"failed"===t.status?(this.hideOverlay(),this.formattedGraphData=this.formatGraphData(t.graph_data),this.renderGraphData(this.chart,this.formattedGraphData),this._setErrorState(),this.model.set("output",t.output)):"graphite_error"===t.status?(this.hideOverlay(),this.showOverlay(this.$graph,"Graphite Error","small-monitor-error-overlay"),this._setErrorState()):"graphite_metric_error"===t.status?(this.hideOverlay(),this.showOverlay(this.$graph,"Graphite Metrics Error","small-monitor-error-overlay"),this._setErrorState()):t.graph_data?(this.hideOverlay(),this.errorState=!1,this.formattedGraphData=this.formatGraphData(t.graph_data),this.renderGraphData(this.chart,this.formattedGraphData),this.model.set("output",t.output),this._setErrorState(!0)):(this.hideOverlay(),this.showOverlay(this.$graph,"Unexpected Error","small-monitor-error-overlay"),this._setErrorState())}.bind(this),error:function(){this.hideOverlay(),this.showOverlay(this.$graph,"Waiting For Next Run","small-monitor-error-overlay")}.bind(this)}))},deactivateMonitor:function(t){$(t.target).hasClass("active")||this.model.save({active:!1},{error:function(t){Backbone.Mediator.pub("view:smallmonitor:save",{model:this.model,message:"The monitor '"+t.get("name")+"' caused an error on deactivation, please check your monitor code.",attention:"Monitor Deactivate Error!",status:"error"})}})},activateMonitor:function(t){$(t.target).hasClass("active")||this.model.save({active:!0},{error:function(){Backbone.Mediator.pub("view:smallmonitor:save",{model:this.model,message:"The monitor '"+this.model.get("name")+"' caused an error on activation, please check your monitor code.",attention:"Monitor Activate Error!",status:"error"})}.bind(this)})},resetMonitor:function(){this.$monitor.find("#resetMonitor").toggle("show"),Backbone.Mediator.pub("view:smallmonitor:reset",{model:this.model})},expandMonitor:function(t){t.monitorId==this.model.get("id")&&this.editMonitor()},editMonitor:function(){Backbone.Mediator.pub("view:smallmonitor:edit",this.model.get("id"),this)},monitorSettings:function(){this.$monitor.toggleClass("flipped")},monitorTitle:function(){var t=140,e=this.$monitor.width();this.$header=this.$monitor.find(".header-name"),this.$titleText=this.$monitor.find(".header-name p"),this.$header.css("width",e-t),this.$titleText.width()>this.$header.width()?this.$header.addClass("truncated"):this.$header.removeClass("truncated")},nextRun:function(){this.hideOverlay(),this.showOverlay(this.$graph,"Waiting For Next Run","small-monitor-error-overlay")},reorder:function(){var t=$(".dashboard-"+this.model.get("dashboardId")+" .small-monitor-drag");t.each(function(t,e){$(e).prepend($("#smallMonitor"+this.currentOrder[t]).parent())}.bind(this))},setDashboardPreferences:function(){var t=this.user.get("preferences")?this.user.get("preferences"):{},e=t&&t.dashboards?t.dashboards:{};e[this.model.get("dashboardId")]={order:this.currentOrder},t.dashboards=e,this.user.updatePrefs(t)},getMonitorOrder:function(){var t=$(".dashboard-"+this.model.get("dashboardId")+" .small-monitor-wrap"),e=[];return t.each(function(t,i){var n=$(i).data("view");e.push(n.model.get("id"))}),e},destructor:function(){clearInterval(this.interval),this.model.unbind(),this.unbind(),this.off(),this.undelegateEvents(),Backbone.Mediator.unsubscribe("view:smallmonitor:edit",this.editMonitor),Backbone.Mediator.unsubscribe("controller:dashboard:init",this.expandMonitor,this),this.remove(),this.$el.remove()},_setErrorState:function(t){t?this.$el.children(":first").removeClass("red"):this.$el.children(":first").addClass("red")}});return e}),define("view/deletemonitor",["view/base"],function(t){var e=t.extend({events:{"click button.cancel":"closeModal","click button.delete":"delete"},initialize:function(t){var e=this;e.templar=t.templar,e.render()},render:function(){var t=this;t.templar.render({path:"deletemonitor",el:t.$el,data:{}}),t.modalEl=t.$el.find(".delete-monitor"),t.resizeModal($("#deleteMonitor"),"small",!0)},"delete":function(){var t=this;t.closeModal(),Backbone.Mediator.pub("view:deletemonitor:delete")},closeModal:function(){var t=this;t.modalEl.modal("hide")},destructor:function(){var t=this,e=t.$el.prev();t.remove(),t.unbind(),t.onDestruct&&t.onDestruct(),t.$el=$("<section class='delete-monitor-wrap'></section>").insertAfter(e)}});return e}),define("view/expandedmonitor",["view/base","view/deletemonitor","model/monitor","util/cron","parsley"],function(t,e,i,n){var s=t.extend({cronScheduleFormValid:!0,cronScheduleWeekdaysSelected:!1,cronScheduleDaysDisabled:!1,events:{"click .name-save":"updateMonitorName","click .schedule-tab":"_setExpandedViewHeight","click #cronScheduleFormEdit .day-month-picker .day-picker button":"cronWeekdayButtonClicked","change #selectPreviousError":"_setErrorDropDown"},subscriptions:{"view:dashboard:init":"exit","view:deletemonitor:delete":"deleteMonitor"},initialize:function(t){_.bindAll(this),this.user=t.user,this.router=t.router,this.templar=t.templar,this.deleteMonitorView=new e({el:$(".delete-monitor-wrap"),templar:this.templar});var i=_.debounce(this._setExpandedViewHeight,500);$(window).resize(i)},render:function(t,e,i,n){this.monitorId=t,this.categories=e,this.categoryId=i,this.dashboardId=n,this.initMonitor()},initMonitor:function(){var t=this;t.getMonitor(t.monitorId,function(e){t.model=e,_.bind(t.updateMonitor,t,t.model),_.each(t.categories,function(e){e.selected=e.id===t.model.get("dashboardId")?!0:!1}),t.getGraphData(t.monitorId,function(){t._initErrorsList(function(e){t.templar.render({path:"expandedmonitor",el:t.$el,data:{monitor:t.model.toJSON(),errors:e,alerts:e,output:t.model.get("output"),categories:t.categories}}),t.$monitor=t.$el.find(".expanded-monitor"),t.$el.html(t.$monitor),t._setAlertsHistory(),t.chart=t.initGraph(t.$monitor.find(".graph")[0]),t._setErrorState(),t.updateGraph(t.model,function(e){t._initializeCodeMirror(),t._initializeDatePicker(".input-from-date"),t._setErrorDropDown(),t._setScheduleData(),t._setEditNameField(),t.$el.find(".save-changes").click({model:t.model},t.updateMonitor),t.$el.find(".cancel-changes").click(function(){t.exit()}),t.$el.find(".test-in-graph button").click({model:new i,output:e},t.testMonitor,t),t.open()},t.formattedGraphData),t.setHelp(),t.setCronScheduleValidation(),t._setExpandedViewHeight()},t.model)})})},setCronScheduleWeekdaysSelected:function(){this.cronScheduleWeekdaysSelected=$("#cronScheduleFormEdit .day-month-picker .day-picker button.active").size()>0},setCronScheduleDaysDisabled:function(t){t?this.cronScheduleDaysDisabled||($("#inputDays").parsley("ParsleyField").reset(),$("#inputDays").val("?"),$("#inputDays").attr("disabled",""),this.cronScheduleDaysDisabled=!0):this.cronScheduleDaysDisabled&&($("#inputDays").val("*"),$("#inputDays").removeAttr("disabled"),this.cronScheduleDaysDisabled=!1)},cronWeekdayButtonClicked:function(t){$(t.target).button("toggle"),this.setCronScheduleWeekdaysSelected(),this.setCronScheduleDaysDisabled(this.cronScheduleWeekdaysSelected)},setCronScheduleValidation:function(){this.cronScheduleForm=$("#cronScheduleFormEdit");var t=n.parsleyValidator();_.extend(t,{errors:{container:function(t,e){var i=$("#cronScheduleFormEditErrors");return i.append(e),i}},listeners:{onFormSubmit:function(t){this.cronScheduleFormValid=t}.bind(this)}}),this.cronScheduleForm.parsley(t)},getGraphData:function(t,e){var i=this;$.ajax({url:"/jobs/"+t+"/data",success:function(t){t.graph_data&&(i.formattedGraphData=i.formatGraphData(t.graph_data)),_.isUndefined(e)||e(t)},error:function(t){_.isUndefined(e)||e(t)}})},getMonitor:function(t,e){var n=this;n.model=new i({id:t}),n.model.fetch({success:function(t){_.isUndefined(e)||e(t)}})},getErrorStatus:function(t){var e=!1;switch(t){case"error":e=!0;break;case"failed":e=!0;break;case"graphite_error":e=!0;break;case"graphite_metric_error":e=!0;break;case"security_error":e=!0}return e},setHelp:function(){var t=this,e="";$alertContent="",$cronHelpContent="",$.ajax({url:rearview.path+"/help/cron.html",async:!1,success:function(t){$cronHelpContent=t}}),$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(t){e=t}}),$.ajax({url:rearview.path+"/help/alert.html",async:!1,success:function(t){$alertContent=t}}),t.$el.find("#viewSchedule .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$cronHelpContent}),t.$el.find(".help:nth-child(2)").tooltip({trigger:"click",html:!0,placement:"right",delay:{show:100,hide:200},title:e}),t.$el.find("#viewSettings .monitor-meta .pager-duty .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$alertContent})},open:function(){this.$el.addClass("active"),Backbone.Mediator.pub("view:expandedmonitor:open",{nav:{back:!0}}),this.router.navigate("dash/"+this.dashboardId+"/expand/"+this.model.get("id"))},exit:function(t){var e=this;e.$el.removeClass("active"),e.model&&e.router.navigate("dash/"+e.model.get("dashboardId")),Backbone.Mediator.pub("view:expandedmonitor:exit",{status:"delete"})},updateGraph:function(t,e,i){var n=this;i?(n.renderGraphData(n.chart,i),"function"==typeof e&&e()):$.ajax({url:"/monitor.json",type:"POST",data:t.toJSON(),success:function(t){if(t.graph_data){var i=n.formatGraphData(t.graph_data);n.renderGraphData(n.chart,i),n.$el.find("textarea.output-view").val(t.output)}"error"===t.status&&Backbone.Mediator.pub("view:expandedmonitor:test",{model:this.model,errors:t.errors,raw:t.output,attention:"Monitor Test Error!",status:"error"}),"function"==typeof e&&e(t.output)},failure:function(){}})},testMonitor:function(t){var e=this,i=t.data.model,n=t.data.output,s=$(t.target);s.button("loading"),i=e._setMetrics(i),i=e._setSchedule(i),e.$el.find("textarea.output-view").val(n),e.$el.find(".output-tab").tab("show"),e.updateGraph(i,function(){s.button("reset")})},viewErrorInGraph:function(t){var e=this,i=t.data.model,n=t.data.output,s=t.data.toDate;i.set("toDate",s),i=e._setMetrics(i,!0),i=e._setSchedule(i),e.$el.find("textarea.output-view").val(n),e.$el.find(".output-tab").tab("show"),e.updateGraph(i)},updateMonitor:function(t){var e=this,i=t.data.model;t.data.test,t.data.toDate,t.data.output,this.cronScheduleForm.parsley("validate"),this.cronScheduleFormValid&&(i=e._setMetrics(i),i=e._setSchedule(i),i=e._setSettings(i),i.save(null,{success:function(t){Backbone.Mediator.pub("view:expandedmonitor:save",{model:e.model,message:"The monitor '"+t.get("name")+"' was saved.",attention:"Monitor Saved!",status:"success"}),e.exit(i),e.updateGraph(i)},error:function(t,i){Backbone.Mediator.pub("view:expandedmonitor:save",{model:e.model,tryJSON:i.responseText,attention:"Monitor Saved Error!",status:"error"})}}))},deleteMonitor:function(){var t=this;t.model.destroy({success:function(e){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:t.model,message:"The monitor '"+e.get("name")+"' was removed from the current dashboard.",attention:"Monitor Deleted!"})},error:function(e){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:t.model,message:"The monitor '"+e.get("name")+"' produced an error during the process of deletion.",attention:"Monitor Delete Error!",status:"error"})}}),t.exit()},updateMonitorName:function(){var t=this,e=t.$el.find(".name-field");e.prev().html(),t.model.set({name:e.find("input").val()}),e.prev().html(t.model.get("name")),e.hide(),e.prev().show()},resize:function(){var t=this;return _.debounce(t._setExpandedViewHeight,500)},destructor:function(){var t=this,e=t.$el.prev();t.deleteMonitorView.destructor(),t.destroySubscriptions(),t.remove(),t.unbind(),t.off(),e.after("<div class='edit-monitor-wrap clearfix'>")},_setExpandedViewHeight:function(){var t=580,e=6,i=4,n=this.$el.find("#viewMetrics")?this.$el.find("#viewMetrics").height():null;n&&this.$el.find("#viewSchedule, #viewSettings").css({height:n+"px"}),this.$el.find(".output-view").css({height:$(window).height()-t-i+"px"}),this.$el.find(".alerts-history ul").css({height:$(window).height()-t-e+"px"}),this.$el.find(".graph").css({height:$(window).height()-t+"px"});var s=$(window).height()-t>150?$(window).height()-t:150;this.chart&&s>150&&this.chart.setSize(null,s)},_setErrorState:function(){var t=this.getErrorStatus(this.model.get("status"));t?this.$monitor.addClass("red"):this.$monitor.removeClass("red")},_initErrorsList:function(t){var e=this,i=e.model.get("id");$.get("/jobs/"+i+"/errors",function(i){i=_.map(i,function(t){return{label:e.formatServerDateTime(t.date,!0).toString("MM/dd/yyyy HH:mm"),value:t.date,message:t.message,id:t.id}}),t(i)})},_setErrorDropDown:function(){var t=this,e=this.$el.find("#selectPreviousError");if(""!==e.find("option:selected").val()){var i=e.find("option:selected").html();t.fromDatePicker.datetimepicker("setDate",i)}},_setEditNameField:function(){var t=this,e=t.$el.find(".name-field");e.prev().click(function(){e.prev().hide(),e.show(),e.find("input").focus()})},_initializeCodeMirror:function(){var t=this,e=t.$el.find("#inputExpressions")[0],i=t.$el.find("#inputMetrics")[0];t.expressionsMirror=CodeMirror.fromTextArea(e,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(e,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),t._toggleFullscreen(".expanded-monitor .expressions .CodeMirror",t.expressionsMirror)):void 0}}),t.metricsMirror=CodeMirror.fromTextArea(i,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(e,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),t._toggleFullscreen(".expanded-monitor .metrics .CodeMirror",t.metricsMirror)):void 0}})},_initializeDatePicker:function(t){var e=this;e.fromDatePicker=e.$el.find(t).datetimepicker()},_setScheduleData:function(){var t=this,e=t.model.get("cronExpr").split(" ");t.$el.find("#inputSeconds").val(e[0]),t.$el.find("#inputMinutes").val(e[1]),t.$el.find("#inputHours").val(e[2]),t.$el.find("#inputDays").val(e[3]);var i=e[4].split(","),n=e[5].split(",");t._setButtonGroup(t.$el.find(".day-picker button"),n),t._setButtonGroup(t.$el.find(".month-picker button"),i)},_setButtonGroup:function(t,e){t.each(function(t,i){i=$(i);var n=_.indexOf(e,i.attr("data-value"));n>-1&&i.addClass("active")})},_setMetrics:function(t,e){var i=this;return t.set({userId:i.user.get("id"),monitorExpr:i.expressionsMirror.getValue(),metrics:i.metricsMirror.getValue().split("\n"),minutes:parseInt(i.$el.find(".input-minutes-back").val()),toDate:e?t.get("toDate"):i.$el.find(".input-from-date").val()}),t},_setSchedule:function(t){var e=this.$el.find(".monitor-name")[0]?this.$el.find(".monitor-name").val():t.get("name");return t.set({userId:this.user.get("id"),name:e,description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find(".pager-duty textarea").val()),cronExpr:this._createCronExpr()}),t},_setSettings:function(t){return t.set({dashboardId:parseInt(this.$el.find("#selectCategory").val(),10)}),t},_setAlertsHistory:function(){var t=this;t.$monitor.find(".alerts-history ul").delegate("li button","click",function(e){t.viewErrorInGraph({data:{model:new i,test:!0,toDate:$(e.target).attr("data-date")}}),t.fromDatePicker.datetimepicker("setDate",$(e.target).attr("data-date"))})}});return s}),define("view/resetmonitor",["view/base"],function(t){var e=t.extend({subscriptions:{"view:smallmonitor:reset":"setCurrentMonitor"},events:{"click button.cancel":"closeModal","click button.reset":"resetMonitor"},initialize:function(t){_.bindAll(this,"setCurrentMonitor","resetMonitor","closeModal"),this.templar=t.templar,this.render()},render:function(){this.templar.render({path:"resetmonitor",el:this.$el,data:{}}),this.$modal=this.$el.find(".reset-monitor"),this.resizeModal($("#resetMonitor"),"small",!0)},setCurrentMonitor:function(t){this.model=t.model},resetMonitor:function(){this.closeModal(),$.ajax({url:"/jobs/"+this.model.get("id")+"/reset.json",type:"post",data:{_method:"PUT"},success:function(){Backbone.Mediator.pub("view:resetmonitor:reset",{model:this.model,message:"The '"+this.model.get("name")+"' monitor's history and data were reset.",attention:"Monitor Reset Successful!"})}.bind(this),error:function(){Backbone.Mediator.pub("view:resetmonitor:reset",{model:this.model,message:"The monitor '"+this.model.get("name")+"' caused an error on reset, please check your monitor code.",attention:"Monitor Activate Error!",status:"error"})}.bind(this)})},closeModal:function(){this.$modal.modal("hide")},destructor:function(){var t=this.$el.prev();this.destroySubscriptions(),this.remove(),this.unbind(),this.onDestruct&&this.onDestruct(),this.$el=$("<section class='reset-monitor-wrap'></section>").insertAfter(t)}});return e}),function(t){"function"==typeof define&&define.amd?define("timeline",t):t()}(function(){var t=function(e){this.dom={},this.conversion={},this.eventParams={},this.groups=[],this.groupIndexes={},this.items=[],this.selection=void 0,this.listeners={},this.size={actualHeight:0,axis:{characterMajorHeight:0,characterMajorWidth:0,characterMinorHeight:0,characterMinorWidth:0,height:0,labelMajorTop:0,labelMinorTop:0,line:0,lineMajorWidth:0,lineMinorHeight:0,lineMinorTop:0,lineMinorWidth:0,top:0},contentHeight:0,contentLeft:0,contentWidth:0,dataChanged:!1,frameHeight:0,frameWidth:0,groupsLeft:0,groupsWidth:0,items:{top:0}},this.dom.container=e,this.options={utc:!1,width:"100%",height:"auto",minHeight:0,autoHeight:!0,eventMargin:10,eventMarginAxis:20,dragAreaWidth:10,min:void 0,max:void 0,intervalMin:10,intervalMax:31536e10,moveable:!0,zoomable:!0,selectable:!0,editable:!1,snapEvents:!0,groupChangeable:!0,showCurrentTime:!0,showCustomTime:!1,showMajorLabels:!0,showNavigation:!0,showButtonAdd:!0,groupsOnRight:!1,axisOnTop:!1,stackEvents:!0,animate:!0,animateZoom:!0,style:"box"},this.clientTimeOffset=3600;for(var i=this.dom;i.container.hasChildNodes();)i.container.removeChild(i.container.firstChild);this.step=new t.StepDate(this.options),this.data=[],this.firstDraw=!0,this.setVisibleChartRange(void 0,void 0,!1),this.redrawFrame(),Array.prototype.indexOf||(Array.prototype.indexOf=function(t){for(var e=0;e<this.length;e++)if(this[e]==t)return e;return-1}),this.trigger("ready")};return t.prototype.draw=function(t,e){this.setOptions(e),this.setData(t),e&&e.start&&e.end?this.setVisibleChartRange(e.start,e.end):this.firstDraw&&this.setVisibleChartRangeAuto(),this.firstDraw=!1},t.prototype.setOptions=function(t){if(t)for(var e in t)t.hasOwnProperty(e)&&(this.options[e]=t[e]);this.options.autoHeight="auto"===this.options.height},t.getOptions=function(){return this.options},t.prototype.setData=function(e){this.unselectItem(),e||(e=[]),this.items=[],this.data=e;var i=this.items;if(this.options,this.setGroups(e),!t.isArray(e))throw"Unknown data type. DataTable or Array expected.";for(var n=0,s=e.length;s>n;n++){var r=e[n],o=this.createItem(r);i.push(o)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(!1),this.redrawFrame(),this.size.dataChanged=!1},t.prototype.setGroups=function(e){if(this.deleteGroups(),this.groups,this.groupIndexes,!t.isArray(e))throw"Unknown data type. DataTable or Array expected.";for(var i=0,n=e.length;n>i;i++){var s=e[i],r=s.group;r&&this.addGroup(r)}},t.prototype.getData=function(){return this.data},t.prototype.updateData=function(e,i){var n=this.data;if(!t.isArray(n))throw"Cannot update data, unknown type of data";var s=n[e];void 0==s&&(s={},n[e]=s),i.start&&(s.start=i.start),i.end&&(s.end=i.end),i.content&&(s.content=i.content),i.group&&(s.group=i.group)},t.prototype.getItemIndex=function(t){for(var e=t,i=this.dom,n=this.items,s=void 0;e.parentNode&&e.parentNode!==i.items.frame;)e=e.parentNode;if(e.parentNode===i.items.frame)for(var r=0,o=n.length;o>r;r++)if(n[r].dom===e){s=r;break}return s},t.prototype.setSize=function(t,e){t&&(this.options.width=t,this.dom.frame.style.width=t),e&&(this.options.height=e,this.options.autoHeight="auto"===this.options.height,"auto"!==e&&(this.dom.frame.style.height=e)),this.recalcSize(),this.stackEvents(!1),this.redrawFrame()},t.prototype.setVisibleChartRange=function(t,e,i){void 0==t&&(t=new Date,t.setDate(t.getDate()-3)),void 0==e&&(e=new Date,e.setDate(t.getDate()+4)),e.valueOf()<=t.valueOf()&&(e=new Date(t),e.setDate(e.getDate()+7));var n=this.options.min?this.options.min.valueOf():void 0;n&&t.valueOf()<n&&(t=new Date(n));var s=this.options.max?this.options.max.valueOf():void 0;s&&e.valueOf()>s&&(e=new Date(s)),this.applyRange(t,e),void 0==i||1==i?(this.recalcSize(),this.stackEvents(!1),this.redrawFrame()):this.recalcConversion()},t.prototype.setVisibleChartRangeAuto=function(){var t=this.items;startMin=void 0,endMax=void 0;for(var e=0,i=t.length;i>e;e++){var n=t[e],s=n.start?n.start.valueOf():void 0,r=n.end?n.end.valueOf():s;startMin=void 0!==startMin&&void 0!==s?Math.min(startMin,s):s,endMax=void 0!==endMax&&void 0!==r?Math.max(endMax,r):r}if(void 0!==startMin&&void 0!==endMax){var o=endMax-startMin;o=0,startMin-=.05*o,endMax+=.05*o,this.setVisibleChartRange(new XDate(startMin),new XDate(endMax))}else this.setVisibleChartRange(void 0,void 0)},t.prototype.setVisibleChartRangeNow=function(){var t=new Date,e=this.end.getTime()-this.start.getTime(),i=new Date(t.getTime()-e/2),n=new Date(i.getTime()+e);this.setVisibleChartRange(i,n)},t.prototype.getVisibleChartRange=function(){var t={start:new Date(this.start),end:new Date(this.end)};return t},t.prototype.redrawFrame=function(){var t=this.dom,e=this.options,i=this.size;t.frame||(t.frame=document.createElement("DIV"),t.frame.className="timeline-frame",t.frame.style.position="relative",t.frame.style.overflow="hidden",t.container.appendChild(t.frame)),t.frame.style.height=e.autoHeight?i.frameHeight+"px":e.height||"100%",t.frame.style.width=e.width||"100%",this.redrawContent(),this.redrawGroups(),this.redrawCurrentTime(),this.redrawCustomTime(),this.redrawNavigation()},t.prototype.redrawContent=function(){var e=this.dom,i=this.size;if(!e.content){e.content=document.createElement("DIV"),e.content.style.position="relative",e.content.style.overflow="hidden",e.frame.appendChild(e.content);var n=document.createElement("DIV");n.style.position="absolute",n.style.left="0px",n.style.top="0px",n.style.height="100%",n.style.width="0px",e.content.appendChild(n),e.contentTimelines=n;var s=this.eventParams,r=this;s.onMouseDown||(s.onMouseDown=function(t){r.onMouseDown(t)},t.addEventListener(e.content,"mousedown",s.onMouseDown)),s.onTouchStart||(s.onTouchStart=function(t){r.onTouchStart(t)},t.addEventListener(e.content,"touchstart",s.onTouchStart)),s.onMouseWheel||(s.onMouseWheel=function(t){r.onMouseWheel(t)},t.addEventListener(e.content,"mousewheel",s.onMouseWheel)),s.onDblClick||(s.onDblClick=function(t){r.onDblClick(t)},t.addEventListener(e.content,"dblclick",s.onDblClick))}e.content.style.left=i.contentLeft+"px",e.content.style.top="0px",e.content.style.width=i.contentWidth+"px",e.content.style.height=i.frameHeight+"px",this.redrawAxis(),this.redrawItems(),this.redrawDeleteButton(),this.redrawDragAreas()},t.prototype.redrawAxis=function(){var t=this.dom,e=this.options,i=this.size,n=this.step,s=t.axis;s||(s={},t.axis=s),void 0===i.axis.properties&&(i.axis.properties={}),void 0===s.minorTexts&&(s.minorTexts=[]),void 0===s.minorLines&&(s.minorLines=[]),void 0===s.majorTexts&&(s.majorTexts=[]),void 0===s.majorLines&&(s.majorLines=[]),s.frame||(s.frame=document.createElement("DIV"),s.frame.style.position="absolute",s.frame.style.left="0px",s.frame.style.top="0px",t.content.appendChild(s.frame)),t.content.removeChild(s.frame),s.frame.style.width=i.contentWidth+"px",s.frame.style.height=i.axis.height+"px";var r=this.screenToTime(0),o=this.screenToTime(i.contentWidth),a=i.contentWidth;this.minimumStep=this.screenToTime(6*i.axis.characterMinorWidth).valueOf()-this.screenToTime(0).valueOf(),n.setRange(r,o,this.minimumStep),this.redrawAxisCharacters(),this.redrawAxisStartOverwriting(),n.start();for(var l=void 0;!n.end();){var h=n.getCurrent(),c=this.timeToScreen(h),u=n.isMajor();this.redrawAxisMinorText(c,n.getLabelMinor()),u&&e.showMajorLabels?(c>0&&(void 0===l&&(l=c),this.redrawAxisMajorText(c,n.getLabelMajor())),this.redrawAxisMajorLine(c)):this.redrawAxisMinorLine(c),n.next()}if(e.showMajorLabels){var d=this.screenToTime(0),p=this.step.getLabelMajor(d),a=p.length*i.axis.characterMajorWidth+10;(void 0===l||l>a)&&this.redrawAxisMajorText(0,p,d)}this.redrawAxisHorizontal(),this.redrawAxisEndOverwriting(),t.content.insertBefore(s.frame,t.content.firstChild)},t.prototype.redrawAxisCharacters=function(){var t=this.dom,e=t.axis;if(!e.characterMinor){var i=document.createTextNode("0"),n=document.createElement("DIV");n.className="timeline-axis-text timeline-axis-text-minor",n.appendChild(i),n.style.position="absolute",n.style.visibility="hidden",n.style.paddingLeft="0px",n.style.paddingRight="0px",e.frame.appendChild(n),e.characterMinor=n}if(!e.characterMajor){var i=document.createTextNode("0"),s=document.createElement("DIV");s.className="timeline-axis-text timeline-axis-text-major",s.appendChild(i),s.style.position="absolute",s.style.visibility="hidden",s.style.paddingLeft="0px",s.style.paddingRight="0px",e.frame.appendChild(s),e.characterMajor=s}},t.prototype.redrawAxisStartOverwriting=function(){var t=this.size.axis.properties;t.minorTextNum=0,t.minorLineNum=0,t.majorTextNum=0,t.majorLineNum=0},t.prototype.redrawAxisEndOverwriting=function(){for(var t=this.dom,e=this.size.axis.properties,i=this.dom.axis.frame,n=t.axis.minorTexts,s=e.minorTextNum;n.length>s;){var r=n[s];
394
+ i.removeChild(r),n.splice(s,1)}for(var o=t.axis.minorLines,s=e.minorLineNum;o.length>s;){var a=o[s];i.removeChild(a),o.splice(s,1)}for(var l=t.axis.majorTexts,s=e.majorTextNum;l.length>s;){var h=l[s];i.removeChild(h),l.splice(s,1)}for(var c=t.axis.majorLines,s=e.majorLineNum;c.length>s;){var u=c[s];i.removeChild(u),c.splice(s,1)}},t.prototype.redrawAxisHorizontal=function(){var t=this.dom.axis,e=this.size;if(!t.backgroundLine){var i=document.createElement("DIV");i.className="timeline-axis",i.style.position="absolute",i.style.left="0px",i.style.width="100%",i.style.border="none",t.frame.insertBefore(i,t.frame.firstChild),t.backgroundLine=i}if(t.backgroundLine.style.top=e.axis.top+"px",t.backgroundLine.style.height=e.axis.height+"px",t.line){var n=t.frame.removeChild(t.line);t.frame.appendChild(n)}else{var n=document.createElement("DIV");n.className="timeline-axis",n.style.position="absolute",n.style.left="0px",n.style.width="100%",n.style.height="0px",t.frame.appendChild(n),t.line=n}t.line.style.top=e.axis.line+"px"},t.prototype.redrawAxisMinorText=function(t,e){var i,n=this.size,s=this.dom,r=n.axis.properties,o=s.axis.frame,a=s.axis.minorTexts,l=r.minorTextNum;if(l<a.length)i=a[l];else{var h=document.createTextNode(""),i=document.createElement("DIV");i.appendChild(h),i.className="timeline-axis-text timeline-axis-text-minor",i.style.position="absolute",o.appendChild(i),a.push(i)}i.childNodes[0].nodeValue=e,i.style.left=t+"px",i.style.top=n.axis.labelMinorTop+"px",r.minorTextNum++},t.prototype.redrawAxisMinorLine=function(t){var e,i=this.size.axis,n=this.dom,s=i.properties,r=n.axis.frame,o=n.axis.minorLines,a=s.minorLineNum;a<o.length?e=o[a]:(e=document.createElement("DIV"),e.className="timeline-axis-grid timeline-axis-grid-minor",e.style.position="absolute",e.style.width="0px",r.appendChild(e),o.push(e)),e.style.top=i.lineMinorTop+"px",e.style.height=i.lineMinorHeight+"px",e.style.left=t-i.lineMinorWidth/2+"px",s.minorLineNum++},t.prototype.redrawAxisMajorText=function(t,e){var i,n=this.size,s=n.axis.properties,r=this.dom.axis.frame,o=this.dom.axis.majorTexts,a=s.majorTextNum;if(a<o.length)i=o[a];else{var l=document.createTextNode(e);i=document.createElement("DIV"),i.className="timeline-axis-text timeline-axis-text-major",i.appendChild(l),i.style.position="absolute",i.style.top="0px",r.appendChild(i),o.push(i)}i.childNodes[0].nodeValue=e,i.style.top=n.axis.labelMajorTop+"px",i.style.left=t+"px",s.majorTextNum++},t.prototype.redrawAxisMajorLine=function(t){var e,i=this.size,n=i.axis.properties,s=this.size.axis,r=this.dom.axis.frame,o=this.dom.axis.majorLines,a=n.majorLineNum;if(a<o.length)var e=o[a];else e=document.createElement("DIV"),e.className="timeline-axis-grid timeline-axis-grid-major",e.style.position="absolute",e.style.top="0px",e.style.width="0px",r.appendChild(e),o.push(e);e.style.left=t-s.lineMajorWidth/2+"px",e.style.height=i.frameHeight+"px",n.majorLineNum++},t.prototype.redrawItems=function(){var t=this.dom,e=this.options,i=e.box&&e.box.align?e.box.align:void 0;size=this.size,contentWidth=size.contentWidth,items=this.items,t.items||(t.items={});var n=t.items.frame;n||(n=document.createElement("DIV"),n.style.position="relative",t.content.appendChild(n),t.items.frame=n),n.style.left="0px",n.style.top=size.items.top+"px",n.style.height=size.frameHeight-size.axis.height+"px";var s=t.items.ranges;s||(s=[],t.items.ranges=s);var r=t.items.boxes;r||(r=[],t.items.boxes=r);var o=t.items.dots;if(o||(o=[],t.items.dots=o),t.content.removeChild(n),size.dataChanged){for(var a=s.length,l=r.length,h=o.length,c=(items.length,0),u=0,d=0,p=0,f=items.length;f>p;p++){var m=items[p];switch(m.type){case"range":if(a>c){var g=s[c];g.firstChild.innerHTML=m.content,g.style.display="",m.dom=g,c++}else{var g=this.createEventRange(m.content,m.groupId,m.id);s[c]=g,n.appendChild(g),m.dom=g,c++,a++}break;case"box":if(l>u){var g=r[u];g.firstChild.innerHTML=m.content,g.style.display="",m.dom=g,u++}else{var g=this.createEventBox(m.content);r[u]=g,n.appendChild(g),n.insertBefore(g.line,n.firstChild),n.appendChild(g.dot),m.dom=g,u++,l++}break;case"dot":if(h>d){var g=o[d];g.firstChild.innerHTML=m.content,g.style.display="",m.dom=g,d++}else{var g=this.createEventDot(m.content);o[d]=g,n.appendChild(g),m.dom=g,d++,h++}}}for(var p=c;a>p;p++)n.removeChild(s[p]);s.splice(c,a-c);for(var p=u;l>p;p++){var v=r[p];n.removeChild(v.line),n.removeChild(v.dot),n.removeChild(v)}r.splice(u,l-u);for(var p=d;h>p;p++)n.removeChild(o[p]);o.splice(d,h-d)}for(var p=0,f=items.length;f>p;p++){var m=items[p],g=m.dom;switch(m.type){case"range":var y=this.timeToScreen(m.start),b=this.timeToScreen(m.end);-contentWidth>y&&(y=-contentWidth),b>2*contentWidth&&(b=2*contentWidth);var x=b>-contentWidth&&2*contentWidth>y;x||size.dataChanged?(m.hidden&&(m.hidden=!1,g.style.display=""),g.style.top=m.top+"px",g.style.left=y+"px",g.style.width=Math.max(b-y,1)+"px"):m.hidden||(g.style.display="none",m.hidden=!0);break;case"box":var y=this.timeToScreen(m.start),w=e.axisOnTop,k=(size.axis.height,size.axis.top),x=y+m.width/2>-contentWidth&&y-m.width/2<2*contentWidth;if(x||size.dataChanged){m.hidden&&(m.hidden=!1,g.style.display="",g.line.style.display="",g.dot.style.display=""),g.style.top=m.top+"px",g.style.left="right"==i?y-m.width+"px":"left"==i?y+"px":y-m.width/2+"px";var _=g.line;_.style.left=y-m.lineWidth/2+"px",w?(_.style.top="0px",_.style.height=Math.max(m.top,0)+"px"):(_.style.top=m.top+m.height+"px",_.style.height=Math.max(k-m.top-m.height,0)+"px");var C=g.dot;C.style.left=y-m.dotWidth/2+"px",C.style.top=k-m.dotHeight/2+"px"}else m.hidden||(g.style.display="none",g.line.style.display="none",g.dot.style.display="none",m.hidden=!0);break;case"dot":var y=this.timeToScreen(m.start),w=e.axisOnTop,k=(size.axis.height,size.axis.top),x=y+m.width>-contentWidth&&2*contentWidth>y;x||size.dataChanged?(m.hidden&&(m.hidden=!1,g.style.display=""),g.style.top=m.top+"px",g.style.left=y-m.dotWidth/2+"px",g.content.style.marginLeft=1.5*m.dotWidth+"px",g.dot.style.top=(m.height-m.dotHeight)/2+"px"):m.hidden||(g.style.display="none",m.hidden=!0)}}if(this.selection){var m=this.selection.item;n.removeChild(m),n.appendChild(m)}t.content.appendChild(n)},t.prototype.createEventBox=function(t){var e=document.createElement("DIV");e.style.position="absolute",e.style.left="0px",e.style.top="0px",e.className="timeline-event timeline-event-box";var i=document.createElement("DIV");i.className="timeline-event-content",i.innerHTML=t,e.appendChild(i);var n=document.createElement("DIV");n.style.position="absolute",n.style.width="0px",n.className="timeline-event timeline-event-line",e.line=n;var s=document.createElement("DIV");return s.style.position="absolute",s.style.width="0px",s.style.height="0px",s.className="timeline-event timeline-event-dot",e.dot=s,e},t.prototype.createEventDot=function(t){var e=document.createElement("DIV");e.style.position="absolute";var i=document.createElement("DIV");i.className="timeline-event-content",i.innerHTML=t,e.appendChild(i);var n=document.createElement("DIV");return n.style.position="absolute",n.className="timeline-event timeline-event-dot",n.style.width="0px",n.style.height="0px",e.appendChild(n),e.content=i,e.dot=n,e},t.prototype.createEventRange=function(t,e,i){var n=document.createElement("DIV"),s=e?" timeline-group-"+e:"",r=i?" timeline-event-"+i:"";n.style.position="absolute",n.className="timeline-event timeline-event-range"+s+r;var o=document.createElement("DIV");return o.className="timeline-event-content",o.innerHTML=t,n.appendChild(o),n},t.prototype.redrawGroups=function(){var t=this.dom,e=this.options,i=this.size,n=this.groups;void 0===t.groups&&(t.groups={});var s=t.groups.labels;s||(s=[],t.groups.labels=s);var r=t.groups.labelLines;r||(r=[],t.groups.labelLines=r);var o=t.groups.itemLines;o||(o=[],t.groups.itemLines=o);var a=t.groups.frame;if(!a){var a=document.createElement("DIV");a.className="timeline-groups-axis",a.style.position="absolute",a.style.overflow="hidden",a.style.top="0px",a.style.height="100%",t.frame.appendChild(a),t.groups.frame=a}if(a.style.left=i.groupsLeft+"px",a.style.width=void 0!==e.groupsWidth?e.groupsWidth:i.groupsWidth+"px",a.style.display=0==n.length?"none":"",i.dataChanged){for(var l=s.length,h=n.length,c=0,u=Math.min(l,h);u>c;c++){var d=n[c],p=s[c];p.innerHTML=d.content,p.style.display=""}for(var c=l;h>c;c++){var d=n[c],p=document.createElement("DIV");p.className="timeline-groups-text",p.style.position="absolute",void 0===e.groupsWidth&&(p.style.whiteSpace="nowrap"),p.innerHTML=d.content,a.appendChild(p),s[c]=p;var f=document.createElement("DIV");f.className="timeline-axis-grid timeline-axis-grid-minor",f.style.position="absolute",f.style.left="0px",f.style.width="100%",f.style.height="0px",f.style.borderTopStyle="solid",a.appendChild(f),r[c]=f;var m=document.createElement("DIV");m.className="timeline-axis-grid timeline-axis-grid-minor",m.style.position="absolute",m.style.left="0px",m.style.width="100%",m.style.height="0px",m.style.borderTopStyle="solid",t.content.insertBefore(m,t.content.firstChild),o[c]=m}for(var c=h;l>c;c++){var p=s[c],f=r[c],m=o[c];a.removeChild(p),a.removeChild(f),t.content.removeChild(m)}s.splice(h,l-h),r.splice(h,l-h),o.splice(h,l-h),a.style.borderStyle=e.groupsOnRight?"none none none solid":"none solid none none"}for(var c=0,u=n.length;u>c;c++){var d=n[c],p=s[c],f=r[c],m=o[c];p.style.top=d.labelTop+"px",f.style.top=d.lineTop+"px",m.style.top=d.lineTop+"px",m.style.width=i.contentWidth+"px"}if(!t.groups.background){var g=document.createElement("DIV");g.className="timeline-axis",g.style.position="absolute",g.style.left="0px",g.style.width="100%",g.style.border="none",a.appendChild(g),t.groups.background=g}if(t.groups.background.style.top=i.axis.top+"px",t.groups.background.style.height=i.axis.height+"px",!t.groups.line){var v=document.createElement("DIV");v.className="timeline-axis",v.style.position="absolute",v.style.left="0px",v.style.width="100%",v.style.height="0px",a.appendChild(v),t.groups.line=v}t.groups.line.style.top=i.axis.line+"px"},t.prototype.redrawCurrentTime=function(){var t=this.options,e=this.dom,i=this.size;if(!t.showCurrentTime)return e.currentTime&&(e.contentTimelines.removeChild(e.currentTime),delete e.currentTime),void 0;if(!e.currentTime){var n=document.createElement("DIV");n.className="timeline-currenttime",n.style.position="absolute",n.style.top="0px",n.style.height="100%",e.contentTimelines.appendChild(n),e.currentTime=n}var s=new Date,r=new Date(s.getTime()+this.clientTimeOffset),o=this.timeToScreen(r),a=o>-i.contentWidth&&o<2*i.contentWidth;e.currentTime.style.display=a?"":"none",e.currentTime.style.left=o+"px",e.currentTime.title="Current time: "+r,void 0!=this.currentTimeTimer&&(clearTimeout(this.currentTimeTimer),delete this.currentTimeTimer);var l=this,h=function(){l.redrawCurrentTime()},c=1/this.conversion.factor/2;30>c&&(c=30),this.currentTimeTimer=setTimeout(h,c)},t.prototype.redrawCustomTime=function(){var t=this.options,e=this.dom,i=this.size;if(!t.showCustomTime)return e.customTime&&(e.contentTimelines.removeChild(e.customTime),delete e.customTime),void 0;if(!e.customTime){var n=document.createElement("DIV");n.className="timeline-customtime",n.style.position="absolute",n.style.top="0px",n.style.height="100%";var s=document.createElement("DIV");s.style.position="relative",s.style.top="0px",s.style.left="-10px",s.style.height="100%",s.style.width="20px",n.appendChild(s),e.contentTimelines.appendChild(n),e.customTime=n,this.customTime=new Date}var r=this.timeToScreen(this.customTime),o=r>-i.contentWidth&&r<2*i.contentWidth;e.customTime.style.display=o?"":"none",e.customTime.style.left=r+"px",e.customTime.title="Time: "+this.customTime},t.prototype.redrawDeleteButton=function(){var t=this.options,e=this.dom,i=this.size,n=e.items.frame;if(t.editable){var s=e.items.deleteButton;if(s||(s=document.createElement("DIV"),s.className="timeline-navigation-delete",s.style.position="absolute",n.appendChild(s),e.items.deleteButton=s),this.selection){var r,o=this.selection.index,a=this.items[o],l=(this.selection.item,a.top);switch(a.type){case"range":r=this.timeToScreen(a.end);break;case"box":r=this.timeToScreen(a.start)+a.width/2;break;case"dot":r=this.timeToScreen(a.start)+a.width}r<-i.contentWidth&&(r=-i.contentWidth),r>2*i.contentWidth&&(r=2*i.contentWidth),s.style.left=r+"px",s.style.top=l+"px",s.style.display="",n.removeChild(s),n.appendChild(s)}else s.style.display="none"}},t.prototype.redrawDragAreas=function(){var t=this.options,e=this.dom,i=(this.size,this.dom.items.frame);if(t.editable){var n=e.items.dragLeft;n||(n=document.createElement("DIV"),n.style.width=t.dragAreaWidth+"px",n.style.position="absolute",n.style.cursor="w-resize",i.appendChild(n),e.items.dragLeft=n);var s=e.items.dragRight;if(s||(s=document.createElement("DIV"),s.style.width=t.dragAreaWidth+"px",s.style.position="absolute",s.style.cursor="e-resize",i.appendChild(s),e.items.dragRight=s),this.selection){var r=this.selection.index,o=this.items[r];if("range"==o.type){var a=(o.dom,this.timeToScreen(o.start)),l=this.timeToScreen(o.end),h=o.top,c=o.height;n.style.left=a+"px",n.style.top=h+"px",n.style.height=c+"px",n.style.display="",i.removeChild(n),i.appendChild(n),s.style.left=l-t.dragAreaWidth+"px",s.style.top=h+"px",s.style.height=c+"px",s.style.display="",i.removeChild(s),i.appendChild(s)}}else n.style.display="none",s.style.display="none"}},t.prototype.redrawNavigation=function(){var e=this,i=this.options,n=this.dom,s=n.frame,r=n.navBar;if(!r){if((i.editable||i.showNavigation)&&(r=document.createElement("DIV"),r.style.position="absolute",r.className="timeline-navigation btn-group",i.groupsOnRight?r.style.left="10px":r.style.right="10px",i.axisOnTop?r.style.bottom="10px":r.style.top="10px",n.navBar=r,s.appendChild(r)),i.editable&&i.showButtonAdd){r.addButton=document.createElement("DIV"),r.addButton.className="timeline-navigation-new",r.addButton.title="Create new event";var o=function(n){t.preventDefault(n),t.stopPropagation(n);var s=e.size.contentWidth,r=s/2,o=e.screenToTime(r-s/10),a=e.screenToTime(r+s/10);i.snapEvents&&(e.step.snap(o),e.step.snap(a));var l="New",h=e.groups.length?e.groups[0].content:void 0;e.addItem({start:o,end:a,content:l,group:h});var c=e.items.length-1;e.selectItem(c),e.applyAdd=!0,e.trigger("add"),e.applyAdd||e.deleteItem(c),e.redrawDeleteButton(),e.redrawDragAreas()};t.addEventListener(r.addButton,"mousedown",o),r.appendChild(r.addButton)}if(i.editable&&i.showButtonAdd&&i.showNavigation&&(r.addButton.style.borderRightWidth="1px",r.addButton.style.borderRightStyle="solid"),i.showNavigation){r.zoomInButton=document.createElement("BUTTON"),r.zoomInButtonIcon=document.createElement("I"),r.zoomInButton.className="timeline-navigation-zoom-in btn btn-inverse",r.zoomInButtonIcon.className="icon-zoom-in",r.zoomInButton.title="Zoom in";var a=function(i){t.preventDefault(i),t.stopPropagation(i),e.zoom(.4),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.zoomInButton,"mousedown",a),r.zoomInButton.appendChild(r.zoomInButtonIcon),r.appendChild(r.zoomInButton),r.zoomOutButton=document.createElement("BUTTON"),r.zoomOutButtonIcon=document.createElement("I"),r.zoomOutButton.className="timeline-navigation-zoom-out btn btn-inverse",r.zoomOutButtonIcon.className="icon-zoom-out",r.zoomOutButton.title="Zoom out";var l=function(i){t.preventDefault(i),t.stopPropagation(i),e.zoom(-.4),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.zoomOutButton,"mousedown",l),r.zoomOutButton.appendChild(r.zoomOutButtonIcon),r.appendChild(r.zoomOutButton),r.moveLeftButton=document.createElement("BUTTON"),r.moveLeftButtonIcon=document.createElement("I"),r.moveLeftButton.className="timeline-navigation-move-left btn btn-inverse",r.moveLeftButtonIcon.className="icon-chevron-left",r.moveLeftButton.title="Move left";var h=function(i){t.preventDefault(i),t.stopPropagation(i),e.move(-.2),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.moveLeftButton,"mousedown",h),r.moveLeftButton.appendChild(r.moveLeftButtonIcon),r.appendChild(r.moveLeftButton),r.moveRightButton=document.createElement("BUTTON"),r.moveRightButtonIcon=document.createElement("I"),r.moveRightButton.className="timeline-navigation-move-right btn btn-inverse",r.moveRightButtonIcon.className="icon-chevron-right",r.moveRightButton.title="Move right";var c=function(i){t.preventDefault(i),t.stopPropagation(i),e.move(.2),e.trigger("rangechange"),e.trigger("rangechanged")};t.addEventListener(r.moveRightButton,"mousedown",c),r.moveRightButton.appendChild(r.moveRightButtonIcon),r.appendChild(r.moveRightButton)}}},t.prototype.setCurrentTime=function(t){var e=new Date;this.clientTimeOffset=t.getTime()-e.getTime(),this.redrawCurrentTime()},t.prototype.getCurrentTime=function(){var t=new Date;return new Date(t.getTime()+this.clientTimeOffset)},t.prototype.setCustomTime=function(t){this.customTime=new Date(t),this.redrawCustomTime()},t.prototype.getCustomTime=function(){return new Date(this.customTime)},t.prototype.setScale=function(t,e){this.step.setScale(t,e),this.redrawFrame()},t.prototype.setAutoScale=function(t){this.step.setAutoScale(t),this.redrawFrame()},t.prototype.redraw=function(){this.setData(this.data)},t.prototype.checkResize=function(){var t=this.recalcSize();t&&this.redrawFrame()},t.filterImageUrls=function(e,i){for(var n=e.firstChild;n;){if("IMG"==n.tagName){var s=n.src;-1==i.indexOf(s)&&i.push(s)}t.filterImageUrls(n,i),n=n.nextSibling}},t.prototype.recalcSize=function(){var e=!1,i=this;if(size=this.size,options=this.options,axisOnTop=options.axisOnTop,dom=this.dom,axis=dom.axis,groups=this.groups,labels=dom.groups.labels,items=this.items,groupsWidth=size.groupsWidth,characterMinorWidth=axis.characterMinor?axis.characterMinor.clientWidth:0,characterMinorHeight=axis.characterMinor?axis.characterMinor.clientHeight:0,characterMajorWidth=axis.characterMajor?axis.characterMajor.clientWidth:0,characterMajorHeight=axis.characterMajor?axis.characterMajor.clientHeight:0,axisHeight=characterMinorHeight+(options.showMajorLabels?characterMajorHeight:0),actualHeight=size.actualHeight||axisHeight,size.dataChanged){for(var n=[],s=0,r=items.length;r>s;s++){var o=items[s],a=o.dom;a&&t.filterImageUrls(a,n)}if(n.length)for(var s=0;s<n.length;s++){var l=n[s],h=function(){i.redraw()},c=!1;t.imageloader.load(l,h,c)}}if(size.dataChanged){groupsWidth=0;for(var s=0,r=labels.length;r>s;s++){var u=groups[s];u.width=labels[s].clientWidth,u.height=labels[s].clientHeight,u.labelHeight=u.height,groupsWidth=Math.max(groupsWidth,u.width)}for(var s=0,r=items.length;r>s;s++){var o=items[s],a=o.dom,u=o.group,d=a?a.clientWidth:0,p=a?a.clientHeight:0;switch(e=e||o.width!=d,e=e||o.height!=p,o.width=d,o.height=p,o.type){case"range":break;case"box":o.dotHeight=a.dot.offsetHeight,o.dotWidth=a.dot.offsetWidth,o.lineWidth=a.line.offsetWidth;break;case"dot":o.dotHeight=a.dot.offsetHeight,o.dotWidth=a.dot.offsetWidth,o.contentHeight=a.content.offsetHeight}u&&(u.height=u.height?Math.max(u.height,o.height):o.height)}actualHeight=axisHeight+2*options.eventMarginAxis;for(var s=0,r=groups.length;r>s;s++)actualHeight+=groups[s].height+options.eventMargin}if(0==groups.length&&options.autoHeight){var f=0,m=0;if(this.animation&&this.animation.finalItems){var g=this.animation.finalItems,v=g[0];v&&v.top&&(f=v.top,m=v.top+v.height);for(var s=1,r=g.length;r>s;s++)v=g[s],f=Math.min(f,v.top),m=Math.max(m,v.top+v.height)}else{var o=items[0];o&&o.top&&(f=o.top,m=o.top+o.height);for(var s=1,r=items.length;r>s;s++){var o=items[s];o.top&&(f=Math.min(f,o.top),m=Math.max(m,o.top+o.height))}}if(actualHeight=m-f+2*options.eventMarginAxis+axisHeight,size.actualHeight!=actualHeight&&options.autoHeight&&!options.axisOnTop){var y=actualHeight-size.actualHeight;if(this.animation&&this.animation.finalItems)for(var g=this.animation.finalItems,s=0,r=g.length;r>s;s++)g[s].top+=y,g[s].item.top+=y;else for(var s=0,r=items.length;r>s;s++)items[s].top+=y}}var b=dom.frame?dom.frame.offsetWidth:0,x=Math.max(options.autoHeight?actualHeight:dom.frame?dom.frame.clientHeight:0,options.minHeight),w=axisOnTop?0:x-axisHeight,k=axisOnTop?axisHeight:w,_=axisOnTop?axisHeight:0,C=Math.max(x-axisHeight,0);void 0!==options.groupsWidth&&(groupsWidth=dom.groups.frame?dom.groups.frame.clientWidth:0);var D=options.groupsOnRight?b-groupsWidth:0;if(size.dataChanged){for(var M=options.eventMargin,S=axisOnTop?options.eventMarginAxis+M/2:C-options.eventMarginAxis+M/2,s=0,r=groups.length;r>s;s++){var u=groups[s];axisOnTop?(u.top=S,u.labelTop=S+axisHeight+(u.height-u.labelHeight)/2,u.lineTop=S+axisHeight+u.height+M/2,S+=u.height+M):(S-=u.height+M,u.top=S,u.labelTop=S+(u.height-u.labelHeight)/2,u.lineTop=S-M/2)}for(var s=0,r=items.length;r>s;s++){var o=items[s],u=o.group;u&&(o.top=u.top)}e=!0}return e=e||size.groupsWidth!==groupsWidth,e=e||size.groupsLeft!==D,e=e||size.actualHeight!==actualHeight,size.groupsWidth=groupsWidth,size.groupsLeft=D,size.actualHeight=actualHeight,e=e||size.frameWidth!==b,e=e||size.frameHeight!==x,size.frameWidth=b,size.frameHeight=x,e=e||size.groupsWidth!==groupsWidth,size.groupsWidth=groupsWidth,size.contentLeft=options.groupsOnRight?0:groupsWidth,size.contentWidth=Math.max(b-groupsWidth,0),size.contentHeight=C,e=e||size.axis.top!==w,e=e||size.axis.line!==k,e=e||size.axis.height!==axisHeight,e=e||size.items.top!==_,size.axis.top=w,size.axis.line=k,size.axis.height=axisHeight,size.axis.labelMajorTop=options.axisOnTop?0:k+characterMinorHeight,size.axis.labelMinorTop=options.axisOnTop?options.showMajorLabels?characterMajorHeight:0:k,size.axis.lineMinorTop=options.axisOnTop?size.axis.labelMinorTop:0,size.axis.lineMinorHeight=options.showMajorLabels?x-characterMajorHeight:x,size.axis.lineMinorWidth=dom.axis.minorLines.length?dom.axis.minorLines[0].offsetWidth:1,size.axis.lineMajorWidth=dom.axis.majorLines.length?dom.axis.majorLines[0].offsetWidth:1,size.items.top=_,e=e||size.axis.characterMinorWidth!==characterMinorWidth,e=e||size.axis.characterMinorHeight!==characterMinorHeight,e=e||size.axis.characterMajorWidth!==characterMajorWidth,e=e||size.axis.characterMajorHeight!==characterMajorHeight,size.axis.characterMinorWidth=characterMinorWidth,size.axis.characterMinorHeight=characterMinorHeight,size.axis.characterMajorWidth=characterMajorWidth,size.axis.characterMajorHeight=characterMajorHeight,this.recalcConversion(),e},t.prototype.recalcConversion=function(){this.conversion.offset=parseFloat(this.start.valueOf()),this.conversion.factor=parseFloat(this.size.contentWidth)/parseFloat(this.end.valueOf()-this.start.valueOf())},t.prototype.screenToTime=function(t){var e=this.conversion,i=new Date(parseFloat(t)/e.factor+e.offset);return i},t.prototype.timeToScreen=function(t){var e=this.conversion,i=(t.valueOf()-e.offset)*e.factor;return i},t.prototype.onTouchStart=function(e){var i=this.eventParams,n=(this.dom,this);i.touchDown||(i.touchDown=!0,i.zoomed=!1,this.onMouseDown(e),i.onTouchMove||(i.onTouchMove=function(t){n.onTouchMove(t)},t.addEventListener(document,"touchmove",i.onTouchMove)),i.onTouchEnd||(i.onTouchEnd=function(t){n.onTouchEnd(t)},t.addEventListener(document,"touchend",i.onTouchEnd)))},t.prototype.onTouchMove=function(e){var i=this.eventParams;if(e.scale&&1!==e.scale&&(i.zoomed=!0),i.zoomed){if(this.options.zoomable){i.zoomed=!0;var n=e.scale,s=i.end.valueOf()-i.start.valueOf(),r=s/n,o=r-s,a=new Date(parseInt(i.start.valueOf()-o/2)),l=new Date(parseInt(i.end.valueOf()+o/2));this.setVisibleChartRange(a,l),timeline.trigger("rangechange"),t.preventDefault(e)}}else this.onMouseMove(e)},t.prototype.onTouchEnd=function(e){var i=this.eventParams;i.touchDown=!1,i.zoomed&&timeline.trigger("rangechanged"),i.onTouchMove&&(t.removeEventListener(document,"touchmove",i.onTouchMove),delete i.onTouchMove),i.onTouchEnd&&(t.removeEventListener(document,"touchend",i.onTouchEnd),delete i.onTouchEnd),this.onMouseUp(e)},t.prototype.onMouseDown=function(e){e=e||window.event;var i=this.eventParams,n=this.options,s=this.dom,r=e.which?1==e.which:1==e.button;if(r||i.touchDown){if(this.recalcSize(),i.touchDown?(i.mouseX=e.targetTouches[0].clientX,i.mouseY=e.targetTouches[0].clientY):(i.mouseX=e.clientX,i.mouseY=e.clientY),void 0===i.mouseX&&(i.mouseX=0),void 0===i.mouseY&&(i.mouseY=0),i.frameLeft=t.getAbsoluteLeft(this.dom.content),i.frameTop=t.getAbsoluteTop(this.dom.content),i.previousLeft=0,i.previousOffset=0,i.moved=!1,i.start=new Date(this.start),i.end=new Date(this.end),i.target=t.getTarget(e),i.itemDragLeft=i.target===this.dom.items.dragLeft,i.itemDragRight=i.target===this.dom.items.dragRight,i.itemIndex=i.itemDragLeft||i.itemDragRight?this.selection?this.selection.index:void 0:this.getItemIndex(i.target),i.customTime=i.target===s.customTime||i.target.parentNode===s.customTime?this.customTime:void 0,i.addItem=n.editable&&e.ctrlKey,i.addItem){var o=i.mouseX-i.frameLeft,a=i.mouseY-i.frameTop,l=this.screenToTime(o);n.snapEvents&&this.step.snap(l);var h=new Date(l),c="New",u=this.getGroupFromHeight(a);this.addItem({start:l,end:h,content:c,group:u.content}),i.itemIndex=this.items.length-1,this.selectItem(i.itemIndex),i.itemDragRight=!0}if(i.editItem=n.editable?this.isSelected(i.itemIndex):void 0,i.editItem){var d=this.items[i.itemIndex];i.itemStart=d.start,i.itemEnd=d.end,i.itemType=d.type,"range"==i.itemType?(i.itemLeft=this.timeToScreen(d.start),i.itemRight=this.timeToScreen(d.end)):i.itemLeft=this.timeToScreen(d.start)}else this.dom.frame.style.cursor="move";if(!i.touchDown){var p=this;i.onMouseMove||(i.onMouseMove=function(t){p.onMouseMove(t)},t.addEventListener(document,"mousemove",i.onMouseMove)),i.onMouseUp||(i.onMouseUp=function(t){p.onMouseUp(t)},t.addEventListener(document,"mouseup",i.onMouseUp)),t.preventDefault(e)}}},t.prototype.onMouseMove=function(e){e=e||window.event;var i=this.eventParams,n=this.size,s=this.dom,r=this.options;if(i.touchDown)var o=e.targetTouches[0].clientX,a=e.targetTouches[0].clientY;else var o=e.clientX,a=e.clientY;void 0===o&&(o=0),void 0===a&&(a=0),void 0===i.mouseX&&(i.mouseX=o),void 0===i.mouseY&&(i.mouseY=a);var l=parseFloat(o)-i.mouseX;if(parseFloat(a)-i.mouseY,i.moved=!0,i.customTime){var h=this.timeToScreen(i.customTime),c=h+l;this.customTime=this.screenToTime(c),this.redrawCustomTime(),this.trigger("timechange")}else if(i.editItem){var u,d,p=this.items[i.itemIndex];if(p.dom,i.itemDragLeft?(u=i.itemLeft+l,d=i.itemRight,p.start=this.screenToTime(u),r.snapEvents&&(this.step.snap(p.start),u=this.timeToScreen(p.start)),u>d&&(u=d,p.start=this.screenToTime(u))):i.itemDragRight?(u=i.itemLeft,d=i.itemRight+l,p.end=this.screenToTime(d),r.snapEvents&&(this.step.snap(p.end),d=this.timeToScreen(p.end)),u>d&&(d=u,p.end=this.screenToTime(d))):(u=i.itemLeft+l,p.start=this.screenToTime(u),r.snapEvents&&(this.step.snap(p.start),u=this.timeToScreen(p.start)),p.end&&(d=u+(i.itemRight-i.itemLeft),p.end=this.screenToTime(d))),this.repositionItem(p,u,d),0==this.groups.length)this.stackEvents(r.animate),r.animate||this.redrawFrame();else if(r.groupsChangeable){var f=a-i.frameTop,m=this.getGroupFromHeight(f);if(p.group!==m){var g=this.items.indexOf(p);this.changeItem(g,{group:m.content}),p.top=m.top,this.repositionItem(p)}}this.redrawDeleteButton(),this.redrawDragAreas()}else if(r.moveable){var v=i.end.valueOf()-i.start.valueOf(),y=Math.round(parseFloat(-l)/n.contentWidth*v),b=new Date(i.start.valueOf()+y),x=new Date(i.end.valueOf()+y);this.applyRange(b,x);var w=this.start.valueOf()-b.valueOf();w&&(y+=w),this.recalcConversion();var k=i.previousLeft||0,_=parseFloat(s.items.frame.style.left)||0,C=i.previousOffset||0,D=C+(_-k),M=-y/v*n.contentWidth+D;i.previousOffset=D,i.previousLeft=M,s.items.frame.style.left=M+"px",this.redrawCurrentTime(),this.redrawCustomTime(),this.redrawAxis(),this.trigger("rangechange")}t.preventDefault(e)},t.prototype.onMouseUp=function(e){var i=this.eventParams,n=this.options;if(e=e||window.event,this.dom.frame.style.cursor="auto",i.onMouseMove&&(t.removeEventListener(document,"mousemove",i.onMouseMove),delete i.onMouseMove),i.onMouseUp&&(t.removeEventListener(document,"mouseup",i.onMouseUp),delete i.onMouseUp),i.customTime)this.trigger("timechanged");else if(i.editItem){var s=this.items[i.itemIndex];if(i.moved||i.addItem){if(this.applyChange=!0,this.applyAdd=!0,this.updateData(i.itemIndex,{start:s.start,end:s.end}),this.trigger(i.addItem?"add":"change"),i.addItem)this.applyAdd?this.updateData(i.itemIndex,{start:s.start,end:s.end,content:s.content,group:s.group?s.group.content:void 0}):this.deleteItem(i.itemIndex);else if(this.applyChange)this.updateData(i.itemIndex,{start:s.start,end:s.end});else{delete this.applyChange,delete this.applyAdd;var s=this.items[i.itemIndex];s.dom,s.start=i.itemStart,s.end=i.itemEnd,this.repositionItem(s,i.itemLeft,i.itemRight)}this.recalcSize(),this.stackEvents(n.animate),n.animate||this.redrawFrame(),this.redrawDeleteButton(),this.redrawDragAreas()}}else i.moved||i.zoomed?(this.redrawFrame(),(i.moved&&n.moveable||i.zoomed&&n.zoomable)&&this.trigger("rangechanged")):n.editable&&i.target===this.dom.items.deleteButton?(this.selection&&this.confirmDeleteItem(this.selection.index),this.redrawFrame()):n.selectable&&(void 0!==i.itemIndex?this.isSelected(i.itemIndex)||(this.selectItem(i.itemIndex),this.redrawDeleteButton(),this.redrawDragAreas(),this.trigger("select")):(this.unselectItem(),this.redrawDeleteButton(),this.redrawDragAreas()))},t.prototype.onDblClick=function(e){var i=this.eventParams,n=this.options,s=this.dom,r=this.size;if(e=e||window.event,n.editable){if(void 0!==i.itemIndex)this.trigger("edit");else{var o=e.clientX-t.getAbsoluteLeft(s.content),a=e.clientY-t.getAbsoluteTop(s.content),l=this.screenToTime(o),h=this.screenToTime(o+r.frameWidth/10);n.snapEvents&&(this.step.snap(l),this.step.snap(h));var c="New",u=this.getGroupFromHeight(a);this.addItem({start:l,end:h,content:c,group:u.content}),i.itemIndex=this.items.length-1,this.selectItem(i.itemIndex),this.applyAdd=!0,this.trigger("add"),this.applyAdd||this.deleteItem(i.itemIndex),this.redrawDeleteButton(),this.redrawDragAreas()}t.preventDefault(e)}},t.prototype.onMouseWheel=function(e){if(this.options.zoomable){e||(e=window.event);var i=0;if(e.wheelDelta?i=e.wheelDelta/120:e.detail&&(i=-e.detail/3),i){var n=this,s=function(){n.recalcSize();var s=i/5,r=t.getAbsoluteLeft(n.dom.content),o=void 0!=e.clientX&&void 0!=r?n.screenToTime(e.clientX-r):void 0;n.zoom(s,o),n.trigger("rangechange"),n.trigger("rangechanged")};s()}t.preventDefault(e)}},t.prototype.zoom=function(t,e){void 0==e&&(e=new Date((this.start.valueOf()+this.end.valueOf())/2)),t>=1&&(t=.9),-1>=t&&(t=-.9),0>t&&(t/=1+t);var i=parseFloat(this.start.valueOf()-e.valueOf()),n=parseFloat(this.end.valueOf()-e.valueOf()),s=new Date(this.start.valueOf()-i*t),r=new Date(this.end.valueOf()-n*t);this.applyRange(s,r,e),this.recalcSize();var o=this.options.animate?this.options.animateZoom:!1;this.stackEvents(o),(!o||this.groups.length>0)&&this.redrawFrame()},t.prototype.move=function(t){var e=parseFloat(this.end.valueOf()-this.start.valueOf()),i=new Date(this.start.valueOf()+e*t),n=new Date(this.end.valueOf()+e*t);this.applyRange(i,n),this.recalcConversion(),this.redrawFrame()},t.prototype.repositionItem=function(t,e,i){var n=t.dom;switch(t.type){case"range":n.style.left=e+"px",n.style.width=Math.max(i-e,1)+"px";break;case"box":n.style.left=e-t.width/2+"px",n.line.style.left=e-t.lineWidth/2+"px",n.dot.style.left=e-t.dotWidth/2+"px";break;case"dot":n.style.left=e-t.dotWidth/2+"px"}this.groups.length>0&&(n.style.top=t.top+"px")},t.prototype.applyRange=function(t,e,i){var n=t.valueOf(),s=e.valueOf(),r=s-n,o=this.options,a=31536e6,l=Number(o.intervalMin)||10;10>l&&(l=10);var h=Number(o.intervalMax)||1e4*a;h>1e4*a&&(h=1e4*a),l>h&&(h=l);var c=o.min?o.min.valueOf():void 0,u=o.max?o.max.valueOf():void 0;if(c&&u){if(c>=u){var d=864e5;u=c+d}h>u-c&&(h=u-c),l>u-c&&(l=u-c)}if(n>=s&&(s+=864e5),l>r){var p=l-r,f=i?(i.valueOf()-n)/r:.5;n-=Math.round(p*f),s+=Math.round(p*(1-f))}if(r>h){var p=r-h,f=i?(i.valueOf()-n)/r:.5;
395
+ n+=Math.round(p*f),s-=Math.round(p*(1-f))}if(c){var p=n-c;0>p&&(n-=p,s-=p)}if(u){var p=u-s;0>p&&(n+=p,s+=p)}this.start=new Date(n),this.end=new Date(s)},t.prototype.confirmDeleteItem=function(t){this.applyDelete=!0,this.isSelected(t)||this.selectItem(t),this.trigger("delete"),this.applyDelete&&this.deleteItem(t),delete this.applyDelete},t.prototype.deleteItem=function(e){if(e>=this.items.length)throw"Cannot delete row, index out of range";if(this.unselectItem(),this.items.splice(e,1),this.data){if(!t.isArray(this.data))throw"Cannot delete row from data, unknown data type";this.data.splice(e,1)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(this.options.animate),this.options.animate||this.redrawFrame(),this.size.dataChanged=!1},t.prototype.deleteAllItems=function(){if(this.unselectItem(),this.items=[],this.deleteGroups(),this.data){if(!t.isArray(this.data))throw"Cannot delete row from data, unknown data type";this.data.splice(0,this.data.length)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(this.options.animate),this.options.animate||this.redrawFrame(),this.size.dataChanged=!1},t.prototype.getGroupFromHeight=function(t){var e=this.groups,i=this.options,n=this.size,s=t-(i.axisOnTop?n.axis.height:0);if(e){for(var r,o=e.length-1;o>=0;o--)if(r=e[o],s>r.top)return r;return r}return void 0},t.prototype.getItem=function(t){if(t>=this.items.length)throw"Cannot get item, index out of range";var e=this.items[t],i={};return i.start=new Date(e.start),e.end&&(i.end=new Date(e.end)),i.content=e.content,e.group&&(i.group=e.group.content),i},t.prototype.addItem=function(t){var e=[t];this.addItems(e)},t.prototype.addItems=function(t){var e=t,i=this.items;this.groups,this.groupIndexes;for(var n=0,s=e.length;s>n;n++){var r=t[n];this.addGroup(r.group),i.push(this.createItem(r));var o=i.length-1;this.updateData(o,r)}this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(!1),this.redrawFrame(),this.size.dataChanged=!1},t.prototype.createItem=function(t){var e={id:t.id,groupId:t.jobId,status:t.status,start:t.start,end:t.end,content:t.content,type:t.end?"range":this.options.style,group:this.findGroup(t.group),top:0,left:0,width:0,height:0,lineWidth:0,dotWidth:0,dotHeight:0};return e},t.prototype.changeItem=function(t,e){if(t>=this.items.length)throw"Cannot change item, index out of range";this.options.style;var i=this.items[t];e.start&&(i.start=e.start),e.end&&(i.end=e.end),e.content&&(i.content=e.content),e.group&&(i.group=this.addGroup(e.group)),this.updateData(t,e),this.size.dataChanged=!0,this.redrawFrame(),this.recalcSize(),this.stackEvents(!1),this.redrawFrame(),this.size.dataChanged=!1},t.prototype.findGroup=function(t){var e=this.groupIndexes[t];return void 0!=e?this.groups[e]:void 0},t.prototype.deleteGroups=function(){this.groups=[],this.groupIndexes={}},t.prototype.addGroup=function(t){var e=this.groups,i=this.groupIndexes,n=void 0,s=i[t];if(void 0===s&&void 0!==t){n={content:t,labelTop:0,lineTop:0},e.push(n),this.options.axisOnTop?e.sort(function(t,e){return t.content>e.content}):e.sort(function(t,e){return t.content<e.content});for(var r=0,o=e.length;o>r;r++)i[e[r].content]=r}else n=e[s];return n},t.prototype.cancelChange=function(){this.applyChange=!1},t.prototype.cancelDelete=function(){this.applyDelete=!1},t.prototype.cancelAdd=function(){this.applyAdd=!1},t.prototype.setSelection=function(t){if(void 0!=t&&t.length>0){if(void 0!=t[0].row){var e=t[0].row;if(this.items[e]){var i=this.items[e];this.selectItem(e);var n=i.start,s=i.end;if(void 0!=s)var r=new Date((s.valueOf()+n.valueOf())/2);else var r=new Date(n);var o=this.end.valueOf()-this.start.valueOf(),a=new Date(r.valueOf()-o/2),l=new Date(r.valueOf()+o/2);return this.setVisibleChartRange(a,l),!0}}}else this.unselectItem();return!1},t.prototype.getSelection=function(){var t=[];return this.selection&&t.push({row:this.selection.index}),t},t.prototype.selectItem=function(t){if(this.unselectItem(),this.selection=void 0,void 0!==this.items[t]){var e=this.items[t],i=e.dom;switch(this.selection={index:t,item:i},this.options.editable&&(i.style.cursor="move"),e.type){case"range":i.className=i.className+" timeline-event-selected";break;case"box":i.className="timeline-event timeline-event-selected timeline-event-box",i.line.className="timeline-event timeline-event-selected timeline-event-line",i.dot.className="timeline-event timeline-event-selected timeline-event-dot";break;case"dot":i.className="timeline-event timeline-event-selected",i.dot.className="timeline-event timeline-event-selected timeline-event-dot"}}},t.prototype.isSelected=function(t){return this.selection&&this.selection.index===t},t.prototype.unselectItem=function(){if(this.selection){var t=this.items[this.selection.index];if(t&&t.dom){var e=t.dom;switch(e.style.cursor="",t.type){case"range":e.className=e.className.replace(" timeline-event-selected","");break;case"box":e.className="timeline-event timeline-event-box",e.line.className="timeline-event timeline-event-line",e.dot.className="timeline-event timeline-event-dot";break;case"dot":e.className="",e.dot.className="timeline-event timeline-event-dot"}}}this.selection=void 0},t.prototype.stackEvents=function(t){if(!(0==this.options.stackEvents||this.groups.length>0)){void 0==t&&(t=!0);var e=this.stackOrder(this.items),i=this.stackCalculateFinal(e,t),n=this.groupOrder(this.items),s=this.groupStackCalculateFinal(n,t);e=n,i=s;var r=this.animation;r||(r={},this.animation=r),r.finalItems=i;var o=this,a=function(){var t=o.stackMoveOneStep(e,r.finalItems);o.recalcSize(),o.redrawFrame(),t?(delete r.finalItems,delete r.timer):r.timer=setTimeout(a,30)};r.timer||(r.timer=setTimeout(a,30))}},t.prototype.stackOrder=function(t){var e=t.concat([]),i=function(t,e){return"range"==t.type&&"range"!=e.type?-1:"range"!=t.type&&"range"==e.type?1:t.left-e.left};return e.sort(i),e},t.prototype.groupOrder=function(t){for(var e=[],i=[],n=t.concat([]),s=[],r=n.length-1;r>=0;r--)"undefined"==typeof e[n[r].groupId]&&(e[n[r].groupId]=[],i.push({groupId:n[r].groupId,content:n[r].content})),e[n[r].groupId].push(n[r]);i.sort(function(t,e){return t.content<e.content?-1:t.content>e.content?1:0});for(var r=0;r<i.length;r++)s.push(e[i[r].groupId]);return s.reverse()},t.prototype.stackCalculateFinal=function(t){for(var e=this.size,i=e.axis.top,n=this.options,s=n.axisOnTop,r=n.eventMargin,o=n.eventMarginAxis,a=[],l=0,h=t.length;h>l;l++){var c,u,d,p,f=t[l],m=f.height,g=f.width;switch(c=s?i+o+r/2:i-m-o-r/2,p=c+m,f.type){case"range":case"dot":u=this.timeToScreen(f.start),d=f.end?this.timeToScreen(f.end):u+g;break;case"box":u=this.timeToScreen(f.start)-g/2,d=u+g}a[l]={left:u,top:c,right:d,bottom:p,height:m,item:f}}for(var l=0,h=a.length;h>l;l++){var v=a[l],y=null;do y=this.stackEventsCheckOverlap(a,l,0,l-1),null!=y&&(v.top=s?y.top+y.height+r:y.top-v.height-r,v.bottom=v.top+v.height);while(y)}return a},t.prototype.groupStackCalculateFinal=function(t){for(var e=this.size,i=e.axis.top,n=this.options,s=n.axisOnTop,r=n.eventMargin,o=n.eventMarginAxis,a=[],l=0;l<t.length;l++)for(var h=t[l],c=0;c<h.length;c++){var u,d,p,f,m=h[c],g=m.height,v=m.width;switch(u=s?i+o+(g+r)*(l+1):i-o-(g+r)*(l+1),f=u+g,m.type){case"range":case"dot":d=this.timeToScreen(m.start),p=m.end?this.timeToScreen(m.end):d+v;break;case"box":d=this.timeToScreen(m.start)-v/2,p=d+v}a.push({left:d,top:u,right:p,bottom:f,height:g,item:m})}return a},t.prototype.stackMoveOneStep=function(t,e){var n=!0;for(i=0,iMax=e.length;iMax>i;i++){var s=e[i],r=s.item,o=parseInt(r.top),a=parseInt(s.top),l=a-o;if(l){var h=a==o?0:a>o?1:-1;Math.abs(l)>4&&(h=l/4);var c=parseInt(o+h);c!=a&&(n=!1),r.top=c,r.bottom=r.top+r.height}else r.top=s.top,r.bottom=s.bottom;r.left=s.left,r.right=s.right}return n},t.prototype.stackMoveToFinal=function(t,e){for(i=0,iMax=t.length;iMax>i;i++){var n=t[i],s=e[i];n.left=s.left,n.top=s.top,n.right=s.right,n.bottom=s.bottom}},t.prototype.stackEventsCheckOverlap=function(t,e,i,n){eventMargin=this.options.eventMargin,collision=this.collision;for(var s=t[e],r=n;r>=i;r--){var o=t[r];if(collision(s,o,eventMargin)&&r!=e)return o}},t.prototype.collision=function(t,e,i){return void 0==i&&(i=0),t.left-i<e.right&&t.right+i>e.left&&t.top-i<e.bottom&&t.bottom+i>e.top},t.prototype.trigger=function(e){var i=null;switch(e){case"rangechange":case"rangechanged":i={start:new Date(this.start),end:new Date(this.end)};break;case"timechange":case"timechanged":i={time:new Date(this.customTime)}}t.events.trigger(this,e,i)},t.events=t.events||{listeners:[],indexOf:function(t){for(var e=this.listeners,i=0,n=this.listeners.length;n>i;i++){var s=e[i];if(s&&s.object==t)return i}return-1},addListener:function(t,e,i){var n=this.indexOf(t),s=this.listeners[n];s||(s={object:t,events:{}},this.listeners.push(s));var r=s.events[e];r||(r=[],s.events[e]=r),-1==r.indexOf(i)&&r.push(i)},removeListener:function(t,e,i){var n=this.indexOf(t),s=this.listeners[n];if(s){var r=s.events[e];if(r){var n=r.indexOf(i);-1!=n&&r.splice(n,1),0==r.length&&delete s.events[e]}var o=0,a=s.events;for(var e in a)a.hasOwnProperty(e)&&o++;0==o&&delete this.listeners[n]}},removeAllListeners:function(){this.listeners=[]},trigger:function(t,e,i){var n=this.indexOf(t),s=this.listeners[n];if(s){var r=s.events[e];if(r)for(var o=0,a=r.length;a>o;o++)r[o](i)}}},t.StepDate=function(e){this.options=e,this.current=this.getDate(),this._start=this.getDate(),this._end=this.getDate(),this.autoScale=!0,this.scale=t.StepDate.SCALE.DAY,this.step=1,this.setRange(e.start,e.end,e.minimumStep)},t.StepDate.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,MONTH:6,YEAR:7},t.StepDate.prototype.getDate=function(t){return this.options.utc?t?new XDate(t,!0):new XDate(!0):t?new XDate(t):new XDate},t.StepDate.prototype.setRange=function(t,e,i){isNaN(t)||isNaN(e)||(this._start=void 0!=t?this.getDate(t):this.getDate(),this._end=void 0!=e?this.getDate(e):this.getDate(),this.autoScale&&this.setMinimumStep(i))},t.StepDate.prototype.start=function(){this.current=this.getDate(this._start),this.roundToMinor()},t.StepDate.prototype.roundToMinor=function(){switch(this.scale){case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step)),this.current.setMonth(0);case t.StepDate.SCALE.MONTH:this.current.setDate(1);case t.StepDate.SCALE.DAY:this.current.setHours(0);case t.StepDate.SCALE.HOUR:this.current.setMinutes(0);case t.StepDate.SCALE.MINUTE:this.current.setSeconds(0);case t.StepDate.SCALE.SECOND:this.current.setMilliseconds(0)}if(1!=this.step)switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case t.StepDate.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case t.StepDate.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case t.StepDate.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case t.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()-1-(this.current.getDate()-1)%this.step+1);break;case t.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step)}},t.StepDate.prototype.end=function(){return this.current.getTime()>this._end.getTime()},t.StepDate.prototype.next=function(){var e=this.current.getTime();if(this.current.getMonth()<6)switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current=this.getDate(this.current.getTime()+this.step,!0);break;case t.StepDate.SCALE.SECOND:this.current=this.getDate(this.current.getTime()+1e3*this.step);break;case t.StepDate.SCALE.MINUTE:this.current=this.getDate(this.current.getTime()+60*1e3*this.step);break;case t.StepDate.SCALE.HOUR:this.current=this.getDate(this.current.getTime()+60*60*1e3*this.step);var i=this.current.getHours();this.current.setHours(i-i%this.step);break;case t.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case t.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}else switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current=this.getDate(this.current.getTime()+this.step);break;case t.StepDate.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case t.StepDate.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()+this.step);break;case t.StepDate.SCALE.HOUR:this.current.setHours(this.current.getHours()+this.step);break;case t.StepDate.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case t.StepDate.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case t.StepDate.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}if(1!=this.step)switch(this.scale){case t.StepDate.SCALE.MILLISECOND:this.current.getMilliseconds()<this.step&&this.current.setMilliseconds(0);break;case t.StepDate.SCALE.SECOND:this.current.getSeconds()<this.step&&this.current.setSeconds(0);break;case t.StepDate.SCALE.MINUTE:this.current.getMinutes()<this.step&&this.current.setMinutes(0);break;case t.StepDate.SCALE.HOUR:this.current.getHours()<this.step&&this.current.setHours(0);break;case t.StepDate.SCALE.DAY:this.current.getDate()<this.step+1&&this.current.setDate(1);break;case t.StepDate.SCALE.MONTH:this.current.getMonth()<this.step&&this.current.setMonth(0);break;case t.StepDate.SCALE.YEAR:}this.current.getTime()==e&&(this.current=this.getDate(this._end))},t.StepDate.prototype.getCurrent=function(){return this.current},t.StepDate.prototype.setScale=function(t,e){this.scale=t,e>0&&(this.step=e),this.autoScale=!1},t.StepDate.prototype.setAutoScale=function(t){this.autoScale=t},t.StepDate.prototype.setMinimumStep=function(e){if(void 0!=e){var i=31104e6,n=2592e6,s=864e5,r=36e5,o=6e4,a=1e3,l=1;1e3*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=1e3),500*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=500),100*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=100),50*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=50),10*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=10),5*i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=5),i>e&&(this.scale=t.StepDate.SCALE.YEAR,this.step=1),3*n>e&&(this.scale=t.StepDate.SCALE.MONTH,this.step=3),n>e&&(this.scale=t.StepDate.SCALE.MONTH,this.step=1),5*s>e&&(this.scale=t.StepDate.SCALE.DAY,this.step=5),2*s>e&&(this.scale=t.StepDate.SCALE.DAY,this.step=2),s>e&&(this.scale=t.StepDate.SCALE.DAY,this.step=1),4*r>e&&(this.scale=t.StepDate.SCALE.HOUR,this.step=4),r>e&&(this.scale=t.StepDate.SCALE.HOUR,this.step=1),15*o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=15),10*o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=10),5*o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=5),o>e&&(this.scale=t.StepDate.SCALE.MINUTE,this.step=1),15*a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=15),10*a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=10),5*a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=5),a>e&&(this.scale=t.StepDate.SCALE.SECOND,this.step=1),200*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=200),100*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=100),50*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=50),10*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=10),5*l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=5),l>e&&(this.scale=t.StepDate.SCALE.MILLISECOND,this.step=1)}},t.StepDate.prototype.snap=function(e){if(this.scale==t.StepDate.SCALE.YEAR){var i=e.getFullYear()+Math.round(e.getMonth()/12);e.setFullYear(Math.round(i/this.step)*this.step),e.setMonth(0),e.setDate(0),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.MONTH)e.getDate()>15?(e.setDate(1),e.setMonth(e.getMonth()+1)):e.setDate(1),e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);else if(this.scale==t.StepDate.SCALE.DAY){switch(this.step){case 5:case 2:e.setHours(24*Math.round(e.getHours()/24));break;default:e.setHours(12*Math.round(e.getHours()/12))}e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.HOUR){switch(this.step){case 4:e.setMinutes(60*Math.round(e.getMinutes()/60));break;default:e.setMinutes(30*Math.round(e.getMinutes()/30))}e.setSeconds(0),e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.MINUTE){switch(this.step){case 15:case 10:e.setMinutes(5*Math.round(e.getMinutes()/5)),e.setSeconds(0);break;case 5:e.setSeconds(60*Math.round(e.getSeconds()/60));break;default:e.setSeconds(30*Math.round(e.getSeconds()/30))}e.setMilliseconds(0)}else if(this.scale==t.StepDate.SCALE.SECOND)switch(this.step){case 15:case 10:e.setSeconds(5*Math.round(e.getSeconds()/5)),e.setMilliseconds(0);break;case 5:e.setMilliseconds(1e3*Math.round(e.getMilliseconds()/1e3));break;default:e.setMilliseconds(500*Math.round(e.getMilliseconds()/500))}else if(this.scale==t.StepDate.SCALE.MILLISECOND){var n=this.step>5?this.step/2:1;e.setMilliseconds(Math.round(e.getMilliseconds()/n)*n)}},t.StepDate.prototype.isMajor=function(){switch(this.scale){case t.StepDate.SCALE.MILLISECOND:return 0==this.current.getMilliseconds();case t.StepDate.SCALE.SECOND:return 0==this.current.getSeconds();case t.StepDate.SCALE.MINUTE:return 0==this.current.getHours()&&0==this.current.getMinutes();case t.StepDate.SCALE.HOUR:return 0==this.current.getHours();case t.StepDate.SCALE.DAY:return 1==this.current.getDate();case t.StepDate.SCALE.MONTH:return 0==this.current.getMonth();case t.StepDate.SCALE.YEAR:return!1;default:return!1}},t.StepDate.prototype.getLabelMinor=function(e){var i=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");switch(void 0==e&&(e=this.current),this.scale){case t.StepDate.SCALE.MILLISECOND:return String(e.getMilliseconds());case t.StepDate.SCALE.SECOND:return String(e.getSeconds());case t.StepDate.SCALE.MINUTE:return this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2);case t.StepDate.SCALE.HOUR:return this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2);case t.StepDate.SCALE.DAY:return String(e.getDate());case t.StepDate.SCALE.MONTH:return i[e.getMonth()];case t.StepDate.SCALE.YEAR:return String(e.getFullYear());default:return""}},t.StepDate.prototype.getLabelMajor=function(e){var i=new Array("January","February","March","April","May","June","July","August","September","October","November","December"),n=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");switch(void 0==e&&(e=this.current),this.scale){case t.StepDate.SCALE.MILLISECOND:return this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2)+":"+this.addZeros(e.getSeconds(),2);case t.StepDate.SCALE.SECOND:return e.getDate()+" "+i[e.getMonth()]+" "+this.addZeros(e.getHours(),2)+":"+this.addZeros(e.getMinutes(),2);case t.StepDate.SCALE.MINUTE:return n[e.getDay()]+" "+e.getDate()+" "+i[e.getMonth()]+" "+e.getFullYear();case t.StepDate.SCALE.HOUR:return n[e.getDay()]+" "+e.getDate()+" "+i[e.getMonth()]+" "+e.getFullYear();case t.StepDate.SCALE.DAY:return i[e.getMonth()]+" "+e.getFullYear();case t.StepDate.SCALE.MONTH:return String(e.getFullYear());default:return""}},t.StepDate.prototype.addZeros=function(t,e){for(var i=""+t;i.length<e;)i="0"+i;return i},t.imageloader=function(){function t(t){if(1==n[t])return!0;var e=new Image;return e.src=t,e.complete?!0:!1}function e(t){return void 0!=s[t]}function i(i,r,o){if(void 0==o&&(o=!0),t(i))return o&&r(i),void 0;if(!e(i)||o){var a=s[i];if(!a){var l=new Image;l.src=i,a=[],s[i]=a,l.onload=function(){n[i]=!0,delete s[i];for(var t=0;t<a.length;t++)a[t](i)}}-1==a.indexOf(r)&&a.push(r)}}var n={},s={};return{isLoaded:t,isLoading:e,load:i}}(),t.addEventListener=function(t,e,i,n){t.addEventListener?(void 0===n&&(n=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.addEventListener(e,i,n)):t.attachEvent("on"+e,i)},t.removeEventListener=function(t,e,i,n){t.removeEventListener?(void 0===n&&(n=!1),"mousewheel"===e&&navigator.userAgent.indexOf("Firefox")>=0&&(e="DOMMouseScroll"),t.removeEventListener(e,i,n)):t.detachEvent("on"+e,i)},t.getTarget=function(t){if(!t)var t=window.event;var e;return t.target?e=t.target:t.srcElement&&(e=t.srcElement),void 0!==e.nodeType&&3==e.nodeType&&(e=e.parentNode),e},t.stopPropagation=function(t){if(!t)var t=window.event;t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},t.preventDefault=function(t){if(!t)var t=window.event;t.preventDefault?t.preventDefault():t.returnValue=!1},t.getAbsoluteLeft=function(t){for(var e=0;null!=t;)e+=t.offsetLeft,e-=t.scrollLeft,t=t.offsetParent;return!document.body.scrollLeft&&window.pageXOffset&&(e-=window.pageXOffset),e},t.getAbsoluteTop=function(t){for(var e=0;null!=t;)e+=t.offsetTop,e-=t.scrollTop,t=t.offsetParent;return!document.body.scrollTop&&window.pageYOffset&&(e-=window.pageYOffset),e},t.isArray=function(t){return t instanceof Array?!0:"[object Array]"===Object.prototype.toString.call(t)},t}),define("view/alerttimeline",["timeline","view/base"],function(t,e){var i=e.extend({events:{"shown .accordion-body":"publishTimelineHeight","hidden .accordion-body":"publishTimelineHeight"},subscriptions:{"view:dashboard:complete":"render"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.dashboardId=t.dashboardId,this.status=t.status,this.popovers=[],this.openPopovers=[],this.alertData=[]},render:function(){this.templar.render({path:"alerttimeline",el:this.$el,data:{}}),this.$timeline=this.$el.find(".alert-timeline .accordion-inner"),this.$accordion=this.$el.find(".alert-timeline .accordion-body")},addPopover:function(){var t=this;jobAlertIdList=_.uniq(t.jobAlertList);for(var e=jobAlertIdList.length-1;e>=0;e--){var i=function(e){var i=$("<div class='timeline-monitor'>"),n=$("<button/>",{text:"Troubleshoot Monitor","class":"btn"}),s=$(".timeline-group-"+e);s.popover({trigger:"manual",html:!0,placement:"bottom",delay:{show:100,hide:200},container:"body",content:i}).click(function(s){s.stopPropagation();var r=$(this);_.each(t.openPopovers,function(t){t.data("popover").tip().removeClass("active"),t.data("popover").hide()}),t.openPopovers=[],r.toggleClass("active").hasClass("active")?(n.off("click"),$("body").off("click"),r.popover("show"),t.showOverlay(i.parent(),"Loading...","alert-data-overlay"),t.loadAlertIncidentData(e,r,i,function(i){var s=t.createMetaTable(i);r.data("popover").tip().find(".alert-meta-data").length>0?r.data("popover").tip().find(".alert-meta-data").replaceWith(s):r.data("popover").tip().append(s),r.data("popover").tip().append(n),n.on("click",function(i){i.stopPropagation(),r.popover("hide"),r.toggleClass("active"),n.off("click"),t.openPopovers=[],Backbone.Mediator.pub("view:alerttimeline:troubleshoot",e)}),t.openPopovers.push(r),$("body").on("click",function(){t.openPopovers=[],r.removeClass("active"),r.popover("hide")})})):(t.openPopovers=[],r.popover("hide"))})};i(jobAlertIdList[e])}},loadAlertIncidentData:function(t,e,i,n){var s=this,r=s.collection.get(t),o=/timeline-event-(\d+)/g,a=parseInt(o.exec(e.attr("class"))[1]),l=_.findWhere(s.alertData,{id:a}),h=r.get("name"),c=new XDate(l.start),u=new XDate(l.end),d=r.toJSON(),p=c.diffMinutes(u),f=c.diffHours(u);d.toDate=u.toString("MM/dd/yyyy HH:mm"),d.minutes=500>p?p:500;var m=s.initGraph(i[0]);$.ajax({url:"/monitor.json",type:"post",data:r.toJSON(),async:!1,success:function(t){if("success"==t.status){var e=s.formatGraphData(t.graph_data);s.renderGraphData(m,e),"function"==typeof n&&n({name:h,start:c.toString("MM/dd/yyyy HH:mm"),end:u.toString("MM/dd/yyyy HH:mm"),hrs:Math.floor(f),min:Math.floor(p%60)}),s.hideOverlay(i.parent())}}})},createMetaTable:function(t){return $("<table class='alert-meta-data'><tr><th>Name</th><td>"+t.name+"</td></tr><tr><th>Start</th><td>"+t.start+"</td></tr><tr><th>End</th><td>"+t.end+"</td></tr><tr><th>Duration</th><td>"+t.hrs+" hr "+t.min+" min"+"</td></tr></table>")},publishTimelineHeight:function(){var t=this;Backbone.Mediator.pub("view:alerttimeline:toggle",t.$accordion.height()),$(document.body).css("overflow","auto")},setAlertStatus:function(){var t=this;this.status&&t.$el.find(".icon-bell-alt").addClass("alert-status")},setupAlertTimeline:function(){var e=this,i=[];$.ajax("/dashboards/"+e.dashboardId+"/errors",{success:function(n){_.each(n,function(t){var n=null;_.extend(t,{name:"undefined"!=typeof e.collection.get(t.jobId)?e.collection.get(t.jobId).get("name"):""}),n=e.formatServerDateTime(t.date,!0)<new XDate(Date.now(),!0).addWeeks(-2)?new XDate(Date.now(),!0).addWeeks(-2):e.formatServerDateTime(t.date,!0),e.alertData.push({id:t.id,jobId:t.jobId,start:n,end:t.endDate?e.formatServerDateTime(t.endDate,!0):e.formatServerDateTime(Date.now(),!0),status:t.status,content:t.name}),i.push(t.jobId)}),e.timeline=new t(e.$timeline[0]);var s=new XDate(Date.now()-864e5,!0),r=new XDate(Date.now()+432e5,!0);e.timeline.draw(e.alertData,{utc:!0,start:s,end:r,width:"100%",editable:!1,style:"box",intervalMin:6e5,intervalMax:2592e5}),e.$timeline.on("mouseenter",function(){$(window).on("scroll",e.stopBrowserScroll)}),e.$timeline.on("mouseleave",function(){$(window).off("scroll",e.stopBrowserScroll)}),e.jobAlertList=i,e.addPopover()}})},stopBrowserScroll:function(){window.scrollTo(0,0)},showOverlay:function(t,e,i){var n=this;if(t=$(t),!n.overlay){var i=i?i:"";t.data("overlay",$("<div class='overlay "+i+"'><h1></h1></div>")),t.append(t.data("overlay"))}t.data("overlay").find("h1").html(e),t.data("overlay").show()},hideOverlay:function(t){t.data("overlay").hide()},destructor:function(){var t=this,e=t.$el.prev();t.destroySubscriptions(),t.remove(),t.unbind(),t.off(),t.$el.empty(),$("<section class='timeline-wrap clearfix'></section>").insertAfter(e)}});return i}),define("view/dashboard",["view/base","model/monitor","collection/monitor","view/smallmonitor","view/expandedmonitor","view/addmonitor","view/resetmonitor","view/alerttimeline","codemirror","codemirror-ruby","jquery-validate"],function(t,e,i,n,s,r,o,a){var l=t.extend({rowMonitorLimit:3,events:{"slid .carousel":"advanceCarousel"},subscriptions:{"view:expandedmonitor:open":"hideDash","view:expandedmonitor:exit":"updateDash","view:addmonitor:close":"showDash","view:addmonitor:save":"updateDash","view:addmonitor:show":"hideDash","view:smallmonitor:edit":"editMonitor","view:alerttimeline:troubleshoot":"editMonitor"},hidePrevCaption:function(){this.$el.find(".carousel-caption").parent().children(".carousel-caption p").hide()},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.dashboardId=t.dashboardId?t.dashboardId:null,this.categoryId=t.categoryId?t.categoryId:null,this.user=t.user?t.user:null,this.router=t.router?t.router:null,this.categories=[],this.monitors=[],this.monitorCollections=[],this.currentOrder=[],this.carouselIndex=0,this.expandedMonitorView=new s({el:$(".edit-monitor-wrap"),user:this.user,templar:this.templar,router:this.router}),this.addMonitorView=new r({model:new e({dashboardId:this.dashboardId}),user:this.user,dashboardId:this.dashboardId,templar:this.templar}),this.alertTimelineView=new a({el:$(".timeline-wrap"),collection:this.collection,dashboardId:this.dashboardId,user:this.user,status:this.checkDashboardAlertState(),templar:this.templar}),this.resetMonitorView=new o({el:$(".reset-monitor-wrap"),templar:this.templar}),this.addHelpers(),Backbone.Mediator.pub("view:dashboard:init")},render:function(){return this.initMonitors(),this},initMonitors:function(){this.getCategories(),this.categories.length&&null==this.categoryId&&Backbone.Mediator.pub("view:dashboard:category",this.setCategoryId(this.categories[this.carouselIndex].id)),this.getDashboardInfo(this.dashboardId,function(t){Backbone.Mediator.pub("view:dashboard:render",{title:t,subtitle:this.getDashboardSubtitle(this.getCategoryIndex()),nav:{ecosystem:!1,dashboard:!0},dashboardId:this.dashboardId})}.bind(this)),this.updateMonitorList(),this.setupCarousel(),this.setupDrop(),this.goToCategory(),Backbone.Mediator.pub("view:dashboard:complete")},setCategories:function(t){_.each(t,function(t,e){t.children.length&&this.categories.splice(e,1)},this),this.categories=t},getCategories:function(){$.ajax({url:"/dashboards/"+this.dashboardId+"/children",async:!1,success:function(t){var e=t;this.setCategories(e)}.bind(this)})},setupDrop:function(){this.$monitorDragWraps=$(".small-monitor-drag"),this.$monitorWraps=$(".small-monitor-wrap"),this.$monitorWraps.droppable({accept:".small-monitor",over:function(t,e){$(t.target).addClass("active-drop"),e.draggable.draggable("option","revert",!1)},out:function(t,e){$(t.target).removeClass("active-drop"),e.draggable.draggable("option","revert",!0)},drop:function(t){$(t.target).removeClass("active-drop"),$(window).trigger("resize")}})},setupCarousel:function(){this.$carousel=$("#dashboardCarousel").carousel({interval:!1}),this.$el.find(".icon-chevron-sign-right").click(function(){this.$carousel.carousel("next")}.bind(this)),this.$el.find(".icon-chevron-sign-left").click(function(){this.$carousel.carousel("prev")}.bind(this))},getDashboardSubtitle:function(t){this.getCategories();var e="";return e=this.categories.length>=1&&this.parentDashboardInfo.id!==this.getCategoryId()?_.str.capitalize(this.categories[t].name)+" Dashboard":"Monitor Dashboard"},publishDashboardSubtitle:function(t){Backbone.Mediator.pub("view:dashboard:render",{subtitle:this.getDashboardSubtitle(t)})},advanceCarousel:function(t){t&&t.stopPropagation(),this.carouselIndex=this.$el.find(".item.active").index(".item"),this.setCategoryId(this.categories.length?this.categories[this.carouselIndex].id:this.getCategoryId()),this.router.navigate("dash/"+this.dashboardId+"/category/"+this.getCategoryId()),this.$el.find(".dashboard-"+this.getCategoryId()).css({"min-height":this.$el.find(".dashboard-"+this.getCategoryId()+" .monitor-grid").height()+40}),this.publishDashboardSubtitle(this.carouselIndex),Backbone.Mediator.pub("view:dashboard:category",this.getCategoryId()),$(window).trigger("resize")},getCategoryIndex:function(){var t=0;return _.each(this.categories,function(e,i){this.getCategoryId()===e.id&&(t=i)},this),t},goToCategory:function(){this.getCategoryIndex()&&(this.$carousel.toggleClass("slide"),this.$carousel.carousel(this.getCategoryIndex()),this.$carousel.toggleClass("slide")),this.categories.length<=1&&this.$el.find(".carousel-indicators, .carousel-control").hide()},getCategoryId:function(){return this.categoryId},setCategoryId:function(t){return this.categoryId=_.isNull(t)?this.categoryId:t,this.getCategoryId()},getMonitorOrder:function(){var t=this.user.get("preferences");if(this.categories.length)_.each(this.categories,function(e){var i=t.dashboards&&!_.isEmpty(t.dashboards[e.id])?t.dashboards[e.id].order:[];this.currentOrder[e.id]=i},this);else{var e=t.dashboards&&!_.isEmpty(t.dashboards[this.parentDashboardInfo.id])?t.dashboards[this.parentDashboardInfo.id].order:[];this.currentOrder[this.parentDashboardInfo.id]=e}return this.currentOrder},getDashboardInfo:function(t,e){$.ajax({url:"/dashboards/"+t,async:!1,success:function(t){this.parentDashboardInfo=t,"function"==typeof e&&e(this.parentDashboardInfo.name)}.bind(this),error:function(){}.bind(this),complete:function(){}.bind(this)})},editMonitor:function(t){this.expandedMonitorView.render(t,this.categories,this.getCategoryId(),this.dashboardId)},updateDash:function(t){t&&t.status&&"error"!=t.status&&(this.collection=new i(null,{dashboardId:this.dashboardId}),this.reinitializeDash(t)),this.showDash()},reinitializeDash:function(){this.$el.parent(),this.router.navigate(),this.getCategoryId()?this.router.navigate("dash/"+this.dashboardId+"/category/"+this.getCategoryId(),{trigger:!0}):this.router.navigate("dash/"+this.dashboardId,{trigger:!0})
396
+ },hideDash:function(){this.$el.hide()},showDash:function(){this.$el.show(),$(window).trigger("resize")},updateSavedMonitorStatus:function(t){var e=t?t.model:null;e&&_.each(this.monitors,function(t){t.model.get("id")===e.get("id")&&t.nextRun()})},checkDashboardAlertState:function(){return this.collection.each(function(t){"success"!==t.get("status")&&"undefined"!=typeof t.get("status")&&t.get("active")&&(this.dashboardAlert=!0)}),this.dashboardAlert&&Backbone.Mediator.pub("view:dashboard:alert"),this.dashboardAlert},updateMonitorList:function(){var t=[],e=[];if(this.getMonitorOrder(),Handlebars.registerHelper("mod",function(t,e){return 0===parseInt(t,10)%this.rowMonitorLimit?e.fn(this):void 0}.bind(this)),this.categories.length)_.each(this.categories,function(t){var e=new i(null,{dashboardId:t.id}),n=this.currentOrder[t.id];if(0!==n.length){var s=_.difference(e.pluck("id"),n);n=_.union(n,s),e.filterById(n)}this.monitorCollections.push(e),t.monitors=e.toJSON()},this),e=this.categories;else{var t=new i(null,{dashboardId:this.parentDashboardInfo.id}),s=this.currentOrder.length?this.currentOrder[this.parentDashboardInfo.id]:[];if(0!==s.length){var r=_.difference(t.pluck("id"),s);s=_.union(s,r),t.filterById(s)}this.monitorCollections.push(t),this.parentDashboardInfo.monitors=t.toJSON(),e.push(this.parentDashboardInfo)}this.templar.render({path:"dashboard",el:this.$el,data:{categories:e}}),_.each(this.monitorCollections,function(t){t.each(function(t){this.monitors.push(new n({el:this.$el.find(".small-monitor-"+t.get("id"))[0],model:t,dashboardId:this.dashboardId,templar:this.templar,user:this.user}).render())}.bind(this))},this)},destroyMonitors:function(){for(viewName in this.monitors){var t=this.monitors[viewName];t.destructor(),delete this.monitors[viewName]}},destructor:function(){var t=this.$el.parent();this.destroyMonitors(),this.collection.off("remove",this.reinitializeDash,this),this.destroySubscriptions(),this.expandedMonitorView.destructor(),this.addMonitorView.destructor(),this.alertTimelineView.destructor(),this.resetMonitorView.destructor(),this.monitors=[],this.categories=[],this.$el.empty(),this.$el.remove(),this.off(),t.prepend("<div class='monitor-panel container clearfix'>")}});return l}),define("model/dashboard",["model/base"],function(t){var e=t.extend({initialize:function(t){this.category=t?t.category:!1,this.dashboardId=t?t.dashboardId:null},url:function(){return this.category?this.dashboardId?"/dashboards/"+this.dashboardId+"/children.json":"/dashboards.json":this.get("id")?"/dashboards/"+this.get("id"):"/dashboards.json"},parse:function(t){return t.createdAt=t.createdAt?this.formatServerDateTime(t.createdAt):t.createdAt,t.modifiedAt=t.modifiedAt?this.formatServerDateTime(t.modifiedAt):t.modifiedAt,t},defaults:{id:null,userId:null,name:"Default",createdAt:null,modifiedAt:null,description:null,children:[]}});return e}),define("view/adddashboard",["view/base","model/dashboard","jquery-validate"],function(t,e){var i=t.extend({events:{"click .saveCloseDashboard":"checkValidationClose","click .saveDashboard":"checkValidation","hidden #addDashboard":"_cleanUp","shown #addDashboard":"focusFirst"},initialize:function(t){_.bind(this,"checkValidation","_cleanUp"),this.user=t.user,this.templar=t.templar},render:function(){this.templar.render({path:"adddashboard",el:this.$el,data:{}}),this.$modal=this.$el.find(".add-dashboard"),this.resizeModal($("#addDashboard"),"small",!0),this.setAddDashboardValidation()},setAddDashboardValidation:function(){this.form=$("#addDashboardForm"),this.validator=this.form.validate({rules:{dashboardName:{required:!0}},highlight:function(t){$(t).closest(".control-group").addClass("error")},success:function(t){t.closest(".control-group").removeClass("error"),$(t).remove()},submitHandler:function(){this.close?this.saveFinish():this.save()}.bind(this)})},checkValidation:function(){this.close=!1,this.form.submit()},checkValidationClose:function(){this.close=!0,this.form.submit()},save:function(){this._saveDashboard(function(){this._cleanUp()}.bind(this))},saveFinish:function(){this._saveDashboard(function(){this._closeModal()}.bind(this))},destructor:function(){var t=this.$el.prev();this.remove(),this.off(),this.$el=$("<section class='add-dashboard-wrap'></section>").insertAfter(t)},_saveDashboard:function(t){this.model.save({userId:this.user.get("id"),name:this.$el.find("#dashboardName").val(),description:this.$el.find("#dashboardDescription").val()},{success:function(e){this.collection.add(e),Backbone.Mediator.pub("view:adddashboard:save",{model:e,message:"The dashboard '"+e.get("name")+"' was added.",attention:"Dashboard Saved!"}),"function"==typeof t&&t()}.bind(this),error:function(){this.validator.showErrors({dashboardName:"That dashboard name already exists!"})}.bind(this)})},_closeModal:function(){this._cleanUp(),this.$modal.modal("hide")},_cleanUp:function(){this.$el.find("#dashboardName").val(""),this.$el.find("#dashboardDescription").val(""),this.$el.find("#dashboardName").parent().removeClass("error"),this.validator.resetForm(),this.model=new e}});return i}),define("view/addcategory",["view/base","model/dashboard","collection/monitor","jquery-validate"],function(t,e,i){var n=t.extend({events:{"click .saveCloseCategory":"checkValidationClose","click .saveCategory":"checkValidation","hidden #addCategory":"_cleanUp","shown #addCategory":"focusFirst"},subscriptions:{"view:dashboard:add":"_openModal"},initialize:function(t){_.bindAll(this),this.user=t.user,this.templar=t.templar,Handlebars.registerHelper("toUpperCase",function(t){return"string"==typeof t?t.toUpperCase():t})},render:function(t){this.dashboard=t?t.dashboard:null,this.templar.render({path:"addcategory",el:this.$el,data:t?t:{}}),this.setElement(this.$el),this.setAddCategoryValidation(),this.$modal=this.$el.find(".add-category"),this.resizeModal($("#addCategory"),"small",!0)},setAddCategoryValidation:function(){this.form=$("#addCategoryForm"),this.validator=this.form.validate({rules:{categoryName:{required:!0}},highlight:function(t){$(t).closest(".control-group").addClass("error")},success:function(t){t.closest(".control-group").removeClass("error"),$(t).remove()},submitHandler:function(){this.close?this.saveFinish():this.save()}.bind(this)})},checkValidation:function(){this.close=!1,this.form.submit()},checkValidationClose:function(){this.close=!0,this.form.submit()},save:function(){this._saveCategory(function(){this._cleanUp()}.bind(this))},saveFinish:function(){this._saveCategory(function(){this._closeModal()}.bind(this))},updateMonitorOrder:function(t){var e=this.user.get("preferences");e.dashboards[this.dashboard.id]&&(e.dashboards[t.get("id")]=e.dashboards[this.dashboard.id],e.dashboards[this.dashboard.id]=null,this.user.save())},destructor:function(){var t=this.$el.prev();this.remove(),this.off(),this.$el=$("<section class='add-category-wrap'></section>").insertAfter(t)},_checkFirstCategoryCondition:function(t){new e({id:this.dashboard.id}).fetch({success:function(e){_.isFunction(t)&&t(e)}.bind(this)})},_moveAllCurrentMonitorsToCategory:function(){this.model.save({userId:this.user.get("id"),name:this.$el.find("#categoryName").val(),description:this.$el.find("#categoryDescription").val()},{success:function(t){Backbone.Mediator.pub("view:addcategory:save",{model:t,message:"The category '"+t.get("name")+"' was added.",attention:"Category Saved!"}),t.get("id")&&new i(null,{dashboardId:this.dashboard.id,cb:function(e){e.each(function(e){e.save({dashboardId:t.get("id")})},this),this.updateMonitorOrder(t)}.bind(this)})}.bind(this),error:function(){this.validator.showErrors({categoryName:"That category name already exists!"})}.bind(this)})},_saveCategory:function(t){this._checkFirstCategoryCondition(function(i){this.model=new e({category:!0,dashboardId:this.dashboard.id}),i.get("children").length?this.model.save({userId:this.user.get("id"),name:this.$el.find("#categoryName").val(),description:this.$el.find("#categoryDescription").val()},{success:function(e){Backbone.Mediator.pub("view:addcategory:save",{model:e,message:"The category '"+e.get("name")+"' was added.",attention:"Category Saved!"}),_.isFunction(t)&&t()}.bind(this),error:function(){this.validator.showErrors({categoryName:"That category name already exists!"})}.bind(this)}):(this._moveAllCurrentMonitorsToCategory(),_.isFunction(t)&&t())}.bind(this))},_closeModal:function(){this._cleanUp(),this.$modal.modal("hide")},_cleanUp:function(){this.$el.find("#categoryName").val(""),this.$el.find("#categoryDescription").val(""),this.$el.find("#categoryName").parent().removeClass("error"),this.validator.resetForm(),this.model=new e},_openModal:function(t){this.destructor(),this.render(t),this.$modal.modal("show")}});return n}),define("view/dashboardtile",["view/base"],function(t){var e=t.extend({events:{"click .save.btn":"save","click .settings.btn":"settings","click figure.front":"loadDashboard","click .cancel.btn":"settings","click .add.btn":"addCategory"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.intervalLength=t.intervalLength?t.intervalLength:60,this.render()},render:function(){this.templar.render({path:"dashboardtile",el:this.$el,append:!0,data:{dashboard:this.model.toJSON()}}),this.$dashboardTile=this.$el.find(".dashboard"+this.model.get("id")),this.setElement(this.$dashboardTile),this.startStatusCheck()},loadDashboard:function(){location.href="#dash/"+this.model.get("id")},addCategory:function(){Backbone.Mediator.pub("view:dashboard:add",{dashboard:{id:this.model.get("id"),name:this.model.get("name"),children:this.model.get("children")}})},startStatusCheck:function(){this.updateTile(),this.interval=setInterval(function(){this.updateTile()}.bind(this),1e3*this.intervalLength),clearInterval(this.interval)},updateTile:function(){$.ajax({url:"/dashboards/"+this.model.get("id")+"/jobs.json",success:function(t){_.map(t,function(t){t.createdAt=t.createdAt?this.formatServerDateTime(t.createdAt,!0):t.createdAt,t.modifiedAt=t.modifiedAt?this.formatServerDateTime(t.modifiedAt,!0):t.modifiedAt},this),this.checkErrorState(t)}.bind(this)})},checkErrorState:function(t){for(var e=!1,i=t.length-1;i>=0;i--)if("success"!=t[i].status&&"undefined"!=typeof t[i].status&&t[i].active){e=!0;break}e?this.$el.find(".dashboard"+this.model.get("id")).addClass("red"):this.$el.find(".dashboard"+this.model.get("id")).removeClass("red")},settings:function(t){t.stopPropagation(),this.$dashboardTile.toggleClass("flipped"),setTimeout(function(){this.$dashboardTile.find(".front .btn").toggle()}.bind(this),600)},save:function(t){t.stopPropagation(),this.model.save({name:this.$dashboardTile.find(".dashboard-name").val()},{success:function(){Backbone.Mediator.pub("view:dashboard:save",{model:this.model,message:"Your changes to '"+this.model.get("name")+"' dashboard were saved.",attention:"Dashboard Saved!"})}.bind(this),error:function(t){Backbone.Mediator.pub("view:dashboard:save",{model:this.model,message:"The dashboard '"+t.get("name")+"' produced an error during the process of saving.",attention:"Dashboard Save Error!",status:"error"})}.bind(this)})},destructor:function(){clearInterval(this.interval),this.remove(),this.$el.remove(),this.off(),this.model.off()}});return e}),define("view/ecosystem",["view/base","view/dashboardtile"],function(t,e){var i=t.extend({dashboards:[],subscriptions:{"view:addcategory:save":"update","view:adddashboard:save":"update","view:dashboard:render":"destructor","view:dashboard:save":"update"},initialize:function(t){_.bindAll(this),this.templar=t.templar,this.dashboards=[]},render:function(){this.collection.each(function(t){this.dashboards.push(new e({el:this.el,model:t,templar:this.templar}))}.bind(this)),this.paddingFix(),Backbone.Mediator.pub("view:ecosystem:render",{title:"Ecosystem",subtitle:"Rearview Dashboards",nav:{ecosystem:!0,dashboard:!1}})},paddingFix:function(){this.$el.css("padding-bottom","40px")},update:function(t){t&&t.model?t.model:null,this.$el.empty(),this.collection.fetch({success:function(){this.render()}.bind(this)})},destroyDashboards:function(){var t=this;for(viewName in t.dashboards){var e=t.dashboards[viewName];e.destructor(),delete t.dashboards[viewName]}},destructor:function(){var t=this.$el.prev();this.destroySubscriptions(),this.destroyDashboards(),this.off(),this.collection.off(),this.remove(),t.after("<section class='ecosystem-dashboard-wrap'>")}});return i}),define("view/secondarynav",["view/base"],function(t){var e=t.extend({initialize:function(t){this.templar=t.templar,_.bindAll(this),this.currentNav={secondary:{nav:{ecosystem:!0,dashboard:!1}}},Backbone.Mediator.sub("view:dashboard:render",this.render,this),Backbone.Mediator.sub("controller:dashboard:init",this.render,this),this.render()},render:function(t){this.destructor(),this.previous=self.currentNav,_.extend(this.currentNav.secondary,t),this.templar.render({path:"secondarynav",el:this.$el,data:this.currentNav})},destructor:function(){this.$el.empty()}});return e}),define("view/settings",["view/base","jquery-validate"],function(t){var e=t.extend({el:".settings",events:{"click .saveSettings":"saveSettings","click .saveCloseSettings":"saveCloseSettings"},initialize:function(t){_.bindAll(this,"saveSettings","saveCloseSettings","render"),this.user=t.user,this.templar=t.templar},render:function(){this.templar.render({path:"settings",el:this.$el,data:{user:this.user.toJSON()}}),this.$modal=this.$el.find(".settings"),this.resizeModal($("#settings"),"small",!0)},saveSettings:function(){this.user.applyPrefs({alertKeys:this.parseAlertKeys(this.$el.find(".alert-settings textarea").val())}),this.user.save({},{success:function(){Backbone.Mediator.pub("view:settings:save",{model:this.user,message:"message",attention:"attention"})}.bind(this),error:function(){}.bind(this)})},saveCloseSettings:function(){this.saveSettings(),this.$modal.modal("hide")},destructor:function(){var t=this.$el.prev();this.remove(),this.off(),this.$el=$("<section class='settings-wrap'></section>").insertAfter(t)},_closeModal:function(){this._cleanUp(),this.$modal.modal("hide")},_cleanUp:function(){}});return e}),define("model/user",["model/base","backbone-mediator"],function(t){var e=t.extend({url:"/user.json",defaults:{id:null,email:"",firstName:"",lastName:"",lastLogin:null,createdAt:null,modifiedAt:null,preferences:{}},parse:function(t){return t.createdAt&&(t.createdAt=this.formatServerDateTime(t.createdAt)),t.modifiedAt&&(t.modifiedAt=this.formatServerDateTime(t.modifiedAt)),t.preferences||(t.preferences={},t.preferences.dashboards||(t.preferences.dashboards=[])),t},convertApplicationPrefs:function(){var t=this.get("preferences");t.applications&&(t.dashboards=t.applications,this.set("preferences",t),delete t.applications,this.save())},applyPrefs:function(t){var e=this.get("preferences");this.set("preferences",_.extend(e,t))},updatePrefs:function(t){this.applyPrefs(t),this.save()},initialize:function(){_.bindAll(this),this.fetch({async:!1,success:function(){this.convertApplicationPrefs(),Backbone.Mediator.pub("model:user:init",this)}.bind(this)})}});return e}),define("collection/dashboard",["jquery","underscore","backbone","model/dashboard"],function(t,e,i,n){var s=i.Collection.extend({model:n,url:"/dashboards.json",comparator:function(t){return t.get("name").toLowerCase()},initialize:function(t,e){e&&(this.cb=e.cb),this.fetch({success:function(){this.cb&&this.cb(),i.Mediator.pub("collection:dashboard:init",this)}.bind(this),async:!1})}});return s}),function(t,e){function i(e,i){var s,r,o,a=e.nodeName.toLowerCase();return"area"===a?(s=e.parentNode,r=s.name,e.href&&r&&"map"===s.nodeName.toLowerCase()?(o=t("img[usemap=#"+r+"]")[0],!!o&&n(o)):!1):(/input|select|textarea|button|object/.test(a)?!e.disabled:"a"===a?e.href||i:i)&&n(e)}function n(e){return t.expr.filters.visible(e)&&!t(e).parents().addBack().filter(function(){return"hidden"===t.css(this,"visibility")}).length}var s=0,r=/^ui-id-\d+$/;t.ui=t.ui||{},t.extend(t.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),t.fn.extend({focus:function(e){return function(i,n){return"number"==typeof i?this.each(function(){var e=this;setTimeout(function(){t(e).focus(),n&&n.call(e)},i)}):e.apply(this,arguments)}}(t.fn.focus),scrollParent:function(){var e;return e=t.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(t.css(this,"position"))&&/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(t.css(this,"overflow")+t.css(this,"overflow-y")+t.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!e.length?t(document):e},zIndex:function(i){if(i!==e)return this.css("zIndex",i);if(this.length)for(var n,s,r=t(this[0]);r.length&&r[0]!==document;){if(n=r.css("position"),("absolute"===n||"relative"===n||"fixed"===n)&&(s=parseInt(r.css("zIndex"),10),!isNaN(s)&&0!==s))return s;r=r.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++s)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&t(this).removeAttr("id")})}}),t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,n){return!!t.data(e,n[3])},focusable:function(e){return i(e,!isNaN(t.attr(e,"tabindex")))},tabbable:function(e){var n=t.attr(e,"tabindex"),s=isNaN(n);return(s||n>=0)&&i(e,!s)}}),t("<a>").outerWidth(1).jquery||t.each(["Width","Height"],function(i,n){function s(e,i,n,s){return t.each(r,function(){i-=parseFloat(t.css(e,"padding"+this))||0,n&&(i-=parseFloat(t.css(e,"border"+this+"Width"))||0),s&&(i-=parseFloat(t.css(e,"margin"+this))||0)}),i}var r="Width"===n?["Left","Right"]:["Top","Bottom"],o=n.toLowerCase(),a={innerWidth:t.fn.innerWidth,innerHeight:t.fn.innerHeight,outerWidth:t.fn.outerWidth,outerHeight:t.fn.outerHeight};t.fn["inner"+n]=function(i){return i===e?a["inner"+n].call(this):this.each(function(){t(this).css(o,s(this,i)+"px")})},t.fn["outer"+n]=function(e,i){return"number"!=typeof e?a["outer"+n].call(this,e):this.each(function(){t(this).css(o,s(this,e,!0,i)+"px")})}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(t.fn.removeData=function(e){return function(i){return arguments.length?e.call(this,t.camelCase(i)):e.call(this)}}(t.fn.removeData)),t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),t.support.selectstart="onselectstart"in document.createElement("div"),t.fn.extend({disableSelection:function(){return this.bind((t.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(t){t.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),t.extend(t.ui,{plugin:{add:function(e,i,n){var s,r=t.ui[e].prototype;for(s in n)r.plugins[s]=r.plugins[s]||[],r.plugins[s].push([i,n[s]])},call:function(t,e,i){var n,s=t.plugins[e];if(s&&t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType)for(n=0;s.length>n;n++)t.options[s[n][0]]&&s[n][1].apply(t.element,i)}},hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var n=i&&"left"===i?"scrollLeft":"scrollTop",s=!1;return e[n]>0?!0:(e[n]=1,s=e[n]>0,e[n]=0,s)}})}(jQuery),function(t,e){var i=0,n=Array.prototype.slice,s=t.cleanData;t.cleanData=function(e){for(var i,n=0;null!=(i=e[n]);n++)try{t(i).triggerHandler("remove")}catch(r){}s(e)},t.widget=function(i,n,s){var r,o,a,l,h={},c=i.split(".")[0];i=i.split(".")[1],r=c+"-"+i,s||(s=n,n=t.Widget),t.expr[":"][r.toLowerCase()]=function(e){return!!t.data(e,r)},t[c]=t[c]||{},o=t[c][i],a=t[c][i]=function(t,i){return this._createWidget?(arguments.length&&this._createWidget(t,i),e):new a(t,i)},t.extend(a,o,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),l=new n,l.options=t.widget.extend({},l.options),t.each(s,function(i,s){return t.isFunction(s)?(h[i]=function(){var t=function(){return n.prototype[i].apply(this,arguments)},e=function(t){return n.prototype[i].apply(this,t)};return function(){var i,n=this._super,r=this._superApply;return this._super=t,this._superApply=e,i=s.apply(this,arguments),this._super=n,this._superApply=r,i}}(),e):(h[i]=s,e)}),a.prototype=t.widget.extend(l,{widgetEventPrefix:o?l.widgetEventPrefix:i},h,{constructor:a,namespace:c,widgetName:i,widgetFullName:r}),o?(t.each(o._childConstructors,function(e,i){var n=i.prototype;t.widget(n.namespace+"."+n.widgetName,a,i._proto)}),delete o._childConstructors):n._childConstructors.push(a),t.widget.bridge(i,a)},t.widget.extend=function(i){for(var s,r,o=n.call(arguments,1),a=0,l=o.length;l>a;a++)for(s in o[a])r=o[a][s],o[a].hasOwnProperty(s)&&r!==e&&(i[s]=t.isPlainObject(r)?t.isPlainObject(i[s])?t.widget.extend({},i[s],r):t.widget.extend({},r):r);return i},t.widget.bridge=function(i,s){var r=s.prototype.widgetFullName||i;t.fn[i]=function(o){var a="string"==typeof o,l=n.call(arguments,1),h=this;return o=!a&&l.length?t.widget.extend.apply(null,[o].concat(l)):o,a?this.each(function(){var n,s=t.data(this,r);return s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(n=s[o].apply(s,l),n!==s&&n!==e?(h=n&&n.jquery?h.pushStack(n.get()):n,!1):e):t.error("no such method '"+o+"' for "+i+" widget instance"):t.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+o+"'")}):this.each(function(){var e=t.data(this,r);e?e.option(o||{})._init():t.data(this,r,new s(o,this))}),h}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(e,n){n=t(n||this.defaultElement||this)[0],this.element=t(n),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=t.widget.extend({},this.options,this._getCreateOptions(),e),this.bindings=t(),this.hoverable=t(),this.focusable=t(),n!==this&&(t.data(n,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===n&&this.destroy()}}),this.document=t(n.style?n.ownerDocument:n.document||n),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:t.noop,_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(t.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:t.noop,widget:function(){return this.element},option:function(i,n){var s,r,o,a=i;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof i)if(a={},s=i.split("."),i=s.shift(),s.length){for(r=a[i]=t.widget.extend({},this.options[i]),o=0;s.length-1>o;o++)r[s[o]]=r[s[o]]||{},r=r[s[o]];if(i=s.pop(),n===e)return r[i]===e?null:r[i];r[i]=n}else{if(n===e)return this.options[i]===e?null:this.options[i];a[i]=n}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return this.options[t]=e,"disabled"===t&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!e).attr("aria-disabled",e),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,n,s){var r,o=this;"boolean"!=typeof i&&(s=n,n=i,i=!1),s?(n=r=t(n),this.bindings=this.bindings.add(n)):(s=n,n=this.element,r=this.widget()),t.each(s,function(s,a){function l(){return i||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):e}"string"!=typeof a&&(l.guid=a.guid=a.guid||l.guid||t.guid++);var h=s.match(/^(\w+)\s*(.*)$/),c=h[1]+o.eventNamespace,u=h[2];u?r.delegate(u,c,l):n.bind(c,l)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.unbind(e).undelegate(e)},_delay:function(t,e){function i(){return("string"==typeof t?n[t]:t).apply(n,arguments)}var n=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){t(e.currentTarget).addClass("ui-state-hover")},mouseleave:function(e){t(e.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){t(e.currentTarget).addClass("ui-state-focus")},focusout:function(e){t(e.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(e,i,n){var s,r,o=this.options[e];if(n=n||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],r=i.originalEvent)for(s in r)s in i||(i[s]=r[s]);return this.element.trigger(i,n),!(t.isFunction(o)&&o.apply(this.element[0],[i].concat(n))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(n,s,r){"string"==typeof s&&(s={effect:s});var o,a=s?s===!0||"number"==typeof s?i:s.effect||i:e;s=s||{},"number"==typeof s&&(s={duration:s}),o=!t.isEmptyObject(s),s.complete=r,s.delay&&n.delay(s.delay),o&&t.effects&&t.effects.effect[a]?n[e](s):a!==e&&n[a]?n[a](s.duration,s.easing,r):n.queue(function(i){t(this)[e](),r&&r.call(n[0]),i()})}})}(jQuery),function(t){var e=!1;t(document).mouseup(function(){e=!1}),t.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.bind("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).bind("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!e){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var n=this,s=1===i.which,r="string"==typeof this.options.cancel&&i.target.nodeName?t(i.target).closest(this.options.cancel).length:!1;return s&&!r&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){n.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===t.data(i.target,this.widgetName+".preventClickEvent")&&t.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return n._mouseMove(t)},this._mouseUpDelegate=function(t){return n._mouseUp(t)},t(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),e=!0,!0)):!0}},_mouseMove:function(e){return t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button?this._mouseUp(e):this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){return t(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),!1},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function n(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var r,o=Math.max,a=Math.abs,l=Math.round,h=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(r!==e)return r;var i,n,s=t("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),i=o.offsetWidth,s.css("overflow","scroll"),n=o.offsetWidth,i===n&&(n=s[0].clientWidth),s.remove(),r=i-n},getScrollInfo:function(e){var i=e.isWindow?"":e.element.css("overflow-x"),n=e.isWindow?"":e.element.css("overflow-y"),s="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,r="scroll"===n||"auto"===n&&e.height<e.element[0].scrollHeight;return{width:r?t.position.scrollbarWidth():0,height:s?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),n=t.isWindow(i[0]);return{element:i,isWindow:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:n?i.width():i.outerWidth(),height:n?i.height():i.outerHeight()}}},t.fn.position=function(e){if(!e||!e.of)return f.apply(this,arguments);e=t.extend({},e);var r,p,m,g,v,y,b=t(e.of),x=t.position.getWithinInfo(e.within),w=t.position.getScrollInfo(x),k=(e.collision||"flip").split(" "),_={};return y=s(b),b[0].preventDefault&&(e.at="left top"),p=y.width,m=y.height,g=y.offset,v=t.extend({},g),t.each(["my","at"],function(){var t,i,n=(e[this]||"").split(" ");1===n.length&&(n=h.test(n[0])?n.concat(["center"]):c.test(n[0])?["center"].concat(n):["center","center"]),n[0]=h.test(n[0])?n[0]:"center",n[1]=c.test(n[1])?n[1]:"center",t=u.exec(n[0]),i=u.exec(n[1]),_[this]=[t?t[0]:0,i?i[0]:0],e[this]=[d.exec(n[0])[0],d.exec(n[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===e.at[0]?v.left+=p:"center"===e.at[0]&&(v.left+=p/2),"bottom"===e.at[1]?v.top+=m:"center"===e.at[1]&&(v.top+=m/2),r=i(_.at,p,m),v.left+=r[0],v.top+=r[1],this.each(function(){var s,h,c=t(this),u=c.outerWidth(),d=c.outerHeight(),f=n(this,"marginLeft"),y=n(this,"marginTop"),C=u+f+n(this,"marginRight")+w.width,D=d+y+n(this,"marginBottom")+w.height,M=t.extend({},v),S=i(_.my,c.outerWidth(),c.outerHeight());"right"===e.my[0]?M.left-=u:"center"===e.my[0]&&(M.left-=u/2),"bottom"===e.my[1]?M.top-=d:"center"===e.my[1]&&(M.top-=d/2),M.left+=S[0],M.top+=S[1],t.support.offsetFractions||(M.left=l(M.left),M.top=l(M.top)),s={marginLeft:f,marginTop:y},t.each(["left","top"],function(i,n){t.ui.position[k[i]]&&t.ui.position[k[i]][n](M,{targetWidth:p,targetHeight:m,elemWidth:u,elemHeight:d,collisionPosition:s,collisionWidth:C,collisionHeight:D,offset:[r[0]+S[0],r[1]+S[1]],my:e.my,at:e.at,within:x,elem:c})}),e.using&&(h=function(t){var i=g.left-M.left,n=i+p-u,s=g.top-M.top,r=s+m-d,l={target:{element:b,left:g.left,top:g.top,width:p,height:m},element:{element:c,left:M.left,top:M.top,width:u,height:d},horizontal:0>n?"left":i>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};
397
+ u>p&&p>a(i+n)&&(l.horizontal="center"),d>m&&m>a(s+r)&&(l.vertical="middle"),l.important=o(a(i),a(n))>o(a(s),a(r))?"horizontal":"vertical",e.using.call(this,t,l)}),c.offset(t.extend(M,{using:h}))})},t.ui.position={fit:{left:function(t,e){var i,n=e.within,s=n.isWindow?n.scrollLeft:n.offset.left,r=n.width,a=t.left-e.collisionPosition.marginLeft,l=s-a,h=a+e.collisionWidth-r-s;e.collisionWidth>r?l>0&&0>=h?(i=t.left+l+e.collisionWidth-r-s,t.left+=l-i):t.left=h>0&&0>=l?s:l>h?s+r-e.collisionWidth:s:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-a,t.left)},top:function(t,e){var i,n=e.within,s=n.isWindow?n.scrollTop:n.offset.top,r=e.within.height,a=t.top-e.collisionPosition.marginTop,l=s-a,h=a+e.collisionHeight-r-s;e.collisionHeight>r?l>0&&0>=h?(i=t.top+l+e.collisionHeight-r-s,t.top+=l-i):t.top=h>0&&0>=l?s:l>h?s+r-e.collisionHeight:s:l>0?t.top+=l:h>0?t.top-=h:t.top=o(t.top-a,t.top)}},flip:{left:function(t,e){var i,n,s=e.within,r=s.offset.left+s.scrollLeft,o=s.width,l=s.isWindow?s.scrollLeft:s.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-o-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-o-r,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(n=t.left-e.collisionPosition.marginLeft+d+p+f-l,(n>0||u>a(n))&&(t.left+=d+p+f))},top:function(t,e){var i,n,s=e.within,r=s.offset.top+s.scrollTop,o=s.height,l=s.isWindow?s.scrollTop:s.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-o-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(n=t.top+p+f+m+e.collisionHeight-o-r,t.top+p+f+m>c&&(0>n||a(c)>n)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-l,t.top+p+f+m>u&&(i>0||u>a(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,n,s,r,o=document.getElementsByTagName("body")[0],a=document.createElement("div");e=document.createElement(o?"div":"body"),n={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&t.extend(n,{position:"absolute",left:"-1000px",top:"-1000px"});for(r in n)e.style[r]=n[r];e.appendChild(a),i=o||document.documentElement,i.insertBefore(e,i.firstChild),a.style.cssText="position: absolute; left: 10.7432222px;",s=t(a).offset().left,t.support.offsetFractions=s>10&&11>s,e.innerHTML="",i.removeChild(e)}()}(jQuery),function(t){t.widget("ui.draggable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(e){var i=this.options;return this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(t(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){t("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(t(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_mouseDrag:function(e,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),!i){var n=this._uiHash();if(this._trigger("drag",e,n)===!1)return this._mouseUp({}),!1;this.position=n.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,n=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(n=t.ui.ddmanager.drop(this,e)),this.dropped&&(n=this.dropped,this.dropped=!1),"original"!==this.options.helper||t.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!n||"valid"===this.options.revert&&n||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1):!1},_mouseUp:function(e){return t("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(e){var i=this.options,n=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.element.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,n,s=this.options;return s.containment?"window"===s.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===s.containment?(this.containment=[0,0,t(document).width()-this.helperProportions.width-this.margins.left,(t(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):s.containment.constructor===Array?(this.containment=s.containment,void 0):("parent"===s.containment&&(s.containment=this.helper[0].parentNode),i=t(s.containment),n=i[0],n&&(e="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,i){i||(i=this.position);var n="absolute"===e?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:s.scrollTop(),left:s.scrollLeft()}),{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*n}},_generatePosition:function(e){var i,n,s,r,o=this.options,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=e.pageX,h=e.pageY;return this.offset.scroll||(this.offset.scroll={top:a.scrollTop(),left:a.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(n=this.relative_container.offset(),i=[this.containment[0]+n.left,this.containment[1]+n.top,this.containment[2]+n.left,this.containment[3]+n.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(l=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(h=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(l=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),o.grid&&(s=o.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,h=i?s-this.offset.click.top>=i[1]||s-this.offset.click.top>i[3]?s:s-this.offset.click.top>=i[1]?s-o.grid[1]:s+o.grid[1]:s,r=o.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,l=i?r-this.offset.click.left>=i[0]||r-this.offset.click.left>i[2]?r:r-this.offset.click.left>=i[0]?r-o.grid[0]:r+o.grid[0]:r)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(e,i,n){return n=n||this._uiHash(),t.ui.plugin.call(this,e,[i,n]),"drag"===e&&(this.positionAbs=this._convertPositionTo("absolute")),t.Widget.prototype._trigger.call(this,e,i,n)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i){var n=t(this).data("ui-draggable"),s=n.options,r=t.extend({},i,{item:n.element});n.sortables=[],t(s.connectToSortable).each(function(){var i=t.data(this,"ui-sortable");i&&!i.options.disabled&&(n.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",e,r))})},stop:function(e,i){var n=t(this).data("ui-draggable"),s=t.extend({},i,{item:n.element});t.each(n.sortables,function(){this.instance.isOver?(this.instance.isOver=0,n.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(e),this.instance.options.helper=this.instance.options._helper,"original"===n.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",e,s))})},drag:function(e,i){var n=t(this).data("ui-draggable"),s=this;t.each(n.sortables,function(){var r=!1,o=this;this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(r=!0,t.each(n.sortables,function(){return this.instance.positionAbs=n.positionAbs,this.instance.helperProportions=n.helperProportions,this.instance.offset.click=n.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&t.contains(o.instance.element[0],this.instance.element[0])&&(r=!1),r})),r?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=t(s).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},e.target=this.instance.currentItem[0],this.instance._mouseCapture(e,!0),this.instance._mouseStart(e,!0,!0),this.instance.offset.click.top=n.offset.click.top,this.instance.offset.click.left=n.offset.click.left,this.instance.offset.parent.left-=n.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=n.offset.parent.top-this.instance.offset.parent.top,n._trigger("toSortable",e),n.dropped=this.instance.element,n.currentItem=n.element,this.instance.fromOutside=n),this.instance.currentItem&&this.instance._mouseDrag(e)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",e,this.instance._uiHash(this.instance)),this.instance._mouseStop(e,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),n._trigger("fromSortable",e),n.dropped=!1)})}}),t.ui.plugin.add("draggable","cursor",{start:function(){var e=t("body"),i=t(this).data("ui-draggable").options;e.css("cursor")&&(i._cursor=e.css("cursor")),e.css("cursor",i.cursor)},stop:function(){var e=t(this).data("ui-draggable").options;e._cursor&&t("body").css("cursor",e._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i){var n=t(i.helper),s=t(this).data("ui-draggable").options;n.css("opacity")&&(s._opacity=n.css("opacity")),n.css("opacity",s.opacity)},stop:function(e,i){var n=t(this).data("ui-draggable").options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(){var e=t(this).data("ui-draggable");e.scrollParent[0]!==document&&"HTML"!==e.scrollParent[0].tagName&&(e.overflowOffset=e.scrollParent.offset())},drag:function(e){var i=t(this).data("ui-draggable"),n=i.options,s=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(n.axis&&"x"===n.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-e.pageY<n.scrollSensitivity?i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop+n.scrollSpeed:e.pageY-i.overflowOffset.top<n.scrollSensitivity&&(i.scrollParent[0].scrollTop=s=i.scrollParent[0].scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(i.overflowOffset.left+i.scrollParent[0].offsetWidth-e.pageX<n.scrollSensitivity?i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft+n.scrollSpeed:e.pageX-i.overflowOffset.left<n.scrollSensitivity&&(i.scrollParent[0].scrollLeft=s=i.scrollParent[0].scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(e.pageY-t(document).scrollTop()<n.scrollSensitivity?s=t(document).scrollTop(t(document).scrollTop()-n.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<n.scrollSensitivity&&(s=t(document).scrollTop(t(document).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(e.pageX-t(document).scrollLeft()<n.scrollSensitivity?s=t(document).scrollLeft(t(document).scrollLeft()-n.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<n.scrollSensitivity&&(s=t(document).scrollLeft(t(document).scrollLeft()+n.scrollSpeed)))),s!==!1&&t.ui.ddmanager&&!n.dropBehaviour&&t.ui.ddmanager.prepareOffsets(i,e)}}),t.ui.plugin.add("draggable","snap",{start:function(){var e=t(this).data("ui-draggable"),i=e.options;e.snapElements=[],t(i.snap.constructor!==String?i.snap.items||":data(ui-draggable)":i.snap).each(function(){var i=t(this),n=i.offset();this!==e.element[0]&&e.snapElements.push({item:this,width:i.outerWidth(),height:i.outerHeight(),top:n.top,left:n.left})})},drag:function(e,i){var n,s,r,o,a,l,h,c,u,d,p=t(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=i.offset.left,v=g+p.helperProportions.width,y=i.offset.top,b=y+p.helperProportions.height;for(u=p.snapElements.length-1;u>=0;u--)a=p.snapElements[u].left,l=a+p.snapElements[u].width,h=p.snapElements[u].top,c=h+p.snapElements[u].height,a-m>v||g>l+m||h-m>b||y>c+m||!t.contains(p.snapElements[u].item.ownerDocument,p.snapElements[u].item)?(p.snapElements[u].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(h-b),s=m>=Math.abs(c-y),r=m>=Math.abs(a-v),o=m>=Math.abs(l-g),n&&(i.position.top=p._convertPositionTo("relative",{top:h-p.helperProportions.height,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),r&&(i.position.left=p._convertPositionTo("relative",{top:0,left:a-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),d=n||s||r||o,"outer"!==f.snapMode&&(n=m>=Math.abs(h-y),s=m>=Math.abs(c-b),r=m>=Math.abs(a-g),o=m>=Math.abs(l-v),n&&(i.position.top=p._convertPositionTo("relative",{top:h,left:0}).top-p.margins.top),s&&(i.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),r&&(i.position.left=p._convertPositionTo("relative",{top:0,left:a}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[u].snapping&&(n||s||r||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,e,t.extend(p._uiHash(),{snapItem:p.snapElements[u].item})),p.snapElements[u].snapping=n||s||r||o||d)}}),t.ui.plugin.add("draggable","stack",{start:function(){var e,i=this.data("ui-draggable").options,n=t.makeArray(t(i.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});n.length&&(e=parseInt(t(n[0]).css("zIndex"),10)||0,t(n).each(function(i){t(this).css("zIndex",e+i)}),this.css("zIndex",e+n.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i){var n=t(i.helper),s=t(this).data("ui-draggable").options;n.css("zIndex")&&(s._zIndex=n.css("zIndex")),n.css("zIndex",s.zIndex)},stop:function(e,i){var n=t(this).data("ui-draggable").options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}t.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept=t.isFunction(i)?i:function(t){return t.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},t.ui.ddmanager.droppables[e.scope]=t.ui.ddmanager.droppables[e.scope]||[],t.ui.ddmanager.droppables[e.scope].push(this),e.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var e=0,i=t.ui.ddmanager.droppables[this.options.scope];i.length>e;e++)i[e]===this&&i.splice(e,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(e,i){"accept"===e&&(this.accept=t.isFunction(i)?i:function(t){return t.is(i)}),t.Widget.prototype._setOption.apply(this,arguments)},_activate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",e,this.ui(i))},_deactivate:function(e){var i=t.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",e,this.ui(i))},_over:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",e,this.ui(i)))},_out:function(e){var i=t.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",e,this.ui(i)))},_drop:function(e,i){var n=i||t.ui.ddmanager.current,s=!1;return n&&(n.currentItem||n.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var e=t.data(this,"ui-droppable");return e.options.greedy&&!e.options.disabled&&e.options.scope===n.options.scope&&e.accept.call(e.element[0],n.currentItem||n.element)&&t.ui.intersect(n,t.extend(e,{offset:e.element.offset()}),e.options.tolerance)?(s=!0,!1):void 0}),s?!1:this.accept.call(this.element[0],n.currentItem||n.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",e,this.ui(n)),this.element):!1):!1},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}}}),t.ui.intersect=function(t,i,n){if(!i.offset)return!1;var s,r,o=(t.positionAbs||t.position.absolute).left,a=o+t.helperProportions.width,l=(t.positionAbs||t.position.absolute).top,h=l+t.helperProportions.height,c=i.offset.left,u=c+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(n){case"fit":return o>=c&&u>=a&&l>=d&&p>=h;case"intersect":return o+t.helperProportions.width/2>c&&u>a-t.helperProportions.width/2&&l+t.helperProportions.height/2>d&&p>h-t.helperProportions.height/2;case"pointer":return s=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,r=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,e(r,d,i.proportions.height)&&e(s,c,i.proportions.width);case"touch":return(l>=d&&p>=l||h>=d&&p>=h||d>l&&h>p)&&(o>=c&&u>=o||a>=c&&u>=a||c>o&&a>u);default:return!1}},t.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(e,i){var n,s,r=t.ui.ddmanager.droppables[e.options.scope]||[],o=i?i.type:null,a=(e.currentItem||e.element).find(":data(ui-droppable)").addBack();t:for(n=0;r.length>n;n++)if(!(r[n].options.disabled||e&&!r[n].accept.call(r[n].element[0],e.currentItem||e.element))){for(s=0;a.length>s;s++)if(a[s]===r[n].element[0]){r[n].proportions.height=0;continue t}r[n].visible="none"!==r[n].element.css("display"),r[n].visible&&("mousedown"===o&&r[n]._activate.call(r[n],i),r[n].offset=r[n].element.offset(),r[n].proportions={width:r[n].element[0].offsetWidth,height:r[n].element[0].offsetHeight})}},drop:function(e,i){var n=!1;return t.each((t.ui.ddmanager.droppables[e.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&t.ui.intersect(e,this,this.options.tolerance)&&(n=this._drop.call(this,i)||n),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),n},dragStart:function(e,i){e.element.parentsUntil("body").bind("scroll.droppable",function(){e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)})},drag:function(e,i){e.options.refreshPositions&&t.ui.ddmanager.prepareOffsets(e,i),t.each(t.ui.ddmanager.droppables[e.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var n,s,r,o=t.ui.intersect(e,this,this.options.tolerance),a=!o&&this.isover?"isout":o&&!this.isover?"isover":null;a&&(this.options.greedy&&(s=this.options.scope,r=this.element.parents(":data(ui-droppable)").filter(function(){return t.data(this,"ui-droppable").options.scope===s}),r.length&&(n=t.data(r[0],"ui-droppable"),n.greedyChild="isover"===a)),n&&"isover"===a&&(n.isover=!1,n.isout=!0,n._out.call(n,i)),this[a]=!0,this["isout"===a?"isover":"isout"]=!1,this["isover"===a?"_over":"_out"].call(this,i),n&&"isout"===a&&(n.isout=!1,n.isover=!0,n._over.call(n,i)))}})},dragStop:function(e,i){e.element.parentsUntil("body").unbind("scroll.droppable"),e.options.refreshPositions||t.ui.ddmanager.prepareOffsets(e,i)}}}(jQuery),function(t){function e(t){return parseInt(t,10)||0}function i(t){return!isNaN(parseInt(t,10))}t.widget("ui.resizable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var e,i,n,s,r,o=this,a=this.options;if(this.element.addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(t("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),e=this.handles.split(","),this.handles={},i=0;e.length>i;i++)n=t.trim(e[i]),r="ui-resizable-"+n,s=t("<div class='ui-resizable-handle "+r+"'></div>"),s.css({zIndex:a.zIndex}),"se"===n&&s.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[n]=".ui-resizable-"+n,this.element.append(s);this._renderAxis=function(e){var i,n,s,r;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=t(this.handles[i],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(n=t(this.handles[i],this.element),r=/sw|ne|nw|se|n|s/.test(i)?n.outerHeight():n.outerWidth(),s=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(s,r),this._proportionallyResize()),t(this.handles[i]).length},this._renderAxis(this.element),this._handles=t(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(s=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=s&&s[1]?s[1]:"se")}),a.autoHide&&(this._handles.hide(),t(this.element).addClass("ui-resizable-autohide").mouseenter(function(){a.disabled||(t(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){a.disabled||o.resizing||(t(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(e){var i,n,s=!1;for(i in this.handles)n=t(this.handles[i])[0],(n===e.target||t.contains(n,e.target))&&(s=!0);return!this.options.disabled&&s},_mouseStart:function(i){var n,s,r,o=this.options,a=this.element.position(),l=this.element;return this.resizing=!0,/absolute/.test(l.css("position"))?l.css({position:"absolute",top:l.css("top"),left:l.css("left")}):l.is(".ui-draggable")&&l.css({position:"absolute",top:a.top,left:a.left}),this._renderProxy(),n=e(this.helper.css("left")),s=e(this.helper.css("top")),o.containment&&(n+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:n,top:s},this.size=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalSize=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalPosition={left:n,top:s},this.sizeDiff={width:l.outerWidth()-l.width(),height:l.outerHeight()-l.height()},this.originalMousePosition={left:i.pageX,top:i.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,r=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===r?this.axis+"-resize":r),l.addClass("ui-resizable-resizing"),this._propagate("start",i),!0
398
+ },_mouseDrag:function(e){var i,n=this.helper,s={},r=this.originalMousePosition,o=this.axis,a=this.position.top,l=this.position.left,h=this.size.width,c=this.size.height,u=e.pageX-r.left||0,d=e.pageY-r.top||0,p=this._change[o];return p?(i=p.apply(this,[e,u,d]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),this.position.top!==a&&(s.top=this.position.top+"px"),this.position.left!==l&&(s.left=this.position.left+"px"),this.size.width!==h&&(s.width=this.size.width+"px"),this.size.height!==c&&(s.height=this.size.height+"px"),n.css(s),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||this._trigger("resize",e,this.ui()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,n,s,r,o,a,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,n=i.length&&/textarea/i.test(i[0].nodeName),s=n&&t.ui.hasScroll(i[0],"left")?0:c.sizeDiff.height,r=n?0:c.sizeDiff.width,o={width:c.helper.width()-r,height:c.helper.height()-s},a=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,l=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(o,{top:l,left:a})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(t){var e,n,s,r,o,a=this.options;o={minWidth:i(a.minWidth)?a.minWidth:0,maxWidth:i(a.maxWidth)?a.maxWidth:1/0,minHeight:i(a.minHeight)?a.minHeight:0,maxHeight:i(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,n=o.maxHeight*this.aspectRatio,r=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>n&&(o.maxWidth=n),o.maxHeight>r&&(o.maxHeight=r)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),i(t.left)&&(this.position.left=t.left),i(t.top)&&(this.position.top=t.top),i(t.height)&&(this.size.height=t.height),i(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,n=this.size,s=this.axis;return i(t.height)?t.width=t.height*this.aspectRatio:i(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(n.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(n.height-t.height),t.left=e.left+(n.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,n=this.axis,s=i(t.width)&&e.maxWidth&&e.maxWidth<t.width,r=i(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=i(t.width)&&e.minWidth&&e.minWidth>t.width,a=i(t.height)&&e.minHeight&&e.minHeight>t.height,l=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,c=/sw|nw|w/.test(n),u=/nw|ne|n/.test(n);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),r&&(t.height=e.maxHeight),o&&c&&(t.left=l-e.minWidth),s&&c&&(t.left=l-e.maxWidth),a&&u&&(t.top=h-e.minHeight),r&&u&&(t.top=h-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var t,e,i,n,s,r=this.helper||this.element;for(t=0;this._proportionallyResizeElements.length>t;t++){if(s=this._proportionallyResizeElements[t],!this.borderDif)for(this.borderDif=[],i=[s.css("borderTopWidth"),s.css("borderRightWidth"),s.css("borderBottomWidth"),s.css("borderLeftWidth")],n=[s.css("paddingTop"),s.css("paddingRight"),s.css("paddingBottom"),s.css("paddingLeft")],e=0;i.length>e;e++)this.borderDif[e]=(parseInt(i[e],10)||0)+(parseInt(n[e],10)||0);s.css({height:r.height()-this.borderDif[0]-this.borderDif[2]||0,width:r.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,n=this.originalPosition;return{left:n.left+e,width:i.width-e}},n:function(t,e,i){var n=this.originalSize,s=this.originalPosition;return{top:s.top+i,height:n.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,n){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,n]))},sw:function(e,i,n){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,n]))},ne:function(e,i,n){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,n]))},nw:function(e,i,n){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,n]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).data("ui-resizable"),n=i.options,s=i._proportionallyResizeElements,r=s.length&&/textarea/i.test(s[0].nodeName),o=r&&t.ui.hasScroll(s[0],"left")?0:i.sizeDiff.height,a=r?0:i.sizeDiff.width,l={width:i.size.width-a,height:i.size.height-o},h=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,c=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:n.animateDuration,easing:n.animateEasing,step:function(){var n={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};s&&s.length&&t(s[0]).css({width:n.width,height:n.height}),i._updateCache(n),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var i,n,s,r,o,a,l,h=t(this).data("ui-resizable"),c=h.options,u=h.element,d=c.containment,p=d instanceof t?d.get(0):/parent/.test(d)?u.parent().get(0):d;p&&(h.containerElement=t(p),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(i=t(p),n=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){n[t]=e(i.css("padding"+s))}),h.containerOffset=i.offset(),h.containerPosition=i.position(),h.containerSize={height:i.innerHeight()-n[3],width:i.innerWidth()-n[1]},s=h.containerOffset,r=h.containerSize.height,o=h.containerSize.width,a=t.ui.hasScroll(p,"left")?p.scrollWidth:o,l=t.ui.hasScroll(p)?p.scrollHeight:r,h.parentData={element:p,left:s.left,top:s.top,width:a,height:l}))},resize:function(e){var i,n,s,r,o=t(this).data("ui-resizable"),a=o.options,l=o.containerOffset,h=o.position,c=o._aspectRatio||e.shiftKey,u={top:0,left:0},d=o.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(o._helper?l.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-l.left:o.position.left-u.left),c&&(o.size.height=o.size.width/o.aspectRatio),o.position.left=a.helper?l.left:0),h.top<(o._helper?l.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-l.top:o.position.top),c&&(o.size.width=o.size.height*o.aspectRatio),o.position.top=o._helper?l.top:0),o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top,i=Math.abs((o._helper?o.offset.left-u.left:o.offset.left-u.left)+o.sizeDiff.width),n=Math.abs((o._helper?o.offset.top-u.top:o.offset.top-l.top)+o.sizeDiff.height),s=o.containerElement.get(0)===o.element.parent().get(0),r=/relative|absolute/.test(o.containerElement.css("position")),s&&r&&(i-=o.parentData.left),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,c&&(o.size.height=o.size.width/o.aspectRatio)),n+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-n,c&&(o.size.width=o.size.height*o.aspectRatio))},stop:function(){var e=t(this).data("ui-resizable"),i=e.options,n=e.containerOffset,s=e.containerPosition,r=e.containerElement,o=t(e.helper),a=o.offset(),l=o.outerWidth()-e.sizeDiff.width,h=o.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(r.css("position"))&&t(this).css({left:a.left-s.left-n.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(r.css("position"))&&t(this).css({left:a.left-s.left-n.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,n=function(e){t(e).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseInt(e.width(),10),height:parseInt(e.height(),10),left:parseInt(e.css("left"),10),top:parseInt(e.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?n(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],n(i.alsoResize)):t.each(i.alsoResize,function(t){n(t)})},resize:function(e,i){var n=t(this).data("ui-resizable"),s=n.options,r=n.originalSize,o=n.originalPosition,a={height:n.size.height-r.height||0,width:n.size.width-r.width||0,top:n.position.top-o.top||0,left:n.position.left-o.left||0},l=function(e,n){t(e).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),r={},o=n&&n.length?n:e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&i>=0&&(r[e]=i||null)}),e.css(r)})};"object"!=typeof s.alsoResize||s.alsoResize.nodeType?l(s.alsoResize):t.each(s.alsoResize,function(t,e){l(t,e)})},stop:function(){t(this).removeData("resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).data("ui-resizable"),i=e.options,n=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:n.height,width:n.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).data("ui-resizable");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).data("ui-resizable");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e=t(this).data("ui-resizable"),i=e.options,n=e.size,s=e.originalSize,r=e.originalPosition,o=e.axis,a="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=a[0]||1,h=a[1]||1,c=Math.round((n.width-s.width)/l)*l,u=Math.round((n.height-s.height)/h)*h,d=s.width+c,p=s.height+u,f=i.maxWidth&&d>i.maxWidth,m=i.maxHeight&&p>i.maxHeight,g=i.minWidth&&i.minWidth>d,v=i.minHeight&&i.minHeight>p;i.grid=a,g&&(d+=l),v&&(p+=h),f&&(d-=l),m&&(p-=h),/^(se|s|e)$/.test(o)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(o)?(e.size.width=d,e.size.height=p,e.position.top=r.top-u):/^(sw)$/.test(o)?(e.size.width=d,e.size.height=p,e.position.left=r.left-c):(e.size.width=d,e.size.height=p,e.position.top=r.top-u,e.position.left=r.left-c)}})}(jQuery),function(t){t.widget("ui.selectable",t.ui.mouse,{version:"1.10.3",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var e,i=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){e=t(i.options.filter,i.element[0]),e.addClass("ui-selectee"),e.each(function(){var e=t(this),i=e.offset();t.data(this,"selectable-item",{element:this,$element:e,left:i.left,top:i.top,right:i.left+e.outerWidth(),bottom:i.top+e.outerHeight(),startselected:!1,selected:e.hasClass("ui-selected"),selecting:e.hasClass("ui-selecting"),unselecting:e.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=e.addClass("ui-selectee"),this._mouseInit(),this.helper=t("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(e){var i=this,n=this.options;this.opos=[e.pageX,e.pageY],this.options.disabled||(this.selectees=t(n.filter,this.element[0]),this._trigger("start",e),t(n.appendTo).append(this.helper),this.helper.css({left:e.pageX,top:e.pageY,width:0,height:0}),n.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var n=t.data(this,"selectable-item");n.startselected=!0,e.metaKey||e.ctrlKey||(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,i._trigger("unselecting",e,{unselecting:n.element}))}),t(e.target).parents().addBack().each(function(){var n,s=t.data(this,"selectable-item");return s?(n=!e.metaKey&&!e.ctrlKey||!s.$element.hasClass("ui-selected"),s.$element.removeClass(n?"ui-unselecting":"ui-selected").addClass(n?"ui-selecting":"ui-unselecting"),s.unselecting=!n,s.selecting=n,s.selected=n,n?i._trigger("selecting",e,{selecting:s.element}):i._trigger("unselecting",e,{unselecting:s.element}),!1):void 0}))},_mouseDrag:function(e){if(this.dragged=!0,!this.options.disabled){var i,n=this,s=this.options,r=this.opos[0],o=this.opos[1],a=e.pageX,l=e.pageY;return r>a&&(i=a,a=r,r=i),o>l&&(i=l,l=o,o=i),this.helper.css({left:r,top:o,width:a-r,height:l-o}),this.selectees.each(function(){var i=t.data(this,"selectable-item"),h=!1;i&&i.element!==n.element[0]&&("touch"===s.tolerance?h=!(i.left>a||r>i.right||i.top>l||o>i.bottom):"fit"===s.tolerance&&(h=i.left>r&&a>i.right&&i.top>o&&l>i.bottom),h?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,n._trigger("selecting",e,{selecting:i.element}))):(i.selecting&&((e.metaKey||e.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),n._trigger("unselecting",e,{unselecting:i.element}))),i.selected&&(e.metaKey||e.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,n._trigger("unselecting",e,{unselecting:i.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,t(".ui-unselecting",this.element[0]).each(function(){var n=t.data(this,"selectable-item");n.$element.removeClass("ui-unselecting"),n.unselecting=!1,n.startselected=!1,i._trigger("unselected",e,{unselected:n.element})}),t(".ui-selecting",this.element[0]).each(function(){var n=t.data(this,"selectable-item");n.$element.removeClass("ui-selecting").addClass("ui-selected"),n.selecting=!1,n.selected=!0,n.startselected=!0,i._trigger("selected",e,{selected:n.element})}),this._trigger("stop",e),this.helper.remove(),!1}})}(jQuery),function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var n=null,s=!1,r=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,r.widgetName+"-item")===r?(n=t(this),!1):void 0}),t.data(e.target,r.widgetName+"-item")===r&&(n=t(e.target)),n?!this.options.handle||i||(t(this.options.handle,n).find("*").addBack().each(function(){this===e.target&&(s=!0)}),s)?(this.currentItem=n,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,n){var s,r,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(r=this.document.find("body"),this.storedCursor=r.css("cursor"),r.css("cursor",o.cursor),this.storedStylesheet=t("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(r)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!n)for(s=this.containers.length-1;s>=0;s--)this.containers[s]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,n,s,r,o=this.options,a=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop+o.scrollSpeed:e.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=a=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-e.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft+o.scrollSpeed:e.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=a=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(e.pageY-t(document).scrollTop()<o.scrollSensitivity?a=t(document).scrollTop(t(document).scrollTop()-o.scrollSpeed):t(window).height()-(e.pageY-t(document).scrollTop())<o.scrollSensitivity&&(a=t(document).scrollTop(t(document).scrollTop()+o.scrollSpeed)),e.pageX-t(document).scrollLeft()<o.scrollSensitivity?a=t(document).scrollLeft(t(document).scrollLeft()-o.scrollSpeed):t(window).width()-(e.pageX-t(document).scrollLeft())<o.scrollSensitivity&&(a=t(document).scrollLeft(t(document).scrollLeft()+o.scrollSpeed))),a!==!1&&t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(n=this.items[i],s=n.item[0],r=this._intersectsWithPointer(n),r&&n.instance===this.currentContainer&&s!==this.currentItem[0]&&this.placeholder[1===r?"next":"prev"]()[0]!==s&&!t.contains(this.placeholder[0],s)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],s):!0)){if(this.direction=1===r?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(n))break;this._rearrange(e,n),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var n=this,s=this.placeholder.offset(),r=this.options.axis,o={};r&&"x"!==r||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),r&&"y"!==r||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){n._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),n=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&n.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!n.length&&e.key&&n.push(e.key+"="),n.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),n=[];return e=e||{},i.each(function(){n.push(t(e.item||this).attr(e.attribute||"id")||"")}),n},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,n=this.positionAbs.top,s=n+this.helperProportions.height,r=t.left,o=r+t.width,a=t.top,l=a+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||n+h>a&&l>n+h,d="y"===this.options.axis||e+c>r&&o>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>r&&o>i-this.helperProportions.width/2&&n+this.helperProportions.height/2>a&&l>s-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),s=i&&n,r=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return s?this.floating?o&&"right"===o||"down"===r?2:1:r&&("down"===r?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),n=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),r=this._getDragHorizontalDirection();return this.floating&&r?"right"===r&&n||"left"===r&&!n:s&&("down"===s&&i||"up"===s&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,n,s,r,o=[],a=[],l=this._connectWith();if(l&&e)for(i=l.length-1;i>=0;i--)for(s=t(l[i]),n=s.length-1;n>=0;n--)r=t.data(s[n],this.widgetFullName),r&&r!==this&&!r.options.disabled&&a.push([t.isFunction(r.options.items)?r.options.items.call(r.element):t(r.options.items,r.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),r]);for(a.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=a.length-1;i>=0;i--)a[i][0].each(function(){o.push(this)});return t(o)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,n,s,r,o,a,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(s=t(d[i]),n=s.length-1;n>=0;n--)r=t.data(s[n],this.widgetFullName),r&&r!==this&&!r.options.disabled&&(u.push([t.isFunction(r.options.items)?r.options.items.call(r.element[0],e,{item:this.currentItem}):t(r.options.items,r.element),r]),this.containers.push(r));for(i=u.length-1;i>=0;i--)for(o=u[i][1],a=u[i][0],n=0,h=a.length;h>n;n++)l=t(a[n]),l.data(this.widgetName+"-item",o),c.push({item:l,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,n,s,r;for(i=this.items.length-1;i>=0;i--)n=this.items[i],n.instance!==this.currentContainer&&this.currentContainer&&n.item[0]!==this.currentItem[0]||(s=this.options.toleranceElement?t(this.options.toleranceElement,n.item):n.item,e||(n.width=s.outerWidth(),n.height=s.outerHeight()),r=s.offset(),n.left=r.left,n.top=r.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)r=this.containers[i].element.offset(),this.containers[i].containerCache.left=r.left,this.containers[i].containerCache.top=r.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,n=e.options;n.placeholder&&n.placeholder.constructor!==String||(i=n.placeholder,n.placeholder={element:function(){var n=e.currentItem[0].nodeName.toLowerCase(),s=t("<"+n+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===n?e.currentItem.children().each(function(){t("<td>&#160;</td>",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(s)}):"img"===n&&s.attr("src",e.currentItem.attr("src")),i||s.css("visibility","hidden"),s},update:function(t,s){(!i||n.forcePlaceholderSize)&&(s.height()||s.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),s.width()||s.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(n.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),n.placeholder.update(e,e.placeholder)},_contactContainers:function(n){var s,r,o,a,l,h,c,u,d,p,f=null,m=null;for(s=this.containers.length-1;s>=0;s--)if(!t.contains(this.currentItem[0],this.containers[s].element[0]))if(this._intersectsWith(this.containers[s].containerCache)){if(f&&t.contains(this.containers[s].element[0],f.element[0]))continue;f=this.containers[s],m=s}else this.containers[s].containerCache.over&&(this.containers[s]._trigger("out",n,this._uiHash(this)),this.containers[s].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",n,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(o=1e4,a=null,p=f.floating||i(this.currentItem),l=p?"left":"top",h=p?"width":"height",c=this.positionAbs[l]+this.offset.click[l],r=this.items.length-1;r>=0;r--)t.contains(this.containers[m].element[0],this.items[r].item[0])&&this.items[r].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[r].top,this.items[r].height))&&(u=this.items[r].item.offset()[l],d=!1,Math.abs(u-c)>Math.abs(u+this.items[r][h]-c)&&(d=!0,u+=this.items[r][h]),o>Math.abs(u-c)&&(o=Math.abs(u-c),a=this.items[r],this.direction=d?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;a?this._rearrange(n,a,null,!0):this._rearrange(n,null,this.containers[m].element,!0),this._trigger("change",n,this._uiHash()),this.containers[m]._trigger("change",n,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",n,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(e){var i=this.options,n=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return n.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(n[0]),n[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!n[0].style.width||i.forceHelperSize)&&n.width(this.currentItem.width()),(!n[0].style.height||i.forceHelperSize)&&n.height(this.currentItem.height()),n},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)
399
+ },_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,n,s=this.options;"parent"===s.containment&&(s.containment=this.helper[0].parentNode),("document"===s.containment||"window"===s.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===s.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===s.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(s.containment)||(e=t(s.containment)[0],i=t(s.containment).offset(),n="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(n?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(n?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var n="absolute"===e?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,r=/(html|body)/i.test(s[0].tagName);return{top:i.top+this.offset.relative.top*n+this.offset.parent.top*n-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():r?0:s.scrollTop())*n,left:i.left+this.offset.relative.left*n+this.offset.parent.left*n-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():r?0:s.scrollLeft())*n}},_generatePosition:function(e){var i,n,s=this.options,r=e.pageX,o=e.pageY,a="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(a[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left<this.containment[0]&&(r=this.containment[0]+this.offset.click.left),e.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),e.pageX-this.offset.click.left>this.containment[2]&&(r=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),s.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/s.grid[1])*s.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-s.grid[1]:i+s.grid[1]:i,n=this.originalPageX+Math.round((r-this.originalPageX)/s.grid[0])*s.grid[0],r=this.containment?n-this.offset.click.left>=this.containment[0]&&n-this.offset.click.left<=this.containment[2]?n:n-this.offset.click.left>=this.containment[0]?n-s.grid[0]:n+s.grid[0]:n)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:a.scrollTop()),left:r-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:a.scrollLeft())}},_rearrange:function(t,e,i,n){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var s=this.counter;this._delay(function(){s===this.counter&&this.refreshPositions(!n)})},_clear:function(t,e){this.reverting=!1;var i,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||n.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(n.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;n.length>i;i++)n[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;n.length>i;i++)n[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}(jQuery),function(t,e){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.dpDiv=n(t("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function n(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){t.datepicker._isDisabledDatepicker(r.inline?e.parent()[0]:r.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))})}function s(e,i){t.extend(e,i);for(var n in i)null==i[n]&&(e[n]=i[n]);return e}t.extend(t.ui,{datepicker:{version:"1.10.3"}});var r,o="datepicker";t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return s(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var n,s,r;n=e.nodeName.toLowerCase(),s="div"===n||"span"===n,e.id||(this.uuid+=1,e.id="dp"+this.uuid),r=this._newInst(t(e),s),r.settings=t.extend({},i||{}),"input"===n?this._connectDatepicker(e,r):s&&this._inlineDatepicker(e,r)},_newInst:function(e,i){var s=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:s,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?n(t("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(e,i){var n=t(e);i.append=t([]),i.trigger=t([]),n.hasClass(this.markerClassName)||(this._attachments(n,i),n.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,o,i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var n,s,r,o=this._get(i,"appendText"),a=this._get(i,"isRTL");i.append&&i.append.remove(),o&&(i.append=t("<span class='"+this._appendClass+"'>"+o+"</span>"),e[a?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),n=this._get(i,"showOn"),("focus"===n||"both"===n)&&e.focus(this._showDatepicker),("button"===n||"both"===n)&&(s=this._get(i,"buttonText"),r=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("<img/>").addClass(this._triggerClass).attr({src:r,alt:s,title:s}):t("<button type='button'></button>").addClass(this._triggerClass).html(r?t("<img/>").attr({src:r,alt:s,title:s}):s)),e[a?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,n,s,r=new Date(2009,11,20),o=this._get(t,"dateFormat");o.match(/[DM]/)&&(e=function(t){for(i=0,n=0,s=0;t.length>s;s++)t[s].length>i&&(i=t[s].length,n=s);return n},r.setMonth(e(this._get(t,o.match(/MM/)?"monthNames":"monthNamesShort"))),r.setDate(e(this._get(t,o.match(/DD/)?"dayNames":"dayNamesShort"))+20-r.getDay())),t.input.attr("size",this._formatDate(t,r).length)}},_inlineDatepicker:function(e,i){var n=t(e);n.hasClass(this.markerClassName)||(n.addClass(this.markerClassName).append(i.dpDiv),t.data(e,o,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,n,r,a){var l,h,c,u,d,p=this._dialogInst;return p||(this.uuid+=1,l="dp"+this.uuid,this._dialogInput=t("<input type='text' id='"+l+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},t.data(this._dialogInput[0],o,p)),s(p.settings,r||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=a?a.length?a:[a.pageX,a.pageY]:null,this._pos||(h=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[h/2-100+u,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=n,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],o,p),this},_destroyDatepicker:function(e){var i,n=t(e),s=t.data(e,o);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,o),"input"===i?(s.append.remove(),s.trigger.remove(),n.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&n.removeClass(this.markerClassName).empty())},_enableDatepicker:function(e){var i,n,s=t(e),r=t.data(e,o);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,r.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(n=s.children("."+this._inlineClass),n.children().removeClass("ui-state-disabled"),n.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,n,s=t(e),r=t.data(e,o);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,r.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(n=s.children("."+this._inlineClass),n.children().addClass("ui-state-disabled"),n.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,o)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,n,r){var o,a,l,h,c=this._getInst(i);return 2===arguments.length&&"string"==typeof n?"defaults"===n?t.extend({},t.datepicker._defaults):c?"all"===n?t.extend({},c.settings):this._get(c,n):null:(o=n||{},"string"==typeof n&&(o={},o[n]=r),c&&(this._curInst===c&&this._hideDatepicker(),a=this._getDateDatepicker(i,!0),l=this._getMinMaxDate(c,"min"),h=this._getMinMaxDate(c,"max"),s(c.settings,o),null!==l&&o.dateFormat!==e&&o.minDate===e&&(c.settings.minDate=this._formatDate(c,l)),null!==h&&o.dateFormat!==e&&o.maxDate===e&&(c.settings.maxDate=this._formatDate(c,h)),"disabled"in o&&(o.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(t(i),c),this._autoSize(c),this._setDate(c,a),this._updateAlternate(c),this._updateDatepicker(c)),e)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,n,s,r=t.datepicker._getInst(e.target),o=!0,a=r.dpDiv.is(".ui-datepicker-rtl");if(r._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),o=!1;break;case 13:return s=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",r.dpDiv),s[0]&&t.datepicker._selectDay(e.target,r.selectedMonth,r.selectedYear,s[0]),i=t.datepicker._get(r,"onSelect"),i?(n=t.datepicker._formatDate(r),i.apply(r.input?r.input[0]:null,[n,r])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(r,"stepBigMonths"):-t.datepicker._get(r,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(r,"stepBigMonths"):+t.datepicker._get(r,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),o=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),o=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,a?1:-1,"D"),o=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(r,"stepBigMonths"):-t.datepicker._get(r,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),o=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,a?-1:1,"D"),o=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(r,"stepBigMonths"):+t.datepicker._get(r,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),o=e.ctrlKey||e.metaKey;break;default:o=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):o=!1;o&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(i){var n,s,r=t.datepicker._getInst(i.target);return t.datepicker._get(r,"constrainInput")?(n=t.datepicker._possibleChars(t.datepicker._get(r,"dateFormat")),s=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">s||!n||n.indexOf(s)>-1):e},_doKeyUp:function(e){var i,n=t.datepicker._getInst(e.target);if(n.input.val()!==n.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(n,"dateFormat"),n.input?n.input.val():null,t.datepicker._getFormatConfig(n)),i&&(t.datepicker._setDateFromField(n),t.datepicker._updateAlternate(n),t.datepicker._updateDatepicker(n))}catch(s){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,n,r,o,a,l,h;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),n=t.datepicker._get(i,"beforeShow"),r=n?n.apply(e,[e,i]):{},r!==!1&&(s(i.settings,r),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),o=!1,t(e).parents().each(function(){return o|="fixed"===t(this).css("position"),!o}),a={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),a=t.datepicker._checkOffset(i,a,o),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":o?"fixed":"absolute",display:"none",left:a.left+"px",top:a.top+"px"}),i.inline||(l=t.datepicker._get(i,"showAnim"),h=t.datepicker._get(i,"duration"),i.dpDiv.zIndex(t(e).zIndex()+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[l]?i.dpDiv.show(l,t.datepicker._get(i,"showOptions"),h):i.dpDiv[l||"show"](l?h:null),t.datepicker._shouldFocusInput(i)&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,r=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,n=this._getNumberOfMonths(e),s=n[1],o=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),s>1&&e.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",o*s+"em"),e.dpDiv[(1!==n[0]||1!==n[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,n){var s=e.dpDiv.outerWidth(),r=e.dpDiv.outerHeight(),o=e.input?e.input.outerWidth():0,a=e.input?e.input.outerHeight():0,l=document.documentElement.clientWidth+(n?0:t(document).scrollLeft()),h=document.documentElement.clientHeight+(n?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?s-o:0,i.left-=n&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=n&&i.top===e.input.offset().top+a?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+s>l&&l>s?Math.abs(i.left+s-l):0),i.top-=Math.min(i.top,i.top+r>h&&h>r?Math.abs(r+a):0),i},_findPos:function(e){for(var i,n=this._getInst(e),s=this._get(n,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[s?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,n,s,r,a=this._curInst;!a||e&&a!==t.data(e,o)||this._datepickerShowing&&(i=this._get(a,"showAnim"),n=this._get(a,"duration"),s=function(){t.datepicker._tidyDialog(a)},t.effects&&(t.effects.effect[i]||t.effects[i])?a.dpDiv.hide(i,t.datepicker._get(a,"showOptions"),n,s):a.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?n:null,s),i||s(),this._datepickerShowing=!1,r=this._get(a,"onClose"),r&&r.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),n=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==n)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,n){var s=t(e),r=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(r,i+("M"===n?this._get(r,"showCurrentAtPos"):0),n),this._updateDatepicker(r))},_gotoToday:function(e){var i,n=t(e),s=this._getInst(n[0]);this._get(s,"gotoCurrent")&&s.currentDay?(s.selectedDay=s.currentDay,s.drawMonth=s.selectedMonth=s.currentMonth,s.drawYear=s.selectedYear=s.currentYear):(i=new Date,s.selectedDay=i.getDate(),s.drawMonth=s.selectedMonth=i.getMonth(),s.drawYear=s.selectedYear=i.getFullYear()),this._notifyChange(s),this._adjustDate(n)},_selectMonthYear:function(e,i,n){var s=t(e),r=this._getInst(s[0]);r["selected"+("M"===n?"Month":"Year")]=r["draw"+("M"===n?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(r),this._adjustDate(s)},_selectDay:function(e,i,n,s){var r,o=t(e);t(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(o[0])||(r=this._getInst(o[0]),r.selectedDay=r.currentDay=t("a",s).html(),r.selectedMonth=r.currentMonth=i,r.selectedYear=r.currentYear=n,this._selectDate(e,this._formatDate(r,r.currentDay,r.currentMonth,r.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var n,s=t(e),r=this._getInst(s[0]);i=null!=i?i:this._formatDate(r),r.input&&r.input.val(i),this._updateAlternate(r),n=this._get(r,"onSelect"),n?n.apply(r.input?r.input[0]:null,[i,r]):r.input&&r.input.trigger("change"),r.inline?this._updateDatepicker(r):(this._hideDatepicker(),this._lastInput=r.input[0],"object"!=typeof r.input[0]&&r.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,n,s,r=this._get(e,"altField");r&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),n=this._getDate(e),s=this.formatDate(i,n,this._getFormatConfig(e)),t(r).each(function(){t(this).val(s)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(i,n,s){if(null==i||null==n)throw"Invalid arguments";if(n="object"==typeof n?""+n:n+"",""===n)return null;var r,o,a,l,h=0,c=(s?s.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(s?s.dayNamesShort:null)||this._defaults.dayNamesShort,p=(s?s.dayNames:null)||this._defaults.dayNames,f=(s?s.monthNamesShort:null)||this._defaults.monthNamesShort,m=(s?s.monthNames:null)||this._defaults.monthNames,g=-1,v=-1,y=-1,b=-1,x=!1,w=function(t){var e=i.length>r+1&&i.charAt(r+1)===t;return e&&r++,e},k=function(t){var e=w(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,s=RegExp("^\\d{1,"+i+"}"),r=n.substring(h).match(s);if(!r)throw"Missing number at position "+h;return h+=r[0].length,parseInt(r[0],10)},_=function(i,s,r){var o=-1,a=t.map(w(i)?r:s,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(a,function(t,i){var s=i[1];return n.substr(h,s.length).toLowerCase()===s.toLowerCase()?(o=i[0],h+=s.length,!1):e}),-1!==o)return o+1;throw"Unknown name at position "+h},C=function(){if(n.charAt(h)!==i.charAt(r))throw"Unexpected literal at position "+h;h++};for(r=0;i.length>r;r++)if(x)"'"!==i.charAt(r)||w("'")?C():x=!1;else switch(i.charAt(r)){case"d":y=k("d");break;case"D":_("D",d,p);break;case"o":b=k("o");break;case"m":v=k("m");break;case"M":v=_("M",f,m);break;case"y":g=k("y");break;case"@":l=new Date(k("@")),g=l.getFullYear(),v=l.getMonth()+1,y=l.getDate();break;case"!":l=new Date((k("!")-this._ticksTo1970)/1e4),g=l.getFullYear(),v=l.getMonth()+1,y=l.getDate();break;case"'":w("'")?C():x=!0;break;default:C()}if(n.length>h&&(a=n.substr(h),!/^\s+/.test(a)))throw"Extra/unparsed characters found in date: "+a;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=g?0:-100)),b>-1)for(v=1,y=b;o=this._getDaysInMonth(g,v-1),!(o>=y);)v++,y-=o;if(l=this._daylightSavingAdjust(new Date(g,v-1,y)),l.getFullYear()!==g||l.getMonth()+1!==v||l.getDate()!==y)throw"Invalid date";return l},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:864e9*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var n,s=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,r=(i?i.dayNames:null)||this._defaults.dayNames,o=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,a=(i?i.monthNames:null)||this._defaults.monthNames,l=function(e){var i=t.length>n+1&&t.charAt(n+1)===e;return i&&n++,i},h=function(t,e,i){var n=""+e;if(l(t))for(;i>n.length;)n="0"+n;return n},c=function(t,e,i,n){return l(t)?n[e]:i[e]},u="",d=!1;if(e)for(n=0;t.length>n;n++)if(d)"'"!==t.charAt(n)||l("'")?u+=t.charAt(n):d=!1;else switch(t.charAt(n)){case"d":u+=h("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),s,r);break;case"o":u+=h("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=h("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),o,a);break;case"y":u+=l("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":l("'")?u+="'":d=!0;break;default:u+=t.charAt(n)}return u},_possibleChars:function(t){var e,i="",n=!1,s=function(i){var n=t.length>e+1&&t.charAt(e+1)===i;return n&&e++,n};for(e=0;t.length>e;e++)if(n)"'"!==t.charAt(e)||s("'")?i+=t.charAt(e):n=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":s("'")?i+="'":n=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,i){return t.settings[i]!==e?t.settings[i]:this._defaults[i]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),n=t.lastVal=t.input?t.input.val():null,s=this._getDefaultDate(t),r=s,o=this._getFormatConfig(t);try{r=this.parseDate(i,n,o)||s}catch(a){n=e?"":n}t.selectedDay=r.getDate(),t.drawMonth=t.selectedMonth=r.getMonth(),t.drawYear=t.selectedYear=r.getFullYear(),t.currentDay=n?r.getDate():0,t.currentMonth=n?r.getMonth():0,t.currentYear=n?r.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,n){var s=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},r=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(n){}for(var s=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,r=s.getFullYear(),o=s.getMonth(),a=s.getDate(),l=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,h=l.exec(i);h;){switch(h[2]||"d"){case"d":case"D":a+=parseInt(h[1],10);break;case"w":case"W":a+=7*parseInt(h[1],10);break;case"m":case"M":o+=parseInt(h[1],10),a=Math.min(a,t.datepicker._getDaysInMonth(r,o));break;case"y":case"Y":r+=parseInt(h[1],10),a=Math.min(a,t.datepicker._getDaysInMonth(r,o))}h=l.exec(i)}return new Date(r,o,a)},o=null==i||""===i?n:"string"==typeof i?r(i):"number"==typeof i?isNaN(i)?n:s(i):new Date(i.getTime());return o=o&&"Invalid Date"==""+o?n:o,o&&(o.setHours(0),o.setMinutes(0),o.setSeconds(0),o.setMilliseconds(0)),this._daylightSavingAdjust(o)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null
400
+ },_setDate:function(t,e,i){var n=!e,s=t.selectedMonth,r=t.selectedYear,o=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=o.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=o.getMonth(),t.drawYear=t.selectedYear=t.currentYear=o.getFullYear(),s===t.selectedMonth&&r===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(n?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),n="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(n,-i,"M")},next:function(){t.datepicker._adjustDate(n,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(n)},selectDay:function(){return t.datepicker._selectDay(n,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(n,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(n,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,n,s,r,o,a,l,h,c,u,d,p,f,m,g,v,y,b,x,w,k,_,C,D,M,S,T,A,E,F,I,L,N,$,z,P,O,H,W=new Date,R=this._daylightSavingAdjust(new Date(W.getFullYear(),W.getMonth(),W.getDate())),j=this._get(t,"isRTL"),B=this._get(t,"showButtonPanel"),Y=this._get(t,"hideIfNoPrevNext"),V=this._get(t,"navigationAsDateFormat"),U=this._getNumberOfMonths(t),G=this._get(t,"showCurrentAtPos"),q=this._get(t,"stepMonths"),X=1!==U[0]||1!==U[1],K=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),J=this._getMinMaxDate(t,"min"),Z=this._getMinMaxDate(t,"max"),Q=t.drawMonth-G,te=t.drawYear;if(0>Q&&(Q+=12,te--),Z)for(e=this._daylightSavingAdjust(new Date(Z.getFullYear(),Z.getMonth()-U[0]*U[1]+1,Z.getDate())),e=J&&J>e?J:e;this._daylightSavingAdjust(new Date(te,Q,1))>e;)Q--,0>Q&&(Q=11,te--);for(t.drawMonth=Q,t.drawYear=te,i=this._get(t,"prevText"),i=V?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Q-q,1)),this._getFormatConfig(t)):i,n=this._canAdjustMonth(t,-1,te,Q)?"<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(j?"e":"w")+"'>"+i+"</span></a>":Y?"":"<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='"+i+"'><span class='ui-icon ui-icon-circle-triangle-"+(j?"e":"w")+"'>"+i+"</span></a>",s=this._get(t,"nextText"),s=V?this.formatDate(s,this._daylightSavingAdjust(new Date(te,Q+q,1)),this._getFormatConfig(t)):s,r=this._canAdjustMonth(t,1,te,Q)?"<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(j?"w":"e")+"'>"+s+"</span></a>":Y?"":"<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='"+s+"'><span class='ui-icon ui-icon-circle-triangle-"+(j?"w":"e")+"'>"+s+"</span></a>",o=this._get(t,"currentText"),a=this._get(t,"gotoCurrent")&&t.currentDay?K:R,o=V?this.formatDate(o,a,this._getFormatConfig(t)):o,l=t.inline?"":"<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>"+this._get(t,"closeText")+"</button>",h=B?"<div class='ui-datepicker-buttonpane ui-widget-content'>"+(j?l:"")+(this._isInRange(t,a)?"<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'>"+o+"</button>":"")+(j?"":l)+"</div>":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),m=this._get(t,"monthNamesShort"),g=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),y=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),x="",k=0;U[0]>k;k++){for(_="",this.maxRows=4,C=0;U[1]>C;C++){if(D=this._daylightSavingAdjust(new Date(te,Q,t.selectedDay)),M=" ui-corner-all",S="",X){if(S+="<div class='ui-datepicker-group",U[1]>1)switch(C){case 0:S+=" ui-datepicker-group-first",M=" ui-corner-"+(j?"right":"left");break;case U[1]-1:S+=" ui-datepicker-group-last",M=" ui-corner-"+(j?"left":"right");break;default:S+=" ui-datepicker-group-middle",M=""}S+="'>"}for(S+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+M+"'>"+(/all|left/.test(M)&&0===k?j?r:n:"")+(/all|right/.test(M)&&0===k?j?n:r:"")+this._generateMonthYearHeader(t,Q,te,J,Z,k>0||C>0,f,m)+"</div><table class='ui-datepicker-calendar'><thead>"+"<tr>",T=u?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",w=0;7>w;w++)A=(w+c)%7,T+="<th"+((w+c+6)%7>=5?" class='ui-datepicker-week-end'":"")+">"+"<span title='"+d[A]+"'>"+p[A]+"</span></th>";for(S+=T+"</tr></thead><tbody>",E=this._getDaysInMonth(te,Q),te===t.selectedYear&&Q===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,E)),F=(this._getFirstDayOfMonth(te,Q)-c+7)%7,I=Math.ceil((F+E)/7),L=X?this.maxRows>I?this.maxRows:I:I,this.maxRows=L,N=this._daylightSavingAdjust(new Date(te,Q,1-F)),$=0;L>$;$++){for(S+="<tr>",z=u?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(N)+"</td>":"",w=0;7>w;w++)P=g?g.apply(t.input?t.input[0]:null,[N]):[!0,""],O=N.getMonth()!==Q,H=O&&!y||!P[0]||J&&J>N||Z&&N>Z,z+="<td class='"+((w+c+6)%7>=5?" ui-datepicker-week-end":"")+(O?" ui-datepicker-other-month":"")+(N.getTime()===D.getTime()&&Q===t.selectedMonth&&t._keyEvent||b.getTime()===N.getTime()&&b.getTime()===D.getTime()?" "+this._dayOverClass:"")+(H?" "+this._unselectableClass+" ui-state-disabled":"")+(O&&!v?"":" "+P[1]+(N.getTime()===K.getTime()?" "+this._currentClass:"")+(N.getTime()===R.getTime()?" ui-datepicker-today":""))+"'"+(O&&!v||!P[2]?"":" title='"+P[2].replace(/'/g,"&#39;")+"'")+(H?"":" data-handler='selectDay' data-event='click' data-month='"+N.getMonth()+"' data-year='"+N.getFullYear()+"'")+">"+(O&&!v?"&#xa0;":H?"<span class='ui-state-default'>"+N.getDate()+"</span>":"<a class='ui-state-default"+(N.getTime()===R.getTime()?" ui-state-highlight":"")+(N.getTime()===K.getTime()?" ui-state-active":"")+(O?" ui-priority-secondary":"")+"' href='#'>"+N.getDate()+"</a>")+"</td>",N.setDate(N.getDate()+1),N=this._daylightSavingAdjust(N);S+=z+"</tr>"}Q++,Q>11&&(Q=0,te++),S+="</tbody></table>"+(X?"</div>"+(U[0]>0&&C===U[1]-1?"<div class='ui-datepicker-row-break'></div>":""):""),_+=S}x+=_}return x+=h,t._keyEvent=!1,x},_generateMonthYearHeader:function(t,e,i,n,s,r,o,a){var l,h,c,u,d,p,f,m,g=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),y=this._get(t,"showMonthAfterYear"),b="<div class='ui-datepicker-title'>",x="";if(r||!g)x+="<span class='ui-datepicker-month'>"+o[e]+"</span>";else{for(l=n&&n.getFullYear()===i,h=s&&s.getFullYear()===i,x+="<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>",c=0;12>c;c++)(!l||c>=n.getMonth())&&(!h||s.getMonth()>=c)&&(x+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+a[c]+"</option>");x+="</select>"}if(y||(b+=x+(!r&&g&&v?"":"&#xa0;")),!t.yearshtml)if(t.yearshtml="",r||!v)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10);return isNaN(e)?d:e},f=p(u[0]),m=Math.max(f,p(u[1]||"")),f=n?Math.max(f,n.getFullYear()):f,m=s?Math.min(m,s.getFullYear()):m,t.yearshtml+="<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";m>=f;f++)t.yearshtml+="<option value='"+f+"'"+(f===i?" selected='selected'":"")+">"+f+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),y&&(b+=(!r&&g&&v?"":"&#xa0;")+x),b+="</div>"},_adjustInstDate:function(t,e,i){var n=t.drawYear+("Y"===i?e:0),s=t.drawMonth+("M"===i?e:0),r=Math.min(t.selectedDay,this._getDaysInMonth(n,s))+("D"===i?e:0),o=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(n,s,r)));t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),n=this._getMinMaxDate(t,"max"),s=i&&i>e?i:e;return n&&s>n?n:s},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,n){var s=this._getNumberOfMonths(t),r=this._daylightSavingAdjust(new Date(i,n+(0>e?e:s[0]*s[1]),1));return 0>e&&r.setDate(this._getDaysInMonth(r.getFullYear(),r.getMonth())),this._isInRange(t,r)},_isInRange:function(t,e){var i,n,s=this._getMinMaxDate(t,"min"),r=this._getMinMaxDate(t,"max"),o=null,a=null,l=this._get(t,"yearRange");return l&&(i=l.split(":"),n=(new Date).getFullYear(),o=parseInt(i[0],10),a=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(o+=n),i[1].match(/[+\-].*/)&&(a+=n)),(!s||e.getTime()>=s.getTime())&&(!r||e.getTime()<=r.getTime())&&(!o||e.getFullYear()>=o)&&(!a||a>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,n){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var s=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(n,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),s,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.10.3"}(jQuery),function(t){var e=5;t.widget("ui.slider",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"),this._refresh(),this._setOption("disabled",this.options.disabled),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var e,i,n=this.options,s=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),r="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",o=[];for(i=n.values&&n.values.length||1,s.length>i&&(s.slice(i).remove(),s=s.slice(0,i)),e=s.length;i>e;e++)o.push(r);this.handles=s.add(t(o.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.each(function(e){t(this).data("ui-slider-handle-index",e)})},_createRange:function(){var e=this.options,i="";e.range?(e.range===!0&&(e.values?e.values.length&&2!==e.values.length?e.values=[e.values[0],e.values[0]]:t.isArray(e.values)&&(e.values=e.values.slice(0)):e.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?this.range.removeClass("ui-slider-range-min ui-slider-range-max").css({left:"",bottom:""}):(this.range=t("<div></div>").appendTo(this.element),i="ui-slider-range ui-widget-header ui-corner-all"),this.range.addClass(i+("min"===e.range||"max"===e.range?" ui-slider-range-"+e.range:""))):this.range=t([])},_setupEvents:function(){var t=this.handles.add(this.range).filter("a");this._off(t),this._on(t,this._handleEvents),this._hoverable(t),this._focusable(t)},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(e){var i,n,s,r,o,a,l,h,c=this,u=this.options;return u.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),i={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(i),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(e){var i=Math.abs(n-c.values(e));(s>i||s===i&&(e===c._lastChangedValue||c.values(e)===u.min))&&(s=i,r=t(this),o=e)}),a=this._start(e,o),a===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,r.addClass("ui-state-active").focus(),l=r.offset(),h=!t(e.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=h?{left:0,top:0}:{left:e.pageX-l.left-r.width()/2,top:e.pageY-l.top-r.height()/2-(parseInt(r.css("borderTopWidth"),10)||0)-(parseInt(r.css("borderBottomWidth"),10)||0)+(parseInt(r.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(e,o,n),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,i),!1},_mouseStop:function(t){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,i,n,s,r;return"horizontal"===this.orientation?(e=this.elementSize.width,i=t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,i=t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),n=i/e,n>1&&(n=1),0>n&&(n=0),"vertical"===this.orientation&&(n=1-n),s=this._valueMax()-this._valueMin(),r=this._valueMin()+n*s,this._trimAlignValue(r)},_start:function(t,e){var i={handle:this.handles[e],value:this.value()};return this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("start",t,i)},_slide:function(t,e,i){var n,s,r;this.options.values&&this.options.values.length?(n=this.values(e?0:1),2===this.options.values.length&&this.options.range===!0&&(0===e&&i>n||1===e&&n>i)&&(i=n),i!==this.values(e)&&(s=this.values(),s[e]=i,r=this._trigger("slide",t,{handle:this.handles[e],value:i,values:s}),n=this.values(e?0:1),r!==!1&&this.values(e,i,!0))):i!==this.value()&&(r=this._trigger("slide",t,{handle:this.handles[e],value:i}),r!==!1&&this.value(i))},_stop:function(t,e){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._trigger("stop",t,i)},_change:function(t,e){if(!this._keySliding&&!this._mouseSliding){var i={handle:this.handles[e],value:this.value()};this.options.values&&this.options.values.length&&(i.value=this.values(e),i.values=this.values()),this._lastChangedValue=e,this._trigger("change",t,i)}},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),this._change(null,0),void 0):this._value()},values:function(e,i){var n,s,r;if(arguments.length>1)return this.options.values[e]=this._trimAlignValue(i),this._refreshValue(),this._change(null,e),void 0;if(!arguments.length)return this._values();if(!t.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(e):this.value();for(n=this.options.values,s=arguments[0],r=0;n.length>r;r+=1)n[r]=this._trimAlignValue(s[r]),this._change(null,r);this._refreshValue()},_setOption:function(e,i){var n,s=0;switch("range"===e&&this.options.range===!0&&("min"===i?(this.options.value=this._values(0),this.options.values=null):"max"===i&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),t.isArray(this.options.values)&&(s=this.options.values.length),t.Widget.prototype._setOption.apply(this,arguments),e){case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),n=0;s>n;n+=1)this._change(null,n);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i,n;if(arguments.length)return e=this.options.values[t],e=this._trimAlignValue(e);if(this.options.values&&this.options.values.length){for(i=this.options.values.slice(),n=0;i.length>n;n+=1)i[n]=this._trimAlignValue(i[n]);return i}return[]},_trimAlignValue:function(t){if(this._valueMin()>=t)return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=this.options.step>0?this.options.step:1,i=(t-this._valueMin())%e,n=t-i;return 2*Math.abs(i)>=e&&(n+=i>0?e:-e),parseFloat(n.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var e,i,n,s,r,o=this.options.range,a=this.options,l=this,h=this._animateOff?!1:a.animate,c={};this.options.values&&this.options.values.length?this.handles.each(function(n){i=100*((l.values(n)-l._valueMin())/(l._valueMax()-l._valueMin())),c["horizontal"===l.orientation?"left":"bottom"]=i+"%",t(this).stop(1,1)[h?"animate":"css"](c,a.animate),l.options.range===!0&&("horizontal"===l.orientation?(0===n&&l.range.stop(1,1)[h?"animate":"css"]({left:i+"%"},a.animate),1===n&&l.range[h?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:a.animate})):(0===n&&l.range.stop(1,1)[h?"animate":"css"]({bottom:i+"%"},a.animate),1===n&&l.range[h?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:a.animate}))),e=i}):(n=this.value(),s=this._valueMin(),r=this._valueMax(),i=r!==s?100*((n-s)/(r-s)):0,c["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[h?"animate":"css"](c,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range[h?"animate":"css"]({width:100-i+"%"},{queue:!1,duration:a.animate}),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[h?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range[h?"animate":"css"]({height:100-i+"%"},{queue:!1,duration:a.animate}))},_handleEvents:{keydown:function(i){var n,s,r,o,a=t(i.target).data("ui-slider-handle-index");switch(i.keyCode){case t.ui.keyCode.HOME:case t.ui.keyCode.END:case t.ui.keyCode.PAGE_UP:case t.ui.keyCode.PAGE_DOWN:case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(i.preventDefault(),!this._keySliding&&(this._keySliding=!0,t(i.target).addClass("ui-state-active"),n=this._start(i,a),n===!1))return}switch(o=this.options.step,s=r=this.options.values&&this.options.values.length?this.values(a):this.value(),i.keyCode){case t.ui.keyCode.HOME:r=this._valueMin();break;case t.ui.keyCode.END:r=this._valueMax();break;case t.ui.keyCode.PAGE_UP:r=this._trimAlignValue(s+(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.PAGE_DOWN:r=this._trimAlignValue(s-(this._valueMax()-this._valueMin())/e);break;case t.ui.keyCode.UP:case t.ui.keyCode.RIGHT:if(s===this._valueMax())return;r=this._trimAlignValue(s+o);break;case t.ui.keyCode.DOWN:case t.ui.keyCode.LEFT:if(s===this._valueMin())return;r=this._trimAlignValue(s-o)}this._slide(i,a,r)},click:function(t){t.preventDefault()},keyup:function(e){var i=t(e.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(e,i),this._change(e,i),t(e.target).removeClass("ui-state-active"))}}})}(jQuery),define("jquery-ui",["jquery"],function(){}),function($){if($.ui.timepicker=$.ui.timepicker||{},!$.ui.timepicker.version){$.extend($.ui,{timepicker:{version:"@@version"}});var Timepicker=function(){this.regional=[],this.regional[""]={currentText:"Now",closeText:"Done",amNames:["AM","A"],pmNames:["PM","P"],timeFormat:"HH:mm",timeSuffix:"",timeOnlyTitle:"Choose Time",timeText:"Time",hourText:"Hour",minuteText:"Minute",secondText:"Second",millisecText:"Millisecond",microsecText:"Microsecond",timezoneText:"Time Zone",isRTL:!1},this._defaults={showButtonPanel:!0,timeOnly:!1,showHour:null,showMinute:null,showSecond:null,showMillisec:null,showMicrosec:null,showTimezone:null,showTime:!0,stepHour:1,stepMinute:1,stepSecond:1,stepMillisec:1,stepMicrosec:1,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMin:0,minuteMin:0,secondMin:0,millisecMin:0,microsecMin:0,hourMax:23,minuteMax:59,secondMax:59,millisecMax:999,microsecMax:999,minDateTime:null,maxDateTime:null,onSelect:null,hourGrid:0,minuteGrid:0,secondGrid:0,millisecGrid:0,microsecGrid:0,alwaysSetTime:!0,separator:" ",altFieldTimeOnly:!0,altTimeFormat:null,altSeparator:null,altTimeSuffix:null,pickerTimeFormat:null,pickerTimeSuffix:null,showTimepicker:!0,timezoneList:null,addSliderAccess:!1,sliderAccessArgs:null,controlType:"slider",defaultValue:null,parse:"strict",ls_now:!1},$.extend(this._defaults,this.regional[""])};$.extend(Timepicker.prototype,{$input:null,$altInput:null,$timeObj:null,inst:null,hour_slider:null,minute_slider:null,second_slider:null,millisec_slider:null,microsec_slider:null,timezone_select:null,hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null,hourMinOriginal:null,minuteMinOriginal:null,secondMinOriginal:null,millisecMinOriginal:null,microsecMinOriginal:null,hourMaxOriginal:null,minuteMaxOriginal:null,secondMaxOriginal:null,millisecMaxOriginal:null,microsecMaxOriginal:null,ampm:"",formattedDate:"",formattedTime:"",formattedDateTime:"",timezoneList:null,units:["hour","minute","second","millisec","microsec"],support:{},control:null,ls_now:!1,setDefaults:function(t){return extendRemove(this._defaults,t||{}),this},_newInst:function($input,opts){var tp_inst=new Timepicker,inlineSettings={},fns={},overrides,i;for(var attrName in this._defaults)if(this._defaults.hasOwnProperty(attrName)){var attrValue=$input.attr("time:"+attrName);if(attrValue)try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}overrides={beforeShow:function(t,e){return tp_inst.ls_now="now"===tp_inst.$input.val()?!0:!1,$.isFunction(tp_inst._defaults.evnts.beforeShow)?tp_inst._defaults.evnts.beforeShow.call($input[0],t,e,tp_inst):void 0},onChangeMonthYear:function(t,e,i){tp_inst.ls_now=!1,tp_inst._updateDateTime(i),$.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)&&tp_inst._defaults.evnts.onChangeMonthYear.call($input[0],t,e,i,tp_inst)},onClose:function(t,e){tp_inst.timeDefined===!0&&""!==$input.val()&&tp_inst._updateDateTime(e),$.isFunction(tp_inst._defaults.evnts.onClose)&&tp_inst._defaults.evnts.onClose.call($input[0],t,e,tp_inst)}};for(i in overrides)overrides.hasOwnProperty(i)&&(fns[i]=opts[i]||null);tp_inst._defaults=$.extend({},this._defaults,inlineSettings,opts,overrides,{evnts:fns,timepicker:tp_inst}),tp_inst.amNames=$.map(tp_inst._defaults.amNames,function(t){return t.toUpperCase()}),tp_inst.pmNames=$.map(tp_inst._defaults.pmNames,function(t){return t.toUpperCase()}),tp_inst.support=detectSupport(tp_inst._defaults.timeFormat+(tp_inst._defaults.pickerTimeFormat?tp_inst._defaults.pickerTimeFormat:"")+(tp_inst._defaults.altTimeFormat?tp_inst._defaults.altTimeFormat:"")),"string"==typeof tp_inst._defaults.controlType?("slider"===tp_inst._defaults.controlType&&"undefined"==typeof $.ui.slider&&(tp_inst._defaults.controlType="select"),tp_inst.control=tp_inst._controls[tp_inst._defaults.controlType]):tp_inst.control=tp_inst._defaults.controlType;var timezoneList=[-720,-660,-600,-570,-540,-480,-420,-360,-300,-270,-240,-210,-180,-120,-60,0,60,120,180,210,240,270,300,330,345,360,390,420,480,525,540,570,600,630,660,690,720,765,780,840];null!==tp_inst._defaults.timezoneList&&(timezoneList=tp_inst._defaults.timezoneList);var tzl=timezoneList.length,tzi=0,tzv=null;if(tzl>0&&"object"!=typeof timezoneList[0])for(;tzl>tzi;tzi++)tzv=timezoneList[tzi],timezoneList[tzi]={value:tzv,label:$.timepicker.timezoneOffsetString(tzv,tp_inst.support.iso8601)};return tp_inst._defaults.timezoneList=timezoneList,tp_inst.timezone=null!==tp_inst._defaults.timezone?$.timepicker.timezoneOffsetNumber(tp_inst._defaults.timezone):-1*(new Date).getTimezoneOffset(),tp_inst.hour=tp_inst._defaults.hour<tp_inst._defaults.hourMin?tp_inst._defaults.hourMin:tp_inst._defaults.hour>tp_inst._defaults.hourMax?tp_inst._defaults.hourMax:tp_inst._defaults.hour,tp_inst.minute=tp_inst._defaults.minute<tp_inst._defaults.minuteMin?tp_inst._defaults.minuteMin:tp_inst._defaults.minute>tp_inst._defaults.minuteMax?tp_inst._defaults.minuteMax:tp_inst._defaults.minute,tp_inst.second=tp_inst._defaults.second<tp_inst._defaults.secondMin?tp_inst._defaults.secondMin:tp_inst._defaults.second>tp_inst._defaults.secondMax?tp_inst._defaults.secondMax:tp_inst._defaults.second,tp_inst.millisec=tp_inst._defaults.millisec<tp_inst._defaults.millisecMin?tp_inst._defaults.millisecMin:tp_inst._defaults.millisec>tp_inst._defaults.millisecMax?tp_inst._defaults.millisecMax:tp_inst._defaults.millisec,tp_inst.microsec=tp_inst._defaults.microsec<tp_inst._defaults.microsecMin?tp_inst._defaults.microsecMin:tp_inst._defaults.microsec>tp_inst._defaults.microsecMax?tp_inst._defaults.microsecMax:tp_inst._defaults.microsec,tp_inst.ampm="",tp_inst.$input=$input,tp_inst._defaults.altField&&(tp_inst.$altInput=$(tp_inst._defaults.altField).css({cursor:"pointer"}).focus(function(){$input.trigger("focus")})),(0===tp_inst._defaults.minDate||0===tp_inst._defaults.minDateTime)&&(tp_inst._defaults.minDate=new Date),(0===tp_inst._defaults.maxDate||0===tp_inst._defaults.maxDateTime)&&(tp_inst._defaults.maxDate=new Date),void 0!==tp_inst._defaults.minDate&&tp_inst._defaults.minDate instanceof Date&&(tp_inst._defaults.minDateTime=new Date(tp_inst._defaults.minDate.getTime())),void 0!==tp_inst._defaults.minDateTime&&tp_inst._defaults.minDateTime instanceof Date&&(tp_inst._defaults.minDate=new Date(tp_inst._defaults.minDateTime.getTime())),void 0!==tp_inst._defaults.maxDate&&tp_inst._defaults.maxDate instanceof Date&&(tp_inst._defaults.maxDateTime=new Date(tp_inst._defaults.maxDate.getTime())),void 0!==tp_inst._defaults.maxDateTime&&tp_inst._defaults.maxDateTime instanceof Date&&(tp_inst._defaults.maxDate=new Date(tp_inst._defaults.maxDateTime.getTime())),tp_inst.$input.bind("focus",function(){}),tp_inst},_addTimePicker:function(t){var e=this.$altInput&&this._defaults.altFieldTimeOnly?this.$input.val()+" "+this.$altInput.val():this.$input.val();this.timeDefined=this._parseTime(e),this._limitMinMaxDateTime(t,!1),this._injectTimePicker()},_parseTime:function(t,e){if(this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),e||!this._defaults.timeOnly){var i=$.datepicker._get(this.inst,"dateFormat");try{}catch(n){return $.timepicker.log("Error parsing the date/time string: "+n+"\ndate/time string = "+t+"\ntimeFormat = "+this._defaults.timeFormat+"\ndateFormat = "+i),!1}return!0}var s=$.datepicker.parseTime(this._defaults.timeFormat,t,this._defaults);return s?($.extend(this,s),!0):!1},_injectTimePicker:function(){var t=this.inst.dpDiv,e=this.inst.settings,i=this,n="",s="",r=null,o={},a={},l=null,h=0,c=0;if(0===t.find("div.ui-timepicker-div").length&&e.showTimepicker){var u=' style="display:none;"',d='<div class="ui-timepicker-div'+(e.isRTL?" ui-timepicker-rtl":"")+'"><dl>'+'<dt class="ui_tpicker_time_label"'+(e.showTime?"":u)+">"+e.timeText+"</dt>"+'<dd class="ui_tpicker_time"'+(e.showTime?"":u)+"></dd>";for(h=0,c=this.units.length;c>h;h++){if(n=this.units[h],s=n.substr(0,1).toUpperCase()+n.substr(1),r=null!==e["show"+s]?e["show"+s]:this.support[n],o[n]=parseInt(e[n+"Max"]-(e[n+"Max"]-e[n+"Min"])%e["step"+s],10),a[n]=0,d+='<dt class="ui_tpicker_'+n+'_label"'+(r?"":u)+">"+e[n+"Text"]+"</dt>"+'<dd class="ui_tpicker_'+n+'"><div class="ui_tpicker_'+n+'_slider"'+(r?"":u)+"></div>",r&&e[n+"Grid"]>0){if(d+='<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>',"hour"===n)for(var p=e[n+"Min"];p<=o[n];p+=parseInt(e[n+"Grid"],10)){a[n]++;var f=$.datepicker.formatTime(this.support.ampm?"hht":"HH",{hour:p},e);d+='<td data-for="'+n+'">'+f+"</td>"}else for(var m=e[n+"Min"];m<=o[n];m+=parseInt(e[n+"Grid"],10))a[n]++,d+='<td data-for="'+n+'">'+(10>m?"0":"")+m+"</td>";d+="</tr></table></div>"}d+="</dd>"}var g=null!==e.showTimezone?e.showTimezone:this.support.timezone;d+='<dt class="ui_tpicker_timezone_label"'+(g?"":u)+">"+e.timezoneText+"</dt>",d+='<dd class="ui_tpicker_timezone" '+(g?"":u)+"></dd>",d+="</dl></div>";var v=$(d);for(e.timeOnly===!0&&(v.prepend('<div class="ui-widget-header ui-helper-clearfix ui-corner-all"><div class="ui-datepicker-title">'+e.timeOnlyTitle+"</div>"+"</div>"),t.find(".ui-datepicker-header, .ui-datepicker-calendar").hide()),h=0,c=i.units.length;c>h;h++)n=i.units[h],s=n.substr(0,1).toUpperCase()+n.substr(1),r=null!==e["show"+s]?e["show"+s]:this.support[n],i[n+"_slider"]=i.control.create(i,v.find(".ui_tpicker_"+n+"_slider"),n,i[n],e[n+"Min"],o[n],e["step"+s]),r&&e[n+"Grid"]>0&&(l=100*a[n]*e[n+"Grid"]/(o[n]-e[n+"Min"]),v.find(".ui_tpicker_"+n+" table").css({width:l+"%",marginLeft:e.isRTL?"0":l/(-2*a[n])+"%",marginRight:e.isRTL?l/(-2*a[n])+"%":"0",borderCollapse:"collapse"}).find("td").click(function(){var t=$(this),e=t.html(),s=parseInt(e.replace(/[^0-9]/g),10),r=e.replace(/[^apm]/gi),o=t.data("for");"hour"===o&&(-1!==r.indexOf("p")&&12>s?s+=12:-1!==r.indexOf("a")&&12===s&&(s=0)),i.control.value(i,i[o+"_slider"],n,s),i._onTimeChange(),i._onSelectHandler()}).css({cursor:"pointer",width:100/a[n]+"%",textAlign:"center",overflow:"hidden"}));if(this.timezone_select=v.find(".ui_tpicker_timezone").append("<select></select>").find("select"),$.fn.append.apply(this.timezone_select,$.map(e.timezoneList,function(t){return $("<option />").val("object"==typeof t?t.value:t).text("object"==typeof t?t.label:t)})),"undefined"!=typeof this.timezone&&null!==this.timezone&&""!==this.timezone){var y=-1*new Date(this.inst.selectedYear,this.inst.selectedMonth,this.inst.selectedDay,12).getTimezoneOffset();y===this.timezone?selectLocalTimezone(i):this.timezone_select.val(this.timezone)}else"undefined"!=typeof this.hour&&null!==this.hour&&""!==this.hour?this.timezone_select.val(e.timezone):selectLocalTimezone(i);this.timezone_select.change(function(){i._onTimeChange(),i._onSelectHandler()});var b=t.find(".ui-datepicker-buttonpane");if(b.length?b.before(v):t.append(v),this.$timeObj=v.find(".ui_tpicker_time"),null!==this.inst){var x=this.timeDefined;
401
+ this._onTimeChange(),this.timeDefined=x}if(this._defaults.addSliderAccess){var w=this._defaults.sliderAccessArgs,k=this._defaults.isRTL;w.isRTL=k,setTimeout(function(){if(0===v.find(".ui-slider-access").length){v.find(".ui-slider:visible").sliderAccess(w);var t=v.find(".ui-slider-access:eq(0)").outerWidth(!0);t&&v.find("table:visible").each(function(){var e=$(this),i=e.outerWidth(),n=e.css(k?"marginRight":"marginLeft").toString().replace("%",""),s=i-t,r=n*s/i+"%",o={width:s,marginRight:0,marginLeft:0};o[k?"marginRight":"marginLeft"]=r,e.css(o)})}},10)}i._limitMinMaxDateTime(this.inst,!0)}},_limitMinMaxDateTime:function(t,e){var i=this._defaults,n=new Date(t.selectedYear,t.selectedMonth,t.selectedDay);if(this._defaults.showTimepicker){if(null!==$.datepicker._get(t,"minDateTime")&&void 0!==$.datepicker._get(t,"minDateTime")&&n){var s=$.datepicker._get(t,"minDateTime"),r=new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0);(null===this.hourMinOriginal||null===this.minuteMinOriginal||null===this.secondMinOriginal||null===this.millisecMinOriginal||null===this.microsecMinOriginal)&&(this.hourMinOriginal=i.hourMin,this.minuteMinOriginal=i.minuteMin,this.secondMinOriginal=i.secondMin,this.millisecMinOriginal=i.millisecMin,this.microsecMinOriginal=i.microsecMin),t.settings.timeOnly||r.getTime()===n.getTime()?(this._defaults.hourMin=s.getHours(),this.hour<=this._defaults.hourMin?(this.hour=this._defaults.hourMin,this._defaults.minuteMin=s.getMinutes(),this.minute<=this._defaults.minuteMin?(this.minute=this._defaults.minuteMin,this._defaults.secondMin=s.getSeconds(),this.second<=this._defaults.secondMin?(this.second=this._defaults.secondMin,this._defaults.millisecMin=s.getMilliseconds(),this.millisec<=this._defaults.millisecMin?(this.millisec=this._defaults.millisecMin,this._defaults.microsecMin=s.getMicroseconds()):(this.microsec<this._defaults.microsecMin&&(this.microsec=this._defaults.microsecMin),this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)):(this._defaults.hourMin=this.hourMinOriginal,this._defaults.minuteMin=this.minuteMinOriginal,this._defaults.secondMin=this.secondMinOriginal,this._defaults.millisecMin=this.millisecMinOriginal,this._defaults.microsecMin=this.microsecMinOriginal)}if(null!==$.datepicker._get(t,"maxDateTime")&&void 0!==$.datepicker._get(t,"maxDateTime")&&n){var o=$.datepicker._get(t,"maxDateTime"),a=new Date(o.getFullYear(),o.getMonth(),o.getDate(),0,0,0,0);(null===this.hourMaxOriginal||null===this.minuteMaxOriginal||null===this.secondMaxOriginal||null===this.millisecMaxOriginal)&&(this.hourMaxOriginal=i.hourMax,this.minuteMaxOriginal=i.minuteMax,this.secondMaxOriginal=i.secondMax,this.millisecMaxOriginal=i.millisecMax,this.microsecMaxOriginal=i.microsecMax),t.settings.timeOnly||a.getTime()===n.getTime()?(this._defaults.hourMax=o.getHours(),this.hour>=this._defaults.hourMax?(this.hour=this._defaults.hourMax,this._defaults.minuteMax=o.getMinutes(),this.minute>=this._defaults.minuteMax?(this.minute=this._defaults.minuteMax,this._defaults.secondMax=o.getSeconds(),this.second>=this._defaults.secondMax?(this.second=this._defaults.secondMax,this._defaults.millisecMax=o.getMilliseconds(),this.millisec>=this._defaults.millisecMax?(this.millisec=this._defaults.millisecMax,this._defaults.microsecMax=o.getMicroseconds()):(this.microsec>this._defaults.microsecMax&&(this.microsec=this._defaults.microsecMax),this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)):(this._defaults.hourMax=this.hourMaxOriginal,this._defaults.minuteMax=this.minuteMaxOriginal,this._defaults.secondMax=this.secondMaxOriginal,this._defaults.millisecMax=this.millisecMaxOriginal,this._defaults.microsecMax=this.microsecMaxOriginal)}if(void 0!==e&&e===!0){var l=parseInt(this._defaults.hourMax-(this._defaults.hourMax-this._defaults.hourMin)%this._defaults.stepHour,10),h=parseInt(this._defaults.minuteMax-(this._defaults.minuteMax-this._defaults.minuteMin)%this._defaults.stepMinute,10),c=parseInt(this._defaults.secondMax-(this._defaults.secondMax-this._defaults.secondMin)%this._defaults.stepSecond,10),u=parseInt(this._defaults.millisecMax-(this._defaults.millisecMax-this._defaults.millisecMin)%this._defaults.stepMillisec,10),d=parseInt(this._defaults.microsecMax-(this._defaults.microsecMax-this._defaults.microsecMin)%this._defaults.stepMicrosec,10);this.hour_slider&&(this.control.options(this,this.hour_slider,"hour",{min:this._defaults.hourMin,max:l}),this.control.value(this,this.hour_slider,"hour",this.hour-this.hour%this._defaults.stepHour)),this.minute_slider&&(this.control.options(this,this.minute_slider,"minute",{min:this._defaults.minuteMin,max:h}),this.control.value(this,this.minute_slider,"minute",this.minute-this.minute%this._defaults.stepMinute)),this.second_slider&&(this.control.options(this,this.second_slider,"second",{min:this._defaults.secondMin,max:c}),this.control.value(this,this.second_slider,"second",this.second-this.second%this._defaults.stepSecond)),this.millisec_slider&&(this.control.options(this,this.millisec_slider,"millisec",{min:this._defaults.millisecMin,max:u}),this.control.value(this,this.millisec_slider,"millisec",this.millisec-this.millisec%this._defaults.stepMillisec)),this.microsec_slider&&(this.control.options(this,this.microsec_slider,"microsec",{min:this._defaults.microsecMin,max:d}),this.control.value(this,this.microsec_slider,"microsec",this.microsec-this.microsec%this._defaults.stepMicrosec))}}},_onTimeChange:function(){if(this._defaults.showTimepicker){var t=this.hour_slider?this.control.value(this,this.hour_slider,"hour"):!1,e=this.minute_slider?this.control.value(this,this.minute_slider,"minute"):!1,i=this.second_slider?this.control.value(this,this.second_slider,"second"):!1,n=this.millisec_slider?this.control.value(this,this.millisec_slider,"millisec"):!1,s=this.microsec_slider?this.control.value(this,this.microsec_slider,"microsec"):!1,r=this.timezone_select?this.timezone_select.val():!1,o=this._defaults,a=o.pickerTimeFormat||o.timeFormat,l=o.pickerTimeSuffix||o.timeSuffix;"object"==typeof t&&(t=!1),"object"==typeof e&&(e=!1),"object"==typeof i&&(i=!1),"object"==typeof n&&(n=!1),"object"==typeof s&&(s=!1),"object"==typeof r&&(r=!1),t!==!1&&(t=parseInt(t,10)),e!==!1&&(e=parseInt(e,10)),i!==!1&&(i=parseInt(i,10)),n!==!1&&(n=parseInt(n,10)),s!==!1&&(s=parseInt(s,10));var h=o[12>t?"amNames":"pmNames"][0],c=t!==this.hour||e!==this.minute||i!==this.second||n!==this.millisec||s!==this.microsec||this.ampm.length>0&&12>t!=(-1!==$.inArray(this.ampm.toUpperCase(),this.amNames))||null!==this.timezone&&r!==this.timezone;c&&(t!==!1&&(this.hour=t),e!==!1&&(this.minute=e),i!==!1&&(this.second=i),n!==!1&&(this.millisec=n),s!==!1&&(this.microsec=s),r!==!1&&(this.timezone=r),this.inst||(this.inst=$.datepicker._getInst(this.$input[0])),this._limitMinMaxDateTime(this.inst,!0)),this.support.ampm&&(this.ampm=h),this.formattedTime=$.datepicker.formatTime(o.timeFormat,this,o),this.$timeObj&&(a===o.timeFormat?this.$timeObj.text(this.formattedTime+l):this.$timeObj.text($.datepicker.formatTime(a,this,o)+l)),this.timeDefined=!0,c&&this._updateDateTime()}},_onSelectHandler:function(){var t=this._defaults.onSelect||this.inst.settings.onSelect,e=this.$input?this.$input[0]:null;t&&e&&t.apply(e,[this.formattedDateTime,this])},_updateDateTime:function(t){if(t=this.inst||t,this.ls_now)this.$input.val("now");else{var e=t.currentYear>0?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(t.selectedYear,t.selectedMonth,t.selectedDay),i=$.datepicker._daylightSavingAdjust(e),n=$.datepicker._get(t,"dateFormat"),s=$.datepicker._getFormatConfig(t),r=null!==i&&this.timeDefined;this.formattedDate=$.datepicker.formatDate(n,null===i?new Date:i,s);var o=this.formattedDate;if(""===t.lastVa&&(t.currentYear=t.selectedYear,t.currentMonth=t.selectedMonth,t.currentDay=t.selectedDay),this._defaults.timeOnly===!0?o=this.formattedTime:this._defaults.timeOnly!==!0&&(this._defaults.alwaysSetTime||r)&&(o+=this._defaults.separator+this.formattedTime+this._defaults.timeSuffix),this.formattedDateTime=o,this._defaults.showTimepicker)if(this.$altInput&&this._defaults.timeOnly===!1&&this._defaults.altFieldTimeOnly===!0)this.$altInput.val(this.formattedTime),this.$input.val(this.formattedDate);else if(this.$altInput){this.$input.val(o);var a="",l=this._defaults.altSeparator?this._defaults.altSeparator:this._defaults.separator,h=this._defaults.altTimeSuffix?this._defaults.altTimeSuffix:this._defaults.timeSuffix;this._defaults.timeOnly||(a=this._defaults.altFormat?$.datepicker.formatDate(this._defaults.altFormat,null===i?new Date:i,s):this.formattedDate,a&&(a+=l)),a+=this._defaults.altTimeFormat?$.datepicker.formatTime(this._defaults.altTimeFormat,this,this._defaults)+h:this.formattedTime+h,this.$altInput.val(a)}else this.$input.val(o);else this.$input.val(this.formattedDate)}this.$input.trigger("change")},_onFocus:function(){if(!this.$input.val()&&this._defaults.defaultValue){this.$input.val(this._defaults.defaultValue);var t=$.datepicker._getInst(this.$input.get(0)),e=$.datepicker._get(t,"timepicker");if(e&&e._defaults.timeOnly&&t.input.val()!==t.lastVal)try{$.datepicker._updateDatepicker(t)}catch(i){$.timepicker.log(i)}}},_controls:{slider:{create:function(t,e,i,n,s,r,o){var a=t._defaults.isRTL;return e.prop("slide",null).slider({orientation:"horizontal",value:a?-1*n:n,min:a?-1*r:s,max:a?-1*s:r,step:o,slide:function(e,n){t.ls_now=!1,t.control.value(t,$(this),i,a?-1*n.value:n.value),t._onTimeChange()},stop:function(){t._onSelectHandler()}})},options:function(t,e,i,n,s){if(t._defaults.isRTL){if("string"==typeof n)return"min"===n||"max"===n?void 0!==s?e.slider(n,-1*s):Math.abs(e.slider(n)):e.slider(n);var r=n.min,o=n.max;return n.min=n.max=null,void 0!==r&&(n.max=-1*r),void 0!==o&&(n.min=-1*o),e.slider(n)}return"string"==typeof n&&void 0!==s?e.slider(n,s):e.slider(n)},value:function(t,e,i,n){return t._defaults.isRTL?void 0!==n?e.slider("value",-1*n):Math.abs(e.slider("value")):void 0!==n?e.slider("value",n):e.slider("value")}},select:{create:function(t,e,i,n,s,r,o){for(var a='<select class="ui-timepicker-select" data-unit="'+i+'" data-min="'+s+'" data-max="'+r+'" data-step="'+o+'">',l=t._defaults.pickerTimeFormat||t._defaults.timeFormat,h=s;r>=h;h+=o)a+='<option value="'+h+'"'+(h===n?" selected":"")+">",a+="hour"===i?$.datepicker.formatTime($.trim(l.replace(/[^ht ]/gi,"")),{hour:h},t._defaults):"millisec"===i||"microsec"===i||h>=10?h:"0"+h.toString(),a+="</option>";return a+="</select>",e.children("select").remove(),$(a).appendTo(e).change(function(){t._onTimeChange(),t._onSelectHandler()}),e},options:function(t,e,i,n,s){var r={},o=e.children("select");if("string"==typeof n){if(void 0===s)return o.data(n);r[n]=s}else r=n;return t.control.create(t,e,o.data("unit"),o.val(),r.min||o.data("min"),r.max||o.data("max"),r.step||o.data("step"))},value:function(t,e,i,n){var s=e.children("select");return void 0!==n?s.val(n):s.val()}}}}),$.fn.extend({timepicker:function(t){t=t||{};var e=Array.prototype.slice.call(arguments);return"object"==typeof t&&(e[0]=$.extend(t,{timeOnly:!0})),$(this).each(function(){$.fn.datetimepicker.apply($(this),e)})},datetimepicker:function(t){t=t||{};var e=arguments;return"string"==typeof t?"getDate"===t?$.fn.datepicker.apply($(this[0]),e):this.each(function(){var t=$(this);t.datepicker.apply(t,e)}):this.each(function(){var e=$(this);e.datepicker($.timepicker._newInst(e,t)._defaults)})}}),$.datepicker.parseDateTime=function(t,e,i,n,s){var r=parseDateTimeInternal(t,e,i,n,s);if(r.timeObj){var o=r.timeObj;r.date.setHours(o.hour,o.minute,o.second,o.millisec),r.date.setMicroseconds(o.microsec)}return r.date},$.datepicker.parseTime=function(t,e,i){var n=extendRemove(extendRemove({},$.timepicker._defaults),i||{});-1!==t.replace(/\'.*?\'/g,"").indexOf("Z");var s=function(t,e,i){var n,s=function(t,e){var i=[];return t&&$.merge(i,t),e&&$.merge(i,e),i=$.map(i,function(t){return t.replace(/[.*+?|()\[\]{}\\]/g,"\\$&")}),"("+i.join("|")+")?"},r=function(t){var e=t.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|c{1}|t{1,2}|z|'.*?')/g),i={h:-1,m:-1,s:-1,l:-1,c:-1,t:-1,z:-1};if(e)for(var n=0;n<e.length;n++)-1===i[e[n].toString().charAt(0)]&&(i[e[n].toString().charAt(0)]=n+1);return i},o="^"+t.toString().replace(/([hH]{1,2}|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){var e=t.length;switch(t.charAt(0).toLowerCase()){case"h":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"m":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"s":return 1===e?"(\\d?\\d)":"(\\d{"+e+"})";case"l":return"(\\d?\\d?\\d)";case"c":return"(\\d?\\d?\\d)";case"z":return"(z|[-+]\\d\\d:?\\d\\d|\\S+)?";case"t":return s(i.amNames,i.pmNames);default:return"("+t.replace(/\'/g,"").replace(/(\.|\$|\^|\\|\/|\(|\)|\[|\]|\?|\+|\*)/g,function(t){return"\\"+t})+")?"}}).replace(/\s/g,"\\s?")+i.timeSuffix+"$",a=r(t),l="";n=e.match(new RegExp(o,"i"));var h={hour:0,minute:0,second:0,millisec:0,microsec:0};return n?(-1!==a.t&&(void 0===n[a.t]||0===n[a.t].length?(l="",h.ampm=""):(l=-1!==$.inArray(n[a.t].toUpperCase(),i.amNames)?"AM":"PM",h.ampm=i["AM"===l?"amNames":"pmNames"][0])),-1!==a.h&&(h.hour="AM"===l&&"12"===n[a.h]?0:"PM"===l&&"12"!==n[a.h]?parseInt(n[a.h],10)+12:Number(n[a.h])),-1!==a.m&&(h.minute=Number(n[a.m])),-1!==a.s&&(h.second=Number(n[a.s])),-1!==a.l&&(h.millisec=Number(n[a.l])),-1!==a.c&&(h.microsec=Number(n[a.c])),-1!==a.z&&void 0!==n[a.z]&&(h.timezone=$.timepicker.timezoneOffsetNumber(n[a.z])),h):!1},r=function(t,e,i){try{var n=new Date("2012-01-01 "+e);if(isNaN(n.getTime())&&(n=new Date("2012-01-01T"+e),isNaN(n.getTime())&&(n=new Date("01/01/2012 "+e),isNaN(n.getTime()))))throw"Unable to parse time with native Date: "+e;return{hour:n.getHours(),minute:n.getMinutes(),second:n.getSeconds(),millisec:n.getMilliseconds(),microsec:n.getMicroseconds(),timezone:-1*n.getTimezoneOffset()}}catch(r){try{return s(t,e,i)}catch(o){$.timepicker.log("Unable to parse \ntimeString: "+e+"\ntimeFormat: "+t)}}return!1};return"function"==typeof n.parse?n.parse(t,e,n):"loose"===n.parse?r(t,e,n):s(t,e,n)},$.datepicker.formatTime=function(t,e,i){i=i||{},i=$.extend({},$.timepicker._defaults,i),e=$.extend({hour:0,minute:0,second:0,millisec:0,microsec:0,timezone:null},e);var n=t,s=i.amNames[0],r=parseInt(e.hour,10);return r>11&&(s=i.pmNames[0]),n=n.replace(/(?:HH?|hh?|mm?|ss?|[tT]{1,2}|[zZ]|[lc]|'.*?')/g,function(t){switch(t){case"HH":return("0"+r).slice(-2);case"H":return r;case"hh":return("0"+convert24to12(r)).slice(-2);case"h":return convert24to12(r);case"mm":return("0"+e.minute).slice(-2);case"m":return e.minute;case"ss":return("0"+e.second).slice(-2);case"s":return e.second;case"l":return("00"+e.millisec).slice(-3);case"c":return("00"+e.microsec).slice(-3);case"z":return $.timepicker.timezoneOffsetString(null===e.timezone?i.timezone:e.timezone,!1);case"Z":return $.timepicker.timezoneOffsetString(null===e.timezone?i.timezone:e.timezone,!0);case"T":return s.charAt(0).toUpperCase();case"TT":return s.toUpperCase();case"t":return s.charAt(0).toLowerCase();case"tt":return s.toLowerCase();default:return t.replace(/'/g,"")}})},$.datepicker._base_selectDate=$.datepicker._selectDate,$.datepicker._selectDate=function(t,e){var i=this._getInst($(t)[0]),n=this._get(i,"timepicker");n?(n._limitMinMaxDateTime(i,!0),i.inline=i.stay_open=!0,this._base_selectDate(t,e),i.inline=i.stay_open=!1,this._notifyChange(i),this._updateDatepicker(i)):this._base_selectDate(t,e)},$.datepicker._base_updateDatepicker=$.datepicker._updateDatepicker,$.datepicker._updateDatepicker=function(t){var e=t.input[0];if(!($.datepicker._curInst&&$.datepicker._curInst!==t&&$.datepicker._datepickerShowing&&$.datepicker._lastInput!==e||"boolean"==typeof t.stay_open&&t.stay_open!==!1)){this._base_updateDatepicker(t);var i=this._get(t,"timepicker");i&&i._addTimePicker(t)}},$.datepicker._base_doKeyPress=$.datepicker._doKeyPress,$.datepicker._doKeyPress=function(t){var e=$.datepicker._getInst(t.target),i=$.datepicker._get(e,"timepicker");if(i&&$.datepicker._get(e,"constrainInput")){var n=i.support.ampm,s=null!==i._defaults.showTimezone?i._defaults.showTimezone:i.support.timezone,r=$.datepicker._possibleChars($.datepicker._get(e,"dateFormat")),o=i._defaults.timeFormat.toString().replace(/[hms]/g,"").replace(/TT/g,n?"APM":"").replace(/Tt/g,n?"AaPpMm":"").replace(/tT/g,n?"AaPpMm":"").replace(/T/g,n?"AP":"").replace(/tt/g,n?"apm":"").replace(/t/g,n?"ap":"")+" "+i._defaults.separator+i._defaults.timeSuffix+(s?i._defaults.timezoneList.join(""):"")+i._defaults.amNames.join("")+i._defaults.pmNames.join("")+r,a=String.fromCharCode(void 0===t.charCode?t.keyCode:t.charCode);return t.ctrlKey||" ">a||!r||o.indexOf(a)>-1}return $.datepicker._base_doKeyPress(t)},$.datepicker._base_updateAlternate=$.datepicker._updateAlternate,$.datepicker._updateAlternate=function(t){var e=this._get(t,"timepicker");if(e){var i=e._defaults.altField;if(i){var n=(e._defaults.altFormat||e._defaults.dateFormat,this._getDate(t)),s=$.datepicker._getFormatConfig(t),r="",o=e._defaults.altSeparator?e._defaults.altSeparator:e._defaults.separator,a=e._defaults.altTimeSuffix?e._defaults.altTimeSuffix:e._defaults.timeSuffix,l=null!==e._defaults.altTimeFormat?e._defaults.altTimeFormat:e._defaults.timeFormat;r+=$.datepicker.formatTime(l,e,e._defaults)+a,e._defaults.timeOnly||e._defaults.altFieldTimeOnly||null===n||(r=e._defaults.altFormat?$.datepicker.formatDate(e._defaults.altFormat,n,s)+o+r:e.formattedDate+o+r),$(i).val(r)}}else $.datepicker._base_updateAlternate(t)},$.datepicker._base_doKeyUp=$.datepicker._doKeyUp,$.datepicker._doKeyUp=function(t){var e=$.datepicker._getInst(t.target),i=$.datepicker._get(e,"timepicker");if(i&&i._defaults.timeOnly&&e.input.val()!==e.lastVal)try{$.datepicker._updateDatepicker(e)}catch(n){$.timepicker.log(n)}return $.datepicker._base_doKeyUp(t)},$.datepicker._base_gotoToday=$.datepicker._gotoToday,$.datepicker._gotoToday=function(t){var e=this._getInst($(t)[0]);e.dpDiv,this._base_gotoToday(t);var i=this._get(e,"timepicker");selectLocalTimezone(i);var n=new Date,s=new Date(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),n.getUTCHours(),n.getUTCMinutes(),n.getUTCHours());i.ls_now=!0,this._setTime(e,s)},$.datepicker._disableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var i=this._get(e,"timepicker");$(t).datepicker("getDate"),i&&(e.settings.showTimepicker=!1,i._defaults.showTimepicker=!1,i._updateDateTime(e))}},$.datepicker._enableTimepickerDatepicker=function(t){var e=this._getInst(t);if(e){var i=this._get(e,"timepicker");$(t).datepicker("getDate"),i&&(e.settings.showTimepicker=!0,i._defaults.showTimepicker=!0,i._addTimePicker(e),i._updateDateTime(e))}},$.datepicker._setTime=function(t,e){var i=this._get(t,"timepicker");if(i){var n=i._defaults;i.hour=e?e.getHours():n.hour,i.minute=e?e.getMinutes():n.minute,i.second=e?e.getSeconds():n.second,i.millisec=e?e.getMilliseconds():n.millisec,i.microsec=e?e.getMicroseconds():n.microsec,i._limitMinMaxDateTime(t,!0),i._onTimeChange(),i._updateDateTime(t)}},$.datepicker._setTimeDatepicker=function(t,e,i){var n=this._getInst(t);if(n){var s=this._get(n,"timepicker");if(s){this._setDateFromField(n);var r;e&&("string"==typeof e?(s._parseTime(e,i),r=new Date,r.setHours(s.hour,s.minute,s.second,s.millisec),r.setMicroseconds(s.microsec)):(r=new Date(e.getTime()),r.setMicroseconds(e.getMicroseconds())),"Invalid Date"===r.toString()&&(r=void 0),this._setTime(n,r))}}},$.datepicker._base_setDateDatepicker=$.datepicker._setDateDatepicker,$.datepicker._setDateDatepicker=function(t,e){var i=this._getInst(t);if(i){"string"==typeof e&&(e=new Date(e),e.getTime()||$.timepicker.log("Error creating Date object from string."));var n,s=this._get(i,"timepicker");e instanceof Date?(n=new Date(e.getTime()),n.setMicroseconds(e.getMicroseconds())):n=e,s&&(s.support.timezone||null!==s._defaults.timezone||(s.timezone=-1*n.getTimezoneOffset()),e=$.timepicker.timezoneAdjust(e,s.timezone),n=$.timepicker.timezoneAdjust(n,s.timezone)),this._updateDatepicker(i),this._base_setDateDatepicker.apply(this,arguments),this._setTimeDatepicker(t,n,!0)}},$.datepicker._base_getDateDatepicker=$.datepicker._getDateDatepicker,$.datepicker._getDateDatepicker=function(t,e){var i=this._getInst(t);if(i){var n=this._get(i,"timepicker");if(n){void 0===i.lastVal&&this._setDateFromField(i,e);var s=this._getDate(i);return s&&n._parseTime($(t).val(),n.timeOnly)&&(s.setHours(n.hour,n.minute,n.second,n.millisec),s.setMicroseconds(n.microsec),null!=n.timezone&&(n.support.timezone||null!==n._defaults.timezone||(n.timezone=-1*s.getTimezoneOffset()),s=$.timepicker.timezoneAdjust(s,n.timezone))),s}return this._base_getDateDatepicker(t,e)}},$.datepicker._base_parseDate=$.datepicker.parseDate,$.datepicker.parseDate=function(t,e,i){var n;try{n=this._base_parseDate(t,e,i)}catch(s){if(!(s.indexOf(":")>=0))throw s;n=this._base_parseDate(t,e.substring(0,e.length-(s.length-s.indexOf(":")-2)),i),$.timepicker.log("Error parsing the date string: "+s+"\ndate string = "+e+"\ndate format = "+t)}return n},$.datepicker._base_formatDate=$.datepicker._formatDate,$.datepicker._formatDate=function(t){var e=this._get(t,"timepicker");return e?(e._updateDateTime(t),e.$input.val()):this._base_formatDate(t)},$.datepicker._base_optionDatepicker=$.datepicker._optionDatepicker,$.datepicker._optionDatepicker=function(t,e,i){var n,s=this._getInst(t);if(!s)return null;var r=this._get(s,"timepicker");if(r){var o,a=null,l=null,h=null,c=r._defaults.evnts,u={};if("string"==typeof e){if("minDate"===e||"minDateTime"===e)a=i;else if("maxDate"===e||"maxDateTime"===e)l=i;else if("onSelect"===e)h=i;else if(c.hasOwnProperty(e)){if("undefined"==typeof i)return c[e];u[e]=i,n={}}}else if("object"==typeof e){e.minDate?a=e.minDate:e.minDateTime?a=e.minDateTime:e.maxDate?l=e.maxDate:e.maxDateTime&&(l=e.maxDateTime);for(o in c)c.hasOwnProperty(o)&&e[o]&&(u[o]=e[o])}for(o in u)u.hasOwnProperty(o)&&(c[o]=u[o],n||(n=$.extend({},e)),delete n[o]);if(n&&isEmptyObject(n))return;a?(a=0===a?new Date:new Date(a),r._defaults.minDate=a,r._defaults.minDateTime=a):l?(l=0===l?new Date:new Date(l),r._defaults.maxDate=l,r._defaults.maxDateTime=l):h&&(r._defaults.onSelect=h)}return void 0===i?this._base_optionDatepicker.call($.datepicker,t,e):this._base_optionDatepicker.call($.datepicker,t,n||e,i)};var isEmptyObject=function(t){var e;for(e in t)if(t.hasOwnProperty(e))return!1;return!0},extendRemove=function(t,e){$.extend(t,e);for(var i in e)(null===e[i]||void 0===e[i])&&(t[i]=e[i]);return t},detectSupport=function(t){var e=t.replace(/'.*?'/g,"").toLowerCase(),i=function(t,e){return-1!==t.indexOf(e)?!0:!1};return{hour:i(e,"h"),minute:i(e,"m"),second:i(e,"s"),millisec:i(e,"l"),microsec:i(e,"c"),timezone:i(e,"z"),ampm:i(e,"t")&&i(t,"h"),iso8601:i(t,"Z")}},convert24to12=function(t){return t%=12,0===t&&(t=12),String(t)},computeEffectiveSetting=function(t,e){return t&&t[e]?t[e]:$.timepicker._defaults[e]},splitDateTime=function(t,e){var i=computeEffectiveSetting(e,"separator"),n=computeEffectiveSetting(e,"timeFormat"),s=n.split(i),r=s.length,o=t.split(i),a=o.length;return a>1?{dateString:o.splice(0,a-r).join(i),timeString:o.splice(0,r).join(i)}:{dateString:t,timeString:""}},parseDateTimeInternal=function(t,e,i,n,s){var r,o,a;if(o=splitDateTime(i,s),r=$.datepicker._base_parseDate(t,o.dateString,n),""===o.timeString)return{date:r};if(a=$.datepicker.parseTime(e,o.timeString,s),!a)throw"Wrong time format";return{date:r,timeObj:a}},selectLocalTimezone=function(t,e){if(t&&t.timezone_select){var i=e||new Date;t.timezone_select.val(-i.getTimezoneOffset())}};$.timepicker=new Timepicker,$.timepicker.timezoneOffsetString=function(t,e){if(isNaN(t)||t>840||-720>t)return t;var i=t,n=i%60,s=(i-n)/60,r=e?":":"",o=(i>=0?"+":"-")+("0"+Math.abs(s)).slice(-2)+r+("0"+Math.abs(n)).slice(-2);return"+00:00"===o?"Z":o},$.timepicker.timezoneOffsetNumber=function(t){var e=t.toString().replace(":","");return"Z"===e.toUpperCase()?0:/^(\-|\+)\d{4}$/.test(e)?("-"===e.substr(0,1)?-1:1)*(60*parseInt(e.substr(1,2),10)+parseInt(e.substr(3,2),10)):t},$.timepicker.timezoneAdjust=function(t,e){var i=$.timepicker.timezoneOffsetNumber(e);return isNaN(i)||t.setMinutes(t.getMinutes()+-t.getTimezoneOffset()-i),t},$.timepicker.timeRange=function(t,e,i){return $.timepicker.handleRange("timepicker",t,e,i)},$.timepicker.datetimeRange=function(t,e,i){$.timepicker.handleRange("datetimepicker",t,e,i)},$.timepicker.dateRange=function(t,e,i){$.timepicker.handleRange("datepicker",t,e,i)},$.timepicker.handleRange=function(t,e,i,n){function s(s,r){var o=e[t]("getDate"),a=i[t]("getDate"),l=s[t]("getDate");if(null!==o){var h=new Date(o.getTime()),c=new Date(o.getTime());h.setMilliseconds(h.getMilliseconds()+n.minInterval),c.setMilliseconds(c.getMilliseconds()+n.maxInterval),n.minInterval>0&&h>a?i[t]("setDate",h):n.maxInterval>0&&a>c?i[t]("setDate",c):o>a&&r[t]("setDate",l)}}function r(e,i,s){if(e.val()){var r=e[t].call(e,"getDate");null!==r&&n.minInterval>0&&("minDate"===s&&r.setMilliseconds(r.getMilliseconds()+n.minInterval),"maxDate"===s&&r.setMilliseconds(r.getMilliseconds()-n.minInterval)),r.getTime&&i[t].call(i,"option",s,r)}}return n=$.extend({},{minInterval:0,maxInterval:0,start:{},end:{}},n),$.fn[t].call(e,$.extend({onClose:function(){s($(this),i)},onSelect:function(){r($(this),i,"minDate")}},n,n.start)),$.fn[t].call(i,$.extend({onClose:function(){s($(this),e)},onSelect:function(){r($(this),e,"maxDate")}},n,n.end)),s(e,i),r(e,i,"minDate"),r(i,e,"maxDate"),$([e.get(0),i.get(0)])},$.timepicker.log=function(t){window.console&&window.console.log(t)},$.timepicker._util={_extendRemove:extendRemove,_isEmptyObject:isEmptyObject,_convert24to12:convert24to12,_detectSupport:detectSupport,_selectLocalTimezone:selectLocalTimezone,_computeEffectiveSetting:computeEffectiveSetting,_splitDateTime:splitDateTime,_parseDateTimeInternal:parseDateTimeInternal},Date.prototype.getMicroseconds||(Date.prototype.microseconds=0,Date.prototype.getMicroseconds=function(){return this.microseconds},Date.prototype.setMicroseconds=function(t){return this.setMilliseconds(this.getMilliseconds()+Math.floor(t/1e3)),this.microseconds=t%1e3,this}),$.timepicker.version="@@version"}}(jQuery),define("jquery-timepicker",["jquery-ui","jquery"],function(){}),!function(t){t(function(){t.support.transition=function(){var t=function(){var t,e=document.createElement("bootstrap"),i={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(t in i)if(void 0!==e.style[t])return i[t]}();return t&&{end:t}}()})}(window.jQuery),!function(t){var e='[data-dismiss="alert"]',i=function(i){t(i).on("click",e,this.close)};i.prototype.close=function(e){function i(){n.trigger("closed").remove()}var n,s=t(this),r=s.attr("data-target");r||(r=s.attr("href"),r=r&&r.replace(/.*(?=#[^\s]*$)/,"")),n=t(r),e&&e.preventDefault(),n.length||(n=s.hasClass("alert")?s:s.parent()),n.trigger(e=t.Event("close")),e.isDefaultPrevented()||(n.removeClass("in"),t.support.transition&&n.hasClass("fade")?n.on(t.support.transition.end,i):i())};var n=t.fn.alert;t.fn.alert=function(e){return this.each(function(){var n=t(this),s=n.data("alert");s||n.data("alert",s=new i(this)),"string"==typeof e&&s[e].call(n)})},t.fn.alert.Constructor=i,t.fn.alert.noConflict=function(){return t.fn.alert=n,this},t(document).on("click.alert.data-api",e,i.prototype.close)}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.button.defaults,i)};e.prototype.setState=function(t){var e="disabled",i=this.$element,n=i.data(),s=i.is("input")?"val":"html";t+="Text",n.resetText||i.data("resetText",i[s]()),i[s](n[t]||this.options[t]),setTimeout(function(){"loadingText"==t?i.addClass(e).attr(e,e):i.removeClass(e).removeAttr(e)},0)},e.prototype.toggle=function(){var t=this.$element.closest('[data-toggle="buttons-radio"]');t&&t.find(".active").removeClass("active"),this.$element.toggleClass("active")};var i=t.fn.button;t.fn.button=function(i){return this.each(function(){var n=t(this),s=n.data("button"),r="object"==typeof i&&i;s||n.data("button",s=new e(this,r)),"toggle"==i?s.toggle():i&&s.setState(i)})},t.fn.button.defaults={loadingText:"loading..."},t.fn.button.Constructor=e,t.fn.button.noConflict=function(){return t.fn.button=i,this},t(document).on("click.button.data-api","[data-toggle^=button]",function(e){var i=t(e.target);i.hasClass("btn")||(i=i.closest(".btn")),i.button("toggle")})}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.$indicators=this.$element.find(".carousel-indicators"),this.options=i,"hover"==this.options.pause&&this.$element.on("mouseenter",t.proxy(this.pause,this)).on("mouseleave",t.proxy(this.cycle,this))};e.prototype={cycle:function(e){return e||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(t.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(e){var i=this.getActiveIndex(),n=this;if(!(e>this.$items.length-1||0>e))return this.sliding?this.$element.one("slid",function(){n.to(e)}):i==e?this.pause().cycle():this.slide(e>i?"next":"prev",t(this.$items[e]))},pause:function(e){return e||(this.paused=!0),this.$element.find(".next, .prev").length&&t.support.transition.end&&(this.$element.trigger(t.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(e,i){var n,s=this.$element.find(".item.active"),r=i||s[e](),o=this.interval,a="next"==e?"left":"right",l="next"==e?"first":"last",h=this;if(this.sliding=!0,o&&this.pause(),r=r.length?r:this.$element.find(".item")[l](),n=t.Event("slide",{relatedTarget:r[0],direction:a}),!r.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var e=t(h.$indicators.children()[h.getActiveIndex()]);e&&e.addClass("active")})),t.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(n),n.isDefaultPrevented())return;r.addClass(e),r[0].offsetWidth,s.addClass(a),r.addClass(a),this.$element.one(t.support.transition.end,function(){r.removeClass([e,a].join(" ")).addClass("active"),s.removeClass(["active",a].join(" ")),h.sliding=!1,setTimeout(function(){h.$element.trigger("slid")},0)})}else{if(this.$element.trigger(n),n.isDefaultPrevented())return;s.removeClass("active"),r.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return o&&this.cycle(),this}}};var i=t.fn.carousel;t.fn.carousel=function(i){return this.each(function(){var n=t(this),s=n.data("carousel"),r=t.extend({},t.fn.carousel.defaults,"object"==typeof i&&i),o="string"==typeof i?i:r.slide;s||n.data("carousel",s=new e(this,r)),"number"==typeof i?s.to(i):o?s[o]():r.interval&&s.pause().cycle()})},t.fn.carousel.defaults={interval:5e3,pause:"hover"},t.fn.carousel.Constructor=e,t.fn.carousel.noConflict=function(){return t.fn.carousel=i,this
402
+ },t(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(e){var i,n,s=t(this),r=t(s.attr("data-target")||(i=s.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"")),o=t.extend({},r.data(),s.data());r.carousel(o),(n=s.attr("data-slide-to"))&&r.data("carousel").pause().to(n).cycle(),e.preventDefault()})}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.collapse.defaults,i),this.options.parent&&(this.$parent=t(this.options.parent)),this.options.toggle&&this.toggle()};e.prototype={constructor:e,dimension:function(){var t=this.$element.hasClass("width");return t?"width":"height"},show:function(){var e,i,n,s;if(!this.transitioning&&!this.$element.hasClass("in")){if(e=this.dimension(),i=t.camelCase(["scroll",e].join("-")),n=this.$parent&&this.$parent.find("> .accordion-group > .in"),n&&n.length){if(s=n.data("collapse"),s&&s.transitioning)return;n.collapse("hide"),s||n.data("collapse",null)}this.$element[e](0),this.transition("addClass",t.Event("show"),"shown"),t.support.transition&&this.$element[e](this.$element[0][i])}},hide:function(){var e;!this.transitioning&&this.$element.hasClass("in")&&(e=this.dimension(),this.reset(this.$element[e]()),this.transition("removeClass",t.Event("hide"),"hidden"),this.$element[e](0))},reset:function(t){var e=this.dimension();return this.$element.removeClass("collapse")[e](t||"auto")[0].offsetWidth,this.$element[null!==t?"addClass":"removeClass"]("collapse"),this},transition:function(e,i,n){var s=this,r=function(){"show"==i.type&&s.reset(),s.transitioning=0,s.$element.trigger(n)};this.$element.trigger(i),i.isDefaultPrevented()||(this.transitioning=1,this.$element[e]("in"),t.support.transition&&this.$element.hasClass("collapse")?this.$element.one(t.support.transition.end,r):r())},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var i=t.fn.collapse;t.fn.collapse=function(i){return this.each(function(){var n=t(this),s=n.data("collapse"),r=t.extend({},t.fn.collapse.defaults,n.data(),"object"==typeof i&&i);s||n.data("collapse",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.collapse.defaults={toggle:!0},t.fn.collapse.Constructor=e,t.fn.collapse.noConflict=function(){return t.fn.collapse=i,this},t(document).on("click.collapse.data-api","[data-toggle=collapse]",function(e){var i,n=t(this),s=n.attr("data-target")||e.preventDefault()||(i=n.attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,""),r=t(s).data("collapse")?"toggle":n.data();n[t(s).hasClass("in")?"addClass":"removeClass"]("collapsed"),t(s).collapse(r)})}(window.jQuery),!function(t){function e(){t(".dropdown-backdrop").remove(),t(n).each(function(){i(t(this)).removeClass("open")})}function i(e){var i,n=e.attr("data-target");return n||(n=e.attr("href"),n=n&&/#/.test(n)&&n.replace(/.*(?=#[^\s]*$)/,"")),i=n&&t(n),i&&i.length||(i=e.parent()),i}var n="[data-toggle=dropdown]",s=function(e){var i=t(e).on("click.dropdown.data-api",this.toggle);t("html").on("click.dropdown.data-api",function(){i.parent().removeClass("open")})};s.prototype={constructor:s,toggle:function(){var n,s,r=t(this);if(!r.is(".disabled, :disabled"))return n=i(r),s=n.hasClass("open"),e(),s||("ontouchstart"in document.documentElement&&t('<div class="dropdown-backdrop"/>').insertBefore(t(this)).on("click",e),n.toggleClass("open")),r.focus(),!1},keydown:function(e){var s,r,o,a,l;if(/(38|40|27)/.test(e.keyCode)&&(s=t(this),e.preventDefault(),e.stopPropagation(),!s.is(".disabled, :disabled"))){if(o=i(s),a=o.hasClass("open"),!a||a&&27==e.keyCode)return 27==e.which&&o.find(n).focus(),s.click();r=t("[role=menu] li:not(.divider):visible a",o),r.length&&(l=r.index(r.filter(":focus")),38==e.keyCode&&l>0&&l--,40==e.keyCode&&l<r.length-1&&l++,~l||(l=0),r.eq(l).focus())}}};var r=t.fn.dropdown;t.fn.dropdown=function(e){return this.each(function(){var i=t(this),n=i.data("dropdown");n||i.data("dropdown",n=new s(this)),"string"==typeof e&&n[e].call(i)})},t.fn.dropdown.Constructor=s,t.fn.dropdown.noConflict=function(){return t.fn.dropdown=r,this},t(document).on("click.dropdown.data-api",e).on("click.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.dropdown.data-api",n,s.prototype.toggle).on("keydown.dropdown.data-api",n+", [role=menu]",s.prototype.keydown)}(window.jQuery),!function(t){var e=function(e,i){this.options=i,this.$element=t(e).delegate('[data-dismiss="modal"]',"click.dismiss.modal",t.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};e.prototype={constructor:e,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var e=this,i=t.Event("show");this.$element.trigger(i),this.isShown||i.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var i=t.support.transition&&e.$element.hasClass("fade");e.$element.parent().length||e.$element.appendTo(document.body),e.$element.show(),i&&e.$element[0].offsetWidth,e.$element.addClass("in").attr("aria-hidden",!1),e.enforceFocus(),i?e.$element.one(t.support.transition.end,function(){e.$element.focus().trigger("shown")}):e.$element.focus().trigger("shown")}))},hide:function(e){e&&e.preventDefault(),e=t.Event("hide"),this.$element.trigger(e),this.isShown&&!e.isDefaultPrevented()&&(this.isShown=!1,this.escape(),t(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),t.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var e=this;t(document).on("focusin.modal",function(t){e.$element[0]===t.target||e.$element.has(t.target).length||e.$element.focus()})},escape:function(){var t=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(e){27==e.which&&t.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var e=this,i=setTimeout(function(){e.$element.off(t.support.transition.end),e.hideModal()},500);this.$element.one(t.support.transition.end,function(){clearTimeout(i),e.hideModal()})},hideModal:function(){var t=this;this.$element.hide(),this.backdrop(function(){t.removeBackdrop(),t.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(e){var i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var n=t.support.transition&&i;if(this.$backdrop=t('<div class="modal-backdrop '+i+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?t.proxy(this.$element[0].focus,this.$element[0]):t.proxy(this.hide,this)),n&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!e)return;n?this.$backdrop.one(t.support.transition.end,e):e()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),t.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(t.support.transition.end,e):e()):e&&e()}};var i=t.fn.modal;t.fn.modal=function(i){return this.each(function(){var n=t(this),s=n.data("modal"),r=t.extend({},t.fn.modal.defaults,n.data(),"object"==typeof i&&i);s||n.data("modal",s=new e(this,r)),"string"==typeof i?s[i]():r.show&&s.show()})},t.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},t.fn.modal.Constructor=e,t.fn.modal.noConflict=function(){return t.fn.modal=i,this},t(document).on("click.modal.data-api",'[data-toggle="modal"]',function(e){var i=t(this),n=i.attr("href"),s=t(i.attr("data-target")||n&&n.replace(/.*(?=#[^\s]+$)/,"")),r=s.data("modal")?"toggle":t.extend({remote:!/#/.test(n)&&n},s.data(),i.data());e.preventDefault(),s.modal(r).one("hide",function(){i.focus()})})}(window.jQuery),!function(t){var e=function(t,e){this.init("tooltip",t,e)};e.prototype={constructor:e,init:function(e,i,n){var s,r,o,a,l;for(this.type=e,this.$element=t(i),this.options=this.getOptions(n),this.enabled=!0,o=this.options.trigger.split(" "),l=o.length;l--;)a=o[l],"click"==a?this.$element.on("click."+this.type,this.options.selector,t.proxy(this.toggle,this)):"manual"!=a&&(s="hover"==a?"mouseenter":"focus",r="hover"==a?"mouseleave":"blur",this.$element.on(s+"."+this.type,this.options.selector,t.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,t.proxy(this.leave,this)));this.options.selector?this._options=t.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(e){return e=t.extend({},t.fn[this.type].defaults,this.$element.data(),e),e.delay&&"number"==typeof e.delay&&(e.delay={show:e.delay,hide:e.delay}),e},enter:function(e){var i,n=t.fn[this.type].defaults,s={};return this._options&&t.each(this._options,function(t,e){n[t]!=e&&(s[t]=e)},this),i=t(e.currentTarget)[this.type](s).data(this.type),i.options.delay&&i.options.delay.show?(clearTimeout(this.timeout),i.hoverState="in",this.timeout=setTimeout(function(){"in"==i.hoverState&&i.show()},i.options.delay.show),void 0):i.show()},leave:function(e){var i=t(e.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),i.options.delay&&i.options.delay.hide?(i.hoverState="out",this.timeout=setTimeout(function(){"out"==i.hoverState&&i.hide()},i.options.delay.hide),void 0):i.hide()},show:function(){var e,i,n,s,r,o,a=t.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(a),a.isDefaultPrevented())return;switch(e=this.tip(),this.setContent(),this.options.animation&&e.addClass("fade"),r="function"==typeof this.options.placement?this.options.placement.call(this,e[0],this.$element[0]):this.options.placement,e.detach().css({top:0,left:0,display:"block"}),this.options.container?e.appendTo(this.options.container):e.insertAfter(this.$element),i=this.getPosition(),n=e[0].offsetWidth,s=e[0].offsetHeight,r){case"bottom":o={top:i.top+i.height,left:i.left+i.width/2-n/2};break;case"top":o={top:i.top-s,left:i.left+i.width/2-n/2};break;case"left":o={top:i.top+i.height/2-s/2,left:i.left-n};break;case"right":o={top:i.top+i.height/2-s/2,left:i.left+i.width}}this.applyPlacement(o,r),this.$element.trigger("shown")}},applyPlacement:function(t,e){var i,n,s,r,o=this.tip(),a=o[0].offsetWidth,l=o[0].offsetHeight;o.offset(t).addClass(e).addClass("in"),i=o[0].offsetWidth,n=o[0].offsetHeight,"top"==e&&n!=l&&(t.top=t.top+l-n,r=!0),"bottom"==e||"top"==e?(s=0,t.left<0&&(s=-2*t.left,t.left=0,o.offset(t),i=o[0].offsetWidth,n=o[0].offsetHeight),this.replaceArrow(s-a+i,i,"left")):this.replaceArrow(n-l,n,"top"),r&&o.offset(t)},replaceArrow:function(t,e,i){this.arrow().css(i,t?50*(1-t/e)+"%":"")},setContent:function(){var t=this.tip(),e=this.getTitle();t.find(".tooltip-inner")[this.options.html?"html":"text"](e),t.removeClass("fade in top bottom left right")},hide:function(){function e(){var e=setTimeout(function(){i.off(t.support.transition.end).detach()},500);i.one(t.support.transition.end,function(){clearTimeout(e),i.detach()})}var i=this.tip(),n=t.Event("hide");return this.$element.trigger(n),n.isDefaultPrevented()?void 0:(i.removeClass("in"),t.support.transition&&this.$tip.hasClass("fade")?e():i.detach(),this.$element.trigger("hidden"),this)},fixTitle:function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var e=this.$element[0];return t.extend({},"function"==typeof e.getBoundingClientRect?e.getBoundingClientRect():{width:e.offsetWidth,height:e.offsetHeight},this.$element.offset())},getTitle:function(){var t,e=this.$element,i=this.options;return t=e.attr("data-original-title")||("function"==typeof i.title?i.title.call(e[0]):i.title)},tip:function(){return this.$tip=this.$tip||t(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(e){var i=e?t(e.currentTarget)[this.type](this._options).data(this.type):this;i.tip().hasClass("in")?i.hide():i.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var i=t.fn.tooltip;t.fn.tooltip=function(i){return this.each(function(){var n=t(this),s=n.data("tooltip"),r="object"==typeof i&&i;s||n.data("tooltip",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.tooltip.Constructor=e,t.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},t.fn.tooltip.noConflict=function(){return t.fn.tooltip=i,this}}(window.jQuery),!function(t){var e=function(t,e){this.init("popover",t,e)};e.prototype=t.extend({},t.fn.tooltip.Constructor.prototype,{constructor:e,setContent:function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();t.find(".popover-title")[this.options.html?"html":"text"](e),t.find(".popover-content")[this.options.html?"html":"text"](i),t.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var t,e=this.$element,i=this.options;return t=("function"==typeof i.content?i.content.call(e[0]):i.content)||e.attr("data-content")},tip:function(){return this.$tip||(this.$tip=t(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var i=t.fn.popover;t.fn.popover=function(i){return this.each(function(){var n=t(this),s=n.data("popover"),r="object"==typeof i&&i;s||n.data("popover",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.popover.Constructor=e,t.fn.popover.defaults=t.extend({},t.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),t.fn.popover.noConflict=function(){return t.fn.popover=i,this}}(window.jQuery),!function(t){function e(e,i){var n,s=t.proxy(this.process,this),r=t(e).is("body")?t(window):t(e);this.options=t.extend({},t.fn.scrollspy.defaults,i),this.$scrollElement=r.on("scroll.scroll-spy.data-api",s),this.selector=(this.options.target||(n=t(e).attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=t("body"),this.refresh(),this.process()}e.prototype={constructor:e,refresh:function(){var e,i=this;this.offsets=t([]),this.targets=t([]),e=this.$body.find(this.selector).map(function(){var e=t(this),n=e.data("target")||e.attr("href"),s=/^#\w/.test(n)&&t(n);return s&&s.length&&[[s.position().top+(!t.isWindow(i.$scrollElement.get(0))&&i.$scrollElement.scrollTop()),n]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){i.offsets.push(this[0]),i.targets.push(this[1])})},process:function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,n=i-this.$scrollElement.height(),s=this.offsets,r=this.targets,o=this.activeTarget;if(e>=n)return o!=(t=r.last()[0])&&this.activate(t);for(t=s.length;t--;)o!=r[t]&&e>=s[t]&&(!s[t+1]||e<=s[t+1])&&this.activate(r[t])},activate:function(e){var i,n;this.activeTarget=e,t(this.selector).parent(".active").removeClass("active"),n=this.selector+'[data-target="'+e+'"],'+this.selector+'[href="'+e+'"]',i=t(n).parent("li").addClass("active"),i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate")}};var i=t.fn.scrollspy;t.fn.scrollspy=function(i){return this.each(function(){var n=t(this),s=n.data("scrollspy"),r="object"==typeof i&&i;s||n.data("scrollspy",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.scrollspy.Constructor=e,t.fn.scrollspy.defaults={offset:10},t.fn.scrollspy.noConflict=function(){return t.fn.scrollspy=i,this},t(window).on("load",function(){t('[data-spy="scroll"]').each(function(){var e=t(this);e.scrollspy(e.data())})})}(window.jQuery),!function(t){var e=function(e){this.element=t(e)};e.prototype={constructor:e,show:function(){var e,i,n,s=this.element,r=s.closest("ul:not(.dropdown-menu)"),o=s.attr("data-target");o||(o=s.attr("href"),o=o&&o.replace(/.*(?=#[^\s]*$)/,"")),s.parent("li").hasClass("active")||(e=r.find(".active:last a")[0],n=t.Event("show",{relatedTarget:e}),s.trigger(n),n.isDefaultPrevented()||(i=t(o),this.activate(s.parent("li"),r),this.activate(i,i.parent(),function(){s.trigger({type:"shown",relatedTarget:e})})))},activate:function(e,i,n){function s(){r.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),e.addClass("active"),o?(e[0].offsetWidth,e.addClass("in")):e.removeClass("fade"),e.parent(".dropdown-menu")&&e.closest("li.dropdown").addClass("active"),n&&n()}var r=i.find("> .active"),o=n&&t.support.transition&&r.hasClass("fade");o?r.one(t.support.transition.end,s):s(),r.removeClass("in")}};var i=t.fn.tab;t.fn.tab=function(i){return this.each(function(){var n=t(this),s=n.data("tab");s||n.data("tab",s=new e(this)),"string"==typeof i&&s[i]()})},t.fn.tab.Constructor=e,t.fn.tab.noConflict=function(){return t.fn.tab=i,this},t(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(e){e.preventDefault(),t(this).tab("show")})}(window.jQuery),!function(t){var e=function(e,i){this.$element=t(e),this.options=t.extend({},t.fn.typeahead.defaults,i),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=t(this.options.menu),this.shown=!1,this.listen()};e.prototype={constructor:e,select:function(){var t=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(t)).change(),this.hide()},updater:function(t){return t},show:function(){var e=t.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:e.top+e.height,left:e.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var e;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(e=t.isFunction(this.source)?this.source(this.query,t.proxy(this.process,this)):this.source,e?this.process(e):this)},process:function(e){var i=this;return e=t.grep(e,function(t){return i.matcher(t)}),e=this.sorter(e),e.length?this.render(e.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(t){return~t.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(t){for(var e,i=[],n=[],s=[];e=t.shift();)e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?n.push(e):s.push(e):i.push(e);return i.concat(n,s)},highlighter:function(t){var e=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return t.replace(new RegExp("("+e+")","ig"),function(t,e){return"<strong>"+e+"</strong>"})},render:function(e){var i=this;return e=t(e).map(function(e,n){return e=t(i.options.item).attr("data-value",n),e.find("a").html(i.highlighter(n)),e[0]}),e.first().addClass("active"),this.$menu.html(e),this},next:function(){var e=this.$menu.find(".active").removeClass("active"),i=e.next();i.length||(i=t(this.$menu.find("li")[0])),i.addClass("active")},prev:function(){var t=this.$menu.find(".active").removeClass("active"),e=t.prev();e.length||(e=this.$menu.find("li").last()),e.addClass("active")},listen:function(){this.$element.on("focus",t.proxy(this.focus,this)).on("blur",t.proxy(this.blur,this)).on("keypress",t.proxy(this.keypress,this)).on("keyup",t.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",t.proxy(this.keydown,this)),this.$menu.on("click",t.proxy(this.click,this)).on("mouseenter","li",t.proxy(this.mouseenter,this)).on("mouseleave","li",t.proxy(this.mouseleave,this))},eventSupported:function(t){var e=t in this.$element;return e||(this.$element.setAttribute(t,"return;"),e="function"==typeof this.$element[t]),e},move:function(t){if(this.shown){switch(t.keyCode){case 9:case 13:case 27:t.preventDefault();break;case 38:t.preventDefault(),this.prev();break;case 40:t.preventDefault(),this.next()}t.stopPropagation()}},keydown:function(e){this.suppressKeyPressRepeat=~t.inArray(e.keyCode,[40,38,9,13,27]),this.move(e)},keypress:function(t){this.suppressKeyPressRepeat||this.move(t)},keyup:function(t){switch(t.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}t.stopPropagation(),t.preventDefault()},focus:function(){this.focused=!0},blur:function(){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(t){t.stopPropagation(),t.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(e){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),t(e.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var i=t.fn.typeahead;t.fn.typeahead=function(i){return this.each(function(){var n=t(this),s=n.data("typeahead"),r="object"==typeof i&&i;s||n.data("typeahead",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},t.fn.typeahead.Constructor=e,t.fn.typeahead.noConflict=function(){return t.fn.typeahead=i,this},t(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(){var e=t(this);e.data("typeahead")||e.typeahead(e.data())})}(window.jQuery),!function(t){var e=function(e,i){this.options=t.extend({},t.fn.affix.defaults,i),this.$window=t(window).on("scroll.affix.data-api",t.proxy(this.checkPosition,this)).on("click.affix.data-api",t.proxy(function(){setTimeout(t.proxy(this.checkPosition,this),1)},this)),this.$element=t(e),this.checkPosition()};e.prototype.checkPosition=function(){if(this.$element.is(":visible")){var e,i=t(document).height(),n=this.$window.scrollTop(),s=this.$element.offset(),r=this.options.offset,o=r.bottom,a=r.top,l="affix affix-top affix-bottom";"object"!=typeof r&&(o=a=r),"function"==typeof a&&(a=r.top()),"function"==typeof o&&(o=r.bottom()),e=null!=this.unpin&&n+this.unpin<=s.top?!1:null!=o&&s.top+this.$element.height()>=i-o?"bottom":null!=a&&a>=n?"top":!1,this.affixed!==e&&(this.affixed=e,this.unpin="bottom"==e?s.top-n:null,this.$element.removeClass(l).addClass("affix"+(e?"-"+e:"")))}};var i=t.fn.affix;t.fn.affix=function(i){return this.each(function(){var n=t(this),s=n.data("affix"),r="object"==typeof i&&i;s||n.data("affix",s=new e(this,r)),"string"==typeof i&&s[i]()})},t.fn.affix.Constructor=e,t.fn.affix.defaults={offset:0},t.fn.affix.noConflict=function(){return t.fn.affix=i,this},t(window).on("load",function(){t('[data-spy="affix"]').each(function(){var e=t(this),i=e.data();i.offset=i.offset||{},i.offsetBottom&&(i.offset.bottom=i.offsetBottom),i.offsetTop&&(i.offset.top=i.offsetTop),e.affix(i)})})}(window.jQuery),define("bootstrap",function(){}),define("app",["jquery","underscore","backbone","util/templar","util/cron","route/index","view/alert","view/primarynav","view/header","view/addmonitor","view/dashboard","view/adddashboard","view/addcategory","view/ecosystem","view/secondarynav","view/settings","model/user","model/dashboard","collection/monitor","collection/dashboard","backbone-mediator","jquery-timepicker","bootstrap"],function(t,e,i,n,s,r,o,a,l,h,c,u,d,p,f,m,g,v,y,b){var x=function(){};return e.extend(x,{initialize:function(){e.bindAll(this),this.auth(),this.alert(),this.primaryNav(),this.header(),this.secondaryNav(),this.addCategory(),i.Mediator.pub("controller:app:init"),this.controllerInit=!0,i.history.start()},addCategory:function(){new d({el:t(".add-category-wrap"),templar:this.templar,user:this.user})},alert:function(){this.auth(),this.alertView=new o({el:t(".alert-wrap"),templar:this.templar})},header:function(){this.auth(),new l({el:t(".header-wrap"),templar:this.templar}).render()},primaryNav:function(){this.auth(),new a({el:t(".primary-nav-wrap"),collection:this.dashboardCollection,user:this.user,templar:this.templar}).render(),new m({el:t(".settings-wrap"),user:this.user,templar:this.templar}).render()},secondaryNav:function(){this.auth(),new f({el:t(".secondary-nav-wrap"),templar:this.templar}).render()},category:function(e,n,s){var r=[];this.auth(),this.destroyViews();var o=new y(null,{dashboardId:e});r.push(new c({el:t(".monitor-panel"),collection:o,dashboardId:e,user:this.user,templar:this.templar,router:this.indexRouter,categoryId:n})),this.renderViews(r),i.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:s,dashboardId:e})},dashboard:function(e,n){var s=[];this.auth(),this.destroyViews();var r=new y(null,{dashboardId:e});s.push(new c({el:t(".monitor-panel"),collection:r,dashboardId:e,user:this.user,templar:this.templar,router:this.indexRouter})),this.renderViews(s),i.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!0},monitorId:n,dashboardId:e})},ecosystem:function(){var e=[];this.auth(),this.destroyViews(),e.push(new p({el:t(".ecosystem-dashboard-wrap"),collection:this.dashboardCollection,templar:this.templar}));var n=new v;e.push(new u({el:t(".add-dashboard-wrap"),templar:this.templar,model:n,collection:this.dashboardCollection,user:this.user})),this.renderViews(e),i.Mediator.pub("controller:dashboard:init",{nav:{dashboard:!1}})},destroyViews:function(){if(this.currentView)for(;this.currentView.length>0;)this.currentView.pop().destructor()},renderViews:function(t){this.currentView=t;for(var e=this.currentView.length-1;e>=0;e--)this.currentView[e].render()},auth:function(){this.indexRouter=this.indexRouter?this.indexRouter:new r({app:this}),this.user=this.user?this.user:new g,this.dashboardCollection=this.dashboardCollection?this.dashboardCollection:new b,this.templar=this.templar?this.templar:new n(["addcategory","adddashboard","addmonitor","alert","dashboard","dashboardtile","deletemonitor","expandedmonitor","header","primarynav","schedulemonitor","secondarynav","setmetrics","settings","smallmonitor"],{url:rearview.path+"/templates/",version:e.isUndefined(rearview.version)?"0.0.1":rearview.version,cache:e.isUndefined(rearview.cache)?!0:!1})}}),x}),require.config({paths:{backbone:"../vendor/backbone/js/backbone","backbone-mediator":"../vendor/backbone/plugins/backbone-mediator/js/backbone-mediator","backbone-localStorage":"../vendor/backbone/plugins/backbone-localStorage/js/backbone-localStorage",bootstrap:"../vendor/bootstrap/js/bootstrap","bootstrap-datepicker":"../vendor/bootstrap/plugins/bootstrap-datepicker/js/bootstrap-datepicker",codemirror:"../vendor/codemirror/lib/codemirror","codemirror-ruby":"../vendor/codemirror/mode/ruby/ruby",handlebars:"../vendor/handlebars/js/handlebars",highcharts:"../vendor/highcharts/js/highcharts","highcharts-theme":"../js/util/highcharts-gray-theme",jquery:"../vendor/jquery/js/jquery","jquery-validate":"../vendor/jquery/plugins/jquery.validate","jquery-ui":"../vendor/jquery/plugins/jquery-ui/js/jquery-ui-1.10.3.custom.min","jquery-timepicker":"../vendor/jquery/plugins/timepicker-ui/js/jquery.timepicker",parsley:"../vendor/parsley/js/parsley",underscore:"../vendor/underscore/js/underscore","underscore-string":"../vendor/underscore/plugins/underscore-string/js/underscore.string",xdate:"../vendor/xdate/js/xdate",timeline:"../vendor/timeline/timeline"},shim:{backbone:{deps:["underscore","jquery"],exports:"Backbone"},"backbone-mediator":{deps:["underscore","backbone"]},"backbone-localStorage":{deps:["backbone"],exports:"Backbone.LocalStorage"},"bootstrap-datepicker":{deps:["bootstrap","jquery"]},codemirror:{exports:"CodeMirror"},"codemirror-ruby":{deps:["codemirror"]},handlebars:{exports:"Handlebars"},"highcharts-theme":{deps:["jquery","highcharts"]},highcharts:{deps:["jquery"],exports:"Highcharts"},jquery:{exports:"$"},"jquery-validate":{deps:["jquery"]},"jquery-ui":{deps:["jquery"]},"jquery-timepicker":{deps:["jquery-ui","jquery"]},parsley:{deps:["jquery"]},timeline:{deps:["xdate"],exports:"timeline"},underscore:{exports:"_"},"underscore-string":{exports:"_.str"}}}),define("main",["app"],function(t){t.initialize()});
@@ -0,0 +1 @@
1
+ define(["underscore"],function(e){var n=function(){};return e.extend(n,{minuteRegex:RegExp(/^[0-9\*\-,\/]+$/),hourRegex:RegExp(/^[0-9\*\-,\/]+$/),dayRegex:RegExp(/^[\?0-9\*\-,\/,LW]+$/i),parsleyValidator:function(n){var i=function(){};return e.extend(i,{validationMinlength:1,validators:{cronfield:function(i,t){var a=null;switch(t){case"day":a=i.match(this.dayRegex);break;case"hour":a=i.match(this.hourRegex);break;case"minute":a=i.match(this.minuteRegex)}return e.isFunction(n)&&(a=n(i,t,a)),null!=a}.bind(this)},messages:{cronfield:"Not a valid value for cron field '%s'"}}),i}}),n});
@@ -1 +1 @@
1
- define(["view/base","model/monitor","codemirror","codemirror-ruby","jquery-validate","parsley"],function(e,t,i){var s=e.extend({scheduleViewInitialized:!1,metricsViewInitialized:!1,scheduleView:!0,el:".add-monitor-wrap",subscriptions:{"view:dashboard:category":"updateDashboardId","view:settings:save":"render"},events:{"click .setMetrics":"advanceToMetrics","click .testGraph":"testMetrics","click .nameSchedule":"backToSchedule","click .saveFinish":"saveFinish","click .back":"exitFullScreen","hide #addMonitor":"modalClose","show #addMonitor":"modalShow","shown #addMonitor":"focusFirst"},initialize:function(e){_.bindAll(this),this.user=e.user,this.dashboardId=e.dashboardId,this.templar=e.templar;var t=_.debounce(this.adjustModalLayout,500);$(window).resize(t),this.render()},render:function(){this.setElement($(".add-monitor-wrap")),this.templar.render({path:"addmonitor",el:this.$el,data:{}}),this.templar.render({path:"schedulemonitor",el:this.$el.find(".content-wrap"),data:{user:this.user.toJSON()}}),this.scheduleViewInitialized=!0,this.setScheduleValidation(),this.$modal=this.$el.find(".add-monitor"),this.resizeModal($("#addMonitor"),"large")},updateDashboardId:function(e){this.dashboardId=e,this.model.set({dashboardId:this.dashboardId})},adjustModalLayout:function(){var e=$("#addMonitor"),t=this.resizeModal(e,"large"),i=325,s=80,r=150,o=80;if(!this.scheduleView){var a=t.body.height-s>i?t.body.height-s:i;e.find(".hero-unit").css({height:a});var n=Math.floor((a-r)/2);this.expressionsMirror.setSize(null,n),this.metricsMirror.setSize(null,n);var d=Math.floor((a-o)/2);e.find(".graph").css({height:d}),this.chart.setSize(null,d),e.find("#outputView").css({height:d})}},advanceToMetrics:function(){this.scheduleForm.parsley("validate")},backToSchedule:function(){this._setupScheduleView()},exitFullScreen:function(){var e=this.$el.find("button.close"),t=this.$el.find("button.back"),i=$(".add-monitor .metrics .CodeMirror"),s=$(".add-monitor .expressions .CodeMirror");e.show(),t.hide(),i.removeClass("fullscreen"),i.data("beforeFullscreen")&&(i.height(i.data("beforeFullscreen").height),i.width(i.data("beforeFullscreen").width)),this.metricsMirror.refresh(),s.removeClass("fullscreen"),s.data("beforeFullscreen")&&(s.height(s.data("beforeFullscreen").height),s.width(s.data("beforeFullscreen").width)),this.expressionsMirror.refresh()},setScheduleValidation:function(){this.scheduleForm=$("#namePagerForm"),this.scheduleForm.parsley({listeners:{onFormSubmit:function(e){e&&(this._setSchedule(),this._setupMetricsView())}.bind(this)}})},setMetricsValidation:function(){$.validator.addMethod("code",function(e,t){var i=$(t).data("CodeMirror");return $(i.getWrapperElement()),this._validateMirror(i)}.bind(this),"This field is required."),$.validator.addMethod("metric-ruby",function(){var e=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(t){"success"==t.status&&(e=!0)}}),e},"Your metrics code does not validate."),$.validator.addMethod("expression-ruby",function(e){var t=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(i){("success"==i.status||""==e)&&(t=!0)}}),t}.bind(this),"Your expression code does not validate."),this.metricsForm=$("#metricsExpressionsForm"),this.metricsForm.validate({rules:{inputMetrics:{code:!0,"expression-ruby":!0},inputExpressions:{"expression-ruby":!0}},errorPlacement:function(e,t){var i=$(t).data("CodeMirror");if(i){var s=$(i.getWrapperElement());this._validateMirror(i),e.insertAfter(s)}else e.insertAfter(t)}.bind(this),highlight:function(e){$(e).closest(".control-group").addClass("error"),$(e).closest("fieldset").addClass("error")},success:function(e){$(e).closest(".control-group").removeClass("error"),$(e).closest("fieldset").removeClass("error"),$(e).remove()},submitHandler:function(){this._saveMonitor(function(){this._closeModal()}.bind(this))}.bind(this)})},testMetrics:function(){this._setMetrics(),$.post("/monitor.json",this.model.toJSON(),function(e){if(e.graph_data){var t=this.formatGraphData(e.graph_data);this.renderGraphData(this.chart,t),$("#outputView").val(e.output)}"error"===e.status&&Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:e.errors,raw:e.output,attention:"Monitor Test Error!",status:"error"})}.bind(this)).error(function(e){Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:e.errors,raw:e.output,attention:"Monitor Test Error!",status:"error"})}.bind(this))},modalClose:function(e){$(e.target).hasClass("add-monitor")&&(e.stopPropagation(),this.metricsViewInitialized&&(this.backToSchedule(),this.metricsViewInitialized=!1),Backbone.Mediator.pub("view:addmonitor:close"))},modalShow:function(){Backbone.Mediator.pub("view:addmonitor:show")},resize:function(){return _.debounce(this.adjustModalLayout,500)},saveFinish:function(){this._setMetrics(),$("#inputMetrics").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),$("#inputExpressions").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),this.metricsForm.submit()},setHelp:function(){var e="";$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(t){e=t}});var t=this.$el.find(".help");t.tooltip({container:".expressions-metrics",trigger:"manual",html:!0,placement:"right",delay:{show:100,hide:200},title:e}).click(function(e){e.stopPropagation(),$(this).tooltip("toggle")})},destructor:function(){this.metricsViewInitialized=!1,this.scheduleViewInitialized=!1,this.metricsMonitorFooter=null,this.scheduleMonitorBody=null,this.scheduleMonitorFooter=null;var e=this.$el.prev();this.$template&&this.$template.off(),this.remove(),this.off(),$("<section class='add-monitor-wrap'></section>").insertAfter(e)},_closeModal:function(){this.$modal.modal("hide")},_getTemplateMetaData:function(e){$.ajax({url:rearview.path+"/monitors/index.json",success:function(t){"function"==typeof e&&e(t)}})},_initCodeMirror:function(){var e=this.$el.find("#inputExpressions")[0],t=".add-monitor .expressions .CodeMirror",s=this.$el.find("#inputMetrics")[0],r=".add-monitor .metrics .CodeMirror",o=this.$el.find("button.close"),a=this.$el.find("button.back");this.expressionsMirror=i.fromTextArea(e,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(e,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),this._toggleFullscreen(t,this.expressionsMirror,o,a)):void 0}.bind(this)}),$(e).data("CodeMirror",this.expressionsMirror),this.metricsMirror=i.fromTextArea(s,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(e,t){return 70==t.keyCode&&t.ctrlKey&&"keydown"==t.type?(t.stop(),this._toggleFullscreen(r,this.metricsMirror,o,a)):void 0}.bind(this)}),$(s).data("CodeMirror",this.metricsMirror)},_initDatePicker:function(){this.fromDatePicker=$("#fromDatePicker").datetimepicker()},_setTemplateSelect:function(e){this.$template=this.$el.find("#selectTemplate"),this.$template.data("template",e),this.$template.on("change",function(){var e=this.$template.data("template");if(this.selectedIndex>0){var t=this.selectedIndex-1,i=e[t];i.path&&$.ajax({url:i.path,success:function(e){i.metrics&&i.metrics.length>0&&this.metricsMirror.setValue(i.metrics.join("\n")),this.expressionsMirror.setValue(e)}.bind(this)})}}.bind(this))},_setSchedule:function(){this.model.set({userId:this.user.get("id"),name:this.$el.find("#monitorName").val(),description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find("#pagerDuty").val()),cronExpr:this._createCronExpr()})},_setMetrics:function(){this.model.set({userId:this.user.get("id"),monitorExpr:this.expressionsMirror.getValue(),metrics:this.metricsMirror.getValue().split("\n"),minutes:parseInt(this.$el.find("#minutesBack").val()),toDate:this.$el.find("#fromDatePicker").val()})},_setupScheduleView:function(){this.metricsMonitorBody=$(".add-monitor .modal-body").detach(),this.metricsMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.scheduleMonitorBody),$(".add-monitor").append(this.scheduleMonitorFooter),this.scheduleView=!0,this.adjustModalLayout()},_setupMetricsView:function(){var e=$(".add-monitor");this.metricsViewInitialized?(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.metricsMonitorBody),$(".add-monitor").append(this.metricsMonitorFooter)):(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),this._getTemplateMetaData(function(t){this.templar.render({path:"setmetrics",el:e,append:!0,data:{monitor:{templates:t}}}),this._setTemplateSelect(t),this._initCodeMirror(),this._initDatePicker(),this.initGraph(e.find(".graph")[0]),this.setHelp(),this.setMetricsValidation(),this.metricsViewInitialized=!0,this.scheduleView=!1,this.adjustModalLayout()}.bind(this)))},_saveMonitor:function(e){this._setMetrics(),this.model.save({id:null,userId:this.user.get("id")},{success:function(i){"function"==typeof e&&e(),Backbone.Mediator.pub("view:addmonitor:save",{model:i,message:"The monitor '"+i.get("name")+"' was added.",attention:"Monitor Saved!",status:"success"}),this.model=new t}.bind(this),error:function(e,t){Backbone.Mediator.pub("view:addmonitor:save",{model:e,tryJSON:t.responseText,attention:"Monitor Save Error!",status:"error"})}})}});return s});
1
+ define(["view/base","model/monitor","codemirror","util/cron","codemirror-ruby","jquery-validate","parsley"],function(e,t,i,r){var s=e.extend({scheduleViewInitialized:!1,metricsViewInitialized:!1,scheduleView:!0,cronScheduleFormValid:!1,cronScheduleWeekdaysSelected:!1,cronScheduleDaysDisabled:!1,namePagerFormValid:!1,el:".add-monitor-wrap",subscriptions:{"view:dashboard:category":"updateDashboardId","view:settings:save":"render"},events:{"click .setMetrics":"advanceToMetrics","click .testGraph":"testMetrics","click .nameSchedule":"backToSchedule","click .saveFinish":"saveFinish","click .back":"exitFullScreen","click #cronScheduleForm .day-month-picker .day-picker button":"cronWeekdayButtonClicked","hide #addMonitor":"modalClose","show #addMonitor":"modalShow","shown #addMonitor":"focusFirst"},initialize:function(e){_.bindAll(this),this.user=e.user,this.dashboardId=e.dashboardId,this.templar=e.templar;var t=_.debounce(this.adjustModalLayout,500);$(window).resize(t),this.render()},render:function(){this.setElement($(".add-monitor-wrap")),this.templar.render({path:"addmonitor",el:this.$el,data:{}}),this.templar.render({path:"schedulemonitor",el:this.$el.find(".content-wrap"),data:{user:this.user.toJSON()}}),this.scheduleViewInitialized=!0,this.setNamePagerValidation(),this.setCronScheduleValidation(),this.setNameScheduleHelp(),this.$modal=this.$el.find(".add-monitor"),this.resizeModal($("#addMonitor"),"large")},updateDashboardId:function(e){this.dashboardId=e,this.model.set({dashboardId:this.dashboardId})},adjustModalLayout:function(){var e=$("#addMonitor"),t=this.resizeModal(e,"large"),i=325,r=80,s=150,o=80;if(!this.scheduleView){var a=t.body.height-r>i?t.body.height-r:i;e.find(".hero-unit").css({height:a});var n=Math.floor((a-s)/2);this.expressionsMirror.setSize(null,n),this.metricsMirror.setSize(null,n);var d=Math.floor((a-o)/2);e.find(".graph").css({height:d}),this.chart.setSize(null,d),e.find("#outputView").css({height:d})}},advanceToMetrics:function(){this.namePagerForm.parsley("validate"),this.cronScheduleForm.parsley("validate"),this.namePagerFormValid&&this.cronScheduleFormValid&&(this._setSchedule(),this._setupMetricsView())},backToSchedule:function(){this._setupScheduleView()},exitFullScreen:function(){var e=this.$el.find("button.close"),t=this.$el.find("button.back"),i=$(".add-monitor .metrics .CodeMirror"),r=$(".add-monitor .expressions .CodeMirror");e.show(),t.hide(),i.removeClass("fullscreen"),i.data("beforeFullscreen")&&(i.height(i.data("beforeFullscreen").height),i.width(i.data("beforeFullscreen").width)),this.metricsMirror.refresh(),r.removeClass("fullscreen"),r.data("beforeFullscreen")&&(r.height(r.data("beforeFullscreen").height),r.width(r.data("beforeFullscreen").width)),this.expressionsMirror.refresh()},setCronScheduleWeekdaysSelected:function(){this.cronScheduleWeekdaysSelected=$("#cronScheduleForm .day-month-picker .day-picker button.active").size()>0},setCronScheduleDaysDisabled:function(e){e?this.cronScheduleDaysDisabled||($("#inputDays").parsley("ParsleyField").reset(),$("#inputDays").val("?"),$("#inputDays").attr("disabled",""),this.cronScheduleDaysDisabled=!0):this.cronScheduleDaysDisabled&&($("#inputDays").val("*"),$("#inputDays").removeAttr("disabled"),this.cronScheduleDaysDisabled=!1)},cronWeekdayButtonClicked:function(e){$(e.target).button("toggle"),this.setCronScheduleWeekdaysSelected(),this.setCronScheduleDaysDisabled(this.cronScheduleWeekdaysSelected)},setNameScheduleHelp:function(){$cronHelpContent="",$alertHelpContent="",$.ajax({url:rearview.path+"/help/cron.html",async:!1,success:function(e){$cronHelpContent=e}}),$.ajax({url:rearview.path+"/help/alert.html",async:!1,success:function(e){$alertHelpContent=e}}),this.$el.find("#cronScheduleForm .set-schedule .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$cronHelpContent}),this.$el.find("#namePagerForm .pager-duty .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$alertHelpContent})},setNamePagerValidation:function(){this.namePagerForm=$("#namePagerForm"),this.namePagerForm.parsley({listeners:{onFormSubmit:function(e){this.namePagerFormValid=e}.bind(this)}})},setCronScheduleValidation:function(){this.cronScheduleForm=$("#cronScheduleForm");var e=r.parsleyValidator();_.extend(e,{errors:{container:function(e,t){var i=$("#cronScheduleFormErrors");return i.append(t),i}},listeners:{onFormSubmit:function(e){this.cronScheduleFormValid=e}.bind(this)}}),this.cronScheduleForm.parsley(e)},setMetricsValidation:function(){$.validator.addMethod("code",function(e,t){var i=$(t).data("CodeMirror");return $(i.getWrapperElement()),this._validateMirror(i)}.bind(this),"This field is required."),$.validator.addMethod("metric-ruby",function(){var e=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(t){"success"==t.status&&(e=!0)}}),e},"Your metrics code does not validate."),$.validator.addMethod("expression-ruby",function(e){var t=!1;return $.ajax({url:"/monitor.json",type:"post",data:this.model.toJSON(),async:!1,success:function(i){("success"==i.status||""==e)&&(t=!0)}}),t}.bind(this),"Your expression code does not validate."),this.metricsForm=$("#metricsExpressionsForm"),this.metricsForm.validate({rules:{inputMetrics:{code:!0,"expression-ruby":!0},inputExpressions:{"expression-ruby":!0}},errorPlacement:function(e,t){var i=$(t).data("CodeMirror");if(i){var r=$(i.getWrapperElement());this._validateMirror(i),e.insertAfter(r)}else e.insertAfter(t)}.bind(this),highlight:function(e){$(e).closest(".control-group").addClass("error"),$(e).closest("fieldset").addClass("error")},success:function(e){$(e).closest(".control-group").removeClass("error"),$(e).closest("fieldset").removeClass("error"),$(e).remove()},submitHandler:function(){this._saveMonitor(function(){this._closeModal()}.bind(this))}.bind(this)})},testMetrics:function(){this._setMetrics(),$.post("/monitor.json",this.model.toJSON(),function(e){if(e.graph_data){var t=this.formatGraphData(e.graph_data);this.renderGraphData(this.chart,t),$("#outputView").val(e.output)}"error"===e.status&&Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:e.errors,raw:e.output,attention:"Monitor Test Error!",status:"error"})}.bind(this)).error(function(e){Backbone.Mediator.pub("view:addmonitor:test",{model:this.model,errors:e.errors,raw:e.output,attention:"Monitor Test Error!",status:"error"})}.bind(this))},modalClose:function(e){$(e.target).hasClass("add-monitor")&&(e.stopPropagation(),this.metricsViewInitialized&&(this.backToSchedule(),this.metricsViewInitialized=!1),Backbone.Mediator.pub("view:addmonitor:close"))},modalShow:function(){Backbone.Mediator.pub("view:addmonitor:show")},resize:function(){return _.debounce(this.adjustModalLayout,500)},saveFinish:function(){this._setMetrics(),$("#inputMetrics").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),$("#inputExpressions").css({"margin-left":"-10000px",left:"-10000px",display:"block",position:"absolute"}),this.metricsForm.submit()},setMetricsHelp:function(){var e="";$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(t){e=t}});var t=this.$el.find(".help");t.tooltip({container:".expressions-metrics",trigger:"manual",html:!0,placement:"right",delay:{show:100,hide:200},title:e}).click(function(e){e.stopPropagation(),$(this).tooltip("toggle")})},destructor:function(){this.metricsViewInitialized=!1,this.scheduleViewInitialized=!1,this.metricsMonitorFooter=null,this.scheduleMonitorBody=null,this.scheduleMonitorFooter=null;var e=this.$el.prev();this.$template&&this.$template.off(),this.remove(),this.off(),$("<section class='add-monitor-wrap'></section>").insertAfter(e)},_closeModal:function(){this.$modal.modal("hide")},_getTemplateMetaData:function(e){$.ajax({url:rearview.path+"/monitors/index.json",success:function(t){"function"==typeof e&&e(t)}})},_initCodeMirror:function(){var e=this.$el.find("#inputExpressions")[0],t=".add-monitor .expressions .CodeMirror",r=this.$el.find("#inputMetrics")[0],s=".add-monitor .metrics .CodeMirror",o=this.$el.find("button.close"),a=this.$el.find("button.back");this.expressionsMirror=i.fromTextArea(e,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(e,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),this._toggleFullscreen(t,this.expressionsMirror,o,a)):void 0}.bind(this)}),$(e).data("CodeMirror",this.expressionsMirror),this.metricsMirror=i.fromTextArea(r,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(e,t){return 70==t.keyCode&&t.ctrlKey&&"keydown"==t.type?(t.stop(),this._toggleFullscreen(s,this.metricsMirror,o,a)):void 0}.bind(this)}),$(r).data("CodeMirror",this.metricsMirror)},_initDatePicker:function(){this.fromDatePicker=$("#fromDatePicker").datetimepicker()},_setTemplateSelect:function(e){this.$template=this.$el.find("#selectTemplate"),this.$template.data("template",e),this.$template.on("change",function(){var e=this.$template.data("template");if(this.selectedIndex>0){var t=this.selectedIndex-1,i=e[t];i.path&&$.ajax({url:i.path,success:function(e){i.metrics&&i.metrics.length>0&&this.metricsMirror.setValue(i.metrics.join("\n")),this.expressionsMirror.setValue(e)}.bind(this)})}}.bind(this))},_setSchedule:function(){this.model.set({userId:this.user.get("id"),name:this.$el.find("#monitorName").val(),description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find("#pagerDuty").val()),cronExpr:this._createCronExpr()})},_setMetrics:function(){this.model.set({userId:this.user.get("id"),monitorExpr:this.expressionsMirror.getValue(),metrics:this.metricsMirror.getValue().split("\n"),minutes:parseInt(this.$el.find("#minutesBack").val()),toDate:this.$el.find("#fromDatePicker").val()})},_setupScheduleView:function(){this.metricsMonitorBody=$(".add-monitor .modal-body").detach(),this.metricsMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.scheduleMonitorBody),$(".add-monitor").append(this.scheduleMonitorFooter),this.scheduleView=!0,this.adjustModalLayout()},_setupMetricsView:function(){var e=$(".add-monitor");this.metricsViewInitialized?(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),$(".add-monitor").append(this.metricsMonitorBody),$(".add-monitor").append(this.metricsMonitorFooter)):(this.scheduleMonitorBody=$(".add-monitor .modal-body").detach(),this.scheduleMonitorFooter=$(".add-monitor .modal-footer").detach(),this._getTemplateMetaData(function(t){this.templar.render({path:"setmetrics",el:e,append:!0,data:{monitor:{templates:t}}}),this._setTemplateSelect(t),this._initCodeMirror(),this._initDatePicker(),this.initGraph(e.find(".graph")[0]),this.setMetricsHelp(),this.setMetricsValidation(),this.metricsViewInitialized=!0,this.scheduleView=!1,this.adjustModalLayout()}.bind(this)))},_saveMonitor:function(e){this._setMetrics(),this.model.save({id:null,userId:this.user.get("id")},{success:function(i){"function"==typeof e&&e(),Backbone.Mediator.pub("view:addmonitor:save",{model:i,message:"The monitor '"+i.get("name")+"' was added.",attention:"Monitor Saved!",status:"success"}),this.model=new t}.bind(this),error:function(e,t){Backbone.Mediator.pub("view:addmonitor:save",{model:e,tryJSON:t.responseText,attention:"Monitor Save Error!",status:"error"})}})}});return s});
@@ -1 +1 @@
1
- define(["view/base","view/deletemonitor","model/monitor"],function(e,t,i){var r=e.extend({events:{"click .name-save":"updateMonitorName","click .schedule-tab":"_setExpandedViewHeight","change #selectPreviousError":"_setErrorDropDown"},subscriptions:{"view:dashboard:init":"exit","view:deletemonitor:delete":"deleteMonitor"},initialize:function(e){_.bindAll(this),this.user=e.user,this.router=e.router,this.templar=e.templar,this.deleteMonitorView=new t({el:$(".delete-monitor-wrap"),templar:this.templar});var i=_.debounce(this._setExpandedViewHeight,500);$(window).resize(i)},render:function(e,t,i,r){this.monitorId=e,this.categories=t,this.categoryId=i,this.dashboardId=r,this.initMonitor()},initMonitor:function(){var e=this;e.getMonitor(e.monitorId,function(t){e.model=t,_.bind(e.updateMonitor,e,e.model),_.each(e.categories,function(t){t.selected=t.id===e.model.get("dashboardId")?!0:!1}),e.getGraphData(e.monitorId,function(){e._initErrorsList(function(t){e.templar.render({path:"expandedmonitor",el:e.$el,data:{monitor:e.model.toJSON(),errors:t,alerts:t,output:e.model.get("output"),categories:e.categories}}),e.$monitor=e.$el.find(".expanded-monitor"),e.$el.html(e.$monitor),e._setAlertsHistory(),e.chart=e.initGraph(e.$monitor.find(".graph")[0]),e._setErrorState(),e.updateGraph(e.model,function(t){e._initializeCodeMirror(),e._initializeDatePicker(".input-from-date"),e._setErrorDropDown(),e._setScheduleData(),e._setEditNameField(),e.$el.find(".save-changes").click({model:e.model},e.updateMonitor),e.$el.find(".cancel-changes").click(function(){e.exit()}),e.$el.find(".test-in-graph button").click({model:new i,output:t},e.testMonitor,e),e.open()},e.formattedGraphData),e.setHelp(),e._setExpandedViewHeight()},e.model)})})},getGraphData:function(e,t){var i=this;$.ajax({url:"/jobs/"+e+"/data",success:function(e){e.graph_data&&(i.formattedGraphData=i.formatGraphData(e.graph_data)),_.isUndefined(t)||t(e)},error:function(e){_.isUndefined(t)||t(e)}})},getMonitor:function(e,t){var r=this;r.model=new i({id:e}),r.model.fetch({success:function(e){_.isUndefined(t)||t(e)}})},getErrorStatus:function(e){var t=!1;switch(e){case"error":t=!0;break;case"failed":t=!0;break;case"graphite_error":t=!0;break;case"graphite_metric_error":t=!0;break;case"security_error":t=!0}return t},setHelp:function(){var e=this,t="";$alertContent="",$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(e){t=e}}),$.ajax({url:rearview.path+"/help/alert.html",async:!1,success:function(e){$alertContent=e}}),e.$el.find(".help:nth-child(2)").tooltip({trigger:"click",html:!0,placement:"right",delay:{show:100,hide:200},title:t}),e.$el.find(".help:nth-child(1)").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$alertContent})},open:function(){this.$el.addClass("active"),Backbone.Mediator.pub("view:expandedmonitor:open",{nav:{back:!0}}),this.router.navigate("dash/"+this.dashboardId+"/expand/"+this.model.get("id"))},exit:function(e){var t=this;t.$el.removeClass("active"),t.model&&t.router.navigate("dash/"+t.model.get("dashboardId")),Backbone.Mediator.pub("view:expandedmonitor:exit",{status:"delete"})},updateGraph:function(e,t,i){var r=this;i?(r.renderGraphData(r.chart,i),"function"==typeof t&&t()):$.ajax({url:"/monitor.json",type:"POST",data:e.toJSON(),success:function(e){if(e.graph_data){var i=r.formatGraphData(e.graph_data);r.renderGraphData(r.chart,i),r.$el.find("textarea.output-view").val(e.output)}"error"===e.status&&Backbone.Mediator.pub("view:expandedmonitor:test",{model:this.model,errors:e.errors,raw:e.output,attention:"Monitor Test Error!",status:"error"}),"function"==typeof t&&t(e.output)},failure:function(){}})},testMonitor:function(e){var t=this,i=e.data.model,r=e.data.output,o=$(e.target);o.button("loading"),i=t._setMetrics(i),i=t._setSchedule(i),t.$el.find("textarea.output-view").val(r),t.$el.find(".output-tab").tab("show"),t.updateGraph(i,function(){o.button("reset")})},viewErrorInGraph:function(e){var t=this,i=e.data.model,r=e.data.output,o=e.data.toDate;i.set("toDate",o),i=t._setMetrics(i,!0),i=t._setSchedule(i),t.$el.find("textarea.output-view").val(r),t.$el.find(".output-tab").tab("show"),t.updateGraph(i)},updateMonitor:function(e){var t=this,i=e.data.model;e.data.test,e.data.toDate,e.data.output,i=t._setMetrics(i),i=t._setSchedule(i),i=t._setSettings(i),i.save(null,{success:function(e){Backbone.Mediator.pub("view:expandedmonitor:save",{model:t.model,message:"The monitor '"+e.get("name")+"' was saved.",attention:"Monitor Saved!",status:"success"}),t.exit(i),t.updateGraph(i)},error:function(e,i){Backbone.Mediator.pub("view:expandedmonitor:save",{model:t.model,tryJSON:i.responseText,attention:"Monitor Saved Error!",status:"error"})}})},deleteMonitor:function(){var e=this;e.model.destroy({success:function(t){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:e.model,message:"The monitor '"+t.get("name")+"' was removed from the current dashboard.",attention:"Monitor Deleted!"})},error:function(t){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:e.model,message:"The monitor '"+t.get("name")+"' produced an error during the process of deletion.",attention:"Monitor Delete Error!",status:"error"})}}),e.exit()},updateMonitorName:function(){var e=this,t=e.$el.find(".name-field");t.prev().html(),e.model.set({name:t.find("input").val()}),t.prev().html(e.model.get("name")),t.hide(),t.prev().show()},resize:function(){var e=this;return _.debounce(e._setExpandedViewHeight,500)},destructor:function(){var e=this,t=e.$el.prev();e.deleteMonitorView.destructor(),e.destroySubscriptions(),e.remove(),e.unbind(),e.off(),t.after("<div class='edit-monitor-wrap clearfix'>")},_setExpandedViewHeight:function(){var e=580,t=6,i=4,r=this.$el.find("#viewMetrics")?this.$el.find("#viewMetrics").height():null;r&&this.$el.find("#viewSchedule, #viewSettings").css({height:r+"px"}),this.$el.find(".output-view").css({height:$(window).height()-e-i+"px"}),this.$el.find(".alerts-history ul").css({height:$(window).height()-e-t+"px"}),this.$el.find(".graph").css({height:$(window).height()-e+"px"});var o=$(window).height()-e>150?$(window).height()-e:150;this.chart&&o>150&&this.chart.setSize(null,o)},_setErrorState:function(){var e=this.getErrorStatus(this.model.get("status"));e?this.$monitor.addClass("red"):this.$monitor.removeClass("red")},_initErrorsList:function(e){var t=this,i=t.model.get("id");$.get("/jobs/"+i+"/errors",function(i){i=_.map(i,function(e){return{label:t.formatServerDateTime(e.date,!0).toString("MM/dd/yyyy HH:mm"),value:e.date,message:e.message,id:e.id}}),e(i)})},_setErrorDropDown:function(){var e=this,t=this.$el.find("#selectPreviousError");if(""!==t.find("option:selected").val()){var i=t.find("option:selected").html();e.fromDatePicker.datetimepicker("setDate",i)}},_setEditNameField:function(){var e=this,t=e.$el.find(".name-field");t.prev().click(function(){t.prev().hide(),t.show(),t.find("input").focus()})},_initializeCodeMirror:function(){var e=this,t=e.$el.find("#inputExpressions")[0],i=e.$el.find("#inputMetrics")[0];e.expressionsMirror=CodeMirror.fromTextArea(t,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(t,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),e._toggleFullscreen(".expanded-monitor .expressions .CodeMirror",e.expressionsMirror)):void 0}}),e.metricsMirror=CodeMirror.fromTextArea(i,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(t,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),e._toggleFullscreen(".expanded-monitor .metrics .CodeMirror",e.metricsMirror)):void 0}})},_initializeDatePicker:function(e){var t=this;t.fromDatePicker=t.$el.find(e).datetimepicker()},_setScheduleData:function(){var e=this,t=e.model.get("cronExpr").split(" ");e.$el.find("#inputSeconds").val(t[0]),e.$el.find("#inputMinutes").val(t[1]),e.$el.find("#inputHours").val(t[2]),e.$el.find("#inputDays").val(t[3]);var i=t[4].split(","),r=t[5].split(",");e._setButtonGroup(e.$el.find(".day-picker button"),r),e._setButtonGroup(e.$el.find(".month-picker button"),i)},_setButtonGroup:function(e,t){e.each(function(e,i){i=$(i);var r=_.indexOf(t,i.attr("data-value"));r>-1&&i.addClass("active")})},_setMetrics:function(e,t){var i=this;return e.set({userId:i.user.get("id"),monitorExpr:i.expressionsMirror.getValue(),metrics:i.metricsMirror.getValue().split("\n"),minutes:parseInt(i.$el.find(".input-minutes-back").val()),toDate:t?e.get("toDate"):i.$el.find(".input-from-date").val()}),e},_setSchedule:function(e){var t=this.$el.find(".monitor-name")[0]?this.$el.find(".monitor-name").val():e.get("name");return e.set({userId:this.user.get("id"),name:t,description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find(".pager-duty textarea").val()),cronExpr:this._createCronExpr()}),e},_setSettings:function(e){return e.set({dashboardId:parseInt(this.$el.find("#selectCategory").val(),10)}),e},_setAlertsHistory:function(){var e=this;e.$monitor.find(".alerts-history ul").delegate("li button","click",function(t){e.viewErrorInGraph({data:{model:new i,test:!0,toDate:$(t.target).attr("data-date")}}),e.fromDatePicker.datetimepicker("setDate",$(t.target).attr("data-date"))})}});return r});
1
+ define(["view/base","view/deletemonitor","model/monitor","util/cron","parsley"],function(e,t,i,r){var o=e.extend({cronScheduleFormValid:!0,cronScheduleWeekdaysSelected:!1,cronScheduleDaysDisabled:!1,events:{"click .name-save":"updateMonitorName","click .schedule-tab":"_setExpandedViewHeight","click #cronScheduleFormEdit .day-month-picker .day-picker button":"cronWeekdayButtonClicked","change #selectPreviousError":"_setErrorDropDown"},subscriptions:{"view:dashboard:init":"exit","view:deletemonitor:delete":"deleteMonitor"},initialize:function(e){_.bindAll(this),this.user=e.user,this.router=e.router,this.templar=e.templar,this.deleteMonitorView=new t({el:$(".delete-monitor-wrap"),templar:this.templar});var i=_.debounce(this._setExpandedViewHeight,500);$(window).resize(i)},render:function(e,t,i,r){this.monitorId=e,this.categories=t,this.categoryId=i,this.dashboardId=r,this.initMonitor()},initMonitor:function(){var e=this;e.getMonitor(e.monitorId,function(t){e.model=t,_.bind(e.updateMonitor,e,e.model),_.each(e.categories,function(t){t.selected=t.id===e.model.get("dashboardId")?!0:!1}),e.getGraphData(e.monitorId,function(){e._initErrorsList(function(t){e.templar.render({path:"expandedmonitor",el:e.$el,data:{monitor:e.model.toJSON(),errors:t,alerts:t,output:e.model.get("output"),categories:e.categories}}),e.$monitor=e.$el.find(".expanded-monitor"),e.$el.html(e.$monitor),e._setAlertsHistory(),e.chart=e.initGraph(e.$monitor.find(".graph")[0]),e._setErrorState(),e.updateGraph(e.model,function(t){e._initializeCodeMirror(),e._initializeDatePicker(".input-from-date"),e._setErrorDropDown(),e._setScheduleData(),e._setEditNameField(),e.$el.find(".save-changes").click({model:e.model},e.updateMonitor),e.$el.find(".cancel-changes").click(function(){e.exit()}),e.$el.find(".test-in-graph button").click({model:new i,output:t},e.testMonitor,e),e.open()},e.formattedGraphData),e.setHelp(),e.setCronScheduleValidation(),e._setExpandedViewHeight()},e.model)})})},setCronScheduleWeekdaysSelected:function(){this.cronScheduleWeekdaysSelected=$("#cronScheduleFormEdit .day-month-picker .day-picker button.active").size()>0},setCronScheduleDaysDisabled:function(e){e?this.cronScheduleDaysDisabled||($("#inputDays").parsley("ParsleyField").reset(),$("#inputDays").val("?"),$("#inputDays").attr("disabled",""),this.cronScheduleDaysDisabled=!0):this.cronScheduleDaysDisabled&&($("#inputDays").val("*"),$("#inputDays").removeAttr("disabled"),this.cronScheduleDaysDisabled=!1)},cronWeekdayButtonClicked:function(e){$(e.target).button("toggle"),this.setCronScheduleWeekdaysSelected(),this.setCronScheduleDaysDisabled(this.cronScheduleWeekdaysSelected)},setCronScheduleValidation:function(){this.cronScheduleForm=$("#cronScheduleFormEdit");var e=r.parsleyValidator();_.extend(e,{errors:{container:function(e,t){var i=$("#cronScheduleFormEditErrors");return i.append(t),i}},listeners:{onFormSubmit:function(e){this.cronScheduleFormValid=e}.bind(this)}}),this.cronScheduleForm.parsley(e)},getGraphData:function(e,t){var i=this;$.ajax({url:"/jobs/"+e+"/data",success:function(e){e.graph_data&&(i.formattedGraphData=i.formatGraphData(e.graph_data)),_.isUndefined(t)||t(e)},error:function(e){_.isUndefined(t)||t(e)}})},getMonitor:function(e,t){var r=this;r.model=new i({id:e}),r.model.fetch({success:function(e){_.isUndefined(t)||t(e)}})},getErrorStatus:function(e){var t=!1;switch(e){case"error":t=!0;break;case"failed":t=!0;break;case"graphite_error":t=!0;break;case"graphite_metric_error":t=!0;break;case"security_error":t=!0}return t},setHelp:function(){var e=this,t="";$alertContent="",$cronHelpContent="",$.ajax({url:rearview.path+"/help/cron.html",async:!1,success:function(e){$cronHelpContent=e}}),$.ajax({url:rearview.path+"/help/quick.html",async:!1,success:function(e){t=e}}),$.ajax({url:rearview.path+"/help/alert.html",async:!1,success:function(e){$alertContent=e}}),e.$el.find("#viewSchedule .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$cronHelpContent}),e.$el.find(".help:nth-child(2)").tooltip({trigger:"click",html:!0,placement:"right",delay:{show:100,hide:200},title:t}),e.$el.find("#viewSettings .monitor-meta .pager-duty .help.label").tooltip({trigger:"click",html:!0,placement:"left",delay:{show:100,hide:200},title:$alertContent})},open:function(){this.$el.addClass("active"),Backbone.Mediator.pub("view:expandedmonitor:open",{nav:{back:!0}}),this.router.navigate("dash/"+this.dashboardId+"/expand/"+this.model.get("id"))},exit:function(e){var t=this;t.$el.removeClass("active"),t.model&&t.router.navigate("dash/"+t.model.get("dashboardId")),Backbone.Mediator.pub("view:expandedmonitor:exit",{status:"delete"})},updateGraph:function(e,t,i){var r=this;i?(r.renderGraphData(r.chart,i),"function"==typeof t&&t()):$.ajax({url:"/monitor.json",type:"POST",data:e.toJSON(),success:function(e){if(e.graph_data){var i=r.formatGraphData(e.graph_data);r.renderGraphData(r.chart,i),r.$el.find("textarea.output-view").val(e.output)}"error"===e.status&&Backbone.Mediator.pub("view:expandedmonitor:test",{model:this.model,errors:e.errors,raw:e.output,attention:"Monitor Test Error!",status:"error"}),"function"==typeof t&&t(e.output)},failure:function(){}})},testMonitor:function(e){var t=this,i=e.data.model,r=e.data.output,o=$(e.target);o.button("loading"),i=t._setMetrics(i),i=t._setSchedule(i),t.$el.find("textarea.output-view").val(r),t.$el.find(".output-tab").tab("show"),t.updateGraph(i,function(){o.button("reset")})},viewErrorInGraph:function(e){var t=this,i=e.data.model,r=e.data.output,o=e.data.toDate;i.set("toDate",o),i=t._setMetrics(i,!0),i=t._setSchedule(i),t.$el.find("textarea.output-view").val(r),t.$el.find(".output-tab").tab("show"),t.updateGraph(i)},updateMonitor:function(e){var t=this,i=e.data.model;e.data.test,e.data.toDate,e.data.output,this.cronScheduleForm.parsley("validate"),this.cronScheduleFormValid&&(i=t._setMetrics(i),i=t._setSchedule(i),i=t._setSettings(i),i.save(null,{success:function(e){Backbone.Mediator.pub("view:expandedmonitor:save",{model:t.model,message:"The monitor '"+e.get("name")+"' was saved.",attention:"Monitor Saved!",status:"success"}),t.exit(i),t.updateGraph(i)},error:function(e,i){Backbone.Mediator.pub("view:expandedmonitor:save",{model:t.model,tryJSON:i.responseText,attention:"Monitor Saved Error!",status:"error"})}}))},deleteMonitor:function(){var e=this;e.model.destroy({success:function(t){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:e.model,message:"The monitor '"+t.get("name")+"' was removed from the current dashboard.",attention:"Monitor Deleted!"})},error:function(t){Backbone.Mediator.pub("view:expandedmonitor:delete",{model:e.model,message:"The monitor '"+t.get("name")+"' produced an error during the process of deletion.",attention:"Monitor Delete Error!",status:"error"})}}),e.exit()},updateMonitorName:function(){var e=this,t=e.$el.find(".name-field");t.prev().html(),e.model.set({name:t.find("input").val()}),t.prev().html(e.model.get("name")),t.hide(),t.prev().show()},resize:function(){var e=this;return _.debounce(e._setExpandedViewHeight,500)},destructor:function(){var e=this,t=e.$el.prev();e.deleteMonitorView.destructor(),e.destroySubscriptions(),e.remove(),e.unbind(),e.off(),t.after("<div class='edit-monitor-wrap clearfix'>")},_setExpandedViewHeight:function(){var e=580,t=6,i=4,r=this.$el.find("#viewMetrics")?this.$el.find("#viewMetrics").height():null;r&&this.$el.find("#viewSchedule, #viewSettings").css({height:r+"px"}),this.$el.find(".output-view").css({height:$(window).height()-e-i+"px"}),this.$el.find(".alerts-history ul").css({height:$(window).height()-e-t+"px"}),this.$el.find(".graph").css({height:$(window).height()-e+"px"});var o=$(window).height()-e>150?$(window).height()-e:150;this.chart&&o>150&&this.chart.setSize(null,o)},_setErrorState:function(){var e=this.getErrorStatus(this.model.get("status"));e?this.$monitor.addClass("red"):this.$monitor.removeClass("red")},_initErrorsList:function(e){var t=this,i=t.model.get("id");$.get("/jobs/"+i+"/errors",function(i){i=_.map(i,function(e){return{label:t.formatServerDateTime(e.date,!0).toString("MM/dd/yyyy HH:mm"),value:e.date,message:e.message,id:e.id}}),e(i)})},_setErrorDropDown:function(){var e=this,t=this.$el.find("#selectPreviousError");if(""!==t.find("option:selected").val()){var i=t.find("option:selected").html();e.fromDatePicker.datetimepicker("setDate",i)}},_setEditNameField:function(){var e=this,t=e.$el.find(".name-field");t.prev().click(function(){t.prev().hide(),t.show(),t.find("input").focus()})},_initializeCodeMirror:function(){var e=this,t=e.$el.find("#inputExpressions")[0],i=e.$el.find("#inputMetrics")[0];e.expressionsMirror=CodeMirror.fromTextArea(t,{value:"",lineNumbers:!0,lineWrapping:!0,height:"100",mode:"ruby",theme:"ambiance",onKeyEvent:function(t,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),e._toggleFullscreen(".expanded-monitor .expressions .CodeMirror",e.expressionsMirror)):void 0}}),e.metricsMirror=CodeMirror.fromTextArea(i,{value:"",lineNumbers:!0,lineWrapping:!0,mode:"ruby",theme:"ambiance",onKeyEvent:function(t,i){return 70==i.keyCode&&i.ctrlKey&&"keydown"==i.type?(i.stop(),e._toggleFullscreen(".expanded-monitor .metrics .CodeMirror",e.metricsMirror)):void 0}})},_initializeDatePicker:function(e){var t=this;t.fromDatePicker=t.$el.find(e).datetimepicker()},_setScheduleData:function(){var e=this,t=e.model.get("cronExpr").split(" ");e.$el.find("#inputSeconds").val(t[0]),e.$el.find("#inputMinutes").val(t[1]),e.$el.find("#inputHours").val(t[2]),e.$el.find("#inputDays").val(t[3]);var i=t[4].split(","),r=t[5].split(",");e._setButtonGroup(e.$el.find(".day-picker button"),r),e._setButtonGroup(e.$el.find(".month-picker button"),i)},_setButtonGroup:function(e,t){e.each(function(e,i){i=$(i);var r=_.indexOf(t,i.attr("data-value"));r>-1&&i.addClass("active")})},_setMetrics:function(e,t){var i=this;return e.set({userId:i.user.get("id"),monitorExpr:i.expressionsMirror.getValue(),metrics:i.metricsMirror.getValue().split("\n"),minutes:parseInt(i.$el.find(".input-minutes-back").val()),toDate:t?e.get("toDate"):i.$el.find(".input-from-date").val()}),e},_setSchedule:function(e){var t=this.$el.find(".monitor-name")[0]?this.$el.find(".monitor-name").val():e.get("name");return e.set({userId:this.user.get("id"),name:t,description:this.$el.find("#description").val(),alertKeys:this.parseAlertKeys(this.$el.find(".pager-duty textarea").val()),cronExpr:this._createCronExpr()}),e},_setSettings:function(e){return e.set({dashboardId:parseInt(this.$el.find("#selectCategory").val(),10)}),e},_setAlertsHistory:function(){var e=this;e.$monitor.find(".alerts-history ul").delegate("li button","click",function(t){e.viewErrorInGraph({data:{model:new i,test:!0,toDate:$(t.target).attr("data-date")}}),e.fromDatePicker.datetimepicker("setDate",$(t.target).attr("data-date"))})}});return o});
@@ -109,6 +109,12 @@ input, button, select, textarea {
109
109
 
110
110
  @import "header.less";
111
111
 
112
+ input.parsley-error {
113
+ background-color: #F2DEDE !important;
114
+ border: 1px solid #EED3D7 !important;
115
+ color: #B94A48 !important;
116
+ }
117
+
112
118
  /* alert timeline styles */
113
119
  .alert-timeline {
114
120
  position : relative;
@@ -879,18 +885,64 @@ input, button, select, textarea {
879
885
  }
880
886
  }
881
887
 
888
+ .add-monitor {
889
+ input[disabled] {
890
+ background-color: #EEEEEE;
891
+ cursor: not-allowed;
892
+ }
893
+ .help.label {
894
+ float : right;
895
+ cursor : pointer;
896
+ }
897
+ .tooltip {
898
+ text-transform : none;
899
+
900
+ .tooltip-inner {
901
+ max-width : 500px;
902
+ text-align : left;
903
+ .proxima-regular(12px);
904
+
905
+ table {
906
+ margin : 5px 0;
907
+ text-align : left;
908
+
909
+ tr:nth-child(even) {
910
+ background : #333
911
+ }
912
+
913
+ th {
914
+ padding : 2px;
915
+ width : 200px;
916
+ vertical-align : top;
917
+ font-weight : normal;
918
+ }
919
+ td {
920
+ padding : 2px;
921
+ width : 480px;
922
+ vertical-align : top;
923
+ }
924
+ }
882
925
 
926
+ .cron-help-details {
927
+ text-align : left;
928
+ }
929
+ }
930
+ }
931
+ .tooltip.in {
932
+ opacity : 0.9 !important;
933
+ }
934
+ }
883
935
 
884
936
  .metrics-schedule {
885
937
  .expressions textarea {
886
938
  width : 396px;
887
939
  min-height : 200px;
888
940
  }
889
-
890
941
  .metrics-test .metrics textarea {
891
942
  width : 459px;
892
943
  }
893
944
  }
945
+
894
946
  /* add monitor code mirrors */
895
947
  .CodeMirror.error {
896
948
  border-color : #B94A48 !important;
@@ -985,6 +1037,12 @@ input, button, select, textarea {
985
1037
 
986
1038
  /* edit monitor styles */
987
1039
  .metrics-schedule {
1040
+
1041
+ input[disabled] {
1042
+ background-color: #7E8079;
1043
+ cursor: not-allowed;
1044
+ }
1045
+
988
1046
  .metrics .CodeMirror,
989
1047
  .expressions .CodeMirror {
990
1048
  border-radius : 3px;
@@ -1018,7 +1076,7 @@ input, button, select, textarea {
1018
1076
 
1019
1077
  .tooltip-inner {
1020
1078
  max-width : 500px;
1021
-
1079
+ text-align : left;
1022
1080
  .proxima-regular(12px);
1023
1081
 
1024
1082
  table {
@@ -1046,6 +1104,10 @@ input, button, select, textarea {
1046
1104
  .tooltip.in {
1047
1105
  opacity : 0.9 !important;
1048
1106
  }
1107
+ .parsley-error-list li {
1108
+ font-weight : bold;
1109
+ font-size : larger;
1110
+ }
1049
1111
  }
1050
1112
 
1051
1113
  /* ecosystem styles (application tiles, etc.) */